auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public RecoveryTestClusterManager getClusterMap() throws IOException { if (recoveryTestClusterManagerRef.get() == null) { StaticClusterManager staticClusterManager = staticClusterAgentsFactory.getClusterMap(); HelixClusterManager helixClusterManager = null; try { helixClusterManager = helixClusterAgentsFactory.getClusterMap(); } catch (Exception e) { logger.error("Helix cluster manager instantiation failed with exception", e); } recoveryTestClusterManagerRef.compareAndSet(null, new RecoveryTestClusterManager(staticClusterManager, helixClusterManager)); } return recoveryTestClusterManagerRef.get(); }

Target:
public RecoveryTestClusterManager getClusterMap() throws IOException { if (recoveryTestClusterManagerRef.get() == null) { StaticClusterManager staticClusterManager = staticClusterAgentsFactory.getClusterMap(); HelixClusterManager helixClusterManager = null; try { helixClusterManager = helixClusterAgentsFactory.getClusterMap(); } catch (Exception e) { logger.error("Helix cluster manager instantiation failed with exception", e); throw new IOException( String.format("Helix cluster manager instantiation failed with exception %s", e.getMessage())); } recoveryTestClusterManagerRef.compareAndSet(null, new RecoveryTestClusterManager(staticClusterManager, helixClusterManager)); } return recoveryTestClusterManagerRef.get(); }
Source:
private void consumeDurability(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity living) { if((double)state.getBlockHardness(world, pos)!=0.0D) { int dmg = ForgeHooks.isToolEffective(world, pos, stack)||isEffective(stack, state.getMaterial())?1: 3; ItemStack sawblade = getSawblade(stack); if(!sawblade.isEmpty()) { if(!getUpgrades(stack).getBoolean("oiled")||Utils.RAND.nextInt(4)==0) sawblade.damageItem(dmg, living, (entity) -> entity.sendBreakAnimation(Hand.MAIN_HAND)); this.setSawblade(stack, sawblade); IFluidHandler handler = FluidUtil.getFluidHandler(stack).orElseThrow(RuntimeException::new); handler.drain(1, FluidAction.EXECUTE); Triple<ItemStack, ShaderRegistryEntry, ShaderCase> shader = ShaderRegistry.getStoredShaderAndCase(stack); if(shader!=null) shader.getMiddle().getEffectFunction().execute(world, shader.getLeft(), stack, shader.getRight().getShaderType().toString(), new Vec3d(pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5), null, .375f); } } }

Target:
private void consumeDurability(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity living) { if(state.getBlockHardness(world, pos)!=0.0f) { int dmg = ForgeHooks.isToolEffective(world, pos, stack)||isEffective(stack, state.getMaterial())?1: 3; ItemStack sawblade = getSawblade(stack); if(!sawblade.isEmpty()) { if(!getUpgrades(stack).getBoolean("oiled")||Utils.RAND.nextInt(4)==0) sawblade.damageItem(dmg, living, (entity) -> entity.sendBreakAnimation(Hand.MAIN_HAND)); this.setSawblade(stack, sawblade); IFluidHandler handler = FluidUtil.getFluidHandler(stack).orElseThrow(RuntimeException::new); handler.drain(1, FluidAction.EXECUTE); Triple<ItemStack, ShaderRegistryEntry, ShaderCase> shader = ShaderRegistry.getStoredShaderAndCase(stack); if(shader!=null) shader.getMiddle().getEffectFunction().execute(world, shader.getLeft(), stack, shader.getRight().getShaderType().toString(), new Vec3d(pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5), null, .375f); } } }
Source:
private void runDistcp(Path from, Path to) throws Exception { info("source: " + from); info("destination: " + to); EmbeddedGobblin embeddedGobblin = new EmbeddedGobblinDistcp(from, to).mrMode(); embeddedGobblin.distributeJar("lib/*"); for (Map.Entry<String, String> entry : this.props.entrySet()) { if (entry.getKey() != null && (entry.getKey()).startsWith("distcpConf.")) { String key = (entry.getKey()).substring("distcpConf.".length()); embeddedGobblin.setConfiguration(key, entry.getValue()); } } JobExecutionResult result = embeddedGobblin.run(); if (!result.isSuccessful()) { throw new RuntimeException("Distcp job failed!", result.getErrorCause()); } }

Target:
private void runDistcp(Path from, Path to) throws Exception { info("sourcePath: " + from + ", destinationPath: " + to); EmbeddedGobblin embeddedGobblin = new EmbeddedGobblinDistcp(from, to).mrMode(); embeddedGobblin.distributeJar("lib/*"); for (Map.Entry<String, String> entry : this.props.entrySet()) { if (entry.getKey() != null && (entry.getKey()).startsWith(ATTR_PREFIX)) { String key = (entry.getKey()).substring(ATTR_PREFIX.length()); embeddedGobblin.setConfiguration(key, entry.getValue()); } } JobExecutionResult result = embeddedGobblin.run(); if (!result.isSuccessful()) { throw new RuntimeException("Distcp job failed!", result.getErrorCause()); } }
Source:
public void testGeneratedClassName() { PageFunctionCompiler functionCompiler = new PageFunctionCompiler(createTestMetadataManager(), 0); String dateTimePattern = "YYYYMMdd_HHmmss_SSS"; String planNodeId = "7"; String stageId = "20170707_223500_67496_zguwn.2"; String classSuffix = stageId + "_" + planNodeId; Supplier<PageProjection> projectionSupplier = functionCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of(classSuffix)); PageProjection projection = projectionSupplier.get(); Work<Block> work = projection.project(SESSION, new DriverYieldSignal(), createLongBlockPage(0), SelectedPositions.positionsRange(0, 1)); String className = work.getClass().getSimpleName(); assertTrue(className.startsWith("PageProjectionWork_" + stageId.replace('.', '_') + "_" + planNodeId)); DateTimeFormat.forPattern(dateTimePattern).parseDateTime(className.substring(className.length() - dateTimePattern.length())); }

Target:
public void testGeneratedClassName() { PageFunctionCompiler functionCompiler = new PageFunctionCompiler(createTestMetadataManager(), 0); String planNodeId = "7"; String stageId = "20170707_223500_67496_zguwn.2"; String classSuffix = stageId + "_" + planNodeId; Supplier<PageProjection> projectionSupplier = functionCompiler.compileProjection(ADD_10_EXPRESSION, Optional.of(classSuffix)); PageProjection projection = projectionSupplier.get(); Work<Block> work = projection.project(SESSION, new DriverYieldSignal(), createLongBlockPage(0), SelectedPositions.positionsRange(0, 1)); assertTrue(work.getClass().getSimpleName().startsWith("PageProjectionWork_" + stageId.replace('.', '_') + "_" + planNodeId)); }
Source:
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) { JsonNode valueNode = parentNode.get(fieldName); if (!TablesConstants.METADATA_KEYS.contains(fieldName) && !fieldName.endsWith(TablesConstants.ODATA_TYPE_KEY_SUFFIX)) { JsonNode typeNode = parentNode.get(fieldName + TablesConstants.ODATA_TYPE_KEY_SUFFIX); if (typeNode != null) { String typeString = typeNode.asText(); EntityDataModelType type = EntityDataModelType.parse(typeString); if (type != null) { try { return type.deserialize(valueNode.asText()); } catch (Exception e) { throw logger.logExceptionAsError(new IllegalArgumentException(String.format( "'%s' value is not a valid %s.", fieldName, type.getEdmType()), e)); } } else { logger.warning(String.format("'%s' value has unknown OData type %s", fieldName, typeString)); } } } return valueNode.asText(); }

Target:
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) throws IOException { JsonNode valueNode = parentNode.get(fieldName); if (TablesConstants.METADATA_KEYS.contains(fieldName) || fieldName.endsWith(TablesConstants.ODATA_TYPE_KEY_SUFFIX)) { return serializer().treeToValue(valueNode, Object.class); } JsonNode typeNode = parentNode.get(fieldName + TablesConstants.ODATA_TYPE_KEY_SUFFIX); if (typeNode == null) { return serializer().treeToValue(valueNode, Object.class); } String typeString = typeNode.asText(); EntityDataModelType type = EntityDataModelType.fromString(typeString); if (type == null) { logger.warning(String.format("'%s' value has unknown OData type %s", fieldName, typeString)); return serializer().treeToValue(valueNode, Object.class); } try { return type.deserialize(valueNode.asText()); } catch (Exception e) { throw logger.logExceptionAsError(new IllegalArgumentException(String.format( "'%s' value is not a valid %s.", fieldName, type.getEdmType()), e)); } }
Source:
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) { writer.getDialect().unparseDataType(writer, this, leftPrec, rightPrec); }

Target:
public void unparse(SqlWriter writer, int leftPrec, int rightPrec) { typeNameSpec.unparse(writer, leftPrec, rightPrec); }
Source:
private Set<String> itemIds( Iterable<com.metabroadcast.atlas.glycerin.model.Broadcast> nitroBroadcasts) { return ImmutableSet.copyOf(Iterables.transform( nitroBroadcasts, new Function<com.metabroadcast.atlas.glycerin.model.Broadcast, String>() { @Override public String apply(com.metabroadcast.atlas.glycerin.model.Broadcast input) { return NitroUtil.programmePid(input).getPid(); } } )); }

Target:
private Set<String> itemIds( Iterable<com.metabroadcast.atlas.glycerin.model.Broadcast> nitroBroadcasts) { return ImmutableSet.copyOf(Iterables.transform( nitroBroadcasts, input -> NitroUtil.programmePid(input).getPid() )); }
Source:
public void tapOnWebElement(By locator, int index, int duration, int waitAfter) { JavascriptExecutor js = (JavascriptExecutor) driver; WebElement element; if (index > 0) { List<WebElement> elements = driver.findElements(locator); element = elements.get(index); } else { element = driver.findElement(locator); } int elementStartPointX = element.getLocation().getX(); int elementHeight = element.getSize().getHeight(); int elementWidth = element.getSize().getHeight(); int offSetY = loadedPageHeight - element.getLocation().getY() - appWebviewHeight; if (offSetY < 0) { offSetY = -offSetY; } else { offSetY = 0; } js.executeScript("window.scrollTo(0, "+element.getLocation().getY()+")"); int pointX = (elementStartPointX + (elementWidth / 2)) * ratio; int pointY = (taskbarWebviewHeight + (elementHeight / 2) + offSetY) * ratio; if (mobileDriver.getContext() != "NATIVE_APP") { mobileDriver.context("NATIVE_APP"); } try { mobileDriver.tap(1, pointX, pointY, duration); } catch (Exception e) try { Thread.sleep(waitAfter); } catch (Exception e) if (mobileDriver.getContext() != "NATIVE_APP") { mobileDriver.context("NATIVE_APP"); } }

Target:
public void tapOnWebElement(By locator, int index, int duration, int waitAfter) { String methodName = "tapOnWebElement"; JavascriptExecutor js = (JavascriptExecutor) driver; WebElement element; if (index > 0) { List<WebElement> elements = driver.findElements(locator); element = elements.get(index); } else { element = driver.findElement(locator); } int elementStartPointX = element.getLocation().getX(); int elementHeight = element.getSize().getHeight(); int elementWidth = element.getSize().getHeight(); int offSetY = loadedPageHeight - element.getLocation().getY() - appWebviewHeight; if (offSetY < 0) { offSetY = -offSetY; } else { offSetY = 0; } js.executeScript("window.scrollTo(0, "+element.getLocation().getY()+")"); int pointX = (elementStartPointX + (elementWidth / 2)) * ratio; int pointY = (taskbarWebviewHeight + (elementHeight / 2) + offSetY) * ratio; switchToContext(CONTEXT_NATIVE_APP, methodName); mobileDriver.tap(1, pointX, pointY, duration); waitForFinish(waitAfter, methodName); switchToContext(CONTEXT_WEBVIEW_1, methodName); }
Source:
public List<ResolutionMethod> getValidResolutions() { List<ResolutionMethod> toReturn = new ArrayList<ResolutionMethod>(); List<String> attributes = artifact.getAttributeValues(CoreAttributeTypes.GeneralStringData); String resolutionsJson = "[]"; for (String attribute : attributes) { if (attribute.startsWith("RESOLUTION_METHODS")) { resolutionsJson = attribute.replaceFirst("RESOLUTION_METHODS=", ""); break; } } try { JSONArray jArray = DispoUtil.asJSONArray(resolutionsJson); for (int i = 0; i < jArray.length(); i++) { JSONObject resolutionMethodJObject = jArray.getJSONObject(i); ResolutionMethod method = DispoUtil.jsonObjToResolutionMethod(resolutionMethodJObject); toReturn.add(method); } return toReturn; } catch (JSONException ex) { throw new OseeCoreException("Could not parse Resolution Methods", ex); } }

Target:
public List<ResolutionMethod> getValidResolutions() { List<ResolutionMethod> toReturn = new ArrayList<ResolutionMethod>(); List<String> attributes = artifact.getAttributeValues(CoreAttributeTypes.GeneralStringData); String resolutionsJson = "[]"; for (String attribute : attributes) { if (attribute.startsWith("RESOLUTION_METHODS")) { resolutionsJson = attribute.replaceFirst("RESOLUTION_METHODS=", ""); break; } } try { JSONArray jArray = DispoUtil.asJSONArray(resolutionsJson); for (int i = 0; i < jArray.length(); i++) { JSONObject resolutionMethodJObject = jArray.getJSONObject(i); ResolutionMethod method = DispoUtil.jsonObjToResolutionMethod(resolutionMethodJObject); toReturn.add(method); } return toReturn; } catch (JSONException ex) { throw new OseeCoreException("Invalid Resolutions JSON in Dispo Config", ex); } }
Source:
public void shouldProperlyCompareVersions() { ServerVersion version = new ServerVersion(ServerVersion.V2_19); Assert.assertTrue(version.isAfter(ServerVersion.V2_18)); Assert.assertTrue(version.isAfter("2.15")); Assert.assertTrue(version.isAfter("2.1")); Assert.assertTrue(version.isAfter("2.0")); Assert.assertTrue(version.isAfter("1.0")); Assert.assertTrue(version.isAfter("0.12")); Assert.assertFalse(version.isAfter(ServerVersion.V2_21)); Assert.assertTrue(version.isSameOrAfter(ServerVersion.V2_19)); Assert.assertTrue(version.isSameOrAfter(ServerVersion.V2_18)); Assert.assertTrue(version.isSameOrAfter("2.15")); Assert.assertTrue(version.isSameOrAfter("2.1")); Assert.assertTrue(version.isSameOrAfter("2.0")); Assert.assertTrue(version.isSameOrAfter("1.0")); Assert.assertTrue(version.isSameOrAfter("0.12")); Assert.assertFalse(version.isSameOrAfter(ServerVersion.V2_21)); Assert.assertTrue(version.isSame(ServerVersion.V2_19)); Assert.assertFalse(version.isSame(ServerVersion.V2_18)); Assert.assertTrue(version.isBefore(ServerVersion.V2_21)); Assert.assertTrue(version.isBefore("2.22")); Assert.assertTrue(version.isBefore("2.30")); Assert.assertTrue(version.isBefore("3.0")); Assert.assertFalse(version.isBefore("2.1")); Assert.assertFalse(version.isBefore("2.17")); Assert.assertTrue(version.isSameOrBefore(ServerVersion.V2_19)); Assert.assertTrue(version.isSameOrBefore(ServerVersion.V2_21)); Assert.assertTrue(version.isSameOrBefore("2.22")); Assert.assertTrue(version.isSameOrBefore("2.30")); Assert.assertTrue(version.isSameOrBefore("3.0")); Assert.assertFalse(version.isSameOrBefore("2.1")); Assert.assertFalse(version.isSameOrBefore("2.17")); }

Target:
public void shouldProperlyCompareVersions() { ServerVersion version = new ServerVersion(ServerVersion.V2_19); assertTrue(version.isAfter(ServerVersion.V2_18)); assertTrue(version.isAfter("2.15")); assertTrue(version.isAfter("2.1")); assertTrue(version.isAfter("2.0")); assertTrue(version.isAfter("1.0")); assertTrue(version.isAfter("0.12")); assertFalse(version.isAfter(ServerVersion.V2_21)); assertTrue(version.isSameOrAfter(ServerVersion.V2_19)); assertTrue(version.isSameOrAfter(ServerVersion.V2_18)); assertTrue(version.isSameOrAfter("2.15")); assertTrue(version.isSameOrAfter("2.1")); assertTrue(version.isSameOrAfter("2.0")); assertTrue(version.isSameOrAfter("1.0")); assertTrue(version.isSameOrAfter("0.12")); assertFalse(version.isSameOrAfter(ServerVersion.V2_21)); assertTrue(version.isSame(ServerVersion.V2_19)); assertFalse(version.isSame(ServerVersion.V2_18)); assertTrue(version.isBefore(ServerVersion.V2_21)); assertTrue(version.isBefore("2.22")); assertTrue(version.isBefore("2.30")); assertTrue(version.isBefore("3.0")); assertFalse(version.isBefore("2.1")); assertFalse(version.isBefore("2.17")); assertTrue(version.isSameOrBefore(ServerVersion.V2_19)); assertTrue(version.isSameOrBefore(ServerVersion.V2_21)); assertTrue(version.isSameOrBefore("2.22")); assertTrue(version.isSameOrBefore("2.30")); assertTrue(version.isSameOrBefore("3.0")); assertFalse(version.isSameOrBefore("2.1")); assertFalse(version.isSameOrBefore("2.17")); }
Source:
protected void setDockWidget(final PlaceRequest placeRequest, final IsWidget widget) { if (getDockPresenter(placeRequest).isPresent()) { getDockPresenter(placeRequest).get().setView(widget); } }

Target:
protected void setDockWidget(final PlaceRequest placeRequest, final IsWidget widget) { final Optional<DockPlaceHolderBase> dockPlaceHolder = getDockPlaceHolder(placeRequest); if (dockPlaceHolder.isPresent()) { dockPlaceHolder.get().setView(widget); } }
Source:
protected ClientHttpResponse run() throws Exception { final RequestContext context = RequestContext.getCurrentContext(); if (context.getRequest() != null) { String contentLengthHeader = context.getRequest().getHeader("Content-Length"); if (StringUtils.hasText(contentLengthHeader)) { this.context.setContentLength(new Long(contentLengthHeader)); } } RQ request = createRequest(); RS response = this.client.executeWithLoadBalancer(request); context.set("ribbonResponse", response); if (this.isResponseTimedOut()) { if (response != null) { response.close(); } } return new RibbonHttpResponse(response); }

Target:
protected ClientHttpResponse run() throws Exception { final RequestContext context = RequestContext.getCurrentContext(); RQ request = createRequest(); RS response = this.client.executeWithLoadBalancer(request); context.set("ribbonResponse", response); if (this.isResponseTimedOut()) { if (response != null) { response.close(); } } return new RibbonHttpResponse(response); }
Source:
public List<ProgramEnrollment> getProgramEnrollmentByPatientMotechId(String configName, String patientMotechId) { Config config = configService.getConfigByName(configName); Patient patient = patientResource.queryForPatient(config, patientMotechId).getResults().get(0); return programEnrollmentResource.getProgramEnrollmentByPatientUuid(config, patient.getUuid()); }

Target:
public List<ProgramEnrollment> getProgramEnrollmentByPatientMotechId(String configName, String patientMotechId) { Patient patient = patientService.getPatientByMotechId(configName, patientMotechId); return Objects.nonNull(patient) ? getProgramEnrollmentByPatientUuid(configName, patient.getUuid()) : new ArrayList<>(); }
Source:
public void onApiChange(SyncthingService.State currentState) { if (currentState != SyncthingService.State.ACTIVE || getApi() == null) return; List<Folder> folders = getApi().getFolders(); int folderIndex = 0; String savedFolderId = getSharedPreferences(SHARED_PREFS_SAVED_DIRECTORIES, MODE_PRIVATE) .getString(PREF_PREVIOUSLY_SELECTED_SYNCTHING_FOLDER, ""); for (Folder folder: folders) { if (folder.id.equals(savedFolderId)) { folderIndex = folders.indexOf(folder); break; } } ArrayAdapter<Folder> adapter = new ArrayAdapter<>( this, android.R.layout.simple_spinner_item, folders); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner sItems = (Spinner) findViewById(R.id.folders); sItems.setAdapter(adapter); sItems.setSelection(folderIndex); }

Target:
public void onApiChange(SyncthingService.State currentState) { if (currentState != SyncthingService.State.ACTIVE || getApi() == null) return; List<Folder> folders = getApi().getFolders(); int folderIndex = 0; String savedFolderId = PreferenceManager.getDefaultSharedPreferences(this) .getString(PREF_PREVIOUSLY_SELECTED_SYNCTHING_FOLDER, ""); for (Folder folder : folders) { if (folder.id.equals(savedFolderId)) { folderIndex = folders.indexOf(folder); break; } } ArrayAdapter<Folder> adapter = new ArrayAdapter<>( this, android.R.layout.simple_spinner_item, folders); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner sItems = findViewById(R.id.folders); sItems.setAdapter(adapter); sItems.setSelection(folderIndex); }
Source:
public void testLexicographicalBinaryComparator() { testObjectComparator(LEXICOGRAPHICAL_BINARY_COMPARATOR, Binary.fromConstantByteArray(new byte[0]), Binary.fromConstantByteArray(new byte[]{127, 127, 0, 127}, 2, 1), Binary.fromCharSequence("aaa"), Binary.fromString("aaaa"), Binary.fromReusedByteArray("aaab".getBytes()), Binary.fromReusedByteArray("azzza".getBytes(), 1, 3), Binary.fromReusedByteBuffer(ByteBuffer.wrap("zzzzzz".getBytes())), Binary.fromReusedByteBuffer(ByteBuffer.wrap("aazzzzzzaa".getBytes(), 2, 7)), Binary.fromConstantByteBuffer(ByteBuffer.wrap(new byte[]{-128, -128, -128})), Binary.fromConstantByteBuffer(ByteBuffer.wrap(new byte[]{-128, -128, -1}, 1, 2)) ); }

Target:
public void testLexicographicalBinaryComparator() { testObjectComparator(UNSIGNED_LEXICOGRAPHICAL_BINARY_COMPARATOR, null, Binary.fromConstantByteArray(new byte[0]), Binary.fromConstantByteArray(new byte[] { 127, 127, 0, 127 }, 2, 1), Binary.fromCharSequence("aaa"), Binary.fromString("aaaa"), Binary.fromReusedByteArray("aaab".getBytes()), Binary.fromReusedByteArray("azzza".getBytes(), 1, 3), Binary.fromReusedByteBuffer(ByteBuffer.wrap("zzzzzz".getBytes())), Binary.fromReusedByteBuffer(ByteBuffer.wrap("aazzzzzzaa".getBytes(), 2, 7)), Binary.fromConstantByteBuffer(ByteBuffer.wrap(new byte[] { -128, -128, -128 })), Binary.fromConstantByteBuffer(ByteBuffer.wrap(new byte[] { -128, -128, -1 }, 1, 2)) ); }
Source:
private void validateRecords(final List<SAMRecord> expectedRecords, ByteArrayInputStream is, ReferenceSource referenceSource) { try (CRAMFileReader cReader = new CRAMFileReader(null, is, referenceSource)) { SAMRecordIterator iterator2 = cReader.getIterator(); int index = 0; while (iterator2.hasNext()) { SAMRecord actualRecord = iterator2.next(); SAMRecord expectedRecord = expectedRecords.get(index++); Assert.assertEquals(actualRecord.getReadName(), expectedRecord.getReadName()); Assert.assertEquals(actualRecord.getFlags(), expectedRecord.getFlags()); Assert.assertEquals(actualRecord.getAlignmentStart(), expectedRecord.getAlignmentStart()); Assert.assertEquals(actualRecord.getAlignmentEnd(), expectedRecord.getAlignmentEnd()); Assert.assertEquals(actualRecord.getReferenceName(), expectedRecord.getReferenceName()); Assert.assertEquals(actualRecord.getMateAlignmentStart(), expectedRecord.getMateAlignmentStart()); Assert.assertEquals(actualRecord.getMateReferenceName(), expectedRecord.getMateReferenceName()); Assert.assertEquals(actualRecord.getReadBases(), expectedRecord.getReadBases()); Assert.assertEquals(actualRecord.getBaseQualities(), expectedRecord.getBaseQualities()); Assert.assertEquals(actualRecord.getAttributes().stream().map(s -> s.tag).collect(Collectors.toSet()), actualRecord.getAttributes().stream().map(s -> s.tag).collect(Collectors.toSet()), expectedRecord.getReadName()); actualRecord.getAttributes().forEach(tv -> { Assert.assertEquals(tv.value, expectedRecord.getAttribute(tv.tag)); }); } } }

Target:
private void validateRecords(final List<SAMRecord> expectedRecords, ByteArrayInputStream is, ReferenceSource referenceSource) { try (CRAMFileReader cReader = new CRAMFileReader(null, is, referenceSource)) { SAMRecordIterator iterator2 = cReader.getIterator(); int index = 0; while (iterator2.hasNext()) { SAMRecord actualRecord = iterator2.next(); SAMRecord expectedRecord = expectedRecords.get(index++); Assert.assertEquals(actualRecord.getReadName(), expectedRecord.getReadName()); Assert.assertEquals(actualRecord.getFlags(), expectedRecord.getFlags()); Assert.assertEquals(actualRecord.getAlignmentStart(), expectedRecord.getAlignmentStart()); Assert.assertEquals(actualRecord.getAlignmentEnd(), expectedRecord.getAlignmentEnd()); Assert.assertEquals(actualRecord.getReferenceName(), expectedRecord.getReferenceName()); Assert.assertEquals(actualRecord.getMateAlignmentStart(), expectedRecord.getMateAlignmentStart()); Assert.assertEquals(actualRecord.getMateReferenceName(), expectedRecord.getMateReferenceName()); Assert.assertEquals(actualRecord.getReadBases(), expectedRecord.getReadBases()); Assert.assertEquals(actualRecord.getBaseQualities(), expectedRecord.getBaseQualities()); Assert.assertEquals( actualRecord.getAttributes().stream().map(s -> s.tag).collect(Collectors.toSet()), expectedRecord.getAttributes().stream().map(s -> s.tag).collect(Collectors.toSet()), expectedRecord.getReadName()); actualRecord.getAttributes().forEach(tv -> { Assert.assertEquals(tv.value, expectedRecord.getAttribute(tv.tag)); }); } } }
Source:
public MethodOutcome createFHIRLocation(@ResourceParam Location location) { location = locationResource.createLocation(location); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdDt(FHIRConstants.LOCATION, location.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); coding.setDisplay("Location is successfully created"); outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }

Target:
public MethodOutcome createFHIRLocation(@ResourceParam Location location) { location = locationResource.createLocation(location); MethodOutcome retVal = new MethodOutcome(); retVal.setId(new IdType(FHIRConstants.LOCATION, location.getId())); OperationOutcome outcome = new OperationOutcome(); CodeableConcept concept = new CodeableConcept(); Coding coding = concept.addCoding(); coding.setDisplay("Location is successfully created with id " + location.getId()); outcome.addIssue().setDetails(concept); retVal.setOperationOutcome(outcome); return retVal; }
Source:
public boolean isLoggedIn() { if (!"XWiki.XWikiGuest".equals(xWikiContext.getUser())) { return true; } return false; }

Target:
public boolean isLoggedIn() { return rightsAccess.isLoggedIn(); }
Source:
public NicProfile createGuestNicProfileForVpcRouter(final RouterDeploymentDefinition vpcRouterDeploymentDefinition, final Network guestNetwork) { final NicProfile guestNic = new NicProfile(); if (vpcRouterDeploymentDefinition.isRedundant()) { guestNic.setIPv4Address(_ipAddrMgr.acquireFirstGuestIpAddress(guestNetwork)); } else { guestNic.setIPv4Address(guestNetwork.getGateway()); } guestNic.setBroadcastUri(guestNetwork.getBroadcastUri()); guestNic.setBroadcastType(guestNetwork.getBroadcastDomainType()); guestNic.setIsolationUri(guestNetwork.getBroadcastUri()); guestNic.setMode(guestNetwork.getMode()); final String gatewayCidr = _networkModel.getValidNetworkCidr(guestNetwork); guestNic.setIPv4Netmask(NetUtils.getCidrNetmask(gatewayCidr)); return guestNic; }

Target:
public NicProfile createGuestNicProfileForVpcRouter(final RouterDeploymentDefinition vpcRouterDeploymentDefinition, final Network guestNetwork) { final NicProfile guestNic = new NicProfile(); if (vpcRouterDeploymentDefinition.isRedundant()) { guestNic.setIPv4Address(this.acquireGuestIpAddressForVrouterRedundant(guestNetwork)); } else { guestNic.setIPv4Address(guestNetwork.getGateway()); } guestNic.setBroadcastUri(guestNetwork.getBroadcastUri()); guestNic.setBroadcastType(guestNetwork.getBroadcastDomainType()); guestNic.setIsolationUri(guestNetwork.getBroadcastUri()); guestNic.setMode(guestNetwork.getMode()); final String gatewayCidr = _networkModel.getValidNetworkCidr(guestNetwork); guestNic.setIPv4Netmask(NetUtils.getCidrNetmask(gatewayCidr)); return guestNic; }
Source:
public int compareTo(final Repo repo) { int returnValue; if (repo instanceof MkRepo) { final MkRepo mkRepo = (MkRepo) repo; returnValue = this.self.compareTo(mkRepo.self); if (returnValue == 0) { returnValue = this.coords.compareTo(mkRepo.coords); } } else { returnValue = -1; } return returnValue; }

Target:
public int compareTo(final Repo repo) { return this.coords.compareTo(repo.coordinates()); }
Source:
void executeInterruptedException() throws InterruptedException { MentionsData data = new MentionsData() .setDocumentReference("xwiki:XWiki.Doc") .setAuthorReference("xwiki:XWiki.Author") .setVersion("1.0") .setWikiId("xwiki"); doThrow(new InterruptedException()).when(this.blockingQueue).put(data); this.executor.execute(new DocumentReference("xwiki", "XWiki", "Doc"), new DocumentReference("xwiki", "XWiki", "Author"), "1.0"); assertEquals(1, this.logCapture.size()); assertEquals(WARN, this.logCapture.getLogEvent(0).getLevel()); assertEquals( "Error while adding the task [documentReference = [xwiki:XWiki.Doc], version = [1.0], " + "authorReference = [xwiki:XWiki.Author], wikiId = [xwiki]] " + "to the mentions analysis queue. Cause [InterruptedException: ]", this.logCapture.getMessage(0)); }

Target:
void executeInterruptedException() throws InterruptedException { DocumentReference documentReference = new DocumentReference("xwiki", "XWiki", "Doc"); DocumentReference authorReference = new DocumentReference("xwiki", "XWiki", "Author"); MentionsData data = new MentionsData() .setDocumentReference("xwiki:XWiki.Doc") .setAuthorReference("xwiki:XWiki.Author") .setVersion("1.0") .setWikiId("xwiki"); when(this.serializer.serialize(documentReference)).thenReturn("xwiki:XWiki.Doc"); when(this.serializer.serialize(authorReference)).thenReturn("xwiki:XWiki.Author"); doThrow(new InterruptedException()).when(this.blockingQueue).put(data); this.executor.execute(documentReference, authorReference, "1.0"); assertEquals(1, this.logCapture.size()); assertEquals(WARN, this.logCapture.getLogEvent(0).getLevel()); assertEquals( "Error while adding the task [documentReference = [xwiki:XWiki.Doc], version = [1.0], " + "authorReference = [xwiki:XWiki.Author], wikiId = [xwiki]] " + "to the mentions analysis queue. Cause [InterruptedException: ]", this.logCapture.getMessage(0)); }
Source:
public void close() { scheduler.shutdownNow(); try { scheduler.awaitTermination(30, TimeUnit.SECONDS); } catch (final InterruptedException e) { log.error("Failed to shut down bigtable flush executor service in a timely manner"); } }

Target:
public AsyncFuture<Void> close() { if (scheduler == null) { return async.resolved(); } return async.call(() -> { scheduler.shutdownNow(); try { scheduler.awaitTermination(30, TimeUnit.SECONDS); } catch (final InterruptedException e) { log.error("Failed to shut down bigtable flush executor service in a timely manner"); } return null; }); }
Source:
public void smartLockAutoFill() { if (!isSmartLockAvailable()) { return; } CredentialRequest credentialRequest = new CredentialRequest.Builder() .setSupportsPasswordLogin(true) .build(); Auth.CredentialsApi.request(mCredentialsClient, credentialRequest).setResultCallback( new ResultCallback<CredentialRequestResult>() { @Override public void onResult(CredentialRequestResult result) { Status status = result.getStatus(); if (status.isSuccess()) { Credential credential = result.getCredential(); onCredentialRetrieved(credential); } else { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(getActivity(), SignInActivity.SMART_LOCK_READ); } catch (IntentSender.SendIntentException e) { AppLog.d(T.NUX, "SmartLock: Failed to send resolution for credential " + "request"); } } else { AppLog.d(T.NUX, "SmartLock: Unsuccessful credential request."); } } } }); }

Target:
public void smartLockAutoFill() { if (!isGooglePlayServicesAvailable() || mCredentialsClient == null || mSelfHosted) { return; } CredentialRequest credentialRequest = new CredentialRequest.Builder() .setSupportsPasswordLogin(true) .build(); Auth.CredentialsApi.request(mCredentialsClient, credentialRequest).setResultCallback( new ResultCallback<CredentialRequestResult>() { @Override public void onResult(CredentialRequestResult result) { Status status = result.getStatus(); if (status.isSuccess()) { Credential credential = result.getCredential(); onCredentialRetrieved(credential); } else { if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(getActivity(), SignInActivity.SMART_LOCK_READ); } catch (IntentSender.SendIntentException e) { AppLog.d(T.NUX, "SmartLock: Failed to send resolution for credential " + "request"); } } else { AppLog.d(T.NUX, "SmartLock: Unsuccessful credential request."); } } } }); }
Source:
public void addSensorJob(SensorJob sensorJob) { synchronized (sensorJobQueue) { if (!this.sensorJobQueue.contains(sensorJob)) { sensorJobQueue.add(sensorJob); logger.debug("Add sensorJob: to circuitScheduler: {}", sensorJob.toString(), this.getMeterDSID()); } else if (checkSensorJobPrio(sensorJob)) { logger.debug("add sensorJob: with higher priority to circuitScheduler: {}", sensorJob.toString(), this.getMeterDSID()); } else { logger.debug("sensorJob: allready exist with a higher priority", sensorJob.getDSID().toString()); } } }

Target:
public void addSensorJob(SensorJob sensorJob) { synchronized (sensorJobQueue) { if (!this.sensorJobQueue.contains(sensorJob)) { sensorJobQueue.add(sensorJob); logger.debug("Add sensorJob: to circuitScheduler: {}", sensorJob.toString(), this.getMeterDSID()); } else if (checkSensorJobPrio(sensorJob)) { logger.debug("add sensorJob: with higher priority to circuitScheduler: {}", sensorJob.toString(), this.getMeterDSID()); } else { logger.debug("sensorJob: allready exist with a higher priority", sensorJob.getDSID()); } } }
Source:
private EntityModel<String> validateName(E entityData) { final int maxNameLength = AsyncDataProvider.getInstance().getMaxVmNameLength(); EntityModel<String> name = new EntityModel<>(entityData.getName()); name.validateEntity( new IValidation[] { new NotEmptyValidation(), new LengthValidation(maxNameLength), new I18NNameValidation(), value -> (entityData.isNameExistsInTheSystem() || !isNameUnique(entityData)) ? ValidationResult.fail(ConstantsManager.getInstance() .getConstants() .nameMustBeUniqueInvalidReason()) : ValidationResult.ok() }); return name; }

Target:
private EntityModel<String> validateName(E entityData) { final int maxNameLength = AsyncDataProvider.getInstance().getMaxVmNameLength(); EntityModel<String> name = new EntityModel<>(entityData.getName()); name.validateEntity( new IValidation[] { new NotEmptyValidation(), new LengthValidation(maxNameLength), new I18NNameValidation(), UniqueNameValidation(entityData) }); return name; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RealmConfig other = (RealmConfig) obj; if (authenticationConfig == null) { if (other.authenticationConfig != null) { return false; } } else if (!authenticationConfig.equals(other.authenticationConfig)) { return false; } if (identityConfig == null) { if (other.identityConfig != null) { return false; } } else if (!identityConfig.equals(other.identityConfig)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RealmConfig other = (RealmConfig) obj; return Objects.equals(authenticationConfig, other.authenticationConfig) && Objects.equals(identityConfig, other.identityConfig); }
Source:
public static Sensor numberOfFileErrorsSensor(final StreamsMetricsImpl streamsMetrics, final RocksDBMetricContext metricContext) { final Sensor sensor = createSensor(streamsMetrics, metricContext, NUMBER_OF_FILE_ERRORS); addValueMetricToSensor( sensor, STATE_LEVEL_GROUP, streamsMetrics .storeLevelTagMap(metricContext.taskName(), metricContext.metricsScope(), metricContext.storeName()), NUMBER_OF_FILE_ERRORS, NUMBER_OF_FILE_ERRORS_DESCRIPTION ); return sensor; }

Target:
public static Sensor numberOfFileErrorsSensor(final StreamsMetricsImpl streamsMetrics, final RocksDBMetricContext metricContext) { final Sensor sensor = createSensor(streamsMetrics, metricContext, NUMBER_OF_FILE_ERRORS); addSumMetricToSensor( sensor, STATE_LEVEL_GROUP, streamsMetrics .storeLevelTagMap(metricContext.taskName(), metricContext.metricsScope(), metricContext.storeName()), NUMBER_OF_FILE_ERRORS, NUMBER_OF_FILE_ERRORS_DESCRIPTION ); return sensor; }
Source:
private static String toHex(byte[] bytes) { StringBuilder builder = new StringBuilder(); for (byte b : bytes) { builder.append(HEX.charAt((b & 0xF0) >> 4)); builder.append(HEX.charAt(b & 0xF)); } return builder.toString(); }

Target:
private static String toHex(byte[] bytes) { StringBuilder builder = new StringBuilder(2 * bytes.length); for (byte b : bytes) { builder.append(HEX.charAt((b & 0xF0) >> 4)); builder.append(HEX.charAt(b & 0xF)); } return builder.toString(); }
Source:
private CommandResponse executeCommand(boolean sensitive, String format, Object... args) throws IOException, MessagingException { List<String> results = new ArrayList<>(); if (format != null) { String command = String.format(Locale.ROOT, format, args); writeLine(command, sensitive); } String line = readCommandResponseLine(results); int length = line.length(); if (length < 1) { throw new MessagingException("SMTP response is 0 length"); } int replyCode = -1; if (length >= 3) { try { replyCode = Integer.parseInt(line.substring(0, 3)); } catch (NumberFormatException e) { } } char c = line.charAt(0); if ((c == '4') || (c == '5')) { if (mEnhancedStatusCodesProvided) { throw buildEnhancedNegativeSmtpReplyException(replyCode, results); } else { String replyText = TextUtils.join(" ", results); throw new NegativeSmtpReplyException(replyCode, replyText); } } return new CommandResponse(replyCode, results); }

Target:
private CommandResponse executeCommand(boolean sensitive, String format, Object... args) throws IOException, MessagingException { List<String> results = new ArrayList<>(); if (format != null) { String command = String.format(Locale.ROOT, format, args); writeLine(command, sensitive); } String line = readCommandResponseLine(results); int length = line.length(); if (length < 1) { throw new MessagingException("SMTP response is 0 length"); } int replyCode = -1; if (length >= 3) { try { replyCode = Integer.parseInt(line.substring(0, 3)); } catch (NumberFormatException e) { } } char replyCodeCategory = line.charAt(0); boolean isReplyCodeErrorCategory = (replyCodeCategory == '4') || (replyCodeCategory == '5'); if (isReplyCodeErrorCategory) { if (mEnhancedStatusCodesProvided) { throw buildEnhancedNegativeSmtpReplyException(replyCode, results); } else { String replyText = TextUtils.join(" ", results); throw new NegativeSmtpReplyException(replyCode, replyText); } } return new CommandResponse(replyCode, results); }
Source:
protected void bindParameters() throws StandardException { if (leftOperand.requiresTypeFromContext()) { if (rightOperand.requiresTypeFromContext()) { throw StandardException.newException(SQLState.LANG_BINARY_OPERANDS_BOTH_PARMS, operator); } leftOperand.setType(rightOperand.getTypeServices()); } if (rightOperand.requiresTypeFromContext()) { rightOperand.setType(leftOperand.getTypeServices()); } }

Target:
protected void bindParameters() throws StandardException { if (leftOperand.requiresTypeFromContext()) { if (rightOperand.requiresTypeFromContext()) { throw StandardException.newException(SQLState.LANG_BINARY_OPERANDS_BOTH_PARMS, operator); } leftOperand.setType(rightOperand.getTypeServices()); } else if (rightOperand.requiresTypeFromContext()) { rightOperand.setType(leftOperand.getTypeServices()); } }
Source:
public View onCreateDialogView() { View view = null; LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.layout_preference_distance, null); String[] values=new String[COUNT_KM_STEPS]; for(int i=0;i<values.length;i++){ values[i]=Integer.toString(i); } mCurrentValue = PreferenceManager.getDefaultSharedPreferences(getContext()).getInt(SharedData.LIMIT_DISTANCE, 0); if(mCurrentValue == 0) { mCurrentValue = mDefaultValue; } mNumberPickerMain = (NumberPicker) view.findViewById(R.id.numberPickerMain); mNumberPickerMain.setMaxValue(values.length-1); mNumberPickerMain.setMinValue(0); mNumberPickerMain.setValue(mCurrentValue/1000); mNumberPickerMain.setDisplayedValues(values); mNumberPickerMain.setOnValueChangedListener(this); String[] valuesExtra=new String[COUNT_M_STEPS]; for(int i=0;i<valuesExtra.length;i++){ valuesExtra[i]=Integer.toString(i*STEP_DIVISION); } mNumberPickerExtra = (NumberPicker) view.findViewById(R.id.numberPickerExtra); mNumberPickerExtra.setMaxValue(valuesExtra.length-1); mNumberPickerExtra.setMinValue(0); mNumberPickerExtra.setValue((mCurrentValue%1000)/STEP_DIVISION); mNumberPickerExtra.setDisplayedValues(valuesExtra); mNumberPickerExtra.setOnValueChangedListener(this); return view; }

Target:
public View onCreateDialogView() { View view = null; LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.layout_preference_distance, null); String[] values = new String[COUNT_KM_STEPS]; for (int i = 0; i < values.length; i++) { values[i] = Integer.toString(i); } mCurrentValue = getPersistedInt(mDefaultValue); mNumberPickerMain = (NumberPicker) view.findViewById(R.id.numberPickerMain); mNumberPickerMain.setMaxValue(values.length - 1); mNumberPickerMain.setMinValue(0); mNumberPickerMain.setValue(mCurrentValue / 1000); mNumberPickerMain.setDisplayedValues(values); mNumberPickerMain.setOnValueChangedListener(this); String[] valuesExtra = new String[COUNT_M_STEPS]; for (int i = 0; i < valuesExtra.length; i++) { valuesExtra[i] = Integer.toString(i * STEP_DIVISION); } mNumberPickerExtra = (NumberPicker) view.findViewById(R.id.numberPickerExtra); mNumberPickerExtra.setMaxValue(valuesExtra.length - 1); mNumberPickerExtra.setMinValue(0); mNumberPickerExtra.setValue((mCurrentValue % 1000) / STEP_DIVISION); mNumberPickerExtra.setDisplayedValues(valuesExtra); mNumberPickerExtra.setOnValueChangedListener(this); return view; }
Source:
public Object invoke(final MethodInvocation invocation) throws Throwable { final Class<?> returnType = invocation.getMethod().getReturnType(); if (this.asyncExecutor != null) { if (returnType.isAssignableFrom(RunnableFuture.class) || FutureTask.class.equals(returnType)) { return this.asyncExecutor.submit(new AsyncInvocationTask(invocation)); } else if (this.asyncExecutor instanceof AsyncListenableTaskExecutor && (returnType.isAssignableFrom(ListenableFuture.class) || ListenableFutureTask.class.equals(returnType))) { return ((AsyncListenableTaskExecutor) this.asyncExecutor).submitListenable(new AsyncInvocationTask(invocation)); } } if (Promise.class.isAssignableFrom(returnType)) { if (this.reactorEnvironment == null) { throw new IllegalStateException("'reactorEnvironment' is required in case of 'Promise' return type."); } return Promises.<Object>task(Functions.supplier(new AsyncInvocationTask(invocation))) .env(this.reactorEnvironment) .get(); } return this.doInvoke(invocation); }

Target:
public Object invoke(final MethodInvocation invocation) throws Throwable { final Class<?> returnType = invocation.getMethod().getReturnType(); if (this.asyncExecutor != null && !Object.class.equals(returnType)) { if (returnType.isAssignableFrom(this.asyncSubmitType)) { return this.asyncExecutor.submit(new AsyncInvocationTask(invocation)); } else if (returnType.isAssignableFrom(asyncSubmitListenableType)) { return ((AsyncListenableTaskExecutor) this.asyncExecutor).submitListenable(new AsyncInvocationTask(invocation)); } else if (Future.class.isAssignableFrom(returnType)) { if (logger.isDebugEnabled()) { logger.debug("AsyncTaskExecutor submit*() return types are incompatible with the method return type; " + "running on calling thread; the downstream flow must return the required Future: " + returnType.getSimpleName()); } } } if (Promise.class.isAssignableFrom(returnType)) { if (this.reactorEnvironment == null) { throw new IllegalStateException("'reactorEnvironment' is required in case of 'Promise' return type."); } return Promises.<Object>task(Functions.supplier(new AsyncInvocationTask(invocation))) .env(this.reactorEnvironment) .get(); } return this.doInvoke(invocation); }
Source:
public void afterPropertiesSet() { eventBus.register(this); connectionState = new SimpleObjectProperty<>(ConnectionState.DISCONNECTED); unreadMessagesCount = new SimpleIntegerProperty(); onChatMessageListeners = new ArrayList<>(); channelUserListListeners = new HashMap<>(); timer = new Timer(true); }

Target:
public void afterPropertiesSet() { eventBus.register(this); }
Source:
private void taskComplete( RemoteTaskRunnerWorkItem taskRunnerWorkItem, ZkWorker zkWorker, TaskStatus taskStatus ) { Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkNotNull(taskStatus, "taskStatus"); if (zkWorker != null) { log.info( "Worker[%s] completed task[%s] with status[%s]", zkWorker.getWorker().getHost(), taskStatus.getId(), taskStatus.getStatusCode() ); zkWorker.setLastCompletedTaskTime(new DateTime()); } else { log.info("Workerless task[%s] completed with status[%s]", taskStatus.getId(), taskStatus.getStatusCode()); } completeTasks.put(taskStatus.getId(), taskRunnerWorkItem); runningTasks.remove(taskStatus.getId()); if (zkWorker != null) { if (taskStatus.isSuccess()) { zkWorker.resetContinuouslyFailedTasksCount(); } else if (taskStatus.isFailure()) { zkWorker.incrementContinuouslyFailedTasksCount(); } if (zkWorker.getContinuouslyFailedTasksCount() > config.getMaxRetriesBeforeBlacklist() && blackListedWorkers.size() <= zkWorkers.size() * (config.getMaxPercentageBlacklistWorkers() / 100) - 1) { if (blackListedWorkers.add(zkWorker)) { log.info( "Blacklisting [%s] after [%,d] failed tasks in a row.", zkWorker.getWorker(), zkWorker.getContinuouslyFailedTasksCount() ); } } } taskRunnerWorkItem.setResult(taskStatus); TaskRunnerUtils.notifyStatusChanged(listeners, taskStatus.getId(), taskStatus); }

Target:
private void taskComplete( RemoteTaskRunnerWorkItem taskRunnerWorkItem, ZkWorker zkWorker, TaskStatus taskStatus ) { Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkNotNull(taskStatus, "taskStatus"); if (zkWorker != null) { log.info( "Worker[%s] completed task[%s] with status[%s]", zkWorker.getWorker().getHost(), taskStatus.getId(), taskStatus.getStatusCode() ); zkWorker.setLastCompletedTaskTime(new DateTime()); } else { log.info("Workerless task[%s] completed with status[%s]", taskStatus.getId(), taskStatus.getStatusCode()); } completeTasks.put(taskStatus.getId(), taskRunnerWorkItem); runningTasks.remove(taskStatus.getId()); if (zkWorker != null) { if (taskStatus.isSuccess()) { zkWorker.resetContinuouslyFailedTasksCount(); if (blackListedWorkers.remove(zkWorker)) { zkWorker.setBlacklistedUntil(null); log.info("[%s] removed from blacklist because a task finished with SUCCESS", zkWorker.getWorker()); } } else if (taskStatus.isFailure()) { zkWorker.incrementContinuouslyFailedTasksCount(); } synchronized (blackListedWorkers) { if (zkWorker.getContinuouslyFailedTasksCount() > config.getMaxRetriesBeforeBlacklist() && blackListedWorkers.size() <= zkWorkers.size() * (config.getMaxPercentageBlacklistWorkers() / 100.0) - 1) { zkWorker.setBlacklistedUntil(DateTime.now().plus(config.getWorkerBlackListBackoffTime())); if (blackListedWorkers.add(zkWorker)) { log.info( "Blacklisting [%s] until [%s] after [%,d] failed tasks in a row.", zkWorker.getWorker(), zkWorker.getBlacklistedUntil(), zkWorker.getContinuouslyFailedTasksCount() ); } } } } taskRunnerWorkItem.setResult(taskStatus); TaskRunnerUtils.notifyStatusChanged(listeners, taskStatus.getId(), taskStatus); }
Source:
public ImmutableSortedSet<Path> getRDotJavaFiles() { if (skipPrebuiltRDotJava) { return FluentIterable.from(unionPackage .map(Collections::singletonList) .orElse(Collections.emptyList()) ) .transform(this::getPathToRDotJava) .toSortedSet(natural()); } else { return FluentIterable.from(androidResourceDeps) .transform(HasAndroidResourceDeps::getRDotJavaPackage) .append(unionPackage .map(Collections::singletonList) .orElse(Collections.emptyList()) ) .transform(this::getPathToRDotJava) .toSortedSet(natural()); } }

Target:
public ImmutableSortedSet<Path> getRDotJavaFiles() { FluentIterable<String> packages = FluentIterable.from( unionPackage.map(Collections::singletonList).orElse(Collections.emptyList())); if (!skipNonUnionRDotJava) { packages = packages.append( FluentIterable.from(androidResourceDeps) .transform(HasAndroidResourceDeps::getRDotJavaPackage)); } return packages .transform(this::getPathToRDotJava) .toSortedSet(natural()); }
Source:
public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.state(converter != null, "Converter must not be null"); admin = newCassandraAdminOperations(getObject(), converter); performSchemaAction(); }

Target:
public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.state(converter != null, "Converter was not properly initialized"); admin = newCassandraAdminOperations(getObject(), converter); performSchemaAction(); }