auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void createView(ConnectorSession session, SchemaTableName viewName, String viewData, boolean replace) { Map<String, String> properties = ImmutableMap.<String, String>builder() .put(TABLE_COMMENT, "Presto View") .put(PRESTO_VIEW_FLAG, "true") .put(PRESTO_VERSION_NAME, prestoVersion) .put(PRESTO_QUERY_ID_NAME, session.getQueryId()) .build(); Column dummyColumn = new Column("dummy", HIVE_STRING, Optional.empty()); Table.Builder tableBuilder = Table.builder() .setDatabaseName(viewName.getSchemaName()) .setTableName(viewName.getTableName()) .setOwner(session.getUser()) .setTableType(TableType.VIRTUAL_VIEW.name()) .setDataColumns(ImmutableList.of(dummyColumn)) .setPartitionColumns(ImmutableList.of()) .setParameters(properties) .setViewOriginalText(Optional.of(encodeViewData(viewData))) .setViewExpandedText(Optional.of(" ")); tableBuilder.getStorageBuilder() .setStorageFormat(VIEW_STORAGE_FORMAT) .setLocation(""); Table table = tableBuilder.build(); PrincipalPrivileges principalPrivileges = buildInitialPrivilegeSet(session.getUser()); Optional<Table> existing = metastore.getTable(viewName.getSchemaName(), viewName.getTableName()); if (existing.isPresent()) { if (!replace || !HiveUtil.isPrestoView(existing.get())) { throw new ViewAlreadyExistsException(viewName); } metastore.replaceView(viewName.getSchemaName(), viewName.getTableName(), table, principalPrivileges); return; } try { metastore.createTable(session, table, principalPrivileges, Optional.empty(), true); } catch (TableAlreadyExistsException e) { throw new ViewAlreadyExistsException(e.getTableName()); } }

Target:
public void createView(ConnectorSession session, SchemaTableName viewName, String viewData, boolean replace) { Map<String, String> properties = ImmutableMap.<String, String>builder() .put(TABLE_COMMENT, "Presto View") .put(PRESTO_VIEW_FLAG, "true") .put(PRESTO_VERSION_NAME, prestoVersion) .put(PRESTO_QUERY_ID_NAME, session.getQueryId()) .build(); Column dummyColumn = new Column("dummy", HIVE_STRING, Optional.empty()); Table.Builder tableBuilder = Table.builder() .setDatabaseName(viewName.getSchemaName()) .setTableName(viewName.getTableName()) .setOwner(session.getUser()) .setTableType(TableType.VIRTUAL_VIEW.name()) .setDataColumns(ImmutableList.of(dummyColumn)) .setPartitionColumns(ImmutableList.of()) .setParameters(properties) .setViewOriginalText(Optional.of(encodeViewData(viewData))) .setViewExpandedText(Optional.of(" ")); tableBuilder.getStorageBuilder() .setStorageFormat(VIEW_STORAGE_FORMAT) .setLocation(""); Table table = tableBuilder.build(); PrincipalPrivileges principalPrivileges = buildInitialPrivilegeSet(session.getUser()); Optional<Table> existing = metastore.getTable(viewName.getSchemaName(), viewName.getTableName()); if (existing.isPresent()) { if (!replace || !HiveUtil.isPrestoView(existing.get())) { throw new ViewAlreadyExistsException(viewName); } metastore.replaceView(viewName.getSchemaName(), viewName.getTableName(), table, principalPrivileges); return; } try { metastore.createTable(session, table, principalPrivileges, Optional.empty(), false); } catch (TableAlreadyExistsException e) { throw new ViewAlreadyExistsException(e.getTableName()); } }
Source:
public FeedbackSubmissionEditQuestion(FeedbackQuestionAttributes questionAttributes, int qnIndx, boolean isModeratedQuestion) { courseId = questionAttributes.courseId; questionNumber = questionAttributes.questionNumber; this.qnIndx = qnIndx; questionId = questionAttributes.getId(); questionText = questionAttributes.getQuestionDetails().getQuestionText(); visibilityMessages = questionAttributes.getVisibilityMessage(); questionType = questionAttributes.questionType; numberOfEntitiesToGiveFeedbackTo = questionAttributes.numberOfEntitiesToGiveFeedbackTo; this.isModeratedQuestion = isModeratedQuestion; isRecipientNameHidden = questionAttributes.isRecipientNameHidden(); isGiverTeam = questionAttributes.giverType.equals(FeedbackParticipantType.TEAMS); isRecipientTeam = questionAttributes.recipientType.isTeam(); isRecipientOwnTeamMembers = questionAttributes.recipientType.isOwnTeamMembers(); isRecipientOtherTeams = questionAttributes.recipientType.isOtherTeams(); isRecipientOtherStudentsInTheCourse = questionAttributes.recipientType.isOtherStudentsInTheCourse(); }

Target:
public FeedbackSubmissionEditQuestion(FeedbackQuestionAttributes questionAttributes, int qnIndx, boolean isModeratedQuestion) { courseId = questionAttributes.courseId; questionNumber = questionAttributes.questionNumber; this.qnIndx = qnIndx; questionId = questionAttributes.getId(); questionText = questionAttributes.getQuestionDetails().getQuestionText(); Text description = questionAttributes.getQuestionDescription(); questionDescription = description == null ? null : description.getValue(); visibilityMessages = questionAttributes.getVisibilityMessage(); questionType = questionAttributes.questionType; numberOfEntitiesToGiveFeedbackTo = questionAttributes.numberOfEntitiesToGiveFeedbackTo; this.isModeratedQuestion = isModeratedQuestion; isRecipientNameHidden = questionAttributes.isRecipientNameHidden(); isGiverTeam = questionAttributes.giverType.equals(FeedbackParticipantType.TEAMS); isRecipientTeam = questionAttributes.recipientType.isTeam(); setMessageToDisplayIfNoRecipientAvailable(questionAttributes); }
Source:
public void setStudy(Study study) { checkNotNull(study); String redisKey = RedisKey.STUDY.getRedisKey(study.getIdentifier()); setObject(redisKey, study); }

Target:
public void setStudy(Study study) { checkNotNull(study); String redisKey = RedisKey.STUDY.getRedisKey(study.getIdentifier()); setObject(redisKey, study, BridgeConstants.BRIDGE_SESSION_EXPIRE_IN_SECONDS); }
Source:
private DateTime addInterval(DateTime from) { String interval = getInterval(); switch (interval.toLowerCase()) { case "second": return from.plusSeconds(1); case "minute": return from.plusMinutes(1); case "hour": return from.plusHours(1); case "day": return from.plusDays(1); case "week": return from.plusDays(1); case "month": return from.plusMonths(1); case "quarter": return from.plusMonths(3); case "year": return from.plusYears(1); } if (interval.endsWith("y")) { return from.plusYears(getNumberFromInterval(interval)); } else if (interval.endsWith("M")) { return from.plusMonths(getNumberFromInterval(interval)); } else if (interval.endsWith("d")) { return from.plusDays(getNumberFromInterval(interval)); } else if (interval.endsWith("h")) { return from.plusHours(getNumberFromInterval(interval)); } else if (interval.endsWith("m")) { return from.plusMinutes(getNumberFromInterval(interval)); } else if (interval.endsWith("s")) { return from.plusSeconds(getNumberFromInterval(interval)); } return from.plusMillis(Integer.valueOf(interval)); }

Target:
private DateTime addInterval(DateTime from) { String interval = getInterval(); switch (interval.toLowerCase()) { case "second": return from.plusSeconds(1); case "minute": return from.plusMinutes(1); case "hour": return from.plusHours(1); case "day": return from.plusDays(1); case "week": return from.plusWeeks(1); case "month": return from.plusMonths(1); case "quarter": return from.plusMonths(3); case "year": return from.plusYears(1); } if (interval.endsWith("y")) { return from.plusYears(getNumberFromInterval(interval)); } else if (interval.endsWith("M")) { return from.plusMonths(getNumberFromInterval(interval)); } else if (interval.endsWith("d")) { return from.plusDays(getNumberFromInterval(interval)); } else if (interval.endsWith("h")) { return from.plusHours(getNumberFromInterval(interval)); } else if (interval.endsWith("m")) { return from.plusMinutes(getNumberFromInterval(interval)); } else if (interval.endsWith("s")) { return from.plusSeconds(getNumberFromInterval(interval)); } return from.plusMillis(Integer.valueOf(interval)); }
Source:
public int getNumOfOptionsInRankOptions(int qnIndex) { if ("RANK_OPTIONS".equals(getQuestionType(qnIndex))) { WebElement rankOptionsTable = browser.driver.findElement(By.id("rankOptionTable-" + qnIndex)); List<WebElement> optionInputFields = rankOptionsTable .findElements( By.cssSelector("input[id^='rankOption-']")); return optionInputFields.size(); } String recipient = getRecipientTypeForQuestion(qnIndex); switch (recipient) { case "STUDENTS": return Integer.parseInt(browser.driver.findElement(By.id("num-students")).getAttribute("value").toString()); case "INSTRUCTORS": return Integer.parseInt(browser.driver.findElement(By.id("num-instructors")).getAttribute("value").toString()); case "TEAMS": return Integer.parseInt(browser.driver.findElement(By.id("num-teams")).getAttribute("value").toString()); case "OWN_TEAM_MEMBERS": return Integer.MAX_VALUE; case "OWN_TEAM_MEMBERS_INCLUDING_SELF": return Integer.MAX_VALUE; default: return 1; } }

Target:
public int getNumOfOptionsInRankOptions(int qnIndex) { if (isRankOptionsQuestion(qnIndex)) { WebElement rankOptionsTable = browser.driver.findElement(By.id("rankOptionTable-" + qnIndex)); List<WebElement> optionInputFields = rankOptionsTable.findElements(By.cssSelector("input[id^='rankOption-']")); return optionInputFields.size(); } String recipient = getRecipientTypeForQuestion(qnIndex); switch (recipient) { case "STUDENTS": case "INSTRUCTORS": case "TEAMS": return Integer.parseInt(browser.driver.findElement(By.id("num-" + recipient.toLowerCase())) .getAttribute("value").toString()); case "OWN_TEAM_MEMBERS": case "OWN_TEAM_MEMBERS_INCLUDING_SELF": return Integer.MAX_VALUE; default: return 1; } }
Source:
public Class getKeyDecoder() { return keyDecoder; }

Target:
public Class<?> getKeyDecoder() { return keyDecoder; }
Source:
private Set<ProjectedTimeDimension> resolveTimeDimensions() { Set<ProjectedTimeDimension> timeDims = new LinkedHashSet<>(); entityProjection.getAttributes().stream().forEach((attribute -> { TimeDimensionColumn timeDim = schema.getTimeDimension(attribute.getName()); if (timeDim == null) { return; } Argument timeGrainArgument = attribute.getArguments().stream() .filter(attr -> attr.getName().equals("grain")) .findAny() .orElse(null); String requestedGrainName = timeGrainArgument.getValue().toString(); TimeGrainDefinition requestedGrainDefinition; if (timeGrainArgument == null) { requestedGrainDefinition = timeDim.getSupportedGrains()[0]; } else { TimeGrain requestedGrain = TimeGrain.valueOf(requestedGrainName); requestedGrainDefinition = Arrays.stream(timeDim.getSupportedGrains()) .filter(supportedGrainDef -> supportedGrainDef.grain().equals(requestedGrain)) .findAny() .orElseThrow(() -> new InvalidOperationException( String.format("Requested grain %s, not supported on %s", requestedGrainName, attribute.getName()))); } timeDims.add(timeDim.toProjectedDimension(requestedGrainDefinition)); })); return timeDims; }

Target:
private Set<TimeDimensionProjection> resolveTimeDimensions() { Set<TimeDimensionProjection> timeDims = new LinkedHashSet<>(); entityProjection.getAttributes().stream().forEach((attribute -> { TimeDimensionColumn timeDim = schema.getTimeDimension(attribute.getName()); if (timeDim == null) { return; } Argument timeGrainArgument = attribute.getArguments().stream() .filter(attr -> attr.getName().equals("grain")) .findAny() .orElse(null); TimeGrainDefinition requestedGrainDefinition; if (timeGrainArgument == null) { requestedGrainDefinition = timeDim.getSupportedGrains().iterator().next(); } else { String requestedGrainName = timeGrainArgument.getValue().toString(); TimeGrain requestedGrain; try { requestedGrain = TimeGrain.valueOf(requestedGrainName); } catch (IllegalArgumentException e) { throw new InvalidOperationException(String.format("Invalid grain %s", requestedGrainName)); } requestedGrainDefinition = timeDim.getSupportedGrains().stream() .filter(supportedGrainDef -> supportedGrainDef.grain().equals(requestedGrain)) .findAny() .orElseThrow(() -> new InvalidOperationException( String.format("Requested grain %s, not supported on %s", requestedGrainName, attribute.getName()))); } timeDims.add(timeDim.toProjectedDimension(requestedGrainDefinition)); })); return timeDims; }
Source:
public void successfulTaskTest() { this.applicationContext = SpringApplication.run( TaskConfiguration.class, new String[] { "spring.cloud.task.closecontext.enable=false", "spring.cloud.task.name=" + TASK_NAME, "spring.main.web-environment=false" }); String output = this.outputCapture.toString(); assertTrue("Test results do not show create task message: " + output, output.contains(CREATE_TASK_MESSAGE)); assertTrue("Test results do not show success message: " + output, output.contains(UPDATE_TASK_MESSAGE)); assertTrue("Test results have incorrect exit code: " + output, output.contains(SUCCESS_EXIT_CODE_MESSAGE)); }

Target:
public void successfulTaskTest() { this.applicationContext = SpringApplication.run( TaskConfiguration.class, new String[] { "--spring.cloud.task.closecontext.enable=false", "--spring.cloud.task.name=" + TASK_NAME, "--spring.main.web-environment=false" }); String output = this.outputCapture.toString(); assertTrue("Test results do not show create task message: " + output, output.contains(CREATE_TASK_MESSAGE)); assertTrue("Test results do not show success message: " + output, output.contains(UPDATE_TASK_MESSAGE)); assertTrue("Test results have incorrect exit code: " + output, output.contains(SUCCESS_EXIT_CODE_MESSAGE)); }
Source:
private TopologyContext mkTopologyContext(StormTopology topology) throws IOException { Map<String, Object> conf = workerData.getConf(); TopologyContext topologyContext = new TopologyContext( topology, workerData.getTopologyConf(), workerData.getTaskToComponent(), workerData.getComponentToSortedTasks(), workerData.getComponentToStreamToFields(), workerData.getBlobToLastKnownVersion(), workerData.getTopologyId(), ConfigUtils.supervisorStormResourcesPath( ConfigUtils.supervisorStormDistRoot(conf, workerData.getTopologyId())), ConfigUtils.workerPidsRoot(conf, workerData.getWorkerId()), taskId, workerData.getPort(), workerData.getLocalTaskIds(), workerData.getDefaultSharedResources(), workerData.getUserSharedResources(), executor.getSharedExecutorData(), executor.getIntervalToTaskToMetricToRegistry(), executor.getOpenOrPrepareWasCalled(), workerData.getMetricRegistry()); executor.setMetricRegistry(workerData.getMetricRegistry()); return topologyContext; }

Target:
private TopologyContext mkTopologyContext(StormTopology topology) throws IOException { Map<String, Object> conf = workerData.getConf(); return new TopologyContext( topology, workerData.getTopologyConf(), workerData.getTaskToComponent(), workerData.getComponentToSortedTasks(), workerData.getComponentToStreamToFields(), workerData.getBlobToLastKnownVersion(), workerData.getTopologyId(), ConfigUtils.supervisorStormResourcesPath( ConfigUtils.supervisorStormDistRoot(conf, workerData.getTopologyId())), ConfigUtils.workerPidsRoot(conf, workerData.getWorkerId()), taskId, workerData.getPort(), workerData.getLocalTaskIds(), workerData.getDefaultSharedResources(), workerData.getUserSharedResources(), executor.getSharedExecutorData(), executor.getIntervalToTaskToMetricToRegistry(), executor.getOpenOrPrepareWasCalled(), workerData.getMetricRegistry()); }
Source:
public void writeLocalDB(final Path localDBFile, final LocalDB localDB) throws Exception { if (localDB == null || localDBFile == null || localDBFile.toFile().isDirectory()) throw new Exception("Invalid Arguments: localDbFile: " + localDBFile + ", localDB: " + localDB); if (!localDBFile.getParent().toFile().exists()) localDBFile.getParent().toFile().mkdirs(); try (FileWriter writer = new FileWriter(localDBFile.toFile())) { writer.write(localDB.toString()); } }

Target:
public void writeLocalDB(final Path localDBFile, final LocalDB localDB) throws Exception { if (localDB == null || localDBFile == null || localDBFile.toFile().isDirectory()) throw new Exception("Invalid Arguments: localDbFile: " + localDBFile + ", localDB: " + localDB); if (!localDBFile.getParent().toFile().exists()) localDBFile.getParent().toFile().mkdirs(); File tmpFile = File.createTempFile(localDBFile.toFile().getName(), ".tmp", localDBFile.getParent().toFile()); try (FileWriter writer = new FileWriter(tmpFile)) { writer.write(localDB.toString()); if (!tmpFile.renameTo(localDBFile.toFile())) logger.error("Failed to persist local db: {}", localDB); } finally { if (tmpFile != null) Files.deleteIfExists(tmpFile.toPath()); } }
Source:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final RevCommit c = pending.next(); if (c == null) return null; c.parseHeaders(walk); DepthWalk.Commit dc = (DepthWalk.Commit)c; int newDepth = dc.getDepth() + 1; for (final RevCommit p : c.parents) { DepthWalk.Commit dp = (DepthWalk.Commit)p; if (dp.getDepth() > newDepth) { dp.setDepth(newDepth); if (newDepth <= depth) pending.add(p); } } boolean produce = true; switch (compareMode) { case EQUAL: produce = (dc.getDepth() == depth); break; case LESS_THAN_EQUAL: produce = (dc.getDepth() <= depth); break; } if (produce) return c; else continue; } }

Target:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final DepthWalk.Commit c = (DepthWalk.Commit)pending.next(); if (c == null) return null; if ((c.flags & RevWalk.PARSED) == 0) c.parseHeaders(walk); int newDepth = c.depth + 1; for (final RevCommit p : c.parents) { DepthWalk.Commit dp = (DepthWalk.Commit)p; if (dp.depth == -1) { dp.depth = newDepth; if (newDepth <= depth) pending.add(p); } if(c.has(UNSHALLOW) || c.has(REINTERESTING)) p.add(REINTERESTING); } boolean produce = c.depth <= depth; if (c.has(REINTERESTING)) c.flags &= ~RevWalk.UNINTERESTING; if ((c.flags & RevWalk.UNINTERESTING) != 0 && !c.has(UNSHALLOW)) produce = false; if (produce) return c; } }
Source:
public void cleanup() { if (printMatrices) { for (final Map.Entry<Integer, Vector> entry : lMatrix.entrySet()) { System.out.printf("L(%d, *):", entry.getKey()); for (final VectorEntry valueEntry : entry.getValue()) { System.out.print(" " + valueEntry.value()); } System.out.println(); } pullRMatrix(); for (final Map.Entry<Integer, Vector> entry : rMatrix.entrySet()) { System.out.printf("R(*, %d):", entry.getKey()); for (final VectorEntry valueEntry : entry.getValue()) { System.out.print(" " + valueEntry.value()); } System.out.println(); } } }

Target:
public void cleanup() { if (!printMatrices) { return; } final StringBuilder lsb = new StringBuilder(); for (final Map.Entry<Integer, Vector> entry : lMatrix.entrySet()) { lsb.append(String.format("L(%d, *):", entry.getKey())); for (final VectorEntry valueEntry : entry.getValue()) { lsb.append(' '); lsb.append(valueEntry.value()); } lsb.append('\n'); } LOG.log(Level.INFO, lsb.toString()); pullRMatrix(); final StringBuilder rsb = new StringBuilder(); for (final Map.Entry<Integer, Vector> entry : rMatrix.entrySet()) { rsb.append(String.format("R(*, %d):", entry.getKey())); for (final VectorEntry valueEntry : entry.getValue()) { rsb.append(' '); rsb.append(valueEntry.value()); } rsb.append('\n'); } LOG.log(Level.INFO, rsb.toString()); }
Source:
public boolean await(String bulkId, long timeout, TimeUnit unit) throws InterruptedException { long deadline = System.currentTimeMillis() + unit.toMillis(timeout); KeyValueStore kvStore = getKvStore(); do { if (COMPLETED.toString().equals(kvStore.getString(bulkId + STATE))) { return true; } Thread.sleep(1000); } while (deadline > System.currentTimeMillis()); return false; }

Target:
public boolean await(String bulkId, long timeout, TimeUnit unit) throws InterruptedException { long deadline = System.currentTimeMillis() + unit.toMillis(timeout); KeyValueStore kvStore = getKvStore(); do { if (COMPLETED.toString().equals(kvStore.getString(bulkId + STATE))) { return true; } Thread.sleep(200); } while (deadline > System.currentTimeMillis()); return false; }
Source:
protected void fillMacAddressIfMissing(VmNic iface) { if (StringUtils.isEmpty(iface.getMacAddress()) && getMacPool().getAvailableMacsCount() > 0) { iface.setMacAddress(getMacPool().allocateNewMac()); } }

Target:
private void fillMacAddressIfMissing(VmNic iface) { if (StringUtils.isEmpty(iface.getMacAddress()) && getMacPool().getAvailableMacsCount() > 0) { iface.setMacAddress(getMacPool().allocateNewMac()); } }
Source:
protected HashMap<Guid, DiskImage> getDestinationTemplateDiskMap(VM vm, Guid storageDomainId, boolean isTemplateGeneralStorageDomainSet) { HashMap<Guid, DiskImage> destinationTemplateDiskMap = null; if (vm.isSetDisks() && vm.getDisks().isSetDisks()) { destinationTemplateDiskMap = new HashMap<Guid, DiskImage>(); Map<Guid, org.ovirt.engine.core.common.businessentities.Disk> vmSourceDisks = queryVMDiskList(vm); for (Disk disk : vm.getDisks().getDisks()) { if (!disk.isSetId()) { continue; } Guid currDiskID = asGuid(disk.getId()); org.ovirt.engine.core.common.businessentities.Disk sourceDisk = vmSourceDisks.get(currDiskID); if (sourceDisk == null || !isDiskImage(sourceDisk)) { continue; } DiskImage destinationDisk = (DiskImage) DiskMapper.map(disk, sourceDisk); if (isTemplateGeneralStorageDomainSet) { destinationDisk.setStorageIds(new ArrayList<>(Arrays.asList(storageDomainId))); } destinationTemplateDiskMap.put(destinationDisk.getId(), destinationDisk); } } return destinationTemplateDiskMap; }

Target:
protected HashMap<Guid, DiskImage> getDestinationTemplateDiskMap(VM vm, Guid storageDomainId, boolean isTemplateGeneralStorageDomainSet) { HashMap<Guid, DiskImage> destinationTemplateDiskMap = null; if (vm.isSetDisks() && vm.getDisks().isSetDisks()) { destinationTemplateDiskMap = new HashMap<Guid, DiskImage>(); Map<Guid, org.ovirt.engine.core.common.businessentities.Disk> vmSourceDisks = queryVmDisksMap(vm); for (Disk disk : vm.getDisks().getDisks()) { if (!disk.isSetId()) { continue; } Guid currDiskID = asGuid(disk.getId()); org.ovirt.engine.core.common.businessentities.Disk sourceDisk = vmSourceDisks.get(currDiskID); if (sourceDisk == null || !isDiskImage(sourceDisk)) { continue; } DiskImage destinationDisk = (DiskImage) DiskMapper.map(disk, sourceDisk); if (isTemplateGeneralStorageDomainSet) { destinationDisk.setStorageIds(new ArrayList<>(Arrays.asList(storageDomainId))); } if (!disk.isSetDiskProfile()) { destinationDisk.setDiskProfileId(null); } if (!disk.isSetQuota()) { destinationDisk.setQuotaId(null); } destinationTemplateDiskMap.put(destinationDisk.getId(), destinationDisk); } } return destinationTemplateDiskMap; }
Source:
public void test_attach_to_activated_cluster_requiring_restart() throws Exception { String destination = "localhost:" + getNodePort(); startNode(1, 1); activateCluster(); assertThat(configToolInvocation("set", "-s", destination, "-c", "stripe.1.node.1.tc-properties.foo=bar"), containsOutput("IMPORTANT: A restart of the cluster is required to apply the changes")); startNode(1, 2); assertThat( configToolInvocation("attach", "-d", destination, "-s", "localhost:" + getNodePort(1, 2)), containsOutput("Impossible to do any topology change. Cluster at address: " + destination + " is waiting to be restarted to apply some pending changes. " + "You can run the command with -f option to force the comment but at the risk of breaking this cluster configuration consistency. " + "The newly added node will be restarted, but not the existing ones.")); assertThat(configToolInvocation("attach", "-f", "-d", destination, "-s", "localhost:" + getNodePort(1, 2)), is(successful())); waitUntil(out.getLog(1, 2), containsLog("Moved to State[ PASSIVE-STANDBY ]")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); }

Target:
public void test_attach_to_activated_cluster_requiring_restart() throws Exception { String destination = "localhost:" + getNodePort(); startNode(1, 1); activateCluster(); assertThat(configToolInvocation("set", "-s", destination, "-c", "stripe.1.node.1.tc-properties.foo=bar"), containsOutput("IMPORTANT: A restart of the cluster is required to apply the changes")); startNode(1, 2); assertThat(configToolInvocation("attach", "-f", "-d", destination, "-s", "localhost:" + getNodePort(1, 2)), is(successful())); waitUntil(out.getLog(1, 2), containsLog("Moved to State[ PASSIVE-STANDBY ]")); assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); withTopologyService(1, 1, topologyService -> assertTrue(topologyService.isActivated())); withTopologyService(1, 2, topologyService -> assertTrue(topologyService.isActivated())); }
Source:
public void authenticationManagerSupportMultipleLdapContextWithDefaultRolePrefix() { loadConfig(MultiLdapAuthenticationProvidersConfig.class); Authentication authenticate = getAuthenticationManager().authenticate(new UsernamePasswordAuthenticationToken("bob", "bobspassword")); assertThat(getAuthorities(authenticate)).contains(new SimpleGrantedAuthority("ROLE_DEVELOPERS")); }

Target:
public void authenticationManagerSupportMultipleLdapContextWithDefaultRolePrefix() throws Exception { this.spring.register(MultiLdapAuthenticationProvidersConfig.class).autowire(); this.mockMvc.perform(formLogin().user("bob").password("bobspassword")) .andExpect(authenticated().withUsername("bob").withAuthorities(singleton(new SimpleGrantedAuthority("ROLE_DEVELOPERS")))); }
Source:
public long getCumulativeCpuTime() { if (jiffyLengthMs < 0) { return UNAVAILABLE; } readTotalProcessJiffies(); return processTotalJiffies.longValue() * jiffyLengthMs; }

Target:
public long getCumulativeCpuTime() { if (jiffyLengthMs < 0) { return UNAVAILABLE; } try { return readTotalProcessJiffies().longValue() * jiffyLengthMs; } catch (YarnException e) { return UNAVAILABLE; } }
Source:
private void testGetNotModifiedBlob(SecurityServiceCallback callback, BlobInfo blobInfo) throws Exception { callback.reset(); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); JSONObject headers = new JSONObject(); SimpleDateFormat dateFormat = new SimpleDateFormat(RestUtils.HTTP_DATE_FORMAT, Locale.US); Date date = new Date(System.currentTimeMillis()); String dateStr = dateFormat.format(date); headers.put(RestUtils.Headers.IF_MODIFIED_SINCE, dateStr); RestRequest restRequest = createRestRequest(RestMethod.GET, "/abc", headers); securityService.processResponse(restRequest, restResponseChannel, blobInfo, callback).get(); Assert.assertTrue("Call back should have been invoked", callback.callbackInvoked.get()); Assert.assertNull("Exception should not have been thrown", callback.exception); Assert.assertEquals("No body is expected in the response", 0, restResponseChannel.getResponseBody().length); verifyHeadersForGetBlobNotModified(restResponseChannel); }

Target:
private void testGetNotModifiedBlob(SecurityServiceCallback callback, BlobInfo blobInfo) throws Exception { callback.reset(); MockRestResponseChannel restResponseChannel = new MockRestResponseChannel(); JSONObject headers = new JSONObject(); SimpleDateFormat dateFormat = new SimpleDateFormat(RestUtils.HTTP_DATE_FORMAT, Locale.ENGLISH); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); Date date = new Date(System.currentTimeMillis()); String dateStr = dateFormat.format(date); headers.put(RestUtils.Headers.IF_MODIFIED_SINCE, dateStr); RestRequest restRequest = createRestRequest(RestMethod.GET, "/abc", headers); securityService.processResponse(restRequest, restResponseChannel, blobInfo, callback).get(); Assert.assertTrue("Call back should have been invoked", callback.callbackInvoked.get()); Assert.assertNull("Exception should not have been thrown", callback.exception); Assert.assertEquals("No body is expected in the response", 0, restResponseChannel.getResponseBody().length); verifyHeadersForGetBlobNotModified(restResponseChannel); }
Source:
private AuthenticationResult acquireTokenSilentFlow(final AuthenticationRequest authenticationRequest) throws AuthenticationException { final boolean requestEligibleForBroker = mBrokerProxy.verifyBrokerForSilentRequest(authenticationRequest); if ((authenticationRequest.getForceRefresh() || authenticationRequest.isClaimsChallengePresent()) && requestEligibleForBroker) { return tryAcquireTokenSilentWithBroker(authenticationRequest); } final AuthenticationResult authResult = tryAcquireTokenSilentLocally(authenticationRequest); if (isAccessTokenReturned(authResult)) { return authResult; } if (authenticationRequest.getSamlAssertion() != null) { final AuthenticationResult authResultFromSaml = tryAcquireTokenSilentWithAssertion(authenticationRequest); if (isAccessTokenReturned(authResultFromSaml)) { return authResultFromSaml; } } if (requestEligibleForBroker) { return tryAcquireTokenSilentWithBroker(authenticationRequest); } else { return authResult; } }

Target:
private AuthenticationResult acquireTokenSilentFlow(final AuthenticationRequest authenticationRequest) throws AuthenticationException { final boolean requestEligibleForBroker = mBrokerProxy.verifyBrokerForSilentRequest(authenticationRequest); final String methodName = ":acquireTokenSilentFlow"; if ((authenticationRequest.getForceRefresh() || authenticationRequest.isClaimsChallengePresent()) && requestEligibleForBroker) { return tryAcquireTokenSilentWithBroker(authenticationRequest); } final AuthenticationResult authResult = tryAcquireTokenSilentLocally(authenticationRequest); if (isAccessTokenReturned(authResult)) { return authResult; } if (authenticationRequest.getSamlAssertion() != null && authenticationRequest.getAssertionType() != null) { final AuthenticationResult authResultFromSaml = tryAcquireTokenSilentWithAssertion(authenticationRequest); if (isAccessTokenReturned(authResultFromSaml)) { Logger.v(TAG + methodName, "Access token has been acquired using the saml assertion."); return authResultFromSaml; } else { Logger.w(TAG + methodName, "Failed to acquire tokens using saml assertion."); } } if (requestEligibleForBroker) { return tryAcquireTokenSilentWithBroker(authenticationRequest); } else { return authResult; } }
Source:
private int getMaxLag() { return prefStore.get(MAX_LAG_KEY) == null ? MAX_LAG_DEFAULT : Integer.parseInt((String) prefStore.get(MAX_LAG_KEY)); }

Target:
private int getMaxLag() { try { return Integer.parseInt((String) prefStore.get(MAX_LAG_KEY)); } catch (NumberFormatException e) { return MAX_LAG_DEFAULT; } }
Source:
public static void before() throws Exception { String serverDir = System.getProperty("server1.dist"); JavaArchive deployedCacheStore = ShrinkWrap.create(JavaArchive.class); deployedCacheStore.addPackage(MyCustomCacheStore.class.getPackage()); deployedCacheStore.addAsManifestResource(new Asset() { @Override public InputStream openStream() { String serviceImplementation = MyCustomCacheStore.class.getName(); return new ByteArrayInputStream(serviceImplementation.getBytes(StandardCharsets.UTF_8)); } }, "services/" + ExternalStore.class.getName()); deployedCacheStore.as(ZipExporter.class).exportTo( new File(serverDir, "/standalone/deployments/custom-store.jar"), true); }

Target:
public static void before() throws Exception { String serverDir = System.getProperty("server1.dist"); JavaArchive deployedCacheStore = ShrinkWrap.create(JavaArchive.class); deployedCacheStore.addPackage(MyCustomCacheStore.class.getPackage()); deployedCacheStore.addAsServiceProvider(ExternalStore.class, MyCustomCacheStore.class); deployedCacheStore.as(ZipExporter.class).exportTo( new File(serverDir, "/standalone/deployments/custom-store.jar"), true); }
Source:
public String toString() { return "CommunicationSummaryStatistics [id=" + id + ", minimumDuration=" + minimumDuration + ", averageDuration=" + averageDuration + ", maximumDuration=" + maximumDuration + ", count=" + count + ", severity=" + severity + ", uri=" + uri + ", operation=" + operation + ", outbound=" + outbound + "]"; }

Target:
public String toString() { return "CommunicationSummaryStatistics [id=" + id + ", minimumDuration=" + minimumDuration + ", averageDuration=" + averageDuration + ", maximumDuration=" + maximumDuration + ", count=" + count + ", severity=" + severity + ", uri=" + uri + ", operation=" + operation + " , serviceName=" + serviceName + ", outbound=" + outbound + "]"; }
Source:
boolean isPut() { return !(isTTLUpdate() || isDelete() || isUndelete()); }

Target:
boolean isPut() { return flags == FLAGS_DEFAULT_VALUE; }
Source:
public void init() throws DBException { Properties props = getProperties(); String servers = props.getProperty("voltdb.servers", "localhost"); String user = props.getProperty("voltdb.user", ""); String password = props.getProperty("voltdb.password", ""); String strLimit = props.getProperty("voltdb.ratelimit"); String useScanAllParam = props.getProperty("voltdb.scanall", "no"); if (useScanAllParam.equalsIgnoreCase("YES")) { useScanAll = true; } int ratelimit = strLimit != null ? Integer.parseInt(strLimit) : Integer.MAX_VALUE; try { mclient = ConnectionHelper.createConnection(Thread.currentThread().getId(), servers, user, password, ratelimit); createYCSBDBIfNeeded(); } catch (Exception e) { e.printStackTrace(); throw new DBException(e.getMessage()); } mworkingData = new byte[1024 * 1024]; mwriteBuf = ByteBuffer.wrap(mworkingData); }

Target:
public void init() throws DBException { Properties props = getProperties(); String servers = props.getProperty("voltdb.servers", "localhost"); String user = props.getProperty("voltdb.user", ""); String password = props.getProperty("voltdb.password", ""); String strLimit = props.getProperty("voltdb.ratelimit"); String useScanAllParam = props.getProperty("voltdb.scanall", "no"); if (useScanAllParam.equalsIgnoreCase("YES")) { useScanAll = true; } int ratelimit = strLimit != null ? Integer.parseInt(strLimit) : Integer.MAX_VALUE; try { mclient = ConnectionHelper.createConnection(servers, user, password, ratelimit); ysb = StaticHolder.INSTANCE; ysb.loadClassesAndDDLIfNeeded(mclient); } catch (Exception e) { logger.error("Error while creating connection: ", e); throw new DBException(e.getMessage()); } mworkingData = new byte[1024 * 1024]; mwriteBuf = ByteBuffer.wrap(mworkingData); }
Source:
protected void validateSamlProtocolResponse(final Response response, final SAML2MessageContext context, final SignatureTrustEngine engine) { validateSuccess(response.getStatus()); if (wantsResponseSigned && response.getSignature() == null) { throw new SAMLSignatureValidationException("Signature not found"); } validateSignatureIfItExists(response.getSignature(), context, engine); validateIssueInstant(response.getIssueInstant()); AuthnRequest request = null; final SAMLMessageStore messageStorage = context.getSAMLMessageStore(); if (messageStorage != null && response.getInResponseTo() != null) { final Optional<XMLObject> xmlObject = messageStorage.get(response.getInResponseTo()); if (!xmlObject.isPresent()) { throw new SAMLInResponseToMismatchException("InResponseToField of the Response doesn't correspond to sent message " + response.getInResponseTo()); } else if (xmlObject.get() instanceof AuthnRequest) { request = (AuthnRequest) xmlObject.get(); } else { throw new SAMLInResponseToMismatchException("Sent request was of different type than the expected AuthnRequest " + response.getInResponseTo()); } } verifyEndpoint(context.getSAMLEndpointContext().getEndpoint(), response.getDestination()); if (request != null) { verifyRequest(request, context); } validateIssuerIfItExists(response.getIssuer(), context); }

Target:
protected void validateSamlProtocolResponse(final Response response, final SAML2MessageContext context, final SignatureTrustEngine engine) { validateSuccess(response.getStatus()); if (wantsResponsesSigned && response.getSignature() == null) { logger.debug( "Unable to find a signature on the SAML response returned. Pac4j is configured to enforce " + "signatures on SAML2 responses from identity providers and the returned response\n{}\n" + "does not contain any signature", Configuration.serializeSamlObject(response)); throw new SAMLSignatureValidationException("Unable to find a signature on the SAML response returned"); } validateSignatureIfItExists(response.getSignature(), context, engine); validateIssueInstant(response.getIssueInstant()); AuthnRequest request = null; final SAMLMessageStore messageStorage = context.getSAMLMessageStore(); if (messageStorage != null && response.getInResponseTo() != null) { final Optional<XMLObject> xmlObject = messageStorage.get(response.getInResponseTo()); if (!xmlObject.isPresent()) { throw new SAMLInResponseToMismatchException( "InResponseToField of the Response doesn't correspond to sent message " + response.getInResponseTo()); } else if (xmlObject.get() instanceof AuthnRequest) { request = (AuthnRequest) xmlObject.get(); } else { throw new SAMLInResponseToMismatchException( "Sent request was of different type than the expected AuthnRequest " + response.getInResponseTo()); } } verifyEndpoint(context.getSAMLEndpointContext().getEndpoint(), response.getDestination()); if (request != null) { verifyRequest(request, context); } validateIssuerIfItExists(response.getIssuer(), context); }
Source:
public HashMap<Integer, BaseSensorValues> getApartmentSensorValues(String sessionToken) { try { String response = transport.execute(SimpleRequestBuilder.buildNewRequest(InterfaceKeys.JSON) .addRequestClass(ClassKeys.APARTMENT).addFunction(FunctionKeys.GET_SENSOR_VALUES) .addParameter(ParameterKeys.TOKEN, sessionToken).buildRequestString()); JsonObject responseObj = JSONResponseHandler.toJsonObject(response); if (JSONResponseHandler.checkResponse(responseObj)) { JsonObject obj = JSONResponseHandler.getResultJsonObject(responseObj); if (obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).isJsonArray()) { JsonArray jArray = obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).getAsJsonArray(); WeatherSensorData weather = new WeatherSensorData(obj); if (jArray.size() != 0) { HashMap<Integer, BaseSensorValues> map = new HashMap<Integer, BaseSensorValues>( jArray.size() + 1); Iterator<JsonElement> iter = jArray.iterator(); while (iter.hasNext()) { SensorValues sensorValues = new SensorValues(iter.next().getAsJsonObject()); if (sensorValues != null) { map.put(sensorValues.getZoneID(), sensorValues); } } map.put(0, weather); return map; } } } } catch (Exception e) { logger.debug("An exception occurred", e); } return null; }

Target:
public HashMap<Integer, BaseSensorValues> getApartmentSensorValues(String sessionToken) { String response = transport.execute(SimpleRequestBuilder.buildNewJsonRequest(ClassKeys.APARTMENT) .addFunction(FunctionKeys.GET_SENSOR_VALUES).addParameter(ParameterKeys.TOKEN, sessionToken) .buildRequestString()); JsonObject responseObj = JSONResponseHandler.toJsonObject(response); if (JSONResponseHandler.checkResponse(responseObj)) { JsonObject obj = JSONResponseHandler.getResultJsonObject(responseObj); if (obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).isJsonArray()) { JsonArray jArray = obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).getAsJsonArray(); WeatherSensorData weather = new WeatherSensorData(obj); if (jArray.size() != 0) { HashMap<Integer, BaseSensorValues> map = new HashMap<Integer, BaseSensorValues>(jArray.size() + 1); Iterator<JsonElement> iter = jArray.iterator(); while (iter.hasNext()) { SensorValues sensorValues = new SensorValues(iter.next().getAsJsonObject()); if (sensorValues != null) { map.put(sensorValues.getZoneID(), sensorValues); } } map.put(GeneralLibConstance.BROADCAST_ZONE_GROUP_ID, weather); return map; } } } return null; }
Source:
protected static void deleteTenantRegistryData(int tenantId, Connection conn) throws SQLException { try { conn.setAutoCommit(false); executeDeleteQuery(conn, DELETE_CLUSTER_LOCK, tenantId); executeDeleteQuery(conn, DELETE_LOG, tenantId); executeDeleteQuery(conn, DELETE_ASSOCIATION, tenantId); executeDeleteQuery(conn, DELETE_SNAPSHOT, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_COMMENT, tenantId); executeDeleteQuery(conn, DELETE_COMMENT, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_RATING, tenantId); executeDeleteQuery(conn, DELETE_RATING, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_TAG, tenantId); executeDeleteQuery(conn, DELETE_TAG, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_PROPERTY, tenantId); executeDeleteQuery(conn, DELETE_PROPERTY, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_HISTORY, tenantId); executeDeleteQuery(conn, DELETE_CONTENT_HISTORY, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE, tenantId); executeDeleteQuery(conn, DELETE_CONTENT, tenantId); executeDeleteQuery(conn, DELETE_PATH, tenantId); executeDeleteQueryWithLikeOperator(conn, DELETE_ADMIN_REGISTRY_RESORUCE, tenantId); executeDeleteQueryWithLikeOperator(conn, DELETE_ADMIN_REGISTRY_PATH, tenantId); conn.commit(); } catch (SQLException e) { conn.rollback(); String errorMsg = "An error occurred while deleting registry data for tenant: " + tenantId; throw new SQLException(errorMsg, e); } finally { conn.close(); } }

Target:
public static void deleteTenantRegistryData(int tenantId, Connection conn) throws SQLException { try { conn.setAutoCommit(false); executeDeleteQuery(conn, DELETE_CLUSTER_LOCK, tenantId); executeDeleteQuery(conn, DELETE_LOG, tenantId); executeDeleteQuery(conn, DELETE_ASSOCIATION, tenantId); executeDeleteQuery(conn, DELETE_SNAPSHOT, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_COMMENT, tenantId); executeDeleteQuery(conn, DELETE_COMMENT, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_RATING, tenantId); executeDeleteQuery(conn, DELETE_RATING, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_TAG, tenantId); executeDeleteQuery(conn, DELETE_TAG, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_PROPERTY, tenantId); executeDeleteQuery(conn, DELETE_PROPERTY, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE_HISTORY, tenantId); executeDeleteQuery(conn, DELETE_CONTENT_HISTORY, tenantId); executeDeleteQuery(conn, DELETE_RESOURCE, tenantId); executeDeleteQuery(conn, DELETE_CONTENT, tenantId); executeDeleteQuery(conn, DELETE_PATH, tenantId); executeDeleteQueryWithLikeOperator(conn, DELETE_ADMIN_REGISTRY_RESORUCE, tenantId); executeDeleteQueryWithLikeOperator(conn, DELETE_ADMIN_REGISTRY_PATH, tenantId); conn.commit(); if (log.isDebugEnabled()) { log.debug("Registry table entries deleted for tenant :" + tenantId); } } catch (SQLException e) { conn.rollback(); String errorMsg = "An error occurred while deleting registry data for tenant: " + tenantId; throw new SQLException(errorMsg, e); } finally { conn.close(); } }
Source:
private void checkActuallyModifiedFixed(String id) { if (!ConfServer.localPollingEnabled || !MassiveCoreMConf.get().warnOnLocalAlter) return; E entity = this.getFixed(id); boolean modified = this.examineHasLocalAlterFixed(id, entity); if (modified) return; List<String> messages = new MassiveList<>(); messages.add(Txt.parse("<pink>%s", this.getDebugName())); messages.add(Txt.parse("<aqua>%s", entity.getId())); String change = Txt.implode(messages, Txt.parse("<silver> | ")); String message = Txt.parse("<b>[No Modification] %s", change); this.getPlugin().log(message); this.getPlugin().log(MUtil.getStackTraceString(entity.getStackTraceChanged(), true);); }

Target:
private void checkActuallyModifiedFixed(String id) { if (!MStore.isLocalPollingDebugEnabled()) return; E entity = this.getFixed(id); boolean modified = this.examineHasLocalAlterFixed(id, entity); if (modified) return; List<String> messages = new MassiveList<>(); messages.add(Txt.parse("<pink>%s", this.getDebugName())); messages.add(Txt.parse("<aqua>%s", entity.getId())); String change = Txt.implode(messages, Txt.parse("<silver> | ")); String message = Txt.parse("<b>[No Modification] %s", change); this.getPlugin().log(message); if (entity.getLastStackTraceChanged() != null) this.getPlugin().log(MUtil.getStackTraceString(entity.getLastStackTraceChanged(), true)); }
Source:
public static @NonNull List<IDataProviderDescriptor> getXmlDataProviderDescriptors(@NonNull ITmfTrace trace, EnumSet<OutputType> types) { List<IDataProviderDescriptor> descriptors = new ArrayList<>(); Map<String, IAnalysisModuleHelper> modules = TmfAnalysisManager.getAnalysisModules(trace.getClass()); for (OutputType viewType : types) { for (XmlOutputElement element : Iterables.filter(XmlUtils.getXmlOutputElements().values(), element -> element.getXmlElem().equals(viewType.getXmlElem()))) { DataProviderDescriptor.Builder builder = new DataProviderDescriptor.Builder(); builder.setId(element.getId()).setName(element.getLabel()).setDescription(element.getLabel()); if (viewType == OutputType.XY) { builder.setProviderType(ProviderType.TREE_TIME_XY); } else if (viewType == OutputType.TIME_GRAPH) { builder.setProviderType(ProviderType.TIME_GRAPH); } boolean applies = false; for (String id : element.getAnalyses()) { for (IAnalysisModuleHelper helper : modules.values()) { if (helper.getId().equals(id)) { applies = true; break; } } } if (applies) { descriptors.add(builder.build()); } } } return descriptors; }

Target:
private static @NonNull List<IDataProviderDescriptor> getXmlDataProviderDescriptors(@NonNull ITmfTrace trace, EnumSet<OutputType> types) { List<IDataProviderDescriptor> descriptors = new ArrayList<>(); Map<String, IAnalysisModuleHelper> modules = TmfAnalysisManager.getAnalysisModules(trace.getClass()); for (OutputType viewType : types) { for (XmlOutputElement element : Iterables.filter(XmlUtils.getXmlOutputElements().values(), element -> element.getXmlElem().equals(viewType.getXmlElem()))) { DataProviderDescriptor.Builder builder = new DataProviderDescriptor.Builder(); String label = String.valueOf(element.getLabel()); String elemId = element.getId(); if (elemId == null) { continue; } builder.setId(elemId).setName(label).setDescription(label); if (viewType == OutputType.XY) { builder.setProviderType(ProviderType.TREE_TIME_XY); } else if (viewType == OutputType.TIME_GRAPH) { builder.setProviderType(ProviderType.TIME_GRAPH); } for (String id : element.getAnalyses()) { if (modules.containsKey(id)) { descriptors.add(builder.build()); break; } } } } return descriptors; }
Source:
public void handleIncomingProjectNegotiation( final AbstractIncomingProjectNegotiation negotiation) { Map<String, IProject> projectMapping = new HashMap<>(); for (ProjectNegotiationData data : negotiation.getProjectNegotiationData()) { String projectName = data.getProjectName(); IProject project = workspace.getProject(projectName); if (!project.exists()) { try { project.adaptTo(ServerProjectImpl.class).create(); } catch (IOException e) { projectMapping.clear(); negotiation.localCancel( "Error creating project folder", NegotiationTools.CancelOption.NOTIFY_PEER); break; } } projectMapping.put(data.getProjectID(), project); } projectExecutor.execute( new Runnable() { @Override public void run() { ProjectNegotiation.Status status; if (ServerConfig.isInteractive()) { status = negotiation.run(projectMapping, new ConsoleProgressIndicator(System.out)); } else { status = negotiation.run(projectMapping, new NullProgressMonitor()); } if (status != ProjectNegotiation.Status.OK) handleErrorStatus(status, negotiation.getErrorMessage(), negotiation.getPeer()); } }); }

Target:
public void handleIncomingProjectNegotiation( final AbstractIncomingProjectNegotiation negotiation) { Map<String, IProject> projectMapping = new HashMap<>(); for (ProjectNegotiationData data : negotiation.getProjectNegotiationData()) { String projectName = data.getProjectName(); IProject project = workspace.getProject(projectName); if (!project.exists()) { try { project.adaptTo(ServerProjectImpl.class).create(); } catch (IOException e) { negotiation.localCancel( "Error creating project folder", NegotiationTools.CancelOption.NOTIFY_PEER); return; } } projectMapping.put(data.getProjectID(), project); } projectExecutor.execute( new Runnable() { @Override public void run() { ProjectNegotiation.Status status; if (ServerConfig.isInteractive()) { status = negotiation.run(projectMapping, new ConsoleProgressIndicator(System.out)); } else { status = negotiation.run(projectMapping, new NullProgressMonitor()); } if (status != ProjectNegotiation.Status.OK) handleErrorStatus(status, negotiation.getErrorMessage(), negotiation.getPeer()); } }); }