auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void resolveTaxon(Taxonomy taxonomy) throws IndexBuilderException { if (this.resolution != null) return; TaxonResolver resolver = taxonomy.getResolver(); List<TaxonConceptInstance> principals = resolver.principals(this, this.instances); this.resolution = resolver.resolve(this, principals, this.instances); Map<TaxonConceptInstance, TaxonConceptInstance> resolution = new HashMap<>(this.instances.size()); taxonomy.count("count.resolve.taxonConcept"); }

Target:
public void resolveTaxon(Taxonomy taxonomy) throws IndexBuilderException { if (this.resolution != null) return; TaxonResolver resolver = taxonomy.getResolver(); List<TaxonConceptInstance> principals = resolver.principals(this, this.instances); this.resolution = resolver.resolve(this, principals, this.instances); taxonomy.count("count.resolve.taxonConcept"); }
Source:
private SchedulerSpaceInterface getSpaceInterface(String sessionId) throws NotConnectedRestException { Session session = sessionStore.get(sessionId); SchedulerSpaceInterface space = session.getSpace(); renewSession(sessionId); return space; }

Target:
private SchedulerSpaceInterface getSpaceInterface(String sessionId) throws NotConnectedRestException { renewSession(sessionId); return sessionStore.get(sessionId).getSpace(); }
Source:
private ItemStack impl$createMapWithSpongeData(World worldIn, int worldX, int worldZ, byte scale, boolean trackingPosition, boolean unlimitedTracking, World worldIn2, PlayerEntity playerIn, Hand handIn) { final Player player = (Player) playerIn; try (final CauseStackManager.StackFrame frame = PhaseTracker.getCauseStackManager().pushCauseFrame()) { frame.pushCause(player); frame.addContext(EventContextKeys.PLAYER, player); final HandType handType = (HandType) (Object) handIn; frame.addContext(EventContextKeys.USED_HAND, handType); frame.addContext(EventContextKeys.USED_ITEM, player.getItemInHand(handType).createSnapshot()); final Set<Value<?>> mapValues = Sets.newHashSet( Value.immutableOf(Keys.MAP_LOCATION.get(), Vector2i.from(worldX, worldZ)), Value.immutableOf(Keys.MAP_WORLD, (org.spongepowered.api.world.World)worldIn), Value.immutableOf(Keys.MAP_TRACKS_PLAYERS, trackingPosition), Value.immutableOf(Keys.MAP_UNLIMITED_TRACKING, unlimitedTracking), Value.immutableOf(Keys.MAP_SCALE, (int)scale) ); final Optional<MapInfo> optMapInfo = MapUtil.fireCreateMapEvent(frame.getCurrentCause(), mapValues); if (!optMapInfo.isPresent()) { return ItemStack.EMPTY; } final int id = ((MapDataBridge) optMapInfo.get()).bridge$getMapId(); final ItemStack newMap = new ItemStack(Items.FILLED_MAP, 1); final CompoundNBT nbt = newMap.getOrCreateTag(); nbt.putInt("map", id); return newMap; } }

Target:
private ItemStack impl$createMapWithSpongeData(World worldIn, int worldX, int worldZ, byte scale, boolean trackingPosition, boolean unlimitedTracking, World worldIn2, PlayerEntity playerIn, Hand handIn) { final Player player = (Player) playerIn; try (final CauseStackManager.StackFrame frame = PhaseTracker.getCauseStackManager().pushCauseFrame()) { frame.addContext(EventContextKeys.PLAYER, player); final HandType handType = (HandType) (Object) handIn; frame.addContext(EventContextKeys.USED_HAND, handType); frame.addContext(EventContextKeys.USED_ITEM, player.getItemInHand(handType).createSnapshot()); final Set<Value<?>> mapValues = Sets.newHashSet( Value.immutableOf(Keys.MAP_LOCATION.get(), Vector2i.from(worldX, worldZ)), Value.immutableOf(Keys.MAP_WORLD, ((ServerWorld)worldIn).getKey()), Value.immutableOf(Keys.MAP_TRACKS_PLAYERS, trackingPosition), Value.immutableOf(Keys.MAP_UNLIMITED_TRACKING, unlimitedTracking), Value.immutableOf(Keys.MAP_SCALE, (int)scale) ); final Optional<MapInfo> optMapInfo = SpongeCommonEventFactory.fireCreateMapEvent(frame.getCurrentCause(), mapValues); if (!optMapInfo.isPresent()) { return ItemStack.EMPTY; } final int id = ((MapDataBridge) optMapInfo.get()).bridge$getMapId(); final ItemStack newMap = new ItemStack(Items.FILLED_MAP, 1); final CompoundNBT nbt = newMap.getOrCreateTag(); nbt.putInt("map", id); return newMap; } }
Source:
public void report(MetricNames names, String status, Class<?> execClass, MetricRegistry registry) { String sn = execClass.getSimpleName(); if (getLockWaitTime() > 0) { registry.timer(names.getTxLockWaitTime() + sn).update(getLockWaitTime(), TimeUnit.MILLISECONDS); } registry.timer(names.getTxExecTime() + sn).update(getTime(), TimeUnit.MILLISECONDS); if (getCollisions() > 0) { registry.meter(names.getTxWithCollision() + sn).mark(); registry.meter(names.getTxCollisions() + sn).mark(getCollisions()); } registry.histogram(names.getTxEntriesSet() + sn).update(getEntriesSet()); registry.histogram(names.getTxEntriesRead() + sn).update(getEntriesReturned()); if (getTimedOutLocks() > 0) { registry.meter(names.getTxLocksTimedout() + sn).mark(getTimedOutLocks()); } if (getDeadLocks() > 0) { registry.meter(names.getTxLocksDead() + sn).mark(getDeadLocks()); } registry.meter(names.getTxStatus() + status.toLowerCase() + "." + sn).mark(); }

Target:
public void report(MetricNames names, String status, Class<?> execClass, MetricRegistry registry) { String sn = execClass.getSimpleName(); if (getLockWaitTime() > 0) { registry.timer(names.getTxLockWaitTime() + sn).update(getLockWaitTime(), TimeUnit.MILLISECONDS); } registry.timer(names.getTxExecTime() + sn).update(getTime(), TimeUnit.MILLISECONDS); if (getCollisions() > 0) { registry.meter(names.getTxWithCollision() + sn).mark(); registry.meter(names.getTxCollisions() + sn).mark(getCollisions()); } registry.meter(names.getTxEntriesSet() + sn).mark(getEntriesSet()); registry.meter(names.getTxEntriesRead() + sn).mark(getEntriesReturned()); if (getTimedOutLocks() > 0) { registry.meter(names.getTxLocksTimedout() + sn).mark(getTimedOutLocks()); } if (getDeadLocks() > 0) { registry.meter(names.getTxLocksDead() + sn).mark(getDeadLocks()); } registry.meter(names.getTxStatus() + status.toLowerCase() + "." + sn).mark(); }
Source:
public static String findFeatureFinderMetabo() throws FeatureFinderMetaboException { if (isFeatureFinderMetaboHere(OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME)) { return OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME; } else { String OS = System.getProperty("os.name").toLowerCase(); if (OS.indexOf("win") >= 0) { for (String s : new File(OPENMS_DEFAULT_LOCATION_WINDOWS).list()) { if (s.toLowerCase().contains("openms")) { String path = OPENMS_DEFAULT_LOCATION_WINDOWS + s + "\\bin\\" + OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME; if (isFeatureFinderMetaboHere(path)) return path; return null; } } } else if (OS.indexOf("mac") >= 0) { for (String s : new File(OPENMS_DEFAULT_LOCATION_MAC).list()) { if (s.toLowerCase().contains("openms")) { String path = OPENMS_DEFAULT_LOCATION_MAC + s + "\\bin\\" + OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME; if (isFeatureFinderMetaboHere(path)) return path; return null; } } } else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0) { for (String s : new File(OPENMS_DEFAULT_LOCATION_LINUX).list()) { if (s.toLowerCase().contains("openms")) { String path = OPENMS_DEFAULT_LOCATION_LINUX + s + "\\bin\\" + OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME; if (isFeatureFinderMetaboHere(path)) return path; return null; } } } else { return null; } } return null; }

Target:
public static String findFeatureFinderMetabo() throws MSDKException { if (isFeatureFinderMetaboHere(OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME)) { return OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME; } final String OS = System.getProperty("os.name").toLowerCase(); if (OS.indexOf("win") >= 0) { for (String s : new File(OPENMS_DEFAULT_LOCATION_WINDOWS).list()) { if (s.toLowerCase().contains("openms")) { String path = "\"" + OPENMS_DEFAULT_LOCATION_WINDOWS + s + "\\bin\\" + OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME + "\""; if (isFeatureFinderMetaboHere(path)) return path; } } } else if (OS.indexOf("mac") >= 0) { for (String s : new File(OPENMS_DEFAULT_LOCATION_MAC).list()) { if (s.toLowerCase().contains("openms")) { String path = "\"" + OPENMS_DEFAULT_LOCATION_MAC + s + "\\bin\\" + OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME + "\""; if (isFeatureFinderMetaboHere(path)) return path; } } } else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0) { for (String s : new File(OPENMS_DEFAULT_LOCATION_LINUX).list()) { if (s.toLowerCase().contains("openms")) { String path = "\"" + OPENMS_DEFAULT_LOCATION_LINUX + s + "\\bin\\" + OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME + "\""; if (isFeatureFinderMetaboHere(path)) return path; } } } return null; }
Source:
private void applyChanges(Sample target, Sample source) throws IOException { target.setDescription(source.getDescription()); target.setSampleType(source.getSampleType()); target.setReceivedDate(source.getReceivedDate()); target.setQcPassed(source.getQcPassed()); target.setScientificName(source.getScientificName()); target.setTaxonIdentifier(source.getTaxonIdentifier()); if (!target.getAlias().equals(source.getAlias())) { validateAliasUniqueness(source.getAlias()); } target.setAlias(source.getAlias()); target.setDescription(source.getDescription()); target.setEmpty(source.isEmpty()); target.setVolume(source.getVolume()); if (isDetailedSample(target)) { sampleAdditionalInfoService.applyChanges((SampleAdditionalInfo) target, (SampleAdditionalInfo) source); if (isIdentitySample(target)) { identityService.applyChanges((Identity) target, (Identity) source); } if (isTissueSample(target)) { sampleTissueService.applyChanges((SampleTissue) target, (SampleTissue) source); } if (isAliquotSample(target)) { SampleAliquot saTarget = (SampleAliquot) target; SampleAliquot saSource = (SampleAliquot) source; saTarget.setGroupId(saSource.getGroupId()); saTarget.setGroupDescription(saSource.getGroupDescription()); saTarget.setSamplePurpose(saSource.getSamplePurpose()); } if (isStockSample(target)) { SampleStock ssTarget = (SampleStock) target; SampleStock ssSource = (SampleStock) source; ssTarget.setStrStatus(ssSource.getStrStatus()); ssTarget.setConcentration(ssSource.getConcentration()); } } }

Target:
private void applyChanges(Sample target, Sample source) throws IOException { target.setDescription(source.getDescription()); target.setSampleType(source.getSampleType()); target.setReceivedDate(source.getReceivedDate()); target.setQcPassed(source.getQcPassed()); target.setScientificName(source.getScientificName()); target.setTaxonIdentifier(source.getTaxonIdentifier()); if (!target.getAlias().equals(source.getAlias())) { validateAliasUniqueness(source.getAlias()); } target.setAlias(source.getAlias()); target.setDescription(source.getDescription()); target.setEmpty(source.isEmpty()); target.setVolume(source.getVolume()); if (isDetailedSample(target)) { sampleAdditionalInfoService.applyChanges((SampleAdditionalInfo) target, (SampleAdditionalInfo) source); if (isIdentitySample(target)) { identityService.applyChanges((Identity) target, (Identity) source); } if (isTissueSample(target)) { sampleTissueService.applyChanges((SampleTissue) target, (SampleTissue) source); } if (isTissueProcessingSample(target)) { applyChanges((SampleTissueProcessing) target, (SampleTissueProcessing) source); } if (isAliquotSample(target)) { SampleAliquot saTarget = (SampleAliquot) target; SampleAliquot saSource = (SampleAliquot) source; saTarget.setSamplePurpose(saSource.getSamplePurpose()); } if (isStockSample(target)) { SampleStock ssTarget = (SampleStock) target; SampleStock ssSource = (SampleStock) source; ssTarget.setStrStatus(ssSource.getStrStatus()); ssTarget.setConcentration(ssSource.getConcentration()); } } }
Source:
public void testTagDetection() { Assert.assertTrue("Valid root tag detection", PropertyMergePostProcessor.looksLikeTag("Some_Root:Tag")); Assert.assertTrue("Valid sub tag detection", PropertyMergePostProcessor.looksLikeTag("Some_Root-123:Tag/Another_Tag456")); Assert.assertFalse("Invalid tag pattern", PropertyMergePostProcessor.looksLikeTag("Some_Root123")); Assert.assertFalse("Spaces check 1", PropertyMergePostProcessor.looksLikeTag("Some Root:Tag")); Assert.assertFalse("Spaces check 2", PropertyMergePostProcessor.looksLikeTag("Some_Root : Tag")); Assert.assertFalse("Spaces check 3", PropertyMergePostProcessor.looksLikeTag("Some_Root:Tag Name")); Assert.assertFalse("Spaces check 4", PropertyMergePostProcessor.looksLikeTag("Some_Root:Tag/Other Tag Name")); }

Target:
public void testTagDetection() { Assert.assertTrue("Valid root tag detection", PropertyMergePostProcessor.looksLikeTag("Some_Root:")); Assert.assertTrue("Valid root tag detection", PropertyMergePostProcessor.looksLikeTag("Some_Root:Tag")); Assert.assertTrue("Valid sub tag detection", PropertyMergePostProcessor.looksLikeTag("Some_Root-123:Tag/Another_Tag456")); Assert.assertFalse("Invalid tag pattern", PropertyMergePostProcessor.looksLikeTag("Some_Root123")); Assert.assertFalse("Spaces check 1", PropertyMergePostProcessor.looksLikeTag("Some Root:Tag")); Assert.assertFalse("Spaces check 2", PropertyMergePostProcessor.looksLikeTag("Some_Root : Tag")); Assert.assertFalse("Spaces check 3", PropertyMergePostProcessor.looksLikeTag("Some_Root:Tag Name")); Assert.assertFalse("Spaces check 4", PropertyMergePostProcessor.looksLikeTag("Some_Root:Tag/Other Tag Name")); }
Source:
public Path getResourcePacksDirectory() { return fileResourcepacks.toPath(); }

Target:
public Path getResourcePacksDirectory() { return this.fileResourcepacks.toPath(); }
Source:
public void onBuildHeaders(List<Header> target) { if(AdaptionUtil.hasReducedPreferences()) { loadHeadersFromResource(R.xml.preference_headers_without_advanced, target); }else { loadHeadersFromResource(R.xml.preference_headers, target); } }

Target:
public void onBuildHeaders(List<Header> target) { loadHeadersFromResource(R.xml.preference_headers, target); Iterator iterator = target.iterator(); while (iterator.hasNext()) { Header header = (Header)iterator.next(); if ((header.titleRes == R.string.pref_cat_advanced) && AdaptionUtil.hasReducedPreferences()){ iterator.remove(); } } }
Source:
public static Optional<HiveBucketFilter> getHiveBucketFilter(Table table, TupleDomain<ColumnHandle> effectivePredicate) { if (!table.getStorage().getBucketProperty().isPresent()) { return Optional.empty(); } Optional<Map<ColumnHandle, NullableValue>> bindings = TupleDomain.extractFixedValues(effectivePredicate); if (!bindings.isPresent()) { return Optional.empty(); } OptionalInt singleBucket = getHiveBucket(table, bindings.get()); if (singleBucket.isPresent()) { return Optional.of(new HiveBucketFilter(ImmutableSet.of(singleBucket.getAsInt()))); } Optional<Map<ColumnHandle, Set<NullableValue>>> columnValueSetBindings = TupleDomain.extractFixedValuesFromRanges(effectivePredicate); if (!columnValueSetBindings.isPresent()) { return Optional.empty(); } Set<Integer> buckets = getHiveBuckets(table, columnValueSetBindings.get()); if (buckets.size() > 0) { return Optional.of(new HiveBucketFilter(buckets)); } if (!effectivePredicate.getDomains().isPresent()) { return Optional.empty(); } Optional<Domain> domain = effectivePredicate.getDomains().get().entrySet().stream() .filter(entry -> ((HiveColumnHandle) entry.getKey()).getName().equals(BUCKET_COLUMN_NAME)) .findFirst() .map(Entry::getValue); if (!domain.isPresent()) { return Optional.empty(); } ValueSet values = domain.get().getValues(); ImmutableSet.Builder<Integer> builder = ImmutableSet.builder(); int bucketCount = table.getStorage().getBucketProperty().get().getBucketCount(); for (int i = 0; i < bucketCount; i++) { if (values.containsValue((long) i)) { builder.add(i); } } return Optional.of(new HiveBucketFilter(builder.build())); }

Target:
public static Optional<HiveBucketFilter> getHiveBucketFilter(Table table, TupleDomain<ColumnHandle> effectivePredicate) { if (!table.getStorage().getBucketProperty().isPresent()) { return Optional.empty(); } Optional<Map<ColumnHandle, Set<NullableValue>>> bindings = TupleDomain.extractFixedValueSets(effectivePredicate); if (!bindings.isPresent()) { return Optional.empty(); } Optional<Set<Integer>> buckets = getHiveBuckets(table, bindings.get()); if (buckets.isPresent()) { return Optional.of(new HiveBucketFilter(buckets.get())); } if (!effectivePredicate.getDomains().isPresent()) { return Optional.empty(); } Optional<Domain> domain = effectivePredicate.getDomains().get().entrySet().stream() .filter(entry -> ((HiveColumnHandle) entry.getKey()).getName().equals(BUCKET_COLUMN_NAME)) .findFirst() .map(Entry::getValue); if (!domain.isPresent()) { return Optional.empty(); } ValueSet values = domain.get().getValues(); ImmutableSet.Builder<Integer> builder = ImmutableSet.builder(); int bucketCount = table.getStorage().getBucketProperty().get().getBucketCount(); for (int i = 0; i < bucketCount; i++) { if (values.containsValue((long) i)) { builder.add(i); } } return Optional.of(new HiveBucketFilter(builder.build())); }
Source:
public void setUp() { Map<String, String> headers = new HashMap<>(); headers.put("my", "value"); setXmlResponse("clusters", 200, "<clusters/>"); setXmlResponse("clusters/123", 200, "<cluster id=\"123\"><name>test</name></cluster>"); startServer(); connection = (HttpConnection) testConnectionBuilder().header("my", "value").build(); clustersService = connection.systemService().clustersService(); clusterService = clustersService.clusterService("123"); }

Target:
public void setUp() { setXmlResponse("clusters", 200, "<clusters/>"); setXmlResponse("clusters/123", 200, "<cluster id=\"123\"><name>test</name></cluster>"); startServer(); connection = (HttpConnection) testConnectionBuilder().header("my", "value").build(); clustersService = connection.systemService().clustersService(); clusterService = clustersService.clusterService("123"); }
Source:
public ThingType(String bindingId, String thingTypeId, String label) throws IllegalArgumentException { this(new ThingTypeUID(bindingId, thingTypeId), null, label, null, false, null, null, null, null); }

Target:
public ThingType(String bindingId, String thingTypeId, String label) throws IllegalArgumentException { this(new ThingTypeUID(bindingId, thingTypeId), null, label, null, true, null, null, null, null); }
Source:
public void testSinkWithTopicListOrTopicPattern(){ ObjectIdentifier objectIdentifier = ObjectIdentifier.of( "default", "default", "sinkTable"); Map<String, String> modifiedOptions = getModifiedOptions( getFullSourceOptions(), options -> { options.put("topic", TOPICS); options.put("scan.startup.mode", "earliest-offset"); options.remove("specific-offsets"); }); CatalogTable sinkTable = createKafkaSinkCatalogTable(modifiedOptions); thrown.expect(ValidationException.class); thrown.expect(containsCause(new ValidationException("Flink Kafka sink currently doesn't support topic list."))); FactoryUtil.createTableSink( null, objectIdentifier, sinkTable, new Configuration(), Thread.currentThread().getContextClassLoader()); modifiedOptions = getModifiedOptions( getFullSourceOptions(), options -> { options.put("topic-pattern", TOPIC_REGEX); }); sinkTable = createKafkaSinkCatalogTable(modifiedOptions); thrown.expect(ValidationException.class); thrown.expect(containsCause(new ValidationException("Flink Kafka sink currently doesn't support 'topic-pattern'."))); FactoryUtil.createTableSink( null, objectIdentifier, sinkTable, new Configuration(), Thread.currentThread().getContextClassLoader()); }

Target:
public void testSinkWithTopicListOrTopicPattern(){ ObjectIdentifier objectIdentifier = ObjectIdentifier.of( "default", "default", "sinkTable"); Map<String, String> modifiedOptions = getModifiedOptions( getFullSourceOptions(), options -> { options.put("topic", TOPICS); options.put("scan.startup.mode", "earliest-offset"); options.remove("specific-offsets"); }); CatalogTable sinkTable = createKafkaSinkCatalogTable(modifiedOptions); String errorMessageTemp = "Flink Kafka sink currently only supports single topic, but got %s: %s."; try { FactoryUtil.createTableSink( null, objectIdentifier, sinkTable, new Configuration(), Thread.currentThread().getContextClassLoader()); } catch (Throwable t) { assertEquals(String.format(errorMessageTemp, "'topic'", String.format("[%s]", String.join(", ", TOPIC_LIST))), t.getCause().getMessage()); } modifiedOptions = getModifiedOptions( getFullSourceOptions(), options -> { options.put("topic-pattern", TOPIC_REGEX); }); sinkTable = createKafkaSinkCatalogTable(modifiedOptions); try { FactoryUtil.createTableSink( null, objectIdentifier, sinkTable, new Configuration(), Thread.currentThread().getContextClassLoader()); } catch (Throwable t) { assertEquals(String.format(errorMessageTemp, "'topic-pattern'", TOPIC_REGEX), t.getCause().getMessage()); } }
Source:
private void copyThenUpload(Uri[] sourceUris, String[] remotePaths) { if (mShowWaitingDialog) { mActivity.showLoadingDialog(mActivity.getResources(). getString(R.string.wait_for_tmp_copy_from_private_storage)); } CopyAndUploadContentUrisTask copyTask = new CopyAndUploadContentUrisTask ((CopyAndUploadContentUrisTask.OnCopyTmpFilesTaskListener)mActivity, mActivity); copyTask.execute( CopyAndUploadContentUrisTask.makeParamsToExecute( mAccount, sourceUris, remotePaths, mActivity.getContentResolver() ) ); }

Target:
private void copyThenUpload(Uri[] sourceUris, String[] remotePaths) { if (mShowWaitingDialog) { mActivity.showLoadingDialog(mActivity.getResources(). getString(R.string.wait_for_tmp_copy_from_private_storage)); } CopyAndUploadContentUrisTask copyTask = new CopyAndUploadContentUrisTask (mCopyTmpTaskListener, mActivity); FragmentManager fm = mActivity.getSupportFragmentManager(); TaskRetainerFragment taskRetainerFragment = (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT); if (taskRetainerFragment != null) { taskRetainerFragment.setTask(copyTask); } copyTask.execute( CopyAndUploadContentUrisTask.makeParamsToExecute( mAccount, sourceUris, remotePaths, mActivity.getContentResolver() ) ); }
Source:
private void reassignIds() { RelativeLayout.LayoutParams iconLayoutParams = (LayoutParams) mIcon.getLayoutParams(); int[] rules = iconLayoutParams.getRules(); for (int i = 0; i < rules.length; i++) { if (rules[i] == mTextInputLayout.getId()) { if (Build.VERSION.SDK_INT > 23) { rules[i] = mNewIds.get(1); } else { iconLayoutParams.addRule(i, mNewIds.get(1)); } } } mIcon.setLayoutParams(iconLayoutParams); RelativeLayout.LayoutParams editTextLayoutParams = (LayoutParams) mTextInputLayout.getLayoutParams(); rules = editTextLayoutParams.getRules(); for (int i = 0; i < rules.length; i++) { if (rules[i] == mIcon.getId()) { if (Build.VERSION.SDK_INT > 23) { rules[i] = mNewIds.get(0); } else { editTextLayoutParams.addRule(i, mNewIds.get(0)); } } } mTextInputLayout.setLayoutParams(editTextLayoutParams); mIcon.setId(mNewIds.get(0)); mTextInputLayout.setId(mNewIds.get(1)); mEditText.setId(mNewIds.get(2)); }

Target:
private void reassignIds() { RelativeLayout.LayoutParams iconLayoutParams = (LayoutParams) mIcon.getLayoutParams(); int[] rules = iconLayoutParams.getRules(); for (int i = 0; i < rules.length; i++) { if (rules[i] == mTextInputLayout.getId()) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { rules[i] = mNewIds.get(1); } else { iconLayoutParams.addRule(i, mNewIds.get(1)); } } } mIcon.setLayoutParams(iconLayoutParams); RelativeLayout.LayoutParams editTextLayoutParams = (LayoutParams) mTextInputLayout.getLayoutParams(); rules = editTextLayoutParams.getRules(); for (int i = 0; i < rules.length; i++) { if (rules[i] == mIcon.getId()) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { rules[i] = mNewIds.get(0); } else { editTextLayoutParams.addRule(i, mNewIds.get(0)); } } } mTextInputLayout.setLayoutParams(editTextLayoutParams); mIcon.setId(mNewIds.get(0)); mTextInputLayout.setId(mNewIds.get(1)); mEditText.setId(mNewIds.get(2)); }
Source:
private void processStoredUntaggedResponses() throws MessagingException { List<ImapResponse> untaggedResponses = getAndClearStoredUntaggedResponses(); if (K9MailLib.isDebug()) { Timber.i("Processing %d untagged responses from previous commands for %s", untaggedResponses.size(), getLogId()); } for (int i = 0; i < untaggedResponses.size();i++) { ImapResponse response = untaggedResponses.get(i); if ((equalsIgnoreCase(response.get(1), "EXPUNGE") && handleExpungeResponse(response)) || (equalsIgnoreCase(response.get(1), "FETCH") && handleFetchResponse(response)) || (equalsIgnoreCase(response.get(1), "EXISTS") && handleExistsResponse()) || (equalsIgnoreCase(response.get(0), "VANISHED") && handleVanishedResponse(response))) { pushReceiver.syncFolder(getName()); break; } } }

Target:
private void processStoredUntaggedResponses() throws MessagingException { while (true) { List<ImapResponse> untaggedResponses = getAndClearStoredUntaggedResponses(); if (untaggedResponses.isEmpty()) { break; } if (K9MailLib.isDebug()) { Timber.i("Processing %d untagged responses from previous commands for %s", untaggedResponses.size(), getLogId()); } processUntaggedResponses(untaggedResponses); } }
Source:
public void handle(Request request, Response response) throws Exception { userSession.checkLoggedIn(); String projectKey = request.mandatoryParam(PARAM_PROJECT); String branchKey = request.mandatoryParam(PARAM_BRANCH); try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto project = componentFinder.getRootComponentByUuidOrKey(dbSession, null, projectKey); checkPermission(project); BranchDto branch = checkFoundWithOptional(dbClient.branchDao().selectByUuid(dbSession, project.uuid()), "Project '%s' not found", projectKey); dbClient.branchDao().updateMainBranchName(dbSession, branch.getUuid(), branchKey); dbSession.commit(); response.noContent(); } }

Target:
public void handle(Request request, Response response) throws Exception { userSession.checkLoggedIn(); String projectKey = request.mandatoryParam(PARAM_PROJECT); String branchKey = request.mandatoryParam(PARAM_BRANCH); try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto project = componentFinder.getRootComponentByUuidOrKey(dbSession, null, projectKey); checkPermission(project); Optional<BranchDto> branch = dbClient.branchDao().selectByKey(dbSession, project.uuid(), BranchKeyType.BRANCH, branchKey); if (branch.isPresent() && !branch.get().isMain()) { throw new IllegalArgumentException("Impossible to update branch name: a branch with name \"" + branchKey + "\" already exists in the project."); } dbClient.branchDao().updateMainBranchName(dbSession, project.uuid(), branchKey); dbSession.commit(); response.noContent(); } }
Source:
protected void executeCommand() { registerRollbackHandler((TransactionRollbackListener)() -> TransactionSupport.executeInNewTransaction( (TransactionMethod<Void>) () -> { macPoolPerCluster.createPool(oldMacPool); return null; } )); macPoolDao.update(getMacPoolEntity()); macPoolPerCluster.modifyPool(getMacPoolEntity()); setSucceeded(true); getReturnValue().setActionReturnValue(getMacPoolId()); }

Target:
protected void executeCommand() { registerRollbackHandler((TransactionRollbackListener)() -> macPoolPerCluster.modifyPool(oldMacPool)); macPoolDao.update(getMacPoolEntity()); macPoolPerCluster.modifyPool(getMacPoolEntity()); setSucceeded(true); getReturnValue().setActionReturnValue(getMacPoolId()); }
Source:
public String toString() { return "BasicDistributionSummary{config=" + config + ", totalAmount=" + totalAmount + ", count=" + count + ", max=" + max + ", min=" + min + ", monitors=" + monitors + '}'; }

Target:
public String toString() { return "BasicDistributionSummary{config=" + config + ", totalAmount=" + totalAmount + ", count=" + count + ", max=" + max + ", min=" + min + '}'; }
Source:
public ExternalIdentity(final Provider provider, final String providerUserId, final String accessToken, final String refreshToken) { setMeta(new Meta()); this.setMeta(new Meta()); this.provider = provider; this.providerUserId = providerUserId; this.accessToken = accessToken; this.refreshToken = refreshToken; }

Target:
public ExternalIdentity(final Provider provider, final String providerUserId, final String accessToken, final String refreshToken) { this.provider = provider; this.providerUserId = providerUserId; this.accessToken = accessToken; this.refreshToken = refreshToken; }
Source:
public LatLng getGoogleMapsLocation() { ParseGeoPoint pGP = (ParseGeoPoint) get("location"); return new LatLng(pGP.getLatitude(), pGP.getLongitude()); }

Target:
public LatLng getGoogleMapsLocation() { ParseGeoPoint pGP = getLocation(); LatLng latlng = null; if (pGP != null) { latlng = new LatLng(pGP.getLatitude(), pGP.getLongitude()); } return latlng; }
Source:
public int getHeuristicSearchStepLimit(SearchStepSemantics requestedSemantics, int numQIs) { if (this.heuristicSearchStepLimit == null) { this.heuristicSearchStepLimit = Integer.MAX_VALUE; } if (this.heuristicSearchStepLimit == Integer.MAX_VALUE || requestedSemantics == this.searchStepSemantics) { return this.heuristicSearchStepLimit; } if (this.searchStepSemantics == SearchStepSemantics.CHECKS) { return this.heuristicSearchStepLimit / numQIs; } else { return this.heuristicSearchStepLimit * numQIs; } }

Target:
public int getHeuristicSearchStepLimit(SearchStepSemantics requestedSemantics, int numQIs) { if (this.heuristicSearchStepLimit == null) { this.heuristicSearchStepLimit = Integer.MAX_VALUE; } if (this.heuristicSearchStepLimit == Integer.MAX_VALUE || requestedSemantics == this.searchStepSemantics) { return this.heuristicSearchStepLimit; } switch (requestedSemantics) { case CHECKS: return this.heuristicSearchStepLimit * numQIs; case EXPANSIONS: return this.heuristicSearchStepLimit / numQIs; default: throw new RuntimeException("The search step semantic " + requestedSemantics + " is not supported"); } }
Source:
public void verifyDefaultKfsAccountForAwsXmlCanBeMarshalled() throws JAXBException, IOException { String marshalledXml = cUMarshalService.marshalObjectToXmlString( DefaultKfsAccountForAwsWrapperFixture.generateExpectedDefaultKfsAccountForAwsResultWrapperObject()); marshalledXml = removeWhitespace(marshalledXml.substring(marshalledXml.indexOf('\n') + 1)); String expectedXmlExample = DefaultKfsAccountForAwsWrapperFixture.getXmlFromExampleFile(); expectedXmlExample = removeWhitespace(expectedXmlExample); assertTrue("The Marshalled XML should be equal to the example XML", marshalledXml.equalsIgnoreCase(expectedXmlExample)); }

Target:
public void verifyDefaultKfsAccountForAwsXmlCanBeMarshalled() throws JAXBException, IOException, ParseException { String marshalledXml = cUMarshalService.marshalObjectToXmlString( DefaultKfsAccountForAwsWrapperFixture.generateExpectedDefaultKfsAccountForAwsResultWrapper()); marshalledXml = removeWhitespace(marshalledXml.substring(marshalledXml.indexOf('\n') + 1)); String expectedXmlExample = DefaultKfsAccountForAwsWrapperFixture.getXmlFromExampleFile(); expectedXmlExample = removeWhitespace(expectedXmlExample); assertTrue("The Marshalled XML should be equal to the example XML", StringUtils.equalsIgnoreCase(marshalledXml, expectedXmlExample)); }
Source:
protected void dispose() { super.dispose(); synchronized (this) { List<Closeable> list = new ArrayList<>(openStreams); for (Closeable closable : list) { try { closable.close(); } catch (IOException e) { } } inputStream = null; } final IDocument document = partitioner.getDocument(); document.setDocumentPartitioner(null); partitioner.disconnect(); }

Target:
protected void dispose() { synchronized (this) { List<Closeable> list = new ArrayList<>(openStreams); for (Closeable closable : list) { try { closable.close(); } catch (IOException e) { } } inputStream = null; } final IDocument document = partitioner.getDocument(); document.setDocumentPartitioner(null); partitioner.disconnect(); super.dispose(); }
Source:
public void createPartControl(Composite parent) { parent.setLayout(new FillLayout(SWT.HORIZONTAL)); Composite queryRegistryContainer = new Composite(parent, SWT.NONE); queryRegistryContainer.setLayout(new GridLayout(1, false)); initializeQueryTreeViewer(queryRegistryContainer); initializeToolBar(); initializeMenu(); }

Target:
public void createPartControl(Composite parent) { parent.setLayout(new FillLayout(SWT.HORIZONTAL)); Composite queryRegistryContainer = new Composite(parent, SWT.NONE); queryRegistryContainer.setLayout(new GridLayout(1, false)); initializeQueryTreeViewer(queryRegistryContainer); }
Source:
public FunApplyBlock(FunctionInfo funInfo, CustomUIPane pane) { super(pane); this.loadFXML("FunApplyBlock"); this.funInfo = funInfo; this.functionInfo.setText(funInfo.getName()); this.inputs = new ArrayList<>(); this.output = new OutputAnchor(this, new Binder("res")); this.resTypeLabel = new Label(""); this.resTypeLabel.setMinWidth(USE_PREF_SIZE); this.resTypeLabel.getStyleClass().add("resultType"); VBox outputSpace = new VBox(this.resTypeLabel, this.output); outputSpace.setAlignment(Pos.CENTER); Type t = funInfo.getFreshSignature(); while (t instanceof FunType) { FunType ft = (FunType) t; FunInputAnchor ia = new FunInputAnchor(); this.inputs.add(ia); t = ft.getResult(); } Pane inputSpace = new HBox(10, this.inputs.toArray(new Node[this.inputs.size()])); this.bodySpace.getChildren().addAll(inputSpace, outputSpace); outputSpace.layoutYProperty().bind(inputSpace.heightProperty()); outputSpace.layoutXProperty().bind(inputSpace.widthProperty().divide(2).subtract(resTypeLabel.widthProperty().divide(2))); }

Target:
public FunApplyBlock(FunctionInfo funInfo, CustomUIPane pane) { super(pane); this.loadFXML("FunApplyBlock"); this.funInfo = funInfo; this.functionInfo.setText(funInfo.getName()); this.inputs = new ArrayList<>(); this.output = new OutputAnchor(this, new Binder("res")); this.resTypeLabel = new Label(""); this.resTypeLabel.setMinWidth(USE_PREF_SIZE); this.resTypeLabel.getStyleClass().add("resultType"); VBox outputSpace = new VBox(this.resTypeLabel, this.output); outputSpace.setAlignment(Pos.CENTER); Type t = funInfo.getFreshSignature(); while (t instanceof FunType) { FunType ft = (FunType) t; FunInputAnchor ia = new FunInputAnchor(); this.inputs.add(ia); t = ft.getResult(); } Pane inputSpace = new HBox(10, this.inputs.toArray(new Node[this.inputs.size()])); this.curriedOutput = new Pane() { @Override public double computePrefWidth(double heigth) { return Math.max(inputSpace.prefWidth(heigth), outputSpace.getLayoutX()+resTypeLabel.prefWidth(heigth)); } }; this.curriedOutput.setVisible(false); this.curriedOutput.getStyleClass().add("curriedOutput"); this.bodySpace.getChildren().addAll(this.curriedOutput, inputSpace, outputSpace); outputSpace.layoutYProperty().bind(inputSpace.heightProperty()); outputSpace.layoutXProperty().bind(inputSpace.widthProperty().divide(2).subtract(resTypeLabel.widthProperty().divide(2))); this.curriedOutput.layoutYProperty().bind(inputSpace.heightProperty().divide(2)); this.curriedOutput.prefHeightProperty().bind(inputSpace.heightProperty()); this.curriedOutput.translateYProperty().bind(outputSpace.translateYProperty()); }
Source:
public void testDelete() throws SQLException{ String name = "TEST_RETROSPECTIVE_NAME"; String description = "TEST_RETROSPECTIVE_DESCRIPTION"; long sprintId = mCS.getSprintsId().get(0); long projectId = mCP.getAllProjects().get(0).getId(); int type = RetrospectiveObject.TYPE_GOOD; RetrospectiveObject retrospective = new RetrospectiveObject(projectId); retrospective.setName(name) .setSprintId(sprintId) .setDescription(description) .setType(type) .save(); assertNotSame(-1, retrospective.getId()); retrospective.delete(); IQueryValueSet valueSet = new MySQLQuerySet(); valueSet.addTableName(RetrospectiveEnum.TABLE_NAME); valueSet.addEqualCondition(RetrospectiveEnum.ID, retrospective.getId()); String query = valueSet.getSelectQuery(); ResultSet result = mControl.executeQuery(query); RetrospectiveObject retrospectiveCreated = null; if (result.next()) { retrospectiveCreated = RetrospectiveDAO.convert(result); } closeResultSet(result); assertNull(retrospectiveCreated); }

Target:
public void testDelete() { String name = "TEST_RETROSPECTIVE_NAME"; String description = "TEST_RETROSPECTIVE_DESCRIPTION"; long sprintId = mCS.getSprintsId().get(0); long projectId = mCP.getAllProjects().get(0).getId(); int type = RetrospectiveObject.TYPE_GOOD; RetrospectiveObject retrospective = new RetrospectiveObject(projectId); retrospective.setName(name) .setSprintId(sprintId) .setDescription(description) .setType(type) .save(); assertNotSame(-1, retrospective.getId()); boolean isDeleteSuccess = retrospective.delete(); assertTrue(isDeleteSuccess); RetrospectiveObject retrospectiveCreated = RetrospectiveDAO.getInstance().get(retrospective.getId()); assertNull(retrospectiveCreated); }
Source:
public void addRoutingTableChangeListener( final RoutingTableChangeListener routingTableChangeListener, Object context) { _routingTableChangeListenerMap.put(routingTableChangeListener, new ListenerContext(context)); logger.info("Attach RoutingTableProviderChangeListener {}", routingTableChangeListener.getClass().getName()); if (_sourceDataTypeMap.isEmpty()) { routingTableChangeListener.onRoutingTableChange(getRoutingTableSnapshot(), context); } else { for (PropertyType propertyType : _sourceDataTypeMap.keySet()) { switch (propertyType) { case EXTERNALVIEW: case TARGETEXTERNALVIEW: case CURRENTSTATES: routingTableChangeListener .onRoutingTableChange(getRoutingTableSnapshot(propertyType), context); break; case CUSTOMIZEDVIEW: for (String customizedStateType : _sourceDataTypeMap .getOrDefault(PropertyType.CUSTOMIZEDVIEW, Collections.emptyList())) { routingTableChangeListener.onRoutingTableChange( getRoutingTableSnapshot(PropertyType.CUSTOMIZEDVIEW, customizedStateType), context); } break; default: logger.warn("Unsupported source data type: {}, stop triggering callback!", propertyType); } } } }

Target:
public void addRoutingTableChangeListener( final RoutingTableChangeListener routingTableChangeListener, Object context) { addRoutingTableChangeListener(routingTableChangeListener, context, false); }
Source:
public String calculateChecksum(InputStream inputStream) throws IOException, NoSuchAlgorithmException { if (inputStream == null) { throw new IllegalArgumentException("InputStream cannot be null"); } try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { byte[] buffer = new byte[1028]; int len; while ((len = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, len); } MessageDigest md = MessageDigest.getInstance(DIGEST_ALGORITHM); byte[] md5Checksum = md.digest(outputStream.toByteArray()); return new String(Hex.encodeHex(md5Checksum)); } }

Target:
public String calculateChecksum(InputStream inputStream) throws IOException, NoSuchAlgorithmException { if (inputStream == null) { throw new IllegalArgumentException("InputStream cannot be null"); } return DigestUtils.sha256Hex(inputStream); }
Source:
public Note cloneNote(String sourceNoteID, String newNoteName, AuthenticationInfo subject) throws IOException, CloneNotSupportedException, IllegalArgumentException { Note sourceNote = getNote(sourceNoteID); if (sourceNote == null) { throw new IllegalArgumentException(sourceNoteID + "not found"); } Note newNote = createNote(subject); if (newNoteName != null) { newNote.setName(newNoteName); } else { newNote.setName("Note " + newNote.getId()); } List<String> boundInterpreterSettingsIds = getBindedInterpreterSettingsIds(sourceNote.id()); bindInterpretersToNote(newNote.id(), boundInterpreterSettingsIds); List<Paragraph> paragraphs = sourceNote.getParagraphs(); for (Paragraph p : paragraphs) { newNote.addCloneParagraph(p); } notebookIndex.addIndexDoc(newNote); newNote.persist(subject); return newNote; }

Target:
public Note cloneNote(String sourceNoteID, String newNoteName, AuthenticationInfo subject) throws IOException, CloneNotSupportedException, IllegalArgumentException { Note sourceNote = getNote(sourceNoteID); if (sourceNote == null) { throw new IllegalArgumentException(sourceNoteID + "not found"); } Note newNote = createNote(subject); if (newNoteName != null) { newNote.setName(newNoteName); } else { newNote.setName("Note " + newNote.getId()); } List<String> boundInterpreterSettingsIds = getBindedInterpreterSettingsIds(sourceNote.getId()); bindInterpretersToNote(newNote.getId(), boundInterpreterSettingsIds); List<Paragraph> paragraphs = sourceNote.getParagraphs(); for (Paragraph p : paragraphs) { newNote.addCloneParagraph(p); } notebookIndex.addIndexDoc(newNote); newNote.persist(subject); return newNote; }
Source:
public List<RuntimeWorkspaceDto> getRuntimeWorkspaces(@DefaultValue("0") @QueryParam("skipCount") Integer skipCount, @DefaultValue("30") @QueryParam("maxItems") Integer maxItems) throws BadRequestException { return workspaceManager.getRuntimeWorkspaces(getCurrentUserId()) .stream() .map(this::asRuntimeWorkspaceDto) .collect(toList()); }

Target:
public List<RuntimeWorkspaceDto> getRuntimeWorkspaces(@DefaultValue("0") @QueryParam("skipCount") Integer skipCount, @DefaultValue("30") @QueryParam("maxItems") Integer maxItems) throws BadRequestException { return workspaceManager.getRuntimeWorkspaces(getCurrentUserId()) .stream() .map(this::asDto) .collect(toList()); }
Source:
private <T> Set<Class<? extends T>> load(Class<T> serviceClass, ClassLoader loader) { String serviceFile = SERVICES + "/" + serviceClass.getName(); LinkedHashSet<Class<? extends T>> providers = new LinkedHashSet<Class<? extends T>>(); LinkedHashSet<Class<? extends T>> vetoedProviders = new LinkedHashSet<Class<? extends T>>(); try { Enumeration<URL> enumeration = loader.getResources(serviceFile); while (enumeration.hasMoreElements()) { final URL url = enumeration.nextElement(); final InputStream is = url.openStream(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = reader.readLine(); while (null != line) { line = skipCommentAndTrim(line); if (line.length() > 0) { try { boolean mustBeVetoed = line.startsWith("!"); if (mustBeVetoed) { line = line.substring(1); } Class<? extends T> provider = loader.loadClass(line).asSubclass(serviceClass); if (mustBeVetoed) { vetoedProviders.add(provider); } if (vetoedProviders.contains(provider)) { providers.remove(provider); } else { providers.add(provider); } } catch (ClassCastException e) { throw new IllegalStateException("Service " + line + " does not implement expected type " + serviceClass.getName()); } } line = reader.readLine(); } } finally { if (reader != null) { reader.close(); } } } } catch (Exception e) { throw new RuntimeException("Could not load services for " + serviceClass.getName(), e); } return providers; }

Target:
private <T> Set<Class<? extends T>> load(Class<T> serviceClass, ClassLoader loader) { String serviceFile = SERVICES + "/" + serviceClass.getName(); Set<Class<? extends T>> providers = new LinkedHashSet<Class<? extends T>>(); Set<Class<? extends T>> vetoedProviders = new LinkedHashSet<Class<? extends T>>(); try { Enumeration<URL> enumeration = loader.getResources(serviceFile); while (enumeration.hasMoreElements()) { final URL url = enumeration.nextElement(); final InputStream is = url.openStream(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = reader.readLine(); while (null != line) { line = skipCommentAndTrim(line); if (line.length() > 0) { try { boolean mustBeVetoed = line.startsWith("!"); if (mustBeVetoed) { line = line.substring(1); } Class<? extends T> provider = loader.loadClass(line).asSubclass(serviceClass); if (mustBeVetoed) { vetoedProviders.add(provider); } if (vetoedProviders.contains(provider)) { providers.remove(provider); } else { providers.add(provider); } } catch (ClassCastException e) { throw new IllegalStateException("Service " + line + " does not implement expected type " + serviceClass.getName()); } } line = reader.readLine(); } } finally { if (reader != null) { reader.close(); } } } } catch (Exception e) { throw new RuntimeException("Could not load services for " + serviceClass.getName(), e); } return providers; }
Source:
public Response previewSnapshot(Action action) { TryBackToAllSnapshotsOfVmParameters tryBackParams = new TryBackToAllSnapshotsOfVmParameters(guid, asGuid(action.getSnapshot().getId())); Response response = doAction(VdcActionType.TryBackToAllSnapshotsOfVm, tryBackParams, action); return response; }

Target:
public Response previewSnapshot(Action action) { TryBackToAllSnapshotsOfVmParameters tryBackParams = new TryBackToAllSnapshotsOfVmParameters(guid, asGuid(action.getSnapshot().getId())); Response response = performAction(VdcActionType.TryBackToAllSnapshotsOfVm, tryBackParams, action); return response; }
Source:
public DocumentReferenceSearchProjectionBuilder documentReference() { return new DocumentReferenceSearchProjectionBuilder() { @Override public SearchProjection<DocumentReference> build() { return null; } }; }

Target:
public DocumentReferenceSearchProjectionBuilder documentReference() { return new DocumentReferenceSearchProjectionBuilder() { @SuppressWarnings("unchecked") @Override public SearchProjection<DocumentReference> build() { return (SearchProjection<DocumentReference>) PROJECTION; } }; }
Source:
private List<ChangeSet> parsePollingLogOutput(ByteArrayOutputStream output) throws IOException { List<ChangeSet> incoming = new ArrayList<ChangeSet>(); BufferedReader in = new BufferedReader(new InputStreamReader( new ByteArrayInputStream(output.toByteArray()))); ChangeSet changeSet = null; String line; while ((line = in.readLine()) != null) { Matcher matcher = FILES_LINE.matcher(line); if (matcher.matches()) { for (String s : matcher.group(1).split(":")) { if (s.length() > 0) { changeSet.files.add(s); } } } if (line.startsWith("id:")) { String id = line.substring(3); changeSet = new ChangeSet(id); incoming.add(changeSet); } if (line.startsWith("branch:")) { String branch = line.substring(7); if (branch == null) { branch = "default"; } changeSet.branch = branch; } } return incoming; }

Target:
private List<ChangeSet> parsePollingLogOutput(ByteArrayOutputStream output) throws IOException { List<ChangeSet> incoming = new ArrayList<ChangeSet>(); BufferedReader in = new BufferedReader(new InputStreamReader( new ByteArrayInputStream(output.toByteArray()))); ChangeSet changeSet = null; String line; while ((line = in.readLine()) != null) { Matcher matcher = FILES_LINE.matcher(line); if (matcher.matches()) { for (String s : matcher.group(1).split(":")) { if (s.length() > 0) { changeSet.files.add(s); } } } if (line.startsWith("id:")) { String id = line.substring(3); changeSet = new ChangeSet(id); incoming.add(changeSet); } if (line.startsWith("branch:")) { String branch = line.substring(7); changeSet.branch = branch; } } return incoming; }
Source:
private boolean tryComplete(LocateRequest req, CompletableFuture<RegionLocations> future, RegionLocations locations) { if (future.isDone()) { return true; } if (locations == null) { return false; } HRegionLocation loc = ObjectUtils.firstNonNull(locations.getRegionLocations()); assert loc != null; boolean completed; if (req.locateType.equals(RegionLocateType.BEFORE)) { KeyValue.KVComparator comparator = getComparator(loc.getRegion().getTable()); byte[] endKey = loc.getRegion().getEndKey(); int c = comparator.compareRows(endKey, 0, endKey.length, req.row,0, req.row.length); completed = c == 0 || ((c > 0 || Bytes.equals(EMPTY_END_ROW, endKey)) && comparator.compareRows( loc.getRegion().getStartKey(), 0, loc.getRegion().getStartKey().length, req.row, 0, req.row.length) < 0); } else { completed = loc.getRegion().containsRow(req.row); } if (completed) { future.complete(locations); return true; } else { return false; } }

Target:
private boolean tryComplete(LocateRequest req, CompletableFuture<RegionLocations> future, RegionLocations locations) { if (future.isDone()) { return true; } if (locations == null) { return false; } HRegionLocation loc = ObjectUtils.firstNonNull(locations.getRegionLocations()); assert loc != null; boolean completed; if (req.locateType.equals(RegionLocateType.BEFORE)) { CellComparator comparator = CellComparator.getComparator(loc.getRegion().getTable()); byte[] endKey = loc.getRegion().getEndKey(); int c = comparator.compareRows(endKey, 0, endKey.length, req.row,0, req.row.length); completed = c == 0 || ((c > 0 || Bytes.equals(EMPTY_END_ROW, endKey)) && comparator.compareRows( loc.getRegion().getStartKey(), 0, loc.getRegion().getStartKey().length, req.row, 0, req.row.length) < 0); } else { completed = loc.getRegion().containsRow(req.row); } if (completed) { future.complete(locations); return true; } else { return false; } }
Source:
public int getHeight() { return recipeHeight; }

Target:
public int getHeight() { return this.recipeHeight; }