auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testEmptyBaseUrl() throws Exception { String clientUuid = KeycloakModelUtils.generateId(); ClientRepresentation emptyBaseclient = ClientBuilder.create() .clientId("empty-baseurl-client") .id(clientUuid) .enabled(true) .baseUrl("") .addRedirectUri("http://localhost:8180/auth/realms/master/app/auth/*") .addRedirectUri("https://localhost:8543/auth/realms/master/app/auth/*") .secret("password") .build(); testRealm().clients().create(emptyBaseclient); getCleanup().addClientUuid(clientUuid); oauth.clientId("empty-baseurl-client"); oauth.openLoginForm(); loginPage.assertCurrent(); loginPage.login("login-test", "password"); updatePasswordPage.assertCurrent(); String tab1Url = driver.getCurrentUrl(); oauth.openLoginForm(); loginPage.assertCurrent(); loginPage.login("login-test", "password"); updatePasswordPage.assertCurrent(); updatePasswordPage.changePassword("password", "password"); updateProfilePage.update("John", "Doe3", "john@doe3.com"); appPage.assertCurrent(); driver.navigate().to(tab1Url); infoPage.assertCurrent(); Assert.assertEquals("You are already logged in.", infoPage.getInfo()); try { infoPage.clickBackToApplicationLink(); fail(); } catch (NoSuchElementException ex) }

Target:
public void testEmptyBaseUrl() throws Exception { String clientUuid = KeycloakModelUtils.generateId(); ClientRepresentation emptyBaseclient = ClientBuilder.create() .clientId("empty-baseurl-client") .id(clientUuid) .enabled(true) .baseUrl("") .addRedirectUri("*") .secret("password") .build(); testRealm().clients().create(emptyBaseclient); getCleanup().addClientUuid(clientUuid); oauth.clientId("empty-baseurl-client"); oauth.openLoginForm(); loginPage.assertCurrent(); loginPage.login("login-test", "password"); updatePasswordPage.assertCurrent(); String tab1Url = driver.getCurrentUrl(); oauth.openLoginForm(); loginPage.assertCurrent(); loginPage.login("login-test", "password"); updatePasswordPage.assertCurrent(); updatePasswordPage.changePassword("password", "password"); updateProfilePage.update("John", "Doe3", "john@doe3.com"); appPage.assertCurrent(); driver.navigate().to(tab1Url); infoPage.assertCurrent(); Assert.assertEquals("You are already logged in.", infoPage.getInfo()); try { infoPage.clickBackToApplicationLink(); fail(); } catch (NoSuchElementException ex) }
Source:
private MethodHandle toMethodHandle(Method method) { if(isMethodDecorated(method)) { return getDecoratedMethodHandle(lookup, method, arity); }else{ try { MethodHandle target = lookup.unreflect(method); if (target.isVarargsCollector() && isLastArgumentAnArray(arity, args)) { return target.asFixedArity().asType(type); } else { return target.asType(type); } } catch (IllegalAccessException e) { return null; } } }

Target:
private MethodHandle toMethodHandle(Method method) { try { MethodHandle target = null; if (isMethodDecorated(method)) { target = getDecoratedMethodHandle(lookup, method, arity); } else { target = lookup.unreflect(method); if (argumentNames.length > 1) { target = FunctionCallSupport.reorderArguments(method, target, argumentNames); } if (target.isVarargsCollector() && isLastArgumentAnArray(arity, args)) { target = target.asFixedArity().asType(type); } else { target = target.asType(type); } } return target; } catch (IllegalAccessException e) { return null; } }
Source:
public ModelAndView membershipDetail(@PathVariable long membershipGiveId) { ModelAndView modelAndView = new ModelAndView("/membership-give-edit"); modelAndView.addObject("userGroups", MembershipUserGroup.values()); modelAndView.addObject("membershipLevels", Lists.newArrayList(0, 1, 2, 3, 4, 5)); MembershipGiveDto membershipGiveDto = membershipGiveService.getMembershipGiveDtoById(membershipGiveId); modelAndView.addObject("membershipGiveId", membershipGiveDto.getId()); modelAndView.addObject("originMembershipLevel", membershipGiveDto.getMembershipLevel()); modelAndView.addObject("validPeriod", membershipGiveDto.getValidPeriod()); modelAndView.addObject("receiveStartTime", membershipGiveDto.getReceiveStartTime()); modelAndView.addObject("receiveEndTime", membershipGiveDto.getReceiveEndTime()); modelAndView.addObject("originUserGroup", membershipGiveDto.getUserGroup()); modelAndView.addObject("smsNotify", membershipGiveDto.isSmsNotify()); return modelAndView; }

Target:
public ModelAndView membershipDetail(@PathVariable long membershipGiveId) { ModelAndView modelAndView = new ModelAndView("/membership-give-edit"); MembershipGiveDto membershipGiveDto = membershipGiveService.getMembershipGiveDtoById(membershipGiveId); modelAndView.addObject("membershipGiveDto", membershipGiveDto); modelAndView.addObject("userGroups", MembershipUserGroup.values()); modelAndView.addObject("membershipLevels", Lists.newArrayList(userMembershipService.getAllLevels())); return modelAndView; }
Source:
public List<HostNetworkQos> getAll() { return hostNetworkQosDao.getAll(); }

Target:
List<HostNetworkQos> getAll() { return hostNetworkQosDao.getAll(); }
Source:
protected void restoreSnapshot() { relapseTime = System.currentTimeMillis() - snapshot.getSnapshotTime(); for (ClockModel clock : getClockModels()) { clock.restoreSnapshot(snapshot.getClockSnapshot(clock.getId())); } for (TeamModel team : getTeamModels()) { team.restoreSnapshot(snapshot.getTeamSnapshot(team.getId())); } setTimeoutOwner(snapshot.getTimeoutOwner()); setOfficialReview(snapshot.isOfficialReview()); setInOvertime(snapshot.inOvertime()); setInPeriod(snapshot.inPeriod()); snapshot = null; }

Target:
protected long restoreSnapshot() { long relapseTime = DefaultClockModel.updateClockTimerTask.getCurrentTime() - snapshot.getSnapshotTime(); for (ClockModel clock : getClockModels()) { clock.restoreSnapshot(snapshot.getClockSnapshot(clock.getId())); } for (TeamModel team : getTeamModels()) { team.restoreSnapshot(snapshot.getTeamSnapshot(team.getId())); } setTimeoutOwner(snapshot.getTimeoutOwner()); setOfficialReview(snapshot.isOfficialReview()); setInOvertime(snapshot.inOvertime()); setInPeriod(snapshot.inPeriod()); snapshot = null; return relapseTime; }
Source:
public Supplier<EntityViewManager> entityViewManagerSupplier(BlazePersistenceInstanceConfiguration blazePersistenceConfig, String blazePersistenceInstanceName, Set<String> entityViewClasses, Set<String> entityViewListenerClasses) { return () -> { EntityViewConfiguration entityViewConfiguration = EntityViews.createDefaultConfiguration(); for (String entityViewClass : entityViewClasses) { try { entityViewConfiguration.addEntityView( Thread.currentThread().getContextClassLoader().loadClass(entityViewClass) ); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } for (String entityViewListenerClass : entityViewListenerClasses) { try { entityViewConfiguration.addEntityViewListener( Thread.currentThread().getContextClassLoader().loadClass(entityViewListenerClass) ); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } blazePersistenceConfig.apply(entityViewConfiguration); entityViewConfiguration.setProperty(ConfigurationProperties.PROXY_UNSAFE_ALLOWED, Boolean.FALSE.toString()); Annotation[] cbfQualifiers; if (BlazePersistenceInstanceUtil.isDefaultBlazePersistenceInstance(blazePersistenceInstanceName)) { cbfQualifiers = new Annotation[] { new Default.Literal() }; } else { cbfQualifiers = new Annotation[] { new BlazePersistenceInstance.BlazePersistenceInstanceLiteral(blazePersistenceInstanceName) }; } CriteriaBuilderFactory cbf = Arc.container().instance(CriteriaBuilderFactory.class, cbfQualifiers).get(); return entityViewConfiguration.createEntityViewManager(cbf); }; }

Target:
public Supplier<EntityViewManager> entityViewManagerSupplier(BlazePersistenceInstanceConfiguration blazePersistenceConfig, String blazePersistenceInstanceName, Set<String> entityViewClasses, Set<String> entityViewListenerClasses) { return () -> { EntityViewConfiguration entityViewConfiguration = EntityViews.createDefaultConfiguration(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); for (String entityViewClass : entityViewClasses) { try { entityViewConfiguration.addEntityView( classLoader.loadClass(entityViewClass) ); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } for (String entityViewListenerClass : entityViewListenerClasses) { try { entityViewConfiguration.addEntityViewListener( classLoader.loadClass(entityViewListenerClass) ); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } blazePersistenceConfig.apply(entityViewConfiguration); entityViewConfiguration.setProperty(ConfigurationProperties.PROXY_UNSAFE_ALLOWED, Boolean.FALSE.toString()); Annotation[] cbfQualifiers; if (BlazePersistenceInstanceUtil.isDefaultBlazePersistenceInstance(blazePersistenceInstanceName)) { cbfQualifiers = new Annotation[] { new Default.Literal() }; } else { cbfQualifiers = new Annotation[] { new BlazePersistenceInstance.BlazePersistenceInstanceLiteral(blazePersistenceInstanceName) }; } CriteriaBuilderFactory cbf = Arc.container().instance(CriteriaBuilderFactory.class, cbfQualifiers).get(); return entityViewConfiguration.createEntityViewManager(cbf); }; }
Source:
public ProcessProperty() { this.container = new Integer(0); this.value = ""; this.possibleValues = new ArrayList<String>(); this.projects = new ArrayList<String>(); this.showStepConditions = new ArrayList<ShowStepCondition>(); this.prozesseigenschaft = new Prozesseigenschaft(); }

Target:
public ProcessProperty() { this.container = 0; this.value = ""; this.possibleValues = new ArrayList<String>(); this.projects = new ArrayList<String>(); this.showStepConditions = new ArrayList<ShowStepCondition>(); this.prozesseigenschaft = new Prozesseigenschaft(); }
Source:
public void getMrrtReportTemplate_shouldReturnNullIfNoMatchWasFound() throws Exception { assertNull(mrrtReportTemplateService.getMrrtReportTemplate(23)); }

Target:
public void getMrrtReportTemplate_shouldReturnNullIfNoMatchWasFound() throws Exception { assertNull(mrrtReportTemplateService.getMrrtReportTemplate(NON_EXISTING_TEMPLATE_ID)); }
Source:
private NacosConfigListener createTargetListener(String key, String group) { return new NacosConfigListener(); }

Target:
private NacosConfigListener createTargetListener(String key, String group) { NacosConfigListener configListener = new NacosConfigListener(); configListener.fillContext(key, group); return configListener; }
Source:
public void testCloseAdminClientInCallback() throws InterruptedException { AdminClientUnitTestEnv env = mockClientEnv(); final ListTopicsResult result = env.adminClient().listTopics(new ListTopicsOptions().timeoutMs(1000)); final KafkaFuture<Map<String, TopicListing>> kafkaFuture = result.namesToListings(); final Semaphore callbackCalled = new Semaphore(0); kafkaFuture.whenComplete((stringTopicListingMap, throwable) -> { env.close(); callbackCalled.release(); }); callbackCalled.acquire(); }

Target:
public void testCloseAdminClientInCallback() throws InterruptedException { MockTime time = new MockTime(); AdminClientUnitTestEnv env = new AdminClientUnitTestEnv(time, mockCluster(3, 0)); final ListTopicsResult result = env.adminClient().listTopics(new ListTopicsOptions().timeoutMs(1000)); final KafkaFuture<Collection<TopicListing>> kafkaFuture = result.listings(); final Semaphore callbackCalled = new Semaphore(0); kafkaFuture.whenComplete((topicListings, throwable) -> { env.close(); callbackCalled.release(); }); time.sleep(2000); callbackCalled.acquire(); }
Source:
public String toString() { StringBuffer annotation = new StringBuffer(512); annotation.append("Gene Name: ") .append(geneName).append(System.lineSeparator()) .append("Gene Position: ").append(getGenomePosition()) .append(System.lineSeparator()).append("Mutation Type: ") .append(typeOfMutation).append(System.lineSeparator()) .append("Change: ").append(change) .append(System.lineSeparator()).append("Filter: ") .append(filter).append(System.lineSeparator()) .append("Drug Resistance: ").append(drugResistance); return annotation.toString(); }

Target:
public String toString() { Formatter formatter = new Formatter(); formatter .format("Gene Name: %1$s%nGene Position: %2$s%nMutation Type: %3$s%nChange: %4$s%nFilter: %5$s%nDrug Resistance: %6$s", geneName, getGenomePosition(), typeOfMutation, change, filter, drugResistance); String annotation = formatter.toString(); formatter.close(); return annotation; }
Source:
public void testFoo() throws Exception { Handle h = db.openHandle(); try { h.insert("WOOF", 7, "Tom"); fail("Should throw a statement exception because of a bad SQL"); } catch (StatementException e) { assertThat(e.getStatementContext().getRawSql()).isEqualTo("WOOF"); } }

Target:
public void testFoo() throws Exception { assertThatExceptionOfType(StatementException.class) .isThrownBy(()-> db.openHandle().insert("WOOF", 7, "Tom")) .satisfies(e -> assertThat(e.getStatementContext().getRawSql()).isEqualTo("WOOF")); }
Source:
public static final VelocityModeHandler modeHandler(final PageMode mode, final HttpServletRequest request, final HttpServletResponse response, final String uri, final Host host) { final long langId = WebAPILocator.getLanguageWebAPI().getLanguage(request).getId(); try { final Identifier id = APILocator.getIdentifierAPI().find(host, uri); final IHTMLPage htmlPage = APILocator.getHTMLPageAssetAPI().findByIdLanguageFallback(id, langId, mode.showLive, APILocator.systemUser(), mode.respectAnonPerms); return pageModeVelocityMap.get(mode).apply(request, response, htmlPage, host); } catch (DotDataException | DotSecurityException e) { throw new DotRuntimeException(e); } }

Target:
public static final VelocityModeHandler modeHandler(final PageMode mode, final HttpServletRequest request, final HttpServletResponse response, final String uri, final Host host) { final IHTMLPage htmlPage= getHtmlPageFromURI(mode, request, uri, host); return pageModeVelocityMap.get(mode).apply(request, response, htmlPage, host); }
Source:
private boolean hasElseOrElsif(AstNode ifNode){ return ifNode.hasDirectChildren(PuppetGrammar.ELSEIF_STMT) || ifNode.hasDirectChildren(PuppetGrammar.ELSE_STMT); }

Target:
private boolean hasElseOrElsif(AstNode ifNode){ return ifNode.hasDirectChildren(PuppetGrammar.ELSIF_STMT, PuppetGrammar.ELSE_STMT); }
Source:
int complete(Xid xid, boolean commit) { try { if (trace) { log.tracef("%s transaction xid=%s, remote-cache=%s", commit ? "Committing" : "Rolling-Back", xid, cacheName); } CompleteTransactionOperation operation = operationsFactory.newCompleteTransactionOperation(xid, commit); return operation.execute().get(); } catch (Exception e) { log.debug("Exception while commit/rollback.", e); return XAException.XA_HEURRB; } }

Target:
int complete(Xid xid, boolean commit) { try { if (trace) { log.tracef("Complete (%s) transaction xid=%s, cache-name=%s", commit, xid, cacheName); } CompleteTransactionOperation operation = operationsFactory.newCompleteTransactionOperation(xid, commit); return operation.execute().get(); } catch (Exception e) { log.debug("Exception while commit/rollback.", e); return XAException.XA_HEURRB; } }
Source:
private void onLoadMessageFromDatabaseFinished() { if (callback == null) { throw new IllegalStateException("unexpected call when callback is already detached"); } callback.onMessageDataLoadFinished(localMessage); boolean messageIsIncomplete = !localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL); if (messageIsIncomplete) { startDownloadingMessageBody(false); return; } if (account.isOpenPgpProviderConfigured()) { startOrResumeCryptoOperation(); return; } startOrResumeDecodeMessage(); }

Target:
private void onLoadMessageFromDatabaseFinished() { if (callback == null) { throw new IllegalStateException("unexpected call when callback is already detached"); } callback.onMessageDataLoadFinished(localMessage); boolean messageIncomplete = !localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL); if (messageIncomplete) { startDownloadingMessageBody(false); return; } if (account.isOpenPgpProviderConfigured()) { startOrResumeCryptoOperation(); return; } startOrResumeDecodeMessage(); }
Source:
private Session loadSessionIfNotExpired(Session session, File file, MicroServiceContext microServiceContext) { if (System.currentTimeMillis() - session.getLastAccessedTime() >= (long) session.getMaxInactiveInterval() * 60L * 1000L && !file.delete()) { log.warn("Couldn't delete expired session file " + file.getAbsolutePath()); return null; } else { session.setManager(this); session.setMicroServiceContext(microServiceContext); return microServiceContext.putSession(session.getId(), session); } }

Target:
private Optional<Session> loadSessionIfNotExpired(Session session, File file, MicroServiceContext microServiceContext) { if (System.currentTimeMillis() - session.getLastAccessedTime() >= (long) session.getMaxInactiveInterval() * 60L * 1000L && !file.delete()) { log.warn("Couldn't delete expired session file " + file.getAbsolutePath()); return Optional.empty(); } else { session.setManager(this); microServiceContext.putSession(session.getId(), session); return Optional.of(session); } }
Source:
public List<Long> getSizeOfTasksWithProcessingStatusForNotTemplateProcessesForProjectIdOrderByOrdering( Integer processingStatus, Integer projectId) { return getCount("SELECT COUNT(t.id) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " + "WITH pr.id = " + projectId + " WHERE t.processingStatus = " + processingStatus + " GROUP BY t.title ORDER BY t.ordering"); }

Target:
public List<Long> getSizeOfTasksWithProcessingStatusForNotTemplateProcessesForProjectIdOrderByOrdering( Integer processingStatus, Integer projectId) { Map<String, Object> parameters = new HashMap<>(); parameters.put("projectId", projectId); parameters.put("processingStatus", processingStatus); return getCount("SELECT COUNT(t.id) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " + "WITH pr.id = :projectId WHERE t.processingStatus = :processingStatus " + "GROUP BY t.title ORDER BY t.ordering", parameters); }
Source:
protected void validateSchedulingRequirements( final Collection<ExecutionVertexSchedulingRequirements> schedulingRequirements) { schedulingRequirements.stream() .map(ExecutionVertexSchedulingRequirements::getExecutionVertexId) .forEach(id -> checkState( !pendingSlotAssignments.containsKey(id), "BUG: vertex %s tries to allocate a slot when its previous slot request is still pending", id)); }

Target:
void validateSchedulingRequirements(final Collection<ExecutionVertexSchedulingRequirements> schedulingRequirements) { schedulingRequirements.stream() .map(ExecutionVertexSchedulingRequirements::getExecutionVertexId) .forEach(id -> checkState( !pendingSlotAssignments.containsKey(id), "BUG: vertex %s tries to allocate a slot when its previous slot request is still pending", id)); }
Source:
public AbstractListDataView<T> addItemsAfter(Collection<T> items, T after) { if (items == null || items.isEmpty()) { return this; } final ListDataProvider<T> dataProvider = getDataProvider(); final Collection<T> backendItems = dataProvider.getItems(); final int afterItemIndex = getItemIndex(after); if (afterItemIndex == -1) { throw new IllegalArgumentException( "Item to insert after is not available in the data"); } if (backendItems instanceof List) { final List<T> itemList = (List<T>) backendItems; final List<T> itemsToAdd = items.stream() .filter(item -> !contains(item, dataProvider)) .collect(Collectors.toList()); itemList.addAll(afterItemIndex + 1, itemsToAdd); dataProvider.refreshAll(); return this; } throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, backendItems.getClass().getSimpleName())); }

Target:
public AbstractListDataView<T> addItemsAfter(Collection<T> items, T after) { addItemCollectionOnTarget(items, after, "Item to insert after is not available in the data", (index, containsTarget) -> containsTarget ? index : index + 1); return this; }
Source:
private Product applyProvidedProductChanges(Product entity, ProductInfo update, Owner owner) { if (update.getProvidedProducts() != null && !update.getProvidedProducts().isEmpty()) { Set<Product> product = new HashSet<>(); for (ProductInfo pInfo : update.getProvidedProducts()) { if (pInfo != null && pInfo.getId() != null) { Product newProd = this.ownerProductCurator.getProductById(owner, pInfo.getId()); if (newProd != null) { product.add(newProd); } } } entity.setProvidedProducts(product); } return entity; }

Target:
private Product applyProvidedProductChanges(Product entity, ProductInfo update, Owner owner) { if (update.getProvidedProducts() != null) { if (update.getProvidedProducts().isEmpty()) { entity.getProvidedProducts().clear(); } else { entity.getProvidedProducts().clear(); for (ProductInfo providedProductDTO : update.getProvidedProducts()) { if (providedProductDTO != null && providedProductDTO.getId() != null) { Product newProd = this.ownerProductCurator.getProductById(owner, providedProductDTO.getId()); if (newProd != null) { entity.addProvidedProduct(newProd); } } } } } return entity; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); try { FeatureFinishOperation operation = new FeatureFinishOperation(gfRepo); String featureBranch = gfRepo.getRepository().getBranch(); String develop = gfRepo.getConfig().getDevelop(); JobUtil.scheduleUserWorkspaceJob(operation, UIText.FeatureFinishHandler_finishingFeature, JobFamilies.GITFLOW_FAMILY); IJobManager jobMan = Job.getJobManager(); jobMan.join(JobFamilies.GITFLOW_FAMILY, null); MergeResult mergeResult = operation.getMergeResult(); MergeStatus mergeStatus = mergeResult.getMergeStatus(); if (MergeStatus.CONFLICTING.equals(mergeStatus)) { MultiStatus conflictInfo = createMergeConflictInfo(develop, featureBranch); MultiStatus warning = createMergeConflictWarning(mergeResult); conflictInfo.addAll(warning); ErrorDialog.openError(null, UIText.FeatureFinishHandler_Conflicts, null, warning); } } catch (WrongGitFlowStateException | CoreException | IOException | OperationCanceledException | InterruptedException e) { return error(e.getMessage(), e); } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); try { FeatureFinishOperation operation = new FeatureFinishOperation(gfRepo); String featureBranch = gfRepo.getRepository().getBranch(); String develop = gfRepo.getConfig().getDevelop(); JobUtil.scheduleUserWorkspaceJob(operation, UIText.FeatureFinishHandler_finishingFeature, JobFamilies.GITFLOW_FAMILY); IJobManager jobMan = Job.getJobManager(); jobMan.join(JobFamilies.GITFLOW_FAMILY, null); MergeResult mergeResult = operation.getMergeResult(); MergeStatus mergeStatus = mergeResult.getMergeStatus(); if (MergeStatus.CONFLICTING.equals(mergeStatus)) { MultiStatus status = createMergeConflictInfo(develop, featureBranch, mergeResult); ErrorDialog.openError(null, UIText.FeatureFinishHandler_Conflicts, null, status); } } catch (WrongGitFlowStateException | CoreException | IOException | OperationCanceledException | InterruptedException e) { return error(e.getMessage(), e); } return null; }
Source:
protected void configure() { final CommandName gerrit = Commands.named("gerrit"); command(gerrit, "approve").to(ReviewCommand.class); command(gerrit, "create-account").to(CreateAccountCommand.class); command(gerrit, "create-group").to(CreateGroupCommand.class); command(gerrit, "create-project").to(CreateProject.class); command(gerrit, "gsql").to(AdminQueryShell.class); command(gerrit, "set-reviewers").to(SetReviewersCommand.class); command(gerrit, "receive-pack").to(Receive.class); command(gerrit, "replicate").to(Replicate.class); command(gerrit, "set-project-parent").to(AdminSetParent.class); command(gerrit, "review").to(ReviewCommand.class); command(gerrit, "archive-project").to(ArchiveProject.class); }

Target:
protected void configure() { final CommandName gerrit = Commands.named("gerrit"); command(gerrit, "approve").to(ReviewCommand.class); command(gerrit, "create-account").to(CreateAccountCommand.class); command(gerrit, "create-group").to(CreateGroupCommand.class); command(gerrit, "rename-group").to(RenameGroupCommand.class); command(gerrit, "create-project").to(CreateProjectCommand.class); command(gerrit, "gsql").to(AdminQueryShell.class); command(gerrit, "set-reviewers").to(SetReviewersCommand.class); command(gerrit, "receive-pack").to(Receive.class); command(gerrit, "replicate").to(Replicate.class); command(gerrit, "set-project-parent").to(AdminSetParent.class); command(gerrit, "review").to(ReviewCommand.class); command(gerrit, "archive-project").to(ArchiveProject.class); }
Source:
private static String readMapping() { JSONParser parser = new JSONParser(); JSONObject jsonObject = new JSONObject(); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); InputStream inputStream = classloader.getResourceAsStream("mapping.json"); try { String mapping = IOUtils.toString(inputStream, "UTF-8"); Object object = parser.parse(mapping); jsonObject = (JSONObject) object; } catch (IOException | ParseException e ) { logger.error(e); } return jsonObject.toJSONString(); }

Target:
private static String readMapping() { JSONParser parser = new JSONParser(); JSONObject jsonObject = new JSONObject(); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); try (InputStream inputStream = classloader.getResourceAsStream("mapping.json")) { String mapping = IOUtils.toString(inputStream, "UTF-8"); Object object = parser.parse(mapping); jsonObject = (JSONObject) object; } catch (IOException | ParseException e ) { logger.error(e); } return jsonObject.toJSONString(); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof ByteKeyMap)) return false; final ByteKeyMap<?> other = (ByteKeyMap<?>) obj; if (other.size() != size()) return false; final ByteIterator i = keySet().iterator(); while (i.hasNext()) { byte key = i.next(); V value = get(key); if (value == null) { if (!(other.get(key) == null && other.containsKey(key))) return false; } else { if (value.equals(other.get(key))) { return false; } } } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof ByteKeyMap)) return false; final ByteKeyMap<?> other = (ByteKeyMap<?>) obj; if (other.size() != size()) return false; final ByteIterator i = keySet().iterator(); while (i.hasNext()) { byte key = i.next(); V value = get(key); if (value == null) { if (!(other.get(key) == null && other.containsKey(key))) return false; } else { if (!value.equals(other.get(key))) { return false; } } } return true; }
Source:
private synchronized SecretKey getKey(final String keyVersion) throws GeneralSecurityException, IOException { if (VERSION_USER_DEFINED.equals(keyVersion)) { return getSecretKey(AuthenticationSettings.INSTANCE.getSecretKeyData()); } if (VERSION_ANDROID_KEY_STORE.equals(keyVersion)) { if (Build.VERSION.SDK_INT >= 18) { final File keyFile = new File(mContext.getDir(mContext.getPackageName(), Context.MODE_PRIVATE), ADALKS); mKeyPair = readKeyPair(); mSecretKeyFromAndroidKeyStore = getUnwrappedSecretKey(keyFile); return mSecretKeyFromAndroidKeyStore; } } throw new IllegalArgumentException("keyVersion = " + keyVersion); }

Target:
private synchronized SecretKey getKey(final String keyVersion) throws GeneralSecurityException, IOException { switch (keyVersion) { case VERSION_USER_DEFINED : return getSecretKey(AuthenticationSettings.INSTANCE.getSecretKeyData()); case VERSION_ANDROID_KEY_STORE : mKeyPair = readKeyPair(); mSecretKeyFromAndroidKeyStore = getUnwrappedSecretKey(); return mSecretKeyFromAndroidKeyStore; default : throw new IOException("Unknown keyVersion."); } }
Source:
public TrackedVisitor2User getOrCreate(Long memberId) { if (memberId == null) { return create(); } return trackedVisitor2UserDao.getByMemberId(memberId) .orElseGet(() -> { TrackedVisitor2User newInstance = new TrackedVisitor2User(); newInstance.setUserId(memberId); newInstance.setUuid_(generateUniqueUUID()); return trackedVisitor2UserDao.create(newInstance); }); }

Target:
public TrackedVisitor2User getOrCreate(Long memberId) { if (memberId == null) { return createUnknownVisitor(); } return trackedVisitor2UserDao.getByMemberId(memberId).orElse(create(memberId)); }
Source:
public void shouldCaptureAPaymentSuccessfully() { when(response.getStatus()).thenReturn(HttpStatus.SC_OK); when(response.readEntity(String.class)).thenReturn(successCaptureResponse()); Either<GatewayError, GatewayClient.Response> response = right(new TestResponse(this.response)); when(client.postRequestFor(isNull(), any(GatewayAccountEntity.class), any(GatewayOrder.class))).thenReturn(response); Either<GatewayError, SmartpayCaptureResponse> unmarshalledResponse = right(new SmartpayCaptureResponse()); when(client.unmarshallResponse(any(TestResponse.class), any(Class.class))).thenReturn(unmarshalledResponse); ChargeEntity chargeEntity = aValidChargeEntity() .withGatewayAccountEntity(aServiceAccount()) .build(); CaptureGatewayRequest request = CaptureGatewayRequest.valueOf(chargeEntity); CaptureResponse gatewayResponse = smartpayCaptureHandler.capture(request); assertTrue(gatewayResponse.isSuccessful()); }

Target:
public void shouldCaptureAPaymentSuccessfully() { when(response.getStatus()).thenReturn(HttpStatus.SC_OK); when(response.readEntity(String.class)).thenReturn(successCaptureResponse()); Either<GatewayError, GatewayClient.Response> response = right(new TestResponse(this.response)); when(client.postRequestFor(isNull(), any(GatewayAccountEntity.class), any(GatewayOrder.class))).thenReturn(response); Either<GatewayError, SmartpayCaptureResponse> unmarshalledResponse = right(new SmartpayCaptureResponse()); when(client.unmarshallResponse(any(TestResponse.class), any(Class.class))).thenReturn(unmarshalledResponse); ChargeEntity chargeEntity = aValidChargeEntity() .withGatewayAccountEntity(aServiceAccount()) .build(); CaptureGatewayRequest request = CaptureGatewayRequest.valueOf(chargeEntity); CaptureResponse gatewayResponse = smartpayCaptureHandler.capture(request); assertTrue(gatewayResponse.isSuccessful()); assertThat(gatewayResponse.state(), is(CaptureResponse.ChargeState.PENDING)); }
Source:
public SqlStatements() { attributes = new ConcurrentHashMap<>(); templateEngine = new DefinedAttributeTemplateEngine(); sqlParser = new ColonPrefixSqlParser(); sqlLogger = SqlLogger.NOP_SQL_LOGGER; queryTimeout = null; customizers = new ArrayList<>(); }

Target:
public SqlStatements() { attributes = new ConcurrentHashMap<>(); templateEngine = new DefinedAttributeTemplateEngine(); sqlParser = new ColonPrefixSqlParser(); sqlLogger = SqlLogger.NOP_SQL_LOGGER; queryTimeout = null; }
Source:
protected void handleSwingDropTargetChanged(TreePath path, Transferable swingTransferable) { if (getUpdateSwingFromScoutLock().isAcquired()) { return; } if (swingTransferable != null) { if (getScoutObject() != null) { final ITreeNode scoutNode = treePathToScoutNode(path); Runnable t = new Runnable() { @Override public void run() { getScoutObject().getUIFacade().fireNodeDropTargetChangedFromUI(scoutNode); } }; getSwingEnvironment().invokeScoutLater(t, 0); } } }

Target:
protected void handleSwingDropTargetChanged(TreePath path, Transferable swingTransferable) { if (getUpdateSwingFromScoutLock().isAcquired()) { return; } if (swingTransferable != null && getScoutObject() != null) { final ITreeNode scoutNode = treePathToScoutNode(path); Runnable t = new Runnable() { @Override public void run() { getScoutObject().getUIFacade().fireNodeDropTargetChangedFromUI(scoutNode); } }; getSwingEnvironment().invokeScoutLater(t, 0); } }
Source:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(DbFacade.getInstance().getVmTemplateDao().getCount()); }

Target:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(getVmTemplateDao().getCount()); }
Source:
private CompletableFuture<Void> rollbackLocks(CommitData cd) throws Exception { CommitStep firstStep = new RollbackOtherLocks(); firstStep.andThen(new RollbackPrimaryLock()); return firstStep.compose(cd) .thenAccept(v -> cd.commitObserver.commitFailed(cd.getShortCollisionMessage())); }

Target:
private CompletableFuture<Void> rollbackLocks(CommitData cd) { CommitStep firstStep = new RollbackOtherLocks(); firstStep.andThen(new RollbackPrimaryLock()); return firstStep.compose(cd) .thenRun(() -> cd.commitObserver.commitFailed(cd.getShortCollisionMessage())); }
Source:
public static AbstractStreamingAnalyticsConnection createStreamingAnalyticsConnection( String vcap, String serviceName) throws IOException { return createStreamingAnalyticsConnection(vcap, serviceName, false); }

Target:
static AbstractStreamingAnalyticsConnection createStreamingAnalyticsConnection( String vcap, String serviceName) throws IOException { return createStreamingAnalyticsConnection(vcap, serviceName, false); }
Source:
public void testFactoryPositionalParameters() { final List<String> names = new ArrayList<>(); names.add("?"); names.add("?"); names.add("?"); final String sql = "insert into test (a, b, c) values (?, ?, ?)"; final ParsedParameters parameters = ParsedParameters.of(true, names); final ParsedSql parsedSql = ParsedSql.of(sql, parameters); assertThat(parsedSql).isNotNull(); assertThat(parsedSql.getSql()).isEqualTo(sql); assertThat(parsedSql.getParameters().isPositional()).isTrue(); assertThat(parsedSql.getParameters().getParameterNames()).containsExactly("?", "?", "?"); }

Target:
public void testFactoryPositionalParameters() { final String sql = "insert into test (a, b, c) values (?, ?, ?)"; final ParsedParameters parameters = ParsedParameters.positional(3); final ParsedSql parsedSql = ParsedSql.of(sql, parameters); assertThat(parsedSql).isNotNull(); assertThat(parsedSql.getSql()).isEqualTo(sql); assertThat(parsedSql.getParameters().isPositional()).isTrue(); assertThat(parsedSql.getParameters().getParameterNames()).containsOnly("?"); }
Source:
public void fill(ToolBar parent, int toolbarItemIndex) { fResourceClassCombo = new Combo(parent, SWT.NONE); fResourceClassCombo.setEnabled(enabled); int width = populateCombo(); fResourceClassCombo.addSelectionListener(new SelectionListener() { @SuppressWarnings({ "null"}) @Override public void widgetSelected(SelectionEvent e) { String description = fResourceClassCombo.getText(); String id = null; for (int i = 0; i < resourceClasses.length; ++i) if (resourceClasses[i].getHumanDescription().equals(description)) { id = resourceClasses[i].getId(); break; } if (!id.equals(fResourceClassId)) { fResourceClassId = id; getDialogSettings().put("resourceClass", id); if (fListener != null && !blockListener) fListener.resourceClassChanged(fResourceClassId); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); toolItem = new ToolItem(parent, SWT.SEPARATOR); toolItem.setControl(fResourceClassCombo); toolItem.setWidth(width); }

Target:
public void fill(ToolBar parent, int toolbarItemIndex) { fResourceClassCombo = new Combo(parent, SWT.NONE); fResourceClassCombo.setEnabled(enabled); int width = populateCombo(); fResourceClassCombo.addSelectionListener(new SelectionListener() { @SuppressWarnings({ "null"}) @Override public void widgetSelected(SelectionEvent e) { String description = fResourceClassCombo.getText(); String id = null; for (int i = 0; i < resourceClasses.length; ++i) if (resourceClasses[i].getHumanDescription().equals(description)) { id = resourceClasses[i].getId(); break; } assert id != null; if (id != null && !id.equals(fResourceClassId)) { fResourceClassId = id; getDialogSettings().put("resourceClass", id); if (fListener != null && !blockListener) fListener.resourceClassChanged(fResourceClassId); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); toolItem = new ToolItem(parent, SWT.SEPARATOR); toolItem.setControl(fResourceClassCombo); toolItem.setWidth(width); }
Source:
public void onGrantLeadership() { synchronized (lock) { if (running) { issuedLeaderSessionID = UUID.randomUUID(); clearConfirmedLeaderInformation(); if (LOG.isDebugEnabled()) { LOG.debug( "Grant leadership to contender with session ID {}.", leaderContender.getDescription(), issuedLeaderSessionID); } leaderContender.grantLeadership(issuedLeaderSessionID); } else { if (LOG.isDebugEnabled()) { LOG.debug("Ignoring the grant leadership notification since the has " + "already been closed.", leaderElectionDriver); } } } }

Target:
public void onGrantLeadership() { synchronized (lock) { if (running) { issuedLeaderSessionID = UUID.randomUUID(); clearConfirmedLeaderInformation(); if (LOG.isDebugEnabled()) { LOG.debug( "Grant leadership to contender with session ID {}.", leaderContender.getDescription(), issuedLeaderSessionID); } } else { if (LOG.isDebugEnabled()) { LOG.debug("Ignoring the grant leadership notification since the has " + "already been closed.", leaderElectionDriver); } return; } } leaderContender.grantLeadership(issuedLeaderSessionID); }
Source:
protected void groupMembershipFromFile(String username) throws LoginException { try (FileInputStream stream = new FileInputStream(groupFile)) { BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Charsets.UTF_8)); String line = null; while ((line = reader.readLine()) != null) { String[] u2g = line.split(":"); if (u2g[0].trim().equals(username)) { subject.getPrincipals().add(new GroupNamePrincipal(u2g[1])); logger.debug("adding group principal '" + u2g[1] + "' for user '" + username + "'"); } } } catch (FileNotFoundException e) { throw new LoginException(e.toString()); } catch (IOException e) { throw new LoginException(e.toString()); } }

Target:
protected void groupMembershipFromFile(String username) throws LoginException { try (FileInputStream stream = new FileInputStream(groupFile)) { BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String line = null; while ((line = reader.readLine()) != null) { String[] u2g = line.split(":"); if (u2g[0].trim().equals(username)) { subject.getPrincipals().add(new GroupNamePrincipal(u2g[1])); logger.debug("adding group principal '" + u2g[1] + "' for user '" + username + "'"); } } } catch (FileNotFoundException e) { throw new LoginException(e.toString()); } catch (IOException e) { throw new LoginException(e.toString()); } }
Source:
public BoundedIterable<Long> newAllEntriesReader() { ArrayList<BoundedIterable<Long>> allEntriesReader = new ArrayList<>(); for ( SpatialKnownIndex index : indexMap.values() ) { try { allEntriesReader.add( index.getOnlineAccessor( descriptor, samplingConfig ).newAllEntriesReader() ); } catch ( IOException e ) { e.printStackTrace(); } } return new BoundedIterable<Long>() { @Override public long maxCount() { return allEntriesReader.stream().map( BoundedIterable::maxCount ).reduce( 0L, ( acc, e ) -> { if ( acc == UNKNOWN_MAX_COUNT || e == UNKNOWN_MAX_COUNT ) { return UNKNOWN_MAX_COUNT; } return acc + e; } ); } @Override public void close() throws Exception { forAll( entries -> ((BoundedIterable) entries).close(), allEntriesReader.toArray() ); } @Override public Iterator<Long> iterator() { return new CombiningIterable( allEntriesReader ).iterator(); } }; }

Target:
public BoundedIterable<Long> newAllEntriesReader() { ArrayList<BoundedIterable<Long>> allEntriesReader = new ArrayList<>(); for ( SpatialKnownIndex index : indexMap.values() ) { allEntriesReader.add( index.newAllEntriesReader() ); } return new BoundedIterable<Long>() { @Override public long maxCount() { return allEntriesReader.stream().map( BoundedIterable::maxCount ).reduce( 0L, ( acc, e ) -> { if ( acc == UNKNOWN_MAX_COUNT || e == UNKNOWN_MAX_COUNT ) { return UNKNOWN_MAX_COUNT; } return acc + e; } ); } @Override public void close() { forAll( entries -> ((BoundedIterable) entries).close(), allEntriesReader.toArray() ); } @Override public Iterator<Long> iterator() { return new CombiningIterable( allEntriesReader ).iterator(); } }; }
Source:
protected void compute() { final List<ParallelParse> walks = new ArrayList<>(); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (!SourceRoot.isSensibleDirectoryToEnter(dir)) { return SKIP_SUBTREE; } if (Files.isSameFile(dir, ParallelParse.this.path)) { ParallelParse w = new ParallelParse(dir, callback); w.fork(); walks.add(w); return SKIP_SUBTREE; } else { return CONTINUE; } } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { return callback.process(file, attrs); } }); } catch (IOException e) { Log.error(e); } for (ParallelParse w : walks) { w.join(); } }

Target:
protected void compute() { final List<ParallelParse> walks = new ArrayList<>(); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (!SourceRoot.isSensibleDirectoryToEnter(dir)) { return SKIP_SUBTREE; } if (!Files.isSameFile(dir, ParallelParse.this.path)) { ParallelParse w = new ParallelParse(dir, callback); w.fork(); walks.add(w); return SKIP_SUBTREE; } else { return CONTINUE; } } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { return callback.process(file, attrs); } }); } catch (IOException e) { Log.error(e); } for (ParallelParse w : walks) { w.join(); } }
Source:
public StreamsResultSet readCurrent() { Queue<StreamsDatum> batch = Queues.newConcurrentLinkedQueue(); while(!this.dataQueue.isEmpty()) { ComponentUtils.offerUntilSuccess(ComponentUtils.pollWhileNotEmpty(this.dataQueue), batch); } this.isCompleted.set(batch.size() == 0 && this.dataQueue.isEmpty() && this.dataCollector.isCompleted()); return new StreamsResultSet(batch); }

Target:
public StreamsResultSet readCurrent() { Queue<StreamsDatum> batch = Queues.newConcurrentLinkedQueue(); int count = 0; while(!this.dataQueue.isEmpty() && count < MAX_BATCH_SIZE) { ComponentUtils.offerUntilSuccess(ComponentUtils.pollWhileNotEmpty(this.dataQueue), batch); ++count; } this.isCompleted.set(batch.size() == 0 && this.dataQueue.isEmpty() && this.dataCollector.isCompleted()); return new StreamsResultSet(batch); }
Source:
public void buildShellScriptAfterRestart() throws Exception { Assume.assumeNotNull( System.getProperty("port"), "This test requires a fixed port to be available."); final AtomicReference<String> projectName = new AtomicReference<>(); story.addStep( new Statement() { @Override public void evaluate() throws Throwable { Node node = TestUtils.createSwarmClient( story.j, processDestroyer, tmpDir.allocate(), "-deleteExistingClients"); WorkflowJob project = story.j.createProject(WorkflowJob.class); projectName.set(project.getName()); project.setConcurrentBuild(false); project.setDefinition(new CpsFlowDefinition(getFlow(node, 1), true)); WorkflowRun build = project.scheduleBuild2(0).waitForStart(); SemaphoreStep.waitForStart("wait-0/1", build); } }); story.addStep( new Statement() { @Override public void evaluate() throws Throwable { SemaphoreStep.success("wait-0/1", null); WorkflowJob project = story.j.jenkins.getItemByFullName( projectName.get(), WorkflowJob.class); assertNotNull(project); WorkflowRun build = Iterables.getOnlyElement(project.getBuilds()); story.j.waitForCompletion(build); story.j.assertLogContains("ON_SWARM_CLIENT=true", build); story.j.assertBuildStatusSuccess(build); tearDown(); } }); }

Target:
public void buildShellScriptAfterRestart() throws Exception { Assume.assumeNotNull( System.getProperty("port"), "This test requires a fixed port to be available."); story.then( s -> { Node node = TestUtils.createSwarmClient( story.j, processDestroyer, temporaryFolder, "-deleteExistingClients"); WorkflowJob project = story.j.createProject(WorkflowJob.class, "test"); project.setConcurrentBuild(false); project.setDefinition(new CpsFlowDefinition(getFlow(node, 1), true)); WorkflowRun build = project.scheduleBuild2(0).waitForStart(); SemaphoreStep.waitForStart("wait-0/1", build); }); story.then( s -> { SemaphoreStep.success("wait-0/1", null); WorkflowJob project = story.j.jenkins.getItemByFullName("test", WorkflowJob.class); assertNotNull(project); WorkflowRun build = project.getBuildByNumber(1); story.j.assertBuildStatusSuccess(story.j.waitForCompletion(build)); story.j.assertLogContains("ON_SWARM_CLIENT=true", build); tearDown(); }); }
Source:
private UserSyncState calculateUserSyncState(String accountId, String envCrnString, UserSyncStatus userSyncStatus) { Operation lastSync = userSyncStatus.getLastStartedFullSync(); UserSyncState state = UserSyncState.STALE; switch (lastSync.getStatus()) { case RUNNING: state = UserSyncState.SYNCING; break; case COMPLETED: if (lastSync.getSuccessList().stream() .anyMatch(details -> envCrnString.equals(details.getEnvironment()))) { UmsEventGenerationIds currentEventGenerationIds = umsEventGenerationIdsProvider.getEventGenerationIds(accountId, MDCUtils.getRequestId()); if (eventGenerationIdsChecker.isInSync(userSyncStatus, currentEventGenerationIds)) { state = UserSyncState.IN_SYNC; } } break; case REQUESTED: case REJECTED: LOGGER.error("UserSyncStatus.lastStartedFullSync '{}' in unexpected state for environment '{}'", lastSync, lastSync.getStatus(), envCrnString); throw new IllegalStateException( String.format("Last sync operation [%s] for environment '%s' is in unexpected state %s", lastSync.getOperationId(), envCrnString, lastSync.getStatus())); case TIMEDOUT: LOGGER.warn("UserSyncStatus.lastStartedFullSync '{}' is timed out for environment '{}'", lastSync.getOperationId(), envCrnString); break; case FAILED: default: break; } return state; }

Target:
private UserSyncState calculateUserSyncState(String accountId, String envCrnString, UserSyncStatus userSyncStatus) { Operation lastSync = userSyncStatus.getLastStartedFullSync(); UserSyncState state; switch (lastSync.getStatus()) { case RUNNING: state = UserSyncState.SYNC_IN_PROGRESS; break; case COMPLETED: state = calculateStateForCompletedOperation(accountId, envCrnString, userSyncStatus); break; case REQUESTED: case REJECTED: throw createExceptionForUnexpectedOperationStatus(envCrnString, userSyncStatus); case TIMEDOUT: LOGGER.warn("UserSyncStatus.lastStartedFullSync '{}' is timed out for environment '{}'", lastSync.getOperationId(), envCrnString); state = UserSyncState.STALE; break; case FAILED: default: state = UserSyncState.STALE; break; } return state; }
Source:
private void resetView() { fStopThread = true; final Display display = Display.getDefault(); if (display == null || display.isDisposed()) { return; } display.asyncExec(new Runnable() { @Override public void run() { if (display.isDisposed()) { return; } Map<TmfPcapProtocol, Table> tableMap = fTableMap; if (tableMap == null) { return; } for (Entry<TmfPcapProtocol, Table> protocol : tableMap.entrySet()) { if (!protocol.getValue().isDisposed()) { protocol.getValue().removeAll(); } } } }); }

Target:
private void resetView() { fStopThread = true; final Display display = Display.getDefault(); if (display == null || display.isDisposed()) { return; } display.asyncExec(new Runnable() { @Override public void run() { if (display.isDisposed()) { return; } Map<TmfPcapProtocol, Table> tableMap = fTableMap; if (tableMap == null) { return; } for (Table table : tableMap.values()) { if (!table.isDisposed()) { table.removeAll(); } } } }); }
Source:
private boolean isInRebasingState(Repository repo) { if (repo == null) return false; RepositoryState state = repo.getRepositoryState(); return RebaseActionHandler.isRebasing(state); }

Target:
private boolean isInRebasingState(Repository repo) { if (repo == null) return false; RepositoryState state = repo.getRepositoryState(); return state.isRebasing(); }
Source:
private boolean isNonEmpty(@Nullable ICaptureSupplier supplier) { if (supplier != null && !supplier.isEmpty()) { return true; } return false; }

Target:
private boolean isNonEmpty(@Nullable ICaptureSupplier supplier) { return supplier != null && !supplier.isEmpty(); }
Source:
@Nullable public LatLng parseLatLng(String value) { if (value == null) { return null; } String[] components = value.split(","); if (components.length != 2) { return null; } try { return new LatLng(Double.valueOf(components[0]), Double.valueOf(components[1])); } catch (NumberFormatException e) { return null; } }

Target:
@Nullable public static LatLng parseLatLng(String value) { if (value == null) { return null; } String[] components = value.split(","); if (components.length != 2) { return null; } try { return new LatLng(Double.valueOf(components[0]), Double.valueOf(components[1])); } catch (NumberFormatException e) { return null; } }