auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AcknowledgementType auditLog(LogEventRequestType request, AssertionType assertion) { LOG.debug("Entering AuditRepositoryProxyWebServiceSecured.auditLog(...)"); AcknowledgementType result = new AcknowledgementType(); if (request.getAuditMessage() == null) { LOG.error("Audit Request Message is null"); return result; } try { String url = oProxyHelper.getUrlLocalHomeCommunity(NhincConstants.AUDIT_REPO_SECURE_SERVICE_NAME); if (NullChecker.isNotNullish(url)) { ServicePortDescriptor<AuditRepositoryManagerSecuredPortType> portDescriptor = new AuditRepositorySecuredServicePortDescriptor(); CONNECTClient<AuditRepositoryManagerSecuredPortType> client = CONNECTCXFClientFactory.getInstance() .getCONNECTClientSecured(portDescriptor, url, assertion); result = (AcknowledgementType) client.invokePort(AuditRepositoryManagerSecuredPortType.class, invokeMethodName, createLogSecureEventRequestType(request)); } } catch (Exception e) { LOG.error("Failed to call the web service({}). An unexpected exception occurred. Exception: {}", NhincConstants.AUDIT_REPO_SECURE_SERVICE_NAME, e.getLocalizedMessage(), e); } LOG.debug("In AuditRepositoryProxyWebServiceSecured.auditLog(...) - completed called to ConnectionManager to " + "retrieve endpoint."); return result; }

Target:
public AcknowledgementType auditLog(LogEventRequestType request, AssertionType assertion) { LOG.debug("Entering AuditRepositoryProxyWebServiceSecured.auditLog(...)"); AcknowledgementType result = new AcknowledgementType(); if (request.getAuditMessage() == null) { LOG.error("Audit Request Message is null"); return result; } try { String url = oProxyHelper.getUrlLocalHomeCommunity(NhincConstants.AUDIT_REPO_SECURE_SERVICE_NAME); if (NullChecker.isNotNullish(url)) { ServicePortDescriptor<AuditRepositoryManagerSecuredPortType> portDescriptor = new AuditRepositorySecuredServicePortDescriptor(); CONNECTClient<AuditRepositoryManagerSecuredPortType> client = CONNECTCXFClientFactory.getInstance() .getCONNECTClientSecured(portDescriptor, url, assertion); result = (AcknowledgementType) client.invokePort(AuditRepositoryManagerSecuredPortType.class, invokeMethodName, createLogSecureEventRequestType(request)); } } catch (Exception e) { LOG.error("Failed to call the web service({}). An unexpected exception occurred. Exception: {}", NhincConstants.AUDIT_REPO_SECURE_SERVICE_NAME, e.getLocalizedMessage(), e); } LOG.debug( "In AuditRepositoryProxyWebServiceSecured.auditLog(...) - completed called to ConnectionManager to retrieve endpoint."); return result; }
Source:
public void checkMoveJavaClassInNewSourceFolder() { projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.quickExpandWithJavaScript(); projectExplorer.openItemByPath(PATH_TO_FILE); projectExplorer.waitAndSelectItem(PROJECT_NAME); createNewFolder(NEW_FOLDER_NAME); projectExplorer.waitAndSelectItem(PROJECT_NAME + "/" + NEW_FOLDER_NAME); createNewFolder(NEW_SOURCE_FOLDER); projectExplorer.waitAndSelectItem(PATH_NEW_SOURCE_FOLDER); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test/" + NEW_SOURCE_FOLDER); projectExplorer.clickOnItemInContextMenu(BUILD_PATH); projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER); projectExplorer.waitDefinedTypeOfFolder(PATH_NEW_SOURCE_FOLDER, JAVA_SOURCE_FOLDER); projectExplorer.waitAndSelectItem(PATH_NEW_SOURCE_FOLDER); projectExplorer.openContextMenuByPathSelectedItem(PATH_NEW_SOURCE_FOLDER); createPackage(); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.waitAndSelectItem(PATH_TO_FILE); WaitUtils.sleepQuietly(11); projectExplorer.launchRefactorMoveByKeyboard(); refactor.waitMoveItemFormIsOpen(); refactor.clickOnExpandIconTree(PROJECT_NAME); refactor.clickOnExpandIconTree("/test/java"); loader.waitOnClosed(); refactor.chooseDestinationForItem(NEW_PACKAGE_NAME); refactor.clickOkButtonRefactorForm(); refactor.waitMoveItemFormIsClosed(); loader.waitOnClosed(); projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/org/ltd/ATest.java"); }

Target:
public void checkMoveJavaClassInNewSourceFolder() { projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.quickExpandWithJavaScript(); projectExplorer.openItemByPath(PATH_TO_FILE); projectExplorer.waitAndSelectItem(PROJECT_NAME); createNewFolder(NEW_FOLDER_NAME); projectExplorer.waitAndSelectItem(PROJECT_NAME + "/" + NEW_FOLDER_NAME); createNewFolder(NEW_SOURCE_FOLDER); projectExplorer.waitAndSelectItem(PATH_NEW_SOURCE_FOLDER); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test/" + NEW_SOURCE_FOLDER); projectExplorer.clickOnItemInContextMenu(BUILD_PATH); projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER); projectExplorer.waitDefinedTypeOfFolder(PATH_NEW_SOURCE_FOLDER, JAVA_SOURCE_FOLDER); projectExplorer.waitAndSelectItem(PATH_NEW_SOURCE_FOLDER); projectExplorer.openContextMenuByPathSelectedItem(PATH_NEW_SOURCE_FOLDER); createPackage(); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.waitAndSelectItem(PATH_TO_FILE); projectExplorer.launchRefactorMoveByKeyboard(); refactor.waitMoveItemFormIsOpen(); refactor.clickOnExpandIconTree(PROJECT_NAME); refactor.clickOnExpandIconTree("/test/java"); loader.waitOnClosed(); refactor.chooseDestinationForItem(NEW_PACKAGE_NAME); refactor.clickOkButtonRefactorForm(); refactor.waitMoveItemFormIsClosed(); loader.waitOnClosed(); projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/org/ltd/ATest.java"); }
Source:
public boolean isTeleportBackWhenFreedFromJail() { return config.getBoolean("teleport-back-when-freed-from-jail", true); }

Target:
public boolean isTeleportBackWhenFreedFromJail() { return teleportBackWhenFreedFromJail; }
Source:
public boolean isClusterProxyApplicable(String cloudPlatform) { return clusterProxyConfiguration.isClusterProxyIntegrationEnabled() && !CloudPlatform.MOCK.name().equals(cloudPlatform); }

Target:
public boolean isClusterProxyApplicable(String cloudPlatform) { return clusterProxyConfiguration.isClusterProxyIntegrationEnabled() && !clusterProxyDisabledPlatforms.contains(cloudPlatform); }
Source:
private void startCswSource() throws Exception { getServiceManager().waitForHttpEndpoint(CSW_PATH + "?_wadl"); getServiceManager() .createManagedService( CSW_FEDERATED_SOURCE_FACTORY_PID, getCswSourceProperties(CSW_SOURCE_ID, CSW_PATH.getUrl(), getServiceManager())); await("Waiting for CSW source to initialize") .atMost(10, TimeUnit.MINUTES) .pollDelay(1, TimeUnit.SECONDS) .until( () -> getServiceManager() .getServiceReferences(FederatedSource.class, null) .stream() .map(getServiceManager()::getService) .filter(src -> CSW_SOURCE_ID.equals(src.getId())) .anyMatch(Source::isAvailable)); }

Target:
private void startCswSource() throws Exception { getServiceManager().waitForHttpEndpoint(CSW_PATH + "?_wadl"); getServiceManager() .createManagedService( CSW_FEDERATED_SOURCE_FACTORY_PID, getCswSourceProperties(CSW_SOURCE_ID, CSW_PATH.getUrl(), getServiceManager())); await("Waiting for CSW source to initialize") .atMost(10, TimeUnit.MINUTES) .pollDelay(1, TimeUnit.SECONDS) .until(this::areSourcesReady); }
Source:
public void coalesceWhiteSpacesSingleLine() { String text = " Text with extra spaces. In the start, middle and end "; String expected = "Text with extra spaces. In the start, middle and end"; String result = Util.coalesceWhiteSpaces(text); Assert.assertEquals("White spaces should be coalesce to single white space", expected, result); }

Target:
public void coalesceWhiteSpacesSingleLine() { String text = " Text with extra spaces. In the start, middle and end "; String expected = "Text with extra spaces. In the start, middle and end"; String result = Util.coalesceWhitespace(text); Assert.assertEquals("White spaces should be coalesce to single white space", expected, result); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } XmlEntry other = (XmlEntry) obj; if (fBaseQuark != other.fBaseQuark) { return false; } if (fDisplayQuark != other.fDisplayQuark) { return false; } if (!Objects.equals(fElement, other.fElement)) { return false; } if (!Objects.equals(fId, other.fId)) { return false; } if (!Objects.equals(fParentId, other.fParentId)) { return false; } if (!fSs.equals(other.fSs)) { return false; } if (!fTrace.equals(other.fTrace)) { return false; } if (!Objects.equals(fType, other.fType)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } XmlEntry other = (XmlEntry) obj; if (fBaseQuark != other.fBaseQuark) { return false; } if (fDisplayQuark != other.fDisplayQuark) { return false; } if (!Objects.equals(fElement, other.fElement)) { return false; } if (!Objects.equals(fId, other.fId)) { return false; } if (!Objects.equals(fParentId, other.fParentId)) { return false; } if (!fSs.equals(other.fSs)) { return false; } if (!fTrace.equals(other.fTrace)) { return false; } if (fType != other.fType) { return false; } return true; }
Source:
public void creationSucceedsIfGivenValue() { new Authenticator(Mockito.mock(AuthenticationChecker.class), Mockito.mock(AuthenticationOptionChecker.class)); }

Target:
public void creationSucceedsIfGivenValue() { Authenticator auth = new Authenticator(Mockito.mock(AuthenticationChecker.class), Mockito.mock(AuthenticationOptionChecker.class)); Assert.assertNotNull(auth); }
Source:
public void testWillMessageIsReceivedWithNonRetain() throws Exception { getServer().createQueue(SimpleString.toSimpleString("will"), RoutingType.MULTICAST, SimpleString.toSimpleString("will"), null, true, false); MQTT mqtt = createMQTTConnection("1", false); mqtt.setKeepAlive((short) 1); mqtt.setWillMessage("test message with non-retain"); mqtt.setWillTopic("will"); mqtt.setWillQos(QoS.AT_LEAST_ONCE); mqtt.setWillRetain(false); final BlockingConnection connection = mqtt.blockingConnection(); connection.connect(); Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisfied() throws Exception { return connection.isConnected(); } }); connection.kill(); Thread.sleep(10000); MQTT mqtt2 = createMQTTConnection("2", false); BlockingConnection connection2 = mqtt2.blockingConnection(); connection2.connect(); connection2.subscribe(new Topic[]{new Topic("will", QoS.AT_LEAST_ONCE)}); Message m = connection2.receive(1000, TimeUnit.MILLISECONDS); assertNotNull(m); m.ack(); assertEquals("test message with non-retain", new String(m.getPayload())); }

Target:
public void testWillMessageIsReceivedWithNonRetain() throws Exception { getServer().createQueue(SimpleString.toSimpleString("will"), RoutingType.MULTICAST, SimpleString.toSimpleString("will"), null, true, false); MQTT mqtt = createMQTTConnection("1", false); mqtt.setKeepAlive((short) 1); mqtt.setWillMessage("test message with non-retain"); mqtt.setWillTopic("will"); mqtt.setWillQos(QoS.AT_LEAST_ONCE); mqtt.setWillRetain(false); final BlockingConnection connection = mqtt.blockingConnection(); connection.connect(); Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisfied() throws Exception { return connection.isConnected(); } }); final CountDownLatch latch = new CountDownLatch(1); server.getRemotingService().getConnections().iterator().next().addCloseListener(new CloseListener() { @Override public void connectionClosed() { latch.countDown(); } }); connection.kill(); latch.await(10, TimeUnit.SECONDS); MQTT mqtt2 = createMQTTConnection("2", false); BlockingConnection connection2 = mqtt2.blockingConnection(); connection2.connect(); connection2.subscribe(new Topic[]{new Topic("will", QoS.AT_LEAST_ONCE)}); Message m = connection2.receive(1000, TimeUnit.MILLISECONDS); assertNotNull(m); m.ack(); assertEquals("test message with non-retain", new String(m.getPayload())); }
Source:
getProblems(@QueryParam("table") @Pattern(regexp = ALPHA_NUM_REGEX_BLANK_OK) String table) { Map<String,Object> model = getModel(); model.put("title", "Per-Table Problem Report"); model.put("template", "problems.ftl"); model.put("js", "problems.js"); if (!table.isBlank()) { model.put("table", table); } return model; }

Target:
getProblems(@QueryParam("table") @Pattern(regexp = ALPHA_NUM_REGEX_BLANK_OK) String table) { Map<String,Object> model = getModel(); model.put("title", "Per-Table Problem Report"); model.put("template", "problems.ftl"); model.put("js", "problems.js"); if (table != null && !table.isBlank()) { model.put("table", table); } return model; }
Source:
public void createCDIProjectWithoutBeansXml(){ cleanUpTheWorkspace(); CDIProjectWizard cw = new CDIProjectWizard(); cw.open(); WebProjectFirstPage fp = new WebProjectFirstPage(cw); fp.setProjectName(PROJECT_NAME); if (CDIVersion.equals("2.0")) { new DefaultCombo(2).setSelection("Dynamic Web Project with CDI 2.0 (Contexts and Dependency Injection)"); } assertEquals(sr.getRuntimeName(),fp.getTargetRuntime()); assertEquals("Dynamic Web Project with CDI "+CDIVersion+" (Contexts and Dependency Injection)",fp.getConfiguration()); if (isJavaLE8() || CDIVersion.equals("1.0")) { fp.activateFacet("1.8", "Java"); } else { fp.activateFacet("11", "Java"); } cw.next(); cw.next(); cw.next(); CDIInstallWizardPage ip = new CDIInstallWizardPage(cw); ip.toggleCreateBeansXml(false); cw.finish(); new WaitUntil(new JobIsRunning(), TimePeriod.DEFAULT, false); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); setWorkspaceDefaultJREForJava8(); isCDISupportEnabled(PROJECT_NAME); isCDIFacetEnabled(PROJECT_NAME, CDIVersion); ProjectExplorer pe = new ProjectExplorer(); pe.open(); assertTrue(pe.containsProject(PROJECT_NAME)); assertFalse(pe.getProject(PROJECT_NAME).containsResource("WebContent","WEB-INF","beans.xml")); new WaitUntil(new ProblemExists(ProblemType.ALL), TimePeriod.LONG, false); if (CDIVersion.equals("1.0")) { assertTrue(new ProblemExists(ProblemType.ALL).test()); } else { new WaitWhile(new ProblemExists(ProblemType.ALL)); } }

Target:
public void createCDIProjectWithoutBeansXml(){ CDIProjectWizard cw = new CDIProjectWizard(); cw.open(); WebProjectFirstPage fp = new WebProjectFirstPage(cw); fp.setProjectName(PROJECT_NAME); if (CDIVersion.equals("2.0")) { new DefaultCombo(2).setSelection("Dynamic Web Project with CDI 2.0 (Contexts and Dependency Injection)"); } assertEquals(sr.getRuntimeName(),fp.getTargetRuntime()); assertEquals("Dynamic Web Project with CDI "+CDIVersion+" (Contexts and Dependency Injection)",fp.getConfiguration()); activateFacets(fp); cw.next(); cw.next(); cw.next(); CDIInstallWizardPage ip = new CDIInstallWizardPage(cw); ip.toggleCreateBeansXml(false); cw.finish(); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); isCDISupportEnabled(PROJECT_NAME); isCDIFacetEnabled(PROJECT_NAME, CDIVersion); ProjectExplorer pe = new ProjectExplorer(); pe.open(); assertTrue(pe.containsProject(PROJECT_NAME)); assertFalse(pe.getProject(PROJECT_NAME).containsResource("WebContent","WEB-INF","beans.xml")); new WaitUntil(new ProblemExists(ProblemType.ALL), TimePeriod.LONG, false); if (CDIVersion.equals("1.0")) { assertTrue(new ProblemExists(ProblemType.ALL).test()); } else { new WaitWhile(new ProblemExists(ProblemType.ALL)); } }
Source:
private void updateActionTotals(Result result) { if(result.getAction().equals(Result.Action.INSERT)) { actionTotals.incrementTotalInsert(); } else if(result.getAction().equals(Result.Action.UPDATE)){ actionTotals.incrementTotalUpdate(); } else { actionTotals.incrementTotalError(); } }

Target:
private void updateActionTotals(Result result) { if(result.getAction().equals(Result.Action.INSERT)) { actionTotals.incrementTotalInsert(); } else if(result.getAction().equals(Result.Action.UPDATE)){ actionTotals.incrementTotalUpdate(); } else if(result.getStatus().equals(Result.Status.FAILURE)) { actionTotals.incrementTotalError(); } }
Source:
public void getCountryShouldReturnCountry() { Assert.assertEquals(Fixtures.loadUser(new HashMap<String, String>() {{ put("country", "foobar"); }}).getCountry(), "foobar"); }

Target:
public void getCountryShouldReturnCountry() { User user = Fixtures.loadUser(new HashMap<String, String>() {{ put("country", "foobar"); }}); Assert.assertEquals(user.getCountry(), "foobar"); }
Source:
public Value toValue() { try { byte[] labelBytes = label.getBytes(CHARSET_NAME); int labelBytesLength = labelBytes.length; byte[] vertexIdBytes = vertexId.getBytes(CHARSET_NAME); int vertexIdBytesLength = vertexIdBytes.length; int len = 4 + labelBytesLength + 4 + vertexIdBytesLength; byte[] buffer = new byte[len]; int offset = 0; writeInt(labelBytesLength, buffer, offset); offset += 4; System.arraycopy(labelBytes, 0, buffer, offset, labelBytesLength); offset += labelBytesLength; writeInt(vertexIdBytesLength, buffer, offset); offset += 4; System.arraycopy(vertexIdBytes, 0, buffer, offset, vertexIdBytesLength); return new Value(buffer); } catch (UnsupportedEncodingException ex) { throw new VertexiumAccumuloIteratorException("Could not encode edge info", ex); } }

Target:
public Value toValue() { byte[] labelBytes = label.getBytes(StandardCharsets.UTF_8); int labelBytesLength = labelBytes.length; byte[] vertexIdBytes = vertexId.getBytes(StandardCharsets.UTF_8); int vertexIdBytesLength = vertexIdBytes.length; int len = Integer.BYTES + labelBytesLength + Integer.BYTES + vertexIdBytesLength; byte[] buffer = new byte[len]; int offset = 0; writeInt(labelBytesLength, buffer, offset); offset += Integer.BYTES; System.arraycopy(labelBytes, 0, buffer, offset, labelBytesLength); offset += labelBytesLength; writeInt(vertexIdBytesLength, buffer, offset); offset += Integer.BYTES; System.arraycopy(vertexIdBytes, 0, buffer, offset, vertexIdBytesLength); return new Value(buffer); }
Source:
public boolean deCoupleMbusDevice(final DeviceMessageMetadata deviceMessageMetadata, final DeCoupleMbusDeviceRequestData requestData) throws FunctionalException { final String deviceIdentification = deviceMessageMetadata.getDeviceIdentification(); final String mbusDeviceIdentification = requestData.getMbusDeviceIdentification(); LOGGER.debug("decoupleMbusDevice for organizationIdentification: for gateway: {}, m-bus device ", deviceMessageMetadata.getOrganisationIdentification(), deviceIdentification, mbusDeviceIdentification); try { final SmartMeter gatewayDevice = this.domainHelperService.findSmartMeter(deviceIdentification); final SmartMeter mbusDevice = this.domainHelperService.findSmartMeter(mbusDeviceIdentification); this.checkAndHandleInactiveMbusDevice(mbusDevice); if (mbusDevice.getChannel() == null) { return false; } else { final DecoupleMbusDto decoupleMbusDto = new DecoupleMbusDto(mbusDeviceIdentification, mbusDevice.getChannel()); final RequestMessage requestMessage = new RequestMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), deviceMessageMetadata.getDeviceIdentification(), gatewayDevice.getIpAddress(), decoupleMbusDto); this.osgpCoreRequestMessageSender.send(requestMessage, deviceMessageMetadata.getMessageType(), deviceMessageMetadata.getMessagePriority(), deviceMessageMetadata.getScheduleTime()); return true; } } catch (final FunctionalException ex) { throw ex; } }

Target:
public void deCoupleMbusDevice(final DeviceMessageMetadata deviceMessageMetadata, final DeCoupleMbusDeviceRequestData requestData) throws FunctionalException { final String deviceIdentification = deviceMessageMetadata.getDeviceIdentification(); final String mbusDeviceIdentification = requestData.getMbusDeviceIdentification(); LOGGER.debug("deCoupleMbusDevice for organizationIdentification: for gateway: {}, m-bus device ", deviceMessageMetadata.getOrganisationIdentification(), deviceIdentification, mbusDeviceIdentification); final SmartMeter gatewayDevice = this.domainHelperService.findSmartMeter(deviceIdentification); final SmartMeter mbusDevice = this.domainHelperService.findSmartMeter(mbusDeviceIdentification); this.checkAndHandleInactiveMbusDevice(mbusDevice); if (this.isMbusDeviceCoupled(mbusDevice)) { this.installationService.handleResponse("deCoupleMbusDevice", deviceMessageMetadata, ResponseMessageResultType.OK, null); } else { final DeCoupleMbusDeviceDto decoupleMbusDto = new DeCoupleMbusDeviceDto(mbusDeviceIdentification, mbusDevice.getChannel()); final RequestMessage requestMessage = new RequestMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), deviceMessageMetadata.getDeviceIdentification(), gatewayDevice.getIpAddress(), decoupleMbusDto); this.osgpCoreRequestMessageSender.send(requestMessage, deviceMessageMetadata.getMessageType(), deviceMessageMetadata.getMessagePriority(), deviceMessageMetadata.getScheduleTime()); } }
Source:
public static Map<ManagedMemoryUseCase, Integer> getManagedMemoryUseCaseWeightsFromConfig(Configuration config) { return config.get(TaskManagerOptions.MANAGED_MEMORY_CONSUMER_WEIGHTS) .entrySet().stream() .flatMap((entry) -> { final String consumer = entry.getKey(); final int weight = Integer.parseInt(entry.getValue()); if (weight < 0) { throw new IllegalConfigurationException(String.format( "Managed memory weight should not be negative. Configured weight for %s is %d.", consumer, weight)); } switch (consumer) { case TaskManagerOptions.ManagedMemoryConsumerNames.DATAPROC: return Stream.of( Tuple2.of(ManagedMemoryUseCase.BATCH_OP, weight), Tuple2.of(ManagedMemoryUseCase.ROCKSDB, weight)); case TaskManagerOptions.ManagedMemoryConsumerNames.PYTHON: return Stream.of(Tuple2.of(ManagedMemoryUseCase.PYTHON, weight)); default: throw new IllegalConfigurationException("Unknown managed memory consumer: " + consumer); } }) .collect(Collectors.toMap( (tuple2) -> tuple2.f0, (tuple2) -> tuple2.f1)); }

Target:
static Map<ManagedMemoryUseCase, Integer> getManagedMemoryUseCaseWeightsFromConfig(Configuration config) { return config.get(TaskManagerOptions.MANAGED_MEMORY_CONSUMER_WEIGHTS) .entrySet().stream() .flatMap((entry) -> { final String consumer = entry.getKey(); final int weight = Integer.parseInt(entry.getValue()); if (weight < 0) { throw new IllegalConfigurationException(String.format( "Managed memory weight should not be negative. Configured weight for %s is %d.", consumer, weight)); } switch (consumer) { case TaskManagerOptions.ManagedMemoryConsumerNames.DATAPROC: return Stream.of( Tuple2.of(ManagedMemoryUseCase.BATCH_OP, weight), Tuple2.of(ManagedMemoryUseCase.ROCKSDB, weight)); case TaskManagerOptions.ManagedMemoryConsumerNames.PYTHON: return Stream.of(Tuple2.of(ManagedMemoryUseCase.PYTHON, weight)); default: throw new IllegalConfigurationException("Unknown managed memory consumer: " + consumer); } }) .collect(Collectors.toMap( (tuple2) -> tuple2.f0, (tuple2) -> tuple2.f1)); }
Source:
public Collection<EObject> eRemoveInverseCrossReferences(EObject eObject, ECrossReferenceAdapter xref, EReferencePredicate isReferencesToIgnorePredicate) { Collection<EObject> impactedEObjects = new ArrayList<EObject>(); Collection<Setting> inverseReferences = xref.getInverseReferences(eObject, true); Collection<Setting> containmentReferences = getContainmentReferences(inverseReferences); Collection<Setting> otherReferences = getNonContainmentReferences(inverseReferences); for (EStructuralFeature.Setting setting : otherReferences) { boolean isChangeableFeature = setting.getEStructuralFeature().isChangeable(); boolean isFeatureToIgnore = isReferencesToIgnorePredicate != null && setting.getEStructuralFeature() instanceof EReference && isReferencesToIgnorePredicate.apply((EReference) setting.getEStructuralFeature()); if (isChangeableFeature && !isFeatureToIgnore) { EcoreUtil.remove(setting, eObject); impactedEObjects.add(setting.getEObject()); } } for (EStructuralFeature.Setting setting : containmentReferences) { boolean isChangeableFeature = setting.getEStructuralFeature().isChangeable(); boolean isFeatureToIgnore = isReferencesToIgnorePredicate != null && setting.getEStructuralFeature() instanceof EReference && isReferencesToIgnorePredicate.apply((EReference) setting.getEStructuralFeature()); if (isChangeableFeature && !isFeatureToIgnore) { EcoreUtil.remove(setting, eObject); impactedEObjects.add(setting.getEObject()); } } return impactedEObjects; }

Target:
public Collection<EObject> eRemoveInverseCrossReferences(EObject eObject, ECrossReferenceAdapter xref, EReferencePredicate isReferencesToIgnorePredicate) { Collection<EObject> impactedEObjects = new LinkedHashSet<EObject>(); Collection<Setting> inverseReferences = xref.getInverseReferences(eObject, true); Collection<Setting> containmentReferences = getContainmentReferences(inverseReferences); Collection<Setting> otherReferences = getNonContainmentReferences(inverseReferences); for (EStructuralFeature.Setting setting : otherReferences) { boolean isChangeableFeature = setting.getEStructuralFeature().isChangeable(); boolean isFeatureToIgnore = isReferencesToIgnorePredicate != null && setting.getEStructuralFeature() instanceof EReference && isReferencesToIgnorePredicate.apply((EReference) setting.getEStructuralFeature()); if (isChangeableFeature && !isFeatureToIgnore) { EcoreUtil.remove(setting, eObject); impactedEObjects.add(setting.getEObject()); } } for (EStructuralFeature.Setting setting : containmentReferences) { boolean isChangeableFeature = setting.getEStructuralFeature().isChangeable(); boolean isFeatureToIgnore = isReferencesToIgnorePredicate != null && setting.getEStructuralFeature() instanceof EReference && isReferencesToIgnorePredicate.apply((EReference) setting.getEStructuralFeature()); if (isChangeableFeature && !isFeatureToIgnore) { EcoreUtil.remove(setting, eObject); impactedEObjects.add(setting.getEObject()); } } return impactedEObjects; }
Source:
private void doHandleEmbedded(CommandContext ctx, ModelControllerClient client) throws CommandLineException { assert(embeddedServerRef != null); assert(embeddedServerRef.get() != null); final ModelNode op = this.buildRequestWithoutHeaders(ctx); if (embeddedServerRef.get().isHostController()) { op.get("admin-only").set(true); } try { final ModelNode response = client.execute(op); if(!Util.isSuccess(response)) { throw new CommandLineException(Util.getFailureDescription(response)); } } catch(IOException e) { StreamUtils.safeClose(client); throw new CommandLineException("Failed to execute :reload", e); } ensureServerRebootComplete(ctx, client); }

Target:
private void doHandleEmbedded(CommandContext ctx, ModelControllerClient client) throws CommandLineException { assert(embeddedServerRef != null); assert(embeddedServerRef.get() != null); final ModelNode op = this.buildRequestWithoutHeaders(ctx); if (embeddedServerRef.get().isHostController()) { final ParsedCommandLine args = ctx.getParsedCommandLine(); if (!this.adminOnly.isPresent(args) || "FALSE".equalsIgnoreCase(this.adminOnly.getValue(args))) { throw new CommandLineException("Reload into running mode is not supported, --admin-only=true must be specified."); } } try { final ModelNode response = client.execute(op); if(!Util.isSuccess(response)) { throw new CommandLineException(Util.getFailureDescription(response)); } } catch(IOException e) { StreamUtils.safeClose(client); throw new CommandLineException("Failed to execute :reload", e); } ensureServerRebootComplete(ctx, client); }
Source:
public int getInt(String key, int default_value) { if (mPref.getAll().get(key) instanceof String) { try { return Integer.parseInt(mPref.getString(key, default_value + "")); } catch (NumberFormatException e) { Log.d(TAG, e.getMessage()); return -1; } } return mPref.getInt(key, default_value); }

Target:
public int getInt(String key, int default_value) { if (mPref.getAll().get(key) instanceof String) { try { return Integer.parseInt(mPref.getString(key, default_value + "")); } catch (NumberFormatException e) { Log.d(TAG, e.getMessage()); return default_value; } } return mPref.getInt(key, default_value); }
Source:
public void listNetworkSecurityRules() { final NetworkSecurityRule rule = createRule(); assertNotNull(rule); final NetworkSecurityRuleApi ruleApi = api.getNetworkSecurityRuleApi(resourcegroup, DEFAULT_NSG_NAME); List<NetworkSecurityRule> result = ruleApi.list(); assertNotNull(result); assertEquals(result.size(), 2); boolean rulePresent = false; for (int i = 0; i < result.size(); i++) { if (result.get(i).name().equals(rule.name())) { rulePresent = true; break; } } assertTrue(rulePresent); }

Target:
public void listNetworkSecurityRules() { final NetworkSecurityRule rule = createRule(); assertNotNull(rule); final NetworkSecurityRuleApi ruleApi = api.getNetworkSecurityRuleApi(resourcegroup, DEFAULT_NSG_NAME); List<NetworkSecurityRule> result = ruleApi.list(); assertNotNull(result); assertEquals(result.size(), 2); boolean rulePresent = Iterables.any(result, new Predicate<NetworkSecurityRule>() { public boolean apply(NetworkSecurityRule input) { return input.name().equals(rule.name()); } }); assertTrue(rulePresent); }
Source:
private void renderOwner(ChangeInfo info) { String name = info.owner().name() != null ? info.owner().name() : Gerrit.getConfig().getAnonymousCowardName(); ownerPanel.insert(new AvatarImage(info.owner()), 0); ownerLink.setText(name); ownerLink.setTitle(info.owner().email() != null ? info.owner().email() : name); ownerLink.setTargetHistoryToken(PageLinks.toAccountQuery( info.owner().name() != null ? info.owner().name() : info.owner().email() != null ? info.owner().email() : String.valueOf(info.owner()._account_id()), Change.Status.NEW)); }

Target:
private void renderOwner(ChangeInfo info) { String name = info.owner().name() != null ? info.owner().name() : Gerrit.getConfig().getAnonymousCowardName(); if (info.owner().avatar(AvatarInfo.DEFAULT_SIZE) != null) { ownerPanel.insert(new AvatarImage(info.owner()), 0); } ownerLink.setText(name); ownerLink.setTitle(info.owner().email() != null ? info.owner().email() : name); ownerLink.setTargetHistoryToken(PageLinks.toAccountQuery( info.owner().name() != null ? info.owner().name() : info.owner().email() != null ? info.owner().email() : String.valueOf(info.owner()._account_id()), Change.Status.NEW)); }
Source:
public void genericValues() { final CEPWindow cepWindow = new CEPWindow(); cepWindow.setOperator("over window:time"); cepWindow.setParameters(new HashMap<>()); assertNotNull(cepWindow.hashCode()); }

Target:
public void genericValues() { final CEPWindow other = new CEPWindow(); other.setOperator("over window:time"); other.setParameters(makeTestParameters()); assertNotNull(cepWindowAllFieldsFilled.hashCode()); assertNotNull(other.hashCode()); assertEquals(cepWindowAllFieldsFilled.hashCode(), other.hashCode()); }
Source:
public Scope getScope(Token token) { if (token.length() != tokenSize) { return Scope.SHORT_TERM_CLIENT_LOCAL; } int scope = token.getBytes()[0] & 0x3; switch (scope) { case 0: return Scope.SHORT_TERM_CLIENT_LOCAL; case 2: return Scope.SHORT_TERM; } return Scope.LONG_TERM; }

Target:
public Scope getScope(Token token) { if (token.length() != tokenSize) { return Scope.SHORT_TERM_CLIENT_LOCAL; } int scope = token.getBytes()[0] & 0b11; switch (scope) { case 0b00: return Scope.SHORT_TERM_CLIENT_LOCAL; case 0b10: return Scope.SHORT_TERM; } return Scope.LONG_TERM; }
Source:
public static EffectiveTLD getEffectiveTLD(String hostname, boolean excludePrivate) { if (getInstance().domains.containsKey(hostname)) { EffectiveTLD foundTld = getInstance().domains.get(hostname); if (!excludePrivate || !foundTld.isPrivate) { return foundTld; } } String[] parts = hostname.split(DOT_REGEX); for (int i = 1; i < parts.length; i++) { String[] slice = Arrays.copyOfRange(parts, i, parts.length); String tryTld = join(slice); if (LOGGER.isDebugEnabled()) { LOGGER.debug(hostname + " [" + i + ".." + parts.length + "]: " + Arrays.toString(slice) + " => " + tryTld); } if (getInstance().domains.containsKey(tryTld)) { EffectiveTLD foundTld = getInstance().domains.get(tryTld); if (excludePrivate && foundTld.isPrivate) { continue; } if (foundTld.isException() || !foundTld.isWild()) { return foundTld; } slice = Arrays.copyOfRange(parts, i - 1, parts.length); String retryTld = join(slice); foundTld = new EffectiveTLD(retryTld, foundTld.isPrivate); return foundTld; } } return null; }

Target:
public static EffectiveTLD getEffectiveTLD(String hostname, boolean excludePrivate) { if (getInstance().domains.containsKey(hostname)) { EffectiveTLD foundTld = getInstance().domains.get(hostname); if (!(excludePrivate && foundTld.isPrivate)) { return foundTld; } } String[] parts = hostname.split(DOT_REGEX); for (int i = 1; i < parts.length; i++) { String[] slice = Arrays.copyOfRange(parts, i, parts.length); String tryTld = join(slice); if (LOGGER.isDebugEnabled()) { LOGGER.debug(hostname + " [" + i + ".." + parts.length + "]: " + Arrays.toString(slice) + " => " + tryTld); } if (getInstance().domains.containsKey(tryTld)) { EffectiveTLD foundTld = getInstance().domains.get(tryTld); if (excludePrivate && foundTld.isPrivate) { continue; } if (foundTld.isException() || !foundTld.isWild()) { return foundTld; } slice = Arrays.copyOfRange(parts, i - 1, parts.length); String retryTld = join(slice); foundTld = new EffectiveTLD(retryTld, foundTld.isPrivate); return foundTld; } } return null; }
Source:
protected static void saveToFile(ProjectMetadata projectMeta, File metadataFile) throws IOException { Writer writer = new OutputStreamWriter(new FileOutputStream(metadataFile), StandardCharsets.UTF_8); try { ParsingUtilities.defaultWriter.writeValue(writer, projectMeta); } finally { writer.close(); } }

Target:
protected static void saveToFile(ProjectMetadata projectMeta, File metadataFile) throws IOException { Writer writer = new OutputStreamWriter(new FileOutputStream(metadataFile), StandardCharsets.UTF_8); try { ParsingUtilities.saveWriter.writeValue(writer, projectMeta); } finally { writer.close(); } }
Source:
public abstract long getRemoteVersion(ClientBlobStore store) throws KeyNotFoundException, AuthorizationException; public abstract long fetchUnzipToTemp(ClientBlobStore store) throws IOException, KeyNotFoundException, AuthorizationException; public abstract void commitNewVersion(long version) throws IOException; public abstract void cleanupOrphanedData() throws IOException; public abstract void completelyRemove() throws IOException; public abstract long getSizeOnDisk(); protected static long getSizeOnDisk(Path p) throws IOException { if (!Files.exists(p)) { return 0; } else if (Files.isRegularFile(p)) { return Files.size(p); } else { return Files.walk(p) .filter((subp) -> Files.isRegularFile(subp, LinkOption.NOFOLLOW_LINKS)) .mapToLong((subp) -> { try { return Files.size(subp); } catch (IOException e) { LOG.warn("Could not get the size of "); } return 0; }).sum(); } }

Target:
public abstract long getRemoteVersion(ClientBlobStore store) throws KeyNotFoundException, AuthorizationException; public abstract long fetchUnzipToTemp(ClientBlobStore store) throws IOException, KeyNotFoundException, AuthorizationException; public abstract void commitNewVersion(long version) throws IOException; public abstract void cleanupOrphanedData() throws IOException; public abstract void completelyRemove() throws IOException; public abstract long getSizeOnDisk(); protected static long getSizeOnDisk(Path p) throws IOException { if (!Files.exists(p)) { return 0; } else if (Files.isRegularFile(p)) { return Files.size(p); } else { return Files.walk(p) .filter((subp) -> Files.isRegularFile(subp, LinkOption.NOFOLLOW_LINKS)) .mapToLong((subp) -> { try { return Files.size(subp); } catch (IOException e) { LOG.warn("Could not get the size of {}", subp); } return 0; }).sum(); } }
Source:
public Response intercept(Chain chain) throws IOException { Request request = chain.request(); OpenSpan callState = Tracer.startSpan(request.method() + " " + request.urlString()); Request.Builder instrumentedRequest = new Request.Builder() .headers(request.headers()) .url(request.url()) .method(request.method(), request.body()) .header(TraceHttpHeaders.TRACE_ID, Tracer.getTraceId()) .header(TraceHttpHeaders.SPAN_ID, callState.getSpanId()); if (callState.getParentSpanId().isPresent()) { instrumentedRequest.header(TraceHttpHeaders.PARENT_SPAN_ID, callState.getParentSpanId().get()); } Response response; try { response = chain.proceed(instrumentedRequest.build()); } finally { Tracer.completeSpan(); } return response; }

Target:
public Response intercept(Chain chain) throws IOException { Request request = chain.request(); OpenSpan callState = Tracer.startSpan(request.method() + " " + request.urlString()); Request.Builder instrumentedRequest = new Request.Builder() .headers(request.headers()) .url(request.url()) .method(request.method(), request.body()) .header(TraceHttpHeaders.TRACE_ID, Tracer.getTraceId()) .header(TraceHttpHeaders.SPAN_ID, callState.getSpanId()) .header(TraceHttpHeaders.IS_SAMPLED, Tracer.isTraceObservable() ? "1" : "0"); if (callState.getParentSpanId().isPresent()) { instrumentedRequest.header(TraceHttpHeaders.PARENT_SPAN_ID, callState.getParentSpanId().get()); } Response response; try { response = chain.proceed(instrumentedRequest.build()); } finally { Tracer.completeSpan(); } return response; }
Source:
public void onError(final String reason) { logger.warn("Error on delivery: {}", variant.getType().getTypeName(), reason); pushMessageMetricsService.appendError(pushMessageInformation, variant, reason); pushMessageSendingMetricsProducer.send(KAFKA_PUSH_MESSAGE_SENDING_METRICS_TOPIC, KAFKA_PUSH_MESSAGE_SENDING_FAILURE); }

Target:
public void onError(final String reason) { logger.warn("Error on '{}' delivery: {}", variant.getType().getTypeName(), reason); pushMessageMetricsService.appendError(pushMessageInformation, variant, reason); pushDeliveryMetricsProducer.send(KAFKA_PUSH_DELIVERY_METRICS_TOPIC, pushMessageInformation.getId(), KAFKA_METRICS_ON_DELIVERY_FAILURE); }
Source:
public static String relativize(String base, String other) { if (base.equals(other)) return ""; final String[] baseSegments = base.split(Pattern.quote(File.separator)); final String[] otherSegments = other.split(Pattern .quote(File.separator)); int commonPrefix = 0; while (commonPrefix < baseSegments.length && commonPrefix < otherSegments.length) { if (baseSegments[commonPrefix].equals(otherSegments[commonPrefix])) commonPrefix++; else break; } final StringBuilder builder = new StringBuilder(); for (int i = commonPrefix; i < baseSegments.length; i++) builder.append("..").append(File.separator); for (int i = commonPrefix; i < otherSegments.length; i++) { builder.append(otherSegments[i]); if (i < otherSegments.length - 1) builder.append(File.separator); } return builder.toString(); }

Target:
public static String relativize(String base, String other) { if (base.equals(other)) return ""; final boolean ignoreCase = SystemReader.getInstance().isWindows(); final String[] baseSegments = base.split(Pattern.quote(File.separator)); final String[] otherSegments = other.split(Pattern .quote(File.separator)); int commonPrefix = 0; while (commonPrefix < baseSegments.length && commonPrefix < otherSegments.length) { if (ignoreCase && baseSegments[commonPrefix] .equalsIgnoreCase(otherSegments[commonPrefix])) commonPrefix++; else if (!ignoreCase && baseSegments[commonPrefix] .equals(otherSegments[commonPrefix])) commonPrefix++; else break; } final StringBuilder builder = new StringBuilder(); for (int i = commonPrefix; i < baseSegments.length; i++) builder.append("..").append(File.separator); for (int i = commonPrefix; i < otherSegments.length; i++) { builder.append(otherSegments[i]); if (i < otherSegments.length - 1) builder.append(File.separator); } return builder.toString(); }
Source:
protected void testExecute_withInvalidInstructorId_shouldFail() { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.INSTRUCTOR_ID, "invalid-instructor-id", Const.ParamsNames.COURSE_ID, instructor1OfCourse1.getCourseId(), }; InstructorPrivilegeUpdateRequest reqBody = new InstructorPrivilegeUpdateRequest(); reqBody.setCanViewStudentInSections(true); reqBody.setCanSubmitSessionInSections(true); reqBody.setFeedbackSessionName("session1"); UpdateInstructorPrivilegeAction action = getAction(reqBody, submissionParams); JsonResult result = getJsonResult(action); assertEquals(HttpStatus.SC_NOT_FOUND, result.getStatusCode()); MessageOutput msg = (MessageOutput) result.getOutput(); assertEquals("Instructor does not exist.", msg.getMessage()); }

Target:
protected void testExecute_withInvalidInstructorId_shouldFail() { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.INSTRUCTOR_EMAIL, "invalid-instructor-email", Const.ParamsNames.COURSE_ID, instructor1OfCourse1.getCourseId(), }; InstructorPrivilegeUpdateRequest reqBody = new InstructorPrivilegeUpdateRequest(); reqBody.setCanViewStudentInSections(true); reqBody.setCanSubmitSessionInSections(true); reqBody.setFeedbackSessionName("session1"); UpdateInstructorPrivilegeAction action = getAction(reqBody, submissionParams); JsonResult result = getJsonResult(action); assertEquals(HttpStatus.SC_NOT_FOUND, result.getStatusCode()); MessageOutput msg = (MessageOutput) result.getOutput(); assertEquals("Instructor does not exist.", msg.getMessage()); }
Source:
default B with(BigDecimal data) { byte[] value = data.unscaledValue().toByteArray(); return with( ByteBuffer.allocate( Integer.BYTES+value.length ) .putInt( data.scale() ).put( value ).array() ); }

Target:
default B with(BigDecimal data) { byte[] value = data.unscaledValue().toByteArray(); byte[] scale = new byte[] {(byte) (data.scale() ), (byte) (data.scale() >> 8), (byte) (data.scale() >> 16), (byte) (data.scale() >> 24)}; byte[] buff = new byte[value.length + scale.length]; System.arraycopy( scale, 0, buff, 0, scale.length); System.arraycopy( value, 0, buff, scale.length, value.length); return with( buff ); }
Source:
public static void main(String args[]) throws Exception { VerifiableProperties properties = ToolUtils.getVerifiableProperties(args); ConsistencyCheckerToolConfig config = new ConsistencyCheckerToolConfig(properties); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(properties); ServerConfig serverConfig = new ServerConfig(properties); try (ClusterMap clusterMap = new StaticClusterAgentsFactory(clusterMapConfig, config.hardwareLayoutFilePath, config.partitionLayoutFilePath).getClusterMap()) { StoreToolsMetrics metrics = new StoreToolsMetrics(clusterMap.getMetricRegistry()); StoreConfig storeConfig = new StoreConfig(properties); BlobIdFactory blobIdFactory = new BlobIdFactory(clusterMap); Set<StoreKey> filterKeySet = new HashSet<>(); for (String key : config.filterSet) { filterKeySet.add(new BlobId(key, clusterMap)); } Time time = SystemTime.getInstance(); Throttler throttler = new Throttler(config.indexEntriesToProcessPerSec, 1000, true, time); StoreKeyConverterFactory storeKeyConverterFactory = Utils.getObj(serverConfig.serverStoreKeyConverterFactory, properties, null); ConsistencyCheckerTool consistencyCheckerTool = new ConsistencyCheckerTool(clusterMap, blobIdFactory, storeConfig, filterKeySet, throttler, metrics, time, storeKeyConverterFactory.getStoreKeyConverter()); boolean success = consistencyCheckerTool.checkConsistency(config.pathOfInput.listFiles(File::isDirectory)).getFirst(); System.exit(success ? 0 : 1); } }

Target:
public static void main(String args[]) throws Exception { VerifiableProperties properties = ToolUtils.getVerifiableProperties(args); ConsistencyCheckerToolConfig config = new ConsistencyCheckerToolConfig(properties); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(properties); ServerConfig serverConfig = new ServerConfig(properties); try (ClusterMap clusterMap = new StaticClusterAgentsFactory(clusterMapConfig, config.hardwareLayoutFilePath, config.partitionLayoutFilePath).getClusterMap()) { StoreToolsMetrics metrics = new StoreToolsMetrics(clusterMap.getMetricRegistry()); StoreConfig storeConfig = new StoreConfig(properties); BlobIdFactory blobIdFactory = new BlobIdFactory(clusterMap); Set<StoreKey> filterKeySet = new HashSet<>(); for (String key : config.filterSet) { filterKeySet.add(new BlobId(key, clusterMap)); } Time time = SystemTime.getInstance(); Throttler throttler = new Throttler(config.indexEntriesToProcessPerSec, 1000, true, time); StoreKeyConverterFactory storeKeyConverterFactory = Utils.getObj(serverConfig.serverStoreKeyConverterFactory, properties, clusterMap.getMetricRegistry()); ConsistencyCheckerTool consistencyCheckerTool = new ConsistencyCheckerTool(clusterMap, blobIdFactory, storeConfig, filterKeySet, throttler, metrics, time, storeKeyConverterFactory.getStoreKeyConverter()); boolean success = consistencyCheckerTool.checkConsistency(config.pathOfInput.listFiles(File::isDirectory)).getFirst(); System.exit(success ? 0 : 1); } }
Source:
private boolean shouldLogToAuditLog() { boolean retValue = (getParameters().getNamesOfVms() == null || getParameters().getNamesOfVms().isEmpty()) ? false : true; return retValue; }

Target:
private boolean shouldLogToAuditLog() { return CollectionUtils.isNotEmpty(getParameters().getNamesOfVms()); }
Source:
public String toString() { return Arrays.stream(value).map(String::valueOf).collect(Collectors.joining(", ")); }

Target:
public String toString() { return Arrays.toString(value); }
Source:
protected void executeCommand() { getDbFacade().getDiskProfileDao().remove(getParameters().getProfileId()); }

Target:
protected void executeCommand() { getDbFacade().getDiskProfileDao().remove(getParameters().getProfileId()); setSucceeded(true); }
Source:
private IFile importProject(String name, IConfigurationElement config, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { String path = config.getAttribute("archive"); if (name == null || path == null) return null; IWorkspace workspace = PDEPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); IProject project = root.getProject(name); boolean skip = false; SubMonitor subMonitor = SubMonitor.convert(monitor, name, 1); if (project.exists()) { if (!yesToAll) { String returnId = query.queryOverwrite(project.getFullPath().toString()); if (returnId.equals(IOverwriteQuery.ALL)) { yesToAll = true; skip = false; } else if (returnId.equals(IOverwriteQuery.YES)) { skip = false; } else if (returnId.equals(IOverwriteQuery.NO)) { skip = true; } else if (returnId.equals(IOverwriteQuery.CANCEL)) { skip = true; cancel = true; } } if (!skip) { project.delete(true, true, subMonitor.newChild(1)); project = root.getProject(name); } else monitor.worked(1); } if (skip) { monitor.worked(3); IFile manifest = project.getFile(SAMPLE_PROPERTIES); return manifest; } project.create(subMonitor.newChild(1)); project.open(new NullProgressMonitor()); Bundle bundle = Platform.getBundle(sample.getNamespaceIdentifier()); ZipFile zipFile = getZipFileFromPluginDir(path, bundle); importFilesFromZip(zipFile, project.getFullPath(), subMonitor.newChild(1)); return createSampleManifest(project, config, subMonitor.newChild(1)); }

Target:
private IFile importProject(String name, IConfigurationElement config, IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { String path = config.getAttribute("archive"); if (name == null || path == null) return null; IWorkspace workspace = PDEPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); IProject project = root.getProject(name); boolean skip = false; SubMonitor subMonitor = SubMonitor.convert(monitor, name, 5); if (project.exists()) { if (!yesToAll) { String returnId = query.queryOverwrite(project.getFullPath().toString()); if (returnId.equals(IOverwriteQuery.ALL)) { yesToAll = true; skip = false; } else if (returnId.equals(IOverwriteQuery.YES)) { skip = false; } else if (returnId.equals(IOverwriteQuery.NO)) { skip = true; } else if (returnId.equals(IOverwriteQuery.CANCEL)) { skip = true; cancel = true; } } if (!skip) { project.delete(true, true, subMonitor.newChild(1)); project = root.getProject(name); } else { subMonitor.worked(1); } } if (skip) { subMonitor.worked(4); IFile manifest = project.getFile(SAMPLE_PROPERTIES); return manifest; } project.create(subMonitor.newChild(1)); project.open(subMonitor.newChild(1)); Bundle bundle = Platform.getBundle(sample.getNamespaceIdentifier()); ZipFile zipFile = getZipFileFromPluginDir(path, bundle); importFilesFromZip(zipFile, project.getFullPath(), subMonitor.newChild(1)); return createSampleManifest(project, config, subMonitor.newChild(1)); }