auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<Edge<V, E>> path(V start, V end) { ArrayList<Edge<V, E>> path = new ArrayList<>(); HashMap<V, Edge<V, E>> hist = new HashMap<>(); HashSet<V> visited = new HashSet<>(); Queue<V> queue = new LinkedList<>(); queue.offer(start); while (!queue.isEmpty()) { V node = queue.poll(); visited.add(node); for (Edge<V, E> e : adj(node)) { V to = e.getTo(); if (!visited.contains(to)) { queue.offer(e.getTo()); if (!hist.containsKey(e.getTo())) { hist.put(e.getTo(), e); } } } } V node = end; while (true) { Edge<V, E> edge = hist.get(node); if (edge == null) { break; } path.add(edge); node = edge.getFrom(); if (node == start) { break; } } Collections.reverse(path); return path; }

Target:
public List<Edge<V, E>> path(V start, V end) { ArrayList<Edge<V, E>> path = new ArrayList<>(); HashMap<V, Edge<V, E>> hist = new HashMap<>(); HashSet<V> visited = new HashSet<>(); Queue<V> queue = new LinkedList<>(); queue.offer(start); while (!queue.isEmpty()) { V node = queue.poll(); visited.add(node); for (Edge<V, E> e : adj(node)) { V to = e.getTo(); if (!visited.contains(to)) { queue.offer(e.getTo()); if (!hist.containsKey(e.getTo())) { hist.put(e.getTo(), e); } } } } V node = end; Edge<V, E> edge = hist.get(node); while (edge != null && node != start) { path.add(edge); node = edge.getFrom(); edge = hist.get(node); } Collections.reverse(path); return path; }
Source:
public void testWithValueOutSideInterval() { fModule.schedule(); fModule.waitForCompletion(); ITmfStateSystem ss = fModule.getStateSystem(); assertNotNull(ss); assertEquals(1L, ss.getStartTime()); assertEquals(30L, ss.getCurrentEndTime()); boolean thrown1 = false; boolean thrown2 = false; try { ITmfStateInterval kernelState1 = ss.querySingleState(0L, 0); long value =0; value = kernelState1.getStateValue().unboxLong(); assertEquals(0, value); } catch (org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException e) { thrown1 = true; } catch (AttributeNotFoundException | StateSystemDisposedException e) { fail(e.getMessage()); } try { ITmfStateInterval kernelState2 = ss.querySingleState(31L, 0); long value =0; value = kernelState2.getStateValue().unboxLong(); assertEquals(0, value); } catch (org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException e) { thrown2 = true; } catch (AttributeNotFoundException | StateSystemDisposedException e) { fail(e.getMessage()); } assertTrue(thrown1); assertTrue(thrown2); }

Target:
public void testWithValueOutSideInterval() { fModule.schedule(); fModule.waitForCompletion(); ITmfStateSystem ss = fModule.getStateSystem(); assertNotNull(ss); assertEquals(1L, ss.getStartTime()); assertEquals(30L, ss.getCurrentEndTime()); ITmfStateInterval kernelState1; ITmfStateInterval kernelState2; long value = 0; try { kernelState1 = ss.querySingleState(0L, 0); value = kernelState1.getStateValue().unboxLong(); assertEquals(0L, value); } catch (AttributeNotFoundException | StateSystemDisposedException e) { fail(e.getMessage()); } try { kernelState2 = ss.querySingleState(31L, 0); value = kernelState2.getStateValue().unboxLong(); assertEquals(0L, value); } catch (AttributeNotFoundException | StateSystemDisposedException e) { fail(e.getMessage()); } }
Source:
public String getData() { if (data == null) return null; return data; }

Target:
public String getData() { return data; }
Source:
public Object data(Computer computer) { String currentValueStr = (String) super.data(computer); if (currentValueStr == null || currentValueStr.contains(Messages.InodesMonitor_NotApplicable())) { return currentValueStr; } try { int currentValue = parse(currentValueStr); String currentState = "current=" + currentValue + ",threshold=" + inodesPercentThreshold; String computerName = computer.getName(); if ("".equals(computer.getName())) { computerName = hudson.model.Messages.Hudson_Computer_DisplayName(); } if (currentValue >= parse(inodesPercentThreshold)) { OfflineCause offlineCause = OfflineCause.create(Messages._InodesMonitor_MarkedOffline(computerName, currentState)); if (((InodesUseInPercentMonitorDescriptor) getDescriptor()).markOffline(computer, offlineCause)) { String inodesmonitor_markedOffline = Messages.InodesMonitor_MarkedOffline(computerName, currentState); LOGGER.warning(inodesmonitor_markedOffline); } } else { if (((InodesUseInPercentMonitorDescriptor) getDescriptor()).markOnline(computer)) { LOGGER.warning(Messages.InodesMonitor_MarkedOnline(computerName, currentState)); } } } catch (ParseException e) { throw new IllegalStateException("WTF? Can't parse " + currentValueStr + " as integer percentage", e); } return currentValueStr; }

Target:
public Object data(Computer computer) { String currentValueStr = (String) super.data(computer); if (currentValueStr == null || currentValueStr.contains(Messages.InodesMonitor_NotApplicable())) { return currentValueStr; } try { int currentValue = parse(currentValueStr); String currentState = "current=" + currentValue + ",threshold=" + inodesPercentThreshold; String computerName = computer.getName(); if ("".equals(computer.getName())) { computerName = hudson.model.Messages.Hudson_Computer_DisplayName(); } if (currentValue >= parse(inodesPercentThreshold)) { OfflineCause offlineCause = OfflineCause.create(Messages._InodesMonitor_MarkedOffline(computerName, currentState)); if (((InodesUseInPercentMonitorDescriptor) getDescriptor()).markOffline(computer, offlineCause)) { String inodesmonitor_markedOffline = Messages.InodesMonitor_MarkedOffline(computerName, currentState); LOGGER.warning(inodesmonitor_markedOffline); } } else { if (((InodesUseInPercentMonitorDescriptor) getDescriptor()).markOnline(computer)) { LOGGER.warning(Messages.InodesMonitor_MarkedOnline(computerName, currentState)); } } } catch (ParseException e) { throw new IllegalStateException("Shouldn't happen: can't parse " + currentValueStr + " as integer percentage", e); } return currentValueStr; }
Source:
public static <T> CollectionStream<T> of(String systemName, String streamName, Map<Integer, ? extends Iterable<T>> partitions) { Preconditions.checkNotNull(systemName); Preconditions.checkNotNull(streamName); Preconditions.checkNotNull(partitions); return new CollectionStream<>(systemName, streamName, partitions); }

Target:
public static <T> CollectionStream<T> of(String systemName, String streamName, Map<Integer, ? extends Iterable<T>> partitions) { return new CollectionStream<>(systemName, streamName, partitions); }
Source:
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().replaceAll("\\s+", ""); }

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:
public void logEvent(AuditEvent.AuditEventType eventType, FormIndex formIndex, boolean writeImmediatelyToDisk, String questionAnswer) { if (!isAuditEnabled() || 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(); } }

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:
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() && !queue.isNonDestructive()) { decrementRefCount(refmsg); } } } }

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:
public boolean shouldDisplayHiddenComponents() { return visibleComponentsPanel.checkboxShowHiddenComponents.getValue(); }

Target:
public boolean shouldDisplayHiddenComponents() { return visibleComponentsPanel.isHiddenComponentsCheckboxChecked(); }
Source:
public void should_report_all_errors() throws Throwable { 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")); } }

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:
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(); fos = new FileOutputStream(credentialsfile); fos.write(credentialBytes); } catch (IOException e) { if (fos != null) { try { fos.close(); } catch (IOException e1) { } throw new RuntimeException(e); } } }

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:
public Manifest getManifest() throws IOException { scanGuiceModules(preloadedClasses); String manifestString = "PluginName: " + pluginName + "\n" + "Implementation-Version: " + pluginVersion + "\n" + "Gerrit-ReloadMode: restart\n" + (sysModule == null ? "" : ("Gerrit-Module: " + sysModule.getName() + "\n")) + (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())); }

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:
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() .get(STREAM_ENDPOINT) .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()); }

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:
public void testExplainAnalyzeVerbose() { assertExplainAnalyze("EXPLAIN ANALYZE VERBOSE SELECT * FROM orders"); }

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:
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, READ_HISTORY); UserOperationLogQuery query = historyService.createUserOperationLogQuery(); assertThat(query.list()) .extracting("processInstanceId") .containsExactly(processInstanceId, processInstanceId); }

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:
public CompletableFuture<V> getAsync(K key, Object... args) { Preconditions.checkNotNull(key); try { return batchProcessor.processQueryOperation(new GetOperation<>(key)); } catch (Exception e) { throw new SamzaException(e); } }

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:
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()); for (DeviceIdentifier deviceIdentifier : deviceIDHolder.getValidDeviceIDList()) { 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(); }

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:
public void prepareForSave() { super.prepareForSave(); if (!this.getInvoiceGeneralDetail().getBillingFrequencyCode().equalsIgnoreCase(ArConstants.MILESTONE_BILLING_SCHEDULE_CODE) && !this.getInvoiceGeneralDetail().getBillingFrequencyCode().equalsIgnoreCase(ArConstants.PREDETERMINED_BILLING_SCHEDULE_CODE)) { ContractsGrantsInvoiceDocumentService contractsGrantsInvoiceDocumentService = SpringContext.getBean(ContractsGrantsInvoiceDocumentService.class); contractsGrantsInvoiceDocumentService.recalculateNewTotalBilled(this); } }

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:
private PipelineConfig pipelineConfigFromRequest(Request req) { final String pipelineName = requiredParam(req, "pipeline_name"); PipelineConfig pipeline = configService.pipelineConfigNamed(pipelineName); if (null == pipeline) { throw new RecordNotFoundException("Cannot locate pipeline config with name: " + pipelineName); } return pipeline; }

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:
protected FreeStyleProject getProject() { FreeStyleProject job = createJob(); copyFilesToWorkspace(job, "checkstyle-qualitygate.xml"); return job; }

Target:
protected FreeStyleProject getProject() { try { return j.createFreeStyleProject(); } catch (IOException e) { throw new AssertionError(e); } }
Source:
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 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; }

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:
@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(0, odm.getData().keySet().size()); }

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:
private Integer getSemanticID() { if (semantic == null) { return -1; } return RefreshIDFactory.getOrCreateID(semantic); }

Target:
private Integer getSemanticID() { return RefreshIDFactory.getOrCreateID(semantic); }
Source:
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>) t -> { 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)); }

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:
public Map<String, Serializable> extractScopeVariables(TaskContext taskContext) { Map<String, Serializable> variables = new HashMap<>(); Map<String, Serializable> previousVariables = null; 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; }

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:
public void deleteDatabase(final String name) { execute( this.influxDBService.postQuery(this.username, this.password, Query.encode("DROP DATABASE \"" + name + "\""))); }

Target:
public void deleteDatabase(final String name) { executeQuery(this.influxDBService.postQuery(this.username, this.password, Query.encode("DROP DATABASE \"" + name + "\""))); }
Source:
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"); if (maybeProfile != null && maybeProfile.equals("pt")) { return true; } return false; }

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:
private boolean updateBlobMetadata(BlobId blobId, String fieldName, Object value) throws CloudStorageException { Objects.requireNonNull(blobId, "BlobId cannot be null"); Objects.requireNonNull(fieldName, "Field name cannot be null"); try { CloudBlobContainer azureContainer = getContainer(blobId, false); String azureBlobName = getAzureBlobName(blobId); CloudBlockBlob azureBlob = azureContainer.getBlockBlobReference(azureBlobName); if (!azureBlob.exists()) { logger.debug("Blob not found in Azure container {}.", blobId, azureContainer.getName()); return false; } Timer.Context storageTimer = azureMetrics.blobUpdateTime.time(); try { azureBlob.downloadAttributes(); String textValue = String.valueOf(value); if (!textValue.equals(azureBlob.getMetadata().get(fieldName))) { azureBlob.getMetadata().put(fieldName, textValue); azureBlob.uploadMetadata(); } } finally { storageTimer.stop(); } ResourceResponse<Document> response = cosmosDataAccessor.readMetadata(blobId); Document doc = response.getResource(); if (doc == null) { logger.warn("Blob metadata record not found: " + blobId.getID()); return false; } if (!value.equals(doc.get(fieldName))) { doc.set(fieldName, value); cosmosDataAccessor.replaceMetadata(blobId, doc); } logger.debug("Updated blob metadata set to {}.", blobId, fieldName, value); azureMetrics.blobUpdatedCount.inc(); return true; } catch (URISyntaxException | StorageException | DocumentClientException e) { azureMetrics.blobUpdateErrorCount.inc(); updateErrorMetrics(e); throw new CloudStorageException("Error updating blob metadata: " + blobId, e); } }

Target:
private boolean updateBlobMetadata(BlobId blobId, String fieldName, Object value) throws CloudStorageException { Objects.requireNonNull(blobId, "BlobId cannot be null"); Objects.requireNonNull(fieldName, "Field name cannot be null"); try { CloudBlobContainer azureContainer = getContainer(blobId, false); String azureBlobName = getAzureBlobName(blobId); CloudBlockBlob azureBlob = azureContainer.getBlockBlobReference(azureBlobName); if (!azureBlob.exists()) { logger.debug("Blob not found in Azure container {}.", blobId, azureContainer.getName()); return false; } Timer.Context storageTimer = azureMetrics.blobUpdateTime.time(); try { azureBlob.downloadAttributes(); String textValue = String.valueOf(value); if (!textValue.equals(azureBlob.getMetadata().get(fieldName))) { azureBlob.getMetadata().put(fieldName, textValue); azureBlob.uploadMetadata(); } } finally { storageTimer.stop(); } ResourceResponse<Document> response = cosmosDataAccessor.readMetadata(blobId); Document doc = response.getResource(); if (doc == null) { logger.warn("Blob metadata record not found: {}", blobId.getID()); return false; } if (!value.equals(doc.get(fieldName))) { doc.set(fieldName, value); cosmosDataAccessor.replaceMetadata(blobId, doc); } logger.debug("Updated blob metadata set to {}.", blobId, fieldName, value); azureMetrics.blobUpdatedCount.inc(); return true; } catch (URISyntaxException | StorageException | DocumentClientException e) { azureMetrics.blobUpdateErrorCount.inc(); updateErrorMetrics(e); throw new CloudStorageException("Error updating blob metadata: " + blobId, e); } }
Source:
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(); } catch (Exception e) { throw new RuntimeException(e); } } VoltTable t = new VoltTable(VoltSystemProcedure.STATUS_SCHEMA); t.addRow(VoltSystemProcedure.STATUS_OK); return (new VoltTable[] {t}); }

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:
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(); resolveCredentials(); Platform.runLater(() -> { if (!lastLoginPassword.isEmpty()){ login(null); } else if (!lastLoginName.isEmpty()) { passwordField.requestFocus(); } else if (lastViewed.isPresent()) { usernameField.requestFocus(); } }); }

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:
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); } 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; }

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:
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; case SNAPLINKS_DISABLED_ERROR: LOG.error("{} Snaplinks disabled for given path: {}", e.getMessage(), path); break; } return false; } catch (IOException e) { return false; } return true; }

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:
public void increment(long amount) { long now = clock.now() / 1000L; if (now != currentSecond.get()) { currentCount.set(0); } long count = currentCount.addAndGet(amount); updatePeak(count); }

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:
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; } NotebookService notebookService = new NotebookService(notebook()); 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()); } }); }

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:
static public InitialMessage parse(Long protocolVersion, DataInputStream din) throws InitialMessageException, IOException { Long sid; if (protocolVersion != PROTOCOL_VERSION) { throw new InitialMessageException( "Got unrecognized protocol version %s", protocolVersion); } sid = din.readLong(); int remaining = din.readInt(); if (remaining <= 0 || remaining > maxBuffer) { throw new InitialMessageException( "Unreasonable buffer length: %s", remaining); } byte[] b = new byte[remaining]; int num_read = din.read(b); if (num_read != remaining) { throw new InitialMessageException( "Read only %s bytes out of %s sent by server %s", num_read, remaining, sid); } String[] addressStrings = new String(b).split(","); List<InetSocketAddress> addresses = new ArrayList<>(addressStrings.length); for(String addr : addressStrings) { String[] host_port; try { host_port = ConfigUtils.getHostAndPort(addr); } catch (ConfigException e) { throw new InitialMessageException("Badly formed address: %s", addr); } if (host_port.length != 2) { throw new InitialMessageException("Badly formed address: %s", addr); } int port; try { port = Integer.parseInt(host_port[1]); } catch (NumberFormatException e) { throw new InitialMessageException("Bad port number: %s", host_port[1]); } catch (ArrayIndexOutOfBoundsException e) { throw new InitialMessageException("No port number in: %s", addr); } addresses.add(new InetSocketAddress(host_port[0], port)); } return new InitialMessage(sid, addresses); }

Target:
public static InitialMessage parse(Long protocolVersion, DataInputStream din) throws InitialMessageException, IOException { Long sid; if (protocolVersion != PROTOCOL_VERSION) { throw new InitialMessageException("Got unrecognized protocol version %s", protocolVersion); } sid = din.readLong(); int remaining = din.readInt(); if (remaining <= 0 || remaining > maxBuffer) { throw new InitialMessageException("Unreasonable buffer length: %s", remaining); } byte[] b = new byte[remaining]; int num_read = din.read(b); if (num_read != remaining) { throw new InitialMessageException("Read only %s bytes out of %s sent by server %s", num_read, remaining, sid); } String[] addressStrings = new String(b).split("\\|"); List<InetSocketAddress> addresses = new ArrayList<>(addressStrings.length); for (String addr : addressStrings) { String[] host_port; try { host_port = ConfigUtils.getHostAndPort(addr); } catch (ConfigException e) { throw new InitialMessageException("Badly formed address: %s", addr); } if (host_port.length != 2) { throw new InitialMessageException("Badly formed address: %s", addr); } int port; try { port = Integer.parseInt(host_port[1]); } catch (NumberFormatException e) { throw new InitialMessageException("Bad port number: %s", host_port[1]); } catch (ArrayIndexOutOfBoundsException e) { throw new InitialMessageException("No port number in: %s", addr); } addresses.add(new InetSocketAddress(host_port[0], port)); } return new InitialMessage(sid, addresses); }
Source:
public void addCapabilityRequirements(OperationContext context, Resource resource, String attributeName, String... values) { String dependentName = this.capability.resolve(context.getCurrentAddress()).getName(); for (String value : values) { this.requirementResolver.apply(context, value).ifPresent(requirementName -> context.registerAdditionalCapabilityRequirement(requirementName, dependentName, attributeName)); } }

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:
default int compareTo(Router o) { if (o == null) { throw new IllegalArgumentException(); } if (this.getPriority() == o.getPriority()) { if (o.getUrl() == null) { return -1; } return getUrl().toFullString().compareTo(o.getUrl().toFullString()); } else { return getPriority() > o.getPriority() ? 1 : -1; } }

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:
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(); startAnchor.get().getBlock().setConnectionState(ConnectionCreationManager.getConnectionState()); endAnchor.get().getBlock().setConnectionState(ConnectionCreationManager.getConnectionState()); } invalidateAnchorPositions(); }

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(); }