auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public double getMaxSpeed(RoadClass roadClass, TransportationMode transport, double currentMaxSpeed) { if (currentMaxSpeed > 0 || transport != TransportationMode.MOTOR_VEHICLE) { return currentMaxSpeed; } switch (roadClass) { case MOTORWAY: case TRUNK: return Integer.MAX_VALUE; case PRIMARY: return 100; case SECONDARY: return 100; case TERTIARY: return 100; case UNCLASSIFIED: return 100; case RESIDENTIAL: return 100; case LIVING_STREET: return 4; default: return -1; } }

Target:
public double getMaxSpeed(RoadClass roadClass, TransportationMode transport, double currentMaxSpeed) { if (currentMaxSpeed > 0 || transport != TransportationMode.MOTOR_VEHICLE) { return currentMaxSpeed; } switch (roadClass) { case MOTORWAY: case TRUNK: return MaxSpeed.UNLIMITED_SIGN_SPEED; case PRIMARY: return 100; case SECONDARY: return 100; case TERTIARY: return 100; case UNCLASSIFIED: return 100; case RESIDENTIAL: return 100; case LIVING_STREET: return 4; default: return -1; } }
Source:
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mAllergenDao = Utils.getAppDaoSession(getActivity()).getAllergenDao(); mAllergensFromDao = mAllergenDao.loadAll(); api = new OpenFoodAPIClient(getActivity()); mView = view; mSettings = getActivity().getSharedPreferences("prefs", 0); boolean firstRunAlert = mSettings.getBoolean("firstRunAlert", true); if (firstRunAlert) { new MaterialDialog.Builder(getContext()) .title(R.string.alert_dialog_warning_title) .content(R.string.warning_alert_data) .positiveText(R.string.ok_button) .show(); SharedPreferences.Editor editor = mSettings.edit(); editor.putBoolean("firstRunAlert", false); editor.apply(); } mRvAllergens = (RecyclerView) view.findViewById(R.id.alergens_recycle); mAllergensEnabled = mAllergenDao.queryBuilder().where(AllergenDao.Properties.Enable.eq("true")).list(); mAdapter = new AllergensAdapter(sortedAllergensList(), getActivity()); Log.e("mAllergensEnabled: ", mAllergensEnabled.toString()); Log.e("mAllergensFromDao: ", mAllergensFromDao.toString()); mRvAllergens.setAdapter(mAdapter); mRvAllergens.setLayoutManager(new LinearLayoutManager(view.getContext())); mRvAllergens.setHasFixedSize(true); }

Target:
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mAllergenDao = Utils.getAppDaoSession(getActivity()).getAllergenDao(); mAllergensFromDao = mAllergenDao.loadAll(); api = new OpenFoodAPIClient(getActivity()); mView = view; mSettings = getActivity().getSharedPreferences("prefs", 0); boolean firstRunAlert = mSettings.getBoolean("firstRunAlert", true); if (firstRunAlert) { new MaterialDialog.Builder(getContext()) .title(R.string.alert_dialog_warning_title) .content(R.string.warning_alert_data) .positiveText(R.string.ok_button) .show(); SharedPreferences.Editor editor = mSettings.edit(); editor.putBoolean("firstRunAlert", false); editor.apply(); } mRvAllergens = (RecyclerView) view.findViewById(R.id.alergens_recycle); mAllergensEnabled = mAllergenDao.queryBuilder().where(AllergenDao.Properties.Enable.eq("true")).list(); mAdapter = new AllergensAdapter(sortedAllergensList(), getActivity()); mRvAllergens.setAdapter(mAdapter); mRvAllergens.setLayoutManager(new LinearLayoutManager(view.getContext())); mRvAllergens.setHasFixedSize(true); }
Source:
private void fixArray() { AtomicIntegerArray s = this.data; AtomicIntegerArray d = this.data = new AtomicIntegerArray(PAGE_SIZE * ( worldHeight = Bukkit.getWorld(worldUid).getMaxHeight() )); int end = Math.max(s.length(), d.length()); while (end-- > 0) { d.set(end, s.get(end)); } }

Target:
private void fixArray() { AtomicIntegerArray old = this.data; AtomicIntegerArray current = this.data = new AtomicIntegerArray(PAGE_SIZE * ( worldHeight = Bukkit.getWorld(worldUid).getMaxHeight() )); int end = Math.min(current.length(), old.length()); while (end-- > 0) { current.set(end, old.get(end)); } }
Source:
private Long sizeInternal() { return cache.values().stream().mapToLong(value -> value.size()).sum(); }

Target:
private Long sizeInternal() { return cache.values().parallelStream().mapToLong(value -> value.size()).sum(); }
Source:
public String enqueueSynchronizeTimeRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, @Identification final SynchronizeTimeReadsRequest requestData) throws FunctionalException { LOGGER.debug("enqueueSynchronizeTimeReadsRequest called with organisation and device {}", organisationIdentification, deviceIdentification); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final SmartMeteringRequestMessage message = new SmartMeteringRequestMessage( SmartMeteringRequestMessageType.REQUEST_PERIODIC_METER_DATA, correlationUid, organisationIdentification, deviceIdentification, requestData); this.smartMeteringRequestMessageSender.send(message); return correlationUid; }

Target:
public String enqueueSynchronizeTimeRequest(@Identification final String organisationIdentification, @Identification final String deviceIdentification, @Identification final SynchronizeTimeReadsRequest requestData) throws FunctionalException { LOGGER.debug("enqueueSynchronizeTimeReadsRequest called with organisation and device {}", organisationIdentification, deviceIdentification); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final SmartMeteringRequestMessage message = new SmartMeteringRequestMessage( SmartMeteringRequestMessageType.REQUEST_SYNCHRONIZE_TIME, correlationUid, organisationIdentification, deviceIdentification, requestData); this.smartMeteringRequestMessageSender.send(message); return correlationUid; }
Source:
private Object createHelper() { preValidate(); Object key = KEY_FACTORY.newInstance((superclass != null) ? superclass.getName() : null, ReflectUtils.getNames(interfaces), filter == ALL_ZERO ? null : new WeakCacheKey<CallbackFilter>(filter), callbackTypes, useFactory, interceptDuringConstruction, serialVersionUID); this.currentKey = key; return super.create(key); }

Target:
private Object createHelper() { preValidate(); Object key = KEY_FACTORY.newInstance((superclass != null) ? superclass.getName() : null, ReflectUtils.getNames(interfaces), filter == ALL_ZERO ? null : new WeakCacheKey<CallbackFilter>(filter), callbackTypes, useFactory, interceptDuringConstruction, serialVersionUID); this.currentKey = key; Object result = super.create(key); return result; }
Source:
protected void setScrollBar( final GuiScrollbar myScrollBar ) { this.myScrollBar = myScrollBar; }

Target:
protected void setScrollBar( final GuiScrollbar myScrollBar ) { this.scrollBar = myScrollBar; }
Source:
public void simpleMultiKeyTest() { InMemSpillableStateStore store = new InMemSpillableStateStore(); useSharedBuffer = false; simpleMultiKeyTestHelper(store); store = new InMemSpillableStateStore(); useSharedBuffer = true; simpleMultiKeyTestHelper(store); }

Target:
public void simpleMultiKeyTest() { InMemSpillableStateStore store = new InMemSpillableStateStore(); simpleMultiKeyTestHelper(store); }
Source:
public void testCache() throws Exception { mockStatic(FileSystem.class); Configuration conf = new Configuration(); JobPath jobPath = new JobPath("foo", "bar", "/baz"); FileSystem mockFileSystem = mock(FileSystem.class); when(FileSystem.get(eq(jobPath.toUri()), any())).thenReturn(mockFileSystem); assertEquals(mockFileSystem, jobPath.getFileSystem(conf)); verifyStatic(times(1)); FileSystem.get(eq(jobPath.toUri()), any()); assertEquals(mockFileSystem, jobPath.getFileSystem(conf)); verifyStatic(times(1)); FileSystem.get(eq(jobPath.toUri()), any()); conf.set(PropertyKey.USER_FILE_READ_TYPE_DEFAULT.toString(), ReadType.NO_CACHE.toString()); assertEquals(mockFileSystem, jobPath.getFileSystem(conf)); verifyStatic(times(2)); FileSystem.get(eq(jobPath.toUri()), any()); conf.set("foo", "bar"); assertEquals(mockFileSystem, jobPath.getFileSystem(conf)); verifyStatic(times(2)); FileSystem.get(eq(jobPath.toUri()), any()); }

Target:
public void testCache() throws Exception { mockStatic(FileSystem.class); Configuration conf = new Configuration(); JobPath jobPath = new JobPath("foo", "bar", "/baz"); when(FileSystem.get(any(), any())).thenAnswer((p) -> mock(FileSystem.class)); FileSystem fileSystem = jobPath.getFileSystem(conf); verifyStatic(times(1)); FileSystem.get(any(), any()); assertEquals(fileSystem, jobPath.getFileSystem(conf)); verifyStatic(times(1)); FileSystem.get(any(), any()); conf.set(PropertyKey.USER_FILE_READ_TYPE_DEFAULT.toString(), ReadType.NO_CACHE.toString()); FileSystem newFileSystem = jobPath.getFileSystem(conf); assertNotEquals(fileSystem, newFileSystem); verifyStatic(times(2)); FileSystem.get(any(), any()); conf.set("foo", "bar"); assertEquals(newFileSystem, jobPath.getFileSystem(conf)); verifyStatic(times(2)); FileSystem.get(any(), any()); jobPath = new JobPath("foo", "bar", "/bar"); assertEquals(newFileSystem, jobPath.getFileSystem(conf)); verifyStatic(times(2)); FileSystem.get(any(), any()); jobPath = new JobPath("foo", "baz", "/bar"); assertNotEquals(newFileSystem, jobPath.getFileSystem(conf)); verifyStatic(times(3)); FileSystem.get(any(), any()); jobPath = new JobPath("bar", "bar", "/bar"); assertNotEquals(newFileSystem, jobPath.getFileSystem(conf)); verifyStatic(times(4)); FileSystem.get(any(), any()); }
Source:
public static String EvtGetExtendedStatus() { int errorCode; IntByReference buffUsed = new IntByReference(); errorCode = Wevtapi.INSTANCE.EvtGetExtendedStatus(0, null, buffUsed); if (errorCode != WinError.ERROR_SUCCESS && errorCode != WinError.ERROR_INSUFFICIENT_BUFFER) { throw new Win32Exception(errorCode); } if (buffUsed.getValue() == 0) { return ""; } Memory mem = new Memory(buffUsed.getValue() * 2); errorCode = Wevtapi.INSTANCE.EvtGetExtendedStatus((int) mem.size(), mem, buffUsed); if (errorCode != WinError.ERROR_SUCCESS) { throw new Win32Exception(errorCode); } return mem.getWideString(0); }

Target:
public static String EvtGetExtendedStatus() { int errorCode; IntByReference buffUsed = new IntByReference(); errorCode = Wevtapi.INSTANCE.EvtGetExtendedStatus(0, null, buffUsed); if (errorCode != WinError.ERROR_SUCCESS && errorCode != WinError.ERROR_INSUFFICIENT_BUFFER) { throw new Win32Exception(errorCode); } if (buffUsed.getValue() == 0) { return ""; } char[] mem = new char[buffUsed.getValue()]; errorCode = Wevtapi.INSTANCE.EvtGetExtendedStatus(mem.length, mem, buffUsed); if (errorCode != WinError.ERROR_SUCCESS) { throw new Win32Exception(errorCode); } return Native.toString(mem); }
Source:
private void checkEventsMappedToWsSchema(final List<Event> originalEvents, final List<com.alliander.osgp.adapter.ws.schema.smartmetering.management.Event> mappedEvents) { assertEquals("number of events", originalEvents.size(), mappedEvents.size()); for (int i = 0; i < originalEvents.size(); i++) { final Event originalEvent = originalEvents.get(i); final com.alliander.osgp.adapter.ws.schema.smartmetering.management.Event mappedEvent = mappedEvents.get(i); assertEquals("eventCode with mapping of " + originalEvent, originalEvent.getEventCode().intValue(), EventType.valueOf(mappedEvent.getEventType().name()).getValue()); assertEquals("eventCounter with mapping of " + originalEvent, originalEvent.getEventCounter(), mappedEvent.getEventCounter()); assertEquals("timestamp with mapping of " + originalEvent, originalEvent.getTimestamp().toString(), new DateTime(mappedEvent.getTimestamp().toGregorianCalendar()).toString()); } }

Target:
private void checkEventsMappedToWsSchema(final List<Event> originalEvents, final List<com.alliander.osgp.adapter.ws.schema.smartmetering.management.Event> mappedEvents) { assertEquals(NUMBER_OF_EVENTS, originalEvents.size(), mappedEvents.size()); for (int i = 0; i < originalEvents.size(); i++) { final Event originalEvent = originalEvents.get(i); final com.alliander.osgp.adapter.ws.schema.smartmetering.management.Event mappedEvent = mappedEvents.get(i); assertEquals(EVENT_CODE_WITH_MAPPING_OF + originalEvent, originalEvent.getEventCode().intValue(), EventType.valueOf(mappedEvent.getEventType().name()).getValue()); assertEquals(EVENT_COUNTER_WITH_MAPPING_OF + originalEvent, originalEvent.getEventCounter(), mappedEvent.getEventCounter()); assertEquals(TIMESTAMP_WITH_MAPPING_OF + originalEvent, originalEvent.getTimestamp().toString(), new DateTime(mappedEvent.getTimestamp().toGregorianCalendar()).toString()); } }
Source:
public void disableReadWriteConflict(TableReference tableRef) { conflictHandlers.compute(tableRef, (tableReference, nullableCurrentValue) -> { ConflictHandler conflictHandler = delegate.get(tableReference); Preconditions.checkNotNull(conflictHandler, "Conflict handler cannot be null when overwriting"); Optional<ConflictHandler> newValue = Optional.of( getDisabledReadWriteConflictHandler(conflictHandler)); Preconditions.checkState(nullableCurrentValue == null || nullableCurrentValue.equals(newValue), "Cannot overwrite conflict behaviour after transaction already started"); return newValue; }); }

Target:
public void disableReadWriteConflict(TableReference tableRef) { conflictHandlers.compute(tableRef, (tableReference, nullableCurrentValue) -> { ConflictHandler conflictHandler = delegate.get(tableReference); Preconditions.checkNotNull(conflictHandler, "Conflict handler cannot be null when overwriting"); Optional<ConflictHandler> newValue = Optional.of( getDisabledReadWriteConflictHandler(conflictHandler)); Preconditions.checkState(nullableCurrentValue == null || nullableCurrentValue.equals(newValue), "Cannot overwrite conflict behaviour after the table has already been used"); return newValue; }); }
Source:
public boolean inputsAreConnected() { for (int i = 0; i < getInputs().length; i++) { if (!inputIsConnected(i)) { return false; } } return true; }

Target:
public boolean inputsAreConnected() { return inputs.stream().allMatch(ConnectionAnchor::isConnected); }
Source:
private void checkDownNodesAndReacquireNodesIfNeeded() { int numberOfNodesToDeploy = 0; for (Node downNode : this.nodeSource.getDownNodes()) { String nodeUrl = downNode.getNodeInformation().getURL(); logger.info("Removing down node " + nodeUrl); BooleanWrapper removed = this.nodeSource.getRMCore().removeNode(nodeUrl, true); if (removed.getBooleanValue()) { logger.info("Down node removed " + nodeUrl); numberOfNodesToDeploy++; } } for (RMDeployingNode lostNode : this.nodeSource.getDeployingAndLostNodes()) { if (!lostNode.isLost()) { continue; } String nodeUrl = lostNode.getNodeURL(); logger.info("Removing lost node " + nodeUrl); BooleanWrapper removed = this.nodeSource.getRMCore().removeNode(nodeUrl, true); if (removed.getBooleanValue()) { logger.info("Lost node removed " + nodeUrl); numberOfNodesToDeploy++; } } if (numberOfNodesToDeploy > 0) { logger.info("Acquiring " + numberOfNodesToDeploy + " nodes"); acquireNodes(numberOfNodesToDeploy); } }

Target:
private void checkDownNodesAndReacquireNodesIfNeeded() { long numberOfNodesToDeploy = this.nodeSource.getDownNodes() .stream() .map(node -> node.getNodeInformation().getURL()) .peek(nodeUrl -> logger.info("Removing down node " + nodeUrl)) .map(nodeUrl -> this.nodeSource.getRMCore().removeNode(nodeUrl, true)) .filter(BooleanWrapper::getBooleanValue) .peek(x -> logger.info("Down node removed")) .count(); numberOfNodesToDeploy += this.nodeSource.getDeployingAndLostNodes() .stream() .filter(RMDeployingNode::isLost) .map(RMDeployingNode::getNodeURL) .peek(nodeUrl -> logger.info("Removing lost node " + nodeUrl)) .map(nodeUrl -> this.nodeSource.getRMCore().removeNode(nodeUrl, true)) .filter(BooleanWrapper::getBooleanValue) .peek(x -> logger.info("Lost node removed")) .count(); if (numberOfNodesToDeploy > 0) { logger.info("Acquiring " + numberOfNodesToDeploy + " nodes"); acquireNodes((int) numberOfNodesToDeploy); } }
Source:
private HashMap<UUID, ClusteredTopDocs> broadcastQuery(ClusteredQueryCommand command) { ClusteredQueryInvoker invoker = new ClusteredQueryInvoker(cache, asyncExecutor); HashMap<UUID, ClusteredTopDocs> topDocsResponses = new HashMap<>(); int resultSize = 0; List<QueryResponse> responses = invoker.broadcast(command); for (QueryResponse queryResponse : responses) { if (queryResponse.getResultSize() > 0) { ClusteredTopDocs topDocs = new ClusteredTopDocs(queryResponse.getTopDocs(), queryResponse.getNodeUUID()); resultSize += queryResponse.getResultSize(); topDocs.setNodeAddress(queryResponse.getAddress()); topDocsResponses.put(queryResponse.getNodeUUID(), topDocs); } } this.resultSize = resultSize; return topDocsResponses; }

Target:
private HashMap<UUID, ClusteredTopDocs> broadcastQuery(ClusteredQueryCommand command) { ClusteredQueryInvoker invoker = new ClusteredQueryInvoker(cache, asyncExecutor); HashMap<UUID, ClusteredTopDocs> topDocsResponses = new HashMap<>(); int resultSize = 0; List<QueryResponse> responses = invoker.broadcast(command); for (QueryResponse queryResponse : responses) { if (queryResponse.nonEmpty()) { topDocsResponses.put(queryResponse.getNodeUUID(), queryResponse.toClusteredTopDocs()); resultSize += queryResponse.getResultSize(); } } this.resultSize = resultSize; return topDocsResponses; }
Source:
public ResponseEntity<?> renewForgotPassword(@RequestBody RenewForgotPasswordDTO renewForgotPassDTO) { String code = renewForgotPassDTO.getCode(); String newPassword = renewForgotPassDTO.getNp(); if (code == null || code.isEmpty()) { throw new BadRequestException("Invalid request!"); } else if (newPassword == null || newPassword.isEmpty()) { throw new BadRequestException("Invalid request!"); } else if (newPassword.length() < 8) { throw new BadRequestException("Password should have at least 8 characters!"); } ForgotPassword forgotPassword = forgotPasswordDao.findByCode(code); if (forgotPassword == null) { throw new BadRequestException("Invalid renew attempt!"); } AppUser appUser = forgotPassword.getUser(); if (appUser == null) { throw new BadRequestException("Invalid user!"); } String newPasswordEncrypted = passwordEncrypt.encryptPassword(newPassword); appUser.setPassword(newPasswordEncrypted); appUser.setForgotPassword(null); appUserDao.saveAndFlush(appUser); forgotPasswordDao.delete(forgotPassword.getId()); return new ResponseEntity<>(HttpStatus.OK); }

Target:
public ResponseEntity<?> renewForgotPassword(@RequestBody RenewForgotPasswordDTO renewForgotPassDTO) { String code = renewForgotPassDTO.getCode(); String newPassword = renewForgotPassDTO.getNp(); if (code == null || code.isEmpty()) { throw new BadRequestException("Invalid request!"); } else if (newPassword == null || newPassword.isEmpty()) { throw new BadRequestException("Invalid request!"); } else if (newPassword.length() < 8) { throw new BadRequestException("Password should have at least 8 characters!"); } ForgotPassword forgotPassword = forgotPasswordDao.findByCode(code); if (forgotPassword == null) { throw new BadRequestException("Invalid renew attempt!"); } AppUser appUser = forgotPassword.getUser(); if (appUser == null) { throw new BadRequestException("Invalid user!"); } String newPasswordEncrypted = passwordEncrypt.encryptPassword(newPassword); appUser.setPassword(newPasswordEncrypted); appUser.setForgotPassword(null); appUserDao.saveAndFlush(appUser); return new ResponseEntity<>(HttpStatus.OK); }
Source:
public String next() throws IOException { if (iseof) return null; for (; ;) { if (curr_off == 0 || !less64(curr_off, off[i].v)) { if (i == off.length - 1) break; if (i >= 0) assert (curr_off == off[i].v); if (i < 0 || off[i].v != off[i + 1].u) { mFp.seek(off[i + 1].u); curr_off = mFp.getFilePointer(); } ++i; } String s; if ((s = readLine(mFp,TabixReader.this.longestLineLength)) != null) { TabixReader.this.longestLineLength = Math.max(s.length(), TabixReader.this.longestLineLength); TIntv intv; curr_off = mFp.getFilePointer(); if (s.isEmpty() || s.charAt(0) == mMeta) continue; intv = getIntv(s); if (intv.tid != tid || intv.beg >= end) break; else if (intv.end > beg && intv.beg < end) return s; } else break; } iseof = true; return null; }

Target:
public String next() throws IOException { if (iseof) return null; for (; ;) { if (curr_off == 0 || !less64(curr_off, off[i].v)) { if (i == off.length - 1) break; if (i >= 0) assert (curr_off == off[i].v); if (i < 0 || off[i].v != off[i + 1].u) { mFp.seek(off[i + 1].u); curr_off = mFp.getFilePointer(); } ++i; } String s; if ((s = readLine(mFp, DEFAULT_BUFFER_SIZE)) != null) { TIntv intv; curr_off = mFp.getFilePointer(); if (s.isEmpty() || s.charAt(0) == mMeta) continue; intv = getIntv(s); if (intv.tid != tid || intv.beg >= end) break; else if (intv.end > beg && intv.beg < end) return s; } else break; } iseof = true; return null; }
Source:
public void onWorldLoad(WorldEvent.Load evt) { if (!(evt.getWorld().getWorldType() instanceof ICubicWorldType)) { return; } CubicChunks.LOGGER.info("Initializing world " + evt.getWorld() + " with type " + evt.getWorld().getWorldType()); ICubicWorld world = (ICubicWorld) evt.getWorld(); WorldType type = evt.getWorld().getWorldType(); if (type instanceof ICubicWorldType) { WorldProvider provider = ((ICubicWorldType) type).getReplacedProviderFor(world.getProvider()); ReflectionUtil.setFieldValueSrg(world, "field_73011_w", provider); } int minHeight = 0; int maxHeight = 255; WorldSavedDataHeightBounds heightBounds = null; if (!world.isRemote()) { heightBounds = (WorldSavedDataHeightBounds) evt.getWorld().getMapStorage().getOrLoadData(WorldSavedDataHeightBounds.class, "heightBounds"); if (heightBounds == null) { heightBounds = new WorldSavedDataHeightBounds("heightBounds"); } minHeight = heightBounds.minHeight; maxHeight = heightBounds.maxHeight; } else { Iterator<IMessage> iIMessage = ClientHandler.getInstance().delayedPackets.iterator(); while (iIMessage.hasNext()) { IMessage iMessage = iIMessage.next(); if (iMessage instanceof PacketWorldHeightBounds) { minHeight = ((PacketWorldHeightBounds) iMessage).getMinHeight(); maxHeight = ((PacketWorldHeightBounds) iMessage).getMaxHeight(); iIMessage.remove(); break; } } } world.initCubicWorld(minHeight, maxHeight); if (!world.isRemote()) { heightBounds.markDirty(); evt.getWorld().getMapStorage().setData("heightBounds", heightBounds); evt.getWorld().getMapStorage().saveAllData(); SpawnCubes.update(world); } }

Target:
public void onWorldLoad(WorldEvent.Load evt) { if (!(evt.getWorld().getWorldType() instanceof ICubicWorldType)) { return; } CubicChunks.LOGGER.info("Initializing world " + evt.getWorld() + " with type " + evt.getWorld().getWorldType()); ICubicWorld world = (ICubicWorld) evt.getWorld(); WorldType type = evt.getWorld().getWorldType(); if (type instanceof ICubicWorldType) { WorldProvider provider = ((ICubicWorldType) type).getReplacedProviderFor(world.getProvider()); ReflectionUtil.setFieldValueSrg(world, "field_73011_w", provider); } int minHeight = 0; int maxHeight = 255; WorldSavedDataHeightBounds heightBounds = null; if (!world.isRemote()) { heightBounds = (WorldSavedDataHeightBounds) evt.getWorld().getMapStorage().getOrLoadData(WorldSavedDataHeightBounds.class, "heightBounds"); if (heightBounds == null) { heightBounds = new WorldSavedDataHeightBounds("heightBounds"); } minHeight = heightBounds.minHeight; maxHeight = heightBounds.maxHeight; } world.initCubicWorld(minHeight, maxHeight); if (!world.isRemote()) { heightBounds.markDirty(); evt.getWorld().getMapStorage().setData("heightBounds", heightBounds); evt.getWorld().getMapStorage().saveAllData(); SpawnCubes.update(world); } }
Source:
public CidrContainer(String cidr) { super(); this.cidr = cidr; }

Target:
public CidrContainer(String cidr) { this.cidr = cidr; }
Source:
public void testUnmatchedVersionQuery() throws Exception { setupForTest(); String testVersionName = ""; for (String versionName : expectedVersionMap.keySet()) { testVersionName = testVersionName + expectedVersionMap.get(versionName).getVersion(); } Version returnedVersion = versionUtil.getVersion(testVersionName); fail("expected exception (InvalidVersionException) did not get thrown"); }

Target:
public void testUnmatchedVersionQuery() throws Exception { String testVersionName = "THIS_STRING_IS_VERY_UNLIKELY_TO_EVER_BE_USED_FOR_THE_NAME_OF_AN_ACTUAL_ONCOTREE_VERSION"; Version returnedVersion = versionUtil.getVersion(testVersionName); fail("expected exception (InvalidVersionException) did not get thrown"); }
Source:
public void should_define_data_table_parameter_type() { DataTableType expected = new DataTableType(Date.class, (TableTransformer<Date>) dataTable -> null); registry.defineDataTableType(expected); assertEquals(expected, registry.dataTableTypeRegistry().lookupTableTypeByType(Date.class)); }

Target:
public void should_define_data_table_parameter_type() { DataTableType expected = new DataTableType(Date.class, (DataTable dataTable) -> null); registry.defineDataTableType(expected); assertEquals(expected, registry.dataTableTypeRegistry().lookupTableTypeByType(Date.class)); }
Source:
public static boolean checkResponse(JsonObject jsonResponse) { if (jsonResponse == null) { return false; } else if (jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_OK.getKey()) != null) { return jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_OK.getKey()).toString() .equals(JSONApiResponseKeysEnum.RESPONSE_SUCCESSFUL.getKey()); } else { logger.error("JSONResponseHandler: error in json request. Error message : {}", jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_MESSAGE.getKey()).toString()); } return false; }

Target:
public static boolean checkResponse(JsonObject jsonResponse) { if (jsonResponse == null) { return false; } else if (jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_OK.getKey()) != null) { return jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_OK.getKey()).toString() .equals(JSONApiResponseKeysEnum.RESPONSE_SUCCESSFUL.getKey()); } else { logger.error("JSONResponseHandler: error in json request. Error message : {}", jsonResponse.get(JSONApiResponseKeysEnum.RESPONSE_MESSAGE.getKey())); } return false; }
Source:
public boolean isAdbEnabled(byte transportType) { if (transportType == AdbTransportType.USB) { return mAdbUsbEnabled; } else if (transportType == AdbTransportType.WIFI) { return mAdbWifiEnabled; } Slog.e(TAG, "Unknown AdbTransportType (" + transportType + ")"); return false; }

Target:
public boolean isAdbEnabled(byte transportType) { if (transportType == AdbTransportType.USB) { return mAdbUsbEnabled; } else if (transportType == AdbTransportType.WIFI) { return mAdbWifiEnabled; } throw new IllegalArgumentException( "isAdbEnabled called with unimplemented transport type=" + transportType); }
Source:
static <T> Attribute of(final NamedAttributeAccess<T> namedAttributeAccess, final T value) { final String name = namedAttributeAccess.getName(); final ObjectMapper mapper = SphereJsonUtils.newObjectMapper(); final SimpleModule module = new SimpleModule(); module.addSerializer(new ReferenceInternalSerializer()); mapper.registerModule(module); final JsonNode jsonNode = mapper.valueToTree(value); return of(name, jsonNode); }

Target:
static <T> Attribute of(final NamedAttributeAccess<T> namedAttributeAccess, final T value) { final String name = namedAttributeAccess.getName(); final JsonNode jsonNode = ReferenceInternalObjectMapper.getInstance().valueToTree(value); return of(name, jsonNode); }
Source:
private void deleteVolumeFromCinder(CinderDisk lastCinderVolume) { try { getCinderBroker().deleteVolumeByClassificationType(lastCinderVolume); } catch (Exception e) { if (!getParameters().isFaultTolerant()) { throw e; } else { log.error("Failed to remove volume from Cinder provider. continue to delete the disk from the DB since the fault tollerant flag is true."); } } }

Target:
private void deleteVolumeFromCinder(CinderDisk lastCinderVolume) { try { getCinderBroker().deleteVolumeByClassificationType(lastCinderVolume); } catch (Exception e) { if (!getParameters().isFaultTolerant()) { throw e; } else { log.error("Failed to remove volume from Cinder provider. continue to delete the disk."); } } }
Source:
private boolean contains(Collection<IRequirement> required, String iu) { for (IRequirement iRequirement : required) { IRequiredCapability req = (IRequiredCapability) iRequirement; if (req.getName().equalsIgnoreCase(iu)) return true; } return false; }

Target:
private boolean contains(Collection<IRequirement> required, String iu) { for (IRequirement requirement : required) { IRequiredCapability req = (IRequiredCapability) requirement; if (req.getName().equalsIgnoreCase(iu)) return true; } return false; }
Source:
final double truncate(double x) { return Math.floor(x * scale + 0.5) / scale; }

Target:
final double truncate(double x) { double scaled = x * scale; scaled += 0.5; scaled = Math.floor(scaled); return scaled / scale; }
Source:
public boolean matches(ILoggingEvent actual) { actualMsg = actual.getMessage().split("(?s)[\\r\\n]+")[0]; if (actualMsg.matches(expected)) { return actual.getMessage().contains(NEWLINE) == shouldContainNewline; } else { return false; } }

Target:
public boolean matches(ILoggingEvent actual) { actualMsg = actual.getMessage().split("(?s)[\\r\\n]+")[0]; if (actualMsg.matches(expected)) { return actual.getMessage().contains(NEWLINE) == shouldContainNewline; } return false; }
Source:
private static String formatMessage(OrcDataSourceId orcDataSourceId, String messageFormat, Object[] args) { return "Malformed ORC file " + orcDataSourceId + ". " + format(messageFormat, args); }

Target:
private static String formatMessage(OrcDataSourceId orcDataSourceId, String messageFormat, Object[] args) { return "Malformed ORC file. " + format(messageFormat, args) + " [" + orcDataSourceId + "]"; }
Source:
protected void syncSearch() { if (getEntity() == null) { return; } AsyncQuery asyncQuery = new AsyncQuery(); asyncQuery.setModel(getViewFilterType()); asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(final Object model, Object ReturnValue) { if (model.equals(getViewFilterType())) { final Iterable returnList = (Iterable) ((VdcQueryReturnValue) ReturnValue).getReturnValue(); final List<PairQueryable<VdsNetworkInterface, VDS>> items = new ArrayList<PairQueryable<VdsNetworkInterface, VDS>>(); if (NetworkHostFilter.unattached.equals(getViewFilterType())) { for (Object obj : returnList) { items.add(new PairQueryable<VdsNetworkInterface, VDS>(null, (VDS) obj)); } setItems(items); } else if (NetworkHostFilter.attached.equals(getViewFilterType())) { initAttachedByLabelInterfaces((List<PairQueryable<VdsNetworkInterface, VDS>>) returnList); } } } }; IdQueryParameters params = new IdQueryParameters(getEntity().getId()); params.setRefresh(getIsQueryFirstTime()); if (NetworkHostFilter.unattached.equals(getViewFilterType())) { Frontend.getInstance().runQuery(VdcQueryType.GetVdsWithoutNetwork, params, asyncQuery); } else if (NetworkHostFilter.attached.equals(getViewFilterType())) { Frontend.getInstance().runQuery(VdcQueryType.GetVdsAndNetworkInterfacesByNetworkId, params, asyncQuery); } setIsQueryFirstTime(false); }

Target:
protected void syncSearch() { if (getEntity() == null) { return; } AsyncQuery asyncQuery = new AsyncQuery(); asyncQuery.setModel(getViewFilterType()); asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(final Object model, Object ReturnValue) { if (model.equals(getViewFilterType())) { final Iterable returnList = (Iterable) ((VdcQueryReturnValue) ReturnValue).getReturnValue(); if (NetworkHostFilter.unattached.equals(getViewFilterType())) { final List<PairQueryable<VdsNetworkInterface, VDS>> items = new ArrayList<PairQueryable<VdsNetworkInterface, VDS>>(); for (Object obj : returnList) { items.add(new PairQueryable<VdsNetworkInterface, VDS>(null, (VDS) obj)); } setItems(items); } else if (NetworkHostFilter.attached.equals(getViewFilterType())) { initAttachedInterfaces((List<PairQueryable<VdsNetworkInterface, VDS>>) returnList); } } } }; IdQueryParameters params = new IdQueryParameters(getEntity().getId()); params.setRefresh(getIsQueryFirstTime()); if (NetworkHostFilter.unattached.equals(getViewFilterType())) { Frontend.getInstance().runQuery(VdcQueryType.GetVdsWithoutNetwork, params, asyncQuery); } else if (NetworkHostFilter.attached.equals(getViewFilterType())) { Frontend.getInstance().runQuery(VdcQueryType.GetVdsAndNetworkInterfacesByNetworkId, params, asyncQuery); } setIsQueryFirstTime(false); }
Source:
private static int figureChunksNumber(final String fileName, final long fileLength, int chunkSize) { if (chunkSize < 0) { throw new IllegalStateException("Overflow in rescaling chunkSize. File way too large?"); } if (fileLength < chunkSize) { return 1; } final long numChunks = (fileLength / chunkSize); if (numChunks > Integer.MAX_VALUE) { log.rescalingChunksize(fileName, fileLength, chunkSize); chunkSize = 32 * chunkSize; return figureChunksNumber(fileName, fileLength, chunkSize); } else { return (int)numChunks; } }

Target:
public static int figureChunksNumber(final String fileName, final long fileLength, int chunkSize) { if (chunkSize < 0) { throw new IllegalStateException("Overflow in rescaling chunkSize. File way too large?"); } final long numChunks = (fileLength % chunkSize == 0) ? (fileLength / chunkSize) : (fileLength / chunkSize) + 1; if (numChunks > Integer.MAX_VALUE) { log.rescalingChunksize(fileName, fileLength, chunkSize); chunkSize = 32 * chunkSize; return figureChunksNumber(fileName, fileLength, chunkSize); } else { return (int)numChunks; } }
Source:
private void reload(final Repository repository) { final boolean repositoryChanged = currentRepository != repository; final AtomicReference<IndexDiff> results = new AtomicReference<IndexDiff>(); final String jobTitle = MessageFormat.format(UIText.StagingView_IndexDiffReload, StagingView.getRepositoryName(repository)); if (reloadJob != null) reloadJob.cancel(); reloadJob = new Job(jobTitle) { @Override protected IStatus run(IProgressMonitor monitor) { IndexDiff indexDiff = doReload(repository, monitor, jobTitle); results.set(indexDiff); if (monitor.isCanceled()) return Status.CANCEL_STATUS; return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { if (family.equals(JobFamilies.STAGING_VIEW_REFRESH)) return true; return super.belongsTo(family); } }; reloadJob.setUser(false); reloadJob.setRule(ResourcesPlugin.getWorkspace().getRoot()); reloadJob.addJobChangeListener(new JobChangeAdapter() { public void done(final IJobChangeEvent event) { asyncExec(new Runnable() { public void run() { if (form.isDisposed()) return; if (!event.getResult().isOK()) return; final IndexDiff indexDiff = results.get(); final StagingViewUpdate update = new StagingViewUpdate(currentRepository, indexDiff, null); unstagedTableViewer.setInput(update); stagedTableViewer.setInput(update); enableCommitWidgets(true); commitAction.setEnabled(repository.getRepositoryState() .canCommit()); form.setText(StagingView.getRepositoryName(repository)); updateCommitMessageComponent(repositoryChanged); updateSectionText(); } }); } }); schedule(reloadJob); }

Target:
private void reload(final Repository repository) { final boolean repositoryChanged = currentRepository != repository; final AtomicReference<IndexDiff> results = new AtomicReference<IndexDiff>(); final String jobTitle = MessageFormat.format(UIText.StagingView_IndexDiffReload, StagingView.getRepositoryName(repository)); if (reloadJob != null) reloadJob.cancel(); reloadJob = new Job(jobTitle) { @Override protected IStatus run(IProgressMonitor monitor) { IndexDiff indexDiff = doReload(repository, monitor, jobTitle); results.set(indexDiff); if (monitor.isCanceled()) return Status.CANCEL_STATUS; return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { if (family.equals(JobFamilies.STAGING_VIEW_REFRESH)) return true; return super.belongsTo(family); } }; reloadJob.setUser(false); reloadJob.setRule(ResourcesPlugin.getWorkspace().getRoot()); reloadJob.addJobChangeListener(new JobChangeAdapter() { public void done(final IJobChangeEvent event) { if (!event.getResult().isOK()) return; asyncExec(new Runnable() { public void run() { if (form.isDisposed()) return; final IndexDiff indexDiff = results.get(); final StagingViewUpdate update = new StagingViewUpdate(currentRepository, indexDiff, null); unstagedTableViewer.setInput(update); stagedTableViewer.setInput(update); enableCommitWidgets(true); commitAction.setEnabled(repository.getRepositoryState() .canCommit()); form.setText(StagingView.getRepositoryName(repository)); updateCommitMessageComponent(repositoryChanged); updateSectionText(); } }); } }); schedule(reloadJob); }
Source:
protected VDSGroup lookupClusterById(String id) { GetVdsGroupByIdParameters params = new GetVdsGroupByIdParameters(Guid.createGuidFromString(id)); params.setFiltered(SessionUtils.isFiltered()); return getEntity(VDSGroup.class, VdcQueryType.GetVdsGroupById, params, id); }

Target:
protected VDSGroup lookupClusterById(String id) { return getEntity(VDSGroup.class, VdcQueryType.GetVdsGroupById, new GetVdsGroupByIdParameters(Guid.createGuidFromString(id)), id); }
Source:
void safeRun(final Runnable task) { if (task == null) return; final Thread currentThread = Thread.currentThread(); final ClassLoader oldCl = JBossExecutors.getContextClassLoader(currentThread); JBossExecutors.clearContextClassLoader(currentThread); try { task.run(); } catch (Throwable t) { try { exceptionHandler.uncaughtException(Thread.currentThread(), t); } catch (Throwable ignored) { } } finally { JBossExecutors.setContextClassLoader(currentThread, oldCl); Thread.interrupted(); } }

Target:
void safeRun(final Runnable task) { if (task == null) return; try { task.run(); } catch (Throwable t) { try { exceptionHandler.uncaughtException(Thread.currentThread(), t); } catch (Throwable ignored) { } } }
Source:
public List<State> queryKeyValueWithOperator(String key1, Object value1, String key2, DBSQueryOperator operator, Object value2, Set<String> ignored) { Map<String, Object> comparatorAndValue = null; if (DBSQueryOperator.IN == operator) { comparatorAndValue = Collections.singletonMap(QueryOperators.IN, value2); } else if (DBSQueryOperator.NOT_IN == operator) { comparatorAndValue = Collections.singletonMap(QueryOperators.NIN, value2); } else { throw new IllegalArgumentException(String.format("Unknown operator: %s", operator)); } Document filter = new Document(converter.keyToBson(key1), value1); filter.put(converter.keyToBson(key2), comparatorAndValue); addIgnoredIds(filter, ignored); return findAll(filter); }

Target:
public List<State> queryKeyValueWithOperator(String key1, Object value1, String key2, DBSQueryOperator operator, Object value2, Set<String> ignored) { Map<String, Object> comparatorAndValue; switch (operator) { case IN: comparatorAndValue = Collections.singletonMap(QueryOperators.IN, value2); break; case NOT_IN: comparatorAndValue = Collections.singletonMap(QueryOperators.NIN, value2); break; default: throw new IllegalArgumentException(String.format("Unknown operator: %s", operator)); } Document filter = new Document(converter.keyToBson(key1), value1); filter.put(converter.keyToBson(key2), comparatorAndValue); addIgnoredIds(filter, ignored); return findAll(filter); }
Source:
public String getPushConfigName() { return mPushConfigName; }

Target:
private String getPushConfigName() { return mPushConfigName; }
Source:
public void noRefLog() throws IOException { writeRef("refs/heads/master", A); Map<String, ReflogEntry> oldLogs = getLastReflogs("refs/heads/master", "refs/heads/branch"); assertEquals(Collections.singleton("refs/heads/master"), oldLogs.keySet()); List<ReceiveCommand> cmds = Arrays.asList( new ReceiveCommand(A, B, "refs/heads/master", UPDATE), new ReceiveCommand(zeroId(), B, "refs/heads/branch", CREATE)); execute(newBatchUpdate(cmds).setAllowNonFastForwards(true)); assertResults(cmds, OK, OK); assertRefs( "refs/heads/master", B, "refs/heads/branch", B); assertEquals((atomic || useReftable) ?2 : 3, refsChangedEvents); assertReflogUnchanged(oldLogs, "refs/heads/master"); assertReflogUnchanged(oldLogs, "refs/heads/branch"); }

Target:
public void noRefLog() throws IOException { writeRef("refs/heads/master", A); Map<String, ReflogEntry> oldLogs = getLastReflogs("refs/heads/master", "refs/heads/branch"); assertEquals(Collections.singleton("refs/heads/master"), oldLogs.keySet()); List<ReceiveCommand> cmds = Arrays.asList( new ReceiveCommand(A, B, "refs/heads/master", UPDATE), new ReceiveCommand(zeroId(), B, "refs/heads/branch", CREATE)); execute(newBatchUpdate(cmds).setAllowNonFastForwards(true)); assertResults(cmds, OK, OK); assertRefs( "refs/heads/master", B, "refs/heads/branch", B); assertEquals(batchesRefUpdates() ?2 : 3, refsChangedEvents); assertReflogUnchanged(oldLogs, "refs/heads/master"); assertReflogUnchanged(oldLogs, "refs/heads/branch"); }
Source:
public List<KieServerState> retrieveAllKieServerStates() { return processKieServerState(client -> { return client.configMaps().list().getItems() .stream() .map(cfg -> (KieServerState) xs.fromXML(cfg.getData().get(CFG_MAP_DATA_KEY))) .collect(Collectors.toList()); }); }

Target:
public List<KieServerState> retrieveAllKieServerStates() { return processKieServerStateByOpenShift(client -> { return client.configMaps().withLabel(CFG_MAP_LABEL_NAME, CFG_MAP_LABEL_VALUE).list().getItems() .stream() .map(cfg -> (KieServerState) xs.fromXML(cfg.getData().get(CFG_MAP_DATA_KEY))) .collect(Collectors.toList()); }); }
Source:
public ListenableFuture<Set<String>> reload(final String key, Set<String> oldValue) throws Exception { LOG.debug("GroupCacheLoader - reload (async)."); if (!reloadGroupsInBackground) { return super.reload(key, oldValue); } backgroundRefreshQueued.incrementAndGet(); ListenableFuture<Set<String>> listenableFuture = executorService.submit(new Callable<Set<String>>() { @Override public Set<String> call() throws Exception { backgroundRefreshQueued.decrementAndGet(); backgroundRefreshRunning.incrementAndGet(); Set<String> results = load(key); return results; } }); Futures.addCallback(listenableFuture, new FutureCallback<Set<String>>() { @Override public void onSuccess(Set<String> result) { backgroundRefreshSuccess.incrementAndGet(); backgroundRefreshRunning.decrementAndGet(); } @Override public void onFailure(Throwable t) { backgroundRefreshException.incrementAndGet(); backgroundRefreshRunning.decrementAndGet(); } }, MoreExecutors.directExecutor()); return listenableFuture; }

Target:
public ListenableFuture<Set<String>> reload(final String key, Set<String> oldValue) throws Exception { LOG.debug("GroupCacheLoader - reload (async)."); if (!reloadGroupsInBackground) { return super.reload(key, oldValue); } backgroundRefreshQueued.incrementAndGet(); ListenableFuture<Set<String>> listenableFuture = executorService.submit(() -> { backgroundRefreshQueued.decrementAndGet(); backgroundRefreshRunning.incrementAndGet(); Set<String> results = load(key); return results; }); Futures.addCallback(listenableFuture, new FutureCallback<Set<String>>() { @Override public void onSuccess(Set<String> result) { backgroundRefreshSuccess.incrementAndGet(); backgroundRefreshRunning.decrementAndGet(); } @Override public void onFailure(Throwable t) { backgroundRefreshException.incrementAndGet(); backgroundRefreshRunning.decrementAndGet(); } }, MoreExecutors.directExecutor()); return listenableFuture; }
Source:
private void resortEquations() { final List<CalculatorVariable> resortedEquations = new ArrayList<>(); String chars = ""; if (currentFormat == Settings.CoordInputFormatEnum.Plain) { final String lat = ePlainLat.getText().toString(); final String lon = ePlainLon.getText().toString(); char first; if (lat.length() > 0) { first = lat.charAt(0); if (first == 'N' || first == 'S') { chars = chars.concat(lat.substring(1)); } else { chars = chars.concat(lat); } } if (lon.length() > 0) { first = lon.charAt(0); if (first == 'E' || first == 'W') { chars = chars.concat(lon.substring(1)); } else { chars = chars.concat(lon); } } } else { for (final EditButton b : coordButtons) { chars = chars.concat(String.valueOf(b.getLabel())); } } for (int i = 0; i<chars.length(); i++) { final char ch = chars.charAt(i); if ('A' <= ch && ch <= 'Z') { if (findVariable(ch, resortedEquations) != null) { continue; } CalculatorVariable thisEquation = findVariable(ch, equations); if (thisEquation == null) { thisEquation = new CalculatorVariable(getContext(), new CalculatorVariable.VariableData(ch), getString(R.string.equation_hint), new EquationWatcher()); } resortedEquations.add(thisEquation); } } equations = resortedEquations; updateGrid(equations, equationGrid, 0); resortFreeVariables(); }

Target:
private void resortEquations() { String coordinateChars = ""; if (currentFormat == Settings.CoordInputFormatEnum.Plain) { final String lat = ePlainLat.getText().toString(); final String lon = ePlainLon.getText().toString(); char first; if (lat.length() > 0) { first = lat.charAt(0); if (first == 'N' || first == 'S') { coordinateChars = coordinateChars.concat(lat.substring(1)); } else { coordinateChars = coordinateChars.concat(lat); } } if (lon.length() > 0) { first = lon.charAt(0); if (first == 'E' || first == 'W') { coordinateChars = coordinateChars.concat(lon.substring(1)); } else { coordinateChars = coordinateChars.concat(lon); } } } else { for (final EditButton b : coordButtons) { coordinateChars = coordinateChars.concat(String.valueOf(b.getLabel())); } } equations = sortVariables(equations, coordinateChars, new Range('A', 'Z'), getString(R.string.equation_hint), new EquationWatcher()); updateGrid(equations, equationGrid, 0); resortFreeVariables(); }
Source:
public static <E extends VmDevice> Map<String, E> vmDevicesByDevice(Collection<E> deviceList) { if (deviceList != null) { Map<String, E> map = new HashMap<String, E>(); for (E device : deviceList) { if (device.getDevice() != null) { map.put(device.getDevice(), device); } } return map; } else { return Collections.emptyMap(); } }

Target:
public static <E extends VmDevice> Map<String, E> vmDevicesByDevice(Collection<E> deviceList) { if (deviceList != null) { Map<String, E> map = new HashMap<>(); for (E device : deviceList) { if (device.getDevice() != null) { map.put(device.getDevice(), device); } } return map; } else { return Collections.emptyMap(); } }
Source:
private void doTaskStart() { if(!started) { String executionId = UUID.randomUUID().toString(); this.taskExecution = new TaskExecution(); this.taskExecution.setTaskName(applicationContext.getId()); this.taskExecution.setStartTime(new Date()); this.taskExecution.setExecutionId(executionId); this.taskRepository.createTaskExecution(this.taskExecution); } else { logger.warn("Multiple start events have been received. The first one was " + "recorded."); } }

Target:
private void doTaskStart() { if(!started) { String executionId = UUID.randomUUID().toString(); this.taskExecution = new TaskExecution(); this.taskExecution.setTaskName(applicationContext.getId()); this.taskExecution.setStartTime(new Date()); this.taskExecution.setExecutionId(executionId); this.taskRepository.createTaskExecution(this.taskExecution); } else { logger.error("Multiple start events have been received. The first one was " + "recorded."); } }
Source:
public boolean isNull() { return getObject() == null; }

Target:
public boolean isNull() { return getObject().isNull(); }
Source:
public Set<String> getBlacklist() { return blacklistedIDs; }

Target:
public Set getBlacklist() { return Collections.unmodifiableSet(blacklistedIDs); }
Source:
protected ElementGroup createQueryPattern(Template t){ ElementGroup elg = new ElementGroup(); List<Quad> quads = t.getQuads(); HashMap<Node, BasicPattern> graphs = new HashMap<Node, BasicPattern>(); for (Quad q: quads){ BasicPattern bgp = graphs.get(q.getGraph()); if (bgp == null){ bgp = new BasicPattern(); graphs.put(q.getGraph(), bgp); } bgp.add( q.asTriple() ); } for(Node n: graphs.keySet()){ Element el = new ElementPathBlock(graphs.get(n)); if(! Quad.defaultGraphIRI.equals(n) ){ el = new ElementNamedGraph(n, el); } elg.addElement(el); } return elg; }

Target:
protected ElementGroup createQueryPattern(Template t){ ElementGroup elg = new ElementGroup(); Map<Node, BasicPattern> graphs = t.getGraphPattern(); for(Node n: graphs.keySet()){ Element el = new ElementPathBlock(graphs.get(n)); if(! Quad.defaultGraphNodeGenerated.equals(n) ){ ElementGroup e = new ElementGroup(); e.addElement(el); el = new ElementNamedGraph(n, e); } elg.addElement(el); } return elg; }