auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String getValidity(X509Certificate certificate) { SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); return new StringBuilder() .append("Issued On: ").append(dateFormat.format(certificate.getNotBefore())).append('\n') .append(EXPIRES_ON_PREFIX).append(dateFormat.format(certificate.getNotAfter())) .toString(); }

Target:
private String getValidity(X509Certificate certificate) { SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); return new StringBuilder() .append(ISSUED_ON_PREFIX).append(dateFormat.format(certificate.getNotBefore())).append('\n') .append(EXPIRES_ON_PREFIX).append(dateFormat.format(certificate.getNotAfter())) .toString(); }
Source:
public List<Long> getAgentProvider(String providedServiceLabel, long accountId) { final Map<Long, Integer> result = new HashMap<>(); create().select(INSTANCE.AGENT_ID, LABEL.VALUE) .from(INSTANCE) .join(INSTANCE_LABEL_MAP) .on(INSTANCE_LABEL_MAP.INSTANCE_ID.eq(INSTANCE.ID)) .join(LABEL) .on(LABEL.ID.eq(INSTANCE_LABEL_MAP.LABEL_ID).and(LABEL.KEY.eq(providedServiceLabel))) .where(INSTANCE.ACCOUNT_ID.eq(accountId) .and(INSTANCE.AGENT_ID.isNotNull()) .and(INSTANCE.STATE.eq(InstanceConstants.STATE_RUNNING)) .and(INSTANCE.HEALTH_STATE.in(HealthcheckConstants.HEALTH_STATE_HEALTHY, HealthcheckConstants.HEALTH_STATE_UPDATING_HEALTHY))) .orderBy(INSTANCE.AGENT_ID.asc()) .fetchInto(new RecordHandler<Record2<Long, String>>() { @Override public void next(Record2<Long, String> record) { Long agentId = record.getValue(INSTANCE.AGENT_ID); String p = record.getValue(LABEL.VALUE); Integer pVal = 1; try { pVal = Integer.valueOf(p); } catch (Exception e) { log.warn("Priority value not found for agent {}. Set it as default", agentId); } result.put(agentId, pVal); } }); List<Long> returnAgentIds = new ArrayList<>(result.keySet()); Collections.sort(returnAgentIds, new Comparator<Long>() { @Override public int compare(Long id1, Long id2) { if (result.get(id1) > result.get(id2)) { return 1; } else if (result.get(id1) < result.get(id2)) { return -1; } return 0; } }); return returnAgentIds; }

Target:
public List<Long> getAgentProvider(String providedServiceLabel, long accountId) { final Map<Long, Integer> result = new HashMap<>(); create().select(INSTANCE.AGENT_ID, LABEL.VALUE) .from(INSTANCE) .join(INSTANCE_LABEL_MAP) .on(INSTANCE_LABEL_MAP.INSTANCE_ID.eq(INSTANCE.ID)) .join(LABEL) .on(LABEL.ID.eq(INSTANCE_LABEL_MAP.LABEL_ID).and(LABEL.KEY.eq(providedServiceLabel))) .join(INSTANCE_HOST_MAP) .on(INSTANCE.ID.eq(INSTANCE_HOST_MAP.INSTANCE_ID)) .join(HOST) .on(INSTANCE_HOST_MAP.HOST_ID.eq(HOST.ID)) .join(AGENT) .on(AGENT.ID.eq(HOST.AGENT_ID)) .where(INSTANCE.ACCOUNT_ID.eq(accountId) .and(INSTANCE.AGENT_ID.isNotNull()) .and(INSTANCE.STATE.eq(InstanceConstants.STATE_RUNNING)) .and(INSTANCE.HEALTH_STATE.in(HealthcheckConstants.HEALTH_STATE_HEALTHY, HealthcheckConstants.HEALTH_STATE_UPDATING_HEALTHY))) .and(AGENT.STATE.eq(CommonStatesConstants.ACTIVE)) .orderBy(INSTANCE.AGENT_ID.asc()) .fetchInto(new RecordHandler<Record2<Long, String>>() { @Override public void next(Record2<Long, String> record) { Long agentId = record.getValue(INSTANCE.AGENT_ID); String p = record.getValue(LABEL.VALUE); Integer pVal = 1; try { pVal = Integer.valueOf(p); } catch (Exception e) { log.warn("Priority value not found for agent {}. Set it as default", agentId); } result.put(agentId, pVal); } }); List<Long> returnAgentIds = new ArrayList<>(result.keySet()); Collections.sort(returnAgentIds, new Comparator<Long>() { @Override public int compare(Long id1, Long id2) { return result.get(id1).compareTo(result.get(id2)); } }); return returnAgentIds; }
Source:
public OAuth2Error checkError() { if (StringUtils.isBlank(responseType) || StringUtils.isBlank(clientId) || StringUtils.isBlank(redirectUri) || !OAuth2Client.isRedirectURIValid(redirectUri) || StringUtils.isBlank(state)) { return OAuth2Error.INVALID_REQUEST; } ClientRegistry registry = Framework.getService(ClientRegistry.class); OAuth2Client client = null; try { client = registry.getClient(clientId); if (client == null || !client.isEnabled()) { return OAuth2Error.UNAUTHORIZED_CLIENT; } } catch (DirectoryException e) { log.warn(e, e); return OAuth2Error.SERVER_ERROR; } String clientName = client.getName(); if (StringUtils.isBlank(clientName)) { log.error(String.format( "No name set for OAuth2 client %s. It is a required field, please make sure you update this OAuth2 client.", client)); } String clientRequestURI = client.getRedirectURI(); if (StringUtils.isBlank(clientRequestURI)) { log.error(String.format( "No redirect URI set for OAuth2 client %s. It is required to validate the %s parameter, please make sure you update this OAuth2 client.", client, OAuth2Request.REDIRECT_URI)); return OAuth2Error.INVALID_REQUEST; } if (!redirectUri.equals(clientRequestURI)) { return OAuth2Error.INVALID_REQUEST; } if (!"code".equals(responseType)) { return OAuth2Error.UNSUPPORTED_RESPONSE_TYPE; } return null; }

Target:
public OAuth2Error checkError() { if (StringUtils.isBlank(responseType) || StringUtils.isBlank(clientId) || StringUtils.isBlank(redirectUri) || !OAuth2Client.isRedirectURIValid(redirectUri) || StringUtils.isBlank(state)) { return OAuth2Error.INVALID_REQUEST; } ClientRegistry registry = Framework.getService(ClientRegistry.class); OAuth2Client client = null; try { client = registry.getClient(clientId); if (client == null || !client.isEnabled()) { return OAuth2Error.UNAUTHORIZED_CLIENT; } } catch (DirectoryException e) { log.warn(e, e); return OAuth2Error.SERVER_ERROR; } String clientName = client.getName(); if (StringUtils.isBlank(clientName)) { log.error(String.format( "No name set for OAuth2 client %s. It is a required field, please make sure you update this OAuth2 client.", client)); } String clientRequestURI = client.getRedirectURI(); if (StringUtils.isBlank(clientRequestURI)) { log.error(String.format( "No redirect URI set for OAuth2 client %s. It is required to validate the %s parameter, please make sure you update this OAuth2 client.", client, REDIRECT_URI_PARAM)); return OAuth2Error.INVALID_REQUEST; } if (!redirectUri.equals(clientRequestURI)) { return OAuth2Error.INVALID_REQUEST; } if (!CODE_RESPONSE_TYPE.equals(responseType)) { return OAuth2Error.UNSUPPORTED_RESPONSE_TYPE; } return null; }
Source:
void serializeRecordedEvents(List<RecordedEvent> events, String filePath) { try { JsonWriter writer = new JsonWriter(new FileWriter(filePath)); writer.beginObject(); writer.name("events"); writer.beginArray(); for (RecordedEvent event : events) { writer.beginObject(); writer.name("entityRef_ID").value(event.getEntityRefId()); writer.name("timestamp").value(event.getTimestamp()); writer.name("position").value(event.getPosition()); writer.name("event_class").value(event.getEvent().getClass().toString()); writer.name("event_data"); writer.beginObject(); writeSpecificEventData(writer, event.getEvent()); writer.endObject(); writer.endObject(); } writer.endArray(); writer.endObject(); writer.close(); } catch (Exception e) { e.printStackTrace(); } }

Target:
void serializeRecordedEvents(List<RecordedEvent> events, String filePath) { try { JsonWriter writer = new JsonWriter(new FileWriter(filePath)); writer.beginObject(); writer.name("events"); writer.beginArray(); for (RecordedEvent event : events) { writer.beginObject(); writer.name("entityRef_ID").value(event.getEntityId()); writer.name("timestamp").value(event.getTimestamp()); writer.name("position").value(event.getPosition()); writer.name("event_class").value(event.getEvent().getClass().toString()); writer.name("event_data"); writer.beginObject(); writeSpecificEventData(writer, event.getEvent()); writer.endObject(); writer.endObject(); } writer.endArray(); writer.endObject(); writer.close(); } catch (Exception e) { logger.error("Error while serializing events:", e); } }
Source:
private static LocalTime changeHours(LocalTime localTime, int hoursDelta) { final Timestamp time = Timestamps.getCurrentTime(); final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, localTime.getHours()); calendar.set(Calendar.MINUTE, localTime.getMinutes()); calendar.set(Calendar.SECOND, localTime.getSeconds()); calendar.set(Calendar.MILLISECOND, localTime.getMillis()); calendar.add(Calendar.HOUR, hoursDelta); final int hours = calendar.get(Calendar.HOUR); final int minutes = calendar.get(Calendar.MINUTE); final int seconds = calendar.get(Calendar.SECOND); final int millis = calendar.get(Calendar.MILLISECOND); final long nanos = time.getNanos(); final LocalTime result = LocalTime.newBuilder() .setHours(hours) .setMinutes(minutes) .setSeconds(seconds) .setMillis(millis) .setNanos(nanos) .build(); return result; }

Target:
private static LocalTime changeHours(LocalTime localTime, int hoursDelta) { return add(localTime, HOUR, hoursDelta); }
Source:
private void doCopyRetry(FileSystem sourceFs, List<ReplChangeManager.FileInfo> srcFileList, FileSystem destinationFs, Path destination, boolean useRegularCopy) throws IOException, LoginException, HiveFatalException { int repeat = 0; boolean isCopyError = false; List<Path> pathList = Lists.transform(srcFileList, ReplChangeManager.FileInfo::getEffectivePath); while (!pathList.isEmpty() && (repeat < MAX_COPY_RETRY)) { try { if (repeat > 0) { pathList = getFilesToRetry(sourceFs, srcFileList, destinationFs, destination, isCopyError); if (pathList.isEmpty()) { break; } } LOG.info("Attempt: " + (repeat+1) + ". Copying files: " + pathList); isCopyError = true; doCopyOnce(sourceFs, pathList, destinationFs, destination, useRegularCopy); isCopyError = false; } catch (IOException e) { LOG.info("file operation failed", e); if (repeat >= (MAX_COPY_RETRY - 1)) { break; } if (!(e instanceof FileNotFoundException)) { int sleepTime = FileUtils.getSleepTime(repeat); LOG.info("Sleep for " + sleepTime + " milliseconds before retry " + (repeat+1)); try { Thread.sleep(sleepTime); } catch (InterruptedException timerEx) { LOG.info("sleep interrupted", timerEx.getMessage()); } FileSystem.closeAllForUGI(Utils.getUGI()); sourceFs = pathList.get(0).getFileSystem(hiveConf); destinationFs = destination.getFileSystem(hiveConf); } } repeat++; } if (!pathList.isEmpty()) { LOG.error("File copy failed even after several attempts. Files list: " + pathList); throw new IOException(ErrorMsg.REPL_FILE_SYSTEM_RETRY.getMsg()); } }

Target:
private void doCopyRetry(FileSystem sourceFs, List<ReplChangeManager.FileInfo> srcFileList, FileSystem destinationFs, Path destination, boolean useRegularCopy) throws IOException, LoginException, HiveFatalException { int repeat = 0; boolean isCopyError = false; List<Path> pathList = Lists.transform(srcFileList, ReplChangeManager.FileInfo::getEffectivePath); while (!pathList.isEmpty() && (repeat < MAX_COPY_RETRY)) { try { if (repeat > 0) { pathList = getFilesToRetry(sourceFs, srcFileList, destinationFs, destination, isCopyError); if (pathList.isEmpty()) { break; } } LOG.info("Attempt: " + (repeat+1) + ". Copying files: " + pathList); isCopyError = true; doCopyOnce(sourceFs, pathList, destinationFs, destination, useRegularCopy); isCopyError = false; } catch (IOException e) { LOG.info("file operation failed", e); if (repeat >= (MAX_COPY_RETRY - 1)) { break; } if (!(e instanceof FileNotFoundException)) { int sleepTime = FileUtils.getSleepTime(repeat); LOG.info("Sleep for " + sleepTime + " milliseconds before retry " + (repeat+1)); try { Thread.sleep(sleepTime); } catch (InterruptedException timerEx) { LOG.info("sleep interrupted", timerEx.getMessage()); } FileSystem.closeAllForUGI(Utils.getUGI()); sourceFs = pathList.get(0).getFileSystem(hiveConf); destinationFs = destination.getFileSystem(hiveConf); } } repeat++; } if (!pathList.isEmpty()) { LOG.error("File copy failed even after several attempts. Files list: " + pathList); throw new IOException(ErrorMsg.REPL_FILE_SYSTEM_OPERATION_RETRY.getMsg()); } }
Source:
private static void fillRwadefGeneralInformation(Swagger swagger, Definition definition, List<String> produces, List<String> consumes) { Info info = swagger.getInfo(); if (info.getContact() != null) { org.restlet.ext.apispark.internal.model.Contact contact = new org.restlet.ext.apispark.internal.model.Contact(); contact.setEmail(info.getContact().getEmail()); contact.setName(info.getContact().getName()); contact.setUrl(info.getContact().getUrl()); definition.setContact(contact); } if (info.getLicense() != null) { org.restlet.ext.apispark.internal.model.License license = new org.restlet.ext.apispark.internal.model.License(); license.setName(info.getLicense().getName()); license.setUrl(info.getLicense().getUrl()); definition.setLicense(license); } Contract contract = new Contract(); contract.setDescription(info.getDescription()); contract.setName(info.getTitle()); definition.setContract(contract); if (swagger.getProduces() != null) { produces.addAll(swagger.getProduces()); } if (swagger.getConsumes() != null) { consumes.addAll(swagger.getConsumes()); } definition.setVersion(info.getVersion()); definition.setTermsOfService(info.getTermsOfService()); definition.setAttribution(null); definition.setKeywords(new ArrayList<String>()); }

Target:
private static void fillRwadefGeneralInformation(Swagger swagger, Definition definition, List<String> produces, List<String> consumes) { Info info = swagger.getInfo(); if (info.getContact() != null) { org.restlet.ext.apispark.internal.model.Contact contact = new org.restlet.ext.apispark.internal.model.Contact(); contact.setEmail(info.getContact().getEmail()); contact.setName(info.getContact().getName()); contact.setUrl(info.getContact().getUrl()); definition.setContact(contact); } if (info.getLicense() != null) { org.restlet.ext.apispark.internal.model.License license = new org.restlet.ext.apispark.internal.model.License(); license.setName(info.getLicense().getName()); license.setUrl(info.getLicense().getUrl()); definition.setLicense(license); } Contract contract = new Contract(); contract.setDescription(info.getDescription()); contract.setName(info.getTitle()); definition.setContract(contract); if (swagger.getProduces() != null) { produces.addAll(swagger.getProduces()); } if (swagger.getConsumes() != null) { consumes.addAll(swagger.getConsumes()); } definition.setVersion(info.getVersion()); definition.setTermsOfService(info.getTermsOfService()); definition.setAttribution(null); }
Source:
protected boolean shouldProcessLine(String itemKey, ConcurStandardAccountingExtractDetailLine saeLine) { switch (saeLine.getPaymentCode()) { case ConcurConstants.PAYMENT_CODE_CASH : return true; case ConcurConstants.PAYMENT_CODE_UNIVERSITY_BILLED_OR_PAID : reportCorporateCardPayment(saeLine); return true; case ConcurConstants.PAYMENT_CODE_PRE_PAID_OR_OTHER : LOG.warn("Found a transaction with a Pre-Paid/Other payment code; it will not be processed. Item key: " + itemKey); reportUnprocessedLine(saeLine, "The line has the Pre-Paid/Other (COPD) payment code"); return false; case ConcurConstants.PAYMENT_CODE_PSEUDO : LOG.warn("Found a transaction with a Pseudo payment code; it will not be processed. Item key: " + itemKey); reportBypassOfLineWithPseudoPaymentCode(saeLine); reportUnprocessedLine(saeLine, "The line has the Pseudo (XXXX) payment code"); return false; default : LOG.warn("Found a transaction with an unknown payment code; it will not be processed. Item key: " + itemKey); reportUnprocessedLine(saeLine, "The line has an unrecognized payment code"); return false; } }

Target:
protected boolean shouldProcessLine(String itemKey, ConcurStandardAccountingExtractDetailLine saeLine) { switch (saeLine.getPaymentCode()) { case ConcurConstants.PAYMENT_CODE_CASH : return true; case ConcurConstants.PAYMENT_CODE_UNIVERSITY_BILLED_OR_PAID : reportCorporateCardPayment(saeLine); return true; case ConcurConstants.PAYMENT_CODE_PRE_PAID_OR_OTHER : reportUnprocessedLine(saeLine, "The line has the Pre-Paid/Other (COPD) payment code"); return false; case ConcurConstants.PAYMENT_CODE_PSEUDO : reportBypassOfLineWithPseudoPaymentCode(saeLine); reportUnprocessedLine(saeLine, "The line has the Pseudo (XXXX) payment code"); return false; default : reportUnprocessedLine(saeLine, "The line has an unrecognized payment code"); return false; } }
Source:
private AtomicOperation doJsonify(List<Long> records, boolean includePrimaryKey, Compoundable store, StringBuilder jsonStr) { AtomicOperation operation = store.startAtomicOperation(); try { Map<Long, Map<String, Set<Object>>> result = Maps.newHashMap(); Map<String, Set<Object>> resultNoKey = Maps.newHashMap(); for (Long record: records) { Map<String, Set<Object>> rec = Maps.newHashMap(); Map<String, Set<TObject>> r = operation.browse(record); for (Map.Entry<String, Set<TObject>> entry: r.entrySet()) { Set<Object> values = Transformers.transformSet(entry.getValue(), new Function<TObject, Object>() { @Override public Object apply(TObject input) { return Convert .thriftToJava(input); } }); rec.put(entry.getKey(), values); if (!includePrimaryKey) { resultNoKey.put(entry.getKey(), values); } } if (includePrimaryKey) { result.put(record, rec); } } if (includePrimaryKey){ jsonStr.append(Convert.javaToJson(result)); } else { jsonStr.append(Convert.javaToJson(resultNoKey)); } return operation; } catch (AtomicStateException e) { return null; } }

Target:
private AtomicOperation doJsonify(List<Long> records, boolean includePrimaryKey, Compoundable store, StringBuilder jsonStr) { AtomicOperation operation = store.startAtomicOperation(); try { List<Map<String, Set<Object>>> result = Lists.newLinkedList(); Set<Map<String, Set<Object>>> resultNoKey = Sets.newHashSet(); for (Long record: records) { Map<String, Set<Object>> rec = Maps.newHashMap(); Map<String, Set<TObject>> r = operation.browse(record); for (Map.Entry<String, Set<TObject>> entry: r.entrySet()) { Set<Object> values = Transformers.transformSet(entry.getValue(), Functions.TOBJECT_TO_JAVA); rec.put(entry.getKey(), values); } if (includePrimaryKey) { Set<Object> recordSet = Sets.newHashSet(); recordSet.add(record); rec.put("$primaryKey$", recordSet); result.add(rec); } else { resultNoKey.add(rec); } } if (includePrimaryKey) { jsonStr.append(Convert.javaToJson(result)); } else { jsonStr.append(Convert.javaToJson(resultNoKey)); } return operation; } catch (AtomicStateException e) { return null; } }
Source:
public boolean equals(final Object o) { if (o instanceof IntraLineDiffKey) { final IntraLineDiffKey k = (IntraLineDiffKey) o; return aId.equals(k.aId) && bId.equals(k.bId) && ignoreWhitespace.equals(k.ignoreWhitespace); } return false; }

Target:
public boolean equals(final Object o) { if (o instanceof IntraLineDiffKey) { final IntraLineDiffKey k = (IntraLineDiffKey) o; return aId.equals(k.aId) && bId.equals(k.bId) && ignoreWhitespace == k.ignoreWhitespace; } return false; }
Source:
private Mono<ServicePrincipal> submitRolesAsync(final ServicePrincipal servicePrincipal) { Mono<ServicePrincipal> create; if (rolesToCreate.isEmpty()) { create = Mono.just(servicePrincipal); } else { create = Flux .fromIterable(rolesToCreate.entrySet()) .flatMap( roleEntry -> manager() .roleAssignments() .define(this.manager().sdkContext().randomUuid()) .forServicePrincipal(servicePrincipal) .withBuiltInRole(roleEntry.getValue()) .withScope(roleEntry.getKey()) .createAsync()) .doOnNext( indexable -> cachedRoleAssignments.put((indexable).id(), indexable)) .last() .map( indexable -> { rolesToCreate.clear(); return servicePrincipal; }); } Mono<ServicePrincipal> delete; if (rolesToDelete.isEmpty()) { delete = Mono.just(servicePrincipal); } else { delete = Flux .fromIterable(rolesToDelete) .flatMap( role -> manager() .roleAssignments() .deleteByIdAsync(cachedRoleAssignments.get(role).id()) .thenReturn(role)) .doOnNext(s -> cachedRoleAssignments.remove(s)) .last() .map( s -> { rolesToDelete.clear(); return servicePrincipal; }); } return create.mergeWith(delete).last(); }

Target:
private Mono<ServicePrincipal> submitRolesAsync(final ServicePrincipal servicePrincipal) { Mono<ServicePrincipal> create; if (rolesToCreate.isEmpty()) { create = Mono.just(servicePrincipal); } else { create = Flux .fromIterable(rolesToCreate.entrySet()) .flatMap( roleEntry -> manager() .roleAssignments() .define(this.manager().sdkContext().randomUuid()) .forServicePrincipal(servicePrincipal) .withBuiltInRole(roleEntry.getValue()) .withScope(roleEntry.getKey()) .createAsync()) .doOnNext( indexable -> cachedRoleAssignments.put(indexable.id(), indexable)) .last() .map( indexable -> { rolesToCreate.clear(); return servicePrincipal; }); } Mono<ServicePrincipal> delete; if (rolesToDelete.isEmpty()) { delete = Mono.just(servicePrincipal); } else { delete = Flux .fromIterable(rolesToDelete) .flatMap( role -> manager() .roleAssignments() .deleteByIdAsync(cachedRoleAssignments.get(role).id()) .thenReturn(role)) .doOnNext(s -> cachedRoleAssignments.remove(s)) .last() .map( s -> { rolesToDelete.clear(); return servicePrincipal; }); } return create.mergeWith(delete).last(); }
Source:
protected void handleSuccess(boolean isUseEmulator, @NonNull String providerId, @NonNull FirebaseUser user, @NonNull OAuthCredential credential, boolean isNewUser, boolean setPendingCredential) { String accessToken = isUseEmulator ? "fake_access_token" : credential.getAccessToken(); String secret = isUseEmulator ? "fake_secret" : credential.getAccessToken(); IdpResponse.Builder response = new IdpResponse.Builder( new User.Builder( providerId, user.getEmail()) .setName(user.getDisplayName()) .setPhotoUri(user.getPhotoUrl()) .build()) .setToken(accessToken) .setSecret(secret); if (setPendingCredential) { response.setPendingCredential(credential); } response.setNewUser(isNewUser); setResult(Resource.<IdpResponse>forSuccess(response.build())); }

Target:
protected void handleSuccess(boolean isUseEmulator, @NonNull String providerId, @NonNull FirebaseUser user, @NonNull OAuthCredential credential, boolean isNewUser, boolean setPendingCredential) { String accessToken = credential.getAccessToken(); if (accessToken == null && isUseEmulator) { accessToken = "fake_access_token"; } String secret = credential.getSecret(); if (secret == null && isUseEmulator) { secret = "fake_secret"; } IdpResponse.Builder response = new IdpResponse.Builder( new User.Builder( providerId, user.getEmail()) .setName(user.getDisplayName()) .setPhotoUri(user.getPhotoUrl()) .build()) .setToken(accessToken) .setSecret(secret); if (setPendingCredential) { response.setPendingCredential(credential); } response.setNewUser(isNewUser); setResult(Resource.<IdpResponse>forSuccess(response.build())); }
Source:
private ActionModeWrapper() { }

Target:
private ActionModeWrapper() { onView(TITLE_MATCHER) .check(matches(isDisplayed())); onView(NAVIGATE_UP_MATCHER) .check(matches(isDisplayed())); onView(CONFIRM_MATCHER) .check(matches(isDisplayed())); }
Source:
private void rewireGeneric(GenericConstraint constraint, List<ResolverBundle> visited) { if (constraint.getSelectedSupplier() != null) return; GenericDescription[] suppliers = ((GenericSpecification) constraint.getVersionConstraint()).getSuppliers(); if (suppliers == null) return; VersionHashMap<GenericCapability> namespace = resolverGenerics.get(constraint.getNameSpace()); if (namespace == null) { System.err.println("Could not find matching capability for " + constraint.getVersionConstraint()); return; } String constraintName = constraint.getName(); List<GenericCapability> matches = constraintName == null ? namespace.get(constraintName) : namespace.getAllValues(); for (GenericCapability match : matches) { for (GenericDescription supplier : suppliers) if (match.getBaseDescription() == supplier) constraint.addPossibleSupplier(match); } VersionSupplier[] matchingCapabilities = constraint.getPossibleSuppliers(); if (matchingCapabilities != null) for (VersionSupplier matchingCapabilitie : matchingCapabilities) { rewireBundle(matchingCapabilitie.getResolverBundle(), visited); } }

Target:
private void rewireGeneric(GenericConstraint constraint, List<ResolverBundle> visited) { if (constraint.getSelectedSupplier() != null) return; GenericDescription[] suppliers = ((GenericSpecification) constraint.getVersionConstraint()).getSuppliers(); if (suppliers == null) return; VersionHashMap<GenericCapability> namespace = resolverGenerics.get(constraint.getNameSpace()); if (namespace == null) { System.err.println("Could not find matching capability for " + constraint.getVersionConstraint()); return; } String constraintName = constraint.getName(); List<GenericCapability> matches = constraintName == null ? namespace.get(constraintName) : namespace.getAllValues(); for (GenericCapability match : matches) { for (GenericDescription supplier : suppliers) if (match.getBaseDescription() == supplier) constraint.addPossibleSupplier(match); } VersionSupplier[] matchingCapabilities = constraint.getPossibleSuppliers(); if (matchingCapabilities != null) for (VersionSupplier matchingCapability : matchingCapabilities) { rewireBundle(matchingCapability.getResolverBundle(), visited); } }
Source:
public RepoObjectMetadata getManuscript(ArticleIdentity article) { RepoCollectionMetadata articleCollection = findCollectionFor(article); Map<String, ?> manuscript = (Map<String, ?>) ((Map<String, ?>) articleCollection.getJsonUserMetadata().get()).get("manuscript"); RepoVersion manuscriptVersion = parseRepoVersion(manuscript); RepoObjectMetadata repoObjectMetadata; try { repoObjectMetadata = contentRepoService.getRepoObjectMetadata(manuscriptVersion); } catch (NotFoundException nfe){ throw entityNotFound(nfe.getMessage() + ": " + manuscriptVersion); } return repoObjectMetadata; }

Target:
public RepoObjectMetadata getManuscript(ArticleIdentity article) { RepoCollectionMetadata articleCollection = findCollectionFor(article); Map<String, ?> manuscript = (Map<String, ?>) ((Map<String, ?>) articleCollection.getJsonUserMetadata().get()).get("manuscript"); RepoVersion manuscriptVersion = parseRepoVersion(manuscript); try { return contentRepoService.getRepoObjectMetadata(manuscriptVersion); } catch (NotFoundException nfe){ throw reportNotFound(article, "object metadata", nfe); } }
Source:
protected Collection<GrantedAuthority> extractAuthorities(Jwt jwt) { return JwtAuthorityConverter.getInstance().convert(jwt); }

Target:
protected Collection<GrantedAuthority> extractAuthorities(Jwt jwt) { return this.jwtGrantedAuthoritiesConverter.convert(jwt); }
Source:
public void syncOrTimeout(String path) throws KeeperException { final CountDownLatch latch = new CountDownLatch(1); long startTime = EnvironmentEdgeManager.currentTime(); this.recoverableZooKeeper.sync(path, (i, s, o) -> latch.countDown(), null); try { if (!latch.await(zkSyncTimeout, TimeUnit.MILLISECONDS)) { LOG.error("sync() operation to ZK timed out. Configured timeout: {}ms. This usually points " + "to a ZK side issue. Check ZK server logs and metrics.", zkSyncTimeout); throw new KeeperException.RequestTimeoutException(); } } catch (InterruptedException e) { LOG.warn("Interrupted waiting for ZK sync() to finish.", e); Thread.currentThread().interrupt(); return; } if (LOG.isDebugEnabled()) { LOG.debug("ZK sync() operation took {}ms", EnvironmentEdgeManager.currentTime() - startTime); } }

Target:
public void syncOrTimeout(String path) throws KeeperException { final CountDownLatch latch = new CountDownLatch(1); long startTime = EnvironmentEdgeManager.currentTime(); this.recoverableZooKeeper.sync(path, (i, s, o) -> latch.countDown(), null); try { if (!latch.await(zkSyncTimeout, TimeUnit.MILLISECONDS)) { LOG.warn("sync() operation to ZK timed out. Configured timeout: {}ms. This usually points " + "to a ZK side issue. Check ZK server logs and metrics.", zkSyncTimeout); throw new KeeperException.RequestTimeoutException(); } } catch (InterruptedException e) { LOG.warn("Interrupted waiting for ZK sync() to finish.", e); Thread.currentThread().interrupt(); return; } if (LOG.isDebugEnabled()) { LOG.debug("ZK sync() operation took {}ms", EnvironmentEdgeManager.currentTime() - startTime); } }
Source:
public void testPreconfiguredIteratorWithDefaultIterator3() throws AccumuloException, TableNotFoundException, AccumuloSecurityException, TableExistsException { Connector conn = getConnector(); String tableName = getUniqueNames(2)[0]; NewTableConfiguration ntc = new NewTableConfiguration(); IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar"); ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan)); conn.tableOperations().create(tableName, ntc); check(conn, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"}, true); Map<String,EnumSet<IteratorScope>> iteratorList = conn.tableOperations().listIterators(tableName); assertEquals(2, iteratorList.size()); conn.tableOperations().removeIterator(tableName, "someName", EnumSet.of(IteratorScope.scan)); check(conn, tableName, new String[] {}, true); iteratorList = conn.tableOperations().listIterators(tableName); assertEquals(1, iteratorList.size()); }

Target:
public void testPreconfiguredIteratorWithDefaultIterator3() throws AccumuloException, TableNotFoundException, AccumuloSecurityException, TableExistsException { Connector conn = getConnector(); String tableName = getUniqueNames(2)[0]; NewTableConfiguration ntc = new NewTableConfiguration(); IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar"); ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan)); conn.tableOperations().create(tableName, ntc); verifyIterators(conn, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"}, true); Map<String,EnumSet<IteratorScope>> iteratorList = conn.tableOperations().listIterators(tableName); assertEquals(2, iteratorList.size()); assertEquals(iteratorList.get("someName"), EnumSet.of(IteratorScope.scan)); conn.tableOperations().removeIterator(tableName, "someName", EnumSet.of(IteratorScope.scan)); verifyIterators(conn, tableName, new String[] {}, true); iteratorList = conn.tableOperations().listIterators(tableName); assertEquals(1, iteratorList.size()); }
Source:
public void testStartAndCompleteTaskUseOfAsyncResponseHandler() { ResponseCallback callback = new BlockingResponseCallback(null); testStartAndCompleteTask(new AsyncResponseHandler(callback)); }

Target:
public void testStartAndCompleteTaskUseOfAsyncResponseHandler() throws Exception { ResponseCallback callback = new BlockingResponseCallback(null); testStartAndCompleteTask(new AsyncResponseHandler(callback)); }
Source:
public void shouldBeAbleToRequestARefund_fullAmount() { Long refundAmount = defaultTestCharge.getAmount(); ValidatableResponse validatableResponse = postRefundFor(defaultTestCharge.getExternalChargeId(), refundAmount, defaultTestCharge.getAmount()); String refundId = assertRefundResponseWith(refundAmount, validatableResponse, ACCEPTED.getStatusCode()); List<Map<String, Object>> refundsFoundByChargeId = databaseTestHelper.getRefundsByChargeId(defaultTestCharge.getChargeId()); assertThat(refundsFoundByChargeId.size(), is(1)); assertThat(refundsFoundByChargeId, hasItems(aRefundMatching(refundId, is(notNullValue()), defaultTestCharge.getChargeId(), refundAmount, "REFUNDED"))); assertRefundsHistoryInDBForSuccessfulOrPartialRefund(defaultTestCharge); }

Target:
public void shouldBeAbleToRequestARefund_fullAmount() { Long refundAmount = defaultTestCharge.getAmount(); ValidatableResponse validatableResponse = postRefundFor(defaultTestCharge.getExternalChargeId(), refundAmount, defaultTestCharge.getAmount()); String refundId = assertRefundResponseWith(refundAmount, validatableResponse, ACCEPTED.getStatusCode()); List<Map<String, Object>> refundsFoundByChargeId = databaseTestHelper.getRefundsByChargeId(defaultTestCharge.getChargeId()); assertThat(refundsFoundByChargeId.size(), is(1)); assertThat(refundsFoundByChargeId, hasItems(aRefundMatching(refundId, is(notNullValue()), defaultTestCharge.getChargeId(), refundAmount, "REFUNDED"))); assertRefundsHistoryInOrderInDBForSuccessfulOrPartialRefund(defaultTestCharge); }
Source:
private boolean hasFallback(){ return properties.get("fallback") != null; }

Target:
private boolean hasFallback(){ return properties.containsKey("fallback"); }
Source:
public void readFilter(InputStream input, OutputStream output, String charset, HashMap<String, String> otherParams, FilterCallback cb) throws DataFilterException, IOException { boolean isComment = false; boolean isBadUri = false; int numberOfDotsInUri = 0; int readcount; byte[] nextbyte = new byte[1]; byte[] fileUri; int fileIndex; String uriForcetypeMp3Suffix = "?type=audio/mpeg"; try (DataInputStream dis = new DataInputStream(input)) { readcount = dis.read(nextbyte); while (readcount != -1) { if (Arrays.equals(nextbyte, CHAR_COMMENT_START)) { isComment = true; } else { isComment = false; } numberOfDotsInUri = 0; isBadUri = false; fileIndex = 0; fileUri = new byte[MAX_URI_LENGTH]; while (readcount != -1) { if (!isComment && !Arrays.equals(nextbyte, CHAR_CARRIAGE_RETURN) && fileIndex <= MAX_URI_LENGTH) { fileUri[fileIndex] = nextbyte[0]; fileIndex += readcount; } readcount = dis.read(nextbyte); if (Arrays.equals(nextbyte, CHAR_NEWLINE)) { if (!isComment) { if (fileIndex <= MAX_URI_LENGTH) { for (int i = 0; i < fileIndex; i++) { byte b = fileUri[i]; if (!isAllowedInUri(b)) { isBadUri = true; break; } if ((byte)'.' == b) { numberOfDotsInUri += 1; } } if (numberOfDotsInUri != 1) { isBadUri = true; } String uri; if (isBadUri) { uri = badUriReplacement; } else { uri = new String(fileUri, 0, fileIndex, "UTF-8"); uri += uriForcetypeMp3Suffix; } output.write(uri.getBytes("UTF-8")); output.write(nextbyte); } } readcount = dis.read(nextbyte); break; } } } } output.flush(); }

Target:
public void readFilter(InputStream input, OutputStream output, String charset, HashMap<String, String> otherParams, FilterCallback cb) throws DataFilterException, IOException { boolean isComment = false; boolean isBadUri = false; int numberOfDotsInUri = 0; int readcount; byte[] nextbyte = new byte[1]; byte[] fileUri; int fileIndex; String uriForcetypeMp3Suffix = "?type=audio/mpeg"; try (DataInputStream dis = new DataInputStream(input); DataOutputStream dos = new DataOutputStream(output)) { readcount = dis.read(nextbyte); while (readcount != -1) { if (isCommentStart(nextbyte)) { isComment = true; } else { isComment = false; } if (isNewline(nextbyte)) { readcount = dis.read(nextbyte); continue; } numberOfDotsInUri = 0; isBadUri = false; fileIndex = 0; fileUri = new byte[MAX_URI_LENGTH]; while (readcount != -1) { if (!isComment && !isCarriageReturn(nextbyte) && fileIndex <= MAX_URI_LENGTH) { fileUri[fileIndex] = nextbyte[0]; fileIndex += readcount; } readcount = dis.read(nextbyte); if (isNewline(nextbyte) || readcount == -1) { if (!isComment) { if (fileIndex <= MAX_URI_LENGTH) { String uriold = new String(fileUri, 0, fileIndex, "UTF-8"); String filtered; try { if (uriold.endsWith(".m3u") || uriold.endsWith(".m3u8")) { filtered = cb.processURI(uriold, "audio/mpegurl"); } else { filtered = cb.processURI(uriold, "audio/mpeg"); } } catch (CommentException e) { filtered = badUriReplacement; } if (filtered == null) { filtered = badUriReplacement; } dos.write(filtered.getBytes("UTF-8")); if (readcount != -1){ dos.write(nextbyte); } } } readcount = dis.read(nextbyte); break; } } } } }
Source:
private EncryptionData getAndValidateEncryptionData(String encryptedDataString) { if (encryptedDataString == null) { throw logger.logExceptionAsError(new IllegalStateException(CryptographyConstants.DECRYPT_UNENCRYPTED_BLOB)); } ObjectMapper objectMapper = new ObjectMapper(); try { EncryptionData encryptionData = objectMapper.readValue(encryptedDataString, EncryptionData.class); if (encryptionData == null) { throw logger.logExceptionAsError(new IllegalStateException( CryptographyConstants.DECRYPT_UNENCRYPTED_BLOB)); } Objects.requireNonNull(encryptionData.contentEncryptionIV()); Objects.requireNonNull(encryptionData.wrappedContentKey().getEncryptedKey()); if (!CryptographyConstants.ENCRYPTION_PROTOCOL_V1.equals(encryptionData.encryptionAgent().getProtocol())) { throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.ROOT, "Invalid Encryption Agent. This version of the client library does not understand the " + "Encryption Agent set on the blob message: %s", encryptionData.encryptionAgent()))); } return encryptionData; } catch (IOException e) { throw logger.logExceptionAsError(new RuntimeException(e)); } }

Target:
private EncryptionData getAndValidateEncryptionData(String encryptedDataString) { if (encryptedDataString == null) { return null; } ObjectMapper objectMapper = new ObjectMapper(); try { EncryptionData encryptionData = objectMapper.readValue(encryptedDataString, EncryptionData.class); if (encryptionData == null) { return encryptionData; } Objects.requireNonNull(encryptionData.getContentEncryptionIV(), "contentEncryptionIV in encryptionData " + "cannot be null"); Objects.requireNonNull(encryptionData.getWrappedContentKey().getEncryptedKey(), "encryptedKey in " + "encryptionData.wrappedContentKey cannot be null"); if (!CryptographyConstants.ENCRYPTION_PROTOCOL_V1 .equals(encryptionData.getEncryptionAgent().getProtocol())) { throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.ROOT, "Invalid Encryption Agent. This version of the client library does not understand the " + "Encryption Agent set on the blob message: %s", encryptionData.getEncryptionAgent()))); } return encryptionData; } catch (IOException e) { throw logger.logExceptionAsError(new RuntimeException(e)); } }
Source:
NativeVideoAdLoader( NendNativeAdForwarder forwarder, AdUnitMapper mapper, NativeMediationAdRequest nativeMediationAdRequest, Bundle mediationExtras) { Context context = forwarder.contextWeakReference.get(); if (context == null) { Log.e(TAG, "Your context may be released..."); forwarder.failedToLoad(AdRequest.ERROR_CODE_INVALID_REQUEST); return; } this.forwarder = forwarder; VideoOptions nativeVideoOptions = nativeMediationAdRequest.getNativeAdOptions().getVideoOptions(); if (nativeVideoOptions == null) { videoAdLoader = new NendAdNativeVideoLoader(context, mapper.spotId, mapper.apiKey, NendAdNativeVideo.VideoClickOption.LP); } else { videoAdLoader = new NendAdNativeVideoLoader(context, mapper.spotId, mapper.apiKey, (nativeVideoOptions.getClickToExpandRequested() ? NendAdNativeVideo.VideoClickOption.FullScreen : NendAdNativeVideo.VideoClickOption.LP) ); } videoAdLoader.setMediationName(MEDIATION_NAME_ADMOB); videoAdLoader.setUserId(mediationExtras.getString(NendMediationAdapter.KEY_USER_ID, "")); }

Target:
NativeVideoAdLoader( NendNativeAdForwarder forwarder, AdUnitMapper mapper, NativeMediationAdRequest nativeMediationAdRequest, Bundle mediationExtras) { Context context = forwarder.getContextFromWeakReference(); if (context == null) { Log.e(TAG, "Your context may be released..."); forwarder.failedToLoad(AdRequest.ERROR_CODE_INVALID_REQUEST); return; } this.forwarder = forwarder; NendAdNativeVideo.VideoClickOption clickOption = NendAdNativeVideo.VideoClickOption.LP; VideoOptions nativeVideoOptions = nativeMediationAdRequest.getNativeAdOptions().getVideoOptions(); if (nativeVideoOptions != null && nativeVideoOptions.getClickToExpandRequested()) { clickOption = NendAdNativeVideo.VideoClickOption.FullScreen; } videoAdLoader = new NendAdNativeVideoLoader(context, mapper.spotId, mapper.apiKey, clickOption); videoAdLoader.setMediationName(MEDIATION_NAME_ADMOB); if (mediationExtras != null) { videoAdLoader.setUserId(mediationExtras.getString(NendMediationAdapter.KEY_USER_ID, "")); } }
Source:
static Map<String, Map<String, Integer>> getConstraintMap(TopologyDetails topo, Set<String> comps) { Map<String, Map<String, Integer>> matrix = new HashMap<>(); for (String comp : comps) { matrix.put(comp, new HashMap<>()); for (String comp2 : comps) { matrix.get(comp).put(comp2, 0); } } List<List<String>> constraints = (List<List<String>>) topo.getConf().get(Config.TOPOLOGY_CONSTRAINTS); if (constraints != null) { for (List<String> constraintPair : constraints) { String comp1 = constraintPair.get(0); String comp2 = constraintPair.get(1); if (!matrix.containsKey(comp1)) { LOG.warn("Comp: declared in constraints is not valid!", comp1); continue; } if (!matrix.containsKey(comp2)) { LOG.warn("Comp: declared in constraints is not valid!", comp2); continue; } matrix.get(comp1).put(comp2, 1); matrix.get(comp2).put(comp1, 1); } } return matrix; }

Target:
static Map<String, Map<String, Integer>> getConstraintMap(TopologyDetails topo, Set<String> comps) { Map<String, Map<String, Integer>> matrix = new HashMap<>(); for (String comp : comps) { matrix.put(comp, new HashMap<>()); for (String comp2 : comps) { matrix.get(comp).put(comp2, 0); } } List<List<String>> constraints = (List<List<String>>) topo.getConf().get(Config.TOPOLOGY_RAS_CONSTRAINTS); if (constraints != null) { for (List<String> constraintPair : constraints) { String comp1 = constraintPair.get(0); String comp2 = constraintPair.get(1); if (!matrix.containsKey(comp1)) { LOG.warn("Comp: declared in constraints is not valid!", comp1); continue; } if (!matrix.containsKey(comp2)) { LOG.warn("Comp: declared in constraints is not valid!", comp2); continue; } matrix.get(comp1).put(comp2, 1); matrix.get(comp2).put(comp1, 1); } } return matrix; }
Source:
public boolean checkForUpdate(String currentVersion) { if (currentVersion == null || currentVersion.equals("UNOFFICIAL")) return false; int latest = getLatestVersion(); if (latest > Integer.parseInt(currentVersion)) { return download(latest); } return false; }

Target:
public boolean checkForUpdate(String currentVersion) { if (currentVersion == null || !PatternUtils.NUMERIC.matcher(currentVersion).matches()) { return false; } int latest = getLatestVersion(); if (latest > Integer.parseInt(currentVersion)) { return download(latest); } return false; }
Source:
private static List<LogEntry> readLog(String logPath) throws FileNotFoundException, IOException { if (logPath == null) { return Collections.emptyList(); } List<LogEntry> log = new ArrayList<>(); try (BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(logPath), UTF_8))) { @SuppressWarnings("nls") Pattern pattern = Pattern.compile("([^,]+)" + ",([0-9]+(?:[.][0-9]+)?)" + ",([^,]+)" + ",([^,]+)" + ",([^,]+)" + ",(.*)"); String line; while ((line = br.readLine()) != null) { Matcher m = pattern.matcher(line); if (m.matches()) { String ref = m.group(1); double t = Double.parseDouble(m.group(2)); long time = ((long) t) * 1000L; long index = (long) (t * 1e6); String user = m.group(3); ObjectId oldId = parseId(m.group(4)); ObjectId newId = parseId(m.group(5)); String msg = m.group(6); String email = user + "@gerrit"; PersonIdent who = new PersonIdent(user, email, time, -480); log.add(new LogEntry(ref, index, who, oldId, newId, msg)); } } } Collections.sort(log, LogEntry::compare); return log; }

Target:
private static List<LogEntry> readLog(String logPath) throws FileNotFoundException, IOException { if (logPath == null) { return Collections.emptyList(); } List<LogEntry> log = new ArrayList<>(); try (BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(logPath), UTF_8))) { @SuppressWarnings("nls") Pattern pattern = Pattern.compile("([^,]+)" + ",([0-9]+(?:[.][0-9]+)?)" + ",([^,]+)" + ",([^,]+)" + ",([^,]+)" + ",(.*)"); String line; while ((line = br.readLine()) != null) { Matcher m = pattern.matcher(line); if (!m.matches()) { throw new IOException("unparsed line: " + line); } String ref = m.group(1); double t = Double.parseDouble(m.group(2)); long time = ((long) t) * 1000L; long index = (long) (t * 1e6); String user = m.group(3); ObjectId oldId = parseId(m.group(4)); ObjectId newId = parseId(m.group(5)); String msg = m.group(6); String email = user + "@gerrit"; PersonIdent who = new PersonIdent(user, email, time, -480); log.add(new LogEntry(ref, index, who, oldId, newId, msg)); } } Collections.sort(log, LogEntry::compare); return log; }
Source:
public boolean isTimeDetectionEnabled() { try { return Settings.Global.getInt(mContentResolver, Settings.Global.AUTO_TIME) > 0; } catch (Settings.SettingNotFoundException snfe) { return true; } }

Target:
public boolean isTimeDetectionEnabled() { try { return Settings.Global.getInt(mContentResolver, Settings.Global.AUTO_TIME) != 0; } catch (Settings.SettingNotFoundException snfe) { return true; } }
Source:
private boolean addToThreadList(ContextManager associateCM) { ContextManagerLink link = threadContextList.get(); if (link == null){ link = new ContextManagerLink(associateCM, null); threadContextList.set(link); return true; } if (associateCM == link.cm) { return true; } if (link.next == null) { ContextManager threadsCM = link.cm; if (threadsCM.activeThread != Thread.currentThread()) { link.cm = associateCM; return true; } link = null; for (int i = 0; i < threadsCM.activeCount; i++) { link = new ContextManagerLink(threadsCM, link); } threadsCM.activeCount = -1; } link = new ContextManagerLink(associateCM, link); threadContextList.set(link); associateCM.activeCount=-1; if(SanityManager.DEBUG){ if(SanityManager.DEBUG_ON("memoryLeakTrace")) { int size = 0; for (; link != null; link = link.next) ++size; if (size > 10) System.out.println("memoryLeakTrace:ContextService:threadLocal " + size); } } return false; }

Target:
private boolean addToThreadList(ContextManager associateCM) { ContextManagerLink link = threadContextList.get(); if (link == null){ link = new ContextManagerLink(associateCM, null); threadContextList.set(link); return true; } if (associateCM == link.cm) { return true; } if (link.next == null) { ContextManager threadsCM = link.cm; if (threadsCM.activeThread != Thread.currentThread()) { link.cm = associateCM; return true; } link = null; for (int i = 0; i < threadsCM.activeCount; i++) { link = new ContextManagerLink(threadsCM, link); } threadsCM.activeCount = -1; } link = new ContextManagerLink(associateCM, link); threadContextList.set(link); associateCM.activeCount=-1; if (LOG.isTraceEnabled()) { int size = 0; for (; link != null; link = link.next) ++size; if (size > 10) { LOG.trace("memoryLeakTrace:threadLocal " + size); } } return false; }
Source:
public void init() { jobNameLabel.addRequiredIndicator(); jobTypeLabel.addRequiredIndicator(); jobRetriesLabel.addRequiredIndicator(); jobRetriesInput.setType("number"); jobRetriesInput.setAttribute("min", "0"); jobRetriesInput.setDefaultValue("0"); jobRetriesInput.addEventListener("keypress", getNumericInputListener(), false); myParametersGrid.setHeight("200px"); myParametersGrid.setEmptyTableWidget(new Label(constants.No_Parameters_added_yet())); initGridColumns(); initDateTimePicker(); Button button = new Button(Constants.INSTANCE.Add_Parameter(), new ClickHandler() { @Override public void onClick(ClickEvent event) { addNewParameter(); } }); button.addStyleName("btn btn-default"); advancedContent.add(myParametersGrid); advancedContent.add(button); inlineNotification.setType(InlineNotification.InlineNotificationType.DANGER); }

Target:
public void init() { jobNameLabel.addRequiredIndicator(); jobTypeLabel.addRequiredIndicator(); jobRetriesLabel.addRequiredIndicator(); jobRetriesInput.setType("number"); jobRetriesInput.setAttribute("min", "0"); jobRetriesInput.setDefaultValue("0"); jobRetriesInput.addEventListener("keypress", getNumericInputListener(), false); myParametersGrid.setHeight("200px"); myParametersGrid.setEmptyTableWidget(new Label(constants.No_Parameters_added_yet())); initGridColumns(); initDateTimePicker(); Button button = GWT.create(Button.class); button.setText(Constants.INSTANCE.Add_Parameter()); button.addClickHandler(e -> addNewParameter()); advancedContent.add(myParametersGrid); advancedContent.add(button); inlineNotification.setType(InlineNotification.InlineNotificationType.DANGER); }
Source:
public List<ConstrainedValue> getValuesWithConstraints(final Object state) { final List<ConstrainedValue> result = new ArrayList<>(); constraints.forEach(new PMap.Consumer<SymbolicValue, Object>() { @Override public void accept(SymbolicValue value, Object valueConstraint) { if (valueConstraint instanceof ObjectConstraint) { ObjectConstraint constraint = (ObjectConstraint) valueConstraint; if (constraint.hasStatus(state)) { result.add(new ConstrainedValue(value, constraint)); } } } }); return result; }

Target:
public Map<SymbolicValue, ObjectConstraint> getValuesWithConstraints(final Object state) { final Map<SymbolicValue, ObjectConstraint> result = new HashMap<>(); constraints.forEach(new PMap.Consumer<SymbolicValue, Object>() { @Override public void accept(SymbolicValue value, Object valueConstraint) { if (valueConstraint instanceof ObjectConstraint) { ObjectConstraint constraint = (ObjectConstraint) valueConstraint; if (constraint.hasStatus(state)) { result.put(value, constraint); } } } }); return result; }