auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected List<Entitlement> createEntitlements(Consumer consumer, Map<String, Integer> poolQuantityMap, CallerType caller) throws EntitlementRefusedException { BindContext context = new BindContext(poolCurator, consumerCurator, i18n); context = BindContext.build(context, consumer, poolQuantityMap); BindChain chain = new BindChain(); PreEntitlementRulesCheck rules = new PreEntitlementRulesCheck(enforcer); chain.addOperation(PreEntitlementRulesCheck.build(rules, caller)); chain.addOperation(new HandleEntitlements(poolCurator, entitlementCurator)); chain.addOperation(new ToDo(this)); HandleCertificates certOp = new HandleCertificates(ecGenerator, entitlementCertificateCurator, entitlementCurator); chain.addOperation(certOp); ComplianceCommand complianceCommand = new ComplianceCommand(complianceRules); chain.addOperation(complianceCommand); chain.preProcess(context); if (context.getException() == null) { context.lockPools(); chain.execute(context); } if (context.getException() != null) { throw context.getException(); } poolCurator.flush(); return new ArrayList<Entitlement>(context.getEntitlementMap().values()); }

Target:
protected List<Entitlement> createEntitlements(Consumer consumer, Map<String, Integer> poolQuantityMap, CallerType caller) throws EntitlementRefusedException { Collection<Entitlement> ents = bindChainFactory. create(consumer, poolQuantityMap, caller). run(); poolCurator.flush(); return new ArrayList<Entitlement>(ents); }
Source:
public void performApply(ILaunchConfigurationWorkingCopy wconfig) { wconfig.setAttribute(PerfPlugin.ATTR_Kernel_Location, txtKernelLocation.getText()); wconfig.setAttribute(PerfPlugin.ATTR_Record_Realtime, chkRecordRealtime.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_Record_Verbose, chkRecordVerbose.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_SourceLineNumbers, chkSourceLineNumbers.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_Kernel_SourceLineNumbers, chkKernelSourceLineNumbers.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_Multiplex, chkMultiplexEvents.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_ModuleSymbols, chkModuleSymbols.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_HideUnresolvedSymbols, chkHideUnresolvedSymbols.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_ShowSourceDisassembly, chkShowSourceDisassembly.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_ShowStat, chkShowStat.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_StatRunCount, statRunCount.getSelection()); if(chkShowStat.getSelection()){ toggleButtonsEnablement(false); } else{ toggleButtonsEnablement(true); } }

Target:
public void performApply(ILaunchConfigurationWorkingCopy wconfig) { wconfig.setAttribute(PerfPlugin.ATTR_Kernel_Location, txtKernelLocation.getText()); wconfig.setAttribute(PerfPlugin.ATTR_Record_Realtime, chkRecordRealtime.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_Record_Verbose, chkRecordVerbose.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_SourceLineNumbers, chkSourceLineNumbers.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_Kernel_SourceLineNumbers, chkKernelSourceLineNumbers.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_Multiplex, chkMultiplexEvents.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_ModuleSymbols, chkModuleSymbols.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_HideUnresolvedSymbols, chkHideUnresolvedSymbols.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_ShowSourceDisassembly, chkShowSourceDisassembly.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_ShowStat, chkShowStat.getSelection()); wconfig.setAttribute(PerfPlugin.ATTR_StatRunCount, statRunCount.getSelection()); }
Source:
public InputStream getRequestEntity() { try { if (!(requestEntity instanceof ResettableServletInputStreamWrapper)) { requestEntity = new ResettableServletInputStreamWrapper( ByteStreams.toByteArray(requestEntity)); } requestEntity.reset(); } finally { return requestEntity; } }

Target:
public InputStream getRequestEntity() { if (requestEntity == null) { return requestEntity; } try { if (!(requestEntity instanceof ResettableServletInputStreamWrapper)) { requestEntity = new ResettableServletInputStreamWrapper( StreamUtils.copyToByteArray(requestEntity)); } requestEntity.reset(); } finally { return requestEntity; } }
Source:
public void setPropertyValue(String propertyName, String value){ setParam("property."+propertyName+".default", value); }

Target:
public void setPropertyValue(String propertyName, String value){ setParam("property."+propertyName, value); }
Source:
public void testConfigRoundtrip() throws Exception { String name = "testSlave"; JCloudsSlaveTemplate originalTemplate = new JCloudsSlaveTemplate(name, "imageId", "hardwareId", 1, 512, "osFamily", "osVersion", "jclouds-slave-type1 jclouds-type2", "Description", "initScript", null, "1", false, null, null, true, null, "jenkins", false, null, false, 5, 0, true, "jenkins", true); List<JCloudsSlaveTemplate> templates = new ArrayList<JCloudsSlaveTemplate>(); templates.add(originalTemplate); JCloudsCloud originalCloud = new JCloudsCloud("aws-profile", "aws-ec2", "identity", "credential", "privateKey", "publicKey", "endPointUrl", 1, 30, 600*1000, 600*1000, templates); hudson.clouds.add(originalCloud); submit(createWebClient().goTo("configure").getFormByName("config")); assertEqualBeans(originalCloud, JCloudsCloud.getByName("aws-profile"), "profile,providerName,identity,credential,privateKey,publicKey,endPointUrl"); assertEqualBeans(originalTemplate, JCloudsCloud.getByName("aws-profile").getTemplate(name), "name,cores,ram,osFamily,osVersion,labelString,description,initScript,numExecutors,stopOnTerminate"); }

Target:
public void testConfigRoundtrip() throws Exception { String name = "testSlave"; JCloudsSlaveTemplate originalTemplate = new JCloudsSlaveTemplate(name, "imageId", "hardwareId", 1, 512, "osFamily", "osVersion", "jclouds-slave-type1 jclouds-type2", "Description", "initScript", null, "1", false, null, null, true, null, "jenkins", false, null, false, 5, 0, true, "jenkins", true); List<JCloudsSlaveTemplate> templates = new ArrayList<JCloudsSlaveTemplate>(); templates.add(originalTemplate); JCloudsCloud originalCloud = new JCloudsCloud("aws-profile", "aws-ec2", "identity", "credential", "privateKey", "publicKey", "endPointUrl", 1, 30, 600*1000, 600*1000, null, templates); hudson.clouds.add(originalCloud); submit(createWebClient().goTo("configure").getFormByName("config")); assertEqualBeans(originalCloud, JCloudsCloud.getByName("aws-profile"), "profile,providerName,identity,credential,privateKey,publicKey,endPointUrl"); assertEqualBeans(originalTemplate, JCloudsCloud.getByName("aws-profile").getTemplate(name), "name,cores,ram,osFamily,osVersion,labelString,description,initScript,numExecutors,stopOnTerminate"); }
Source:
public void testPostCommentPerIssue() throws Exception { when(config.getIssueSeverityThreshold()).thenReturn(Severity.INFO); when(stashCommentsReport1.contains(stashCommentMessage1, FILE_PATH_1, 1)).thenReturn(true); when(stashCommentsReport1.contains(stashCommentMessage2, FILE_PATH_1, 2)).thenReturn(false); when(stashCommentsReport2.contains(stashCommentMessage3, FILE_PATH_2, 1)).thenReturn(false); myFacade.postCommentPerIssue(pr, report, diffReport, stashClient); verify(stashClient, times(0)).postCommentLineOnPullRequest(pr, stashCommentMessage1, FILE_PATH_1, 1, STASH_DIFF_TYPE); verify(stashClient, times(1)).postCommentLineOnPullRequest(pr, stashCommentMessage2, "path/to/file1", 2, STASH_DIFF_TYPE); verify(stashClient, times(1)).postCommentLineOnPullRequest(pr, stashCommentMessage3, "path/to/file2", 1, STASH_DIFF_TYPE); }

Target:
public void testPostCommentPerIssue() throws Exception { when(stashCommentsReport1.contains(stashCommentMessage1, FILE_PATH_1, 1)).thenReturn(true); when(stashCommentsReport1.contains(stashCommentMessage2, FILE_PATH_1, 2)).thenReturn(false); when(stashCommentsReport2.contains(stashCommentMessage3, FILE_PATH_2, 1)).thenReturn(false); myFacade.postCommentPerIssue(pr, report, diffReport, stashClient); verify(stashClient, times(0)).postCommentLineOnPullRequest(pr, stashCommentMessage1, FILE_PATH_1, 1, STASH_DIFF_TYPE); verify(stashClient, times(1)).postCommentLineOnPullRequest(pr, stashCommentMessage2, "path/to/file1", 2, STASH_DIFF_TYPE); verify(stashClient, times(1)).postCommentLineOnPullRequest(pr, stashCommentMessage3, "path/to/file2", 1, STASH_DIFF_TYPE); }
Source:
public WebAppForbiddenException() { super(Response .status(Response.Status.FORBIDDEN) .entity(new HashMap<String,String>() {{ put("status", "failed"); put("message", "Not Authorized");}}) .build()); }

Target:
public WebAppForbiddenException() { super(Response .status(Response.Status.FORBIDDEN) .type(MediaType.APPLICATION_JSON) .entity(myMap) .build()); }
Source:
public Mono<Void> deleteModel(String modelId) { return deleteModelWithResponse(modelId) .map(response -> response.getValue()); }

Target:
public Mono<Void> deleteModel(String modelId) { return deleteModelWithResponse(modelId) .map(Response::getValue); }
Source:
public HttpResponse<InstanceInfo> sendHeartBeat(String appName, String id, InstanceInfo info, InstanceStatus overriddenStatus) { ClientResponse response = null; try { String urlPath = "apps/" + appName + "/" + id; WebResource webResource = getJerseyApacheClient().resource(serviceUrl) .path(urlPath) .queryParam("status", info.getStatus().toString()) .queryParam("lastDirtyTimestamp", info.getLastDirtyTimestamp().toString()); if (overriddenStatus != null) { webResource = webResource.queryParam("overriddenstatus", overriddenStatus.name()); } addExtraHeaders(webResource); response = webResource.accept(MediaType.APPLICATION_JSON_TYPE).put(ClientResponse.class); InstanceInfo infoFromPeer = null; if (response.getStatus() == Status.OK.getStatusCode() && response.hasEntity()) { infoFromPeer = response.getEntity(InstanceInfo.class); } return HttpResponse.responseWith(response.getStatus(), infoFromPeer); } finally { if (response != null) { response.close(); } } }

Target:
public HttpResponse<InstanceInfo> sendHeartBeat(String appName, String id, InstanceInfo info, InstanceStatus overriddenStatus) { String urlPath = "apps/" + appName + '/' + id; ClientResponse response = null; try { WebResource webResource = getJerseyApacheClient().resource(serviceUrl) .path(urlPath) .queryParam("status", info.getStatus().toString()) .queryParam("lastDirtyTimestamp", info.getLastDirtyTimestamp().toString()); if (overriddenStatus != null) { webResource = webResource.queryParam("overriddenstatus", overriddenStatus.name()); } Builder requestBuilder = webResource.getRequestBuilder(); addExtraHeaders(requestBuilder); return HttpResponse.responseWith(response.getStatus()); } finally { if (logger.isDebugEnabled()) { logger.debug("[heartbeat] Jersey HTTP PUT {}; statusCode={}", urlPath, response == null ? "N/A" : response.getStatus()); } if (response != null) { response.close(); } } }
Source:
private void addBasicParameters(TestExecutionBuilder testExecutionBuilder, Report report) { testExecutionBuilder.parameter("exec.config", report.getConfiguration().name); testExecutionBuilder.parameter("exec.jenkins_build_url", jenkinsBuildUrl); testExecutionBuilder.parameter("exec.jenkins_build_number", jenkinsBuild); if (buildParams != null) { for (Map.Entry<String, String> buildParam : buildParams.entrySet()) { testExecutionBuilder.parameter(buildParam.getKey(), buildParam.getValue()); } } if (buildParamsFile != null) { Properties paramsFromFile = new Properties(); try { paramsFromFile.load(new FileInputStream(buildParamsFile)); } catch (IOException e) { log.warn("Error while loading build parameters from file", e); } for (Map.Entry<Object, Object> entry : paramsFromFile.entrySet()) { testExecutionBuilder.parameter((String) entry.getKey(), (String) entry.getValue()); } } }

Target:
private void addBasicParameters(TestExecutionBuilder testExecutionBuilder, Report report) { testExecutionBuilder.parameter("exec.config", report.getConfiguration().name); testExecutionBuilder.parameter("exec.jenkins_build_url", jenkinsBuildUrl); testExecutionBuilder.parameter("exec.jenkins_build_number", jenkinsBuild); if (buildParams != null) { for (Map.Entry<String, String> buildParam : buildParams.entrySet()) { testExecutionBuilder.parameter(buildParam.getKey(), buildParam.getValue()); } } if (buildParamsFile != null) { Properties paramsFromFile = new Properties(); try (FileInputStream fileInputStream = new FileInputStream(buildParamsFile)) { paramsFromFile.load(fileInputStream); } catch (IOException e) { log.warn("Error while loading build parameters from file", e); } for (Map.Entry<Object, Object> entry : paramsFromFile.entrySet()) { testExecutionBuilder.parameter((String) entry.getKey(), (String) entry.getValue()); } } }
Source:
protected void processHandRelease(float xvel, float yvel, boolean isCloseBeforeDragged) { float minVelocity = mDragHelper.getMinVelocity(); View surfaceView = getSurfaceView(); DragEdge currentDragEdge = null; try { currentDragEdge = mCurrentDragEdge; } catch (Exception e) { e.printStackTrace(); } if(currentDragEdge == null || surfaceView == null){ return; } float willOpenPercent = (isCloseBeforeDragged ? .25f : .75f); if(currentDragEdge == DragEdge.Left){ if(xvel > minVelocity) open(); else if(xvel < -minVelocity) close(); else{ float openPercent = 1f * getSurfaceView().getLeft() / mDragDistance; if(openPercent > willOpenPercent ) open(); else close(); } }else if(currentDragEdge == DragEdge.Right){ if(xvel > minVelocity) close(); else if(xvel < -minVelocity) open(); else{ float openPercent = 1f * (-getSurfaceView().getLeft()) / mDragDistance; if(openPercent > willOpenPercent ) open(); else close(); } }else if(currentDragEdge == DragEdge.Top){ if(yvel > minVelocity) open(); else if(yvel < -minVelocity) close(); else{ float openPercent = 1f * getSurfaceView().getTop() / mDragDistance; if(openPercent > willOpenPercent ) open(); else close(); } }else if(currentDragEdge == DragEdge.Bottom){ if(yvel > minVelocity) close(); else if(yvel < -minVelocity) open(); else{ float openPercent = 1f * (-getSurfaceView().getTop()) / mDragDistance; if(openPercent > willOpenPercent ) open(); else close(); } } }

Target:
protected void processHandRelease(float xvel, float yvel, boolean isCloseBeforeDragged) { float minVelocity = mDragHelper.getMinVelocity(); View surfaceView = getSurfaceView(); DragEdge currentDragEdge = mCurrentDragEdge; if(currentDragEdge == null || surfaceView == null){ return; } float willOpenPercent = (isCloseBeforeDragged ? .25f : .75f); if(currentDragEdge == DragEdge.Left){ if(xvel > minVelocity) open(); else if(xvel < -minVelocity) close(); else{ float openPercent = 1f * getSurfaceView().getLeft() / mDragDistance; if(openPercent > willOpenPercent ) open(); else close(); } }else if(currentDragEdge == DragEdge.Right){ if(xvel > minVelocity) close(); else if(xvel < -minVelocity) open(); else{ float openPercent = 1f * (-getSurfaceView().getLeft()) / mDragDistance; if(openPercent > willOpenPercent ) open(); else close(); } }else if(currentDragEdge == DragEdge.Top){ if(yvel > minVelocity) open(); else if(yvel < -minVelocity) close(); else{ float openPercent = 1f * getSurfaceView().getTop() / mDragDistance; if(openPercent > willOpenPercent ) open(); else close(); } }else if(currentDragEdge == DragEdge.Bottom){ if(yvel > minVelocity) close(); else if(yvel < -minVelocity) open(); else{ float openPercent = 1f * (-getSurfaceView().getTop()) / mDragDistance; if(openPercent > willOpenPercent ) open(); else close(); } } }
Source:
public void initialise() { renderingConfig = config.getRendering(); blur = worldRenderer.getMaterial("engine:prog.blur"); requireDynamicFBO(new FBOConfig(BLUR_0_URN, 0.5f, FBO.Type.DEFAULT)); requireDynamicFBO(new FBOConfig(BLUR_1_URN, 0.5f, FBO.Type.DEFAULT)); requireDynamicFBO(new FBOConfig(TONE_MAPPED_URN, 1.0f, FBO.Type.HDR)); }

Target:
public void initialise() { renderingConfig = config.getRendering(); blur = worldRenderer.getMaterial("engine:prog.blur"); requiresFBO(new FBOConfig(BLUR_0, HALF_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(BLUR_1, HALF_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(TONE_MAPPED, FULL_SCALE, FBO.Type.HDR), displayResolutionDependentFBOs); }
Source:
public void verifyThreadClosed(String userName, String reason, String message) { refreshPage(); Assertion.assertStringContains(driver.findElement(firstMessageWrapperBy).findElement(closeThreadInfobox).getText(), userName + " closed this thread because:\n" + reason); }

Target:
public void verifyThreadClosed(String userName, String reason, String message) { refreshPage(); Assertion.assertStringContains( driver.findElement(firstMessageWrapperBy).findElement(closeThreadInfobox).getText(), userName + " closed this thread because:\n" + reason ); PageObjectLogging.log("verifyThreadClosed", "verifyed thread closed", true); }
Source:
public ParseServices(Json json) { super(json, TypeLiteral.get(Services.class)); }

Target:
ParseServices(Json json) { super(json, TypeLiteral.get(Services.class)); }
Source:
public void setMessage(HttpMessage msg) { String query = null; try { query = msg.getRequestHeader().getURI().getQuery(); } catch (URIException e) { log.error(e.getMessage(), e); } if (query == null || query.isEmpty()) { if (msg.getRequestBody().length() == 0) { return; } } List<HttpHeaderField> httpHeaders = msg.getRequestHeader().getHeaders(); if (httpHeaders == null) return; int headerPos=0; for (HttpHeaderField header : httpHeaders) { boolean ignoreHeader = false; for (int idx = 0; idx < nonInjectableHeaders.length; idx++) { if ( header.getName().equalsIgnoreCase(nonInjectableHeaders[idx])) { ignoreHeader=true; break; } } if (!ignoreHeader) { params.add(new NameValuePair(NameValuePair.TYPE_HEADER, header.getName(), header.getValue(), headerPos++)); } } }

Target:
public void setMessage(HttpMessage msg) { String query = null; try { query = msg.getRequestHeader().getURI().getQuery(); } catch (URIException e) { log.error(e.getMessage(), e); } if (query == null || query.isEmpty()) { if (msg.getRequestBody().length() == 0) { return; } } List<HttpHeaderField> httpHeaders = msg.getRequestHeader().getHeaders(); int headerPos=0; for (HttpHeaderField header : httpHeaders) { if (! NON_INJECTABLE_HEADERS.contains(header.getName().toLowerCase(Locale.ROOT))) { params.add(new NameValuePair(NameValuePair.TYPE_HEADER, header.getName(), header.getValue(), headerPos++)); } } }
Source:
public void testAllocationFromCameraFlexibleYuv() throws Exception { if (SystemProperties.getBoolean("ro.config.low_ram", false)) { return; } final int NUM_FRAME_VERIFIED = 1; mCameraIterable.forEachCamera(new CameraBlock() { @Override public void run(CameraDevice camera) throws CameraAccessException { mSizeIterable.forEachSize(YUV_420_888, new SizeBlock() { @Override public void run(final Size size) throws CameraAccessException { try (ScriptGraph scriptGraph = ScriptGraph.create() .configureInputWithSurface(size, YUV_420_888) .chainScript(ScriptYuvToRgb.class) .buildGraph()) { if (VERBOSE) Log.v(TAG, "Prepared ScriptYuvToRgb for size " + size); CaptureRequest request = configureAndCreateRequestForSurface(scriptGraph.getInputSurface()).build(); mResultIterable.forEachResultRepeating( request, NUM_FRAME_VERIFIED, new ResultBlock() { @Override public void run(CaptureResult result) throws CameraAccessException { scriptGraph.advanceInputWaiting(); scriptGraph.execute(); validateInputOutputNotZeroes(scriptGraph, size); scriptGraph.advanceInputAndDrop(); } }); stopCapture(); if (VERBOSE) Log.v(TAG, "Cleanup Renderscript cache"); scriptGraph.close(); RenderScriptSingleton.clearContext(); RenderScriptSingleton.setContext(getContext()); } } }); } }); }

Target:
public void testAllocationFromCameraFlexibleYuv() throws Exception { final int NUM_FRAME_VERIFIED = 1; mCameraIterable.forEachCamera(new CameraBlock() { @Override public void run(CameraDevice camera) throws CameraAccessException { mSizeIterable.forEachSize(YUV_420_888, new SizeBlock() { @Override public void run(final Size size) throws CameraAccessException { try (ScriptGraph scriptGraph = ScriptGraph.create() .configureInputWithSurface(size, YUV_420_888) .chainScript(ScriptYuvToRgb.class) .buildGraph()) { if (VERBOSE) Log.v(TAG, "Prepared ScriptYuvToRgb for size " + size); CaptureRequest request = configureAndCreateRequestForSurface(scriptGraph.getInputSurface()).build(); mResultIterable.forEachResultRepeating( request, NUM_FRAME_VERIFIED, new ResultBlock() { @Override public void run(CaptureResult result) throws CameraAccessException { scriptGraph.advanceInputWaiting(); scriptGraph.execute(); validateInputOutputNotZeroes(scriptGraph, size); scriptGraph.advanceInputAndDrop(); } }); stopCapture(); if (VERBOSE) Log.v(TAG, "Cleanup Renderscript cache"); scriptGraph.close(); RenderScriptSingleton.clearContext(); RenderScriptSingleton.setContext(getContext()); } } }); } }); }
Source:
public static void assertParentRepairFailedWithMessageContains(AbstractCluster<?> cluster, int coordinator, String ks, String table, String message) { ResultSet rs = queryParentRepairHistory(cluster, coordinator, ks, table); validateExistingParentRepair(rs, row -> { Assert.assertNotNull("finished_at not found, alears the repair is not complete?", rs.getTimestamp("finished_at")); Assert.assertNotNull("Exception not found", rs.getString("exception_stacktrace")); String exceptionMessage = rs.getString("exception_message"); Assert.assertNotNull("Exception not found", exceptionMessage); Assert.assertTrue("Unable to locate message '" + message + "' in repair error message: " + exceptionMessage, exceptionMessage.contains(message)); }); }

Target:
public static void assertParentRepairFailedWithMessageContains(AbstractCluster<?> cluster, int coordinator, String ks, String table, String message) { QueryResult rs = queryParentRepairHistory(cluster, coordinator, ks, table); validateExistingParentRepair(rs, row -> { Assert.assertNotNull("finished_at not found, the repair is not complete?", row.getTimestamp("finished_at")); Assert.assertNotNull("Exception not found", row.getString("exception_stacktrace")); String exceptionMessage = row.getString("exception_message"); Assert.assertNotNull("Exception not found", exceptionMessage); Assert.assertTrue("Unable to locate message '" + message + "' in repair error message: " + exceptionMessage, exceptionMessage.contains(message)); }); }
Source:
public Collection<ArtifactToken> getRelated(ArtifactId artifact, RelationTypeSide relationType) { List<ArtifactToken> results = new ArrayList<>(); if (artifact instanceof ArtifactReadable) { for (ArtifactReadable art : getArtifact(artifact).getRelated(relationType)) { results.add(art); } } else if (artifact instanceof IAtsObject) { IAtsObject iAtsObject = (IAtsObject) artifact; for (ArtifactReadable art : getArtifact(iAtsObject.getStoreObject()).getRelated(relationType)) { results.add(art); } } return results; }

Target:
public Collection<ArtifactToken> getRelated(ArtifactId artifact, RelationTypeSide relationType) { List<ArtifactToken> results = new ArrayList<>(); for (ArtifactReadable art : getArtifact(artifact).getRelated(relationType)) { if (art != null) { results.add(art); } } return results; }
Source:
public void testNotRetrieveHostName() { try { InetAddress address = mock(InetAddress.class); when(address.getCanonicalHostName()).thenReturn("worker10"); when(address.getHostName()).thenReturn("worker10"); when(address.getHostAddress()).thenReturn("127.0.0.1"); TaskManagerLocation info = new TaskManagerLocation(ResourceID.generate(), address, 19871, false); assertNotEquals("worker10", info.getHostname()); assertNotEquals("worker10", info.getFQDNHostname()); assertEquals("127.0.0.1", info.getHostname()); assertEquals("127.0.0.1", info.getFQDNHostname()); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }

Target:
public void testNotRetrieveHostName() { InetAddress address = mock(InetAddress.class); when(address.getCanonicalHostName()).thenReturn("worker10"); when(address.getHostName()).thenReturn("worker10"); when(address.getHostAddress()).thenReturn("127.0.0.1"); TaskManagerLocation info = new TaskManagerLocation(ResourceID.generate(), address, 19871, new TaskManagerLocation.IpOnlyHostNameSupplier(address)); assertNotEquals("worker10", info.getHostname()); assertNotEquals("worker10", info.getFQDNHostname()); assertEquals("127.0.0.1", info.getHostname()); assertEquals("127.0.0.1", info.getFQDNHostname()); }
Source:
public static Object withBlockingDetails(String description, Callable code) throws Exception { Task current = current(); if (current instanceof BasicTask) ((BasicTask)current).setBlockingDetails(description); if (code!=null) { try { return code.call(); } finally { if (current instanceof BasicTask) ((BasicTask)current).setBlockingDetails(null); } } return null; }

Target:
public static Object withBlockingDetails(String description, Callable code) throws Exception { Task current = current(); if (code==null) { log.warn("legacy invocation of withBlockingDetails with null code block, ignoring"); return null; } if (current instanceof BasicTask) ((BasicTask)current).setBlockingDetails(description); try { return code.call(); } finally { if (current instanceof BasicTask) ((BasicTask)current).setBlockingDetails(null); } }
Source:
protected void showMergeDialog(List<T> selectedItems) { if (adapter.getSelectedItems().size() <= 1) { ToastUtil.showError(getContext(), R.string.am_merge_error); } else { TextInputDialog.Builder builder = new TextInputDialog.Builder(getContext()); builder.setHint(getString(R.string.project_name_label)) .setPositiveButton(getString(R.string.ok), (TextInputDialog.OnClickListener) (dialog, textInput) -> { Toast.makeText(getContext(), "Merging " + selectedItems.get(0).getName() + " and " + selectedItems.get(1).getName(), Toast.LENGTH_LONG).show(); }); builder.setTitle(R.string.new_project_dialog_title) .setNegativeButton(R.string.cancel, null) .show(); } setShowProgressBar(true); finishActionMode(); }

Target:
protected void showMergeDialog(List<T> selectedItems) { if (adapter.getSelectedItems().size() <= 1) { ToastUtil.showError(getContext(), R.string.am_merge_error); } else { TextInputDialog.Builder builder = new TextInputDialog.Builder(getContext()); builder.setHint(getString(R.string.project_name_label)) .setPositiveButton(getString(R.string.ok), (TextInputDialog.OnClickListener) (dialog, textInput) -> { mergeProjects(selectedItems, textInput); }); builder.setTitle(R.string.new_merge_project_dialog_title) .setNegativeButton(R.string.cancel, null) .show(); } setShowProgressBar(true); finishActionMode(); }
Source:
public JsonParserIterator( JavaType typeRef, Future<InputStream> future, String url, @Nullable Query<T> query, String host, ObjectMapper objectMapper, BytesAccumulatingResponseHandler responseHandler ) { this.typeRef = typeRef; this.future = future; this.url = url; this.query = query; jp = null; this.host = host; this.objectMapper = objectMapper; this.responseHandler = responseHandler; this.timeoutAt = query != null ? query.<Long>getContextValue(DirectDruidClient.QUERY_FAIL_TIME, -1L) : -1L; this.hasTimeout = timeoutAt > -1; }

Target:
public JsonParserIterator( JavaType typeRef, Future<InputStream> future, String url, @Nullable Query<T> query, String host, ObjectMapper objectMapper, BytesAccumulatingResponseHandler responseHandler ) { this.typeRef = typeRef; this.future = future; this.url = url; if (query != null) { this.timeoutAt = query.<Long>getContextValue(DirectDruidClient.QUERY_FAIL_TIME, -1L); this.queryId = query.getId(); } else { this.timeoutAt = -1; this.queryId = null; } this.jp = null; this.host = host; this.objectMapper = objectMapper; this.responseHandler = responseHandler; this.hasTimeout = timeoutAt > -1; }
Source:
public void setColor(int color) { this.setColor(color, color); }

Target:
public void setColor(int color) { setColor(color, color); }
Source:
public boolean checkForSubscriptions(String queueName) throws AndesException { SubscriptionStore subscriptionStore = new SubscriptionStore(); Map<String, LocalSubscription> subscriptionMapForQueue = subscriptionStore.getLocalSubscriptionMap(queueName, false); if(subscriptionMapForQueue.isEmpty()) return false; else return true; }

Target:
public boolean checkForSubscriptions(String queueName) throws AndesException { SubscriptionStore subscriptionStore = new SubscriptionStore(); Map<String, LocalSubscription> subscriptionMapForQueue = subscriptionStore.getLocalSubscriptionMap(queueName, false); if(subscriptionMapForQueue.isEmpty()) { return false; } else{ return true; } }
Source:
private void performImportScript(String[] csv) throws Exception { String filename = "test.csv"; BufferedWriter out = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(filename), "UTF-8")); for (String csvLine : csv) { out.write(csvLine + "\n"); } out.flush(); out.close(); out = null; runDSpaceScript("metadata-import", "-f", "test.csv", "-e", "admin@email.com", "-s"); File file = new File(filename); if (file.exists()) { file.delete(); } }

Target:
private void performImportScript(String[] csv) throws Exception { String filename = "test.csv"; BufferedWriter out = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(filename), "UTF-8")); for (String csvLine : csv) { out.write(csvLine + "\n"); } out.flush(); out.close(); out = null; runDSpaceScript("metadata-import", "-f", filename, "-e", "admin@email.com", "-s"); File file = new File(filename); if (file.exists()) { file.delete(); } }
Source:
private EncodingParams buildTagEncodingForSize(final int tagValueSize, final int tagID) { return new ByteArrayLenEncoding( new CanonicalHuffmanIntegerEncoding(new int[] { tagValueSize }, new int[] { 0 }), new ExternalByteArrayEncoding(tagID)).toParam(); }

Target:
private EncodingParams buildTagEncodingForSize(final int tagValueSize, final int tagID) { return new ByteArrayLenEncoding( new CanonicalHuffmanIntegerEncoding(new int[] { tagValueSize }, singleZero), new ExternalByteArrayEncoding(tagID)).toParam(); }
Source:
public ServiceResponseMapper<? extends ValueLocator> buildServiceResponseMapper(PluginTask task) { JacksonServiceResponseMapper.Builder builder = JacksonServiceResponseMapper.builder(); builder.add("marketoGUID", Types.STRING) .add("leadId", Types.STRING) .add("activityDate", Types.TIMESTAMP, "%Y-%m-%dT%H:%M:%S%z") .add("activityTypeId", Types.STRING) .add("campaignId", Types.STRING) .add("primaryAttributeValueId", Types.STRING) .add("primaryAttributeValue", Types.STRING) .add("attributes", Types.JSON); return builder.build(); }

Target:
public ServiceResponseMapper<? extends ValueLocator> buildServiceResponseMapper(PluginTask task) { JacksonServiceResponseMapper.Builder builder = JacksonServiceResponseMapper.builder(); builder.add("marketoGUID", Types.STRING) .add("leadId", Types.STRING) .add("activityDate", Types.TIMESTAMP, MarketoUtils.MARKETO_DATE_TIME_FORMAT) .add("activityTypeId", Types.STRING) .add("campaignId", Types.STRING) .add("primaryAttributeValueId", Types.STRING) .add("primaryAttributeValue", Types.STRING) .add("attributes", Types.JSON); return builder.build(); }
Source:
public void testToolbar() { List<SWTBotToolbarButton> buttons = fViewBot.getToolbarButtons(); String[] tooltipsArray = {"Align Views", "Optimize", "", "Show View Filters", "Show Legend", "", "Reset the Time Scale to Default", "Select Previous State Change", "Select Next State Change", "", "Add Bookmark...", "Previous Marker", "Next Marker", "", "Select Previous Process", "Select Next Process", "Zoom In", "Zoom Out", "", "Hide Arrows", "Follow CPU Backward", "Follow CPU Forward", "Go to previous event of the selected thread", "Go to next event of the selected thread"}; List<String> tooltipsExpected = Arrays.asList(tooltipsArray); List<String> tooltips = new ArrayList<>(); for(SWTBotToolbarButton button : buttons){ tooltips.add(button.getToolTipText()); assertTrue(button.getText() + " enabled", button.isEnabled()); assertTrue(button.getText() + " visible", button.isVisible()); } assertEquals(tooltipsExpected, tooltips); }

Target:
public void testToolbar() { List<SWTBotToolbarButton> buttons = fViewBot.getToolbarButtons(); List<String> tooltipsExpected = getToolbarTooltips(); List<String> tooltips = new ArrayList<>(); for (SWTBotToolbarButton button : buttons) { tooltips.add(button.getToolTipText()); assertTrue(button.getText() + " enabled", button.isEnabled()); assertTrue(button.getText() + " visible", button.isVisible()); } assertEquals(tooltipsExpected, tooltips); }
Source:
public Maintainable toMaintenance() { final StatusTransitioner.Transition st = statusTransitioner.maintenance(); try { final Maintainable maintainable = new Maintainable() { private LocalPersistenceService persistenceService; @Override public void create() { EhcacheManager.this.create(); } @Override public void destroy() { startPersistenceService(); EhcacheManager.this.destroy(); persistenceService.destroyAllPersistenceContext(); stopPersistenceService(); } @Override public void close() { statusTransitioner.exitMaintenance(); } private void startPersistenceService() { persistenceService = serviceLocator.getService(LocalPersistenceService.class); persistenceService.start(serviceLocator); } private void stopPersistenceService() { persistenceService.stop(); } }; st.succeeded(); return maintainable; } catch (RuntimeException e) { throw st.failed(e); } }

Target:
public Maintainable toMaintenance() { final StatusTransitioner.Transition st = statusTransitioner.maintenance(); startPersistenceService(); try { final Maintainable maintainable = new Maintainable() { private LocalPersistenceService persistenceService = serviceLocator.getService(LocalPersistenceService.class); @Override public void create() { EhcacheManager.this.create(); } @Override public void destroy() { EhcacheManager.this.destroy(); persistenceService.destroyAllPersistenceContext(); } @Override public void close() { persistenceService.stop(); statusTransitioner.exitMaintenance(); } }; st.succeeded(); return maintainable; } catch (RuntimeException e) { throw st.failed(e); } }
Source:
public void createAndTriggerReplicationWithSourceIamAuth() throws Exception { mockWebServer.enqueue(JSON_OK); CloudantClient c = CloudantClientHelper.newMockWebServerClientBuilder(mockWebServer) .build(); c.replication() .source(sourceDbUrl) .sourceIamApiKey(EXPECTED_OK_COOKIE) .target(targetDbUrl) .trigger(); RecordedRequest[] requests = takeN(mockWebServer, 1); assertEquals(requests[0].getPath(), "/_replicate"); String body = requests[0].getBody().readString(Charset.forName("UTF-8")); assertThat("The replication document should contain the source IAM API key", body, containsString(authJson + EXPECTED_OK_COOKIE)); assertThat("The replication document should contain the correct target", body, containsString("\"target\":\"" + targetDbUrl + "\"")); }

Target:
public void createAndTriggerReplicationWithSourceIamAuth() throws Exception { server.enqueue(JSON_OK); CloudantClient c = CloudantClientHelper.newMockWebServerClientBuilder(server) .build(); c.replication() .source(sourceDbUrl) .sourceIamApiKey(IAM_API_KEY) .target(targetDbUrl) .trigger(); RecordedRequest[] requests = takeN(server, 1); assertEquals(requests[0].getPath(), "/_replicate"); String body = requests[0].getBody().readUtf8(); assertThat("The replication document should contain the source IAM API key", body, containsString(authJson + IAM_API_KEY)); assertThat("The replication document should contain the correct target", body, containsString("\"target\":\"" + targetDbUrl + "\"")); }
Source:
private static <A extends Annotation> A findAnnotation(AnnotatedElement annotatedElement, Class<A> annotationType, Set<Annotation> visited) { Annotation[] anns = annotatedElement.getAnnotations(); for (Annotation ann : anns) { if (JHelper.objectSameReference(ann.annotationType(), annotationType)) { return (A) ann; } } for (Annotation ann : anns) { if (!isInJavaLangAnnotationPackage(ann) && visited.add(ann)) { A annotation = findAnnotation(ann.annotationType(), annotationType, visited); if (annotation != null) { return annotation; } } } return null; }

Target:
private static <A extends Annotation> A findAnnotation(AnnotatedElement annotatedElement, Class<A> annotationType, Set<Annotation> visited) { Annotation[] anns = annotatedElement.getAnnotations(); for (Annotation ann : anns) { if (ann.annotationType() == annotationType) { return (A) ann; } } for (Annotation ann : anns) { if (!isInJavaLangAnnotationPackage(ann) && visited.add(ann)) { A annotation = findAnnotation(ann.annotationType(), annotationType, visited); if (annotation != null) { return annotation; } } } return null; }
Source:
public ResponseBodyData readFile(String requestId) throws IOException { InputStream in = mContext.openFileInput(getFilename(requestId)); try { int firstByte = in.read(); if (firstByte == -1) { throw new EOFException("Failed to read base64Encode byte"); } ResponseBodyData bodyData = new ResponseBodyData(); bodyData.base64Encoded = firstByte != 0; if (mRequestIdMap.containsKey(requestId)) { AsyncPrettyPrinter asyncPrettyPrinter = mRequestIdMap.get(requestId); bodyData.data = prettyPrintContent(in, asyncPrettyPrinter); } else { bodyData.data = readContentsAsUTF8(in); } return bodyData; } finally { in.close(); } }

Target:
public ResponseBodyData readFile(String requestId) throws IOException { InputStream in = mContext.openFileInput(getFilename(requestId)); try { int firstByte = in.read(); if (firstByte == -1) { throw new EOFException("Failed to read base64Encode byte"); } ResponseBodyData bodyData = new ResponseBodyData(); bodyData.base64Encoded = firstByte != 0; AsyncPrettyPrinter asyncPrettyPrinter = mRequestIdMap.get(requestId); if (asyncPrettyPrinter != null) { bodyData.data = prettyPrintContentWithTimeOut(asyncPrettyPrinter, in); } else { bodyData.data = Util.readAsUTF8(in); } return bodyData; } finally { in.close(); } }
Source:
public void updated(final String name) { try { final String path = getZNodePath(name); zkClient.setData().forPath(path, new byte[0]); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public void updated(final String name) throws Exception { final String path = getZNodePath(name); created(name); zkClient.setData().forPath(path, new byte[0]); }
Source:
public void addUserMetaData(Map<String, String> userMetaDataMap) { StringBuilder userMetadata = new StringBuilder("?SDK=Android&Version=" + SDK_VERSION); if (userMetaDataMap != null) { for (Map.Entry<String, String> metaData : userMetaDataMap.entrySet()) { userMetadata.append("&" + metaData.getKey() + "=" + metaData.getValue()); } } if(userMetadata.length() > 255) { LOGGER.warn("Too many characters. User metadata was truncated.", new IllegalArgumentException("Total number of characters in user metadata" + " cannot exceed " + (255 - ("?SDK=Android&Version=" + SDK_VERSION).length()))); this.userMetaData = userMetadata.substring(0, 255); } else { this.userMetaData = userMetadata.toString(); } }

Target:
public void addUserMetaData(Map<String, String> userMetaDataMap) { StringBuilder userMetadata = new StringBuilder("?SDK=Android&Version=" + SDK_VERSION); int baseLength = userMetadata.length(); if (userMetaDataMap != null) { for (Map.Entry<String, String> metaData : userMetaDataMap.entrySet()) { userMetadata.append("&" + metaData.getKey() + "=" + metaData.getValue()); } } if(userMetadata.length() > 255) { LOGGER.warn("Too many characters. User metadata was truncated.", new IllegalArgumentException("Total number of characters in user metadata" + " cannot exceed " + (255 - baseLength))); this.userMetaData = userMetadata.substring(0, 255); } else { this.userMetaData = userMetadata.toString(); } }
Source:
public List<VlanVO> listVlansForPod(long podId) { List<PodVlanMapVO> vlanMaps = _podVlanMapDao.listPodVlanMapsByPod(podId); List<VlanVO> result = new ArrayList<VlanVO>(); for (PodVlanMapVO pvmvo : vlanMaps) { VlanVO vlanByPodId = findById(pvmvo.getVlanDbId()); if (vlanByPodId != null && vlanByPodId.getRemoved() == null) { result.add(vlanByPodId); } } return result; }

Target:
public List<VlanVO> listVlansForPod(long podId) { List<PodVlanMapVO> vlanMaps = _podVlanMapDao.listPodVlanMapsByPod(podId); List<VlanVO> result = new ArrayList<VlanVO>(); for (PodVlanMapVO pvmvo : vlanMaps) { VlanVO vlanByPodId = findById(pvmvo.getVlanDbId()); if (vlanByPodId != null) { result.add(vlanByPodId); } } return result; }
Source:
public ClasspathResourceDataSchemaResolver(ClassLoader classLoader) { for (DataSchemaParserFactory parserForFormat: BUILTIN_FORMAT_PARSER_FACTORIES) { SingleFormatClasspathSchemaResolver resolver = new SingleFormatClasspathSchemaResolver(parserForFormat); resolver.setExtension("." + parserForFormat.getLanguageExtension()); addResolver(resolver); } _classLoader = classLoader; }

Target:
public ClasspathResourceDataSchemaResolver(ClassLoader classLoader) { for (DataSchemaParserFactory parserForFormat: BUILTIN_FORMAT_PARSER_FACTORIES) { addResolver(new SingleFormatClasspathSchemaResolver(parserForFormat)); } _classLoader = classLoader; }
Source:
private Map<String, Object> generateJsonDiskDescription(Map<String, Object> descriptionFields, String... descriptionFieldsPriority) { Map<String, Object> descriptionMap = new TreeMap<>(); int descriptionAvailableLength = METADATA_DESCRIPTION_MAX_LENGTH; for (int priority = 0; priority < descriptionFieldsPriority.length; ++priority) { String fieldName = descriptionFieldsPriority[priority]; String fieldValue = descriptionFields.get(fieldName).toString(); descriptionAvailableLength = addFieldToDescriptionMap(descriptionMap, fieldName, fieldValue, descriptionAvailableLength); if (descriptionAvailableLength < 0) { String diskAlias = descriptionFields.get(DISK_ALIAS).toString(); String storedFieldValue = (String) descriptionMap.get(fieldName); String[] descriptionFieldsLeft = Arrays.copyOfRange(descriptionFieldsPriority, priority, descriptionFieldsPriority.length); String diskFieldsNames = StringUtils.join(descriptionFieldsLeft, ", ", 0, descriptionFieldsLeft.length); if (storedFieldValue == null) { auditLogFailedToStoreDiskFields(diskAlias, diskFieldsNames); } else if (storedFieldValue.length() < fieldValue.length()) { auditLogFailedToStoreEntireDiskField(diskAlias, fieldName, storedFieldValue, diskFieldsNames); } break; } } return descriptionMap; }

Target:
private Map<String, Object> generateJsonDiskDescription(Map<String, Object> descriptionFields, String... descriptionFieldsPriority) { Map<String, Object> descriptionMap = new TreeMap<>(); int descriptionAvailableLength = METADATA_DESCRIPTION_MAX_LENGTH; for (int priority = 0; priority < descriptionFieldsPriority.length; ++priority) { String fieldName = descriptionFieldsPriority[priority]; String fieldValue = descriptionFields.get(fieldName).toString(); descriptionAvailableLength = addFieldToDescriptionMap(descriptionMap, fieldName, fieldValue, descriptionAvailableLength); if (descriptionAvailableLength <= 0) { if (!auditLogIfFieldWasNotAddedSuccessfully(descriptionFields, descriptionMap, fieldName, fieldValue, descriptionFieldsPriority, priority)) { break; } } } return descriptionMap; }
Source:
public Configuration loadConfiguration() throws ConfigurationException, IOException { nexusDefaults.loadConfiguration(); if ( getConfigurationFile() == null || getConfigurationFile().getAbsolutePath().contains( "${" ) ) { throw new ConfigurationException( "The configuration file is not set or resolved properly: " + getConfigurationFile().getAbsolutePath() ); } if ( !getConfigurationFile().exists() ) { getLogger().warn( "No configuration file in place, copying the default one and continuing with it." ); setConfiguration( nexusDefaults.getConfiguration() ); saveConfiguration( getConfigurationFile() ); configurationDefaulted = true; } else { configurationDefaulted = false; } try { loadConfiguration( getConfigurationFile() ); setConfigurationUpgraded( false ); } catch ( ConfigurationException e ) { getLogger().info( "Configuration file is out to dated, begin upgrade" ); upgradeConfiguration( getConfigurationFile() ); setConfigurationUpgraded( true ); loadConfiguration( getConfigurationFile() ); this.eventMulticaster.notifyEventListeners( new SecurityConfigurationChangedEvent( null ) ); } upgradeNexusVersion(); ValidationResponse vResponse = getConfigurationValidator().validateModel( new ValidationRequest( getConfiguration() ) ); dumpValidationErrors( vResponse ); setValidationResponse( vResponse ); if ( vResponse.isValid() ) { if ( vResponse.isModified() ) { getLogger().info( "Validation has modified the configuration, storing the changes." ); storeConfiguration(); } return getConfiguration(); } else { throw new InvalidConfigurationException( vResponse ); } }

Target:
public Configuration loadConfiguration() throws ConfigurationException, IOException { nexusDefaults.loadConfiguration(); if ( getConfigurationFile() == null || getConfigurationFile().getAbsolutePath().contains( "${" ) ) { throw new ConfigurationException( "The configuration file is not set or resolved properly: " + getConfigurationFile().getAbsolutePath() ); } if ( !getConfigurationFile().exists() ) { getLogger().warn( "No configuration file in place, copying the default one and continuing with it." ); setConfiguration( nexusDefaults.getConfiguration() ); saveConfiguration( getConfigurationFile() ); configurationDefaulted = true; } else { configurationDefaulted = false; } try { loadConfiguration( getConfigurationFile() ); setConfigurationUpgraded( false ); } catch ( ConfigurationException e ) { getLogger().info( "Configuration file is outdated, begin upgrade" ); upgradeConfiguration( getConfigurationFile() ); setConfigurationUpgraded( true ); loadConfiguration( getConfigurationFile() ); this.eventMulticaster.notifyEventListeners( new SecurityConfigurationChangedEvent( null ) ); } upgradeNexusVersion(); ValidationResponse vResponse = getConfigurationValidator().validateModel( new ValidationRequest( getConfiguration() ) ); dumpValidationErrors( vResponse ); setValidationResponse( vResponse ); if ( vResponse.isValid() ) { if ( vResponse.isModified() ) { getLogger().info( "Validation has modified the configuration, storing the changes." ); storeConfiguration(); } return getConfiguration(); } else { throw new InvalidConfigurationException( vResponse ); } }
Source:
public static Collection<Node> getNodes(AdminClient adminClient, List<Integer> nodeIds, Boolean allNodes) { Collection<Node> nodes = null; if(allNodes) { nodes = adminClient.getAdminClientCluster().getNodes(); } else { nodes = new ArrayList<Node>(); for(Integer nodeId: nodeIds) { nodes.add(adminClient.getAdminClientCluster().getNodeById(nodeId)); } } if(nodes.size() == 0) throw new VoldemortException("The cluster doesn't have any node."); return nodes; }

Target:
public static Collection<Node> getNodes(AdminClient adminClient, List<Integer> nodeIds, Boolean allNodes) { Collection<Node> nodes = null; if(allNodes) { nodes = adminClient.getAdminClientCluster().getNodes(); } else { nodes = new ArrayList<Node>(); for(Integer nodeId: nodeIds) { nodes.add(adminClient.getAdminClientCluster().getNodeById(nodeId)); } } if(nodes.size() == 0) { throw new VoldemortException("The cluster doesn't have any node."); } return nodes; }
Source:
private DefaultCategoryDataset createJunitExecutionBarDataset() { double diffSeconds = Math.abs(averageTestDurationSeconds - junitRunsCount); double diffMinutes = Math.abs(averageTestDurationMinutes - junitRunsCount); final DefaultCategoryDataset result = new DefaultCategoryDataset(); result.setValue(junitRunsCount, "1", "Number of Test Runs"); if (diffSeconds < diffMinutes) result.setValue(averageTestDurationSeconds, "1", "Test Run Average Duration (in seconds)"); else result.setValue(averageTestDurationMinutes, "1", "Test Run Average Duration (in minutes)"); return result; }

Target:
private DefaultCategoryDataset createJunitExecutionBarDataset() { double differenceSeconds = Math.abs(averageTestDurationSeconds - junitRunsCount); double differenceMinutes = Math.abs(averageTestDurationMinutes - junitRunsCount); DefaultCategoryDataset result = new DefaultCategoryDataset(); result.setValue(junitRunsCount, "1", "Number of Test Runs"); String TestDuration = "Average Test Run Duration"; if (differenceSeconds < differenceMinutes) { result.setValue(averageTestDurationSeconds, "1", TestDuration + " (in seconds)"); } else { result.setValue(averageTestDurationMinutes, "1", TestDuration + " (in minutes)"); } return result; }