auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected String createPayload(LoadBalancer.Request.DeregisterPayload payload) { requestBuilder.append("<ws:deregisterServersOnLoadBalancer>") .append("<request>"); for (String s : payload.serverIds()) { requestBuilder.append(format("<serverIds>%s</serverIds>", s)); } requestBuilder.append(format("<loadBalancerId>%s</loadBalancerId>", payload.id())) .append("</request>") .append("</ws:deregisterServersOnLoadBalancer>"); <START> return requestBuilder.toString().replaceAll("\\s+", ""); <END> }</code><technical_language>Is this needed</technical_language>

Target:
protected String createPayload(LoadBalancer.Request.DeregisterPayload payload) { requestBuilder.append("<ws:deregisterServersOnLoadBalancer>") .append("<request>"); for (String s : payload.serverIds()) { requestBuilder.append(format("<serverIds>%s</serverIds>", s)); } requestBuilder.append(format("<loadBalancerId>%s</loadBalancerId>", payload.id())) .append("</request>") .append("</ws:deregisterServersOnLoadBalancer>"); return requestBuilder.toString(); }
Source:
<code>public void logEvent(AuditEvent.AuditEventType eventType, FormIndex formIndex, boolean writeImmediatelyToDisk, String questionAnswer) { <START> if (!isAuditEnabled() <END> || eventType.isLocationRelated() && !auditConfig.isLocationEnabled() || eventType == AuditEvent.AuditEventType.BEGINNING_OF_FORM || eventType == AuditEvent.AuditEventType.REPEAT || isDuplicateOfLastLocationEvent(eventType)) { return; } Timber.i("AuditEvent recorded: %s", eventType); AuditEvent newAuditEvent = new AuditEvent(getEventTime(), eventType, auditConfig.isLocationEnabled(), auditConfig.isTrackingChangesEnabled(), formIndex, questionAnswer); if (isDuplicatedIntervalEvent(newAuditEvent)) { return; } if (auditConfig.isLocationEnabled()) { addLocationCoordinatesToAuditEvent(newAuditEvent); } if (eventType == AuditEvent.AuditEventType.FORM_EXIT) { manageSavedEvents(); } auditEvents.add(newAuditEvent); if (writeImmediatelyToDisk && !newAuditEvent.isIntervalAuditEventType()) { writeEvents(); } }</code><technical_language>I factor out this list of conditions a separate method</technical_language>

Target:
public void logEvent(AuditEvent.AuditEventType eventType, FormIndex formIndex, boolean writeImmediatelyToDisk, String questionAnswer) { if (!isAuditEnabled() || shouldBeIgnored(eventType)) { return; } Timber.i("AuditEvent recorded: %s", eventType); AuditEvent newAuditEvent = new AuditEvent(getEventTime(), eventType, auditConfig.isLocationEnabled(), auditConfig.isTrackingChangesEnabled(), formIndex, questionAnswer); if (isDuplicatedIntervalEvent(newAuditEvent)) { return; } if (auditConfig.isLocationEnabled()) { addLocationCoordinatesToAuditEvent(newAuditEvent); } if (eventType == AuditEvent.AuditEventType.FORM_EXIT) { manageSavedEvents(); } auditEvents.add(newAuditEvent); if (writeImmediatelyToDisk && !newAuditEvent.isIntervalAuditEventType()) { writeEvents(); } }
Source:
<code>public void afterCommit(final Transaction tx) { for (MessageReference ref : refsToAck) { synchronized (ref.getQueue()) { queue.postAcknowledge(ref, reason); } } if (pagedMessagesToPostACK != null) { for (MessageReference refmsg : pagedMessagesToPostACK) { ((PagedReference)refmsg).removePendingFlag(); <START> if (((PagedReference) refmsg).isLargeMessage() && !queue.isNonDestructive()) { <END> decrementRefCount(refmsg); } } } }</code><technical_language>need check ack type? e.g. if expired killed (i another douche moment )</technical_language>

Target:
public void afterCommit(final Transaction tx) { for (MessageReference ref : refsToAck) { synchronized (ref.getQueue()) { queue.postAcknowledge(ref, reason); } } if (pagedMessagesToPostACK != null) { for (MessageReference refmsg : pagedMessagesToPostACK) { ((PagedReference)refmsg).removePendingFlag(); if (((PagedReference) refmsg).isLargeMessage()) { decrementRefCount(refmsg); } } } }
Source:
<code><START> public boolean shouldDisplayHiddenComponents() { <END> return visibleComponentsPanel.checkboxShowHiddenComponents.getValue(); }</code><technical_language>other note a getter for state of checkbox exposing underlying object model</technical_language>

Target:
public boolean shouldDisplayHiddenComponents() { return visibleComponentsPanel.isHiddenComponentsCheckboxChecked(); }
Source:
<code><START> public void should_report_all_errors() throws Throwable { <END> try { softly.then(1).isEqualTo(1); softly.then(1).isEqualTo(2); softly.then(Lists.newArrayList(1, 2)).containsOnly(1, 3); softly.afterEach(null); fail("Should not reach here"); } catch (MultipleFailuresError e) { List<Throwable> failures = e.getFailures(); assertThat(failures).hasSize(2) .extracting("message") .contains("expected:<[2]> but was:<[1]>", format("%n" + "Expecting:%n" + " <[1, 2]>%n" + "to contain only:%n" + " <[1, 3]>%n" + "elements not found:%n" + " <[3]>%n" + "and elements not expected:%n" + " <[2]>%n")); } }</code><technical_language>keen a test sections catchThrowable clearer testing (the code rightfully duplicated written pre java 8), like: java // some preconditions // Throwable thrown = catchThrowable(() -> { throw new Exception("boom!"); }); // assertThat(thrown).isInstanceOf(Exception.class) .hasMessageContaining("boom");</technical_language>

Target:
public void should_report_all_errors() { softly.then(1).isEqualTo(1); softly.then(1).isEqualTo(2); softly.then(Lists.newArrayList(1, 2)).containsOnly(1, 3); MultipleFailuresError error = catchThrowableOfType(() -> softly.afterEach(null), MultipleFailuresError.class); List<Throwable> failures = error.getFailures(); assertThat(failures).hasSize(2) .extracting("message") .contains("expected:<[2]> but was:<[1]>", format("%n" + "Expecting:%n" + " <[1, 2]>%n" + "to contain only:%n" + " <[1, 3]>%n" + "elements not found:%n" + " <[3]>%n" + "and elements not expected:%n" + " <[2]>%n")); }
Source:
<code>public void saveCredentialsFile(String username, byte[] credentialBytes) { if (!PASchedulerProperties.SCHEDULER_CREATE_CREDENTIALS_WHEN_LOGIN.getValueAsBoolean()) { return; } File credentialsfile = new File(PASchedulerProperties.SCHEDULER_HOME.getValueAsString() + "/config/authentication/" + username + ".cred"); if (credentialsfile.exists() && sameCredentialsBytes(credentialBytes, credentialsfile)) { return; } FileOutputStream fos = null; try { credentialsfile.delete(); credentialsfile.createNewFile(); <START> fos = new FileOutputStream(credentialsfile); <END> fos.write(credentialBytes); } catch (IOException e) { if (fos != null) { try { fos.close(); } catch (IOException e1) { } throw new RuntimeException(e); } } }</code><technical_language>I FileOutputStream closed end</technical_language>

Target:
public synchronized void saveCredentialsFile(String username, byte[] credentialBytes) { if (!PASchedulerProperties.SCHEDULER_CREATE_CREDENTIALS_WHEN_LOGIN.getValueAsBoolean()) { return; } File credentialsfile = new File(PASchedulerProperties.SCHEDULER_HOME.getValueAsString() + "/config/authentication/" + username + ".cred"); if (credentialsfile.exists() && sameCredentialsBytes(credentialBytes, credentialsfile)) { return; } FileOutputStream fos = null; try { credentialsfile.delete(); credentialsfile.createNewFile(); fos = new FileOutputStream(credentialsfile); fos.write(credentialBytes); } catch (IOException e) { throw new RuntimeException(e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e1) { } } } }
Source:
<code>public Manifest getManifest() throws IOException { scanGuiceModules(preloadedClasses); String manifestString = "PluginName: " + pluginName + "\n" + "Implementation-Version: " + pluginVersion + "\n" + "Gerrit-ReloadMode: restart\n" + <START> (sysModule == null ? "" : ("Gerrit-Module: " + sysModule.getName() + "\n")) <END> + (httpModule == null ? "" : ("Gerrit-HttpModule: " + httpModule.getName() + " \n")) + (sshModule == null ? "" : ("Gerrit-SshModule: " + sshModule.getName() + "\n")) + "Gerrit-ApiType: " + apiType + "\n"; return new Manifest(new ByteArrayInputStream(manifestString.getBytes())); }</code><technical_language>Usage of StringBuilder more readable IMO</technical_language>

Target:
public Manifest getManifest() throws IOException { scanGuiceModules(preloadedClasses); StringBuilder manifestString = new StringBuilder("PluginName: " + pluginName + "\n" + "Implementation-Version: " + pluginVersion + "\n" + "Gerrit-ReloadMode: restart\n" + "Gerrit-ApiType: " + apiType + "\n"); appendIfNotNull(manifestString, "Gerrit-Module: ", sshModuleClassName); appendIfNotNull(manifestString, "Gerrit-HttpModule: ", httpModuleClassName); appendIfNotNull(manifestString, "Gerrit-SshModule: ", sysModuleClassName); return new Manifest(new ByteArrayInputStream(manifestString.toString() .getBytes())); }
Source:
<code>public void whenReadEventsForBlockedConsumerThen429() throws Exception { final FloodService.Flooder flooder = new FloodService.Flooder(EVENT_TYPE_NAME, FloodService.Type.CONSUMER_ET); given() .header(new Header("X-nakadi-cursors", xNakadiCursors)) .param("batch_limit", "5") .param("stream_timeout", "2") .param("batch_flush_timeout", "2") .when() <START> .get(STREAM_ENDPOINT) <END> .then() .statusCode(HttpStatus.OK.value()); NakadiControllerAT.blockFlooder(flooder); given() .header(new Header("X-nakadi-cursors", xNakadiCursors)) .param("batch_limit", "5") .param("stream_timeout", "2") .param("batch_flush_timeout", "2") .when() .get(STREAM_ENDPOINT) .then() .statusCode(HttpStatus.TOO_MANY_REQUESTS.value()) .header("Retry-After", "300"); NakadiControllerAT.unblockFlooder(flooder); given() .header(new Header("X-nakadi-cursors", xNakadiCursors)) .param("batch_limit", "5") .param("stream_timeout", "2") .param("batch_flush_timeout", "2") .when() .get(STREAM_ENDPOINT) .then() .statusCode(HttpStatus.OK.value()); }</code><technical_language>I 7 lines extracted a helper method 3 times</technical_language>

Target:
public void whenReadEventsForBlockedConsumerThen429() throws Exception { final FloodService.Flooder flooder = new FloodService.Flooder(EVENT_TYPE_NAME, FloodService.Type.CONSUMER_ET); readEvents() .then() .statusCode(HttpStatus.OK.value()); SettingsControllerAT.blockFlooder(flooder); readEvents() .then() .statusCode(HttpStatus.TOO_MANY_REQUESTS.value()) .header("Retry-After", "300"); SettingsControllerAT.unblockFlooder(flooder); readEvents() .then() .statusCode(HttpStatus.OK.value()); }
Source:
<code>public void testExplainAnalyzeVerbose() { <START> assertExplainAnalyze("EXPLAIN ANALYZE VERBOSE SELECT * FROM orders"); <END> }</code><technical_language>assertExplainAnalyze called assertDoesn'tFail ..</technical_language>

Target:
public void testExplainAnalyzeVerbose() { assertExplainAnalyze("EXPLAIN ANALYZE VERBOSE SELECT * FROM orders"); assertExplainAnalyze("EXPLAIN ANALYZE VERBOSE SELECT rank() OVER (PARTITION BY orderkey ORDER BY clerk DESC) FROM orders"); assertExplainAnalyze("EXPLAIN ANALYZE VERBOSE SELECT rank() OVER (PARTITION BY orderkey ORDER BY clerk DESC) FROM orders WHERE orderkey < 0"); }
Source:
<code>public void testCheckNoneOnHistoricProcessInstanceAndReadHistoryPermissionOnProcessDefinition() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); String processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY) .getProcessInstanceId(); String taskId = selectSingleTask().getId(); setAssignee(taskId, "demo"); createGrantAuthorizationWithoutAuthentication(Resources.HISTORIC_PROCESS_INSTANCE, processInstanceId, userId, HistoricProcessInstancePermissions.NONE); <START> createGrantAuthorizationWithoutAuthentication(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, READ_HISTORY); <END> UserOperationLogQuery query = historyService.createUserOperationLogQuery(); assertThat(query.list()) .extracting("processInstanceId") .containsExactly(processInstanceId, processInstanceId); }</code><technical_language>suggestion createGrantAuthorizationWithoutAuthentication(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, ProcessDefinitionPermissions.READ_HISTORY); works, I guess. ProcessDefinitionPermissions.NONE in testCheckReadOnHistoricProcessInstanceAndNonePermissionOnProcessDefinition, stick format</technical_language>

Target:
public void testCheckNoneOnHistoricProcessInstanceAndReadHistoryPermissionOnProcessDefinition() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); String processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY) .getProcessInstanceId(); String taskId = selectSingleTask().getId(); setAssignee(taskId, "demo"); createGrantAuthorizationWithoutAuthentication(Resources.HISTORIC_PROCESS_INSTANCE, processInstanceId, userId, HistoricProcessInstancePermissions.NONE); createGrantAuthorizationWithoutAuthentication(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, ProcessDefinitionPermissions.READ_HISTORY); UserOperationLogQuery query = historyService.createUserOperationLogQuery(); assertThat(query.list()) .extracting("processInstanceId") .containsExactly(processInstanceId, processInstanceId); }
Source:
<code>public CompletableFuture<V> getAsync(K key, Object... args) { Preconditions.checkNotNull(key); try { <START> return batchProcessor.processQueryOperation(new GetOperation<>(key)); <END> } catch (Exception e) { throw new SamzaException(e); } }</code><technical_language>Args need included in operation</technical_language>

Target:
public CompletableFuture<V> getAsync(K key, Object... args) { try { return batchProcessor.processQueryOperation(new GetOperation<>(key, args)); } catch (BatchingNotSupportedException e) { return table.getAsync(key, args); } catch (Exception e) { throw new SamzaException(e); } }
Source:
<code>public static Response getOperationResponse(List<String> deviceIDs, Operation operation, Message message, MediaType responseMediaType) throws DeviceManagementException, OperationManagementException { AndroidDeviceUtils deviceUtils = new AndroidDeviceUtils(); DeviceIDHolder deviceIDHolder = deviceUtils.validateDeviceIdentifiers(deviceIDs, message, responseMediaType); List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList(); int status = getDeviceManagementService().addOperation(operation, validDeviceIds); if (status > 0) { GCMService gcmService = getGCMService(); if (gcmService.isGCMEnabled()) { List<Device> devices = new ArrayList<Device>(deviceIDHolder.getValidDeviceIDList().size()); <START> for (DeviceIdentifier deviceIdentifier : deviceIDHolder.getValidDeviceIDList()) { <END> devices.add(getDeviceManagementService().getDevice(deviceIdentifier)); } getGCMService().sendNotification(operation.getCode(), devices); } } if (!deviceIDHolder.getErrorDeviceIdList().isEmpty()) { return javax.ws.rs.core.Response.status(AndroidConstants.StatusCodes. MULTI_STATUS_HTTP_CODE).type( responseMediaType).entity(deviceUtils. convertErrorMapIntoErrorMessage(deviceIDHolder.getErrorDeviceIdList())).build(); } return javax.ws.rs.core.Response.status(javax.ws.rs.core.Response.Status.CREATED). type(responseMediaType).build(); }</code><technical_language>Assign deviceIDHolder.getValidDeviceIDList() a variable here</technical_language>

Target:
public static Response getOperationResponse(List<String> deviceIDs, Operation operation, Message message, MediaType responseMediaType) throws DeviceManagementException, OperationManagementException { AndroidDeviceUtils deviceUtils = new AndroidDeviceUtils(); DeviceIDHolder deviceIDHolder = deviceUtils.validateDeviceIdentifiers(deviceIDs, message, responseMediaType); List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList(); int status = getDeviceManagementService().addOperation(operation, validDeviceIds); if (status > 0) { GCMService gcmService = getGCMService(); if (gcmService.isGCMEnabled()) { List<DeviceIdentifier> deviceIDList = deviceIDHolder.getValidDeviceIDList(); List<Device> devices = new ArrayList<Device>(deviceIDList.size()); for (DeviceIdentifier deviceIdentifier : deviceIDList) { devices.add(getDeviceManagementService().getDevice(deviceIdentifier)); } getGCMService().sendNotification(operation.getCode(), devices); } } if (!deviceIDHolder.getErrorDeviceIdList().isEmpty()) { return javax.ws.rs.core.Response.status(AndroidConstants.StatusCodes. MULTI_STATUS_HTTP_CODE).type( responseMediaType).entity(deviceUtils. convertErrorMapIntoErrorMessage(deviceIDHolder.getErrorDeviceIdList())).build(); } return javax.ws.rs.core.Response.status(javax.ws.rs.core.Response.Status.CREATED). type(responseMediaType).build(); }
Source:
<code>public void prepareForSave() { super.prepareForSave(); <START> if (!this.getInvoiceGeneralDetail().getBillingFrequencyCode().equalsIgnoreCase(ArConstants.MILESTONE_BILLING_SCHEDULE_CODE) && !this.getInvoiceGeneralDetail().getBillingFrequencyCode().equalsIgnoreCase(ArConstants.PREDETERMINED_BILLING_SCHEDULE_CODE)) { <END> ContractsGrantsInvoiceDocumentService contractsGrantsInvoiceDocumentService = SpringContext.getBean(ContractsGrantsInvoiceDocumentService.class); contractsGrantsInvoiceDocumentService.recalculateNewTotalBilled(this); } }</code><technical_language>StringUtils.equalsIgnoreCase here</technical_language>

Target:
public void prepareForSave() { super.prepareForSave(); if (!StringUtils.equalsIgnoreCase(getInvoiceGeneralDetail().getBillingFrequencyCode(), ArConstants.MILESTONE_BILLING_SCHEDULE_CODE) && !StringUtils.equalsIgnoreCase(getInvoiceGeneralDetail().getBillingFrequencyCode(), ArConstants.PREDETERMINED_BILLING_SCHEDULE_CODE)) { ContractsGrantsInvoiceDocumentService contractsGrantsInvoiceDocumentService = SpringContext.getBean(ContractsGrantsInvoiceDocumentService.class); contractsGrantsInvoiceDocumentService.recalculateNewTotalBilled(this); } }
Source:
<code>private PipelineConfig pipelineConfigFromRequest(Request req) { final String pipelineName = requiredParam(req, "pipeline_name"); PipelineConfig pipeline = configService.pipelineConfigNamed(pipelineName); if (null == pipeline) { <START> throw new RecordNotFoundException("Cannot locate pipeline config with name: " + pipelineName); <END> } return pipeline; }</code><technical_language>String.format</technical_language>

Target:
private PipelineConfig pipelineConfigFromRequest(Request req) { final String pipelineName = requiredParam(req, "pipeline_name"); PipelineConfig pipeline = configService.pipelineConfigNamed(pipelineName); if (null == pipeline) { throw new RecordNotFoundException(format("Cannot locate pipeline config with name: %s", pipelineName)); } return pipeline; }
Source:
<code>protected FreeStyleProject getProject() { FreeStyleProject job = createJob(); <START> copyFilesToWorkspace(job, "checkstyle-qualitygate.xml"); <END> return job; }</code><technical_language>s. Baseclass Kommentar</technical_language>

Target:
protected FreeStyleProject getProject() { try { return j.createFreeStyleProject(); } catch (IOException e) { throw new AssertionError(e); } }
Source:
<code>static Map<String, String> getAvailableValues(AuditLogableBase logable) { Map<String, String> returnValue = new HashMap<String, String>(logable.getCustomValues()); Class<?> type = AuditLogableBase.class; for (PropertyInfo propertyInfo : TypeCompat.GetProperties(type)) { Object value = propertyInfo.GetValue(logable, null); String stringValue = value != null ? value.toString() : null; if (!returnValue.containsKey(propertyInfo.getName().toLowerCase())) { returnValue.put(propertyInfo.getName().toLowerCase(), stringValue); } else { <START> log.errorFormat("Try to add duplicate audit log values with same name. Type: {0}. Value: {1}", <END> logable.getAuditLogTypeValue(), propertyInfo.getName().toLowerCase()); } } List<String> attributes = AuditLogHelper.getCustomLogFields(logable.getClass(), true); if (attributes != null && attributes.size() > 0) { TypeCompat.getPropertyValues(logable, new HashSet<String>(attributes), returnValue); } return returnValue; }</code><technical_language>/same/the same, important, I think</technical_language>

Target:
static Map<String, String> getAvailableValues(AuditLogableBase logable) { Map<String, String> returnValue = new HashMap<String, String>(logable.getCustomValues()); Class<?> type = AuditLogableBase.class; for (PropertyInfo propertyInfo : TypeCompat.GetProperties(type)) { Object value = propertyInfo.GetValue(logable, null); String stringValue = value != null ? value.toString() : null; if (!returnValue.containsKey(propertyInfo.getName().toLowerCase())) { returnValue.put(propertyInfo.getName().toLowerCase(), stringValue); } else { log.errorFormat("Try to add duplicate audit log values with the same name. Type: {0}. Value: {1}", logable.getAuditLogTypeValue(), propertyInfo.getName().toLowerCase()); } } List<String> attributes = AuditLogHelper.getCustomLogFields(logable.getClass(), true); if (attributes != null && attributes.size() > 0) { TypeCompat.getPropertyValues(logable, new HashSet<String>(attributes), returnValue); } return returnValue; }
Source:
<code>@Test public void unlocatableRun() throws Exception { OldDataMonitor odm = OldDataMonitor.get(r.jenkins); FreeStyleProject p = mock(FreeStyleProject.class); when(p.getParent()).thenReturn(Jenkins.getInstance()); when(p.getFullName()).thenReturn("notfound"); FreeStyleBuild build = new FreeStyleBuild(p); odm.report(build, (String) null); assertEquals(Collections.singleton(build), odm.getData().keySet()); odm.doDiscard(null, null); <START> assertEquals(0, odm.getData().keySet().size()); <END> }</code><technical_language>Alternately, a bit nicer in case fails: assertEquals(Collections.emptySet(), odm.getData().keySet());</technical_language>

Target:
@Test public void unlocatableRun() throws Exception { OldDataMonitor odm = OldDataMonitor.get(r.jenkins); FreeStyleProject p = mock(FreeStyleProject.class); when(p.getParent()).thenReturn(Jenkins.getInstance()); when(p.getFullName()).thenReturn("notfound"); FreeStyleBuild build = new FreeStyleBuild(p); odm.report(build, (String) null); assertEquals(Collections.singleton(build), odm.getData().keySet()); odm.doDiscard(null, null); assertEquals(Collections.emptySet(), odm.getData().keySet()); }
Source:
<code>private Integer getSemanticID() { <START> if (semantic == null) { return -1; } <END> return RefreshIDFactory.getOrCreateID(semantic); }</code><technical_language>Nullness of this is tested in computeHashCode()</technical_language>

Target:
private Integer getSemanticID() { return RefreshIDFactory.getOrCreateID(semantic); }
Source:
<code>public void testWriter() throws SQLException { final int TEN = 10; DbState writer = DbState.writer(DbState.driverManager("jdbc:h2:mem:")); <START> DB<Unit> setup = DB.db((Try1<Connection, Unit, SQLException>) t -> { <END> Statement s = null; try { s = t.createStatement(); assertThat(s.executeUpdate("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"), is(0)); assertThat(s.executeUpdate("INSERT INTO TEST (ID, NAME) VALUES (" + TEN + ", 'FOO')"), is(1)); } finally { DbUtils.closeQuietly(s); } return Unit.unit(); }); DB<Option<Integer>> query = new DB<Option<Integer>>() { @Override public Option<Integer> run(Connection c) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = c.prepareStatement("SELECT ID FROM TEST WHERE NAME = ?"); ps.setString(1, "FOO"); rs = ps.executeQuery(); if (rs.next()) { return Option.some(rs.getInt("ID")); } else { return Option.none(); } } finally { DbUtils.closeQuietly(rs); DbUtils.closeQuietly(ps); } } }; assertThat(writer.run(setup.bind(v -> query)).some(), is(TEN)); }</code><technical_language>c instead of t for Connection</technical_language>

Target:
public void testWriter() throws SQLException { final int TEN = 10; DbState writer = DbState.writer(DbState.driverManager("jdbc:h2:mem:")); DB<Unit> setup = DB.db((Try1<Connection, Unit, SQLException>) c -> { Statement s = null; try { s = c.createStatement(); assertThat(s.executeUpdate("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))"), is(0)); assertThat(s.executeUpdate("INSERT INTO TEST (ID, NAME) VALUES (" + TEN + ", 'FOO')"), is(1)); } finally { DbUtils.closeQuietly(s); } return Unit.unit(); }); DB<Option<Integer>> query = new DB<Option<Integer>>() { @Override public Option<Integer> run(Connection c) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = c.prepareStatement("SELECT ID FROM TEST WHERE NAME = ?"); ps.setString(1, "FOO"); rs = ps.executeQuery(); if (rs.next()) { return Option.some(rs.getInt("ID")); } else { return Option.none(); } } finally { DbUtils.closeQuietly(rs); DbUtils.closeQuietly(ps); } } }; assertThat(writer.run(setup.bind(v -> query)).some(), is(TEN)); }
Source:
<code>public Map<String, Serializable> extractScopeVariables(TaskContext taskContext) { Map<String, Serializable> variables = new HashMap<>(); <START> Map<String, Serializable> previousVariables = null; <END> try { previousVariables = extractVariables(taskContext, false); } catch (IOException | ClassNotFoundException e) { logger.error("Unable to extract variables", e); } if (taskContext.getInitializer().getTaskVariables() != null) { for (TaskVariable taskVariable : taskContext.getInitializer().getTaskVariables().values()) { if (!taskVariable.isJobInherited() || (taskVariable.isJobInherited() && !previousVariables.containsKey(taskVariable.getName()))) { variables.put(taskVariable.getName(), taskVariable.getValue()); } } } return variables; }</code><technical_language>This throw a null pointer exception line 135. initialise maps: Map<String, Serializable> previousVariables = new HashMap<>();</technical_language>

Target:
public Map<String, Serializable> extractScopeVariables(TaskContext taskContext) throws IOException, ClassNotFoundException { Map<String, Serializable> variables = new HashMap<>(); if (taskContext.getInitializer() != null && taskContext.getInitializer().getTaskVariables() != null) { variables = appendNonInheritedTaskVariables(taskContext); } return variables; }
Source:
<code>public void deleteDatabase(final String name) { execute( <START> this.influxDBService.postQuery(this.username, this.password, Query.encode("DROP DATABASE \"" + name + "\""))); <END> }</code><technical_language>formatting</technical_language>

Target:
public void deleteDatabase(final String name) { executeQuery(this.influxDBService.postQuery(this.username, this.password, Query.encode("DROP DATABASE \"" + name + "\""))); }
Source:
<code>private boolean shouldRedirect(ContainerRequestContext requestContext) { String maybeVehicle = requestContext.getUriInfo().getQueryParameters().getFirst("vehicle"); if (maybeVehicle != null && maybeVehicle.equals("pt")) { return true; } String maybeProfile = requestContext.getUriInfo().getQueryParameters().getFirst("profile"); <START> if (maybeProfile != null && maybeProfile.equals("pt")) { return true; } return false; <END> }</code><technical_language>this a bit shorter ;) return "pt".equals(maybeProfile) remove profile param in filter method above? (replaceQueryParam("profile"))</technical_language>

Target:
private boolean shouldRedirect(ContainerRequestContext requestContext) { String maybeVehicle = requestContext.getUriInfo().getQueryParameters().getFirst("vehicle"); String maybeProfile = requestContext.getUriInfo().getQueryParameters().getFirst("profile"); return "pt".equals(maybeVehicle) || "pt".equals(maybeProfile); }
Source:
<code>public VoltTable[] run(SystemProcedureExecutionContext ctx) { if (ctx.isLowestSiteId()) { VoltDB.instance().setMode(OperationMode.PAUSED); try { VoltDB.instance().getHostMessenger().getZK().setData( VoltZK.operationMode, OperationMode.PAUSED.getBytes(), -1); <START> VoltDB.instance().getHostMessenger(); <END> } catch (Exception e) { throw new RuntimeException(e); } } VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA); t.addRow(VoltSystemProcedure.STATUS_OK); return (new VoltTable[] {t}); }</code><technical_language>'just' host messenger</technical_language>

Target:
public VoltTable[] run(SystemProcedureExecutionContext ctx) { if (ctx.isLowestSiteId()) { VoltDB.instance().setMode(OperationMode.PAUSED); try { VoltDB.instance().getHostMessenger().getZK().setData( VoltZK.operationMode, OperationMode.PAUSED.getBytes(), -1); VoltDB.instance().getHostMessenger().pause(); } catch (Exception e) { throw new RuntimeException(e); } } VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA); t.addRow(VoltSystemProcedure.STATUS_OK); return (new VoltTable[] {t}); }
Source:
<code>private void populateSavedFields() { Optional<RepositoryId> lastViewed = prefs.getLastViewedRepository(); if (lastViewed.isPresent()) { repoOwnerField.setText(lastViewed.get().getOwner()); repoNameField.setText(lastViewed.get().getName()); } String lastLoginName = prefs.getLastLoginUsername(); if (!lastLoginName.isEmpty()) { usernameField.setText(lastLoginName); } String lastLoginPassword = prefs.getLastLoginPassword(); if (!lastLoginPassword.isEmpty()) { passwordField.setText(lastLoginPassword); } loadCredentialsFromFile(); <START> resolveCredentials(); <END> Platform.runLater(() -> { if (!lastLoginPassword.isEmpty()){ login(null); } else if (!lastLoginName.isEmpty()) { passwordField.requestFocus(); } else if (lastViewed.isPresent()) { usernameField.requestFocus(); } }); }</code><technical_language>loadCredentialsFromFile calls resolveCredentials, is a need call resolveCredentials here</technical_language>

Target:
private void populateSavedFields() { Optional<RepositoryId> lastViewed = prefs.getLastViewedRepository(); if (lastViewed.isPresent()) { repoOwnerField.setText(lastViewed.get().getOwner()); repoNameField.setText(lastViewed.get().getName()); } String lastLoginName = prefs.getLastLoginUsername(); if (!lastLoginName.isEmpty()) { usernameField.setText(lastLoginName); } String lastLoginPassword = prefs.getLastLoginPassword(); if (!lastLoginPassword.isEmpty()) { passwordField.setText(lastLoginPassword); } loadCredentialsFromFile(); Platform.runLater(() -> { if (!lastLoginPassword.isEmpty()){ login(null); } else if (!lastLoginName.isEmpty()) { passwordField.requestFocus(); } else if (lastViewed.isPresent()) { usernameField.requestFocus(); } }); }
Source:
<code>protected TokenTaskResult doInBackground(String... urlItems) { Oauth2 oauthRequest = new Oauth2(mRequest, mRequestHandler, mJWSBuilder); TokenTaskResult result = new TokenTaskResult(); try { result.taskResult = oauthRequest.getToken(urlItems[0]); Logger.v(TAG, "TokenTask processed the result. " + mRequest.getLogInfo()); } catch (IOException exc) { Logger.e(TAG, "Error in processing code to get a token. " + mRequest.getLogInfo(), "Request url:" + urlItems[0], ADALError.AUTHORIZATION_CODE_NOT_EXCHANGED_FOR_TOKEN, exc); result.taskException = exc; } if (result != null && result.taskResult != null && result.taskResult.getAccessToken() != null) { Logger.v(TAG, "Setting account:" + mRequest.getLogInfo()); try { setAccount(result); <START> } catch (GeneralSecurityException | IOException exc) { <END> Logger.e(TAG, "Error in setting the account" + mRequest.getLogInfo(), "", ADALError.BROKER_ACCOUNT_SAVE_FAILED, exc); result.taskException = exc; } } return result; }</code><technical_language>this in catches, log out exception in log</technical_language>

Target:
protected TokenTaskResult doInBackground(String... urlItems) { Oauth2 oauthRequest = new Oauth2(mRequest, mRequestHandler, mJWSBuilder); TokenTaskResult result = new TokenTaskResult(); try { result.taskResult = oauthRequest.getToken(urlItems[0]); Logger.v(TAG, "TokenTask processed the result. " + mRequest.getLogInfo()); } catch (IOException | AuthenticationServerProtocolException exc) { Logger.e(TAG, "Error in processing code to get a token. " + mRequest.getLogInfo(), "Request url:" + urlItems[0], ADALError.AUTHORIZATION_CODE_NOT_EXCHANGED_FOR_TOKEN, exc); result.taskException = exc; } if (result != null && result.taskResult != null && result.taskResult.getAccessToken() != null) { Logger.v(TAG, "Setting account:" + mRequest.getLogInfo()); try { setAccount(result); } catch (GeneralSecurityException | IOException exc) { Logger.e(TAG, "Error in setting the account" + mRequest.getLogInfo(), "", ADALError.BROKER_ACCOUNT_SAVE_FAILED, exc); result.taskException = exc; } } return result; }
Source:
<code>public boolean existsAndIsAccessible(final String path) { try { head(path); } catch (MantaClientHttpResponseException e) { switch (e.getServerCode()) { case DIRECTORY_DOES_NOT_EXIST_ERROR: LOG.error("{} Directory invalid for given path: {}", e.getMessage(), path); break; case ACCOUNT_DOES_NOT_EXIST_ERROR: LOG.error("{} Non-existent account for given path: {}", e.getMessage(), path); break; case AUTHORIZATION_FAILED_ERROR: case INVALID_CREDENTIALS_ERROR: LOG.error("{} Invalid authorization credentials for given path: {}", e.getMessage(), path); break; case RESOURCE_NOT_FOUND_ERROR: LOG.error("{} Unavailable Resource for given path: {}", e.getMessage(), path); break; case INVALID_KEY_ID_ERROR: LOG.error("{} Invalid key-id for given path: {}", e.getMessage(), path); break; case JOB_NOT_FOUND_ERROR: LOG.error("{} Non-existent Job Id for given path: {}", e.getMessage(), path); break; case MULTIPART_UPLOAD_STATE_ERROR: LOG.error("{} Unavailable Resource for given path: {}", e.getMessage(), path); break; case REQUEST_TIMEOUT_ERROR: LOG.error("{} Request time-out for given path: {}", e.getMessage(), path); break; case INTERNAL_ERROR: LOG.error("{} Internal Server error for given path: {}", e.getMessage(), path); break; <START> case SNAPLINKS_DISABLED_ERROR: <END> LOG.error("{} Snaplinks disabled for given path: {}", e.getMessage(), path); break; } return false; } catch (IOException e) { return false; } return true; }</code><technical_language>add a default case logs a generic message</technical_language>

Target:
public boolean existsAndIsAccessible(final String path) { try { head(path); } catch (MantaClientHttpResponseException e) { switch (e.getServerCode()) { case DIRECTORY_DOES_NOT_EXIST_ERROR: LOG.error("{} Directory invalid for given path: {}", e.getMessage(), path); break; case ACCOUNT_DOES_NOT_EXIST_ERROR: LOG.error("{} Non-existent account for given path: {}", e.getMessage(), path); break; case AUTHORIZATION_FAILED_ERROR: case INVALID_CREDENTIALS_ERROR: LOG.error("{} Invalid authorization credentials for given path: {}", e.getMessage(), path); break; case RESOURCE_NOT_FOUND_ERROR: case MULTIPART_UPLOAD_STATE_ERROR: LOG.error("{} Unavailable Resource for given path: {}", e.getMessage(), path); break; case INVALID_KEY_ID_ERROR: LOG.error("{} Invalid key-id for given path: {}", e.getMessage(), path); break; case JOB_NOT_FOUND_ERROR: LOG.error("{} Non-existent Job Id for given path: {}", e.getMessage(), path); break; case REQUEST_TIMEOUT_ERROR: LOG.error("{} Request time-out for given path: {}", e.getMessage(), path); break; case INTERNAL_ERROR: LOG.error("{} Internal Server error for given path: {}", e.getMessage(), path); break; case SNAPLINKS_DISABLED_ERROR: LOG.error("{} Snaplinks disabled for given path: {}", e.getMessage(), path); break; default: LOG.error("{} doesn't exist for given path: {}", e.getMessage(), path); } return false; } catch (IOException e) { return false; } return true; }
Source:
<code>public void increment(long amount) { long now = clock.now() / 1000L; <START> if (now != currentSecond.get()) { <END> currentCount.set(0); } long count = currentCount.addAndGet(amount); updatePeak(count); }</code><technical_language>is currentSecond updated</technical_language>

Target:
public void increment(long amount) { long now = clock.now() / 1000L; if (now != currentSecond.get()) { currentCount.set(0); currentSecond.set(now); } long count = currentCount.addAndGet(amount); updatePeak(count); }
Source:
<code>private void updateNote(NotebookSocket conn, Message fromMessage) throws IOException { String noteId = (String) fromMessage.get("id"); String name = (String) fromMessage.get("name"); Map<String, Object> config = (Map<String, Object>) fromMessage.get("config"); if (noteId == null) { return; } if (config == null) { return; } <START> NotebookService notebookService = new NotebookService(notebook()); <END> notebookService.updateNote(noteId, name, config, getServiceContext(fromMessage), new WebSocketServiceCallback<Note>(conn) { @Override public void onSuccess(Note note, ServiceContext context) throws IOException { broadcast(note.getId(), new Message(OP.NOTE_UPDATED).put("name", name) .put("config", config) .put("info", note.getInfo())); broadcastNoteList(context.getAutheInfo(), context.getUserAndRoles()); } }); }</code><technical_language>this method getNotebookService()</technical_language>

Target:
private void updateNote(NotebookSocket conn, Message fromMessage) throws IOException { String noteId = (String) fromMessage.get("id"); String name = (String) fromMessage.get("name"); Map<String, Object> config = (Map<String, Object>) fromMessage.get("config"); if (noteId == null) { return; } if (config == null) { return; } getNotebookService().updateNote(noteId, name, config, getServiceContext(fromMessage), new WebSocketServiceCallback<Note>(conn) { @Override public void onSuccess(Note note, ServiceContext context) throws IOException { broadcast(note.getId(), new Message(OP.NOTE_UPDATED).put("name", name) .put("config", config) .put("info", note.getInfo())); broadcastNoteList(context.getAutheInfo(), context.getUserAndRoles()); } }); }
Source:
<code>public void addCapabilityRequirements(OperationContext context, Resource resource, String attributeName, String... values) { String dependentName = this.capability.resolve(context.getCurrentAddress()).getName(); for (String value : values) { <START> this.requirementResolver.apply(context, value).ifPresent(requirementName -> context.registerAdditionalCapabilityRequirement(requirementName, dependentName, attributeName)); <END> } }</code><technical_language>This lambda eliminated</technical_language>

Target:
public void addCapabilityRequirements(OperationContext context, Resource resource, String attributeName, String... values) { String dependentName = this.capability.resolve(context.getCurrentAddress()).getName(); for (String value : values) { final String requirementName = this.requirementResolver.apply(context, value); if (requirementName != null) { context.registerAdditionalCapabilityRequirement(requirementName, dependentName, attributeName); } } }
Source:
<code>default int compareTo(Router o) { if (o == null) { throw new IllegalArgumentException(); } if (this.getPriority() == o.getPriority()) { if (o.getUrl() == null) { return -1; } <START> return getUrl().toFullString().compareTo(o.getUrl().toFullString()); <END> } else { return getPriority() > o.getPriority() ? 1 : -1; } }</code><technical_language>NullPointException for getUrl</technical_language>

Target:
default int compareTo(Router o) { if (o == null) { throw new IllegalArgumentException(); } if (this.getPriority() == o.getPriority()) { if (o.getUrl() == null) { return 1; } if (getUrl() == null) { return -1; } return getUrl().toFullString().compareTo(o.getUrl().toFullString()); } else { return getPriority() > o.getPriority() ? 1 : -1; } }
Source:
<code>private void setAnchor(ConnectionAnchor newAnchor) { if (newAnchor instanceof OutputAnchor) { startAnchor.ifPresent(a -> disconnect(a)); startAnchor = Optional.of((OutputAnchor) newAnchor); } else if (newAnchor instanceof InputAnchor) { endAnchor.ifPresent(a -> disconnect(a)); endAnchor = Optional.of((InputAnchor) newAnchor); } else { throw new InvalidAnchorException(); } newAnchor.addConnection(this); addListeners(newAnchor); if (isConnected()) { ConnectionCreationManager.nextConnectionState(); <START> startAnchor.get().getBlock().setConnectionState(ConnectionCreationManager.getConnectionState()); <END> endAnchor.get().getBlock().setConnectionState(ConnectionCreationManager.getConnectionState()); } invalidateAnchorPositions(); }</code><technical_language>refactor ConnectionCreationManger.getConnectionState a variable</technical_language>

Target:
private void setAnchor(ConnectionAnchor newAnchor) { if (newAnchor instanceof OutputAnchor) { startAnchor.ifPresent(a -> disconnect(a)); startAnchor = Optional.of((OutputAnchor) newAnchor); } else if (newAnchor instanceof InputAnchor) { endAnchor.ifPresent(a -> disconnect(a)); endAnchor = Optional.of((InputAnchor) newAnchor); } else { throw new InvalidAnchorException(); } newAnchor.addConnection(this); addListeners(newAnchor); if (isConnected()) { int state = ConnectionCreationManager.nextConnectionState(); startAnchor.get().getBlock().setConnectionState(state); endAnchor.get().getBlock().setConnectionState(state); } invalidateAnchorPositions(); }
Source:
<code>public void postLoad(XMLResource resource, String loadedVersion) { super.postLoad(resource, loadedVersion); if (Version.parseVersion(loadedVersion).compareTo(MIGRATION_VERSION) < 0) { TreeIterator<EObject> iter = resource.getAllContents(); while (iter.hasNext()) { EObject obj = iter.next(); EStructuralFeature initialOperationFeature = null; for (EStructuralFeature feature : <START> obj.eClass().getEAllStructuralFeatures()) <END> { if (feature.getName().equals("initialOperation")) { initialOperationFeature = feature; break; } } if (initialOperationFeature != null && !obj.eIsSet(initialOperationFeature)) { InitialOperation initial = ToolFactory.eINSTANCE.createInitialOperation(); if (map.containsKey(obj)) { initial.getFirstModelOperations().add(map.get(obj)); } obj.eSet(initialOperationFeature, initial); } } } }</code><technical_language>Iterating getEAllReferences() enough avoid testing for attributes</technical_language>

Target:
public void postLoad(XMLResource resource, String loadedVersion) { super.postLoad(resource, loadedVersion); if (Version.parseVersion(loadedVersion).compareTo(MIGRATION_VERSION) < 0) { TreeIterator<EObject> iter = resource.getAllContents(); while (iter.hasNext()) { EObject obj = iter.next(); EReference initialOperationFeature = null; for (EReference reference : obj.eClass().getEAllReferences()) { if (reference.getName().equals("initialOperation")) { initialOperationFeature = reference; break; } } if (initialOperationFeature != null && !obj.eIsSet(initialOperationFeature)) { InitialOperation initial = ToolFactory.eINSTANCE.createInitialOperation(); if (map.containsKey(obj)) { initial.getFirstModelOperations().add(map.get(obj)); } obj.eSet(initialOperationFeature, initial); } } } }
Source:
<code>public int hashCode() { int result = name.hashCode(); result = 31 * result + fieldName.hashCode(); result = 31 * result + Integer.hashCode(k); <START> result = 31 * result + Byte.hashCode(cacheTypeId); <END> return result; }</code><technical_language>cacheTypeId is considered here. BTW, Objects.hash(name, fieldName, k)</technical_language>

Target:
public int hashCode() { return Objects.hash(name, fieldName, k); }
Source:
<code>public final void init(Config config, TaskContext context) throws Exception { <START> if (serializedGraph.getContextManager() != null) { <END> this.contextManager = serializedGraph.getContextManager(); if (this.contextManager != null) { this.contextManager.init(config, context); } } this.operatorImplGraph = new OperatorImplGraph(serializedGraph, config, context, clock); }</code><technical_language>IIUC this is before</technical_language>

Target:
public final void init(Config config, TaskContext context) throws Exception { if (this.contextManager != null) { this.contextManager.init(config, context); } this.operatorImplGraph = new OperatorImplGraph(specGraph, config, context, clock); }
Source:
<code>public BlackFxOptionSurfaceVolatilities volatilities( ZonedDateTime valuationDateTime, DoubleArray parameters, ReferenceData refData) { ArgChecker.isTrue(parameters.size() == getParameterCount(), Messages.format("size of parameters must be {}, but found {}", getParameterCount(), parameters.size())); <START> DoubleArray strikes = DoubleArray.ofUnsafe( <END> nodes.stream().mapToDouble(n -> n.getStrike().getValue()).toArray()); DoubleArray expiries = DoubleArray.ofUnsafe( nodes.stream().mapToDouble(n -> n.timeToExpiry(valuationDateTime, dayCount, refData)).toArray()); SurfaceMetadata metadata = Surfaces.blackVolatilityByExpiryStrike(SurfaceName.of(name.getName()), dayCount) .withParameterMetadata(parameterMetadata(expiries)); SurfaceInterpolator interp = GridSurfaceInterpolator.of( timeInterpolator, timeExtrapolatorLeft, timeExtrapolatorRight, strikeInterpolator, strikeExtrapolatorLeft, strikeExtrapolatorRight); InterpolatedNodalSurface surface = InterpolatedNodalSurface.ofUnsorted(metadata, expiries, strikes, parameters, interp); return BlackFxOptionSurfaceVolatilities.of(name, currencyPair, valuationDateTime, surface); }</code><technical_language>is a DoubleArray.of(DoubleStream) method, need for unsafe</technical_language>

Target:
public BlackFxOptionSurfaceVolatilities volatilities( ZonedDateTime valuationDateTime, DoubleArray parameters, ReferenceData refData) { int nNodes = getParameterCount(); ArgChecker.isTrue(parameters.size() == nNodes, Messages.format("size of parameters must be {}, but found {}", nNodes, parameters.size())); DoubleArray strikes = DoubleArray.of(nNodes, i -> nodes.get(i).getStrike().getValue()); DoubleArray expiries = DoubleArray.of(nNodes, i -> nodes.get(i).timeToExpiry(valuationDateTime, dayCount, refData)); SurfaceMetadata metadata = Surfaces.blackVolatilityByExpiryStrike(SurfaceName.of(name.getName()), dayCount) .withParameterMetadata(parameterMetadata(expiries)); SurfaceInterpolator interp = GridSurfaceInterpolator.of( timeInterpolator, timeExtrapolatorLeft, timeExtrapolatorRight, strikeInterpolator, strikeExtrapolatorLeft, strikeExtrapolatorRight); InterpolatedNodalSurface surface = InterpolatedNodalSurface.ofUnsorted(metadata, expiries, strikes, parameters, interp); return BlackFxOptionSurfaceVolatilities.of(name, currencyPair, valuationDateTime, surface); }
Source:
<code>public List<String> arguments() { List<String> args = asList( <START> "bin/crate -p", <END> "crate.pid", String.format("-Des.cluster.name=%s", configuration.clusterName), String.format("-Des.http.port=%d", configuration.httpPort), String.format("-Des.transport.tcp.port=%d", configuration.transportPort), String.format("-Des.node.name=%s", nodeNode), String.format("-Des.discovery.zen.ping.multicast.enabled=%s", "false"), String.format("-Des.discovery.zen.ping.unicast.hosts=%s", unicastHosts) ); if (configuration.dataPath != null) { args.add(String.format("-Des.path.data=%s", configuration.dataPath)); } if (configuration.blobPath != null) { args.add(String.format("-Des.path.blobs=%s", configuration.blobPath)); } for (Attribute attribute : attributes) { if (attribute.hasText()) { args.add(String.format("-Des.node.mesos_%s=%s", attribute.getName(), attribute.getText().getValue())); } } for (String crateArg : configuration.crateArgs()) { args.add(crateArg); } return args; }</code><technical_language>split arguments</technical_language>

Target:
public List<String> arguments() { List<String> args = new ArrayList<>(asList( "bin/crate", "-p", "crate.pid", String.format("-Des.cluster.name=%s", configuration.clusterName), String.format("-Des.http.port=%d", configuration.httpPort), String.format("-Des.transport.tcp.port=%d", configuration.transportPort), String.format("-Des.node.name=%s", nodeNode), String.format("-Des.discovery.zen.ping.multicast.enabled=%s", "false"), String.format("-Des.discovery.zen.ping.unicast.hosts=%s", unicastHosts) )); if (configuration.dataPath != null) { args.add(String.format("-Des.path.data=%s", configuration.dataPath)); } if (configuration.blobPath != null) { args.add(String.format("-Des.path.blobs=%s", configuration.blobPath)); } for (Attribute attribute : attributes) { if (attribute.hasText()) { args.add(String.format("-Des.node.mesos_%s=%s", attribute.getName(), attribute.getText().getValue())); } } for (String crateArg : configuration.crateArgs()) { args.add(crateArg); } return args; }
Source:
<code>private synchronized void removeSubscription() { if (service.isRegistered(this)) { <START> logger.debug("Removing WeMo GENA subscription for '{}'", this); <END> String subscription = "bridge1"; if ((subscriptionState.get(subscription) != null) && subscriptionState.get(subscription).booleanValue()) { logger.debug("WeMo {}: Unsubscribing from service {}...", getUDN(), subscription); service.removeSubscription(this, subscription); } subscriptionState = new HashMap<String, Boolean>(); service.unregisterParticipant(this); } }</code><technical_language>I formatter work correctly here, is indentation level missing</technical_language>

Target:
private synchronized void removeSubscription() { if (service.isRegistered(this)) { logger.debug("Removing WeMo GENA subscription for '{}'", this); if ((subscriptionState.get(SUBSCRIPTION) != null) && subscriptionState.get(SUBSCRIPTION).booleanValue()) { logger.debug("WeMo {}: Unsubscribing from service {}...", getUDN(), SUBSCRIPTION); service.removeSubscription(this, SUBSCRIPTION); } subscriptionState = new HashMap<String, Boolean>(); service.unregisterParticipant(this); } }