auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ImmutableCollection<IjFolder> createExcludes(final IjModule module) throws IOException { final ImmutableList.Builder<IjFolder> excludesBuilder = ImmutableList.builder(); final Path moduleBasePath = module.getModuleBasePath(); if (!projectFilesystem.exists(moduleBasePath)) { return ImmutableList.of(); } projectFilesystem.walkRelativeFileTree( moduleBasePath, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (filesystemTraversalBoundaryPaths.contains(dir) && !moduleBasePath.equals(dir)) { return FileVisitResult.SKIP_SUBTREE; } if (isRootAndroidResourceDirectory(module, dir)) { return FileVisitResult.SKIP_SUBTREE; } if (!referencedFolderPaths.contains(dir)) { excludesBuilder.add(new ExcludeFolder(dir)); return FileVisitResult.SKIP_SUBTREE; } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); return excludesBuilder.build(); }

Target:
public ImmutableCollection<IjFolder> createExcludes(final IjModule module) throws IOException { final Path moduleBasePath = module.getModuleBasePath(); if (!projectFilesystem.exists(moduleBasePath)) { return ImmutableList.of(); } final ImmutableList.Builder<IjFolder> excludesBuilder = ImmutableList.builder(); projectFilesystem.walkRelativeFileTree( moduleBasePath, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (filesystemTraversalBoundaryPaths.contains(dir) && !moduleBasePath.equals(dir)) { return FileVisitResult.SKIP_SUBTREE; } if (isRootAndroidResourceDirectory(module, dir)) { return FileVisitResult.SKIP_SUBTREE; } if (!referencedFolderPaths.contains(dir)) { excludesBuilder.add(new ExcludeFolder(dir)); return FileVisitResult.SKIP_SUBTREE; } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); return excludesBuilder.build(); }
Source:
public List<Community> findAll(Context context, MetadataField sortField, Integer limit, Integer offset) throws SQLException { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append("SELECT ").append(Community.class.getSimpleName()).append(" FROM Community as ") .append(Community.class.getSimpleName()).append(" "); addMetadataLeftJoin(queryBuilder, Community.class.getSimpleName(), Arrays.asList(sortField)); addMetadataSortQuery(queryBuilder, Arrays.asList(sortField), Collections.EMPTY_LIST); Query query = createQuery(context, queryBuilder.toString()); if (offset != null) { query.setFirstResult(offset); } if (limit != null) { query.setMaxResults(limit); } query.setParameter(sortField.toString(), sortField.getID()); return new LinkedList<Community>(new LinkedHashSet<>(list(query))); }

Target:
public List<Community> findAll(Context context, MetadataField sortField, Integer limit, Integer offset) throws SQLException { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append("SELECT c" + " FROM Community c" + " left join c.metadata title on title.metadataField = :sortField and" + " title.dSpaceObject = c.id and" + " title.place = (select min(internal.place) " + "from c.metadata internal " + "where internal.metadataField = :sortField and" + " internal.dSpaceObject = c.id)" + " ORDER BY LOWER(title.value)"); Query query = createQuery(context, queryBuilder.toString()); if (offset != null) { query.setFirstResult(offset); } if (limit != null) { query.setMaxResults(limit); } query.setParameter("sortField", sortField); return list(query); }
Source:
@Override public boolean isRebalanceEnabled() { return kernal.context().cache().context().isRebalanceEnabled(); }

Target:
@Override public boolean isRebalanceEnabled() { return kernal.isRebalanceEnabled(); }
Source:
public void doesNotHangWhenClearWithConcurrentPutsAndInvalidates() throws Exception { InternalCache cache = server.getCache(); Region<Object, Object> region = server.createPartitionRegion("regionA", f -> { }, f -> f.setTotalNumBuckets(1)); cache.getQueryService().createIndex("indexA", "r", "/regionA r"); region.put(0, "value0"); CompletableFuture<Void> put = executor.runAsync(() -> { Thread.currentThread().setName("put-Thread"); IntStream.range(0, 10).forEach(i -> region.put(i, "value" + i)); }); CompletableFuture<Void> invalidate = executor.runAsync(() -> { Thread.currentThread().setName("invalidate-Thread"); IntStream.range(0, 10).forEach(i -> { try { region.invalidate(i); } catch (EntryNotFoundException e) { } }); }); CompletableFuture<Void> clear = executor.runAsync(() -> { Thread.currentThread().setName("Clear-Thread"); region.clear(); }); put.get(5, TimeUnit.SECONDS); invalidate.get(5, TimeUnit.SECONDS); clear.get(5, TimeUnit.SECONDS); }

Target:
public void doesNotHangWhenClearWithConcurrentPutsAndInvalidates() throws Exception { InternalCache cache = server.getCache(); Region<Object, Object> region = server.createPartitionRegion("regionA", f -> { }, f -> f.setTotalNumBuckets(1)); cache.getQueryService().createIndex("indexA", "r", "/regionA r"); region.put(0, "value0"); CompletableFuture<Void> put = executor.runAsync(() -> { Thread.currentThread().setName("put-Thread"); IntStream.range(0, 10).forEach(i -> region.put(i, "value" + i)); }); CompletableFuture<Void> invalidate = executor.runAsync(() -> { Thread.currentThread().setName("invalidate-Thread"); IntStream.range(0, 10).forEach(i -> { try { region.invalidate(i); } catch (EntryNotFoundException e) { } }); }); CompletableFuture<Void> clear = executor.runAsync(() -> { Thread.currentThread().setName("Clear-Thread"); IntStream.range(0, 10).forEach(i -> region.clear()); }); put.get(5, TimeUnit.SECONDS); invalidate.get(5, TimeUnit.SECONDS); clear.get(5, TimeUnit.SECONDS); }
Source:
public String getEmail() { final List<Google2Email> list = getEmails(); if (list != null && list.size() > 0) return list.get(0).getEmail(); else return null; }

Target:
public String getEmail() { final List<Google2Email> list = getEmails(); if (list != null && list.size() > 0) { return list.get(0).getEmail(); } else { return null; } }
Source:
@Test public void testItemOperatorException() { sql("select ^name^[0] from dept") .fails("Cannot apply item operator to 'VARCHAR' for field 'DEPT.NAME'"); }

Target:
@Test public void testItemOperatorException() { sql("select ^name[0]^ from dept") .fails("Cannot apply 'ITEM' to arguments of type 'ITEM\\(<VARCHAR\\(10\\)>, " + "<INTEGER>\\)'\\. Supported form\\(s\\): <ARRAY>\\[<INTEGER>\\]\n" + "<MAP>\\[<VALUE>\\].*"); }
Source:
private boolean isSmartMeter(final Map<String, String> settings) { final String devtype = settings.get(Keys.KEY_DEVICE_TYPE); return SMART_METER_E.equals(devtype) || SMART_METER_G.equals(devtype) ; }

Target:
private boolean isSmartMeter(final Map<String, String> settings) { final String deviceType = settings.get(Keys.KEY_DEVICE_TYPE); return SMART_METER_E.equals(deviceType) || SMART_METER_G.equals(deviceType); }
Source:
public void requestDone(HttpServerExchange exchange) { try { Session<LocalSessionContext> session = this.entry.getKey(); if (session.isValid()) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { if (this.batch.getState() == Batch.State.DISCARDED) { this.batch.close(); } try (Batch batch = (this.batch.getState() == Batch.State.CLOSED) ? batcher.createBatch() : this.batch) { session.close(); } } catch (Throwable e) { UndertowClusteringLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e); } } else if (this.batch.getState() != Batch.State.CLOSED) { this.batch.close(); } } finally { this.closeTask.accept(exchange); } }

Target:
public void requestDone(HttpServerExchange exchange) { try { Session<LocalSessionContext> session = this.entry.getKey(); if (session.isValid()) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { if (this.batch.getState() == Batch.State.DISCARDED) { this.batch.close(); } try (Batch batch = (this.batch.getState() == Batch.State.CLOSED) ? batcher.createBatch() : this.batch) { session.close(); } } catch (Throwable e) { UndertowClusteringLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e); } } else if (this.batch.getState() != Batch.State.CLOSED) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { this.batch.close(); } } } finally { this.closeTask.accept(exchange); } }
Source:
public void testDialogAndTextBoxAfterReopenDialog() { enterTestText(); selectFormatting(FormattingOptions.SANS_SERIF); selectFormatting(FormattingOptions.UNDERLINE); selectFormatting(FormattingOptions.ITALIC); selectFormatting(FormattingOptions.BOLD); selectFormatting(FormattingOptions.STRIKETHROUGH); selectFormatting(FormattingOptions.SIZE_40); onToolBarView() .performCloseToolOptionsView(); PointF boxPosition = getToolMemberBoxPosition(); PointF newBoxPosition = new PointF(boxPosition.x + 20, boxPosition.y + 20); setToolMemberBoxPosition(newBoxPosition); setToolMemberBoxHeight(50.0f); setToolMemberBoxWidth(50.0f); onToolBarView() .performOpenToolOptionsView(); assertEquals(TEST_TEXT, textEditText.getText().toString()); assertEquals(FONT_SANS_SERIF, fontSpinner.getSelectedItem()); assertTrue(underlinedToggleButton.isChecked()); assertTrue(italicToggleButton.isChecked()); assertTrue(boldToggleButton.isChecked()); assertEquals("Wrong text size selected after reopen dialog", TEXT_SIZE_40_STRING, textSizeSpinner.getSelectedItem()); checkTextBoxDimensions(); }

Target:
public void testDialogAndTextBoxAfterReopenDialog() { enterTestText(); selectFormatting(FormattingOptions.SANS_SERIF); selectFormatting(FormattingOptions.UNDERLINE); selectFormatting(FormattingOptions.ITALIC); selectFormatting(FormattingOptions.BOLD); selectFormatting(FormattingOptions.STRIKETHROUGH); selectFormatting(FormattingOptions.SIZE_40); onToolBarView() .performCloseToolOptionsView(); PointF boxPosition = getToolMemberBoxPosition(); PointF newBoxPosition = new PointF(boxPosition.x + 20, boxPosition.y + 20); setToolMemberBoxPosition(newBoxPosition); setToolMemberBoxHeight(50.0f); setToolMemberBoxWidth(50.0f); onToolBarView() .performOpenToolOptionsView(); assertEquals(TEST_TEXT, textEditText.getText().toString()); assertEquals(FONT_SANS_SERIF, fontSpinner.getSelectedItem()); assertTrue(underlinedToggleButton.isChecked()); assertTrue(italicToggleButton.isChecked()); assertTrue(boldToggleButton.isChecked()); assertTrue(strikeThroughToggleButton.isChecked()); assertEquals("Wrong text size selected after reopen dialog", TEXT_SIZE_40_STRING, textSizeSpinner.getSelectedItem()); checkTextBoxDimensions(); }
Source:
private void showFeed() { Log.d(TAG, "Language is " + feed.getLanguage()); Log.d(TAG, "Author is " + feed.getAuthor()); Log.d(TAG, "URL is " + feed.getDownload_url()); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate()) .into(imgvCover); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.image_readability_tint) .error(R.color.image_readability_tint) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FastBlurTransformation()) .dontAnimate()) .into(imgvBackground); txtvTitle.setText(feed.getTitle()); String description = HtmlToPlainText.getPlainText(feed.getDescription()); txtvDescription.setText(description); txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}"); Iconify.addIcons(txtvUrl); getActivity().invalidateOptionsMenu(); }

Target:
private void showFeed() { Log.d(TAG, "Language is " + feed.getLanguage()); Log.d(TAG, "Author is " + feed.getAuthor()); Log.d(TAG, "URL is " + feed.getDownload_url()); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate()) .into(imgvCover); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.image_readability_tint) .error(R.color.image_readability_tint) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FastBlurTransformation()) .dontAnimate()) .into(imgvBackground); txtvTitle.setText(feed.getTitle()); String description = HtmlToPlainText.getPlainText(feed.getDescription()); txtvDescription.setText(description); if (!TextUtils.isEmpty(feed.getAuthor())) { txtvAuthorHeader.setText(feed.getAuthor()); } txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}"); Iconify.addIcons(txtvUrl); getActivity().invalidateOptionsMenu(); }
Source:
private static Set<String> getSchemaNames(DatabaseMetaData meta, String schemaFilter) { Set<String> res = new HashSet<>(); try { ResultSet schemas = meta.getSchemas(); try { while (schemas.next()) { String schemaName = schemas.getString("TABLE_SCHEM"); if (schemaFilter.equals("") || schemaFilter == null || schemaName.matches( schemaFilter.replace("_", ".").replace("%", ".*?"))) { res.add(schemaName); } } } finally { schemas.close(); } } catch (Throwable t) { logger.error("Failed to retrieve the schema names", t); } return res; }

Target:
private static Set<String> getSchemaNames(DatabaseMetaData meta, String schemaFilter) { Set<String> res = new HashSet<>(); try { ResultSet schemas = meta.getSchemas(); try { while (schemas.next()) { String schemaName = schemas.getString("TABLE_SCHEM"); if (schemaFilter.equals("") || schemaFilter == null || schemaName.matches( schemaFilter.replace("_", ".").replace("%", ".*?"))) { res.add(schemaName); } } } finally { schemas.close(); } } catch (SQLException t) { logger.error("Failed to retrieve the schema names", t); } return res; }
Source:
void onRunSchedulerExampleButtonClicked() { Observable.defer(new Func0<Observable<String>>() { @Override public Observable<String> call() { try { Thread.sleep(TimeUnit.SECONDS.toMillis(5)); } catch (InterruptedException e) { throw OnErrorThrowable.from(e); } return Observable.just("one", "two", "three", "four", "five"); } }) .subscribeOn(handlerThread(backgroundThreadHandler)) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<String>() { @Override public void onCompleted() { Log.d(TAG, "onCompleted()"); } @Override public void onError(Throwable e) { Log.e(TAG, "onError()", e); } @Override public void onNext(String string) { Log.d(TAG, "onNext(" + string + ")"); } }); }

Target:
void onRunSchedulerExampleButtonClicked() { sampleObservable() .subscribeOn(handlerThread(backgroundThreadHandler)) .observeOn(mainThread()) .subscribe(new Subscriber<String>() { @Override public void onCompleted() { Log.d(TAG, "onCompleted()"); } @Override public void onError(Throwable e) { Log.e(TAG, "onError()", e); } @Override public void onNext(String string) { Log.d(TAG, "onNext(" + string + ")"); } }); }
Source:
public List<MapGenStructure> getStructuresImmutable() { return ImmutableList.copyOf(structureList); }

Target:
public List<MapGenStructure> getStructuresImmutable() { return Collections.unmodifiableList(structureList); }
Source:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FragmentActivity activity = getActivity(); if (!(activity instanceof EmailLinkEmailPromptFragment.EmailLinkPromptEmailListener)) { throw new IllegalStateException("Activity must implement EmailLinkPromptEmailListener"); } mListener = (FinishEmailLinkSignInListener) activity; }

Target:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FragmentActivity activity = getActivity(); if (!(activity instanceof FinishEmailLinkSignInListener)) { throw new IllegalStateException("Activity must implement EmailLinkPromptEmailListener"); } mListener = (FinishEmailLinkSignInListener) activity; }
Source:
private void print(Rules rule, Severity severity, String msg, Location location) { ViolationMessage violationMessage; if (rule != null) { violationMessage = new ViolationMessage(rule, location.line, location.column, severity, msg); } else { violationMessage = new ViolationMessage(location.line, location.column, severity, msg); } try { violationMessage.setFilePath(this.inputFile.getCanonicalPath()); } catch (IOException e) { System.err.println("Error in getting canonical path of input file: " + e.getMessage()); } this.msgBuffer.put(violationMessage.toString(), violationMessage); }

Target:
private void print(Rules rule, Severity severity, String msg, Location location) { ViolationMessage violationMessage = new ViolationMessage(rule, location.line, location.column, severity, msg); addToMsgBuffer(violationMessage); }
Source:
public HtlChecks addChecks(String repositoryKey, Iterable<Class<? extends HtlCheck>> checkClass) { checksByRepository.add(checkFactory .<HtlCheck>create(repositoryKey) .addAnnotatedChecks(checkClass)); return this; }

Target:
public HtlChecks addChecks(String repositoryKey, Iterable<Class<? extends HtlCheck>> checkClass) { Checks<HtlCheck> htlChecks = checkFactory .<HtlCheck>create(repositoryKey) .addAnnotatedChecks(checkClass); checksByRepository.add(htlChecks); return this; }
Source:
@Bean OAuthInterceptor getAuthenticationInterceptor() { OAuthInterceptor interceptor = new OAuthInterceptor(userFetcher(), idCodec); interceptor.setUrlsToProtect(ImmutableSet.of( "/4.0/applications", "/4.0/sources", "/4.0/requests", "/4.0/users", "/4.0/auth/user")); interceptor.setUrlsNotRequiringCompleteProfile(ImmutableSet.of( "/4.0/auth/user", "/4.0/users/:uid")); return interceptor; }

Target:
@Bean OAuthInterceptor getAuthenticationInterceptor() { return OAuthInterceptor .builder() .withUserFetcher(userFetcher()) .withIdCodec(idCodec) .withUrlsToProtect(ImmutableSet.of( "/4.0/applications", "/4.0/sources", "/4.0/requests", "/4.0/users", "/4.0/auth/user")) .withUrlsNotNeedingCompleteProfile(ImmutableSet.of( "/4.0/auth/user", "/4.0/users/:uid")) .build(); }
Source:
public void fixPrjFile() throws IOException { CoordinateReferenceSystem crs = readPrjToCRS(); if (crs == null) { return; } try { CoordinateReferenceSystem epsgCrs = null; Integer epsgCode = EPSG_LOOKUP_CACHE.lookupEPSGCode(crs); if (epsgCode != null) { epsgCrs = CRS.decode("EPSG:" + epsgCode); } if (epsgCrs != null) { String epsgWKT = epsgCrs.toWKT(); final PrintStream printStream = new PrintStream(getPrjFile().out()); printStream.print(epsgWKT); printStream.close(); } } catch (FactoryException e) { throw (IOException) new IOException().initCause(e); } }

Target:
public void fixPrjFile() throws IOException { CoordinateReferenceSystem crs = readPrjToCRS(); if (crs == null) { return; } try { CoordinateReferenceSystem epsgCrs = null; Integer epsgCode = EPSG_LOOKUP_CACHE.lookupEPSGCode(crs); if (epsgCode != null) { epsgCrs = CRS.decode("EPSG:" + epsgCode); } if (epsgCrs != null) { String epsgWKT = epsgCrs.toWKT(); try (PrintStream printStream = new PrintStream(getPrjFile().out())) { printStream.print(epsgWKT); } } } catch (FactoryException e) { throw (IOException) new IOException().initCause(e); } }
Source:
private static void waitForHBaseToComeOnline(MiniHBaseCluster hbaseCluster) throws IOException { while (true) { if (hbaseCluster.getRegionServer(0).isOnline()) { break; } } HTable t = new HTable(hbaseCluster.getConf(), HBASE_META_TABLE); ResultScanner s = t.getScanner(new Scan()); while (s.next() != null) { continue; } s.close(); t.close(); }

Target:
private static void waitForHBaseToComeOnline(MiniHBaseCluster hbaseCluster) throws IOException, InterruptedException { while (!hbaseCluster.getMaster().isInitialized()) { Thread.sleep(1000); } hbaseCluster.getRegionServer(0).waitForServerOnline(); HTable t = new HTable(hbaseCluster.getConf(), HBASE_META_TABLE); ResultScanner s = t.getScanner(new Scan()); while (s.next() != null) { continue; } s.close(); t.close(); }
Source:
public void endWithFailure() { }

Target:
public void endWithFailure() { revertTask(); enclosingCommand.getReturnValue().setSucceeded(true); }
Source:
public synchronized void dispose() { if (masterMap != null) { masterMap.removeMapChangeListener(masterMapListener); masterMap.removeStaleListener(masterStaleListener); } if (keyDetailMap != null) { for (Iterator<IObservableValue<E>> iter = keyDetailMap.values() .iterator(); iter.hasNext();) { IObservableValue<E> detailValue = iter.next(); detailValue.dispose(); } keyDetailMap.clear(); } masterMap = null; observableValueFactory = null; detailValueType = null; keyDetailMap = null; masterStaleListener = null; detailStaleListener = null; staleDetailObservables = null; super.dispose(); }

Target:
public synchronized void dispose() { if (masterMap != null) { masterMap.removeMapChangeListener(masterMapListener); masterMap.removeStaleListener(masterStaleListener); } if (keyDetailMap != null) { for (IObservableValue<E> detailValue : keyDetailMap.values()) { detailValue.dispose(); } keyDetailMap.clear(); } masterMap = null; observableValueFactory = null; detailValueType = null; keyDetailMap = null; masterStaleListener = null; detailStaleListener = null; staleDetailObservables = null; super.dispose(); }
Source:
public void saveEncounter_shouldCascadeSaveToContainedConditions() { Encounter encounter = buildEncounter(); Condition pregnancy = new Condition(); CodedOrFreeText freeTextForPregnancy = new CodedOrFreeText(); freeTextForPregnancy.setNonCoded("Pregnancy"); pregnancy.setCondition(freeTextForPregnancy); pregnancy.setPatient(encounter.getPatient()); encounter.addCondition(pregnancy); Condition edema = new Condition(); CodedOrFreeText freeTextForEdema = new CodedOrFreeText(); freeTextForEdema.setNonCoded("Edema"); edema.setCondition(freeTextForEdema); edema.setPatient(encounter.getPatient()); encounter.addCondition(edema); Context.getEncounterService().saveEncounter(encounter); Object[] conditionsArray = encounter.getConditions().toArray(); pregnancy = (Condition) conditionsArray[0]; edema = (Condition) conditionsArray[1]; assertEquals(2, conditionsArray.length); assertNotNull(pregnancy.getId()); assertEquals("Pregnancy", pregnancy.getCondition().getNonCoded()); assertNotNull(edema.getId()); assertEquals("Edema", edema.getCondition().getNonCoded()); }

Target:
public void saveEncounter_shouldCascadeSaveToContainedConditions() { Encounter encounter = buildEncounter(); Condition pregnancy = new Condition(); CodedOrFreeText freeTextForPregnancy = new CodedOrFreeText(); freeTextForPregnancy.setNonCoded("Pregnancy"); pregnancy.setCondition(freeTextForPregnancy); pregnancy.setPatient(encounter.getPatient()); Condition edema = new Condition(); CodedOrFreeText freeTextForEdema = new CodedOrFreeText(); freeTextForEdema.setNonCoded("Edema"); edema.setCondition(freeTextForEdema); edema.setPatient(encounter.getPatient()); encounter.addCondition(pregnancy); encounter.addCondition(edema); Context.getEncounterService().saveEncounter(encounter); Object[] conditionsArray = encounter.getConditions().toArray(); pregnancy = (Condition) conditionsArray[0]; edema = (Condition) conditionsArray[1]; assertEquals(2, conditionsArray.length); assertNotNull(pregnancy.getId()); assertEquals("Pregnancy", pregnancy.getCondition().getNonCoded()); assertNotNull(edema.getId()); assertEquals("Edema", edema.getCondition().getNonCoded()); }
Source:
public void testMerge() { final List<String> first = new ArrayList<String>(); first.add(null); final List<String> second = new ArrayList<String>(); second.add("a/b/c"); final List<String> actual = Utils.merge(first, second); final List<String> arrayList = new ArrayList<String>(); arrayList.add(null); arrayList.add("a/b/c"); assertEquals(arrayList, actual); }

Target:
public void testMerge() { assertEquals( Arrays.asList("foo", "bar"), Utils.merge(Arrays.asList("foo"), Arrays.asList("bar")) ); }
Source:
public int hashCode() { if (hashCode == null) { hashCode = Objects.hash(lockMap, lockTimeout, lockGroupBehavior, blockingMode, blockingDuration, versionId); } return hashCode; }

Target:
public int hashCode() { int tempHashCode = hashCode; if (tempHashCode == 0) { tempHashCode = Objects.hash(lockMap, lockTimeout, lockGroupBehavior, blockingMode, blockingDuration, versionId); hashCode = tempHashCode; } return tempHashCode; }
Source:
public static NamedQueueEvent getEventByOrdinal(int value){ switch (value) { case 0: { return SLOW_LOG; } case 1: { return BALANCE_DECISION; } default: { throw new IllegalArgumentException("Failed to retrieve NamedQueue Event"); } } }

Target:
public static NamedQueueEvent getEventByOrdinal(int value){ switch (value) { case 0: { return SLOW_LOG; } case 1: { return BALANCE_DECISION; } default: { throw new IllegalArgumentException( "NamedQueue event with ordinal " + value + " not defined"); } } }
Source:
private File addToWorkDir(String path, String content) throws IOException { File f = new File(db.getWorkDir(), path); FileOutputStream fos = new FileOutputStream(f); try { fos.write(content.getBytes()); return f; } finally { fos.close(); } }

Target:
private File addToWorkDir(String path, String content) throws IOException { File f = new File(db.getWorkDir(), path); FileOutputStream fos = new FileOutputStream(f); try { fos.write(content.getBytes(Constants.CHARACTER_ENCODING)); return f; } finally { fos.close(); } }
Source:
private String getInstituteForStudent( CourseStudent student, List<Instructor> allInstructors, List<Account> allAccounts) { if (courseIdToInstituteMap.containsKey(student.getCourseId())) { return courseIdToInstituteMap.get(student.getCourseId()); } List<Instructor> instructorList = new ArrayList<>(); for (Instructor instructor : allInstructors) { if (instructor.getCourseId().equals(student.getCourseId())) { instructorList.add(instructor); } } String institute = getInstituteForInstructors(instructorList, allAccounts); courseIdToInstituteMap.put(student.getCourseId(), institute); return institute; }

Target:
private String getInstituteForStudent( CourseStudent student, List<Instructor> allInstructors, List<Account> allAccounts) { if (courseIdToInstituteMap.containsKey(student.getCourseId())) { return courseIdToInstituteMap.get(student.getCourseId()); } List<Instructor> instructorList = getInstructorsOfCourse(allInstructors, student.getCourseId()); String institute = getInstituteForInstructors(instructorList, allAccounts); courseIdToInstituteMap.put(student.getCourseId(), institute); return institute; }
Source:
public Config getSystem() { return new EmptyConfig(); }

Target:
public Config getSystem() { return EmptyConfig.INSTANCE; }
Source:
public void testWhenNextMarkerAbsentDoesntAdvance() { GeneratedHttpRequest request = args(ImmutableList.of()); TestArgs converter = new TestArgs(request) { @Override protected Function<Object, IterableWithMarker<String>> markerToNextForArgs(List<Object> args) { fail(); return null; } }; assertEquals(converter.apply(IterableWithMarkers.from(ImmutableSet.of("foo", "bar"))).concat().toSet(), ImmutableSet.of("foo", "bar")); }

Target:
public void testWhenNextMarkerAbsentDoesntAdvance() { GeneratedHttpRequest request = args(ImmutableList.of()); TestArgs converter = new TestArgs(request) { @Override protected Function<Object, IterableWithMarker<String>> markerToNextForArgs(List<Object> args) { fail("The Iterable should not advance"); return null; } }; assertEquals(converter.apply(IterableWithMarkers.from(ImmutableSet.of("foo", "bar"))).concat().toSet(), ImmutableSet.of("foo", "bar")); }
Source:
private String addRecordTranslator () { String translatorId = "avroKafkaSpoutTranslator" + UUID_FOR_COMPONENTS; String translatorClassname = "com.hortonworks.streamline.streams.runtime.storm.spout.AvroKafkaSpoutTranslator"; List<Object> constructorArgs = new ArrayList<>(); constructorArgs.addAll(getConstructorArgsYaml(new String[]{TopologyLayoutConstants.JSON_KEY_OUTPUT_STREAM_ID, TopologyLayoutConstants .JSON_KEY_TOPIC})); constructorArgs.add(kafkaSource != null ? kafkaSource.getId() : ""); constructorArgs.add(conf.get(TopologyLayoutConstants.SCHEMA_REGISTRY_URL)); Object readerSchemaVersionObj = conf.get("readerSchemaVersion"); if (readerSchemaVersionObj != null) { String readerSchemaVersion = (String) readerSchemaVersionObj; if (!readerSchemaVersion.isEmpty()) { constructorArgs.add(Integer.parseInt(readerSchemaVersion)); } } addToComponents(createComponent(translatorId, translatorClassname, null, constructorArgs, null)); return translatorId; }

Target:
private String addRecordTranslator () { String translatorId = "avroKafkaSpoutTranslator" + UUID_FOR_COMPONENTS; String translatorClassname = "com.hortonworks.streamline.streams.runtime.storm.spout.AvroKafkaSpoutTranslator"; List<Object> constructorArgs = new ArrayList<>(); constructorArgs.addAll(getConstructorArgsYaml(new String[]{TopologyLayoutConstants.JSON_KEY_OUTPUT_STREAM_ID, TopologyLayoutConstants .JSON_KEY_TOPIC})); constructorArgs.add(kafkaSource != null ? kafkaSource.getId() : ""); constructorArgs.add(conf.get(TopologyLayoutConstants.SCHEMA_REGISTRY_URL)); String readerSchemaVersion = (String) conf.get("readerSchemaVersion"); if(readerSchemaVersion != null && !readerSchemaVersion.isEMpty()) { constructorArgs.add(Integer.parseInt(readerSchemaVersion)) } addToComponents(createComponent(translatorId, translatorClassname, null, constructorArgs, null)); return translatorId; }
Source:
protected void checkTextConversion(String textContent) { assertTrue(!textContent.isEmpty()); String[] cells = textContent.trim().split(separator); assertTrue(cells.length == 2); assertArrayEquals(cells, new String[] { "hello", "world" }); }

Target:
protected void checkTextConversion(String textContent) { String[] cells = textContent.trim().split(" "); assertTrue(cells.length == 2); assertArrayEquals(cells, new String[] { "hello", "world" }); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); if (mSearchRecentsListView != null) { mSearchRecentsListView.setAdapter(mRecentSearchesAdapter); if (mSearchQuery == null) { mSearchRecentsListView.setVisibility(View.VISIBLE); mSearchRecentsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String query = mRecentSearches.get(position); Activity activity = getActivity(); if (activity instanceof BoxBrowseActivity) { ((BoxBrowseActivity)activity).setSearchQuery(query); } } }); } } mSearchFiltersHeader = view.findViewById(R.id.filterResultsHeader); mSearchFiltersHeader.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startFilterActivity(); } }); setupSearchFiltersHeader(); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); mSearchFiltersHeader = view.findViewById(R.id.filterResultsHeader); mSearchFiltersHeader.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startFilterActivity(); } }); setupSearchFiltersHeader(); return view; }
Source:
protected void scrollToElement(WebElement element) { try { ((JavascriptExecutor) driver).executeScript( "var x = $(arguments[0]); window.scroll(0,parseInt(x.offset().top - 100));", element); } catch (WebDriverException e) { if (e.getMessage().contains(XSSContent.NO_JQUERY_ERROR)) { PageObjectLogging.log("JSError", "JQuery is not defined", false); } } }

Target:
protected void scrollToElement(WebElement element) { try { ((JavascriptExecutor) driver).executeScript( "var x = $(arguments[0]); " + "window.scroll(0,parseInt(x.offset().top - 100));", element ); } catch (WebDriverException e) { if (e.getMessage().contains(XSSContent.NO_JQUERY_ERROR)) { PageObjectLogging.log("JSError", "JQuery is not defined", false); } } }
Source:
protected List<SQLTranslation> fetchAllTranslations(@Nonnull Mapping field) { return oma.select(SQLTranslation.class) .eq(Translation.TRANSLATION_DATA.inner(TranslationData.OWNER), owner.getUniqueName()) .eq(Translation.TRANSLATION_DATA.inner(TranslationData.FIELD), field.getName()) .limit(supportedLanguages.size()) .queryList(); }

Target:
protected List<SQLTranslation> fetchAllTranslations(@Nonnull Mapping field) { return oma.select(SQLTranslation.class) .eq(Translation.TRANSLATION_DATA.inner(TranslationData.OWNER), owner.getUniqueName()) .eq(Translation.TRANSLATION_DATA.inner(TranslationData.FIELD), field.getName()) .queryList(); }
Source:
private void match(BuiltinList builtinList, BuiltinList pattern) { addMatchingTask( builtinList.toLabelRepresentation(termContext), pattern.toLabelRepresentation(termContext)); }

Target:
private void match(BuiltinList builtinList, BuiltinList pattern) { addMatchingTask( builtinList.toK(termContext), pattern.toK(termContext)); }
Source:
private boolean shouldAbortOnClientInactivityTimeout(ImageTransfer entity, long ts, Integer idleTimeFromTicket) { int inactivityTimeout = entity.getClientInactivityTimeout() != null ? entity.getClientInactivityTimeout() : getTransferImageClientInactivityTimeoutInSeconds(); boolean timeoutExceeded = idleTimeFromTicket != null ? idleTimeFromTicket > inactivityTimeout : ts > (entity.getLastUpdated().getTime() / 1000) + inactivityTimeout; return inactivityTimeout > 0 && timeoutExceeded && !entity.getActive(); }

Target:
private boolean shouldAbortOnClientInactivityTimeout(ImageTransfer entity, long ts, Integer idleTimeFromTicket) { int inactivityTimeout = entity.getClientInactivityTimeout(); boolean timeoutExceeded = idleTimeFromTicket != null ? idleTimeFromTicket > inactivityTimeout : ts > (entity.getLastUpdated().getTime() / 1000) + inactivityTimeout; return inactivityTimeout > 0 && timeoutExceeded && !entity.getActive(); }
Source:
public String toString() { return "ClientConfiguration{" + ", cacheManagerTtl=" + cacheManagerTtl + ", cacheManagerTti=" + cacheManagerTti + ", cacheManagerCaches=" + cacheManagerCaches + ", baseUrl='" + getBaseUrl() + '\'' + ", authorizationMode='" + getAuthorizationMode() + ", clientId='" + getClientId() + ", scopes='" + getScopes() + ", privateKey=" + getPrivateKey() + ", connectionTimeout=" + getConnectionTimeout() + ", requestAuthenticator=" + getRequestAuthenticator() + ", retryMaxElapsed=" + getRetryMaxElapsed() + ", retryMaxAttempts=" + getRetryMaxAttempts() + ", proxy=" + getProxy() + '}'; }

Target:
public String toString() { return "ClientConfiguration {cacheManagerTtl=" + cacheManagerTtl + ", cacheManagerTti=" + cacheManagerTti + ", cacheManagerCaches=" + cacheManagerCaches + ", baseUrl='" + getBaseUrl() + '\'' + ", authorizationMode=" + getAuthorizationMode() + ", clientId=" + getClientId() + ", scopes=" + getScopes() + ", privateKey=" + ((getPrivateKey() != null) ? "xxxxx" : null) + ", connectionTimeout=" + getConnectionTimeout() + ", requestAuthenticator=" + getRequestAuthenticator() + ", retryMaxElapsed=" + getRetryMaxElapsed() + ", retryMaxAttempts=" + getRetryMaxAttempts() + ", proxy=" + getProxy() + " }"; }
Source:
public void testBulkWrites() throws Exception { CountDownLatch countDownLatch = new CountDownLatch(20); loaderWriter.setLatch(countDownLatch); for(int i=0 ; i<10; i++) testCache.put("test"+i, "test"+i); Map<String, String> entries = new HashMap<String, String>(10); Set<String> keys = new HashSet<String>(10); for(int i=10 ; i<19; i++) { entries.put("test"+i, "test"+i); keys.add("test"+i); } Thread.sleep(1000); entries.put("test20", "test20"); keys.add("test20"); testCache.putAll(entries); countDownLatch.await(5, TimeUnit.SECONDS); assertThat(loaderWriter.getData().size(), is(20)); CountDownLatch countDownLatch1 = new CountDownLatch(10); loaderWriter.setLatch(countDownLatch1); testCache.removeAll(keys); countDownLatch1.await(5, TimeUnit.SECONDS); assertThat(loaderWriter.getData().size(), is(10)); }

Target:
public void testBulkWrites() throws Exception { CountDownLatch countDownLatch = new CountDownLatch(20); loaderWriter.setLatch(countDownLatch); for(int i=0 ; i<10; i++) testCache.put("test"+i, "test"+i); Map<String, String> entries = new HashMap<String, String>(10); Set<String> keys = new HashSet<String>(10); for(int i=10 ; i<20; i++) { entries.put("test"+i, "test"+i); keys.add("test"+i); } testCache.putAll(entries); countDownLatch.await(5, TimeUnit.SECONDS); assertThat(loaderWriter.getData().size(), is(20)); CountDownLatch countDownLatch1 = new CountDownLatch(10); loaderWriter.setLatch(countDownLatch1); testCache.removeAll(keys); countDownLatch1.await(5, TimeUnit.SECONDS); assertThat(loaderWriter.getData().size(), is(10)); }
Source:
public Collection<Config> getAllConfigs() { return GlobalConfigFiles.get().getConfigs(); }

Target:
public Collection<Config> getAllConfigs() { return GlobalConfigFiles.get().getConfigs(getClass()); }
Source:
private boolean isCurrentFilter(String filter) { if (TextUtils.isEmpty(filter) && TextUtils.isEmpty(mCurrentFilter)) { return true; } return filter.equalsIgnoreCase(mCurrentFilter); }

Target:
private boolean isCurrentFilter(String filter) { if (TextUtils.isEmpty(filter) && TextUtils.isEmpty(mCurrentFilter)) { return true; } return filter != null && filter.equalsIgnoreCase(mCurrentFilter); }
Source:
public void synchronizeMailboxSynchronous_withAccountPolicySetToExpungeOnPoll_shouldExpungeRemoteFolder() throws Exception { messageCountInRemoteFolder(1); when(account.getExpungePolicy()).thenReturn(Account.Expunge.EXPUNGE_ON_POLL); configureRemoteStoreWithFolder(); controller.synchronizeMailboxSynchronous(account, FOLDER_NAME, listener, null); verify(remoteFolder).expunge(anySet()); }

Target:
public void synchronizeMailboxSynchronous_withAccountPolicySetToExpungeOnPoll_shouldExpungeRemoteFolder() throws Exception { messageCountInRemoteFolder(1); when(account.getExpungePolicy()).thenReturn(Account.Expunge.EXPUNGE_ON_POLL); configureRemoteStoreWithFolder(); controller.synchronizeMailboxSynchronous(account, FOLDER_NAME, listener, null); verify(remoteFolder).expunge(); }
Source:
public void scan(File dir, FileVisitor visitor) throws IOException { if (Util.fixEmpty(this.includes) == null && this.excludes == null) { (new DirScanner.Full()).scan(dir, visitor); } else { FileSet fs = Util.createFileSet(dir, this.includes, this.excludes); fs.setDefaultexcludes(this.useDefaultExcludes); fs.setFollowSymlinks(followSymlinks); if (dir.exists()) { DirectoryScanner ds = fs.getDirectoryScanner(new Project()); String[] var5 = (String [])ArrayUtils.addAll(ds.getIncludedFiles(), Stream.of(ds.getNotFollowedSymlinks()) .map(s -> dir.toPath().relativize(Paths.get(s)).toString()) .toArray() ); for (String f : var5) { File file = new File(dir, f); this.scanSingle(file, f, visitor); } } } }

Target:
public void scan(File dir, FileVisitor visitor) throws IOException { FileSet fileSet = Util.createFileSet(dir, Optional.ofNullable(Util.fixEmpty(this.includes)).orElse("**/*"), Optional.ofNullable(Util.fixEmpty(this.excludes)).orElse("")); fileSet.setDefaultexcludes(this.useDefaultExcludes); fileSet.setFollowSymlinks(followSymlinks); if (dir.exists()) { DirectoryScanner dirScanner = fileSet.getDirectoryScanner(new Project()); String[] var5 = (String[]) ArrayUtils.addAll(dirScanner.getIncludedFiles(), Stream.of(dirScanner.getNotFollowedSymlinks()) .map(s -> dir.toPath().relativize(Paths.get(s)).toString()) .toArray() ); int var6 = var5.length; for (int var7 = 0; var7 < var6; ++var7) { String f = var5[var7]; File file = new File(dir, f); this.scanSingle(file, f, visitor); } } }
Source:
public void setUp() { when(model.getProgress()).thenReturn(null, progressModel); Config.setConfigUtils(mock(IConfigUtilsInterface.class)); when(Config.getConfigUtils().getValue(ConfigValues.CoCoCommandLifeInMinutes, ConfigCommon.defaultConfigurationVersion)).thenReturn(300); }

Target:
public void setUp() { when(model.getProgress()).thenReturn(null, progressModel); }
Source:
public boolean checkMasterPassword(char[] passwd) { try { if (!this.masterPasswordProviderHelper .loadConfig(this.masterPasswordConfig.getProviderName()) .isCanLogin()) { return false; } } catch (IOException e) { throw new RuntimeException("Unable to load master password provider config", e); } GeoServerDigestPasswordEncoder pwEncoder = loadPasswordEncoder(GeoServerDigestPasswordEncoder.class); if (masterPasswdDigest == null) { synchronized (this) { if (masterPasswdDigest == null) { try { masterPasswdDigest = loadMasterPasswordDigest(); } catch (IOException e) { throw new RuntimeException("Unable to create master password digest", e); } } } } return pwEncoder.isPasswordValid(masterPasswdDigest, passwd, null); }

Target:
public boolean checkMasterPassword(char[] passwd) { try { if (!this.masterPasswordProviderHelper .loadConfig(this.masterPasswordConfig.getProviderName()) .isLoginEnabled()) { return false; } } catch (IOException e) { throw new RuntimeException("Unable to load master password provider config", e); } GeoServerDigestPasswordEncoder pwEncoder = loadPasswordEncoder(GeoServerDigestPasswordEncoder.class); if (masterPasswdDigest == null) { synchronized (this) { if (masterPasswdDigest == null) { try { masterPasswdDigest = loadMasterPasswordDigest(); } catch (IOException e) { throw new RuntimeException("Unable to create master password digest", e); } } } } return pwEncoder.isPasswordValid(masterPasswdDigest, passwd, null); }
Source:
public Mono<AccessToken> authenticateWithPemCertificate(String pemCertificatePath, TokenRequestContext request) { String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + tenantId; try { byte[] pemCertificateBytes = Files.readAllBytes(Paths.get(pemCertificatePath)); ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.createFromCertificate( CertificateUtil.privateKeyFromPem(pemCertificateBytes), CertificateUtil.publicKeyFromPem(pemCertificateBytes))) .httpClient(new HttpPipelineAdapter(options.getHttpPipeline())) .authority(authorityUrl); if (options.getProxyOptions() != null) { applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } if (options.getHttpPipeline() != null) { applicationBuilder.httpClient(new HttpPipelineAdapter(options.getHttpPipeline())); } ConfidentialClientApplication application = applicationBuilder.build(); return Mono.fromFuture(application.acquireToken( ClientCredentialParameters.builder(new HashSet<>(request.getScopes())) .build())) .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), ZoneOffset.UTC))); } catch (IOException e) { return Mono.error(e); } }

Target:
public Mono<AccessToken> authenticateWithPemCertificate(String pemCertificatePath, TokenRequestContext request) { String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + tenantId; try { byte[] pemCertificateBytes = Files.readAllBytes(Paths.get(pemCertificatePath)); ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.createFromCertificate( CertificateUtil.privateKeyFromPem(pemCertificateBytes), CertificateUtil.publicKeyFromPem(pemCertificateBytes))) .authority(authorityUrl); if (options.getProxyOptions() != null) { applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } if (options.getHttpPipeline() != null) { applicationBuilder.httpClient(new HttpPipelineAdapter(options.getHttpPipeline())); } ConfidentialClientApplication application = applicationBuilder.build(); return Mono.fromFuture(application.acquireToken( ClientCredentialParameters.builder(new HashSet<>(request.getScopes())) .build())) .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), ZoneOffset.UTC))); } catch (IOException e) { return Mono.error(e); } }
Source:
public void testSetStarred() throws Exception { int reviewId = Integer.parseInt(reviewHarness.shortId); boolean starred = true; reviewHarness.client.setStarred(reviewHarness.shortId, starred, new NullProgressMonitor()); ChangeDetailX changeDetail = reviewHarness.client.getChangeDetail(reviewId, new NullProgressMonitor()); assertEquals(starred, changeDetail.isStarred()); starred = false; reviewHarness.client.setStarred(reviewHarness.shortId, starred, new NullProgressMonitor()); changeDetail = reviewHarness.client.getChangeDetail(reviewId, new NullProgressMonitor()); assertEquals(starred, changeDetail.isStarred()); }

Target:
public void testSetStarred() throws Exception { int reviewId = Integer.parseInt(reviewHarness.shortId); reviewHarness.client.setStarred(reviewHarness.shortId, true, new NullProgressMonitor()); ChangeDetailX changeDetail = reviewHarness.client.getChangeDetail(reviewId, new NullProgressMonitor()); assertEquals(true, changeDetail.isStarred()); reviewHarness.client.setStarred(reviewHarness.shortId, true, new NullProgressMonitor()); changeDetail = reviewHarness.client.getChangeDetail(reviewId, new NullProgressMonitor()); assertEquals(true, changeDetail.isStarred()); reviewHarness.client.setStarred(reviewHarness.shortId, false, new NullProgressMonitor()); changeDetail = reviewHarness.client.getChangeDetail(reviewId, new NullProgressMonitor()); assertEquals(false, changeDetail.isStarred()); }
Source:
private static List<List<Trivia>> groupTrivias(Token token) { List<List<Trivia>> result = new LinkedList<>(); List<Trivia> currentGroup = null; for (Trivia trivia : token.trivia()) { currentGroup = handleOneLineComment(result, currentGroup, trivia); } if (currentGroup != null) { result.add(currentGroup); } return result; }

Target:
private static List<List<Trivia>> groupTrivias(Token token) { List<List<Trivia>> result = new ArrayList<>(); List<Trivia> currentGroup = null; for (Trivia trivia : token.trivia()) { currentGroup = handleOneLineComment(result, currentGroup, trivia); } if (currentGroup != null) { result.add(currentGroup); } return result; }
Source:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "MistMaster is started"); if (!masterRecovery) { final Collection<AllocatedTask> allocatedTasks = taskRequestor.setupTaskAndConn(initialTaskNum); if (allocatedTasks == null) { LOG.log(Level.SEVERE, "Mist tasks are not successfully submitted!"); throw new IllegalStateException("Internal Error : No tasks are allocated!"); } else { masterSetupFinished.setFinished(); } } else { applicationCodeManager.recoverAppJarInfo(); taskRequestor.recoverTaskConn(); masterSetupFinished.setFinished(); } if (dynamicScalingEnabled) { final ScheduledExecutorService dynamicScalingService = Executors.newSingleThreadScheduledExecutor(); final Injector injector = tang.newInjector(); final DynamicScalingPolicy policy = injector.getInstance(DefaultDynamicScalingPolicy.class); dynamicScalingService.schedule(new DynamicScalingRunner(policy), dynamicScalingPeriod, TimeUnit.MILLISECONDS); } this.countDownLatch.await(); this.driverToMasterServer.close(); this.clientToMasterServer.close(); this.taskToMasterServer.close(); return null; }

Target:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "MistMaster is started"); if (!masterRecovery) { final Collection<AllocatedTask> allocatedTasks = taskRequestor.setupTaskAndConn(initialTaskNum); if (allocatedTasks == null) { LOG.log(Level.SEVERE, "Mist tasks are not successfully submitted!"); throw new IllegalStateException("Internal Error : No tasks are allocated!"); } else { masterSetupFinished.setFinished(); } } else { applicationCodeManager.recoverAppJarInfo(); taskRequestor.recoverTaskConn(); masterSetupFinished.setFinished(); } this.dynamicScalingManager.startAutoScaling(); this.countDownLatch.await(); this.driverToMasterServer.close(); this.clientToMasterServer.close(); this.taskToMasterServer.close(); this.dynamicScalingManager.close(); return null; }