auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Promise<ImageStreamTag> setActiveImageTag(final ImageStream stream) { return osService.getImageStreamTag("openshift", stream.getMetadata().getName(), "latest").thenPromise( new Function<ImageStreamTag, Promise<ImageStreamTag>>() { @Override public Promise<ImageStreamTag> apply(ImageStreamTag streamTag) throws FunctionException { osActiveStreamTag = streamTag; List<String> envs = streamTag.getDockerImageMetadata().getContainerConfig().getEnv(); List<Pair<String, String>> variables = new ArrayList<Pair<String, String>>(); for (String env : envs) { String[] pair = env.split("="); if (pair.length != 2) { continue; } variables.add(new Pair<String, String>(pair[0], pair[1])); } view.setEnvironmentVariables(variables); return Promises.resolve(streamTag); } }); }

Target:
private Promise<ImageStreamTag> setActiveImageTag(final ImageStream stream) { return osService.getImageStreamTag("openshift", stream.getMetadata().getName(), "latest").thenPromise( new Function<ImageStreamTag, Promise<ImageStreamTag>>() { @Override public Promise<ImageStreamTag> apply(ImageStreamTag streamTag) throws FunctionException { osActiveStreamTag = streamTag; List<String> envs = streamTag.getDockerImageMetadata().getContainerConfig().getEnv(); List<Pair<String, String>> variables = new ArrayList<>(); for (String env : envs) { String[] keyValuePair = env.split("="); if (keyValuePair.length != 2) { continue; } variables.add(new Pair<>(keyValuePair[0], keyValuePair[1])); } view.setEnvironmentVariables(variables); return Promises.resolve(streamTag); } }); }
Source:
public void testPositiveImportVmFromConfiguration() { initCommand(getOvfEntityData()); doReturn(createStorageDomain()).when(cmd).getStorageDomain(); doReturn(Boolean.TRUE).when(cmd).canDoActionAfterCloneVm(anyMap()); doReturn(Boolean.TRUE).when(cmd).canDoActionBeforeCloneVm(anyMap()); boolean canDoReturn = cmd.canDoAction(); assertTrue("The CDA assertion is false, Those are the following messages " + cmd.getReturnValue().getCanDoActionMessages(), canDoReturn); }

Target:
public void testPositiveImportVmFromConfiguration() { initCommand(getOvfEntityData()); doReturn(createStorageDomain()).when(cmd).getStorageDomain(); doReturn(Boolean.TRUE).when(cmd).canDoActionAfterCloneVm(anyMap()); doReturn(Boolean.TRUE).when(cmd).canDoActionBeforeCloneVm(anyMap()); CanDoActionTestUtils.runAndAssertCanDoActionSuccess(cmd); }
Source:
boolean getHl7PrefixProperty() { try { return PropertyAccessor.getInstance().getPropertyBoolean(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.HL7_PREFIX_FOR_ATTR_PROPERTY); } catch (final PropertyAccessException ex) { LOG.warn(ex.getLocalizedMessage()); LOG.trace("Get HL7 Prefix Property exception: {}", ex.getLocalizedMessage(), ex); } return false; }

Target:
boolean getHl7PrefixProperty() { try { return PropertyAccessor.getInstance().getPropertyBoolean(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.HL7_PREFIX_FOR_ATTR_PROPERTY); } catch (final PropertyAccessException ex) { LOG.trace("Get HL7 Prefix Property exception: {}", ex.getLocalizedMessage(), ex); } return false; }
Source:
private QueryIterator variableSubject(Binding binding, Node s, Node score, Node literal, StrMatch match, ExecutionContext execCxt) { if (log.isTraceEnabled()) log.trace("variableSubject: {}", match) ; ListMultimap<String,TextHit> results = query(match.getProperty(), match.getQueryString(), match.getLang(), match.getLimit(), execCxt) ; Collection<TextHit> r = results.values(); return resultsToQueryIterator(binding, s, score, literal, r, execCxt); }

Target:
private QueryIterator variableSubject(Binding binding, Node s, Node score, Node literal, StrMatch match, ExecutionContext execCxt) { log.trace("variableSubject: {}", match) ; ListMultimap<String,TextHit> results = query(match.getProperty(), match.getQueryString(), match.getLang(), match.getLimit(), execCxt) ; Collection<TextHit> r = results.values(); return resultsToQueryIterator(binding, s, score, literal, r, execCxt); }
Source:
private List<String> readIdsList(JSONArray jsonArray, @NonNull String idScheme) { List<String> list = new ArrayList<>(); if (jsonArray != null) { for (int i = 0; i < jsonArray.length(); i++) { String id = jsonArray.optString(i); if (id.startsWith(AIDL_LAYERS_PREFIX)) { list.add(id); } else { list.add(idScheme + id); } } } return list; }

Target:
protected List<String> readIdsList(JSONArray jsonArray, @NonNull String idScheme) { List<String> list = new ArrayList<>(); if (jsonArray != null) { for (int i = 0; i < jsonArray.length(); i++) { String id = jsonArray.optString(i); list.add(idScheme + id); } } return list; }
Source:
public void enqueue(Lifespan lifespan, List<SerializedPage> pages) { checkState(!Thread.holdsLock(this), "Can not enqueue pages while holding a lock on this"); requireNonNull(lifespan, "lifespan is null"); requireNonNull(pages, "page is null"); checkState(lifespanCompletionCallback != null, "lifespanCompletionCallback must be set before enqueueing data"); if (!state.get().canAddPages() || noMorePagesForLifespan.contains(lifespan)) { return; } long bytesAdded = pages.stream().mapToLong(SerializedPage::getRetainedSizeInBytes).sum(); memoryManager.updateMemoryUsage(bytesAdded); long rowCount = pages.stream().mapToLong(SerializedPage::getPositionCount).sum(); totalRowsAdded.addAndGet(rowCount); totalPagesAdded.addAndGet(pages.size()); outstandingPageCountPerLifespan.computeIfAbsent(lifespan, ignored -> new AtomicLong()).addAndGet(pages.size()); List<SerializedPageReference> serializedPageReferences = pages.stream() .map(pageSplit -> new SerializedPageReference( pageSplit, 1, () -> dereferencePage(pageSplit, lifespan))) .collect(toImmutableList()); masterBuffer.addPages(serializedPageReferences); List<ClientBuffer> buffers = safeGetBuffersSnapshot(); if (buffers.isEmpty()) { return; } int index = nextClientBufferIndex.get() % buffers.size(); for (int i = 0; i < buffers.size(); i++) { buffers.get(index).loadPagesIfNecessary(masterBuffer); index = (index + 1) % buffers.size(); if (masterBuffer.isEmpty()) { nextClientBufferIndex.set(index); break; } } }

Target:
public void enqueue(Lifespan lifespan, List<SerializedPage> pages) { checkState(!Thread.holdsLock(this), "Can not enqueue pages while holding a lock on this"); requireNonNull(lifespan, "lifespan is null"); requireNonNull(pages, "page is null"); checkState(lifespanCompletionCallback != null, "lifespanCompletionCallback must be set before enqueueing data"); if (!state.get().canAddPages() || noMorePagesForLifespan.contains(lifespan)) { return; } long bytesAdded = pages.stream().mapToLong(SerializedPage::getRetainedSizeInBytes).sum(); memoryManager.updateMemoryUsage(bytesAdded); long rowCount = pages.stream().mapToLong(SerializedPage::getPositionCount).sum(); totalRowsAdded.addAndGet(rowCount); totalPagesAdded.addAndGet(pages.size()); outstandingPageCountPerLifespan.computeIfAbsent(lifespan, ignored -> new AtomicLong()).addAndGet(pages.size()); List<SerializedPageReference> serializedPageReferences = pages.stream() .map(pageSplit -> new SerializedPageReference( pageSplit, 1, () -> dereferencePage(pageSplit, lifespan))) .collect(toImmutableList()); masterBuffer.addPages(serializedPageReferences); List<ClientBuffer> buffers = safeGetBuffersSnapshot(); if (buffers.isEmpty()) { return; } int index = nextClientBufferIndex.get() % buffers.size(); for (int i = 0; i < buffers.size(); i++) { if (masterBuffer.isEmpty()) { nextClientBufferIndex.set(index); break; } buffers.get(index).loadPagesIfNecessary(masterBuffer); index = (index + 1) % buffers.size(); } }
Source:
public static Reaction GetReaction(ConfigRuntimeException e, Environment env) { if(env.getEnv(GlobalEnv.class).GetExceptionHandler() != null) { CClosure c = env.getEnv(GlobalEnv.class).GetExceptionHandler(); CArray ex = ObjectGenerator.GetGenerator().exception(e, env, Target.UNKNOWN); if(e.getEnv() != null) { MCCommandSender sender = e.getEnv().getEnv(CommandHelperEnvironment.class).GetCommandSender(); c.getEnv().getEnv(CommandHelperEnvironment.class).SetCommandSender(sender); } try { c.execute(new Construct[]{ex}); return Reaction.REPORT; } catch (FunctionReturnException retException) { Construct ret = retException.getReturn(); if(ret instanceof CNull || Prefs.ScreamErrors() || !Static.getBoolean(ret, Target.UNKNOWN)) { return Reaction.REPORT; } else { return Reaction.IGNORE; } } catch (ConfigRuntimeException cre) { HandleUncaughtException(cre, env, Reaction.REPORT); return Reaction.REPORT; } } else { return Reaction.REPORT; } }

Target:
public static Reaction GetReaction(ConfigRuntimeException e, Environment env) { if(env.getEnv(GlobalEnv.class).GetExceptionHandler() != null) { CClosure c = env.getEnv(GlobalEnv.class).GetExceptionHandler(); CArray ex = ObjectGenerator.GetGenerator().exception(e, env, Target.UNKNOWN); if(e.getEnv() != null) { MCCommandSender sender = e.getEnv().getEnv(CommandHelperEnvironment.class).GetCommandSender(); c.getEnv().getEnv(CommandHelperEnvironment.class).SetCommandSender(sender); } try { c.execute(new Construct[]{ex}); return Reaction.REPORT; } catch (FunctionReturnException retException) { Construct ret = retException.getReturn(); if(ret instanceof CNull || Prefs.ScreamErrors()) { return Reaction.REPORT; } else { return (Static.getBoolean(ret, Target.UNKNOWN) ? Reaction.IGNORE : Reaction.FATAL); } } catch (ConfigRuntimeException cre) { HandleUncaughtException(cre, env, Reaction.REPORT); return Reaction.REPORT; } } else { return Reaction.REPORT; } }
Source:
public void shouldResolveHistoricTaskAuthorization_HistoricProcessInstance() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); String processInstanceId = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY) .getProcessInstanceId(); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setUserId("myUserId"); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); authorization.setResourceId(processInstanceId); authorizationService.saveAuthorization(authorization); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime(), nullValue()); String taskId = taskService.createTaskQuery().singleResult().getId(); ClockUtil.setCurrentTime(END_DATE); taskService.complete(taskId); Date removalTime = addDays(END_DATE, 5); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime(), is(removalTime)); clearAuthorization(); }

Target:
public void shouldResolveHistoricTaskAuthorization_HistoricProcessInstance() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); String processInstanceId = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY) .getProcessInstanceId(); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setUserId("myUserId"); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); authorization.setResourceId(processInstanceId); authorizationService.saveAuthorization(authorization); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime(), nullValue()); String taskId = taskService.createTaskQuery().singleResult().getId(); ClockUtil.setCurrentTime(END_DATE); taskService.complete(taskId); Date removalTime = addDays(END_DATE, 5); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime(), is(removalTime)); }
Source:
private boolean tableExists(TableName tableName) { Connection connection = queryExecutor.getConnection(); try { DatabaseMetaData metadata = connection.getMetaData(); String escape = metadata.getSearchStringEscape(); try (ResultSet resultSet = metadata.getTables( connection.getCatalog(), escapeNamePattern(tableName.getSchema().orElse(null), escape), escapeNamePattern(tableName.getName(), escape), new String[] {"TABLE"}) ) { while (resultSet.next()) { if (tableNameMatches(tableName, resultSet) && tableSchemaMatches(tableName, resultSet)) { LOGGER.info("Table already exists", tableName.getNameInDatabase()); return true; } } } } catch (SQLException e) { throw new QueryExecutionException(e); } return false; }

Target:
private boolean tableExists(TableName tableName) { Connection connection = queryExecutor.getConnection(); try { DatabaseMetaData metadata = connection.getMetaData(); String escape = metadata.getSearchStringEscape(); try (ResultSet resultSet = metadata.getTables( connection.getCatalog(), escapeNamePattern(tableName.getSchema().orElse(null), escape), escapeNamePattern(tableName.getName(), escape), new String[] {"TABLE"}) ) { return QueryResult.forResultSet(resultSet).getRowsCount() > 0; } } catch (SQLException e) { throw new QueryExecutionException(e); } }
Source:
public void setTreeViewGroupMetricsToNodeRuleProvider(TreeViewGroupMetricsToNodeRuleProvider treeViewGroupMetricsToNodeRuleProvider) { this.treeViewGroupMetricsToNodeRuleProvider = treeViewGroupMetricsToNodeRuleProvider; setDefaultMonitoringParams(this.treeViewGroupMetricsToNodeRuleProvider.getMonitoringPlotGroups()); }

Target:
public void setTreeViewGroupMetricsToNodeRuleProvider(TreeViewGroupMetricsToNodeRuleProvider treeViewGroupMetricsToNodeRuleProvider) { this.treeViewGroupMetricsToNodeRuleProvider = treeViewGroupMetricsToNodeRuleProvider; }
Source:
public void tearDown() throws Exception { if (newApp != null) Entities.destroyAll(newApp.getManagementContext()); if (origApp != null && origManagementContext.isRunning()) Entities.destroyAll(origManagementContext); if (mementoDir != null) RebindTestUtils.deleteMementoDir(mementoDir); }

Target:
public void tearDown() throws Exception { if (newApp != null) Entities.destroyAllCatching(newApp.getManagementContext()); if (origApp != null && origManagementContext.isRunning()) Entities.destroyAll(origManagementContext); if (mementoDir != null) RebindTestUtils.deleteMementoDir(mementoDir); }
Source:
public void write(Enriched<EntityType> enrichable, JsonGenerator jg) { try (Writer writer = new StringWriter()) { try (TokenBuffer tb = new TokenBuffer(MAPPER, false)) { tb.writeStartObject(); write(tb, enrichable.getEntity()); tb.flush(); try (JsonParser parser = tb.asParser()) { parser.nextToken(); while (parser.nextToken() == JsonToken.FIELD_NAME) { jg.copyCurrentStructure(parser); } } } } catch (Exception e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); throw new RuntimeException("interrupted", e); } else { log.info("enrichment failed", e); } } }

Target:
public void write(Enriched<EntityType> enrichable, JsonGenerator jg) { try (TokenBuffer tb = new TokenBuffer(MAPPER, false)) { tb.writeStartObject(); write(tb, enrichable.getEntity()); tb.flush(); try (JsonParser parser = tb.asParser()) { parser.nextToken(); while (parser.nextToken() == JsonToken.FIELD_NAME) { jg.copyCurrentStructure(parser); } if (parser.currentToken() != null) { log.error("Enricher returned invalid output {}", name, tb.toString()); } } } catch (Exception e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); throw new RuntimeException("interrupted", e); } else { log.info("Enricher failed", name, e); } } }
Source:
public void prepare() throws Exception { String resourceRoot; URL root = j.getURL(); resourceRoot = root.toString().replace("localhost", RESOURCE_DOMAIN); ResourceDomainConfiguration configuration = ExtensionList.lookupSingleton(ResourceDomainConfiguration.class); configuration.setUrl(resourceRoot); }

Target:
public void prepare() throws Exception { String resourceRoot; URL root = j.getURL(); Assert.assertTrue(root.toString().contains("localhost")); resourceRoot = root.toString().replace("localhost", RESOURCE_DOMAIN); ResourceDomainConfiguration configuration = ExtensionList.lookupSingleton(ResourceDomainConfiguration.class); configuration.setUrl(resourceRoot); }
Source:
public void assignRandomAttributes(EntityRef oreon) { OreonAttributeComponent oreonAttributes = new OreonAttributeComponent(); MersenneRandom random = new MersenneRandom(); if(prefabToSpawn.getName().equals("Oreons:OreonBuilder")) { oreonAttributes.intelligence = random.nextInt(oreonAttributes.maxIntelligence); } else { oreonAttributes.intelligence = 0; } oreonAttributes.strength = random.nextInt(oreonAttributes.maxStrength); oreon.addComponent(oreonAttributes); }

Target:
private void assignRandomAttributes(EntityRef oreon) { OreonAttributeComponent oreonAttributes = new OreonAttributeComponent(); MersenneRandom random = new MersenneRandom(); if (prefabToSpawn.getName().equals(Constants.OREON_BUILDER_PREFAB)) { oreonAttributes.intelligence = random.nextInt(oreonAttributes.maxIntelligence); } else { oreonAttributes.intelligence = 0; } oreonAttributes.strength = random.nextInt(oreonAttributes.maxStrength); oreon.addComponent(oreonAttributes); }
Source:
private void waitUntilBuilt() { totalsStats.waitUntilBuilt(); typesStats.waitUntilBuilt(); }

Target:
private boolean waitUntilBuilt() { boolean check1 = totalsStats.waitUntilBuilt(); boolean check2 = typesStats.waitUntilBuilt(); return (check1 && check2); }
Source:
public void onSetAsDefaultFilter(@ForEvent("click") elemental2.dom.Event e) { savedFilterSelectedEvent.fire(new SavedFilterSelectedEvent(getValue())); savedFilterAsDefaultEventEvent.fire(new SavedFilterAsDefaultActiveEvent(getValue())); }

Target:
public void onSetAsDefaultFilter(@ForEvent("click") elemental2.dom.Event e) { if (!getValue().isDefaultFilter()) { savedFilterAsDefaultEventEvent.fire(new SavedFilterAsDefaultActiveEvent(getValue())); } }
Source:
boolean isTraceState(String key, Object value) { return key.startsWith("Hawkular"); }

Target:
boolean isTraceState(String key, Object value) { return key.startsWith("Hawkular-APM"); }
Source:
public void init(Map<String, Serializable> args) throws Exception { if (args.containsKey(CONTAINER_NAME) && !args.get(CONTAINER_NAME).toString().isEmpty()) { containerName = args.get(CONTAINER_NAME).toString(); } else { throw new IllegalArgumentException("You have to specify a container name. Empty value is not allowed."); } if (args.containsKey(BLOB_NAME) && !args.get(BLOB_NAME).toString().isEmpty()) { blobName = args.get(BLOB_NAME).toString(); } if (args.containsKey(OUTPUT_PATH) && !args.get(OUTPUT_PATH).toString().isEmpty()) { outputPath = args.get(OUTPUT_PATH).toString(); } else { outputPath = getLocalSpace(); } accountName = getThirdPartyCredential("ACCOUNT_NAME"); accountKey = getThirdPartyCredential("ACCOUNT_KEY"); if (accountName == null || accountKey == null) { throw new IllegalArgumentException("You first need to add your account name and account key (ACCOUNT_NAME, ACCOUNT_KEY) to the third party credentials."); } }

Target:
public void init(Map<String, Serializable> args) throws Exception { containerName = (String) Optional.ofNullable(args.get(CONTAINER_NAME)) .filter(container -> !container.toString().isEmpty()) .orElseThrow(() -> new IllegalArgumentException("You have to specify a container name. Empty value is not allowed.")); optionalBlobName = Optional.ofNullable(args.get(BLOB_NAME).toString()).filter(name -> !name.isEmpty()); outputPath = (String) Optional.ofNullable(args.get(OUTPUT_PATH)) .filter(output -> !output.toString().isEmpty()) .orElse(getLocalSpace()); storageAccount = getThirdPartyCredential("STORAGE_ACCOUNT"); accountKey = getThirdPartyCredential("ACCOUNT_KEY"); if (storageAccount == null || accountKey == null) { throw new IllegalArgumentException("You first need to add your account name and account key (STORAGE_ACCOUNT, ACCOUNT_KEY) to the third party credentials."); } }
Source:
public void home() throws Exception { Logger.debug("{}.home()", getName()); for (NozzleTip attachedNozzleTip : this.getCompatibleNozzleTips()) { if (attachedNozzleTip instanceof ReferenceNozzleTip) { ReferenceNozzleTip calibrationNozzleTip = (ReferenceNozzleTip)attachedNozzleTip; if (calibrationNozzleTip.getCalibration().isRecalibrateOnHomeNeeded()) { if (calibrationNozzleTip == this.nozzleTip) { Logger.debug("{}.home() nozzle tip calibration neeeded", getName(), calibrationNozzleTip.getName()); calibrationNozzleTip.getCalibration().calibrate(calibrationNozzleTip, true, false); } else { Logger.debug("{}.home() nozzle tip calibration reset", getName(), calibrationNozzleTip.getName()); calibrationNozzleTip.getCalibration().reset(); } } } } }

Target:
public void home() throws Exception { Logger.debug("{}.home()", getName()); for (NozzleTip attachedNozzleTip : this.getCompatibleNozzleTips()) { if (attachedNozzleTip instanceof ReferenceNozzleTip) { ReferenceNozzleTip calibrationNozzleTip = (ReferenceNozzleTip)attachedNozzleTip; if (calibrationNozzleTip.getCalibration().isRecalibrateOnHomeNeeded(this)) { if (calibrationNozzleTip == this.getCalibrationNozzleTip()) { Logger.debug("{}.home() nozzle tip calibration neeeded", getName(), calibrationNozzleTip.getName()); calibrationNozzleTip.getCalibration().calibrate(this, true, false); } else { Logger.debug("{}.home() nozzle tip calibration reset", getName(), calibrationNozzleTip.getName()); calibrationNozzleTip.getCalibration().reset(this); } } } } }
Source:
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) { if(tab == EsteemedInnovation.tab) for (Entry<Integer, String[]> entry : map.entrySet()) { items.add(new ItemStack(this, 1, entry.getKey())); } }

Target:
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) { if (isInCreativeTab(tab)) { for (Entry<Integer, String[]> entry : map.entrySet()) { items.add(new ItemStack(this, 1, entry.getKey())); } } }
Source:
private void registerShoutListeners() { listen(Message.LOADED, (sender, subject, args) -> { if (!subject.equals("sequences")) { return; } assert (args[0] instanceof Map<?, ?>); Map<String, Sequence> newSequences = (Map<String, Sequence>) args[0]; load(newSequences); }); listen(Message.FILTERED, (sender, subject, args) -> { assert args.length == 1; assert (args[0] instanceof Set<?>); updateVisible((Set<Sequence>) args[0]); }); listen(Message.RESET, (sender, subject, args) -> { updateVisible(new HashSet<Sequence>(sequences.values())); shout(Message.FILTERED, "", new HashSet<>(sequences.values())); }); }

Target:
private void registerShoutListeners() { listen(Message.LOADED, (sender, subject, args) -> { if (!subject.equals("sequences")) { return; } assert (args[0] instanceof Map<?, ?>); Map<String, Sequence> newSequences = (Map<String, Sequence>) args[0]; load(newSequences); }); listen(Message.FILTERED, (sender, subject, args) -> { assert args.length == 1; assert (args[0] instanceof Set<?>); updateVisible((Set<Sequence>) args[0]); }); listen(Message.RESET, (sender, subject, args) -> { Set<Sequence> visibleSet = new HashSet<>(sequences.values()); updateVisible(visibleSet); shout(Message.FILTERED, "", visibleSet); }); }
Source:
public IBinding getBinding() { if (fBinding == null) { if (fParameterOwner == null) { CCorePlugin.log(new NullPointerException()); return null; } ICPPParameter[] parameters = fParameterOwner.getParameters(); fBinding = parameters[fParameterPosition]; } return fBinding; }

Target:
public IBinding getBinding() { if (fBinding == null && fParameterOwner != null) { ICPPParameter[] parameters = fParameterOwner.getParameters(); fBinding = parameters[fParameterPosition]; } return fBinding; }
Source:
private static Command createCustomerCmd() { final LocalDate localDate = LocalDates.today(); final CustomerId customerId = CustomerId.newBuilder() .setRegistrationDate(localDate) .setNumber(customerNumber) .build(); customerNumber++; final Message msg = CreateCustomer.newBuilder() .setCustomerId(customerId) .setCustomer(Customer.newBuilder() .setId(customerId) .setName(PersonName.newBuilder() .setGivenName("Kreat") .setFamilyName("C'Ustomer") .setHonorificSuffix("Cmd"))) .build(); final UserId userId = newUserId(Identifiers.newUuid()); final Command result = Given.Command.createCommand(msg, userId, TimeUtil.getCurrentTime()); return result; }

Target:
private static Command createCustomerCmd() { final LocalDate localDate = LocalDates.today(); final CustomerId customerId = CustomerId.newBuilder() .setRegistrationDate(localDate) .setNumber(customerNumber) .build(); customerNumber++; final Message msg = CreateCustomer.newBuilder() .setCustomerId(customerId) .setCustomer(Customer.newBuilder() .setId(customerId) .setName(PersonName.newBuilder() .setGivenName("Kreat") .setFamilyName("C'Ustomer") .setHonorificSuffix("Cmd"))) .build(); final UserId userId = newUserId(Identifiers.newUuid()); final Command result = Given.Command.create(msg, userId, TimeUtil.getCurrentTime()); return result; }
Source:
private void postError(final ObjectServerError error) { boolean errorHandled = false; if (callback != null) { Runnable action = new Runnable() { @Override public void run() { callback.onError(error); } }; errorHandled = handler.post(action); } if (!errorHandled) { RealmLog.error(error, "An error was thrown, but could not be handled."); } }

Target:
private void postError(final ObjectServerError error) { boolean errorHandled = false; if (callback != null) { Runnable action = new Runnable() { @Override public void run() { callback.onError(error); } }; errorHandled = handler.post(action); } if (!errorHandled) { RealmLog.error(error, "An error was thrown, but could not be posted: \n" + error.toString()); } }
Source:
private TaskData doInBackgroundSearchCards(TaskData... params) { Timber.d("doInBackgroundSearchCards"); Collection col = CollectionHelper.getInstance().getCol(mContext); String query = (String) params[0].getObjArray()[0]; Boolean order = (Boolean) params[0].getObjArray()[1]; int numCardsToRender = (int) params[0].getObjArray()[2]; List<Long> searchResult_ = col.findCards(query, order); List<Map<String,String>> searchResult = new ArrayList<>(searchResult_.size()); for (Long cid: searchResult_) { Map<String, String> card = new HashMap<>(); card.put(CardBrowser.ID, cid.toString()); searchResult.add(card); } for (int i = 0; i < Math.min(numCardsToRender, searchResult.size()); i++) { Card c = col.getCard(Long.parseLong(searchResult.get(i).get("id"))); CardBrowser.updateSearchItemQA(mContext, searchResult.get(i), c, col); } if (isCancelled()) { Timber.d("doInBackgroundSearchCards was cancelled so return null"); return null; } else { return new TaskData(searchResult); } }

Target:
private TaskData doInBackgroundSearchCards(TaskData... params) { Timber.d("doInBackgroundSearchCards"); Collection col = CollectionHelper.getInstance().getCol(mContext); String query = (String) params[0].getObjArray()[0]; Boolean order = (Boolean) params[0].getObjArray()[1]; int numCardsToRender = (int) params[0].getObjArray()[2]; List<Long> searchResult_ = col.findCards(query, order); int resultSize = searchResult_.size(); List<Map<String,String>> searchResult = new ArrayList<>(resultSize); Timber.d("The search found %d cards", resultSize); for (Long cid: searchResult_) { Map<String, String> card = new HashMap<>(); card.put(CardBrowser.ID, cid.toString()); searchResult.add(card); } for (int i = 0; i < Math.min(numCardsToRender, searchResult.size()); i++) { Card c = col.getCard(Long.parseLong(searchResult.get(i).get("id"))); CardBrowser.updateSearchItemQA(mContext, searchResult.get(i), c, col); } if (isCancelled()) { Timber.d("doInBackgroundSearchCards was cancelled so return null"); return null; } else { return new TaskData(searchResult); } }
Source:
protected DLNAThumbnailInputStream getGenericThumbnailInputStreamInternal(String fallback) throws IOException { String thumb = fallback; if (format != null && format.getIcon() != null) { thumb = format.getIcon(); } if (thumb != null && isCodeValid(this)) { if (new File(thumb).exists()) { try (FileInputStream fis = new FileInputStream(thumb)) { return DLNAThumbnailInputStream.toThumbnailInputStream(fis); } } InputStream is; if ((is = getResourceInputStream(thumb)) != null) { return DLNAThumbnailInputStream.toThumbnailInputStream(is); } try { return DLNAThumbnailInputStream.toThumbnailInputStream(downloadAndSend(thumb, true)); } catch (Exception e) } if (isFolder()) { return GenericIcons.INSTANCE.getGenericFolderIcon(); } return GenericIcons.INSTANCE.getGenericIcon(this); }

Target:
protected DLNAThumbnailInputStream getGenericThumbnailInputStreamInternal(String fallback) throws IOException { String thumb = fallback; if (format != null && format.getIcon() != null) { thumb = format.getIcon(); } if (thumb != null && isCodeValid(this)) { InputStream is; if (new File(thumb).exists() && ((is = new FileInputStream(thumb)) != null)) { return DLNAThumbnailInputStream.toThumbnailInputStream(is); } if ((is = getResourceInputStream(thumb)) != null) { return DLNAThumbnailInputStream.toThumbnailInputStream(is); } try { return DLNAThumbnailInputStream.toThumbnailInputStream(downloadAndSend(thumb, true)); } catch (Exception e) } if (isFolder()) { return GenericIcons.INSTANCE.getGenericFolderIcon(); } return GenericIcons.INSTANCE.getGenericIcon(this); }
Source:
public BigInteger convert( final String value ) { return new BigInteger( value ); }

Target:
public BigInteger convert( final String value ) { try { return new BigInteger( value ); } catch ( NumberFormatException nfe ) { return new BigInteger( "0" ); } }
Source:
private void assertTravelExpenseCorrect(DisbursementVoucherNonEmployeeExpense expectedExpense, DisbursementVoucherNonEmployeeExpense actualExpense) { assertEquals("expense code not correct", expectedExpense.getDisbVchrExpenseCode(), actualExpense.getDisbVchrExpenseCode()); assertEquals("expense compnay name not correct", expectedExpense.getDisbVchrExpenseCompanyName(), actualExpense.getDisbVchrExpenseCompanyName()); assertEquals("expense amount not correct", expectedExpense.getDisbVchrExpenseAmount(), actualExpense.getDisbVchrExpenseAmount()); }

Target:
private void assertTravelExpenseCorrect(DisbursementVoucherNonEmployeeExpense expectedExpense, DisbursementVoucherNonEmployeeExpense actualExpense) { assertEquals("expense code not correct", expectedExpense.getDisbVchrExpenseCode(), actualExpense.getDisbVchrExpenseCode()); assertEquals("expense company name not correct", expectedExpense.getDisbVchrExpenseCompanyName(), actualExpense.getDisbVchrExpenseCompanyName()); assertEquals("expense amount not correct", expectedExpense.getDisbVchrExpenseAmount(), actualExpense.getDisbVchrExpenseAmount()); }
Source:
public void inputChanged(@Nullable Viewer viewer, @Nullable Object oldInput, @Nullable Object newInput) { fTableViewer = (TableViewer) viewer; if (newInput instanceof Collection<?>) { Collection<ISegment> segmentStore = (Collection<ISegment>) newInput; fSegmentArray = Iterables.toArray(segmentStore, ISegment.class); if (fComparator != null) { Arrays.sort(fSegmentArray, fComparator); } } else if (newInput instanceof ISegment[]) { fSegmentArray = ((ISegment[]) newInput).clone(); if (fComparator != null) { Arrays.sort(fSegmentArray, fComparator); } } else { fSegmentArray = null; } }

Target:
public void inputChanged(@Nullable Viewer viewer, @Nullable Object oldInput, @Nullable Object newInput) { fTableViewer = (TableViewer) viewer; if (newInput instanceof Collection<?> || newInput instanceof ISegmentStore) { Collection<ISegment> segmentStore = (Collection<ISegment>) newInput; fSegmentArray = Iterables.toArray(segmentStore, ISegment.class); if (fComparator != null) { Arrays.sort(fSegmentArray, fComparator); } } else if (newInput instanceof ISegment[]) { fSegmentArray = ((ISegment[]) newInput).clone(); if (fComparator != null) { Arrays.sort(fSegmentArray, fComparator); } } else { fSegmentArray = null; } }
Source:
public Object execute(MessageContext context, final LongTask lt) { showExecutionInfo(); ContinuationProvider provider = (ContinuationProvider) context.get(ContinuationProvider.class.getName()); final Continuation continuation = provider.getContinuation(); TaskExecutor executor = getTaskExecutor(this.corePoolSize, this.maxPoolSize); synchronized (continuation) { if (continuation.isNew()) { FutureTask<Object> futureProcess = new FutureTask<>(new Callable<Object>() { @Override public Object call() throws Exception { Object response = lt.run(); continuation.resume(); return response; } }); executor.execute(futureProcess); continuation.setObject(futureProcess); continuation.suspend(this.timeOut); return null; } else { @SuppressWarnings("unchecked") FutureTask<Object> futureTask = (FutureTask<Object>) continuation.getObject(); if (futureTask.isDone()) { try { System.gc(); return futureTask.get(); } catch (Exception e) { System.out.println("ERROR: " + e.getMessage()); return null; } } return null; } } }

Target:
public Object execute(MessageContext context, final LongTask lt) { showExecutionInfo(); ContinuationProvider provider = (ContinuationProvider) context.get(ContinuationProvider.class.getName()); final Continuation continuation = provider.getContinuation(); TaskExecutor executor = getTaskExecutor(this.corePoolSize, this.maxPoolSize); synchronized (continuation) { if (continuation.isNew()) { FutureTask<Object> futureProcess = new FutureTask<>(new Callable<Object>() { @Override public Object call() throws Exception { Object response = lt.run(); continuation.resume(); return response; } }); executor.execute(futureProcess); continuation.setObject(futureProcess); continuation.suspend(this.timeOut); return null; } else { @SuppressWarnings("unchecked") FutureTask<Object> futureTask = (FutureTask<Object>) continuation.getObject(); if (futureTask.isDone()) { try { System.gc(); return futureTask.get(); } catch (Exception e) { LOG.error(e.getMessage()); return null; } } return null; } } }
Source:
public void processRecord(ComputationContext context, String documentIdsStreamName, Record record) { Codec<DataBucket> codec = BulkCodecs.getDataBucketCodec(); DataBucket in = codec.decode(record.getData()); String commandId = in.getCommandId(); long documents = in.getCount(); Blob blob = getBlob(in.getDataAsString(), in.getAction()); TransientStore store = Framework.getService(TransientStoreService.class) .getStore(DownloadService.TRANSIENT_STORE_STORE_NAME); store.putBlobs(commandId, Collections.singletonList(blob)); store.setCompleted(commandId, true); String url = Framework.getService(DownloadService.class).getDownloadUrl(commandId); Map<String, Serializable> result = Collections.singletonMap("url", url); AbstractBulkComputation.updateStatusProcessed(context, commandId, documents, result); context.askForCheckpoint(); }

Target:
public void processRecord(ComputationContext context, String documentIdsStreamName, Record record) { Codec<DataBucket> codec = BulkCodecs.getDataBucketCodec(); DataBucket in = codec.decode(record.getData()); String commandId = in.getCommandId(); long documents = in.getCount(); String storeName = Framework.getService(BulkService.class).getStatus(commandId).getAction(); Blob blob = getBlob(in.getDataAsString(), storeName); TransientStore store = Framework.getService(TransientStoreService.class) .getStore(DownloadService.TRANSIENT_STORE_STORE_NAME); store.putBlobs(commandId, Collections.singletonList(blob)); store.setCompleted(commandId, true); String url = Framework.getService(DownloadService.class).getDownloadUrl(commandId); Map<String, Serializable> result = Collections.singletonMap("url", url); AbstractBulkComputation.updateStatusProcessed(context, commandId, documents, result); context.askForCheckpoint(); }
Source:
public org.codice.solr.client.solrj.SolrClient newClient(String core) { String solrUrl = StringUtils.defaultIfBlank( System.getProperty("solr.http.url", getDefaultHttpsAddress()), SystemBaseUrl.constructUrl("/solr")); final String coreUrl = solrUrl + "/" + core; if (System.getProperty(SOLR_DATA_DIR) != null) { ConfigurationStore.getInstance().setDataDirectoryPath(System.getProperty(SOLR_DATA_DIR)); } LOGGER.debug("Solr({}): Creating an HTTP Solr client using url [{}]", core, coreUrl); return new SolrClientAdapter( core, () -> HttpSolrClientFactory.createSolrHttpClient(solrUrl, core, null, coreUrl)); }

Target:
public org.codice.solr.client.solrj.SolrClient newClient(String core) { String solrUrl = StringUtils.defaultIfBlank( AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_HTTP_URL)), getDefaultHttpsAddress()); final String coreUrl = solrUrl + "/" + core; final String solrDataDir = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_DATA_DIR)); if (solrDataDir != null) { ConfigurationStore.getInstance().setDataDirectoryPath(solrDataDir); } LOGGER.debug("Solr({}): Creating an HTTP Solr client using url [{}]", core, coreUrl); return new SolrClientAdapter(core, () -> createSolrHttpClient(solrUrl, core, coreUrl)); }
Source:
public DtlsTransport(Endpoint endpoint, boolean controlling, Logger parentLogger) throws IOException { super(endpoint, controlling, parentLogger); this.endpoint = endpoint; outgoingPacketQueue = new PacketInfoQueue( getClass().getSimpleName() + "-outgoing-packet-queue", TaskPools.IO_POOL, this::handleOutgoingPacket, DtlsTransportConfig.Config.queueSize()); outgoingPacketQueue.setErrorHandler(queueErrorCounter); dtlsStack = new DtlsStack(logger); dtlsReceiver = new ProtocolReceiver(dtlsStack); dtlsSender = new ProtocolSender(dtlsStack); dtlsStack.onHandshakeComplete((chosenSrtpProfile, tlsRole, keyingMaterial) -> { dtlsHandshakeComplete = true; logger.info("DTLS handshake complete. Got SRTP profile " + chosenSrtpProfile); endpoint.setSrtpInformation(chosenSrtpProfile, tlsRole, keyingMaterial); dtlsConnectedSubscribers.forEach(Runnable::run); return Unit.INSTANCE; }); incomingPipelineRoot = createIncomingPipeline(); outgoingDtlsPipelineRoot = createOutgoingDtlsPipeline(); outgoingSrtpPipelineRoot = createOutgoingSrtpPipeline(); }

Target:
public DtlsTransport(Endpoint endpoint, boolean controlling, Logger parentLogger) throws IOException { super(endpoint, controlling, parentLogger); this.endpoint = endpoint; outgoingPacketQueue = new PacketInfoQueue( getClass().getSimpleName() + "-outgoing-packet-queue", TaskPools.IO_POOL, this::handleOutgoingPacket, Config.queueSize()); outgoingPacketQueue.setErrorHandler(queueErrorCounter); dtlsStack = new DtlsStack(logger); dtlsReceiver = new ProtocolReceiver(dtlsStack); dtlsSender = new ProtocolSender(dtlsStack); dtlsStack.onHandshakeComplete((chosenSrtpProfile, tlsRole, keyingMaterial) -> { dtlsHandshakeComplete = true; logger.info("DTLS handshake complete. Got SRTP profile " + chosenSrtpProfile); endpoint.setSrtpInformation(chosenSrtpProfile, tlsRole, keyingMaterial); dtlsConnectedSubscribers.forEach(Runnable::run); return Unit.INSTANCE; }); incomingPipelineRoot = createIncomingPipeline(); outgoingDtlsPipelineRoot = createOutgoingDtlsPipeline(); outgoingSrtpPipelineRoot = createOutgoingSrtpPipeline(); }
Source:
public VanityUrlResult handle(final CachedVanityUrl vanityUrl, final HttpServletResponse response, final Host host, final long languageId) throws IOException { String rewrite = null; String queryString = null; CMSFilter.IAm iAm = CMSFilter.IAm.NOTHING_IN_THE_CMS; if (vanityUrl != null) { rewrite = InodeUtils.isSet(vanityUrl.getForwardTo()) ? vanityUrl.getForwardTo() : null; if (vanityUrl.getResponse() == HttpServletResponse.SC_OK) { response.setStatus(vanityUrl.getResponse()); } else if (vanityUrl.getResponse() == HttpServletResponse.SC_MOVED_PERMANENTLY || vanityUrl.getResponse() == HttpServletResponse.SC_FOUND) { response.setStatus(vanityUrl.getResponse()); response.sendRedirect(rewrite); return DEFAULT_RESULT; } else { response.sendError(vanityUrl.getResponse()); return DEFAULT_RESULT; } } if (UtilMethods.isSet(rewrite) && rewrite.contains(" response.sendRedirect(rewrite); return DEFAULT_RESULT; } if (UtilMethods.isSet(rewrite)) { if (rewrite != null && rewrite.contains("?")) { String[] arr = rewrite.split("\\?", 2); rewrite = arr[0]; if (arr.length > 1) { queryString = arr[1]; } } iAm = rewriteIs(rewrite, host, languageId); } return new VanityUrlResult(rewrite, queryString, iAm, false); }

Target:
public VanityUrlResult handle(final CachedVanityUrl vanityUrl, final HttpServletResponse response, final Host host, final long languageId) throws IOException { String rewrite = null; String queryString = null; CMSFilter.IAm iAm = CMSFilter.IAm.NOTHING_IN_THE_CMS; VanityUrlResult vanityUrlResult = null; if (vanityUrl != null) { rewrite = InodeUtils.isSet(vanityUrl.getForwardTo()) ? vanityUrl.getForwardTo() : null; vanityUrlResult = processVanityResponse(vanityUrl,rewrite, response); } if (vanityUrlResult != null) { return vanityUrlResult; } if (UtilMethods.isSet(rewrite) && rewrite.contains(" response.sendRedirect(rewrite); return DEFAULT_RESULT; } if (UtilMethods.isSet(rewrite)) { if (rewrite != null && rewrite.contains("?")) { String[] arr = rewrite.split("\\?", LIMIT); rewrite = arr[0]; if (arr.length > 1) { queryString = arr[1]; } } iAm = rewriteIs(rewrite, host, languageId); } return new VanityUrlResult(rewrite, queryString, iAm, false); }
Source:
private Integer getWarningLowSpaceSize(StorageModel storageModel) { if (!storageModel.isNewStorage()) { Integer percentageValue = warningLowSpaceIndicatorEditor.asValueBox().getValue(); return percentageValue == null ? 0 : storageModel.getStorage().getTotalDiskSize() * percentageValue / 100; } return 0; }

Target:
private Integer getWarningLowSpaceSize(StorageModel storageModel) { Integer percentageValue = warningLowSpaceIndicatorEditor.asValueBox().getValue(); return percentageValue == null ? 0 : storageModel.getStorage().getTotalDiskSize() * percentageValue / 100; }
Source:
public static synchronized void serialize(@NotNull DataOutput out, @NotNull IgnoreEntryOccurrence entry) throws IOException { out.writeUTF(entry.url); out.writeInt(entry.items.size()); for (Pair<Pattern, Boolean> item : entry.items) { out.writeUTF(item.first.pattern()); out.writeBoolean(item.second); } }

Target:
public static synchronized void serialize(@NotNull DataOutput out, @NotNull IgnoreEntryOccurrence entry) throws IOException { out.writeUTF(entry.url); out.writeInt(entry.items.size()); for (Pair<String, Boolean> item : entry.items) { out.writeUTF(item.first); out.writeBoolean(item.second); } }
Source:
private RuleExtensionHandler getExtensionHandler(final RuleExtension rule, final RuleEvaluationContext context) { final RuleExtensionHandler handler = registry.getExtensionHandler(rule.getHandlerType()); return null != handler && accepts(handler, rule, context) ? handler : null; }

Target:
private Optional<RuleExtensionHandler> getExtensionHandler(final RuleExtension rule, final RuleEvaluationContext context) { final RuleExtensionHandler handler = registry.getExtensionHandler(rule.getHandlerType()); return null != handler && accepts(handler, rule, context) ? Optional.of(handler) : Optional.empty(); }
Source:
public void removeInstance(Instance instance, String trafficSourceName, String agentId) { Optional<TargetGroup> maybeTargetGroup = getTargetGroup(trafficSourceName); if (maybeTargetGroup.isPresent()) { TargetGroup targetGroup = maybeTargetGroup.get(); TargetDescription targetDescription = new TargetDescription() .withId(instance.getInstanceId()); DeregisterTargetsRequest deregisterTargetsRequest = new DeregisterTargetsRequest() .withTargets(targetDescription) .withTargetGroupArn(targetGroup.getTargetGroupArn()); try { elbClient.deregisterTargets(deregisterTargetsRequest); LOG.info("De-registered instance from target group {}", instance.getInstanceId(), targetGroup); } catch (AmazonServiceException exn) { LOG.debug("Instance not found at target group {}", instance.getInstanceId(), targetGroup); } } }

Target:
public void removeInstance(Instance instance, String trafficSourceName, String agentId) { removeInstance(instance.getInstanceId(), trafficSourceName); }
Source:
private void processValidation() { RefactoringStatus status= fRefactoring.checkMethodNames(); String message= null; boolean valid= true; if (status.hasFatalError()) { message= status.getMessageMatchingSeverity(RefactoringStatus.FATAL); valid= false; } if (fGenerateGetter.getSelection() && fGetterName.getText().isEmpty()) { message= RefactoringMessages.SelfEncapsulateFieldInputPage_getter_name; valid= false; } else if (fGenerateSetter.getSelection() && fSetterName.getText().isEmpty()) { message= RefactoringMessages.SelfEncapsulateFieldInputPage_setter_name; valid= false; } else if (!fGenerateGetter.getSelection() && !fGenerateSetter.getSelection()) { message= RefactoringMessages.SelfEncapsulateFieldInputPage_please_choose_to_generate_a_getter_setter; valid= false; } setErrorMessage(message); setPageComplete(valid); }

Target:
private void processValidation() { RefactoringStatus status= fRefactoring.checkMethodNames(); String message= null; boolean valid= true; if (status.hasFatalError()) { message= status.getMessageMatchingSeverity(RefactoringStatus.FATAL); valid= false; } if (fGenerateGetter.getSelection() && fGetterName.getText().isEmpty()) { message= RefactoringMessages.SelfEncapsulateFieldInputPage_no_getter_name; valid= false; } else if (fGenerateSetter.getSelection() && fSetterName.getText().isEmpty()) { message= RefactoringMessages.SelfEncapsulateFieldInputPage_no_setter_name; valid= false; } else if (!fGenerateGetter.getSelection() && !fGenerateSetter.getSelection()) { message= RefactoringMessages.SelfEncapsulateFieldInputPage_please_choose_to_generate_a_getter_setter; valid= false; } setErrorMessage(message); setPageComplete(valid); }
Source:
public void shouldHandleSameInputs() throws IOException { final String USR_BIN = Paths.get(URI.create("file:/ String rel = PathUtils.getRelativeToCanonical(USR_BIN, USR_BIN); Assert.assertEquals(USR_BIN + " rel to itself", "", rel); }

Target:
public void shouldHandleSameInputs() throws IOException { final String USR_BIN = Paths.get("/usr/bin").toString(); String rel = PathUtils.getRelativeToCanonical(USR_BIN, USR_BIN); Assert.assertEquals(USR_BIN + " rel to itself", "", rel); }
Source:
private void addWithAdjustedWeight(double sample, double adjustedWeight) { if (count < samples.length) { samples[count] = sample; weights[count] = adjustedWeight; count++; bubbleUp(); checkArguments(); return; } if (adjustedWeight <= weights[0]) { return; } samples[0] = sample; weights[0] = adjustedWeight; bubbleDown(); checkArguments(); }

Target:
private void addWithAdjustedWeight(double sample, double adjustedWeight) { if (count < samples.length) { samples[count] = sample; weights[count] = adjustedWeight; count++; bubbleUp(); return; } if (adjustedWeight <= weights[0]) { return; } samples[0] = sample; weights[0] = adjustedWeight; bubbleDown(); }
Source:
public static List<ACNVModeledSegment> readACNVModeledSegmentFile(final File acnvSegFile) { Utils.nonNull(acnvSegFile); Utils.regularReadableUserFile(acnvSegFile); try (final TableReader<ACNVModeledSegment> reader = TableUtils.reader(acnvSegFile, (columns, formatExceptionFactory) -> { if (!columns.containsAll(SegmentTableColumns.ACNV_MODELED_SEGMENT_COLUMN_NAME_ARRAY)) { final Set<String> missingColumns = Sets.difference(new HashSet<>(Arrays.asList(SegmentTableColumns.ACNV_MODELED_SEGMENT_COLUMN_NAME_ARRAY)), new HashSet<>(columns.names())); throw formatExceptionFactory.apply("Bad header in ACS file. Not all columns are present. Missing: " + StringUtils.join(missingColumns, ", ")); } return SegmentUtils :: toACNVModeledSegment; })) { return reader.stream().collect(Collectors.toList()); } catch (final IOException | UncheckedIOException e) { throw new UserException.CouldNotReadInputFile(acnvSegFile, e); } }

Target:
public static List<ACNVModeledSegment> readACNVModeledSegmentFile(final File acnvSegFile) { Utils.nonNull(acnvSegFile); Utils.regularReadableUserFile(acnvSegFile); return readSegmentFile(acnvSegFile, SegmentTableColumns.ACNV_MODELED_SEGMENT_COLUMN_NAME_ARRAY, SegmentUtils::toACNVModeledSegment); }
Source:
UserDto(User user) { this.username = user.getUsername(); this.email = user.getEmail(); this.id = user.getId(); }

Target:
public UserDto(User user) { this.username = user.getUsername(); this.email = user.getEmail(); this.id = user.getId(); }