auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private PythonVariables getPyInputsFromWritables(List<Writable> writables){ PythonVariables ret = new PythonVariables(); for (String name: pyInputs.getVariables()){ int colIdx = inputSchema.getIndexOfColumn(name); Writable w = writables.get(colIdx); PythonVariables.Type pyType = pyInputs.getType(name); switch (pyType){ case INT: if (w instanceof LongWritable){ ret.addInt(name, ((LongWritable)w).get()); } else{ ret.addInt(name, ((IntWritable)w).get()); } break; case FLOAT: ret.addFloat(name, ((DoubleWritable)w).get()); break; case STR: ret.addStr(name, ((Text)w).toString()); break; case NDARRAY: ret.addNDArray(name,((NDArrayWritable)w).get()); break; } } return ret; }

Target:
private PythonVariables getPyInputsFromWritables(List<Writable> writables){ PythonVariables ret = new PythonVariables(); for (String name: pyInputs.getVariables()){ int colIdx = inputSchema.getIndexOfColumn(name); Writable w = writables.get(colIdx); PythonVariables.Type pyType = pyInputs.getType(name); switch (pyType){ case INT: if (w instanceof LongWritable){ ret.addInt(name, ((LongWritable)w).get()); } else{ ret.addInt(name, ((IntWritable)w).get()); } break; case FLOAT: if (w instanceof DoubleWritable){ ret.addFloat(name, ((DoubleWritable)w).get()); } else{ ret.addFloat(name, ((FloatWritable)w).get()); } break; case STR: ret.addStr(name, ((Text)w).toString()); break; case NDARRAY: ret.addNDArray(name,((NDArrayWritable)w).get()); break; } } return ret; }
Source:
public void shouldGetCohortQueryReportWithGivenParameters() { String cohortQueryUuid = "QQQ"; Map<String, String> parameters = new HashMap<>(); parameters.put("param1", "value"); parameters.put("param2", "value"); ArgumentCaptor<String> uuidCaptor = ArgumentCaptor.forClass(String.class); ArgumentCaptor<Map> parametersCaptor = ArgumentCaptor.forClass(Map.class); doReturn(prepareCohortQueryReportWithMembers()).when(cohortService) .getCohortQueryReport(eq(CONFIG_NAME), eq(cohortQueryUuid), eq(parameters)); openMRSActionProxyService.getCohortQueryReport(CONFIG_NAME, cohortQueryUuid, parameters); verify(cohortService).getCohortQueryReport(eq(CONFIG_NAME), uuidCaptor.capture(), parametersCaptor.capture()); verify(eventRelay, times(3)).sendEventMessage(Matchers.<MotechEvent>any()); assertEquals(cohortQueryUuid, uuidCaptor.getValue()); assertEquals(parameters, parametersCaptor.getValue()); }

Target:
public void shouldGetCohortQueryReportWithGivenParameters() { String cohortQueryUuid = "QQQ"; Map<String, String> parameters = new HashMap<>(); parameters.put("param1", "value"); parameters.put("param2", "value"); ArgumentCaptor<String> uuidCaptor = ArgumentCaptor.forClass(String.class); ArgumentCaptor<Map> parametersCaptor = ArgumentCaptor.forClass(Map.class); ArgumentCaptor<MotechEvent> eventCaptor = ArgumentCaptor.forClass(MotechEvent.class); doReturn(prepareCohortQueryReport(true)).when(cohortService) .getCohortQueryReport(eq(CONFIG_NAME), eq(cohortQueryUuid), eq(parameters)); openMRSActionProxyService.getCohortQueryReport(CONFIG_NAME, cohortQueryUuid, parameters); verify(cohortService).getCohortQueryReport(eq(CONFIG_NAME), uuidCaptor.capture(), parametersCaptor.capture()); verify(eventRelay, times(2)).sendEventMessage(eventCaptor.capture()); assertEquals(cohortQueryUuid, uuidCaptor.getValue()); assertEquals(parameters, parametersCaptor.getValue()); List<MotechEvent> capturedEvents = eventCaptor.getAllValues(); assertEquals(createEventForMember(cohortQueryUuid, prepareCohortQueryReportMember("1")), capturedEvents.get(0)); assertEquals(createEventForMember(cohortQueryUuid, prepareCohortQueryReportMember("2")), capturedEvents.get(1)); }
Source:
public boolean isVisible(Widget widget) { if (widget.isDisposed()) return false; boolean ret = true; Object o = null; try { o = ObjectUtil.invokeMethod(widget, "isVisible"); } catch (RuntimeException e) { throw new CoreLayerException( "Runtime error during checking widget visibility", e); } if (o instanceof Boolean) { ret = ((Boolean) o).booleanValue(); } return ret; }

Target:
public boolean isVisible(Widget widget) { boolean ret = true; Object o = null; try { o = ObjectUtil.invokeMethod(widget, "isVisible"); } catch (RuntimeException e) { throw new CoreLayerException( "Runtime error during checking widget visibility", e); } if (o == null) { return ret; } if (o instanceof Boolean) { ret = ((Boolean) o).booleanValue(); } return ret; }
Source:
public void testInsertSingleInstance() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Instances> instance = new VirtualRowSnapshot<>(new InstanceTable(mAuthority)); assertThat(new Seq<>( new Put<>(taskList, new NameData("list1")), new Referring<>(taskList, Tasks.LIST_ID, new Put<>(instance, new CharSequenceRowData<>(Tasks.TITLE, "task1"))) ), resultsIn(mClient, new Assert<>(taskList, new NameData("list1")), new AssertRelated<>(new InstanceTable(mAuthority), Tasks.LIST_ID, taskList, new Composite<>( new InstanceData(Instances.INSTANCE_STATUS_NEXT), new CharSequenceRowData<>(Tasks.TITLE, "task1")) ))); }

Target:
public void testInsertSingleInstance() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Instances> instance = new VirtualRowSnapshot<>(new InstanceTable(mAuthority)); assertThat(new Seq<>( new Put<>(taskList, new NameData("list1")), new Referring<>(taskList, Tasks.LIST_ID, new Put<>(instance, new CharSequenceRowData<>(Tasks.TITLE, "task1"))) ), resultsIn(mClient, new Assert<>(taskList, new NameData("list1")), new AssertRelated<>(new InstanceTable(mAuthority), Tasks.LIST_ID, taskList, new Composite<>( new InstanceTestData(0), new CharSequenceRowData<>(Tasks.TITLE, "task1"), new CharSequenceRowData<>(Tasks.TZ, null)) ))); }
Source:
public void updateTo(String sha, Boolean force) throws IOException { root.retrieve() .method("POST") .with("sha", sha) .with("force", force) .method("PATCH") .withUrlPath(url) .to(GHRef.class) .wrap(root); }

Target:
public void updateTo(String sha, Boolean force) throws IOException { root.createRequest() .method("PATCH") .with("sha", sha) .with("force", force) .withUrlPath(url) .fetch(GHRef.class) .wrap(root); }
Source:
public static DSLContext databaseAgnostic(DataSource dataSource) throws SQLException { SQLDialect dialect; try (Connection conn = dataSource.getConnection()) { dialect = dialect(conn); } return DSL.using(dataSource, SQLDialect.H2, new Settings() .withRenderSchema(false) .withRenderNameStyle(RenderNameStyle.AS_IS)); }

Target:
public static DSLContext databaseAgnostic(DataSource dataSource) throws SQLException { SQLDialect dialect; try (Connection conn = dataSource.getConnection()) { dialect = dialect(conn); } return DSL.using(dataSource, dialect, new Settings() .withRenderSchema(false) .withRenderNameStyle(RenderNameStyle.AS_IS)); }
Source:
int getBlock(final AbfsInputStream stream, final long position, final int length, final byte[] buffer) throws java.io.IOException { if (LOGGER.isTraceEnabled()) { LOGGER.trace("getBlock for file position thread {}", stream.getPath(), position, Thread.currentThread().getName()); } waitForProcess(stream, position); int bytesRead = 0; synchronized (this) { bytesRead = getBlockFromCompletedQueue(stream, position, length, buffer); } if (bytesRead > 0) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Done read from Cache for position length {}", stream.getPath(), position, bytesRead); } return bytesRead; } return 0; }

Target:
int getBlock(final AbfsInputStream stream, final long position, final int length, final byte[] buffer) throws IOException { if (LOGGER.isTraceEnabled()) { LOGGER.trace("getBlock for file position thread {}", stream.getPath(), position, Thread.currentThread().getName()); } waitForProcess(stream, position); int bytesRead = 0; synchronized (this) { bytesRead = getBlockFromCompletedQueue(stream, position, length, buffer); } if (bytesRead > 0) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Done read from Cache for position length {}", stream.getPath(), position, bytesRead); } return bytesRead; } return 0; }
Source:
protected Map.Entry<String, Map> buildProcedureQueryWithParams(String storedProcedureName, ProcedureQueryParameters queryParameters) { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append( "CALL " ).append( storedProcedureName ).append( "(" ); Map namedParams = new HashMap<>(); List parameters = queryParameters.getPositionalParameters(); for ( int i = 0; i < parameters.size(); i++ ) { queryBuilder.append( "{a" + i + "}," ); namedParams.put( "a" + i, parameters.get( i ) ); } queryBuilder.replace( queryBuilder.lastIndexOf( "," ), queryBuilder.length(), ")" ); return new AbstractMap.SimpleEntry<>( queryBuilder.toString(), namedParams ); }

Target:
protected Map.Entry<String, Map<String, Object>> buildProcedureQueryWithParams(String storedProcedureName, ProcedureQueryParameters queryParameters) { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append( "CALL " ).append( storedProcedureName ).append( "(" ); Map<String, Object> namedParams; if ( queryParameters.getPositionalParameters() != null && queryParameters.getPositionalParameters() .size() > 0 ) { namedParams = new HashMap<>(); List parameters = queryParameters.getPositionalParameters(); for ( int i = 0; i < parameters.size(); i++ ) { queryBuilder.append( "{" ).append( i ).append( "}," ); namedParams.put( String.valueOf( i ), parameters.get( i ) ); } } else { namedParams = queryParameters.getNamedParameters(); for ( String namedParameter : namedParams.keySet() ) { queryBuilder.append( "{" ).append( namedParameter ).append( "}," ); } } queryBuilder.replace( queryBuilder.lastIndexOf( "," ), queryBuilder.length(), ")" ); return new AbstractMap.SimpleEntry<>( queryBuilder.toString(), namedParams ); }
Source:
public List<Ref> call() throws GitAPIException { checkCallable(); List<Ref> resultRefs; try { Collection<Ref> refs = new ArrayList<>(); Ref head = repo.exactRef(HEAD); if (head != null && head.getLeaf().getName().equals(HEAD)) refs.add(head); if (listMode == null) { refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_HEADS)); } else if (listMode == ListMode.REMOTE) { refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_REMOTES)); } else { refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_HEADS, R_REMOTES)); } resultRefs = new ArrayList<>(filterRefs(refs)); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } Collections.sort(resultRefs, new Comparator<Ref>() { @Override public int compare(Ref o1, Ref o2) { return o1.getName().compareTo(o2.getName()); } }); setCallable(false); return resultRefs; }

Target:
public List<Ref> call() throws GitAPIException { checkCallable(); List<Ref> resultRefs; try { Collection<Ref> refs = new ArrayList<>(); Ref head = repo.exactRef(HEAD); if (head != null && head.getLeaf().getName().equals(HEAD)) { refs.add(head); } if (listMode == null) { refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_HEADS)); } else if (listMode == ListMode.REMOTE) { refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_REMOTES)); } else { refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_HEADS, R_REMOTES)); } resultRefs = new ArrayList<>(filterRefs(refs)); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } Collections.sort(resultRefs, new Comparator<Ref>() { @Override public int compare(Ref o1, Ref o2) { return o1.getName().compareTo(o2.getName()); } }); setCallable(false); return resultRefs; }
Source:
public void testWithNoPrefixSet() { final PrefixedSpringCredentialBuilder builder = new PrefixedSpringCredentialBuilder(); assertThrows(IllegalArgumentException.class, builder::build); }

Target:
public void testWithNoPrefixSet() { final PrefixedSpringCredentialBuilder builder = new PrefixedSpringCredentialBuilder(); builder.environment(buildEnvironment(new Properties())); assertThrows(IllegalArgumentException.class, builder::build); }
Source:
public Config buildConfig(Config defaultConfig, @Nullable String workspaceId) throws InfrastructureException { return defaultConfig; }

Target:
protected Config buildConfig(Config defaultConfig, @Nullable String workspaceId) throws InfrastructureException { return defaultConfig; }
Source:
public static ObservableBehaviorAdapter create() { return INSTANCE; }

Target:
public static ObservableBehaviorAdapter create() { return new ObservableBehaviorAdapter(); }
Source:
public void setSolShip(SolShip hero, SolGame solGame) { isInvincible = false; isDead = false; if (hero != shipHero && !isTranscendent) { mercs = new ItemContainer(); } this.shipHero = hero; isTranscendent = false; if (shipHero.getTradeContainer() != null) { throw new SolException("Hero is not supposed to have TradeContainer."); } GameOptions options = solGame.getSolApplication().getOptions(); if (hero.getHull() != null) solGame.getSolApplication().getMusicManager().registerModuleMusic(hero.getHull().getHullConfig().getInternalName().split(":")[0], options); solGame.getSolApplication().getMusicManager().playMusic(OggMusicManager.GAME_MUSIC_SET, options); }

Target:
public void setSolShip(SolShip hero, SolGame solGame) { isDead = false; if (hero != shipHero && !isTranscendent) { mercs = new ItemContainer(); } this.shipHero = hero; isTranscendent = false; if (shipHero.getTradeContainer() != null) { throw new SolException("Hero is not supposed to have TradeContainer."); } GameOptions options = solGame.getSolApplication().getOptions(); if (hero.getHull() != null) solGame.getSolApplication().getMusicManager().registerModuleMusic(hero.getHull().getHullConfig().getInternalName().split(":")[0], options); solGame.getSolApplication().getMusicManager().playMusic(OggMusicManager.GAME_MUSIC_SET, options); }
Source:
protected void onInitUI() { super.onInitUI(); prev = new Hyperlink(Util.C.pagedChangeListPrev(), true, ""); prev.setVisible(false); next = new Hyperlink(Util.C.pagedChangeListNext(), true, ""); next.setVisible(false); table = new ChangeTable2() { { keysNavigation.add(new DoLinkCommand(0, 'p', Util.C .changeTablePagePrev(), prev)); keysNavigation.add(new DoLinkCommand(0, 'n', Util.C .changeTablePageNext(), next)); } }; section = new ChangeTable2.Section(); table.addSection(section); table.setSavePointerId(anchorPrefix); HorizontalPanel copySearchResultPanel = new HorizontalPanel(); copySearchResultPanel.add(new Label(Util.C.pagedCopySearchResults())); copySearchResultPanel.add(copySearchResult = new CopyableLabel("", false)); setTitleFarEast(copySearchResultPanel); add(table); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks()); buttons.add(prev); buttons.add(next); add(buttons); }

Target:
protected void onInitUI() { super.onInitUI(); prev = new Hyperlink(Util.C.pagedChangeListPrev(), true, ""); prev.setVisible(false); next = new Hyperlink(Util.C.pagedChangeListNext(), true, ""); next.setVisible(false); table = new ChangeTable2() { { keysNavigation.add(new DoLinkCommand(0, 'p', Util.C .changeTablePagePrev(), prev)); keysNavigation.add(new DoLinkCommand(0, 'n', Util.C .changeTablePageNext(), next)); keysNavigation.add(new DoLinkCommand(0, '[', Util.C .changeTablePagePrev(), prev)); keysNavigation.add(new DoLinkCommand(0, ']', Util.C .changeTablePageNext(), next)); keysNavigation.add(new KeyCommand(0, 'R', Util.C.keyReloadSearch()) { @Override public void onKeyPress(final KeyPressEvent event) { Gerrit.display(getToken()); } }); } }; section = new ChangeTable2.Section(); table.addSection(section); table.setSavePointerId(anchorPrefix); HorizontalPanel copySearchResultPanel = new HorizontalPanel(); copySearchResultPanel.add(new Label(Util.C.pagedCopySearchResults())); copySearchResultPanel.add(copySearchResult = new CopyableLabel("", false)); setTitleFarEast(copySearchResultPanel); add(table); final HorizontalPanel buttons = new HorizontalPanel(); buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks()); buttons.add(prev); buttons.add(next); add(buttons); }
Source:
public void transactionWithNestedExpressionFilterEvaluatesFalseStopsFlowAndReturnsNull() throws Exception { MuleClient client = muleContext.getClient(); client.dispatch("vm://transaction-filter-all", TEST_MESSAGE, null); MuleMessage reply = client.request("vm://transaction-filter-all-reply", RECEIVE_TIMEOUT); assertThat(reply, nullValue()); }

Target:
public void transactionWithNestedExpressionFilterEvaluatesFalseStopsFlowAndReturnsNull() throws Exception { MuleMessage reply = sendTestMessageVmQueueEndpoint("transaction-filter-all", "transaction-filter-all-reply"); assertThat(reply, nullValue()); }
Source:
public void iteratesContent() throws Exception { final Repos repos = github().repos(); final Repo repo = this.rule.repo(repos); try { final String afile = RandomStringUtils.randomAlphanumeric(Tv.TEN); final String dir = RandomStringUtils.randomAlphanumeric(Tv.TEN); final String bfile = new StringBuilder(dir) .append("/") .append(RandomStringUtils.randomAlphanumeric(Tv.TEN)) .toString(); final String message = String.format("testMessage"); final String acont = new String( Base64.encodeBase64( String.format("content a:%d", System.currentTimeMillis()) .getBytes() ) ); final String bcont = new String( Base64.encodeBase64( String.format("content b:%d", System.currentTimeMillis()) .getBytes() ) ); final Contents contents = repos.get(repo.coordinates()).contents(); contents.create(this.jsonObject(afile, acont, message)); contents.create(this.jsonObject(bfile, bcont, message)); final Content acontent = contents.get(afile); final Content bcontent = contents.get(dir); final Iterable<Content> iterated = contents.iterate("", "master"); MatcherAssert.assertThat( iterated, Matchers.allOf( Matchers.hasItems(acontent, bcontent), Matchers.<Content>iterableWithSize(3) ) ); } finally { repos.remove(repo.coordinates()); } }

Target:
public void iteratesContent() throws Exception { final Repos repos = github().repos(); final Repo repo = this.rule.repo(repos); try { final String afile = RandomStringUtils.randomAlphanumeric(Tv.TEN); final String dir = RandomStringUtils.randomAlphanumeric(Tv.TEN); final String bfile = String.format( "%s/%s", dir, RandomStringUtils.randomAlphanumeric(Tv.TEN) ); final String message = String.format("testMessage"); final Contents contents = repos.get(repo.coordinates()).contents(); contents.create( this.jsonObject( afile, new String( Base64.encodeBase64( String.format( "content a:%d", System.currentTimeMillis() ).getBytes() ) ), message ) ); contents.create( this.jsonObject( bfile, new String( Base64.encodeBase64( String.format( "content b:%d", System.currentTimeMillis() ).getBytes() ) ), message ) ); final Iterable<Content> iterated = contents.iterate("", "master"); MatcherAssert.assertThat( iterated, Matchers.allOf( Matchers.hasItems(contents.get(afile), contents.get(dir)), Matchers.<Content>iterableWithSize(Tv.THREE) ) ); } finally { repos.remove(repo.coordinates()); } }
Source:
public long getForceValue(boolean noInfantry) { long value = 0; for (UUID uuid : forces.getAllUnits()) { Unit u = getUnit(uuid); if (null == u) { continue; } if (noInfantry && u.getEntity() instanceof Infantry && !(u.getEntity() instanceof BattleArmor)) { continue; } if (u.getEntity() instanceof Dropship) { if (getCampaignOptions().getDropshipContractPercent() == 0) { continue; } if (getCampaignOptions().useEquipmentContractSaleValue()) { value += (getCampaignOptions().getDropshipContractPercent() / 100) * u.getSellValue(); } else { value += (getCampaignOptions().getDropshipContractPercent() / 100) * u.getBuyCost(); } } else if (u.getEntity() instanceof Warship) { if (getCampaignOptions().getWarshipContractPercent() == 0) { continue; } if (getCampaignOptions().useEquipmentContractSaleValue()) { value += (getCampaignOptions().getWarshipContractPercent() / 100) * u.getSellValue(); } else { value += (getCampaignOptions().getWarshipContractPercent() / 100) * u.getBuyCost(); } } else if (u.getEntity() instanceof Jumpship) { if (getCampaignOptions().getJumpshipContractPercent() == 0) { continue; } if (getCampaignOptions().useEquipmentContractSaleValue()) { value += (getCampaignOptions().getJumpshipContractPercent() / 100) * u.getSellValue(); } else { value += (getCampaignOptions().getJumpshipContractPercent() / 100) * u.getBuyCost(); } } else { if (getCampaignOptions().useEquipmentContractSaleValue()) { value += (getCampaignOptions().getEquipmentContractPercent() / 100.0) * u.getSellValue(); } else { value += (getCampaignOptions().getEquipmentContractPercent() / 100.0) * u.getBuyCost(); } } } return value; }

Target:
public long getForceValue(boolean noInfantry) { long value = 0; for (UUID uuid : forces.getAllUnits()) { Unit u = getUnit(uuid); if (null == u) { continue; } if (noInfantry && ((u.getEntity().getEntityType() & Entity.ETYPE_INFANTRY) == Entity.ETYPE_INFANTRY) && !((u.getEntity().getEntityType() & Entity.ETYPE_BATTLEARMOR) == Entity.ETYPE_BATTLEARMOR)) { continue; } if (u.getEntity().hasETypeFlag(Entity.ETYPE_DROPSHIP)) { if (getCampaignOptions().getDropshipContractPercent() == 0) { continue; } value += getEquipmentContractValue(u, getCampaignOptions().useEquipmentContractSaleValue()); } else if (u.getEntity().hasETypeFlag(Entity.ETYPE_WARSHIP)) { if (getCampaignOptions().getWarshipContractPercent() == 0) { continue; } value += getEquipmentContractValue(u, getCampaignOptions().useEquipmentContractSaleValue()); } else if (u.getEntity().hasETypeFlag(Entity.ETYPE_JUMPSHIP) || u.getEntity().hasETypeFlag(Entity.ETYPE_SPACE_STATION)) { if (getCampaignOptions().getJumpshipContractPercent() == 0) { continue; } value += getEquipmentContractValue(u, getCampaignOptions().useEquipmentContractSaleValue()); } else { value += getEquipmentContractValue(u, getCampaignOptions().useEquipmentContractSaleValue()); } } return value; }
Source:
private void findAndThrowStartupErrors(Collection<Module> modules) { List<Exception> errors = new ArrayList<Exception>(); for (Module module : modules) { if (moduleFactoryWrapper.isModuleStopped(module)) { if (module.getStartupErrorMessage() != null) { errors.add(new ModuleException(module.getStartupErrorMessage())); } } } if (!errors.isEmpty()) { StringBuilder stringBuilder = new StringBuilder(); for (Exception error : errors) { stringBuilder.append(error.getMessage()).append("; "); } throw new RuntimeException(stringBuilder.toString()); } }

Target:
private void findAndThrowStartupErrors(Collection<Module> modules) { List<Exception> errors = new ArrayList<Exception>(); for (Module module : modules) { if (moduleFactoryWrapper.isModuleStopped(module)) { if (module.getStartupErrorMessage() != null) { errors.add(new ModuleException(module.getStartupErrorMessage())); } } } if (!errors.isEmpty()) { StringBuilder stringBuilder = new StringBuilder(); for (Exception error : errors) { stringBuilder.append(error.getMessage()).append("; "); } throw new ModuleException(stringBuilder.toString()); } }
Source:
public void subqueryWithCorrelationOnGroupByColumnThrows() throws Exception { try(ResultSet resultSet = methodWatcher.executeQuery(String.format("SELECT oc1, (SELECT c2 FROM %s WHERE ic2 = %s.oc1) FROM %s GROUP BY oc1 order by oc1 asc", itWatcher.toString(), otWatcher.toString(), otWatcher.toString()))) { Assert.fail("expected exception containing message: Column 'C2' is either not in any table in the FROM list or appears within a join specification and " + "is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or " + "ALTER TABLE statement then 'C2' is not a column in the target table."); } catch(Exception se) { Assert.assertTrue(se instanceof SQLException); Assert.assertEquals("42X04", ((SQLException) se).getSQLState()); Assert.assertTrue(se.getMessage().contains("Column 'C2' is either not in any table in the FROM list or appears within a join specification and is outside " + "the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this " + "is a CREATE or ALTER TABLE statement then 'C2' is not a column in the target table.")); } }

Target:
public void subqueryWithCorrelationOnGroupByColumnThrows() throws Exception { try(ResultSet resultSet = methodWatcher.executeQuery(String.format("SELECT oc1, (SELECT ic2 FROM %s WHERE ic2 = %s.oc1) FROM %s GROUP BY oc1 order by oc1 asc", itWatcher.toString(), otWatcher.toString(), otWatcher.toString()))) { Assert.fail("expected exception containing message: Scalar subquery is only allowed to return a single row."); } catch(Exception se) { Assert.assertTrue(se instanceof SQLException); Assert.assertEquals("21000", ((SQLException) se).getSQLState()); Assert.assertTrue(se.getMessage().contains("Scalar subquery is only allowed to return a single row.")); } }
Source:
String getHostname() { try { return InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { throw new RuntimeException(e); } }

Target:
String getHostname() { try { return InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { throw new CouldNotResolveHostNameException(e); } }
Source:
@Override public float getPressure () { return 0; }

Target:
public float getPressure () { return 0; }
Source:
Item(FragmentResponseMessage msg, long txnId) { m_initiateMsg = null; m_fragmentMsg = msg; m_txnId = txnId; }

Target:
Item(FragmentResponseMessage msg, long txnId) { m_initiateMsg = null; m_fragmentMsg = msg; m_safeSpHandle = txnId; }
Source:
public void appendAll(final Iterable<Event> events) { final Optional<Event> tenantDiningEvent = tryFind(events, Predicates.<Event>notNull()); if (!tenantDiningEvent.isPresent()) { return; } final Event event = tenantDiningEvent.get(); final TenantAwareOperation op = new EventOperation(event) { @Override public void run() { store(events); } }; op.execute(); logStored(events); }

Target:
public void appendAll(final Iterable<Event> events) { checkNotNull(events); final Optional<Event> tenantDefiningEvent = tryFind(events, Predicates.<Event>notNull()); if (!tenantDefiningEvent.isPresent()) { return; } final Event event = tenantDefiningEvent.get(); final TenantAwareOperation op = new EventOperation(event) { @Override public void run() { if (isTenantSet()) { ensureSameTenant(events); } store(events); } }; op.execute(); logStored(events); }
Source:
public static PermanentFlagsResponse parse(ImapResponse response) { ImapList responseTextList = response.getList(1); if (responseTextList.size() < 2 || !equalsIgnoreCase(responseTextList.get(0), Responses.PERMANENTFLAGS) || !responseTextList.isList(1)) { return null; } ImapList permanentFlagsList = responseTextList.getList(1); int size = permanentFlagsList.size(); Set<Flag> flags = new HashSet<>(size); boolean canCreateKeywords = false; for (int i = 0; i < size; i++) { if (!permanentFlagsList.isString(i)) { return null; } String flag = permanentFlagsList.getString(i); String compareFlag = flag.toLowerCase(Locale.US); switch (compareFlag) { case "\\deleted": { flags.add(Flag.DELETED); break; } case "\\answered": { flags.add(Flag.ANSWERED); break; } case "\\seen": { flags.add(Flag.SEEN); break; } case "\\flagged": { flags.add(Flag.FLAGGED); break; } case "$forwarded": { flags.add(Flag.FORWARDED); break; } case "\\*": { canCreateKeywords = true; break; } } } return new PermanentFlagsResponse(flags, canCreateKeywords); }

Target:
public static PermanentFlagsResponse parse(ImapResponse response) { if (response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK) || !response.isList(1)) { return null; } ImapList responseTextList = response.getList(1); if (responseTextList.size() < 2 || !equalsIgnoreCase(responseTextList.get(0), Responses.PERMANENTFLAGS) || !responseTextList.isList(1)) { return null; } ImapList permanentFlagsList = responseTextList.getList(1); int size = permanentFlagsList.size(); Set<Flag> flags = new HashSet<>(size); boolean canCreateKeywords = false; for (int i = 0; i < size; i++) { if (!permanentFlagsList.isString(i)) { return null; } String flag = permanentFlagsList.getString(i); String compareFlag = flag.toLowerCase(Locale.US); switch (compareFlag) { case "\\deleted": { flags.add(Flag.DELETED); break; } case "\\answered": { flags.add(Flag.ANSWERED); break; } case "\\seen": { flags.add(Flag.SEEN); break; } case "\\flagged": { flags.add(Flag.FLAGGED); break; } case "$forwarded": { flags.add(Flag.FORWARDED); break; } case "\\*": { canCreateKeywords = true; break; } } } return new PermanentFlagsResponse(flags, canCreateKeywords); }
Source:
private void initHandlers() { btnNestedPresenter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { } }); btnPresenterWidget.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { } }); btnPopupPresenter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { } }); tabbedPanel.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int index = tabbedPanel.getSelectedIndex(); setPresenterType(index); if (index == 0) { btnNestedPresenter.setSelected(true); btnPresenterWidget.setSelected(false); btnPopupPresenter.setSelected(false); } else if (index == 1) { btnNestedPresenter.setSelected(false); btnPresenterWidget.setSelected(true); btnPopupPresenter.setSelected(false); } else if (index == 2) { btnNestedPresenter.setSelected(false); btnPresenterWidget.setSelected(false); btnPopupPresenter.setSelected(true); } } }); }

Target:
private void initHandlers() { initRadioHandlers(); initTabFoldersHandlers(); initContentEventHandlers(); initPlaceHandlers(); initButtonHandlers(); }
Source:
private void initChatView() { WebView messagesWebView = getMessagesWebView(); JavaFxUtil.configureWebView(messagesWebView, preferencesService); messagesWebView.addEventHandler(MouseEvent.MOUSE_MOVED, moveHandler); messagesWebView.zoomProperty().addListener((observable, oldValue, newValue) -> { preferencesService.getPreferences().getChatPrefs().setZoom(newValue.doubleValue()); preferencesService.storeInBackground(); }); Double zoom = preferencesService.getPreferences().getChatPrefs().getZoom(); if (zoom != null) { messagesWebView.setZoom(zoom); } engine = messagesWebView.getEngine(); ((JSObject) engine.executeScript("window")).setMember(CHAT_TAB_REFERENCE_IN_JAVASCRIPT, this); engine.getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> { if (Worker.State.SUCCEEDED.equals(newValue)) { synchronized (waitingMessages) { waitingMessages.forEach(new Consumer<ChatMessage>() { @Override public void accept(ChatMessage chatMessage) { AbstractChatTabController.this.appendMessage(chatMessage); } }); waitingMessages.clear(); isChatReady = true; } } }); try (InputStream inputStream = CHAT_HTML_RESOURCE.getInputStream()) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ByteCopier.from(inputStream).to(byteArrayOutputStream).copy(); String chatContainerHtml = new String(byteArrayOutputStream.toByteArray(), StandardCharsets.UTF_8) .replace("{chat-container-js}", CHAT_JS_RESOURCE.getURL().toExternalForm()) .replace("{auto-linker-js}", AUTOLINKER_JS_RESOURCE.getURL().toExternalForm()); engine.loadContent(chatContainerHtml); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private void initChatView() { WebView messagesWebView = getMessagesWebView(); JavaFxUtil.configureWebView(messagesWebView, preferencesService); messagesWebView.addEventHandler(MouseEvent.MOUSE_MOVED, moveHandler); messagesWebView.zoomProperty().addListener((observable, oldValue, newValue) -> { preferencesService.getPreferences().getChat().setZoom(newValue.doubleValue()); preferencesService.storeInBackground(); }); Double zoom = preferencesService.getPreferences().getChat().getZoom(); if (zoom != null) { messagesWebView.setZoom(zoom); } engine = messagesWebView.getEngine(); (getJsObject()).setMember(CHAT_TAB_REFERENCE_IN_JAVASCRIPT, this); engine.getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> { if (Worker.State.SUCCEEDED.equals(newValue)) { synchronized (waitingMessages) { waitingMessages.forEach(AbstractChatTabController.this::appendMessage); waitingMessages.clear(); isChatReady = true; } } }); try (InputStream inputStream = CHAT_HTML_RESOURCE.getInputStream()) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ByteCopier.from(inputStream).to(byteArrayOutputStream).copy(); String chatContainerHtml = new String(byteArrayOutputStream.toByteArray(), StandardCharsets.UTF_8) .replace("{chat-container-js}", CHAT_JS_RESOURCE.getURL().toExternalForm()) .replace("{auto-linker-js}", AUTOLINKER_JS_RESOURCE.getURL().toExternalForm()); engine.loadContent(chatContainerHtml); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
private String blockingSSLConnect(int socketBufSize) throws IOException { String connectionId = selector.connect(new InetSocketAddress("localhost", server.port), socketBufSize, socketBufSize, PortType.SSL); while (!selector.connected().contains(connectionId)) { System.out.println("here"); selector.poll(10000L); } return connectionId; }

Target:
private String blockingSSLConnect(int socketBufSize) throws IOException { String connectionId = selector.connect(new InetSocketAddress("localhost", server.port), socketBufSize, socketBufSize, PortType.SSL); while (!selector.connected().contains(connectionId)) { selector.poll(10000L); } return connectionId; }
Source:
public static LinkedHashSet<String> findJars(LogicalPlan dag, Class<?>[] defaultClasses) { List<Class<?>> jarClasses = new ArrayList<>(); for (String className : dag.getClassNames()) { try { Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className); jarClasses.add(clazz); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Failed to load class " + className, e); } } for (Class<?> clazz : Lists.newArrayList(jarClasses)) { for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass()) { jarClasses.add(c); jarClasses.addAll(Arrays.asList(c.getInterfaces())); } } jarClasses.addAll(Arrays.asList(defaultClasses)); if (dag.isDebug()) { LOG.debug("Deploy dependencies: {}", jarClasses); } LinkedHashSet<String> localJarFiles = new LinkedHashSet<>(); HashMap<String, String> sourceToJar = new HashMap<>(); for (Class<?> jarClass : jarClasses) { String jar = JarHelper.getJar(jarClass); if (jar != null) { localJarFiles.add(jar); } } String libJarsPath = dag.getValue(Context.DAGContext.LIBRARY_JARS); if (!StringUtils.isEmpty(libJarsPath)) { String[] libJars = StringUtils.splitByWholeSeparator(libJarsPath, LIB_JARS_SEP); localJarFiles.addAll(Arrays.asList(libJars)); } LOG.info("Local jar file dependencies: " + localJarFiles); return localJarFiles; }

Target:
public static LinkedHashSet<String> findJars(LogicalPlan dag, Class<?>[] defaultClasses) { List<Class<?>> jarClasses = new ArrayList<>(); for (String className : dag.getClassNames()) { try { Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className); jarClasses.add(clazz); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Failed to load class " + className, e); } } for (Class<?> clazz : Lists.newArrayList(jarClasses)) { for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass()) { jarClasses.add(c); jarClasses.addAll(Arrays.asList(c.getInterfaces())); } } jarClasses.addAll(Arrays.asList(defaultClasses)); if (dag.isDebug()) { LOG.debug("Deploy dependencies: {}", jarClasses); } LinkedHashSet<String> localJarFiles = new LinkedHashSet<>(); JarHelper jarHelper = new JarHelper(); for (Class<?> jarClass : jarClasses) { String jar = jarHelper.getJar(jarClass); if (jar != null) { localJarFiles.add(jar); } } String libJarsPath = dag.getValue(Context.DAGContext.LIBRARY_JARS); if (!StringUtils.isEmpty(libJarsPath)) { String[] libJars = StringUtils.splitByWholeSeparator(libJarsPath, LIB_JARS_SEP); localJarFiles.addAll(Arrays.asList(libJars)); } LOG.info("Local jar file dependencies: " + localJarFiles); return localJarFiles; }
Source:
public final int parse (InputStream stream, RepInfo info, int parseIndex) throws IOException { initParse (); info.setModule (this); info.setFormat (_format[0]); info.setMimeType (_mimeType[0]); setupDataStream(stream, info); boolean eof = false; _nByte = 0; byte[] byteBuf = new byte[4096]; while (!eof) { try { int n = readByteBuf (_dstream, byteBuf, this); if (n <= 0) { break; } } catch (EOFException e) { eof = true; } } info.setSize (_nByte); if (_nByte == 0) { info.setMessage (new InfoMessage (CoreMessageConstants.INF_FILE_EMPTY)); } if (_ckSummer != null) { info.setChecksum (new Checksum (_ckSummer.getCRC32 (), ChecksumType.CRC32)); String value = _ckSummer.getMD5 (); if (value != null) { info.setChecksum (new Checksum (value, ChecksumType.MD5)); } if ((value = _ckSummer.getSHA1 ()) != null) { info.setChecksum (new Checksum (value, ChecksumType.SHA1)); } } return 0; }

Target:
public final int parse (InputStream stream, RepInfo info, int parseIndex) throws IOException { initParse (); info.setModule (this); info.setFormat (this._format[0]); info.setMimeType (this._mimeType[0]); setupDataStream(stream, info); boolean eof = false; this._nByte = 0; byte[] byteBuf = new byte[4096]; while (!eof) { try { int n = readByteBuf (this._dstream, byteBuf, this); if (n <= 0) { break; } } catch (EOFException e) { _logger.log(Level.FINEST, "End of file exception when parsing.", e); eof = true; } } info.setSize (this._nByte); if (this._nByte == 0) { info.setMessage (new InfoMessage (CoreMessageConstants.INF_FILE_EMPTY)); } setChecksums(this._ckSummer, info); return 0; }
Source:
public void load(Reader theReader, boolean allowArray) throws DataFormatException { PushbackReader pbr = new PushbackReader(theReader); int nextInt; try { while(true) { nextInt = pbr.read(); if (nextInt == -1) { throw new DataFormatException("Did not find any content to parse"); } if (nextInt == '{') { pbr.unread(nextInt); break; } if (Character.isWhitespace(nextInt)) { continue; } if (allowArray) { if (nextInt == '[') { pbr.unread(nextInt); break; } throw new DataFormatException("Content does not appear to be FHIR JSON, first non-whitespace character was: '" + (char)nextInt + "' (must be '{' or '[')"); } throw new DataFormatException("Content does not appear to be FHIR JSON, first non-whitespace character was: '" + (char)nextInt + "' (must be '{')"); } Gson gson = new GsonBuilder().disableHtmlEscaping().create(); if (nextInt == '{') { JsonObject root = gson.fromJson(pbr, JsonObject.class); setNativeObject(root); } else { JsonArray root = gson.fromJson(pbr, JsonArray.class); setNativeArray(root); } } catch (Exception e) { if (e.getMessage().startsWith("Unexpected char 39")) { throw new DataFormatException("Failed to parse JSON encoded FHIR content: " + e.getMessage() + " - " + "This may indicate that single quotes are being used as JSON escapes where double quotes are required", e); } throw new DataFormatException("Failed to parse JSON encoded FHIR content: " + e.getMessage(), e); } }

Target:
public void load(Reader theReader, boolean allowArray) throws DataFormatException { PushbackReader pbr = new PushbackReader(theReader); int nextInt; try { while(true) { nextInt = pbr.read(); if (nextInt == -1) { throw new DataFormatException("Did not find any content to parse"); } if (nextInt == '{') { pbr.unread(nextInt); break; } if (Character.isWhitespace(nextInt)) { continue; } if (allowArray) { if (nextInt == '[') { pbr.unread(nextInt); break; } throw new DataFormatException("Content does not appear to be FHIR JSON, first non-whitespace character was: '" + (char)nextInt + "' (must be '{' or '[')"); } throw new DataFormatException("Content does not appear to be FHIR JSON, first non-whitespace character was: '" + (char)nextInt + "' (must be '{')"); } if (nextInt == '{') { setNativeObject((ObjectNode) OBJECT_MAPPER.readTree(pbr)); } else { setNativeArray((ArrayNode) OBJECT_MAPPER.readTree(pbr)); } } catch (Exception e) { if (e.getMessage().startsWith("Unexpected char 39")) { throw new DataFormatException("Failed to parse JSON encoded FHIR content: " + e.getMessage() + " - " + "This may indicate that single quotes are being used as JSON escapes where double quotes are required", e); } throw new DataFormatException("Failed to parse JSON encoded FHIR content: " + e.getMessage(), e); } }
Source:
public void onMapReady(GoogleMap map) { mMap = map; mMap.getUiSettings().setCompassEnabled(false); mMap.getUiSettings().setMyLocationButtonEnabled(false); mMap.moveCamera(CameraUpdateFactory.zoomTo(MapUtils.ZOOM)); LatLng latLng; if (mSchool == null) { latLng = new LatLng(MapUtils.DEFAULT_LAT, MapUtils.DEFAULT_LONG); } else { latLng = new LatLng(mSchool.getLat(), mSchool.getLng()); } moveMapToLatLng(latLng); mBounds = latLng; mRadius.setMax(MAX_RADIUS); final int initialRadius; if (mSchool != null) { initialRadius = mSchool.getRadius(); mRadius.setProgress(initialRadius); } else { initialRadius = 0; } mRadiusInt.setText(Integer.toString(initialRadius) + " m"); mMapView.setRadius(initialRadius); mMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition position) { mBounds = mMap.getCameraPosition().target; } }); mRadius.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { int radius = progress; mMapView.setRadius(radius); mRadiusInt.setText(Integer.toString(radius) + " m"); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); }

Target:
public void onMapReady(GoogleMap map) { mMap = map; mMap.getUiSettings().setCompassEnabled(false); mMap.getUiSettings().setMyLocationButtonEnabled(false); mMap.moveCamera(CameraUpdateFactory.zoomTo(MapUtils.ZOOM)); LatLng latLng; if (mSchool == null) { latLng = new LatLng(MapUtils.DEFAULT_LAT, MapUtils.DEFAULT_LONG); } else { latLng = new LatLng(mSchool.getLat(), mSchool.getLng()); } moveMapToLatLng(latLng); mBounds = latLng; mRadius.setMax(MAX_RADIUS); final int initialRadius; if (mSchool != null) { initialRadius = mSchool.getRadius(); mRadius.setProgress(initialRadius); } else { initialRadius = 0; } mRadiusInt.setText(initialRadius + " m"); mMapView.setRadius(initialRadius); mMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition position) { mBounds = mMap.getCameraPosition().target; } }); mRadius.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { int radius = progress; mMapView.setRadius(radius); mRadiusInt.setText(radius + " m"); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); }
Source:
public InitialLdapContextProvider(String server, String bindDn, String bindDNPwd, Boolean useSSL, String trustStore, String trustStorePassword) { LOGGER.debug("init()"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); if (bindDn != null) { env.put(Context.SECURITY_PRINCIPAL, bindDn); } if (bindDNPwd != null) { env.put(Context.SECURITY_CREDENTIALS, bindDNPwd); } env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, server); if(useSSL) { System.setProperty("javax.net.ssl.trustStore", trustStore); System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword); } }

Target:
public InitialLdapContextProvider(String server, String bindDn, String bindDNPwd, Boolean useSSL, String trustStore, String trustStorePassword) { this(server, bindDn, bindDNPwd); if(useSSL) { System.setProperty("javax.net.ssl.trustStore", trustStore); System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword); } }
Source:
public synchronized void traceOpened(final TmfTraceOpenedSignal signal) { final ITmfTrace trace = signal.getTrace(); final ITmfTimestamp startTs = trace.getStartTime(); final int SCALE = ITmfTimestamp.NANOSECOND_SCALE; long offset = trace.getInitialRangeOffset().normalize(0, SCALE).getValue(); long endTime = startTs.normalize(0, SCALE).getValue() + offset; final TmfTimeRange startTr = new TmfTimeRange(startTs, new TmfTimestamp(endTime, SCALE)); final TmfTraceContext startCtx = new TmfTraceContext(startTs, startTr); fTraces.put(trace, startCtx); if (fCurrentTrace == null) { fCurrentTrace = trace; } }

Target:
public synchronized void traceOpened(final TmfTraceOpenedSignal signal) { final ITmfTrace trace = signal.getTrace(); final ITmfTimestamp startTs = trace.getStartTime(); final int SCALE = ITmfTimestamp.NANOSECOND_SCALE; long offset = trace.getInitialRangeOffset().normalize(0, SCALE).getValue(); long endTime = startTs.normalize(0, SCALE).getValue() + offset; final TmfTimeRange startTr = new TmfTimeRange(startTs, new TmfTimestamp(endTime, SCALE)); final TmfTraceContext startCtx = new TmfTraceContext(startTs, startTr); fTraces.put(trace, startCtx); fCurrentTrace = trace; }
Source:
public void recordWithNonexistentReferences(){ Individual individual = makeValidEntity("validName", "validId"); individual.setCollectedBy(null); individual = service.recordIndividual(individual, "feldwarker"); assertNotNull(individual.getCollectedBy()); }

Target:
public void recordWithNonexistentReferences(){ Individual individual = makeValidEntity("validName", "validId"); individual.setCollectedBy(null); individual = service.recordIndividual(individual, "feldwarker"); assertNotNull(individual.getCollectedBy()); assertEquals(individual.getCollectedBy().getUuid(), "feldwarker"); }
Source:
private CompletableFuture<LogReplicationContext> startDiscoveryService(ServerContext serverContext) { log.info("Start Discovery Service."); CompletableFuture<LogReplicationContext> discoveryServiceCallback = new CompletableFuture<>(); this.clusterManagerAdapter = buildClusterManagerAdapter(serverContext.getPluginConfigFilePath()); replicationDiscoveryService = new CorfuReplicationDiscoveryService(serverContext, clusterManagerAdapter, discoveryServiceCallback); Thread replicationDiscoveryThread = new Thread(replicationDiscoveryService); replicationDiscoveryThread.start(); return discoveryServiceCallback; }

Target:
private CompletableFuture<CorfuInterClusterReplicationServerNode> startDiscoveryService(ServerContext serverContext) { log.info("Start Discovery Service."); CompletableFuture<CorfuInterClusterReplicationServerNode> discoveryServiceCallback = new CompletableFuture<>(); this.clusterManagerAdapter = buildClusterManagerAdapter(serverContext.getPluginConfigFilePath()); replicationDiscoveryService = new CorfuReplicationDiscoveryService(serverContext, clusterManagerAdapter, discoveryServiceCallback); Thread replicationDiscoveryThread = new Thread(replicationDiscoveryService, "discovery-service"); replicationDiscoveryThread.start(); return discoveryServiceCallback; }
Source:
public Void run() throws Exception { FlowNode thisNode = getContext().get(FlowNode.class); LinearScanner scanner = new LinearScanner(); FlowNode getLock = scanner.findFirstMatch(thisNode, new NodeStepTypePredicate("getLock")); if (getLock != null) { LockedResourcesAction action = getLock.getAction(LockedResourcesAction.class); if (action != null && !action.isReleased()) { LockableResourcesManager.get().unlockNames(action.getResourceNames(), getContext().get(Run.class), action.isInversePrecedence()); action.release(); getContext().get(TaskListener.class).getLogger() .println("Lock released on resource [" + action.getResourceDescription()+ "]"); } else { getContext().get(TaskListener.class).getLogger().println("No active lock, proceeding."); } } else { getContext().get(TaskListener.class).getLogger().println("No previous getLock step, proceeding."); } return null; }

Target:
public Void run() throws Exception { FlowNode thisNode = getContext().get(FlowNode.class); LinearScanner scanner = new LinearScanner(); FlowNode getLock = scanner.findFirstMatch(thisNode, new NodeStepTypePredicate("getLock")); if (getLock != null) { LockedFlowNodeAction action = getLock.getAction(LockedFlowNodeAction.class); if (action != null && !action.isReleased()) { LockableResourcesManager.get().unlockNames(action.getResourceNames(), getContext().get(Run.class), action.isInversePrecedence()); action.release(); getContext().get(TaskListener.class).getLogger() .println("Lock released on resource [" + action.getResourceDescription()+ "]"); } else { getContext().get(TaskListener.class).getLogger().println("No active lock, proceeding."); } } else { getContext().get(TaskListener.class).getLogger().println("No previous getLock step, proceeding."); } return null; }