auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean isUniqueAst(DetailAST ast) { boolean isOnly = true; final DetailAST identAst = ast.findFirstToken(TokenTypes.IDENT); if (identAst == null) { DetailAST cur; if (ast.getParent() == null) { cur = ast; while (cur.getPreviousSibling() != null) { cur = cur.getPreviousSibling(); } } else { cur = ast.getParent().getFirstChild(); } for (; cur != null; cur = cur.getNextSibling()) { if (cur != ast && cur.getType() == ast.getType()) { isOnly = false; break; } } } return isOnly; }

Target:
private static boolean isUniqueAst(DetailAST ast) { return ast.findFirstToken(TokenTypes.IDENT) != null || !hasAtLeastOneSiblingWithSameTokenType(ast); }
Source:
public void run() { for (int i = 0; i < getsPerThread; i++) { final Set<LongRange> rangeSet = partitionManager.getRangeSet(EVAL_ID, KEY); if (rangeSet == null) { continue; } for (final LongRange longRange : rangeSet) { } } countDownLatch.countDown(); }

Target:
public void run() { for (int i = 0; i < getsPerThread; i++) { final Set<LongRange> rangeSet = partitionManager.getRangeSet(EVAL_ID, DATA_TYPE); if (rangeSet == null) { continue; } for (final LongRange longRange : rangeSet) { longRange.getMinimumLong(); } } countDownLatch.countDown(); }
Source:
public void sphereBrush(Player player, LocalSession session, @Arg(desc = "The pattern of blocks to set") Pattern pattern, @Arg(desc = "The radius of the sphere", def = "2") double radius, @Switch(name = 'h', desc = "Create hollow spheres instead") boolean hollow) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setFill(pattern); tool.setSize(radius); if (hollow) { tool.setBrush(new HollowSphereBrush(), "worldedit.brush.sphere"); } else { tool.setBrush(new SphereBrush(), "worldedit.brush.sphere"); } player.printInfo(TranslatableComponent.of("worldedit.brush.sphere.equip", TextComponent.of((int) radius))); }

Target:
public void sphereBrush(Player player, LocalSession session, @Arg(desc = "The pattern of blocks to set") Pattern pattern, @Arg(desc = "The radius of the sphere", def = "2") double radius, @Switch(name = 'h', desc = "Create hollow spheres instead") boolean hollow) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setFill(pattern); tool.setSize(radius); if (hollow) { tool.setBrush(new HollowSphereBrush(), "worldedit.brush.sphere"); } else { tool.setBrush(new SphereBrush(), "worldedit.brush.sphere"); } player.printInfo(TranslatableComponent.of("worldedit.brush.sphere.equip", TextComponent.of(String.format("%.0f", radius)))); }
Source:
public void free() { logger.fine("Free ICE agent"); shutdown = true; if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); synchronized (terminationThreadSyncRoot) { if (terminationThread != null) { terminationThread.interrupt(); terminationThread = null; } } connCheckServer.stop(); IceProcessingState state = getState(); if (!IceProcessingState.FAILED.equals(state) && !IceProcessingState.TERMINATED.equals(state)) { terminate(IceProcessingState.TERMINATED); } boolean interrupted = false; logger.fine("remove streams"); for (IceMediaStream stream : getStreams()) { try { removeStream(stream); logger.fine("remove stream " + stream.getName()); } catch (Throwable t) { logger.fine( "remove stream " + stream.getName() + " failed: " + t); if (t instanceof InterruptedException) interrupted = true; else if (t instanceof ThreadDeath) throw (ThreadDeath) t; } } if (interrupted) Thread.currentThread().interrupt(); getStunStack().shutDown(); logger.fine("ICE agent freed"); }

Target:
public void free() { logger.fine("Free ICE agent"); shutdown = true; if (stunKeepAliveThread != null) stunKeepAliveThread.interrupt(); synchronized (terminationFutureSyncRoot) { if (terminationFuture != null) { terminationFuture.cancel(true); terminationFuture = null; } } connCheckServer.stop(); IceProcessingState state = getState(); if (!IceProcessingState.FAILED.equals(state) && !IceProcessingState.TERMINATED.equals(state)) { terminate(IceProcessingState.TERMINATED); } boolean interrupted = false; logger.fine("remove streams"); for (IceMediaStream stream : getStreams()) { try { removeStream(stream); logger.fine("remove stream " + stream.getName()); } catch (Throwable t) { logger.fine( "remove stream " + stream.getName() + " failed: " + t); if (t instanceof InterruptedException) interrupted = true; else if (t instanceof ThreadDeath) throw (ThreadDeath) t; } } if (interrupted) Thread.currentThread().interrupt(); getStunStack().shutDown(); logger.fine("ICE agent freed"); }
Source:
public NewsCard(@NonNull List<NewsItem> news, int age, @NonNull WikiSite wiki) { super(wiki); this.news = news; this.date = new UtcDate(age); this.wiki = wiki; }

Target:
public NewsCard(@NonNull List<NewsItem> news, int age, @NonNull WikiSite wiki) { super(wiki); this.news = news; this.date = new UtcDate(age); }
Source:
void invalidate(Object connection) { Reference<Object> connReference = new Reference<>(connection); lock.lock(); try { int count = getConnectionRefCount(connReference) - 1; ConnectionHandler<Object> connectionHandler = connections.get(connReference).getSecond(); if (count > 0) { connections.put(connReference, new Pair(count, connectionHandler)); return; } if (connectionHandler != null) { connectionHandler.invalidate(); } connections.remove(connReference); } finally { lock.unlock(); } }

Target:
void invalidate(Object connection) { decreaseConnectionReferenceCount(new Reference<>(connection), connHandler -> { if (connHandler != null) connHandler.invalidate(); }); }
Source:
public RefUpdate.Result modifyMessage(ChangeEdit edit, String msg) throws AuthException, InvalidChangeOperationException, IOException, UnchangedCommitMessage { checkState(!Strings.isNullOrEmpty(msg), "message cannot be null"); if (!currentUser.get().isIdentifiedUser()) { throw new AuthException("Authentication required"); } RevCommit prevEdit = edit.getEditCommit(); if (prevEdit.getParentCount() == 0) { throw new InvalidChangeOperationException( "Modify edit against root commit not supported"); } if (prevEdit.getFullMessage().equals(msg)) { throw new UnchangedCommitMessage( "New commit message cannot be same as existing commit message"); } IdentifiedUser me = (IdentifiedUser) currentUser.get(); Repository repo = gitManager.openRepository(edit.getChange().getProject()); try { RevWalk rw = new RevWalk(repo); ObjectInserter inserter = repo.newObjectInserter(); try { String refName = edit.getRefName(); ObjectId commit = createCommit(me, inserter, prevEdit, rw.parseCommit(prevEdit.getParent(0)), prevEdit.getTree(), msg); inserter.flush(); return update(repo, me, refName, rw, prevEdit, commit); } finally { rw.release(); inserter.release(); } } finally { repo.close(); } }

Target:
public RefUpdate.Result modifyMessage(ChangeEdit edit, String msg) throws AuthException, InvalidChangeOperationException, IOException, UnchangedCommitMessageException { checkState(!Strings.isNullOrEmpty(msg), "message cannot be null"); if (!currentUser.get().isIdentifiedUser()) { throw new AuthException("Authentication required"); } RevCommit prevEdit = edit.getEditCommit(); if (prevEdit.getParentCount() == 0) { throw new InvalidChangeOperationException( "Modify edit against root commit not supported"); } if (prevEdit.getFullMessage().equals(msg)) { throw new UnchangedCommitMessageException(); } IdentifiedUser me = (IdentifiedUser) currentUser.get(); Repository repo = gitManager.openRepository(edit.getChange().getProject()); try { RevWalk rw = new RevWalk(repo); ObjectInserter inserter = repo.newObjectInserter(); try { String refName = edit.getRefName(); ObjectId commit = createCommit(me, inserter, prevEdit, rw.parseCommit(prevEdit.getParent(0)), prevEdit.getTree(), msg); inserter.flush(); return update(repo, me, refName, rw, prevEdit, commit); } finally { rw.release(); inserter.release(); } } finally { repo.close(); } }
Source:
public @Nullable ChannelTypeUID getChannelTypeUID(ChannelUID channelUID) { if (!channelUID.isInGroup()) { for (ChannelDefinition channelDefinition : this.getChannelDefinitions()) { if (channelDefinition.getId().equals(channelUID.getId())) { return channelDefinition.getChannelTypeUID(); } } } else { List<ChannelGroupDefinition> channelGroupDefinitions = this.getChannelGroupDefinitions(); BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); @SuppressWarnings("rawtypes") ServiceReference ref = bundleContext.getServiceReference(ChannelTypeRegistry.class.getName()); ChannelTypeRegistry channelTypeRegistry = null; if (ref != null) { channelTypeRegistry = (ChannelTypeRegistry) bundleContext.getService(ref); } for (ChannelGroupDefinition channelGroupDefinition : channelGroupDefinitions) { if (channelGroupDefinition.getId().equals(channelUID.getGroupId())) { ChannelGroupType channelGroupType = null; if (channelTypeRegistry != null) { channelGroupType = channelTypeRegistry.getChannelGroupType(channelGroupDefinition.getTypeUID()); } if (channelGroupType != null) { for (ChannelDefinition channelDefinition : channelGroupType.getChannelDefinitions()) { if (channelDefinition.getId().equals(channelUID.getIdWithoutGroup())) { return channelDefinition.getChannelTypeUID(); } } } } } if (ref != null) { bundleContext.ungetService(ref); } } return null; }

Target:
public @Nullable ChannelTypeUID getChannelTypeUID(ChannelUID channelUID) { if (!channelUID.isInGroup()) { for (ChannelDefinition channelDefinition : this.getChannelDefinitions()) { if (channelDefinition.getId().equals(channelUID.getId())) { return channelDefinition.getChannelTypeUID(); } } } else { List<ChannelGroupDefinition> channelGroupDefinitions = this.getChannelGroupDefinitions(); BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); @SuppressWarnings("rawtypes") ServiceReference ref = bundleContext.getServiceReference(ChannelTypeRegistry.class.getName()); try { ChannelTypeRegistry channelTypeRegistry = null; if (ref != null) { channelTypeRegistry = (ChannelTypeRegistry) bundleContext.getService(ref); } for (ChannelGroupDefinition channelGroupDefinition : channelGroupDefinitions) { if (channelGroupDefinition.getId().equals(channelUID.getGroupId())) { ChannelGroupType channelGroupType = null; if (channelTypeRegistry != null) { channelGroupType = channelTypeRegistry .getChannelGroupType(channelGroupDefinition.getTypeUID()); } if (channelGroupType != null) { for (ChannelDefinition channelDefinition : channelGroupType.getChannelDefinitions()) { if (channelDefinition.getId().equals(channelUID.getIdWithoutGroup())) { return channelDefinition.getChannelTypeUID(); } } } } } } finally { if (ref != null) { bundleContext.ungetService(ref); } } } return null; }
Source:
public IndexedInts getRow() { return new IndexedInts() { @Override public int size() { return 1; } @Override public int get(int index) { return 0; } @Override public Iterator<Integer> iterator() { return Iterators.singletonIterator(0); } }; }

Target:
public IndexedInts getRow() { return SINGLETON; }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { List<Fragment> fragments; switch (requestCode) { case REQUEST_CODE_FOR_STARTED_VISIT: fragments = getSupportFragmentManager().getFragments(); recreateFragmentView(fragments.get(TabHost.VISITS_TAB_POS)); break; case REQUEST_CODE_FOR_VISIT: fragments = getSupportFragmentManager().getFragments(); recreateFragmentView(fragments.get(TabHost.VISITS_TAB_POS)); break; default: break; } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { List<Fragment> fragments; switch (requestCode) { case REQUEST_CODE_FOR_VISIT: fragments = getSupportFragmentManager().getFragments(); recreateFragmentView(fragments.get(TabHost.VISITS_TAB_POS)); break; default: break; } }
Source:
public void shouldCreateFileWithParamName() throws IOException, URISyntaxException { Path path = Files.createTempFile("temp", ".tmp"); path.toFile().deleteOnExit(); String fileName = path.getFileName().toString(); String uri = path.toUri().toString().replace(fileName, "[fileName]"); Config config = new Config("conf159", false, null, null, null, null, null, null, HttpMethod.GET, false, uri, false, null); configService.updateConfigs(Arrays.asList(config)); Map<String, String> params = new HashMap<>(); params.put("api_key", "qwerty123"); params.put("message_id", "123123"); params.put("channel", "ivr"); params.put("status_callback_url", "<LINK_0>"); params.put("subscribers", "[{\"phone\":\"48700123123\",\"language\":null}]"); List<String> result = new ArrayList<>(); for(Map.Entry<String, String> entry: params.entrySet()){ result.add(String.format("%s: %s", entry.getKey(), entry.getValue())); } params.put("fileName", fileName); outboundCallService.initiateCall(config.getName(), params); List<String> fileOutput = Files.readAllLines(path); assertTrue(fileOutput.containsAll(result)); }

Target:
public void shouldCreateFileWithParamName() throws IOException, URISyntaxException { Path path = Files.createTempFile("temp", ".tmp"); path.toFile().deleteOnExit(); String fileName = path.getFileName().toString(); String uri = path.toUri().toString().replace(fileName, "[fileName]"); Config config = new Config("conf159", false, null, null, null, null, null, null, HttpMethod.GET, false, uri, false, null); configService.updateConfigs(Arrays.asList(config)); Map<String, String> params = new HashMap<>(); params.put("api_key", "qwerty123"); params.put("message_id", "123123"); params.put("channel", "ivr"); params.put("status_callback_url", "<LINK_0>"); params.put("subscribers", "[{\"phone\":\"48700123123\",\"language\":null}]"); List<String> result = new ArrayList<>(); for(Map.Entry<String, String> entry: params.entrySet()){ result.add(String.format("%s: %s", entry.getKey(), entry.getValue())); } params.put("fileName", fileName); String fileNameParam = String.format("%s: %s", "fileName", fileName); outboundCallService.initiateCall(config.getName(), params); List<String> fileOutput = Files.readAllLines(path); assertTrue(fileOutput.containsAll(result)); assertTrue(!fileOutput.contains(fileNameParam)); }
Source:
public boolean incrementToken() throws IOException { if (!input.incrementToken()) { return false; } String thisToken = termAtt.toString(); if (thisToken.length() == 1 && Character.isHighSurrogate(termAtt.buffer()[0])) { char highSurrogate = termAtt.buffer()[0]; int highSurrogateStart = offsetAtt.startOffset(); if (!input.incrementToken()) { return true; } thisToken = termAtt.toString(); if (thisToken.length() == 1 && Character.isLowSurrogate(termAtt.buffer()[0])) { termAtt.setEmpty(); termAtt.append(highSurrogate).append(thisToken); offsetAtt.setOffset(highSurrogateStart, offsetAtt.endOffset()); posIncr.setPositionIncrement(1); } } return true; }

Target:
public boolean incrementToken() throws IOException { if (!input.incrementToken()) { return false; } if (termAtt.length() == 1) { while (lowSurrogateCheck(termAtt)) { if (!input.incrementToken()) { return false; } } char highSurrogate = 0; int highSurrogateStart = 0; int highSurrogatePosIncr = 0; while (highSurrogateCheck(termAtt)) { highSurrogate = termAtt.buffer()[0]; highSurrogateStart = offsetAtt.startOffset(); highSurrogatePosIncr = posIncr.getPositionIncrement(); if (!input.incrementToken()) { return false; } } if (lowSurrogateCheck(termAtt)) { char thisToken = termAtt.buffer()[0]; termAtt.setEmpty(); termAtt.append(highSurrogate).append(thisToken); offsetAtt.setOffset(highSurrogateStart, offsetAtt.endOffset()); posIncr.setPositionIncrement(highSurrogatePosIncr); } } return true; }
Source:
protected HiveMetaStoreClient createClient() throws Exception { boolean gotException = false; MetastoreConf.setVar(conf, ConfVars.THRIFT_URIS, "thrift://localhost:" + port); MetastoreConf.setBoolVar(conf, ConfVars.METASTORE_CLIENT_USE_PLAIN_AUTH, true); String tmpDir = System.getProperty("build.dir"); String credentialsPath = "jceks://file" + tmpDir + "/test-classes/creds/hms_plain_auth_test.jceks"; conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, credentialsPath); try { MetastoreConf.setVar(conf, ConfVars.METASTORE_CLIENT_PLAIN_USERNAME, wrongUser); HiveMetaStoreClient tmpClient = new HiveMetaStoreClient(conf); } catch (Exception e) { gotException = true; } Assert.assertTrue(gotException); MetastoreConf.setVar(conf, ConfVars.METASTORE_CLIENT_PLAIN_USERNAME, correctUser); return new HiveMetaStoreClient(conf); }

Target:
protected HiveMetaStoreClient createClient() throws Exception { MetastoreConf.setVar(conf, ConfVars.THRIFT_URIS, "thrift://localhost:" + port); MetastoreConf.setVar(conf, ConfVars.METASTORE_CLIENT_AUTH_MODE, "PLAIN"); String credsCUWP = createCredFile(correctUser, wrongPassword); conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, credsCUWP); String exceptionMessage = null; try { MetastoreConf.setVar(conf, ConfVars.METASTORE_CLIENT_PLAIN_USERNAME, correctUser); HiveMetaStoreClient tmpClient = new HiveMetaStoreClient(conf); } catch (MetaException e) { exceptionMessage = e.getMessage(); } Assert.assertNotNull(exceptionMessage); Assert.assertTrue(exceptionMessage.contains("Error validating the login")); exceptionMessage = null; try { MetastoreConf.setVar(conf, ConfVars.METASTORE_CLIENT_PLAIN_USERNAME, wrongUser); HiveMetaStoreClient tmpClient = new HiveMetaStoreClient(conf); } catch (MetaException e) { exceptionMessage = e.getMessage(); } Assert.assertNotNull(exceptionMessage); Assert.assertTrue(exceptionMessage.contains("No password found for user")); exceptionMessage = null; String credsWUWP = createCredFile(wrongUser, wrongPassword); conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, credsWUWP); try { MetastoreConf.setVar(conf, ConfVars.METASTORE_CLIENT_PLAIN_USERNAME, wrongUser); HiveMetaStoreClient tmpClient = new HiveMetaStoreClient(conf); } catch (MetaException e) { exceptionMessage = e.getMessage(); } Assert.assertNotNull(exceptionMessage); Assert.assertTrue(exceptionMessage.contains("Error validating the login")); String credsCUCP = createCredFile(correctUser, correctPassword); conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, credsCUCP); MetastoreConf.setVar(conf, ConfVars.METASTORE_CLIENT_PLAIN_USERNAME, correctUser); return new HiveMetaStoreClient(conf); }
Source:
private void validateUser(User user) throws BadRequestException, NotFoundException, InternalServerErrorException { if (user == null || user.getUserId() == null || user.getUserId().isEmpty()) { throw new BadRequestException(ValidationMessageEnums.USER_GOOGLE_ENDPOINT_NULL.message()); } final TechGalleryUser techUser = getUserByGoogleId(user.getUserId()); if (techUser == null) { throw new NotFoundException(ValidationMessageEnums.USER_NOT_EXIST.message()); } }

Target:
public TechGalleryUser validateUser(User user) throws BadRequestException, NotFoundException, InternalServerErrorException { if (user == null || user.getUserId() == null || user.getUserId().isEmpty()) { throw new BadRequestException(ValidationMessageEnums.USER_GOOGLE_ENDPOINT_NULL.message()); } final TechGalleryUser techUser = getUserByGoogleId(user.getUserId()); if (techUser == null) { throw new NotFoundException(ValidationMessageEnums.USER_NOT_EXIST.message()); } return techUser; }
Source:
public void screencastFrameAck(JsonRpcPeer peer, JSONObject params) { LogUtil.i("screencastFrameAck()"); }

Target:
public void screencastFrameAck(JsonRpcPeer peer, JSONObject params) { }
Source:
public void switchUserWhenUsernameIsMissingThenThrowException() { final MockServerWebExchange exchange = MockServerWebExchange .from(MockServerHttpRequest.post("/login/impersonate")); final WebFilterChain chain = mock(WebFilterChain.class); final SecurityContextImpl securityContext = new SecurityContextImpl(mock(Authentication.class)); assertThatIllegalArgumentException() .isThrownBy(() -> this.switchUserWebFilter.filter(exchange, chain) .subscriberContext( ReactiveSecurityContextHolder.withSecurityContext(Mono.just(securityContext))) .block()) .withMessage("The userName can not be null."); verifyNoInteractions(chain); }

Target:
public void switchUserWhenUsernameIsMissingThenThrowException() { final MockServerWebExchange exchange = MockServerWebExchange .from(MockServerHttpRequest.post("/login/impersonate")); final WebFilterChain chain = mock(WebFilterChain.class); final SecurityContextImpl securityContext = new SecurityContextImpl(mock(Authentication.class)); assertThatIllegalArgumentException().isThrownBy(() -> { Context securityContextHolder = ReactiveSecurityContextHolder .withSecurityContext(Mono.just(securityContext)); this.switchUserWebFilter.filter(exchange, chain).subscriberContext(securityContextHolder).block(); }).withMessage("The userName can not be null."); verifyNoInteractions(chain); }
Source:
public void invalidUrlIsNotSavedOnConvertedAlert() { int feedId = 1; HealthMapAlert healthMapAlert = mock(HealthMapAlert.class); when(healthMapAlert.getFeedId()).thenReturn(feedId); when(healthMapAlert.getOriginalUrl()).thenReturn("invalid/url.com"); HealthMapLookupData lookupData = mock(HealthMapLookupData.class); HashMap<Integer, Feed> feedMap = new HashMap<>(); feedMap.put(feedId, new Feed("Test feed", null, 0, "zh", 1)); when(lookupData.getFeedMap()).thenReturn(feedMap); HealthMapAlertConverter alertConverter = new HealthMapAlertConverter( mock(AlertService.class), mock(DiseaseService.class), mock(EmailService.class), lookupData); DiseaseOccurrence occurrence = alertConverter.convert(healthMapAlert, mock(Location.class)); Alert newAlert = occurrence.getAlert(); assertThat(newAlert).isNotNull(); assertThat(newAlert.getUrl()).isNull(); }

Target:
public void invalidUrlIsNotSavedOnConvertedAlert() { testInvalidUrl("/invalid/url.com"); testInvalidUrl("article.aspx?articleNO=21162&?????? 10 ?????? ????? ??\"??????\" ?29 ???? ?????? ??? ????? ??? ????? ?????-21162"); testInvalidUrl("gx.php?id=XX_ALERT_ID_XX&t=Single+Patient+Report+from+the+GeoSentinel+Surveillance+Network"); testInvalidUrl("onm.php?id=XX_ALERT_ID_XX<LINK_0>"); testInvalidUrl("www.phac-aspc.gc.ca/phn-asp/2013/measles-0325-eng.php"); testInvalidUrl("file://www.phac-aspc.gc.ca/phn-asp/2013/measles-0325-eng.php"); testInvalidUrl("scp://www.phac-aspc.gc.ca/phn-asp/2013/measles-0325-eng.php"); testInvalidUrl("ftp://www.phac-aspc.gc.ca/phn-asp/2013/measles-0325-eng.php"); testInvalidUrl("ssh://www.phac-aspc.gc.ca/phn-asp/2013/measles-0325-eng.php"); testInvalidUrl("smb://www.phac-aspc.gc.ca/phn-asp/2013/measles-0325-eng.php"); }
Source:
public void testDepth() { DataCenter dataCenter = createDataCenter(); for (int i = 1; i <= 5; ++i) { dataCenter = getDataCenter(dataCenter.id(), new DepthOptions().depth(i)); assertNotNull(dataCenter); } deleteDataCenter(dataCenter.id()); }

Target:
public void testDepth() { DataCenter dataCenter = createDataCenter(); for (int i = 1; i <= 5; ++i) { dataCenter = getDataCenter(dataCenter.id(), new DepthOptions().depth(i)); assertNotNull(dataCenter); switch(i) { case 1: assertNotNull(dataCenter.entities()); assertNotNull(dataCenter.entities().servers().items()); assertNotNull(dataCenter.entities().volumes().items()); assertNotNull(dataCenter.entities().loadbalancers().items()); assertNotNull(dataCenter.entities().lans().items()); break; } } deleteDataCenter(dataCenter.id()); }
Source:
public void addSessionFactory(String key, SessionFactory<F> factory) { this.factories.put(key, factory); }

Target:
public void addSessionFactory(String key, SessionFactory<F> factory) { addSessionFactory((Object) key, factory); }
Source:
protected Collection<String> getTableDefinitions() { return Collections.singleton( "CREATE TABLE test (" + " k int," + " c1 'DynamicCompositeType(s => UTF8Type, i => Int32Type)'," + " c2 'ReversedType(CompositeType(UTF8Type, Int32Type))'," + " c3 'ListType(Int32Type)'," + " PRIMARY KEY (k, c1, c2)" + ")" ); }

Target:
protected Collection<String> getTableDefinitions() { return Collections.singleton( "CREATE TABLE test (" + " k int," + " c1 'DynamicCompositeType(s => UTF8Type, i => Int32Type)'," + " c2 'ReversedType(CompositeType(UTF8Type, Int32Type))'," + " c3 'Int32Type'," + " PRIMARY KEY (k, c1, c2)" + ") WITH COMPACT STORAGE" ); }
Source:
public List<CellWithTimestamp> getTimestampsWithinRow( TableReference tableRef, byte[] row, byte[] startColumnInclusive, long startTimestampExclusive, int limit) { long invertedTimestamp = ~startTimestampExclusive; CqlQuery query = new CqlQuery( "SELECT column1, column2 FROM %s WHERE key = %s AND (column1, column2) > (%s, %s) LIMIT %s;", quotedTableName(tableRef), key(row), column1(startColumnInclusive), column2(invertedTimestamp), limit(limit)); return query.executeAndGetCells(row, result -> getCellForColumn1Column2(result, row)); }

Target:
public List<CellWithTimestamp> getTimestampsWithinRow( TableReference tableRef, byte[] row, byte[] startColumnInclusive, long startTimestampExclusive, int limit) { long invertedTimestamp = ~startTimestampExclusive; CqlQuery query = new CqlQuery( "SELECT column1, column2 FROM %s WHERE key = %s AND (column1, column2) > (%s, %s) LIMIT %s;", quotedTableName(tableRef), key(row), column1(startColumnInclusive), column2(invertedTimestamp), limit(limit)); return query.executeAndGetCells(row, result -> getCellFromKeylessRow(result, row)); }
Source:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_ENTITYLESS_ATTR_DEF); attr.setFriendlyName("namespace_GIDRanges"); attr.setDisplayName("GID ranges in namespace"); attr.setType(List.class.getName()); attr.setDescription("Manageable GID ranges in namespace."); return attr; }

Target:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_ENTITYLESS_ATTR_DEF); attr.setFriendlyName("namespace_GIDRanges"); attr.setDisplayName("GID ranges in namespace"); attr.setType(LinkedHashMap.class.getName()); attr.setDescription("Manageable GID ranges in a namespace - key of map is minimum and assigned value is maximum of one range, minimum and maximum can be equal"); return attr; }
Source:
protected void executeCommand() { AuthenticationProfile profile = sessionDataContainer.getProfile(getParameters().getSessionId()); if (profile == null) { setSucceeded(false); } else { sessionId = getParameters().getSessionId(); sourceIp = sessionDataContainer.getSourceIp(getParameters().getSessionId()); sessionDataContainer.setSessionValid(getParameters().getSessionId(), false); setSucceeded(true); } }

Target:
protected void executeCommand() { AuthenticationProfile profile = sessionDataContainer.getProfile(getParameters().getSessionId()); sessionId = getParameters().getSessionId(); sourceIp = sessionDataContainer.getSourceIp(getParameters().getSessionId()); if (profile == null) { setSucceeded(false); } else { sessionDataContainer.setSessionValid(getParameters().getSessionId(), false); setSucceeded(true); } }
Source:
void onItemSelected(int position) { if (mAnimationEnabledCheckBox.isChecked()) { if (mDurationList.get(position) == 0) { mExpandableAdapter.setParentClickableViewAnimationDuration(-1); } else { mExpandableAdapter.setParentClickableViewAnimationDuration(mDurationList.get(position)); } } else { mExpandableAdapter.setParentClickableViewAnimationDuration(mDurationList.get(position)); } mExpandableAdapter.notifyDataSetChanged(); }

Target:
void onItemSelected(int position) { if (mAnimationEnabledCheckBox.isChecked()) { if (mDurationList.get(position) == 0) { mExpandableAdapter.setParentClickableViewAnimationDuration( mExpandableAdapter.CUSTOM_ANIMATION_DURATION_NOT_SET); } else { mExpandableAdapter.setParentClickableViewAnimationDuration(mDurationList.get(position)); } mExpandableAdapter.setParentAndIconExpandOnClick(false); } else { if (mDurationList.get(position) == 0) { mExpandableAdapter.setParentClickableViewAnimationDuration( mExpandableAdapter.CUSTOM_ANIMATION_DURATION_NOT_SET); mExpandableAdapter.setParentAndIconExpandOnClick(false); } else { mExpandableAdapter.setParentClickableViewAnimationDuration(mDurationList.get(position)); mExpandableAdapter.setCustomParentAnimationViewId(R.id.recycler_item_arrow_parent); mExpandableAdapter.setParentAndIconExpandOnClick(true); } } mExpandableAdapter.notifyDataSetChanged(); }
Source:
public static Alias getNewFilmAlias(String id) { return new Alias(NEW_PA_BASE_ALIAS + "prog_id", id); }

Target:
public static Alias getNewFilmAlias(String id) { return new Alias(PA_BASE_ALIAS_V2 + "prog_id", id); }
Source:
private IStatus updateElements(IWorkingSet[] workingSets, IProgressMonitor monitor) { try { if(isDisposed.get() || monitor.isCanceled()) { return Status.CANCEL_STATUS; } IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); IJavaModel model= JavaCore.create(root); List<IAdaptable> testResult= new ArrayList<>(); List<IAdaptable> mainResult= new ArrayList<>(); IJavaProject[] jProjects= model.getJavaProjects(); for (int i= 0; i < jProjects.length; i++) { if (monitor.isCanceled() || isDisposed.get()) return Status.CANCEL_STATUS; final IJavaProject project= jProjects[i]; if (project.getProject().isOpen()) { for (IPackageFragmentRoot iPackageFragmentRoot : project.getPackageFragmentRoots()) { IClasspathEntry classpathEntry= iPackageFragmentRoot.getRawClasspathEntry(); if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { if (classpathEntry.isTest()) { testResult.add(iPackageFragmentRoot); } else { mainResult.add(iPackageFragmentRoot); } } } } } IAdaptable[] testArray= testResult.toArray(new IAdaptable[testResult.size()]); IAdaptable[] productionArray= mainResult.toArray(new IAdaptable[mainResult.size()]); if (PlatformUI.isWorkbenchRunning()) { final Display display= PlatformUI.getWorkbench().getDisplay(); if (!display.isDisposed()) { fUpdateUIJob.setTask(() -> { for (IWorkingSet w : workingSets) { if (MAIN_NAME.equals(w.getName())) { w.setElements(productionArray); } else if (TEST_NAME.equals(w.getName())) { w.setElements(testArray); } } }); } } } catch (Exception e) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; }

Target:
private IStatus updateElements(IWorkingSet[] workingSets, IProgressMonitor monitor) { try { if(isDisposed.get()) { return Status.CANCEL_STATUS; } IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); IJavaModel model= JavaCore.create(root); List<IAdaptable> testResult= new ArrayList<>(); List<IAdaptable> mainResult= new ArrayList<>(); IJavaProject[] jProjects= model.getJavaProjects(); for (int i= 0; i < jProjects.length; i++) { if (monitor.isCanceled() || isDisposed.get()) return Status.CANCEL_STATUS; final IJavaProject project= jProjects[i]; if (project.getProject().isOpen()) { for (IPackageFragmentRoot iPackageFragmentRoot : project.getPackageFragmentRoots()) { IClasspathEntry classpathEntry= iPackageFragmentRoot.getRawClasspathEntry(); if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { if (classpathEntry.isTest()) { testResult.add(iPackageFragmentRoot); } else { mainResult.add(iPackageFragmentRoot); } } } } } IAdaptable[] testArray= testResult.toArray(new IAdaptable[testResult.size()]); IAdaptable[] productionArray= mainResult.toArray(new IAdaptable[mainResult.size()]); if (PlatformUI.isWorkbenchRunning()) { final Display display= PlatformUI.getWorkbench().getDisplay(); if (!display.isDisposed()) { display.asyncExec(() -> { for (IWorkingSet w : workingSets) { if (MAIN_NAME.equals(w.getName())) { w.setElements(productionArray); } else if (TEST_NAME.equals(w.getName())) { w.setElements(testArray); } } }); } } } catch (Exception e) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; }
Source:
LocalSymbolTableImports(List<SymbolTable> importTables) { int importTablesSize = importTables.size(); myImports = new SymbolTable[importTablesSize]; for(int i = 0; i < importTables.size(); i++) { SymbolTable symbolTable = importTables.get(i); if(symbolTable.isLocalTable()) { myImports[i] = LocalSymbolTableImportAdapter.of((LocalSymbolTable) symbolTable); } else { myImports[i] = symbolTable; } } myBaseSids = new int[importTablesSize]; myMaxId = prepBaseSids(myBaseSids, myImports); }

Target:
LocalSymbolTableImports(List<SymbolTable> importTables) { validateImports(importTables); int importTablesSize = importTables.size(); myImports = new SymbolTable[importTablesSize]; for(int i = 0; i < importTables.size(); i++) { SymbolTable symbolTable = importTables.get(i); if(symbolTable.isLocalTable()) { myImports[i] = LocalSymbolTableImportAdapter.of((LocalSymbolTable) symbolTable); } else { myImports[i] = symbolTable; } } myBaseSids = new int[importTablesSize]; myMaxId = prepBaseSids(myBaseSids, myImports); }
Source:
static <E extends Enum<E>> Gen<E> choose(Class<E> clazz) { return random -> Gen.choose(clazz.getEnumConstants()).apply(random); }

Target:
static <E extends Enum<E>> Gen<E> choose(Class<E> clazz) { Objects.requireNonNull(clazz, "clazz is null"); return random -> Gen.choose(clazz.getEnumConstants()).apply(random); }
Source:
private Object[] createDataProviders(SpockExecutionContext context) { if (context.getErrorInfoCollector().hasErrors()) { return null; } List<DataProviderInfo> dataProviderInfos = context.getCurrentFeature().getDataProviders(); Object[] dataProviders = new Object[dataProviderInfos.size()]; if (!dataProviderInfos.isEmpty()) { for (int i = 0; i < dataProviderInfos.size(); i++) { DataProviderInfo dataProviderInfo = dataProviderInfos.get(i); MethodInfo method = dataProviderInfo.getDataProviderMethod(); List<String> dataProviderVariables = dataProviderInfos .stream() .map(DataProviderInfo::getDataVariables) .flatMap(List::stream) .collect(toList()); List<Object> arguments = new ArrayList<>(); outerLoop: for (String previousDataTableVariable : dataProviderInfo.getPreviousDataTableVariables()) { for (int j = 0; j < dataProviderVariables.size(); j++) { String dataProviderVariable = dataProviderVariables.get(j); if (previousDataTableVariable.equals(dataProviderVariable)) { arguments.add(dataProviders[j]); continue outerLoop; } } throw new IllegalStateException(String.format("Variable name not defined (%s not in %s)!", previousDataTableVariable, dataProviderVariables)); } Object provider = invokeRaw(context, context.getCurrentInstance(), method, arguments.toArray()); if (context.getErrorInfoCollector().hasErrors()) { return null; } else if (provider == null) { SpockExecutionException error = new SpockExecutionException("Data provider is null!"); supervisor.error(context.getErrorInfoCollector(), new ErrorInfo(method, error)); return null; } dataProviders[i] = provider; } } return dataProviders; }

Target:
private Object[] createDataProviders(SpockExecutionContext context) { if (context.getErrorInfoCollector().hasErrors()) { return null; } List<DataProviderInfo> dataProviderInfos = context.getCurrentFeature().getDataProviders(); if (dataProviderInfos.isEmpty()) { return new Object[0]; } List<String> dataProviderVariables = dataProviderInfos .stream() .map(DataProviderInfo::getDataVariables) .flatMap(List::stream) .collect(toList()); Object[] dataProviders = new Object[dataProviderInfos.size()]; for (int i = 0, size = dataProviderInfos.size(); i < size; i++) { DataProviderInfo dataProviderInfo = dataProviderInfos.get(i); MethodInfo method = dataProviderInfo.getDataProviderMethod(); Object provider = invokeRaw( context, context.getCurrentInstance(), method, getPreviousDataTableProviders(dataProviderVariables, dataProviders, dataProviderInfo)); if (context.getErrorInfoCollector().hasErrors()) { if (provider != null) { dataProviders[i] = provider; } break; } else if (provider == null) { SpockExecutionException error = new SpockExecutionException("Data provider is null!"); supervisor.error(context.getErrorInfoCollector(), new ErrorInfo(method, error)); break; } dataProviders[i] = provider; } return dataProviders; }
Source:
private void persistProject(final Project project, final FlowLoader loader, final File archive, final User uploader) throws ProjectManagerException { synchronized (project) { final int newVersion = this.projectLoader.getLatestProjectVersion(project) + 1; final Map<String, Flow> flows = loader.getFlowMap(); for (final Flow flow : flows.values()) { flow.setProjectId(project.getId()); flow.setVersion(newVersion); } this.storageManager.uploadProject(project, newVersion, archive, uploader); log.info("Uploading flow to db " + archive.getName()); this.projectLoader.uploadFlows(project, newVersion, flows.values()); log.info("Changing project versions " + archive.getName()); this.projectLoader.changeProjectVersion(project, newVersion, uploader.getUserId()); project.setFlows(flows); if (loader instanceof DirectoryFlowLoader) { final DirectoryFlowLoader directoryFlowLoader = (DirectoryFlowLoader) loader; log.info("Uploading Job properties"); this.projectLoader.uploadProjectProperties(project, new ArrayList<>( directoryFlowLoader.getJobPropsMap().values())); log.info("Uploading Props properties"); this.projectLoader.uploadProjectProperties(project, directoryFlowLoader.getPropsList()); } else if (loader instanceof DirectoryYamlFlowLoader) { } else { throw new ProjectManagerException("Invalid type of flow loader."); } this.projectLoader.postEvent(project, EventType.UPLOADED, uploader.getUserId(), "Uploaded project files zip " + archive.getName()); } }

Target:
private void persistProject(final Project project, final FlowLoader loader, final File archive, final User uploader) throws ProjectManagerException { synchronized (project) { final int newVersion = this.projectLoader.getLatestProjectVersion(project) + 1; final Map<String, Flow> flows = loader.getFlowMap(); for (final Flow flow : flows.values()) { flow.setProjectId(project.getId()); flow.setVersion(newVersion); } this.storageManager.uploadProject(project, newVersion, archive, uploader); log.info("Uploading flow to db for project " + archive.getName()); this.projectLoader.uploadFlows(project, newVersion, flows.values()); log.info("Changing project versions for project " + archive.getName()); this.projectLoader.changeProjectVersion(project, newVersion, uploader.getUserId()); project.setFlows(flows); if (loader instanceof DirectoryFlowLoader) { final DirectoryFlowLoader directoryFlowLoader = (DirectoryFlowLoader) loader; log.info("Uploading Job properties"); this.projectLoader.uploadProjectProperties(project, new ArrayList<>( directoryFlowLoader.getJobPropsMap().values())); log.info("Uploading Props properties"); this.projectLoader.uploadProjectProperties(project, directoryFlowLoader.getPropsList()); } else if (loader instanceof DirectoryYamlFlowLoader) { } else { throw new ProjectManagerException("Invalid type of flow loader."); } this.projectLoader.postEvent(project, EventType.UPLOADED, uploader.getUserId(), "Uploaded project files zip " + archive.getName()); } }
Source:
public void normalize(CertifiedProductSearchDetails listing) { if (listing.getCertificationResults() != null && listing.getCertificationResults().size() > 0) { listing.getCertificationResults().stream() .forEach(certResult -> lookupTestProcedureIds(certResult.getCriterion(), certResult.getTestProcedures())); } }

Target:
public void normalize(CertifiedProductSearchDetails listing) { if (listing.getCertificationResults() != null && listing.getCertificationResults().size() > 0) { listing.getCertificationResults().stream() .forEach(certResult -> populateTestProcedureIds(certResult.getCriterion(), certResult.getTestProcedures())); } }
Source:
public FoundViewHolder getFoundViewHolder(JFieldRef idRef, AbstractJClass viewClass) { String idRefString = idRef.name(); FoundViewHolder foundViewHolder = (FoundViewHolder) foundHolders.get(idRefString); if (foundViewHolder == null) { foundViewHolder = createFoundViewAndIfNotNullBlock(idRef, viewClass); foundHolders.put(idRefString, foundViewHolder); } return foundViewHolder; }

Target:
public FoundViewHolder getFoundViewHolder(JFieldRef idRef, AbstractJClass viewClass) { return getFoundViewHolder(idRef, viewClass, null); }
Source:
public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { if (c.getEnvironment().getRegion().getRegionInfo().getTable().isSystemTable()) { return; } for (int i = 0; i < miniBatchOp.size(); i++) { Mutation m = miniBatchOp.getOperation(i); if (!(m instanceof Delete)) { continue; } byte[] sourceOpAttr = m.getAttribute(TEST_ATTR); if (sourceOpAttr == null) { continue; } Tag sourceOpTag = new ArrayBackedTag(TEST_TAG_TYPE, sourceOpAttr); List<Cell> updatedCells = new ArrayList<>(); for (CellScanner cellScanner = m.cellScanner(); cellScanner.advance(); ) { Cell cell = cellScanner.current(); List<Tag> tags = PrivateCellUtil.getTags(cell); tags.add(sourceOpTag); Cell updatedCell = PrivateCellUtil.createCell(cell, tags); updatedCells.add(updatedCell); } m.getFamilyCellMap().clear(); for (Cell cell : updatedCells) { if (m instanceof Delete) { Delete d = (Delete) m; d.add(cell); } } } }

Target:
public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException { if (c.getEnvironment().getRegion().getRegionInfo().getTable().isSystemTable()) { return; } for (int i = 0; i < miniBatchOp.size(); i++) { Mutation m = miniBatchOp.getOperation(i); if (!(m instanceof Delete)) { continue; } byte[] sourceOpAttr = m.getAttribute(TEST_ATTR); if (sourceOpAttr == null) { continue; } Tag sourceOpTag = new ArrayBackedTag(TEST_TAG_TYPE, sourceOpAttr); List<Cell> updatedCells = new ArrayList<>(); for (CellScanner cellScanner = m.cellScanner(); cellScanner.advance(); ) { Cell cell = cellScanner.current(); List<Tag> tags = PrivateCellUtil.getTags(cell); tags.add(sourceOpTag); Cell updatedCell = PrivateCellUtil.createCell(cell, tags); updatedCells.add(updatedCell); } m.getFamilyCellMap().clear(); for (Cell cell : updatedCells) { Delete d = (Delete) m; d.add(cell); } } }
Source:
public void methodInterceptorShouldBeRunOnceWhenCustomisedListenerImplementsITestListenerAndIMethodInterceptor() { TestNG tng = create(LSampleTest.class); InterceptorInvokeTwiceSimulateListener interceptor = new InterceptorInvokeTwiceSimulateListener(); tng.addListener((ITestNGListener) interceptor); tng.run(); Assert.assertEquals(interceptor.getCount(), 1); }

Target:
public void methodInterceptorShouldBeRunOnceWhenCustomisedListenerImplementsITestListenerAndIMethodInterceptor() { TestNG tng = create(LSampleTest.class); InterceptorInvokeTwiceSimulateListener interceptor = new InterceptorInvokeTwiceSimulateListener(); tng.addListener(interceptor); tng.run(); Assert.assertEquals(interceptor.getCount(), 1); }
Source:
public BaseStation(String port, int baud, SerialEventWorker sew) { bindingEventWorker = sew; serialDevice = new SerialDevice(port, baud); serialDevice.setEventWorker(this); try { serialDevice.initialize(); } catch (InitializationException e) { e.printStackTrace(); } }

Target:
public BaseStation(String port, int baud, SerialEventWorker sew) { bindingEventWorker = sew; serialDevice = new SerialDevice(port, baud); serialDevice.setEventWorker(this); try { serialDevice.initialize(); } catch (InitializationException e) { logger.error("Port cannot be opened. Port: {}", port); logger.error("initialization exception", e); } }
Source:
public void testSearchAgreement() throws PayPalRESTException { Date startDate = new GregorianCalendar(2014, 10, 1).getTime(); Date endDate = new GregorianCalendar(2014, 10, 14).getTime(); AgreementTransactions transactions = Agreement.transactions(SANDBOXCONTEXTBILLING, "I-9STXMKR58UNN", startDate, endDate); Assert.assertNotNull(transactions); Assert.assertNotNull(transactions.getAgreementTransactionList()); }

Target:
public void testSearchAgreement() throws PayPalRESTException { Date startDate = new GregorianCalendar(2014, 10, 1).getTime(); Date endDate = new GregorianCalendar(2014, 10, 14).getTime(); AgreementTransactions transactions = Agreement.transactions(TestConstants.SANDBOX_CONTEXT, "I-9STXMKR58UNN", startDate, endDate); Assert.assertNotNull(transactions); Assert.assertNotNull(transactions.getAgreementTransactionList()); }
Source:
public Response getNoteParagraphJobStatus(@PathParam("noteId") String noteId, @PathParam("paragraphId") String paragraphId) throws IOException, IllegalArgumentException { LOG.info("get notebook paragraph job status."); Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } Paragraph paragraph = note.getParagraph(paragraphId); if (paragraph == null) { return new JsonResponse<>(Status.NOT_FOUND, "paragraph not found.").build(); } return new JsonResponse<>(Status.OK, null, note.generateSingleParagraphInfo(paragraphId)). build(); }

Target:
public Response getNoteParagraphJobStatus(@PathParam("noteId") String noteId, @PathParam("paragraphId") String paragraphId) throws IOException, IllegalArgumentException { LOG.info("get note paragraph job status."); Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } Paragraph paragraph = note.getParagraph(paragraphId); if (paragraph == null) { return new JsonResponse<>(Status.NOT_FOUND, "paragraph not found.").build(); } return new JsonResponse<>(Status.OK, null, note.generateSingleParagraphInfo(paragraphId)). build(); }
Source:
public void serve() throws TException { Dispatcher dispatcher = conn.createDispatcher(newRequestHandler()); for (String subject : subjects) { if (queue != null && !queue.isEmpty()) { dispatcher.subscribe(subject, queue); } else { dispatcher.subscribe(subject); } } LOGGER.info("Frugal server running..."); partiesAwaitingFullShutdown.register(); try { boolean shutdownSignalReceived = false; try { shutdownSignal.await(); shutdownSignalReceived = true; } catch (InterruptedException ignored) { } LOGGER.info("Frugal server stopping..."); for (String subject : subjects) { try { dispatcher.unsubscribe(subject); } catch (IllegalStateException e) { LOGGER.warn("Frugal server failed to unsubscribe from " + subject + ": " + e .getMessage()); } } conn.closeDispatcher(dispatcher); if (shutdownSignalReceived) { partiesAwaitingFullShutdown.arriveAndAwaitAdvance(); partiesAwaitingFullShutdown.arriveAndAwaitAdvance(); } } finally { partiesAwaitingFullShutdown.arriveAndDeregister(); } }

Target:
public void serve() throws TException { Dispatcher dispatcher = conn.createDispatcher(newRequestHandler()); for (String subject : subjects) { if (queue != null && !queue.isEmpty()) { dispatcher.subscribe(subject, queue); } else { dispatcher.subscribe(subject); } } LOGGER.info("Frugal server running..."); partiesAwaitingFullShutdown.register(); try { boolean shutdownSignalReceived; try { shutdownSignal.await(); shutdownSignalReceived = true; } catch (InterruptedException ignored) { shutdownSignalReceived = false; } LOGGER.info("Frugal server stopping..."); conn.closeDispatcher(dispatcher); if (shutdownSignalReceived) { partiesAwaitingFullShutdown.arriveAndAwaitAdvance(); partiesAwaitingFullShutdown.arriveAndAwaitAdvance(); } } finally { partiesAwaitingFullShutdown.arriveAndDeregister(); } }
Source:
static public void importTreeData( TreeReader parser, Project project, String[] recordPath, ImportColumnGroup rootColumnGroup, int limit, ImportParameters parameters ) throws ImportingParserException{ if (logger.isTraceEnabled()) { logger.trace("importTreeData(TreeReader, Project, String[], ImportColumnGroup)"); } try { while (parser.hasNext()) { Token eventType = parser.next(); if (eventType == Token.StartEntity) { findRecord(project, parser, recordPath, 0, rootColumnGroup, limit--,parameters); } } } catch (TreeReaderException e) { logger.error("Exception from XML parse",e); throw new ImportingParserException(((JsonParseException)e.getCause()).getOriginalMessage()); } }

Target:
static public void importTreeData( TreeReader parser, Project project, String[] recordPath, ImportColumnGroup rootColumnGroup, int limit, ImportParameters parameters ) throws TreeReaderException{ if (logger.isTraceEnabled()) { logger.trace("importTreeData(TreeReader, Project, String[], ImportColumnGroup)"); } try { while (parser.hasNext()) { Token eventType = parser.next(); if (eventType == Token.StartEntity) { findRecord(project, parser, recordPath, 0, rootColumnGroup, limit--,parameters); } } } catch (TreeReaderException e) { logger.error("Exception from XML parse",e); throw e; } }
Source:
public boolean equals(final Object o) { if (o instanceof Map) { if (innerMap.equals(o)) { return true; } } return false; }

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof Map)) { return false; } final Map that = (Map) o; return Objects.equals(innerMap, that); }