auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void threadMessages(List<EmailMessage> emailMessages, String threadIDPrefix) { HashMap<String, Container> id_table = createIDTable(emailMessages); Set<Container> rootSet = getRootSet(id_table); pruneEmptyContainers(rootSet); Set<Container> finalSet = groupBySubject(rootSet); assignThreadIDs(finalSet, threadIDPrefix); }

Target:
public static void threadMessages(List<EmailMessage> emailMessages, String threadIDPrefix) { EmailMessageThreader instance = new EmailMessageThreader(); Map<String, EmailContainer> id_table = instance.createIDTable(emailMessages); Set<EmailContainer> rootSet = instance.getRootSet(id_table); instance.pruneEmptyContainers(rootSet); Set<EmailContainer> finalRootSet = instance.groupBySubject(rootSet); instance.assignThreadIDs(finalRootSet, threadIDPrefix); }
Source:
public void processEvent(DiscoveryServiceEvent event) { switch (event.type) { case ACQUIRE_LOCK: processLockAcquire(); break; case RELEASE_LOCK: processLockRelease(); break; case DISCOVERED_TOPOLOGY: processTopologyChangeNotification(event); break; case UPGRADE: processUpgrade(event); break; case ENFORCE_SNAPSHOT_FULL_SYNC: processEnforceSnapshotFullSync(event); break; default: log.error("Invalid event type {}", event.type); break; } }

Target:
public synchronized void processEvent(DiscoveryServiceEvent event) { switch (event.type) { case ACQUIRE_LOCK: processLockAcquire(); break; case RELEASE_LOCK: processLockRelease(); break; case DISCOVERED_TOPOLOGY: processTopologyChangeNotification(event); break; case UPGRADE: processUpgrade(event); break; case ENFORCE_SNAPSHOT_SYNC: processEnforceSnapshotSync(event); break; default: log.error("Invalid event type {}", event.type); break; } }
Source:
public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); T pasredValue = null; if ((value instanceof String && !StringUtils.isEmpty((String) value))) { pasredValue = parse((String) value); } else if (valueTypeCheck(value)) { pasredValue = (T) value; } else { validationFailedWith(result, getNumberTypeErrorMessage()); return result; } String message = ""; String prefixMsg = getNumberTypeErrorMessage(); if (pasredValue == null) { message = getNumberRangeErrorMessage(prefixMsg); validationFailedWith(result, message); } else if (belowMinimum(pasredValue)) { message = getNumberBellowMinimumErrorMessage(prefixMsg); validationFailedWith(result, message); } else if (aboveMaximum(pasredValue)) { message = getNumberAboveMaximumErrorMessage(prefixMsg); validationFailedWith(result, message); } return result; }

Target:
public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); T parsedValue = null; if (value instanceof String && !StringUtils.isEmpty((String) value)) { parsedValue = parse((String) value); } else { try { parsedValue = (T) value; } catch (Exception ex) { validationFailedWith(result, getNumberTypeErrorMessage()); return result; } } String message = ""; String prefixMsg = getNumberTypeErrorMessage(); if (parsedValue == null) { message = getNumberTypeErrorMessage(); validationFailedWith(result, message); } else if (belowMinimum(parsedValue)) { message = getNumberBellowMinimumErrorMessage(prefixMsg); validationFailedWith(result, message); } else if (aboveMaximum(parsedValue)) { message = getNumberAboveMaximumErrorMessage(prefixMsg); validationFailedWith(result, message); } return result; }
Source:
public ValueMatcher makeValueMatcher(final String dimension, final DruidPredicateFactory predicateFactory) { if (dimension.equals(Column.TIME_COLUMN_NAME)) { return new ValueMatcher() { DruidLongPredicate predicate = predicateFactory.makeLongPredicate(); @Override public boolean matches() { return predicate.applyLong(row.getTimestampFromEpoch()); } }; } else { return new ValueMatcher() { Predicate<String> predicate = predicateFactory.makeStringPredicate(); @Override public boolean matches() { List<String> values = row.getDimension(dimension); for (String value : values) { if (predicate.apply(value)) { return true; } } return false; } }; } }

Target:
public ValueMatcher makeValueMatcher(final String dimension, final DruidPredicateFactory predicateFactory) { if (dimension.equals(Column.TIME_COLUMN_NAME)) { return new ValueMatcher() { final DruidLongPredicate predicate = predicateFactory.makeLongPredicate(); @Override public boolean matches() { return predicate.applyLong(row.getTimestampFromEpoch()); } }; } else { return new ValueMatcher() { final Predicate<String> predicate = predicateFactory.makeStringPredicate(); @Override public boolean matches() { List<String> values = row.getDimension(dimension); for (String value : values) { if (predicate.apply(value)) { return true; } } return false; } }; } }
Source:
Time toTime(DateTime dateTime) { Time time = new Time(); time.set(dateTime.getTimestamp()); time.timezone = dateTime.getTimeZone().getID(); time.allDay = dateTime.isAllDay(); return time; }

Target:
Time toTime(DateTime dateTime) { if (dateTime.isFloating() && !dateTime.isAllDay()) { throw new IllegalArgumentException("Cannot support floating DateTime that is not all-day, can't represent it with Time"); } String timeZoneId = dateTime.getTimeZone() == null ? "UTC" : dateTime.getTimeZone().getID(); Time time = new Time(timeZoneId); time.set(dateTime.getTimestamp()); if (dateTime.isAllDay()) { time.allDay = true; time.hour = 0; time.minute = 0; time.second = 0; } return time; }
Source:
private static Integer positionByRank(List<DocStruct> siblings, Integer rank) { if (siblings != null || rank != null) { SIBLINGS: for (int i = 0; i < siblings.size(); i++) { DocStruct aforeborn = siblings.get(i); List<Metadata> allMetadata = aforeborn.getAllMetadata(); if (allMetadata != null) { for (Metadata metadataElement : allMetadata) { if (metadataElement.getType().getName().equals(IndividualIssue.RULESET_ORDER_NAME)) { try { if (Integer.parseInt(metadataElement.getValue()) > rank) { return i; } else { continue SIBLINGS; } } catch (NumberFormatException e) { if (metadataElement.getValue().compareTo(rank.toString()) > 0) { return i; } else { continue SIBLINGS; } } } } } } } return null; }

Target:
private static Integer positionByRank(List<DocStruct> siblings, Integer rank) { if (siblings != null && rank != null) { SIBLINGS: for (int i = 0; i < siblings.size(); i++) { DocStruct aforeborn = siblings.get(i); List<Metadata> allMetadata = aforeborn.getAllMetadata(); if (allMetadata != null) { for (Metadata metadataElement : allMetadata) { if (metadataElement.getType().getName().equals(IndividualIssue.RULESET_ORDER_NAME)) { try { if (Integer.parseInt(metadataElement.getValue()) > rank) { return i; } else { continue SIBLINGS; } } catch (NumberFormatException e) { if (metadataElement.getValue().compareTo(rank.toString()) > 0) { return i; } else { continue SIBLINGS; } } } } } } } return null; }
Source:
private static Object convertField(Group g, String fieldName, boolean binaryAsString) { if (!g.getType().containsField(fieldName)) { return null; } final int fieldIndex = g.getType().getFieldIndex(fieldName); if (!(g.getFieldRepetitionCount(fieldIndex) > 0)) { return null; } Type fieldType = g.getType().getFields().get(fieldIndex); if (fieldType.isPrimitive()) { if (fieldType.getRepetition().equals(Type.Repetition.REPEATED)) { int repeated = g.getFieldRepetitionCount(fieldIndex); List<Object> vals = new ArrayList<>(); for (int i = 0; i < repeated; i++) { vals.add(convertPrimitiveField(g, fieldIndex, i, binaryAsString)); } return vals; } return convertPrimitiveField(g, fieldIndex, binaryAsString); } else { if (fieldType.isRepetition(Type.Repetition.REPEATED)) { return convertRepeatedFieldToList(g, fieldIndex, binaryAsString); } if (isLogicalMapType(fieldType)) { return convertLogicalMap(g.getGroup(fieldIndex, 0), binaryAsString); } if (isLogicalListType(fieldType)) { return convertLogicalList(g.getGroup(fieldIndex, 0), binaryAsString); } return g.getGroup(fieldIndex, 0); } }

Target:
private static Object convertField(Group g, String fieldName, boolean binaryAsString) { if (!g.getType().containsField(fieldName)) { return null; } final int fieldIndex = g.getType().getFieldIndex(fieldName); if (g.getFieldRepetitionCount(fieldIndex) <= 0) { return null; } Type fieldType = g.getType().getFields().get(fieldIndex); if (fieldType.isPrimitive()) { if (fieldType.getRepetition().equals(Type.Repetition.REPEATED)) { int repeated = g.getFieldRepetitionCount(fieldIndex); List<Object> vals = new ArrayList<>(); for (int i = 0; i < repeated; i++) { vals.add(convertPrimitiveField(g, fieldIndex, i, binaryAsString)); } return vals; } return convertPrimitiveField(g, fieldIndex, binaryAsString); } else { if (fieldType.isRepetition(Type.Repetition.REPEATED)) { return convertRepeatedFieldToList(g, fieldIndex, binaryAsString); } if (isLogicalMapType(fieldType)) { return convertLogicalMap(g.getGroup(fieldIndex, 0), binaryAsString); } if (isLogicalListType(fieldType)) { return convertLogicalList(g.getGroup(fieldIndex, 0), binaryAsString); } return g.getGroup(fieldIndex, 0); } }
Source:
protected void addHeaders(Message<?> message, Map<String, Object> headers) { if (message.getPayload() instanceof File) { File file = (File) message.getPayload(); headers.putIfAbsent(FileHeaders.ORIGINAL_FILE, file); headers.putIfAbsent(FileHeaders.FILENAME, file.getName()); } else if (message.getPayload() instanceof String) { File file = new File((String) message.getPayload()); headers.putIfAbsent(FileHeaders.ORIGINAL_FILE, file); headers.putIfAbsent(FileHeaders.FILENAME, file.getName()); } }

Target:
protected void addHeaders(Message<?> message, Map<String, Object> headers) { File file = null; if (message.getPayload() instanceof File) { file = (File) message.getPayload(); } else if (message.getPayload() instanceof String) { file = new File((String) message.getPayload()); } if (file != null) { if (!headers.containsKey(FileHeaders.ORIGINAL_FILE)) { headers.put(FileHeaders.ORIGINAL_FILE, file); } if (!headers.containsKey(FileHeaders.FILENAME)) { headers.put(FileHeaders.FILENAME, file.getName()); } } }
Source:
public void verifyAddTableLightbox() { waitForElementByElement(addTableLightbox); Assertion.assertTrue(lightboxBackground.getCssValue("background-color").equals(backgroundLigthboxColor)); }

Target:
public void verifyAddTableLightbox() { waitForElementByElement(addTableLightbox); }
Source:
public void clear(String originator, TaskId taskid, String channel) throws InvalidChannelException, IOException { getChannel(channel).clear(); logWithContext(taskid, channel, "cleared channel", Level.DEBUG); commitIfNeeded(channel); }

Target:
public void clear(String originator, TaskId taskid, String channel) throws InvalidChannelException, IOException { getChannel(channel).clear(); logWithContextAndPersist(taskid, channel, "Cleared channel", Level.DEBUG); }
Source:
public ValuePriorityLevel getValueLevel() { return fLevel; }

Target:
public PriorityLevel getValueLevel() { return fLevel; }
Source:
public void doContainerLog(@QueryParameter String containerId, StaplerRequest req, StaplerResponse rsp) throws UnrecoverableKeyException, CertificateEncodingException, NoSuchAlgorithmException, KeyStoreException, IOException { ByteBuffer outputStream = new ByteBuffer(); KubernetesSlave slave = getNode(); if(slave != null) { KubernetesCloud cloud = slave.getKubernetesCloud(); KubernetesClient client = cloud.connect(); String namespace = StringUtils.defaultIfBlank(slave.getNamespace(), client.getNamespace()); client.pods().inNamespace(namespace).withName(getName()) .inContainer(containerId).tailingLines(20).watchLog(outputStream); } new LargeText(outputStream, false).doProgressText(req, rsp); }

Target:
public void doContainerLog(@QueryParameter String containerId, StaplerRequest req, StaplerResponse rsp) throws UnrecoverableKeyException, CertificateEncodingException, NoSuchAlgorithmException, KeyStoreException, IOException { Jenkins.get().checkPermission(Jenkins.ADMINISTER); ByteBuffer outputStream = new ByteBuffer(); KubernetesSlave slave = getNode(); if(slave != null) { KubernetesCloud cloud = slave.getKubernetesCloud(); KubernetesClient client = cloud.connect(); String namespace = StringUtils.defaultIfBlank(slave.getNamespace(), client.getNamespace()); client.pods().inNamespace(namespace).withName(getName()) .inContainer(containerId).tailingLines(20).watchLog(outputStream); } new LargeText(outputStream, false).doProgressText(req, rsp); }
Source:
public void cachesResults() { List<Integer> firstResponse = allocator.getRelevantModuli(KEY); List<Integer> secondResponse = allocator.getRelevantModuli(KEY); List<Integer> thirdResponse = allocator.getRelevantModuli(KEY); verify(generator).getAndMarkResidue(); verifyNoMoreInteractions(generator); assertThat(firstResponse).isEqualTo(secondResponse).isEqualTo(thirdResponse); }

Target:
public void cachesResults() { List<Integer> firstResponse = allocator.getRelevantModuli(KEY); List<Integer> secondResponse = allocator.getRelevantModuli(KEY); List<Integer> thirdResponse = allocator.getRelevantModuli(KEY); verify(generator, times(1)).getAndMarkResidue(); verifyNoMoreInteractions(generator); assertThat(firstResponse).isEqualTo(secondResponse).isEqualTo(thirdResponse); }
Source:
public StreamProperties visitSort(SortNode node, List<StreamProperties> inputProperties) { StreamProperties sourceProperties = Iterables.getOnlyElement(inputProperties); if (sourceProperties.isSingleStream()) { return StreamProperties.ordered(); } else { return sourceProperties; } }

Target:
public StreamProperties visitSort(SortNode node, List<StreamProperties> inputProperties) { StreamProperties sourceProperties = Iterables.getOnlyElement(inputProperties); if (sourceProperties.isSingleStream()) { return StreamProperties.ordered(); } return sourceProperties; }
Source:
@Override public void dispose() { SubscriptionHelper.dispose(this); }

Target:
@Override public void dispose() { if (compareAndSet(false, true)) { inner.cancel(); inner = null; } }
Source:
public static boolean main(String[] args) { new GlobalOptions().initialize(); try { return new KTest(args).run() == 0; } catch (SAXException | ParserConfigurationException | IOException | InterruptedException | TransformerException e) { e.printStackTrace(); GlobalSettings.kem.register( new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, e.getMessage(), "command line", "System file.")); } catch (InvalidConfigError e) { LocationData location = e.getLocation(); GlobalSettings.kem.register( new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, e.getMessage(), location.getSystemId(), location.getPosStr())); } catch (ParseException | InvalidArgumentException e) { GlobalSettings.kem.register( new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, e.getMessage(), "command line", "System file.")); } return false; }

Target:
public static boolean main(String[] args) { new GlobalOptions().initialize(); KTest ktest = null; try { ktest = new KTest(args); } catch (ParseException e) { if (ArrayUtils.contains(args, "--" + Constants.DEBUG)) { e.printStackTrace(); } GlobalSettings.kem.register( new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, e.getMessage())); } assert(ktest != null); try { return ktest.run() == 0; } catch (SAXException | ParserConfigurationException | IOException | InterruptedException | TransformerException | InvalidArgumentException e) { if (ktest.debug()) { e.printStackTrace(); } GlobalSettings.kem.register( new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, e.getMessage())); } catch (InvalidConfigError e) { if (ktest.debug()) { e.printStackTrace(); } LocationData location = e.getLocation(); GlobalSettings.kem.register( new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, e.getMessage(), location.getSystemId(), location.getPosStr())); } return false; }
Source:
private void createRepoManipulatorButton(Composite comboComposite) { new Label(comboComposite, SWT.NONE); new Label(comboComposite, SWT.NONE); Button repoManipulatorButton = new Button(comboComposite, SWT.PUSH); repoManipulatorButton.setText(ProvUIMessages.RepositoryManipulationPage_Manage); setButtonLayoutData(repoManipulatorButton); repoManipulatorButton.setFont(comboComposite.getFont()); repoManipulatorButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { openRepoManipulatorUi(); } @Override public void widgetDefaultSelected(SelectionEvent e) { openRepoManipulatorUi(); } }); }

Target:
private void createRepoManipulatorButton(Composite comboComposite) { new Label(comboComposite, SWT.NONE); new Label(comboComposite, SWT.NONE); Button repoManipulatorButton = new Button(comboComposite, SWT.PUSH); repoManipulatorButton.setText(ProvUIMessages.RepositoryManipulationPage_Manage); setButtonLayoutData(repoManipulatorButton); repoManipulatorButton.setFont(comboComposite.getFont()); repoManipulatorButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { openRepoManipulatorUi(); })); }
Source:
private boolean isValidConfiguration() { if (isDiscarding() || isCalleeData()) { return isAsync(); } else { return true; } }

Target:
private boolean isValidConfiguration() { return !(isDiscarding() || isCalleeData()) || isAsync(); }
Source:
public void registerOperations(ManagementResourceRegistration registration) { ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()) .addAttributes(SingleSignOnDefinition.Attribute.class).addCapabilities((Capability) new Capability() { @Override public RuntimeCapability<?> getDefinition() { return HOST_SSO_CAPABILITY; } @Override public RuntimeCapability<?> resolve(PathAddress address) { return HOST_SSO_CAPABILITY.fromBaseCapability(address); } }); new SimpleResourceRegistration(descriptor, new HostSingleSignOnServiceHandler()).register(registration); }

Target:
public void registerOperations(ManagementResourceRegistration registration) { ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()) .addAttributes(SingleSignOnDefinition.Attribute.class).addCapabilities(() -> HOST_SSO_CAPABILITY); new SimpleResourceRegistration(descriptor, new HostSingleSignOnServiceHandler()).register(registration); }
Source:
public String getTopCommitRevision() { loader.waitOnClosed(); return seleniumWebDriverHelper .waitVisibility(revertPanel, ELEMENT_TIMEOUT_SEC) .getText() .split("\n")[1] .replaceAll("\\.", ""); }

Target:
public String getTopCommitRevision() { loader.waitOnClosed(); int numberOfTopRevisionCell = 1; return getRevertCommitTableContent().split("\n")[numberOfTopRevisionCell]; }
Source:
public Consumer getHost(String guestId, Owner owner) { String guestLower = guestId.toLowerCase(); if (this.cachedHosts.containsKey(guestLower)) { return this.cachedHosts.get(guestLower); } Disjunction guestIdCrit = Restrictions.disjunction(); for (String possibleId : Util.getPossibleUuids(guestId)) { guestIdCrit.add(Restrictions.eq("guestIdLower", possibleId.toLowerCase())); } Criteria crit = currentSession() .createCriteria(GuestId.class) .createAlias("consumer", "gconsumer") .add(Restrictions.eq("gconsumer.owner", owner)) .addOrder(Order.desc("updated")) .setMaxResults(1) .setProjection(Projections.property("consumer")); Consumer host = (Consumer) crit.add(guestIdCrit).uniqueResult(); cachedHosts.put(guestLower, host); return host; }

Target:
public Consumer getHost(String guestId, Owner owner) { String guestLower = guestId.toLowerCase(); if (cachedHosts.containsKey(guestLower)) { return cachedHosts.get(guestLower); } Disjunction guestIdCrit = Restrictions.disjunction(); for (String possibleId : Util.getPossibleUuids(guestId)) { guestIdCrit.add(Restrictions.eq("guestIdLower", possibleId.toLowerCase())); } Criteria crit = currentSession() .createCriteria(GuestId.class) .createAlias("consumer", "gconsumer") .add(Restrictions.eq("gconsumer.owner", owner)) .add(guestIdCrit) .addOrder(Order.desc("updated")) .setMaxResults(1) .setProjection(Projections.property("consumer")); Consumer host = (Consumer) crit.uniqueResult(); cachedHosts.put(guestLower, host); return host; }
Source:
private void setUpUsers() throws Exception { getUtil().rest().deletePage("XWiki", FIRST_USER_NAME); getUtil().rest().deletePage("XWiki", FIRST_USER_NAME); getUtil().createUser(FIRST_USER_NAME, FIRST_USER_PASSWORD, "", ""); getUtil().createUser(SECOND_USER_NAME, SECOND_USER_PASSWORD, "", ""); NotificationsUserProfilePage p; getUtil().login(FIRST_USER_NAME, FIRST_USER_PASSWORD); p = NotificationsUserProfilePage.gotoPage(FIRST_USER_NAME); p.disableAllParameters(); getUtil().login(SECOND_USER_NAME, SECOND_USER_PASSWORD); p = NotificationsUserProfilePage.gotoPage(SECOND_USER_NAME); p.disableAllParameters(); }

Target:
public void setUpUsers() throws Exception { getUtil().createUser(FIRST_USER_NAME, FIRST_USER_PASSWORD, "", ""); getUtil().createUser(SECOND_USER_NAME, SECOND_USER_PASSWORD, "", ""); NotificationsUserProfilePage p; getUtil().login(FIRST_USER_NAME, FIRST_USER_PASSWORD); p = NotificationsUserProfilePage.gotoPage(FIRST_USER_NAME); p.disableAllParameters(); getUtil().login(SECOND_USER_NAME, SECOND_USER_PASSWORD); p = NotificationsUserProfilePage.gotoPage(SECOND_USER_NAME); p.disableAllParameters(); }
Source:
public static final boolean isWindows() { return System.getProperty("os.name").startsWith("Windows"); }

Target:
public static final boolean isWindows() { return IS_WINDOWS; }
Source:
private static String toLegacyPathString(String moduleName) { final ModuleIdentifier moduleIdentifier = ModuleIdentifier.fromString(moduleName); final String name = moduleIdentifier.getName(); final String slot = moduleIdentifier.getSlot(); final StringBuilder builder = new StringBuilder(name.length() + slot.length() + 2); builder.append(name.replace('.', File.separatorChar)); builder.append(File.separatorChar).append(slot); builder.append(File.separatorChar); return builder.toString(); }

Target:
private static String toLegacyPathString(String moduleName) { final ModuleIdentifier moduleIdentifier = ModuleIdentifier.fromString(moduleName); final String name = moduleIdentifier.getName(); final String slot = moduleIdentifier.getSlot(); final StringBuilder builder = new StringBuilder(name.length() + slot.length() + 2); builder.append(name.replace('.', File.separatorChar)); builder.append(File.separatorChar).append(slot); return builder.toString(); }
Source:
public synchronized void run() { if (log.isDebugEnabled()) { log.debug("Cache expiry scheduler running..."); } try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext cc = PrivilegedCarbonContext.getThreadLocalCarbonContext(); cc.setTenantId(MultitenantConstants.SUPER_TENANT_ID); cc.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); for (CacheImpl cache : caches) { try { cache.runCacheExpiry(); if (log.isDebugEnabled()) { log.debug("Cache expiry completed for cache " + cache.getName()); } } catch (IllegalStateException e) { if (log.isDebugEnabled()) { log.debug("Error occurred while running CacheCleanupTask for cache " + cache.getName(), e); } } catch (Throwable e) { log.error("Error occurred while running CacheCleanupTask for cache " + cache.getName(), e); } } } finally { PrivilegedCarbonContext.endTenantFlow(); } }

Target:
public synchronized void run() { if (log.isDebugEnabled()) { log.debug("Cache expiry scheduler running..."); } try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext cc = PrivilegedCarbonContext.getThreadLocalCarbonContext(); cc.setTenantId(MultitenantConstants.SUPER_TENANT_ID); cc.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); for (CacheImpl cache : caches) { try { cache.runCacheExpiry(); if (log.isDebugEnabled()) { log.debug("Cache expiry completed for the cache: " + cache.getName()); } } catch (IllegalStateException e) { if (log.isDebugEnabled()) { log.debug("Error occurred while running CacheCleanupTask for the cache: " + cache.getName(), e); } } catch (Throwable e) { log.error("Error occurred while running CacheCleanupTask for the cache: " + cache.getName(), e); } } } finally { PrivilegedCarbonContext.endTenantFlow(); } }
Source:
protected void checkFailures(StandardHost host) { boolean ok = Stream.of(host.findChildren()).map(Lifecycle::getState).allMatch(s -> s == LifecycleState.STARTED); boolean strict = System.getProperty("nuxeo.start.strict") != null; if (!ok && strict) { throw new IllegalStateException("There're context(s) failed to start."); } }

Target:
protected void checkFailures(StandardHost host) { boolean ok = Stream.of(host.findChildren()).map(Lifecycle::getState).allMatch(s -> s == LifecycleState.STARTED); boolean strict = Boolean.getBoolean("nuxeo.start.strict"); if (!ok && strict) { throw new IllegalStateException("Some contexts failed to start."); } }
Source:
public List<LogEvent> getRecentLogs() { List<DedupedLogEvent> dedupedLogEvents = LogService.getInstance().getEvents(); ArrayList<LogEvent> logEvents = new ArrayList<>(dedupedLogEvents.size()); for (DedupedLogEvent dev : dedupedLogEvents) { LoggingEvent ev = dev.getEvent(); Object application = ev.getMDC("application"); if (application == null) application = ""; String msg = ev.getMessage().toString(); StringBuilder text = new StringBuilder(); for (int i = 0; i < msg.length(); i++) { char c = msg.charAt(i); int type = Character.getType(c); boolean notPrintable = type == Character.UNASSIGNED || type == Character.LINE_SEPARATOR || type == Character.NON_SPACING_MARK || type == Character.PRIVATE_USE; text.append(notPrintable ? '?' : c); } msg = sanitize(text.toString()); logEvents.add(new LogEvent(ev.getTimeStamp(), application, dev.getCount(), ev.getLevel().toString(), msg.trim(), ev.getThrowableStrRep())); } return logEvents; }

Target:
public List<LogEvent> getRecentLogs() { List<DedupedLogEvent> dedupedLogEvents = LogService.getInstance().getEvents(); ArrayList<LogEvent> logEvents = new ArrayList<>(dedupedLogEvents.size()); for (DedupedLogEvent dev : dedupedLogEvents) { LoggingEvent ev = dev.getEvent(); Object application = ev.getMDC("application"); if (application == null) application = ""; String msg = ev.getMessage().toString(); msg = StringUtils.abbreviate(sanitize(msg), 300); String[] stacktrace = ev.getThrowableStrRep(); if (stacktrace != null) for (int i = 0; i < stacktrace.length; i++) stacktrace[i] = sanitize(stacktrace[i]); logEvents.add(new LogEvent(ev.getTimeStamp(), application, dev.getCount(), ev.getLevel().toString(), msg.trim(), stacktrace)); } return logEvents; }
Source:
protected String getSQLine(final SAMSequenceRecord sequenceRecord) { int numAttributes = sequenceRecord.getAttributes() != null ? sequenceRecord.getAttributes().size() : 0; if (sequenceRecord.hasAlternativeSequenceNames()) numAttributes++; final String[] fields = new String[3 + numAttributes]; fields[0] = HEADER_LINE_START + HeaderRecordType.SQ; fields[1] = SAMSequenceRecord.SEQUENCE_NAME_TAG + TAG_KEY_VALUE_SEPARATOR + sequenceRecord.getSequenceName(); fields[2] = SAMSequenceRecord.SEQUENCE_LENGTH_TAG + TAG_KEY_VALUE_SEPARATOR + Integer.toString(sequenceRecord.getSequenceLength()); encodeTags(sequenceRecord, fields, 3); if (sequenceRecord.hasAlternativeSequenceNames()) fields[fields.length - 1] = SAMSequenceRecord.ALTERNATIVE_SEQUENCE_NAME_TAG + TAG_KEY_VALUE_SEPARATOR + String.join(",", sequenceRecord.getAlternativeSequeneNames()); return StringUtil.join(FIELD_SEPARATOR, fields); }

Target:
protected String getSQLine(final SAMSequenceRecord sequenceRecord) { final int numAttributes = sequenceRecord.getAttributes() != null ? sequenceRecord.getAttributes().size() : 0; final String[] fields = new String[3 + numAttributes]; fields[0] = HEADER_LINE_START + HeaderRecordType.SQ; fields[1] = SAMSequenceRecord.SEQUENCE_NAME_TAG + TAG_KEY_VALUE_SEPARATOR + sequenceRecord.getSequenceName(); fields[2] = SAMSequenceRecord.SEQUENCE_LENGTH_TAG + TAG_KEY_VALUE_SEPARATOR + Integer.toString(sequenceRecord.getSequenceLength()); encodeTags(sequenceRecord, fields, 3); return StringUtil.join(FIELD_SEPARATOR, fields); }
Source:
private void assertCorruptedFrameExceptionHandling(byte[] data) { EmbeddedChannel channel = new EmbeddedChannel(new Utf8FrameValidator()); try { channel.writeInbound(new TextWebSocketFrame(Unpooled.copiedBuffer(data))); Assert.fail(); } catch (CorruptedFrameException e) { } Assert.assertTrue(channel.finish()); EmptyByteBuf buf = channel.readOutbound(); Assert.assertNotNull(buf); Assert.assertNull(channel.readOutbound()); }

Target:
private void assertCorruptedFrameExceptionHandling(byte[] data) { EmbeddedChannel channel = new EmbeddedChannel(new Utf8FrameValidator()); try { channel.writeInbound(new TextWebSocketFrame(Unpooled.copiedBuffer(data))); Assert.fail(); } catch (CorruptedFrameException e) { } Assert.assertTrue(channel.finish()); ByteBuf buf = channel.readOutbound(); Assert.assertNotNull(buf); try { Assert.assertFalse(buf.isReadable()); } finally { buf.release(); } Assert.assertNull(channel.readOutbound()); }
Source:
public void waitForInitialData_resilientInCaseOfRetriesAsync() { SyncCredentials credentials = SyncCredentials.usernamePassword(UUID.randomUUID().toString(), "password", true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); final SyncConfiguration config = new SyncConfiguration.Builder(user, Constants.USER_REALM) .waitForInitialRemoteData(false) .build(); Random randomizer = new Random(); for (int i = 0; i < 10; i++) { final int iteration = i; RealmAsyncTask task = Realm.getInstanceAsync(config, new Realm.Callback() { @Override public void onSuccess(Realm realm) { fail(); } @Override public void onError(Throwable exception) { fail(exception.toString()); } }); SystemClock.sleep(randomizer.nextInt(5)); task.cancel(); } looperThread.testComplete(); }

Target:
public void waitForInitialData_resilientInCaseOfRetriesAsync() { SyncCredentials credentials = SyncCredentials.usernamePassword(UUID.randomUUID().toString(), "password", true); SyncUser user = SyncUser.login(credentials, Constants.AUTH_URL); final SyncConfiguration config = new SyncConfiguration.Builder(user, Constants.USER_REALM) .waitForInitialRemoteData() .build(); Random randomizer = new Random(); for (int i = 0; i < 10; i++) { RealmAsyncTask task = Realm.getInstanceAsync(config, new Realm.Callback() { @Override public void onSuccess(Realm realm) { fail(); } @Override public void onError(Throwable exception) { fail(exception.toString()); } }); SystemClock.sleep(randomizer.nextInt(5)); task.cancel(); } looperThread.testComplete(); }
Source:
public TraversalControl visitField(Field field, TraverserContext<Node> context) { QueryTraversalContext parentEnv = context .parentContext() .getVar(QueryTraversalContext.class); GraphQLFieldDefinition fieldDefinition = Introspection.getFieldDef(schema, parentEnv.getType(), field.getName()); Map<String, Object> argumentValues = valuesResolver.getArgumentValues(schema.getFieldVisibility(), fieldDefinition.getArguments(), field.getArguments(), variables); QueryVisitorEnvironment environment = new QueryVisitorEnvironment(field, fieldDefinition, parentEnv.getType(), parentEnv.getEnvironment(), argumentValues); LeaveOrEnter leaveOrEnter = context.getVar(LeaveOrEnter.class); if (leaveOrEnter == LEAVE) { if (!preOrder) { visitFieldCallback.visitField(environment); } return TraversalControl.CONTINUE; } if (preOrder) { visitFieldCallback.visitField(environment); } if (!conditionalNodes.shouldInclude(variables, field.getDirectives())) return TraversalControl.ABORT; GraphQLUnmodifiedType unmodifiedType = schemaUtil.getUnmodifiedType(fieldDefinition.getType()); QueryTraversalContext fieldEnv = (unmodifiedType instanceof GraphQLCompositeType) ? new QueryTraversalContext((GraphQLCompositeType) unmodifiedType, environment) : new QueryTraversalContext(null, environment); context.setVar(QueryTraversalContext.class, fieldEnv); return TraversalControl.CONTINUE; }

Target:
public TraversalControl visitField(Field field, TraverserContext<Node> context) { QueryTraversalContext parentEnv = context .getParentContext() .getVar(QueryTraversalContext.class); GraphQLFieldDefinition fieldDefinition = Introspection.getFieldDef(schema, parentEnv.getType(), field.getName()); Map<String, Object> argumentValues = valuesResolver.getArgumentValues(schema.getFieldVisibility(), fieldDefinition.getArguments(), field.getArguments(), variables); QueryVisitorEnvironment environment = new QueryVisitorEnvironment(field, fieldDefinition, parentEnv.getType(), parentEnv.getEnvironment(), argumentValues); LeaveOrEnter leaveOrEnter = context.getVar(LeaveOrEnter.class); if (leaveOrEnter == LEAVE) { postOrderCallback.visitField(environment); return TraversalControl.CONTINUE; } if (!conditionalNodes.shouldInclude(variables, field.getDirectives())) return TraversalControl.ABORT; preOrderCallback.visitField(environment); GraphQLUnmodifiedType unmodifiedType = schemaUtil.getUnmodifiedType(fieldDefinition.getType()); QueryTraversalContext fieldEnv = (unmodifiedType instanceof GraphQLCompositeType) ? new QueryTraversalContext((GraphQLCompositeType) unmodifiedType, environment) : new QueryTraversalContext(null, environment); context.setVar(QueryTraversalContext.class, fieldEnv); return TraversalControl.CONTINUE; }
Source:
public <Z, D extends Database<Z>> void dump(D database, Decoder decoder, File file, boolean dataOnly) throws Exception { try (Connection c = database.connect(decoder)) { try (Statement s = c.createStatement()) { if (!s.execute("set EXCLUSIVE 1;")) { try (ResultSet rs = s.executeQuery("SCRIPT;")) { try (FileWriter fw = new FileWriter(file)) { while (rs.next()) { fw.write(rs.getString(1) + "\n"); } } } finally { s.execute("set EXCLUSIVE 0;"); } } } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); throw e; } } }

Target:
public <Z, D extends Database<Z>> void dump(D database, Decoder decoder, File file, boolean dataOnly) throws Exception { try (Connection c = database.connect(decoder)) { try (Statement s = c.createStatement()) { if (!s.execute("set EXCLUSIVE 1;")) { try (ResultSet rs = s.executeQuery("SCRIPT;")) { try (FileWriter fw = new FileWriter(file)) { while (rs.next()) { fw.write(rs.getString(1) + "\n"); } } } finally { s.execute("set EXCLUSIVE 0;"); } } } } }
Source:
public void testMulipleClients() throws Throwable { final CountDownLatch latch = new CountDownLatch(NUM_THREADS + 1); List<Thread> threads = new ArrayList<>(NUM_THREADS); for (int i = 0; i < NUM_THREADS; i++) { Thread t1 = new Thread(content(latch)); t1.start(); threads.add(t1); } latch.countDown(); latch.await(); for (Thread t : threads) { t.join(); } Throwable throwable = exception.get(); if (throwable != null) { throw throwable; } }

Target:
public void testMulipleClients() throws Throwable { CountDownLatch latch = new CountDownLatch(NUM_THREADS + 1); List<Thread> threads = new ArrayList<>(NUM_THREADS); for (int i = 0; i < NUM_THREADS; i++) { Thread t1 = new Thread(content(latch)); t1.start(); threads.add(t1); } latch.countDown(); assertTrue(latch.await(MAX_WAIT_TIME_SECONDS, TimeUnit.SECONDS)); for (Thread t : threads) { t.join(); } Throwable throwable = exception.get(); if (throwable != null) { throw throwable; } }
Source:
public @NonNull String getHelpText() { return "Start time of the segment"; }

Target:
public @NonNull String getHelpText() { return Messages.getString("SegmentStartTimeAspect.startDescription"); }
Source:
public AdapterFactory getAdapterFactory() { Object adapterFactory; String adapterFactoryClassName = msbConfig.getBrokerAdapterFactory(); try { Class clazz = Class.forName(adapterFactoryClassName); adapterFactory = clazz.newInstance(); } catch (ClassNotFoundException e) { throw new AdapterFactoryNotSupportedException("The required MSB Adapter Factory '" + adapterFactoryClassName + "' is not supported.", e); } catch (Exception e) { throw new FailedToCreateAdapterFactoryException("Failed to create Adapter Factory: " + adapterFactoryClassName, e); } if (!(adapterFactory instanceof AdapterFactory)) { throw new InconsistentAdapterFactoryException("Inconsistent Adapter Factory class: " + adapterFactoryClassName); } ((AdapterFactory) adapterFactory).init(msbConfig); return (AdapterFactory) adapterFactory; }

Target:
public AdapterFactory getAdapterFactory() { AdapterFactory adapterFactory; String adapterFactoryClassName = msbConfig.getBrokerAdapterFactory(); try { Class clazz = Class.forName(adapterFactoryClassName); adapterFactory = (AdapterFactory) clazz.newInstance(); } catch (ClassNotFoundException e) { throw new AdapterInitializationException("The required MSB Adapter Factory '" + adapterFactoryClassName + "' is not supported.", e); } catch (InstantiationException | IllegalAccessException e) { throw new AdapterInitializationException("Failed to create Adapter Factory: " + adapterFactoryClassName, e); } catch (ClassCastException e) { throw new AdapterInitializationException("Inconsistent Adapter Factory class: " + adapterFactoryClassName); } adapterFactory.init(msbConfig); return adapterFactory; }
Source:
private String readPasswordFile(String passwordFile) throws FileNotFoundException, IOException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(passwordFile), Charset.defaultCharset().displayName()))) { String readLine = reader.readLine(); return readLine; } }

Target:
private String readPasswordFile(String passwordFile) throws FileNotFoundException, IOException { FileReader in = new FileReader(passwordFile); BufferedReader bufferedReader = new BufferedReader(in); String readLine = bufferedReader.readLine(); closeQuietly(in, bufferedReader); return readLine; }
Source:
SyslogAuditEndpoint(Builder builder) throws IOException { infiniteReconnectAttemptsOverflowNumber = Integer.parseInt(System.getProperty("wildfly.elytron.infinite.reconnect.attempts.overflow.number", "10000")); maxReconnectAttempts = builder.maxReconnectAttempts; protocol = builder.ssl ? Protocol.SSL_TCP : builder.tcp ? Protocol.TCP : Protocol.UDP; syslogHandler = new SyslogHandler(checkNotNullParam("serverAddress", builder.serverAddress), builder.port, Facility.SECURITY, builder.format, protocol, checkNotNullParam("hostName", builder.hostName)); if (builder.tcp) { if (builder.socketFactory != null) { tcpOutputStream = new TcpOutputStream(builder.socketFactory, builder.serverAddress, builder.port) { }; } else { tcpOutputStream = new TcpOutputStream(builder.serverAddress, builder.port); } syslogHandler.setOutputStream(tcpOutputStream); } else { tcpOutputStream = null; } errorManager = new TransportErrorManager(protocol); syslogHandler.setErrorManager(errorManager); accept(EventPriority.INFORMATIONAL, "Elytron audit logging enabled with RFC format: " + builder.format); }

Target:
SyslogAuditEndpoint(Builder builder) throws IOException { maxReconnectAttempts = builder.maxReconnectAttempts; protocol = builder.ssl ? Protocol.SSL_TCP : builder.tcp ? Protocol.TCP : Protocol.UDP; syslogHandler = new SyslogHandler(checkNotNullParam("serverAddress", builder.serverAddress), builder.port, Facility.SECURITY, builder.format, protocol, checkNotNullParam("hostName", builder.hostName)); if (builder.tcp) { if (builder.socketFactory != null) { tcpOutputStream = new TcpOutputStream(builder.socketFactory, builder.serverAddress, builder.port) { }; } else { tcpOutputStream = new TcpOutputStream(builder.serverAddress, builder.port); } syslogHandler.setOutputStream(tcpOutputStream); } else { tcpOutputStream = null; } errorManager = new TransportErrorManager(protocol); syslogHandler.setErrorManager(errorManager); accept(EventPriority.INFORMATIONAL, "Elytron audit logging enabled with RFC format: " + builder.format); }
Source:
private void initialize(FileSplit split, JobConf job) { if (realInputFormat == null) { return; } Map<String, PartitionDesc> partitionDescMap = Utilities.getMapRedWork(job).getPathToPartitionInfo(); if (!partitionDescMap.containsKey(split.getPath().getParent().toUri().toString())) { throw new RuntimeException("Failed locating partition description for " + split.getPath().toUri().toString()); } Properties properties = partitionDescMap.get(split.getPath().getParent().toUri().toString()) .getTableDesc().getProperties(); String thriftClassName = properties.getProperty(Constants.SERIALIZATION_CLASS, null); if (thriftClassName == null) { throw new RuntimeException( "Required property " + Constants.SERIALIZATION_CLASS + " is null."); } try { Class thriftClass = job.getClassByName(thriftClassName); realInputFormat = new MultiInputFormat(new TypeRef(thriftClass) {}); } catch (ClassNotFoundException e) { throw new RuntimeException("Failed getting class for " + thriftClassName); } }

Target:
private void initialize(FileSplit split, JobConf job) { Map<String, PartitionDesc> partitionDescMap = Utilities.getMapRedWork(job).getPathToPartitionInfo(); if (!partitionDescMap.containsKey(split.getPath().getParent().toUri().toString())) { throw new RuntimeException("Failed locating partition description for " + split.getPath().toUri().toString()); } Properties properties = partitionDescMap.get(split.getPath().getParent().toUri().toString()) .getTableDesc().getProperties(); String thriftClassName = properties.getProperty(Constants.SERIALIZATION_CLASS, null); if (thriftClassName == null) { throw new RuntimeException( "Required property " + Constants.SERIALIZATION_CLASS + " is null."); } try { Class thriftClass = job.getClassByName(thriftClassName); realInputFormat = new MultiInputFormat(new TypeRef(thriftClass) {}); } catch (ClassNotFoundException e) { throw new RuntimeException("Failed getting class for " + thriftClassName); } }
Source:
protected void sendPromiseMessage(final Object[] args, final SPromise rcvr, final SResolver resolver, final RegisterWhenResolved registerNode) { assert rcvr.getOwner() == EventualMessage.getActorCurrentMessageIsExecutionOn() : "think this should be true because the promise is an Object and owned by this specific actor"; SteppingType step = getStepping(); PromiseSendMessage msg = new PromiseSendMessage( EventualMessage.getCurrentExecutingMessage(), EventualMessage.getCurrentExecutingMessageId(), selector, args, rcvr.getOwner(), resolver, onReceive, messageReceiverBreakpoint.executeCheckIsSetAndEnabled(), promiseResolverBreakpoint.executeCheckIsSetAndEnabled()); msg.setTriggerStepping(step); registerNode.register(rcvr, msg, rcvr.getOwner()); }

Target:
protected void sendPromiseMessage(final Object[] args, final SPromise rcvr, final SResolver resolver, final RegisterWhenResolved registerNode) { assert rcvr.getOwner() == EventualMessage.getActorCurrentMessageIsExecutionOn() : "think this should be true because the promise is an Object and owned by this specific actor"; PromiseSendMessage msg = new PromiseSendMessage( EventualMessage.getCurrentExecutingMessageId(), selector, args, rcvr.getOwner(), resolver, onReceive, hasMessageReceiverBreakpoint(resolver), promiseResolverBreakpoint.executeCheckIsSetAndEnabled()); registerNode.register(rcvr, msg, rcvr.getOwner()); }
Source:
public AbstractWidget() { this.title = ""; settings = new HashMap<String, String>(); location = new WidgetLocation(); }

Target:
public AbstractWidget() { settings = new HashMap<String, String>(); location = new WidgetLocation(); }
Source:
public boolean check() { format = FORMAT_UNSUPPORTED; try { File fileCopy = File.createTempFile("modeshape-sequencer-audio", ".tmp"); FileOutputStream fileOutputStream = new FileOutputStream(fileCopy); byte[] b = new byte[1024]; while (read(b) != -1) { fileOutputStream.write(b); } fileOutputStream.close(); if (mimeType.startsWith("audio/mpeg")) { format = FORMAT_MP3; audioFile = new MP3FileReader().read(fileCopy); } else if (mimeType.startsWith("audio/vorbis") || mimeType.startsWith("audio/x-vorbis")) { format = FORMAT_VORBIS; audioFile = new OggFileReader().read(fileCopy); } else if (mimeType.startsWith("audio/flac") || mimeType.startsWith("audio/x-flac")) { format = FORMAT_FLAC; audioFile = new FlacFileReader().read(fileCopy); } else if (mimeType.equals("audio/mp4") || mimeType.equals("video/mp4") || mimeType.equals("video/quicktime")) { format = FORMAT_MP4; audioFile = new Mp4FileReader().read(fileCopy); } else if (mimeType.equals("audio/x-ms-wma")) { format = FORMAT_WMA; audioFile = new AsfFileReader().read(fileCopy); } else if (mimeType.startsWith("audio/x-wav") || mimeType.startsWith("audio/wav")) { format = FORMAT_WAV; audioFile = new WavFileReader().read(fileCopy); } return checkSupportedAudio(); } catch (Exception e) { } return false; }

Target:
public boolean check() throws Exception { format = FORMAT_UNSUPPORTED; File fileCopy = File.createTempFile("modeshape-sequencer-audio", ".tmp"); IoUtil.write(in, new BufferedOutputStream(new FileOutputStream(fileCopy))); if (mimeType.startsWith("audio/mpeg")) { format = FORMAT_MP3; audioFile = new MP3FileReader().read(fileCopy); } else if (mimeType.startsWith("audio/vorbis") || mimeType.startsWith("audio/x-vorbis")) { format = FORMAT_VORBIS; audioFile = new OggFileReader().read(fileCopy); } else if (mimeType.startsWith("audio/flac") || mimeType.startsWith("audio/x-flac")) { format = FORMAT_FLAC; audioFile = new FlacFileReader().read(fileCopy); } else if (mimeType.equals("audio/mp4") || mimeType.equals("video/mp4") || mimeType.equals("video/quicktime")) { format = FORMAT_MP4; audioFile = new Mp4FileReader().read(fileCopy); } else if (mimeType.equals("audio/x-ms-wma")) { format = FORMAT_WMA; audioFile = new AsfFileReader().read(fileCopy); } else if (mimeType.startsWith("audio/x-wav") || mimeType.startsWith("audio/wav")) { format = FORMAT_WAV; audioFile = new WavFileReader().read(fileCopy); } boolean deleted = false; try { deleted = fileCopy.delete(); } catch (SecurityException e) { } if (!deleted) { fileCopy.deleteOnExit(); } return checkSupportedAudio(); }
Source:
private void removeEmptyParents(File f) { File parentFile = f.getParentFile(); while (!parentFile.equals(repo.getWorkDir())) { if (parentFile.list().length == 0) parentFile.delete(); else break; parentFile = parentFile.getParentFile(); } }

Target:
private void removeEmptyParents(File f) { File parentFile = f.getParentFile(); while (!parentFile.equals(repo.getWorkDir())) { if (!parentFile.delete()) break; parentFile = parentFile.getParentFile(); } }
Source:
public Allele getAltAlleleWithHighestAlleleCount() { try { if ( isBiallelic() ) return getAlternateAllele(0); return getAlternateAlleles().stream() .map(allele -> new Tuple<>(allele, getCalledChrCount(allele))) .max((alleleAndCount1, alleleAndCount2) -> Integer.compare(alleleAndCount1.b, alleleAndCount2.b)) .get() .a; } catch(NoSuchElementException e) { return null; } }

Target:
public Allele getAltAlleleWithHighestAlleleCount() { if ( isBiallelic() ) return getAlternateAllele(0); return getAlternateAlleles().stream() .map(allele -> new Tuple<>(allele, getCalledChrCount(allele))) .max((alleleAndCount1, alleleAndCount2) -> Integer.compare(alleleAndCount1.b, alleleAndCount2.b)) .orElse(null) .a; }
Source:
public String getFullViewPath() { if (StringUtils.isBlank(assetRoot)) { return viewPath; } return URI.create(assetRoot + File.separator + viewPath).normalize().toString(); }

Target:
public String getFullViewPath() { if (StringUtils.isBlank(assetRoot)) { return viewPath; } return URI.create(FilenameUtils.separatorsToUnix(Paths.get( assetRoot, viewPath).toString())).normalize().toString(); }
Source:
private ItemStack itemFromBlock(Block block, IBlockState state) { try { return block.getPickBlock(state, null, null, null, null); } catch (Exception e) { ItemStack item = new ItemStack(block); int dropped = block.damageDropped(state); if (item.getItem().getHasSubtypes() && dropped > 0) { return new ItemStack(block, 1, dropped); } return item; } }

Target:
private ItemStack itemFromBlock(Block block, IBlockState state) { try { return block.getPickBlock(state, null, null, null, null); } catch (Exception e) { return ItemHelper.stateToStack(state, 1); } }
Source:
public boolean basicPut(EntryEventImpl event, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue) throws TimeoutException, CacheWriterException { boolean returnValue = getDataView().putEntry(event, ifNew, ifOld, expectedOldValue, requireOldValue, 0L, false); getFutures.remove(event.getKey()); return returnValue; }

Target:
public boolean basicPut(EntryEventImpl event, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue) throws TimeoutException, CacheWriterException { try { return getDataView().putEntry(event, ifNew, ifOld, expectedOldValue, requireOldValue, 0L, false); } finally { clearOptimizedGetFuture(event.getKey()); } }