auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
final void writePlanJsonFile(String planJson) { try { String content = "plan='" + planJson + "'"; String binPath = System.getenv(ShellCommandConfig.JOB_BIN_DIR()); if (binPath != null && !binPath.isEmpty()) { File file = new File(binPath + "/plan.json"); file.setReadable(true, false); PrintWriter writer = new PrintWriter(file, "UTF-8"); writer.println(content); writer.close(); } } catch (Throwable t) { log.warn("fail to write execution plan json to file", t); } }

Target:
final void writePlanJsonFile(String planJson) { try { String content = "plan='" + planJson + "'"; String planPath = System.getenv(ShellCommandConfig.EXECUTION_PLAN_DIR()); if (planPath != null && !planPath.isEmpty()) { File file = new File(planPath + "/plan.json"); file.setReadable(true, false); PrintWriter writer = new PrintWriter(file, "UTF-8"); writer.println(content); writer.close(); } } catch (Exception e) { log.warn("Failed to write execution plan json to file", e); } }
Source:
private ConcurAccountInfo buildConcurAccountingInformation(ConcurStandardAccountingExtractDetailLine line) { String objectCode = line.getJournalAccountCode(); String subObjectCode; if (getConcurBatchUtilityService().lineRepresentsPersonalExpenseChargedToCorporateCard(line)) { subObjectCode = line.getSubObjectCode(); } else { subObjectCode = line.getReportSubObjectCode(); } ConcurAccountInfo accountingInformation = buildConcurAccountingInformation(line, objectCode, subObjectCode); return accountingInformation; }

Target:
private ConcurAccountInfo buildConcurAccountingInformation(ConcurStandardAccountingExtractDetailLine line) { String objectCode = line.getJournalAccountCode(); String subObjectCode; if (getConcurBatchUtilityService().lineRepresentsPersonalExpenseChargedToCorporateCard(line)) { subObjectCode = line.getReportSubObjectCode(); } else { subObjectCode = line.getSubObjectCode(); } ConcurAccountInfo accountingInformation = buildConcurAccountingInformation(line, objectCode, subObjectCode); return accountingInformation; }
Source:
public void go(final AcceptsOneWidget container) { ProjectConfigDto projectConfig = appContext.getCurrentProject().getProjectConfig(); isPlainJava = "javac".equals(projectConfig.getType()); setReadOnlyMod(); container.setWidget(view); if (!categories.isEmpty()) { view.renderLibraries(); return; } classpathContainer.getClasspathEntries(projectConfig.getPath()).then(new Operation<List<ClasspathEntryDto>>() { @Override public void apply(List<ClasspathEntryDto> arg) throws OperationException { categories.clear(); for (ClasspathEntryDto entry : arg) { if (CONTAINER == entry.getEntryKind() || LIBRARY == entry.getEntryKind()) { categories.put(entry.getPath(), entry); } } view.setData(categories); view.renderLibraries(); } }); }

Target:
public void go(final AcceptsOneWidget container) { ProjectConfigDto projectConfig = appContext.getCurrentProject().getProjectConfig(); isPlainJava = JAVAC.equals(projectConfig.getType()); setReadOnlyMod(); container.setWidget(view); if (!categories.isEmpty()) { view.renderLibraries(); return; } classpathContainer.getClasspathEntries(projectConfig.getPath()).then(new Operation<List<ClasspathEntryDto>>() { @Override public void apply(List<ClasspathEntryDto> arg) throws OperationException { categories.clear(); for (ClasspathEntryDto entry : arg) { if (CONTAINER == entry.getEntryKind() || LIBRARY == entry.getEntryKind()) { categories.put(entry.getPath(), entry); } } view.setData(categories); view.renderLibraries(); } }); }
Source:
protected boolean checkPayload(VmPayload payload, String isoPath) { boolean returnValue = true; if (payload.getType() != VmDeviceType.CDROM && payload.getType() != VmDeviceType.FLOPPY) { addCanDoActionMessage(VdcBllMessages.VMPAYLOAD_INVALID_PAYLOAD_TYPE); returnValue = false; } else if (payload.getContent().length() > Config.<Integer> GetValue(ConfigValues.PayloadSize)) { Integer lengthInKb = 2 * Config.<Integer> GetValue(ConfigValues.PayloadSize) / 1024; addCanDoActionMessage(VdcBllMessages.VMPAYLOAD_SIZE_EXCEEDED); addCanDoActionMessage(String.format("$size %1$s", lengthInKb.toString())); returnValue = false; } else if (!StringHelper.isNullOrEmpty(isoPath) && payload.getType() == VmDeviceType.CDROM) { addCanDoActionMessage(VdcBllMessages.VMPAYLOAD_CDROM_EXCEEDED); returnValue = false; } return returnValue; }

Target:
protected boolean checkPayload(VmPayload payload, String isoPath) { boolean returnValue = true; if (payload.getType() != VmDeviceType.CDROM && payload.getType() != VmDeviceType.FLOPPY) { addCanDoActionMessage(VdcBllMessages.VMPAYLOAD_INVALID_PAYLOAD_TYPE); returnValue = false; } else if (payload.getContent().length() > Config.<Integer> GetValue(ConfigValues.PayloadSize)) { Integer lengthInKb = 2 * Config.<Integer> GetValue(ConfigValues.PayloadSize) / Kb; addCanDoActionMessage(VdcBllMessages.VMPAYLOAD_SIZE_EXCEEDED); addCanDoActionMessage(String.format("$size %1$s", lengthInKb.toString())); returnValue = false; } else if (!StringHelper.isNullOrEmpty(isoPath) && payload.getType() == VmDeviceType.CDROM) { addCanDoActionMessage(VdcBllMessages.VMPAYLOAD_CDROM_EXCEEDED); returnValue = false; } return returnValue; }
Source:
public void testCreateServer() { assertNotNull(dataCenter); testServer = serverApi().createServer( Server.Request.creatingBuilder() .dataCenterId(dataCenter.id()) .name("jclouds-node") .cpuFamily(CpuFamily.INTEL_XEON) .cores(1) .ram(1024) .build()); assertRequestCompleted(testServer); assertRequestCompleted(testServer); assertNotNull(testServer); assertEquals(testServer.properties().name(), "jclouds-node"); assertNodeRunning(ServerRef.create(dataCenter.id(), testServer.id())); }

Target:
public void testCreateServer() { assertNotNull(dataCenter); testServer = serverApi().createServer( Server.Request.creatingBuilder() .dataCenterId(dataCenter.id()) .name("jclouds-node") .cpuFamily(CpuFamily.INTEL_XEON) .cores(1) .ram(1024) .build()); assertRequestCompleted(testServer); assertNotNull(testServer); assertEquals(testServer.properties().name(), "jclouds-node"); assertNodeRunning(ServerRef.create(dataCenter.id(), testServer.id())); }
Source:
private Screen getNextScreen() { String next = mSession.getNeededData(mSession.getEvaluationContext()); if (next == null) { return null; } else if (next.equals(SessionFrame.STATE_COMMAND_ID)) { return new MenuScreen(); } else if (next.equals(SessionFrame.STATE_DATUM_VAL)) { return new EntityScreen(); } else if (next.equals(SessionFrame.STATE_QUERY_REQUEST)) { return new QueryScreen(qualifiedUsername, password, System.out); } else if (next.equals(SessionFrame.STATE_SYNC_REQUEST)) { new SyncScreen(qualifiedUsername, password); mSession.syncState(); if (mSession.finishExecuteAndPop(mSession.getEvaluationContext())) { mSession.clearVolatiles(); return getNextScreen(); } mSession.clearAllState(); return getNextScreen(); } else if (next.equalsIgnoreCase(SessionFrame.STATE_DATUM_COMPUTED)) { computeDatum(); return getNextScreen(); } throw new RuntimeException("Unexpected Frame Request: " + next); }

Target:
private Screen getNextScreen() { String next = mSession.getNeededData(mSession.getEvaluationContext()); if (next == null) { return null; } else if (next.equals(SessionFrame.STATE_COMMAND_ID)) { return new MenuScreen(); } else if (next.equals(SessionFrame.STATE_DATUM_VAL)) { return new EntityScreen(); } else if (next.equals(SessionFrame.STATE_QUERY_REQUEST)) { return new QueryScreen(qualifiedUsername, password, System.out); } else if (next.equals(SessionFrame.STATE_SYNC_REQUEST)) { return new SyncScreen(qualifiedUsername, password, System.out); } else if (next.equalsIgnoreCase(SessionFrame.STATE_DATUM_COMPUTED)) { computeDatum(); return getNextScreen(); } throw new RuntimeException("Unexpected Frame Request: " + next); }
Source:
public void lunsMismatchWrongId() { Guid pvID = Guid.newGuid(); LUNs lunFromVG = new LUNs(); lunFromVG.setLUNId(Guid.newGuid().toString()); lunFromVG.setPhysicalVolumeId(pvID.toString()); LUNs lunFromDB = new LUNs(); lunFromDB.setLUNId(Guid.newGuid().toString()); lunFromDB.setPhysicalVolumeId(pvID.toString()); List<LUNs> lunsFromVgInfo = Collections.singletonList(lunFromVG); List<LUNs> lunsFromDb = Collections.singletonList(lunFromDB); boolean isMismatch = command.getLunsToUpdateInDb(lunsFromVgInfo, lunsFromDb).size() > 0; assertTrue(isMismatch); }

Target:
public void lunsMismatchWrongId() { Guid pvID = Guid.newGuid(); LUNs lunFromVG = new LUNs(); lunFromVG.setLUNId(Guid.newGuid().toString()); lunFromVG.setPhysicalVolumeId(pvID.toString()); LUNs lunFromDB = new LUNs(); lunFromDB.setLUNId(Guid.newGuid().toString()); lunFromDB.setPhysicalVolumeId(pvID.toString()); List<LUNs> lunsFromVgInfo = Collections.singletonList(lunFromVG); List<LUNs> lunsFromDb = Collections.singletonList(lunFromDB); boolean isMatch = command.getLunsToUpdateInDb(lunsFromVgInfo, lunsFromDb).isEmpty(); assertFalse(isMatch); }
Source:
protected ExtractionResult visitInPredicate(InPredicate node, Boolean complement) { InListExpression valueList = (InListExpression) node.getValueList(); checkState(!valueList.getValues().isEmpty(), "InListExpression should never be empty"); ImmutableList.Builder<Expression> disjuncts = ImmutableList.builder(); for (Expression expression : valueList.getValues()) { disjuncts.add(new ComparisonExpression(EQUAL, node.getValue(), expression)); } return process(or(disjuncts.build()), complement); }

Target:
protected ExtractionResult visitInPredicate(InPredicate node, Boolean complement) { if (!(node.getValueList() instanceof InListExpression)) { return super.visitInPredicate(node, complement); } InListExpression valueList = (InListExpression) node.getValueList(); checkState(!valueList.getValues().isEmpty(), "InListExpression should never be empty"); ImmutableList.Builder<Expression> disjuncts = ImmutableList.builder(); for (Expression expression : valueList.getValues()) { disjuncts.add(new ComparisonExpression(EQUAL, node.getValue(), expression)); } return process(or(disjuncts.build()), complement); }
Source:
public void getAllCustomers() throws Exception { putAll(); mockMvc.perform(get("/v1/customers?limit=ALL") .with(POST_PROCESSOR)) .andExpect(status().isOk()) .andExpect( header().string("Content-Location", new StringStartsWith(BASE_URL + "/customers/"))) .andExpect(jsonPath("$.customers", jsonEquals(jsonResources.get(CUSTOMER_LIST_JSON)))); }

Target:
public void getAllCustomers() throws Exception { putAll(); mockMvc.perform(get("/v1/customers?limit=ALL") .with(POST_PROCESSOR)) .andExpect(status().isOk()) .andExpect( header().string("Content-Location", startsWith(BASE_URL + "/customers/"))) .andExpect(jsonPath("$.customers", jsonEquals(jsonResources.get(CUSTOMER_LIST_JSON)))); }
Source:
void setValueAsString(String theValue) throws IllegalArgumentException; String getValueAsString(); T getValue(); boolean hasValue(); IPrimitiveType<T> setValue(T theValue) throws IllegalArgumentException; static <T> T toValueOrNull(IPrimitiveType<T> thePrimitiveType) { return thePrimitiveType != null ? thePrimitiveType.getValue() : null; }

Target:
void setValueAsString(String theValue) throws IllegalArgumentException; T getValue(); IPrimitiveType<T> setValue(T theValue) throws IllegalArgumentException; boolean hasValue(); @Nullable static <T> T toValueOrNull(@Nullable IPrimitiveType<T> thePrimitiveType) { return thePrimitiveType != null ? thePrimitiveType.getValue() : null; }
Source:
public void progress() { for (int i = 0; i < 2; i++) { for (final Location check : this.getCircle(center, this.radius + i, 10)) { Block b = check.getBlock(); if (this.checked.contains(b)) { continue; } b = this.getAppropriateBlock(b); if (b == null) { continue; } new RaiseEarth(player, b.getLocation(), Math.round(this.height - i)); this.checked.add(b); } } this.bPlayer.addCooldown("EarthDome", this.getCooldown()); this.remove(); }

Target:
public void progress() { for (int i = 0; i < 2; i++) { for (final Location check : this.getCircle(center, this.radius + i, 10)) { Block currBlock = check.getBlock(); if (this.checked.contains(currBlock)) { continue; } currBlock = this.getAppropriateBlock(currBlock); if (currBlock == null) { continue; } new RaiseEarth(player, currBlock.getLocation(), Math.round(this.height - i)); this.checked.add(currBlock); } } this.bPlayer.addCooldown("EarthDome", this.getCooldown()); this.remove(); }
Source:
public ResponseEntity<Map<String, String>> recharge(@RequestBody Map<String, String> params) { logger.info("[Fudian] call register"); RegisterRequestDto requestDto = registerService.register(params.get("loginName"), params.get("mobilePhone"), params.get("realName"), params.get("identityCode")); return this.generateResponseJson(requestDto, ApiType.REGISTER); }

Target:
public ResponseEntity<Map<String, String>> recharge(@RequestBody Map<String, String> params) { logger.info("[Fudian] call register"); RegisterRequestDto requestDto = registerService.register(params.get("loginName"), params.get("mobile"), params.get("realName"), params.get("identityCode")); return this.generateResponseJson(requestDto, ApiType.REGISTER); }
Source:
public void testRemoveIf() { ArrayList<Integer> integerList = new ArrayList<>(); Collection<Integer> integerCollection = integerList; for (int i = 0; i < 100; ++i) { integerCollection.add(i); } integerCollection.removeIf(isEven); for (int i = 0; i < integerList.size(); i++) { assertTrue(integerList.get(i) % 2 != 0); if (i < integerList.size() - 1) { assertTrue(integerList.get(i + 1) > integerList.get(i)); } } integerCollection.removeIf(isOdd); assertTrue(integerCollection.isEmpty()); }

Target:
public void testRemoveIf() { for (Supplier<Collection<Integer>> impl : collectionImpls) { Collection<Integer> integers = impl.get(); for (int h = 0; h < 100; ++h) { integers.add((h >>> 2) ^ (h >>> 5) ^ (h >>> 11) ^ (h >>> 17)); } integers.removeIf(isEven); for (Integer i : integers) { assertTrue(i % 2 != 0); } integers.removeIf(isOdd); assertTrue(integers.isEmpty()); } }
Source:
private boolean isNumberOfNodesLimited() { return maximumNumberOfNodes != null && maximumNumberOfNodes > 0; }

Target:
private boolean isNumberOfNodesLimited() { return maximumNumberOfNodes != null && maximumNumberOfNodes >= 0; }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/finalPostProcessing"); postMaterial.setFloat("focalDistance", cameraTargetSystem.getFocalDistance(), true); if (isFilmGrainEnabled) { postMaterial.setFloat("grainIntensity", filmGrainIntensity, true); postMaterial.setFloat("noiseOffset", randomGenerator.nextFloat(), true); postMaterial.setFloat2("noiseSize", noiseTextureSize, noiseTextureSize, true); postMaterial.setFloat2("renderTargetSize", lastUpdatedGBuffer.width(), lastUpdatedGBuffer.height(), true); } if (isMotionBlurEnabled) { postMaterial.setMatrix4("invViewProjMatrix", activeCamera.getInverseViewProjectionMatrix(), true); postMaterial.setMatrix4("prevViewProjMatrix", activeCamera.getPrevViewProjectionMatrix(), true); } renderFullscreenQuad(); if (!screenGrabber.isTakingScreenshot()) { screenGrabber.saveScreenshot(); } PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/finalPostProcessing"); postMaterial.setFloat("focalDistance", cameraTargetSystem.getFocalDistance(), true); if (isFilmGrainEnabled) { postMaterial.setFloat("grainIntensity", filmGrainIntensity, true); postMaterial.setFloat("noiseOffset", randomGenerator.nextFloat(), true); postMaterial.setFloat2("noiseSize", noiseTextureSize, noiseTextureSize, true); postMaterial.setFloat2("renderTargetSize", lastUpdatedGBuffer.width(), lastUpdatedGBuffer.height(), true); } if (isMotionBlurEnabled) { postMaterial.setMatrix4("invViewProjMatrix", activeCamera.getInverseViewProjectionMatrix(), true); postMaterial.setMatrix4("prevViewProjMatrix", activeCamera.getPrevViewProjectionMatrix(), true); } renderFullscreenQuad(); if (screenGrabber.isTakingScreenshot()) { screenGrabber.saveScreenshot(); } PerformanceMonitor.endActivity(); }
Source:
public void checkCanSetUser(Principal principal, String userName) { if (principalUserMatchRules.isEmpty()) { return; } if (principal == null) { denySetUser(principal, userName); } String principalName = principal.getName(); for (PrincipalUserMatchRule rule : principalUserMatchRules) { Optional<Boolean> allowed = rule.match(principalName, userName); if (allowed.isPresent()) { if (allowed.get()) { return; } else { denySetUser(principal, userName); } } } denySetUser(principal, userName); }

Target:
public void checkCanSetUser(Principal principal, String userName) { if (!principalUserMatchRules.isPresent()) { return; } if (principal == null) { denySetUser(principal, userName); } String principalName = principal.getName(); for (PrincipalUserMatchRule rule : principalUserMatchRules.get()) { Optional<Boolean> allowed = rule.match(principalName, userName); if (allowed.isPresent()) { if (allowed.get()) { return; } denySetUser(principal, userName); } } denySetUser(principal, userName); }
Source:
public void testInitEmptyRepoMissingMaster() throws Exception { String projectName = "AnyProjectName"; TestRepository testRepository = createAndShare(projectName); selectProject(projectName); clickInit(); bot.button("Yes").click(); fillDialog(MASTER_BRANCH_MISSING); bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing)); bot.button("Yes").click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); Repository localRepository = testRepository.getRepository(); GitFlowRepository gitFlowRepository = new GitFlowRepository(localRepository); GitFlowConfig config = gitFlowRepository.getConfig(); assertEquals(DEVELOP_BRANCH, localRepository.getBranch()); assertEquals(MASTER_BRANCH_MISSING, config.getMaster()); assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix()); assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix()); assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix()); assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix()); assertNotNull( localRepository.findRef(Constants.R_HEADS + DEVELOP_BRANCH)); }

Target:
public void testInitEmptyRepoMissingMaster() throws Exception { String projectName = "AnyProjectName"; TestRepository testRepository = createAndShare(projectName); selectProject(projectName); clickInit(); bot.button("Yes").click(); fillDialog(MASTER_BRANCH_MISSING); bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing)); bot.button("Yes").click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); Repository localRepository = testRepository.getRepository(); GitFlowRepository gitFlowRepository = new GitFlowRepository(localRepository); GitFlowConfig config = gitFlowRepository.getConfig(); assertEquals(DEVELOP_BRANCH, localRepository.getBranch()); assertEquals(MASTER_BRANCH_MISSING, config.getMaster()); assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix()); assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix()); assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix()); assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix()); assertNotNull( localRepository.exactRef(Constants.R_HEADS + DEVELOP_BRANCH)); }
Source:
private static boolean hasUnbracedStatements(DetailAST ast) { final DetailAST nextSibling = ast.getNextSibling(); return nextSibling != null && nextSibling.getType() == TokenTypes.SLIST && !"{".equals(nextSibling.getFirstChild().getText()); }

Target:
private static boolean hasUnbracedStatements(DetailAST ast) { final DetailAST nextSibling = ast.getNextSibling(); return nextSibling != null && nextSibling.getType() == TokenTypes.SLIST && nextSibling.getFirstChild().getType() != TokenTypes.SLIST; }
Source:
private ListenableFuture<MutateRowResponse> processUnsafeMutationSplit(MutateRowsRequest.Entry entry) { final SettableFuture<MutateRowResponse> mutateRowResponseListenableFuture = SettableFuture.create(); final List<List<Mutation>> subSets = Lists.partition(entry.getMutationsList(), (int) MAX_NUMBER_OF_MUTATIONS); for (List<Mutation> mutations : subSets) { ListenableFuture<MutateRowResponse> childFuture = sendDirect(entry.getRowKey(), mutations); Futures.addCallback(childFuture, new FutureCallback<MutateRowResponse>() { private boolean failed = false; private int success = 0; @Override public void onSuccess(@Nullable MutateRowResponse result) { success++; if (!failed && success == subSets.size()) { mutateRowResponseListenableFuture.set(result); } } @Override public void onFailure(Throwable t) { failed = true; mutateRowResponseListenableFuture.setException(t); } }); operationAccountant.registerOperation(childFuture); } return mutateRowResponseListenableFuture; }

Target:
private ListenableFuture<MutateRowResponse> processUnsafeMutationSplit(MutateRowsRequest.Entry entry) { final SettableFuture<MutateRowResponse> mutateRowResponseListenableFuture = SettableFuture.create(); final List<List<Mutation>> subSets = Lists.partition(entry.getMutationsList(), (int) MAX_NUMBER_OF_MUTATIONS); FutureCallback<MutateRowResponse> futureCallback = new FutureCallback<MutateRowResponse>() { private boolean failed = false; private int success = 0; @Override public void onSuccess(@Nullable MutateRowResponse result) { success++; if (!failed && success == subSets.size()) { mutateRowResponseListenableFuture.set(result); } } @Override public void onFailure(Throwable t) { failed = true; mutateRowResponseListenableFuture.setException(t); } }; for (List<Mutation> mutations : subSets) { ListenableFuture<MutateRowResponse> childFuture = sendDirect(entry.getRowKey(), mutations); Futures.addCallback(childFuture, futureCallback); operationAccountant.registerOperation(childFuture); } return mutateRowResponseListenableFuture; }
Source:
public void updateUsbSlots(VmBase oldVm, VmBase newVm) { final int oldNumberOfSlots = getUsbSlots(oldVm.getId()).size(); final int newNumberOfUsbSlots = Config.<Integer> getValue(ConfigValues.NumberOfUSBSlots); if (!requiresSpiceUsb(oldVm) && requiresSpiceUsb(newVm)) { disableNormalUsb(newVm.getId()); enableSpiceUsb(newVm.getId(), newNumberOfUsbSlots); return; } if (requiresSpiceUsb(oldVm) && requiresSpiceUsb(newVm)) { updateSpiceUsb(newVm.getId(), oldNumberOfSlots, newNumberOfUsbSlots); return; } if (requiresSpiceUsb(oldVm) && !requiresSpiceUsb(newVm)) { disableSpiceUsb(newVm.getId()); enableNormalUsb(newVm); return; } if (!requiresSpiceUsb(oldVm) && !requiresSpiceUsb(newVm)) { updateNormalUsb(newVm); return; } throw new RuntimeException( format("Unexpected state: oldUsbPolicy=%s, oldGraphicsDevices=[%s], newUsbPolicy=%s, newGraphicsDevices=[%s]", oldVm.getUsbPolicy(), StringUtils.join(getGraphicsDevices(oldVm.getId()), ", "), newVm.getUsbPolicy(), StringUtils.join(getGraphicsDevices(newVm.getId()), ", "))); }

Target:
public void updateUsbSlots(VmBase oldVm, VmBase newVm) { final UsbPolicy oldUsbPolicy = oldVm.getUsbPolicy(); final UsbPolicy newUsbPolicy = newVm.getUsbPolicy(); final int oldNumberOfSlots = getUsbSlots(oldVm.getId()).size(); final int newNumberOfUsbSlots = Config.<Integer> getValue(ConfigValues.NumberOfUSBSlots); if (UsbPolicy.DISABLED == oldUsbPolicy && UsbPolicy.ENABLED_NATIVE == newUsbPolicy) { disableNormalUsb(newVm.getId()); enableSpiceUsb(newVm.getId(), newNumberOfUsbSlots); return; } if (UsbPolicy.ENABLED_NATIVE == oldUsbPolicy && UsbPolicy.ENABLED_NATIVE == newUsbPolicy) { updateSpiceUsb(newVm.getId(), oldNumberOfSlots, newNumberOfUsbSlots); return; } if (UsbPolicy.ENABLED_NATIVE == oldUsbPolicy && UsbPolicy.DISABLED == newUsbPolicy) { disableSpiceUsb(newVm.getId()); enableNormalUsb(newVm); return; } if (UsbPolicy.DISABLED == oldUsbPolicy && UsbPolicy.DISABLED == newUsbPolicy) { updateNormalUsb(newVm); return; } throw new RuntimeException( format("Unexpected state: oldUsbPolicy=%s, newUsbPolicy=%s", oldUsbPolicy, newUsbPolicy)); }
Source:
public AddWanConfigResult(Collection<String> addedPublisherIds, Collection<String> ignoredPublisherIds) { this.addedPublisherIds = addedPublisherIds; this.ignoredPublisherIds = ignoredPublisherIds; }

Target:
public AddWanConfigResult(Collection<String> addedPublisherIds, Collection<String> ignoredPublisherIds) { Preconditions.checkNotNull(addedPublisherIds, "Added publisher IDs must not be null"); Preconditions.checkNotNull(ignoredPublisherIds, "Ignored publisher IDs must not be null"); this.addedPublisherIds = addedPublisherIds; this.ignoredPublisherIds = ignoredPublisherIds; }
Source:
public boolean getTaskForOreon(Actor oreon) { List<EntityRef> availableTasks = oreonHolding.availableTasks; logger.info("Looking for task in " + oreonHolding); if (!availableTasks.isEmpty()) { EntityRef taskEntity = availableTasks.remove(0); TaskComponent taskComponent = taskEntity.getComponent(TaskComponent.class); TaskComponent oreonTaskComponent = oreon.getComponent(TaskComponent.class); oreonTaskComponent.assignedTaskType = taskComponent.assignedTaskType; oreonTaskComponent.creationTime = taskComponent.creationTime; oreonTaskComponent.taskRegion = taskComponent.taskRegion; oreonTaskComponent.taskStatus = TaskStatusType.InProgress; oreon.save(oreonTaskComponent); MinionMoveComponent moveComponent = oreon.getComponent(MinionMoveComponent.class); Vector3i target = oreonTaskComponent.taskRegion.min(); moveComponent.target = new Vector3f(target.x, target.y, target.z); logger.info("Set Oreon target to : " + moveComponent.target); oreon.save(moveComponent); return true; } return false; }

Target:
public boolean getTaskForOreon(Actor oreon) { Queue<EntityRef> availableTasks = oreonHolding.availableTasks; logger.debug("Looking for task in " + oreonHolding); if (!availableTasks.isEmpty()) { EntityRef taskEntity = availableTasks.remove(); TaskComponent taskComponent = taskEntity.getComponent(TaskComponent.class); TaskComponent oreonTaskComponent = oreon.getComponent(TaskComponent.class); oreonTaskComponent.assignedTaskType = taskComponent.assignedTaskType; oreonTaskComponent.creationTime = taskComponent.creationTime; oreonTaskComponent.taskRegion = taskComponent.taskRegion; oreonTaskComponent.taskStatus = TaskStatusType.InProgress; oreon.save(oreonTaskComponent); MinionMoveComponent moveComponent = oreon.getComponent(MinionMoveComponent.class); Vector3i target = oreonTaskComponent.taskRegion.min(); moveComponent.target = new Vector3f(target.x, target.y, target.z); logger.info("Set Oreon target to : " + moveComponent.target); oreon.save(moveComponent); return true; } return false; }
Source:
public <T> T readDataAndStat(String path, Stat stat, boolean returnNullIfPathNotExists) { T data = null; try { data = readData(path, stat); } catch (ZkNoNodeException e) { if (!returnNullIfPathNotExists) { throw e; } } return data; }

Target:
public <T> T readDataAndStat(String path, Stat stat, boolean returnNullIfPathNotExists) { checkIfPathContainsShardingKey(path); return _rawZkClient.readDataAndStat(path, stat, returnNullIfPathNotExists); }
Source:
public void fail_due_to_mixture_of_dtd_and_xsd_with_schema_provided() { File xmlFile = new File("src/test/resources/checks/XmlSchemaCheck/dtd_and_xsd/entities.xml"); String schema = "src/test/resources/checks/XmlSchemaCheck/dtd_and_xsd/entities.xsd"; parseAndCheck(xmlFile, createCheck(schema, null)); assertLog("Unable to validate file .*entities\\.xml.*", true); assertLog("Cause: .*nested\\.xml.*(No such file or directory|The system cannot find the file specified).*", true); }

Target:
public void fail_due_to_mixture_of_dtd_and_xsd_with_schema_provided() { File xmlFile = new File("src/test/resources/checks/XmlSchemaCheck/dtd_and_xsd/entities.xml"); String schema = "src/test/resources/checks/XmlSchemaCheck/dtd_and_xsd/entities.xsd"; parseAndCheck(xmlFile, createCheck(schema, null)); assertLog("Unable to validate file .*entities\\.xml.*", true); String expectedErrorOnLinux = "Cause: .*nested\\.xml.*No such file or directory.*"; String expectedErrorOnWindows = "Cause: .*nested\\.xml.*The system cannot find the file specified.*"; assertTrue(logsContain(expectedErrorOnLinux) || logsContain(expectedErrorOnWindows)); }
Source:
public void setParameter(String name, Object value) { synchronized (fParameters) { if (!fParameterNames.contains(name)) { throw new RuntimeException(NLS.bind(Messages.TmfAbstractAnalysisModule_InvalidParameter, name, getName())); } Object oldValue = fParameters.get(name); fParameters.put(name, value); if ((value != null) && !(value.equals(oldValue))) { parameterChanged(name); } } }

Target:
public synchronized void setParameter(String name, Object value) { if (!fParameterNames.contains(name)) { throw new RuntimeException(NLS.bind(Messages.TmfAbstractAnalysisModule_InvalidParameter, name, getName())); } Object oldValue = fParameters.get(name); fParameters.put(name, value); if ((value != null) && !(value.equals(oldValue))) { parameterChanged(name); } }
Source:
public static boolean isPapyrusContext(Comparison comparison) { IComparisonScope comparisonScope = (IComparisonScope)EcoreUtil.getAdapter(comparison.eAdapters(), IComparisonScope.class); if (comparisonScope != null) { return Iterables.any(comparisonScope.getNsURIs(), new Predicate<String>() { public boolean apply(String input) { return input.contains(PAPYRUS_NS_URI) || input.contains(NOTATION_NS_URI); } }); } for (MatchResource matchResource : comparison.getMatchedResources()) { if (hasPapyrusURI(matchResource)) { return true; } } return false; }

Target:
public static boolean isPapyrusContext(Comparison comparison) { final IComparisonScope2 comparisonScope = (IComparisonScope2)EcoreUtil.getAdapter(comparison .eAdapters(), IComparisonScope2.class); if (comparisonScope != null) { return containsPapyrusURI(comparisonScope.getAllInvolvedResourceURIs()); } return containsPapyrusURI(comparison.getMatchedResources()); }
Source:
public <A> PathBuilder<A> get(String property, Class<A> type) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, type); PathBuilder<A> path = (PathBuilder<A>) properties.get(entry); if (path == null) { Class<? extends A> vtype = validate(property, type); path = new PathBuilder<A>(vtype, forProperty(property), validator); properties.putIfAbsent(entry, path); } return path; }

Target:
public <A> PathBuilder<A> get(String property, Class<A> type) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, type); PathBuilder<A> path = (PathBuilder<A>) properties.get(entry); PathBuilder<?> existingPath = null; if (path == null) { Class<? extends A> vtype = validate(property, type); path = new PathBuilder<A>(vtype, forProperty(property), validator); existingPath = properties.putIfAbsent(entry, path); } return existingPath == null ? path : (PathBuilder<A>) existingPath; }
Source:
public void addColumn(long tableId, ColumnInfo column) { String columnType = sqlColumnType(column.getType()); if (columnType == null) { return; } String sql = format("ALTER TABLE %s ADD COLUMN (%s %s, %s %s)", shardIndexTable(tableId), minColumn(column.getColumnId()), columnType, maxColumn(column.getColumnId()), columnType); int attempts = 0; while (true) { attempts++; try (Handle handle = dbi.open()) { handle.execute(sql); } catch (DBIException e) { if (isSyntaxOrAccessError(e)) { return; } if (attempts >= MAX_ADD_COLUMN_ATTEMPTS) { throw metadataError(e); } log.warn(e, "Failed to alter table with attempt %d, will retry. SQL: %s", attempts, sql); try { TimeUnit.MILLISECONDS.sleep(ADD_COLUMN_RETRY_SLEEP_MS); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new RuntimeException("Interrupted", ie); } } } }

Target:
public void addColumn(long tableId, ColumnInfo column) { String columnType = sqlColumnType(column.getType()); if (columnType == null) { return; } String sql = format("ALTER TABLE %s ADD COLUMN (%s %s, %s %s)", shardIndexTable(tableId), minColumn(column.getColumnId()), columnType, maxColumn(column.getColumnId()), columnType); int attempts = 0; while (true) { attempts++; try (Handle handle = dbi.open()) { handle.execute(sql); } catch (DBIException e) { if (isSyntaxOrAccessError(e)) { return; } if (attempts >= MAX_ADD_COLUMN_ATTEMPTS) { throw metadataError(e); } log.warn(e, "Failed to alter table on attempt %s, will retry. SQL: %s", attempts, sql); try { SECONDS.sleep(3); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw metadataError(ie); } } } }
Source:
public boolean getBoolean(Config config, String section, String subsection, String name, boolean defaultValue) { String n = config.getRawString(section, subsection, name); if (n == null) return defaultValue; if (Config.MAGIC_EMPTY_VALUE == n) return true; try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new IllegalArgumentException(MessageFormat.format( JGitText.get().invalidBooleanValue, section, name, n)); } }

Target:
public boolean getBoolean(Config config, String section, String subsection, String name, boolean defaultValue) { String n = config.getRawString(section, subsection, name); if (n == null) { return defaultValue; } if (Config.MAGIC_EMPTY_VALUE == n) { return true; } try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new IllegalArgumentException(MessageFormat.format( JGitText.get().invalidBooleanValue, section, name, n)); } }
Source:
protected Rollover(Rollover.Builder builder) { super(builder); this.indexName = builder.index; Map<String, Object> rolloverConditions = new HashMap<>(); if (builder.conditions != null) { rolloverConditions.put("conditions", builder.conditions); } if (builder.settings != null) { rolloverConditions.put("settings", builder.conditions); } this.payload = rolloverConditions; setURI(buildURI() + (builder.isDryRun ? "?dry_run" : "")); }

Target:
protected Rollover(Rollover.Builder builder) { super(builder); this.indexName = builder.index; Map<String, Object> rolloverConditions = new HashMap<>(); if (builder.conditions != null) { rolloverConditions.put("conditions", builder.conditions); } if (builder.settings != null) { rolloverConditions.put("settings", builder.settings); } this.payload = rolloverConditions; setURI(buildURI() + (builder.isDryRun ? "?dry_run" : "")); }
Source:
public void testGetStringBuilderCapacityRestrictedToMax() throws Exception { final StringBuilder sb = ConcreteStringLayout.getStringBuilder(); assertEquals("initial capacity", ConcreteStringLayout.DEFAULT_STRING_BUILDER_SIZE, sb.capacity()); final int MEDIUM = ConcreteStringLayout.DEFAULT_STRING_BUILDER_SIZE + 100; final String mediumMessage = new String(new char[MEDIUM]); sb.append(mediumMessage); final int GROWN = sb.capacity(); assertTrue("capacity has grown", GROWN >= MEDIUM); assertEquals("length=msg length", MEDIUM, sb.length()); final int LARGE = 4096; final String largeMessage = new String(new char[LARGE]); final StringBuilder sb2 = ConcreteStringLayout.getStringBuilder(); assertTrue("reset capacity", sb2.capacity() <= AbstractStringLayout.MAX_STRING_BUILDER_SIZE); assertEquals("empty, ready for use", 0, sb2.length()); sb2.append(largeMessage); assertTrue("capacity grown to fit msg length", sb2.capacity() >= LARGE); assertEquals("length=msg length", LARGE, sb2.length()); sb2.setLength(0); assertEquals("empty, cleared", 0, sb2.length()); final StringBuilder next = ConcreteStringLayout.getStringBuilder(); assertEquals("max capacity", ConcreteStringLayout.MAX_STRING_BUILDER_SIZE, next.capacity()); assertEquals("empty, ready for use", 0, next.length()); }

Target:
public void testGetStringBuilderCapacityRestrictedToMax() throws Exception { final StringBuilder sb = ConcreteStringLayout.getStringBuilder(); int initialCapacity = sb.capacity(); assertEquals("initial capacity", ConcreteStringLayout.DEFAULT_STRING_BUILDER_SIZE, sb.capacity()); final int SMALL = 100; final String mediumMessage = new String(new char[SMALL]); sb.append(mediumMessage); assertTrue("capacity not grown", sb.capacity() == initialCapacity); assertEquals("length=msg length", SMALL, sb.length()); final StringBuilder sb2 = ConcreteStringLayout.getStringBuilder(); assertEquals("capacity unchanged", sb2.capacity(), initialCapacity); assertEquals("empty, ready for use", 0, sb2.length()); final int LARGE = ConcreteStringLayout.MAX_STRING_BUILDER_SIZE * 2; final String largeMessage = new String(new char[LARGE]); sb2.append(largeMessage); assertTrue("capacity grown to fit msg length", sb2.capacity() >= LARGE); assertTrue("capacity is now greater than max length", sb2.capacity() >= ConcreteStringLayout.MAX_STRING_BUILDER_SIZE); assertEquals("length=msg length", LARGE, sb2.length()); sb2.setLength(0); assertEquals("empty, cleared", 0, sb2.length()); assertTrue("capacity remains very large", sb2.capacity() >= ConcreteStringLayout.MAX_STRING_BUILDER_SIZE); final StringBuilder next = ConcreteStringLayout.getStringBuilder(); assertEquals("capacity, trimmed to MAX_STRING_BUILDER_SIZE", ConcreteStringLayout.MAX_STRING_BUILDER_SIZE, next.capacity()); assertEquals("empty, ready for use", 0, next.length()); }
Source:
public static long getAdvancedLongConfigProperty(String property, long defaultValue) { String globalPropertyKey = PATH_PREFIX + property; return Long.getLong(globalPropertyKey, defaultValue); }

Target:
public static long getAdvancedLongConfigProperty(String property, long defaultValue) { String globalPropertyKey = PATH_PREFIX + property; return Long.parseLong(System.getProperty(globalPropertyKey, Long.toString(defaultValue))); }
Source:
public Map<String, ByteBuffer> getOperatorState() throws IOException { final Map<String, Object> stateMap = new HashMap<>(); stateMap.put("applyStatefulFunctionState", applyStatefulFunction.getCurrentState()); return StateSerializer.getSerializedStateMap(stateMap); }

Target:
public Map<String, Object> getOperatorState() { final Map<String, Object> stateMap = new HashMap<>(); stateMap.put("applyStatefulFunctionState", applyStatefulFunction.getCurrentState()); return stateMap; }
Source:
public void waitNode(String expectedText) { seleniumWebDriverHelper.waitNoExceptions( () -> seleniumWebDriverHelper.waitSuccessCondition( driver -> { for (int i = 0; i < getActionNodesCount(); i++) { if (isActionNodeContainsText(i, expectedText)) { return true; } } return false; }), ELEMENT_TIMEOUT_SEC, StaleElementReferenceException.class); }

Target:
public void waitNode(String expectedText) { seleniumWebDriverHelper.waitNoExceptions( () -> seleniumWebDriverHelper.waitSuccessCondition( driver -> { for (int i = 0; i < getActionNodesCount(); i++) { if (isActionNodeContainsText(i, expectedText)) { return true; } } return false; }), WIDGET_TIMEOUT_SEC * 2, StaleElementReferenceException.class); }
Source:
public static <K, V> ReadEntryView<K, V> readOnly(CacheEntry<K, V> entry) { return new EntryBackedReadOnlyView<>(entry, null, null); }

Target:
public static <K, V> ReadEntryView<K, V> readOnly(CacheEntry<K, V> entry) { return new EntryBackedReadOnlyView<>(entry, DataConversion.DEFAULT, DataConversion.DEFAULT); }
Source:
String getNext(boolean first) { if (first && inheritNamespaceToken != null && !wrapToken) { String rootTokenNamespacesString = getNamespacesFromNamespaceToken(scanner.findWithinHorizon(inheritNamespaceTokenPattern, 0)); rootTokenNamespaces = rootTokenNamespacesString == null ? null : rootTokenNamespacesString.split(" "); } String next = scanner.findWithinHorizon(tagTokenPattern, 0); if (next == null) { return null; } if (first && wrapToken) { MatchResult mres = scanner.match(); wrapHead = ((RecordableInputStream)in).getText(mres.start()); wrapTail = buildXMLTail(wrapHead); } if (inheritNamespaceToken != null && rootTokenNamespaces != null) { String head = StringHelper.before(next, ">"); boolean empty = false; if (head.endsWith("/")) { head = head.substring(0, head.length() - 1); empty = true; } StringBuilder sb = new StringBuilder(); String tail = StringHelper.after(next, ">"); next = sb.append(head).append(getMissingInherritNamespaces(head)).append(empty ? "/>" : ">").append(tail).toString(); } else if (wrapToken) { StringBuilder sb = new StringBuilder(); next = sb.append(wrapHead).append(next).append(wrapTail).toString(); } return next; }

Target:
String getNext(boolean first) { if (first && inheritNamespaceToken != null && !wrapToken) { rootTokenNamespaces = getNamespacesFromNamespaceTokenSplitter(scanner.findWithinHorizon(inheritNamespaceTokenPattern, 0)); } String next = scanner.findWithinHorizon(tagTokenPattern, 0); if (next == null) { return null; } if (first && wrapToken) { MatchResult mres = scanner.match(); wrapHead = ((RecordableInputStream)in).getText(mres.start()); wrapTail = buildXMLTail(wrapHead); } if (inheritNamespaceToken != null && rootTokenNamespaces != null) { String head = StringHelper.before(next, ">"); boolean empty = false; if (head.endsWith("/")) { head = head.substring(0, head.length() - 1); empty = true; } StringBuilder sb = new StringBuilder(); String tail = StringHelper.after(next, ">"); next = sb.append(head).append(getMissingInherritNamespaces(head)).append(empty ? "/>" : ">").append(tail).toString(); } else if (wrapToken) { StringBuilder sb = new StringBuilder(); next = sb.append(wrapHead).append(next).append(wrapTail).toString(); } return next; }
Source:
protected void serialize(EntityType model, Property field, Type type, CodeWriter writer, String factoryMethod, String... args) throws IOException { String constantFieldName = constantFieldName(field.getEscapedName()); writer.publicStaticFinal(new ClassType(String.class), constantFieldName, "\"" + field.getName() + "\""); Supertype superType = model.getSuperType(); StringBuilder value = new StringBuilder(); if (field.isInherited() && superType != null) { if (!superType.getEntityType().hasEntityFields()) { value.append("_super." + field.getEscapedName()); } } else { value.append(factoryMethod + "(" + constantFieldName); for (String arg : args) { value.append(COMMA + arg); } value.append(")"); } if (field.isInherited()) { writer.line(" } if (value.length() > 0) { writer.publicFinal(type, field.getEscapedName(), value.toString()); } else { writer.publicFinal(type, field.getEscapedName()); } }

Target:
protected void serialize( EntityType model, Property field, Type type, CodeWriter writer, String factoryMethod, String... args ) throws IOException { String constantFieldName = null; if (namesAsConstants) { constantFieldName = constantFieldName(field.getEscapedName()); writer.publicStaticFinal(new ClassType(String.class), constantFieldName, QUOTE + field.getName() + QUOTE); } Supertype superType = model.getSuperType(); StringBuilder value = new StringBuilder(); if (field.isInherited() && superType != null) { if (!superType.getEntityType().hasEntityFields()) { value.append("_super." + field.getEscapedName()); } } else { if (namesAsConstants) { value.append(factoryMethod + "(" + constantFieldName); } else { value.append(factoryMethod + "(" + QUOTE + field.getName() + QUOTE); } for (String arg : args) { value.append(COMMA + arg); } value.append(")"); } if (field.isInherited()) { writer.line(" } if (value.length() > 0) { writer.publicFinal(type, field.getEscapedName(), value.toString()); } else { writer.publicFinal(type, field.getEscapedName()); } }
Source:
private void createSimpleCache() { try { manager.administration().createCache("SimpleCache", (String)null); System.out.println("SimpleCache created"); } catch (Exception e) { System.out.println("Expected to fail for multiple invocations as the cache exists message: " + e.getMessage()); } }

Target:
private void createSimpleCache() { try { manager.administration().createCache("SimpleCache", (String)null); System.out.println("SimpleCache created."); } catch (Exception e) { System.out.println("Expected to fail for multiple invocations as the cache exists message: " + e.getMessage()); } }
Source:
public Collection<Metadata> getAll() { try { lock.readLock().lock(); return Collections.unmodifiableSet(metadata); } finally { lock.readLock().unlock(); } }

Target:
public Collection<Metadata> getAll() { try { lock.readLock().lock(); return Collections.unmodifiableSet(new HashSet<>(metadata)); } finally { lock.readLock().unlock(); } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CoordinatorDynamicConfig that = (CoordinatorDynamicConfig) o; if (millisLagSinceCoordinatorBecomesLeaderBeforeCanMarkAsUnusedOvershadowedSegments != that.millisLagSinceCoordinatorBecomesLeaderBeforeCanMarkAsUnusedOvershadowedSegments) { return false; } if (mergeBytesLimit != that.mergeBytesLimit) { return false; } if (mergeSegmentsLimit != that.mergeSegmentsLimit) { return false; } if (maxSegmentsToMove != that.maxSegmentsToMove) { return false; } if (replicantLifetime != that.replicantLifetime) { return false; } if (replicationThrottleLimit != that.replicationThrottleLimit) { return false; } if (balancerComputeThreads != that.balancerComputeThreads) { return false; } if (emitBalancingStats != that.emitBalancingStats) { return false; } if (killUnusedSegmentsInAllDataSources != that.killUnusedSegmentsInAllDataSources) { return false; } if (maxSegmentsInNodeLoadingQueue != that.maxSegmentsInNodeLoadingQueue) { return false; } if (!Objects.equals(specificDataSourcesToKillUnusedSegmentsIn, that.specificDataSourcesToKillUnusedSegmentsIn)) { return false; } if (!Objects.equals(dataSourcesToNotKillStalePendingSegmentsIn, that.dataSourcesToNotKillStalePendingSegmentsIn)) { return false; } if (!Objects.equals(decommissioningNodes, that.decommissioningNodes)) { return false; } return decommissioningMaxPercentOfMaxSegmentsToMove == that.decommissioningMaxPercentOfMaxSegmentsToMove; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CoordinatorDynamicConfig that = (CoordinatorDynamicConfig) o; if (leadingTimeMillisBeforeCanMarkAsUnusedOvershadowedSegments != that.leadingTimeMillisBeforeCanMarkAsUnusedOvershadowedSegments) { return false; } if (mergeBytesLimit != that.mergeBytesLimit) { return false; } if (mergeSegmentsLimit != that.mergeSegmentsLimit) { return false; } if (maxSegmentsToMove != that.maxSegmentsToMove) { return false; } if (replicantLifetime != that.replicantLifetime) { return false; } if (replicationThrottleLimit != that.replicationThrottleLimit) { return false; } if (balancerComputeThreads != that.balancerComputeThreads) { return false; } if (emitBalancingStats != that.emitBalancingStats) { return false; } if (killUnusedSegmentsInAllDataSources != that.killUnusedSegmentsInAllDataSources) { return false; } if (maxSegmentsInNodeLoadingQueue != that.maxSegmentsInNodeLoadingQueue) { return false; } if (!Objects.equals(specificDataSourcesToKillUnusedSegmentsIn, that.specificDataSourcesToKillUnusedSegmentsIn)) { return false; } if (!Objects.equals(dataSourcesToNotKillStalePendingSegmentsIn, that.dataSourcesToNotKillStalePendingSegmentsIn)) { return false; } if (!Objects.equals(decommissioningNodes, that.decommissioningNodes)) { return false; } return decommissioningMaxPercentOfMaxSegmentsToMove == that.decommissioningMaxPercentOfMaxSegmentsToMove; }
Source:
public String getHadoopJobIdFileName() { String hadoopJobIdFileName = "mapReduceJobId.json"; StringBuilder fileName = new StringBuilder(getContext().getOrDefault(ForkingTaskRunner.INDEX_TASK_DIR, Strings.EMPTY).toString()); fileName.append("/"); fileName.append(hadoopJobIdFileName); return fileName.toString(); }

Target:
public String getHadoopJobIdFileName() { return new File(taskConfig.getTaskDir(getId()), HADOOP_JOB_ID_FILENAME).getAbsolutePath(); }
Source:
public void testSafelyLoadNullFileBytesFile() { try { File nullFile = null; byte[] nullFIleContents = LoadFileUtils.safelyLoadFileBytes(nullFile); } catch (IllegalArgumentException iae) { assertTrue(true); return; } assertTrue("Expected to cause illegal argument exception, but did not.", false); }

Target:
public void testSafelyLoadNullFileBytesFile() { try { File nullFile = null; byte[] nullFIleContents = LoadFileUtils.safelyLoadFileBytes(nullFile); fail("Expected to cause illegal argument exception, but did not."); } catch (IllegalArgumentException iae) { } }