auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected View onCreateViewHelper(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, int fragmentResource) { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(fragmentResource, container, false); listView = (RecyclerView) root.findViewById(android.R.id.list); layoutManager = new LinearLayoutManager(getActivity()); listView.setLayoutManager(layoutManager); progLoading = (ProgressBar) root.findViewById(R.id.progLoading); if (!itemsLoaded) { progLoading.setVisibility(View.VISIBLE); } viewsCreated = true; if (itemsLoaded && activity.get() != null) { onFragmentLoaded(); } return root; }

Target:
protected View onCreateViewHelper(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, int fragmentResource) { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(fragmentResource, container, false); recyclerView = (RecyclerView) root.findViewById(android.R.id.list); layoutManager = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(layoutManager); recyclerView.setHasFixedSize(true); RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), null); recyclerView.addItemDecoration(itemDecoration); progLoading = (ProgressBar) root.findViewById(R.id.progLoading); if (!itemsLoaded) { progLoading.setVisibility(View.VISIBLE); } viewsCreated = true; if (itemsLoaded && activity.get() != null) { onFragmentLoaded(); } return root; }
Source:
public void shouldHandleRemoveNodeFromExplicitIndexTwice() throws Exception { long nodeId = addNodeToExplicitIndex(); try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { IndexHits<Node> hits = graphDb.index().forNodes( INDEX_NAME ).get( KEY, "this is it" ); assertFalse( hits.hasNext() ); hits.close(); ctx.success(); } }

Target:
public void shouldHandleRemoveNodeFromExplicitIndexTwice() throws Exception { long nodeId = addNodeToExplicitIndex(); try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { IndexHits<Node> hits = graphDb.index().forNodes( INDEX_NAME ).get( KEY, VALUE ); assertFalse( hits.hasNext() ); hits.close(); ctx.success(); } }
Source:
public BulkStatus getStatus(UUID bulkOperationId) { String commandAsString = ""; try { BulkStatus status = new BulkStatus(); status.setUUID(bulkOperationId); String state = kvStore.getString(bulkOperationId + STATE); status.setState(State.valueOf(state)); String creationDate = kvStore.getString(bulkOperationId + CREATION_DATE); status.setCreationDate(ZonedDateTime.parse(creationDate)); commandAsString = kvStore.getString(bulkOperationId + COMMAND); BulkCommand command = OBJECT_MAPPER.readValue(commandAsString, BulkCommand.class); status.setCommand(command); Long scrolledDocumentCount = kvStore.getLong(bulkOperationId + SCROLLED_DOCUMENT_COUNT); status.setScrolledDocumentCount(scrolledDocumentCount); return status; } catch (IOException e) { throw new NuxeoException("Unable to deserialize the bulk command=" + commandAsString, e); } }

Target:
public BulkStatus getStatus(UUID bulkOperationId) { String commandAsString = ""; try { BulkStatus status = new BulkStatus(); status.setUUID(bulkOperationId); KeyValueStore keyValueStore = getKvStore(); String state = keyValueStore.getString(bulkOperationId + STATE); status.setState(State.valueOf(state)); String creationDate = keyValueStore.getString(bulkOperationId + CREATION_DATE); status.setCreationDate(ZonedDateTime.parse(creationDate)); commandAsString = keyValueStore.getString(bulkOperationId + COMMAND); BulkCommand command = OBJECT_MAPPER.readValue(commandAsString, BulkCommand.class); status.setCommand(command); Long scrolledDocumentCount = keyValueStore.getLong(bulkOperationId + SCROLLED_DOCUMENT_COUNT); status.setScrolledDocumentCount(scrolledDocumentCount); return status; } catch (IOException e) { throw new NuxeoException("Unable to deserialize the bulk command=" + commandAsString, e); } }
Source:
private String makeUrl(ContainerPort port, ServerConfig cfg, String hostname) throws InternalInfrastructureException { LOG.debug( "ContainerPort: " + port.toString() + "\n ServerConfig: " + cfg.toString() + "\n Hostname: " + hostname); LOG.debug("URL result: \t" + makeUrl(port, cfg.getProtocol(), cfg.getPath(), hostname)); return makeUrl(port, cfg.getProtocol(), cfg.getPath(), hostname); }

Target:
private String makeUrl(ContainerPort port, ServerConfig cfg, String hostname) throws InternalInfrastructureException { LOG.debug( "ContainerPort: {}\n ServerConfig: {}\n Hostname: {}", port.toString(), cfg.toString(), hostname); return makeUrl(port, cfg.getProtocol(), cfg.getPath(), hostname); }
Source:
public boolean isAdapter(final SAMRecord record) { if (!record.getReadUnmappedFlag() && record.getMappingQuality() != 0) { return false; } final byte[] readBases = record.getReadBases(); final boolean revComp = !record.getReadUnmappedFlag() && record.getMappingQuality() == 0 && record.getReadNegativeStrandFlag(); if (!(record instanceof BAMRecord)) { StringUtil.toUpperCase(readBases); } return isAdapterSequence(readBases, revComp); }

Target:
public boolean isAdapter(final SAMRecord record) { if (!record.getReadUnmappedFlag() && record.getMappingQuality() != 0) { return false; } final boolean revComp = !record.getReadUnmappedFlag() && record.getReadNegativeStrandFlag(); final byte[] readBases = record.getReadBases(); return isAdapterSequence(readBases, revComp); }
Source:
public static File ensureDirectoryWriteable(File logDir) throws IOException { FileUtils.forceMkdir(logDir); if(!logDir.canWrite()) { log.warn("Init param log dir cannot be used!"); logDir = null; } return logDir; }

Target:
public static File ensureDirectoryWriteable(File logDir) throws FileNotFoundException { try { FileUtils.forceMkdir(logDir); } catch(IOException e){ log.debug("Failed to create directory " + logDir, e); throw new FileNotFoundException("Failed to create directory: " + logDir + " IOException: " + e.getMessage()); } if(!logDir.canWrite()) { log.debug("Init param log dir cannot be used!"); throw new FileNotFoundException("Directory is not writable: " + logDir); } return logDir; }
Source:
public MessageHandler mockHandler() { return mockMessageHandler(hasHeader("bar", "BAR")) .thenReply() .assertNext(hasHeader("baz", "BAZ")) .thenReply() .assertNext(hasPayload("foo")) .thenReply("foo"); }

Target:
public MessageHandler mockHandler() { return mockMessageHandler(messageArgumentCaptor()) .handleNextAndReply(m -> m) .handleNextAndReply(m -> m) .handleNextAndReply(m -> "foo"); }
Source:
default <T> T getClaim(String claim) { return (T) this.getClaims().get(claim); }

Target:
default <T> T getClaim(String claim) { return !containsClaim(claim) ? null : (T) this.getClaims().get(claim); }
Source:
public String getPdxDiskStoreName() { Assert.state(!StringUtils.isEmpty(pdxDiskStoreName), "The PDX Disk Store name was not properly initialized!"); return pdxDiskStoreName; }

Target:
public String getPdxDiskStoreName() { return pdxDiskStoreName; }
Source:
private ObjectId getFirstParent(final ObjectId id, GitClient git) throws GitException, IOException, InterruptedException { return git.withRepository(new RepositoryCallback<ObjectId>() { @Override public ObjectId invoke(Repository repository, VirtualChannel virtualChannel) throws IOException, InterruptedException { RevWalk walk = null; ObjectId result = null; try { walk = new RevWalk(repository); RevCommit commit = walk.parseCommit(id); if (commit.getParentCount() > 0) { result = commit.getParent(0); } else { result = id; } } catch (Exception e) { throw new GitException("Failed to find parent id. ", e); } finally { if (walk != null) { walk.close(); } } return result; } }); }

Target:
private ObjectId getFirstParent(final ObjectId id, GitClient git) throws GitException, IOException, InterruptedException { return git.withRepository(new RepositoryCallback<ObjectId>() { @Override public ObjectId invoke(Repository repository, VirtualChannel virtualChannel) throws IOException, InterruptedException { ObjectId result = null; try (RevWalk walk = new RevWalk(repository)) { RevCommit commit = walk.parseCommit(id); if (commit.getParentCount() > 0) { result = commit.getParent(0); } else { result = id; } } catch (Exception e) { throw new GitException("Failed to find parent id. ", e); } return result; } }); }
Source:
public void pauseUntilVisibleTest() throws Exception { long timeout = 10; long startTime = 0; long endTime = 0; iface.go("<LINK_0>"); VControl hideControl = iface.getControl(Strategy.XPATH, " startTime = System.currentTimeMillis(); hideControl.getPause().untilVisible((int)timeout); endTime = System.currentTimeMillis(); Assert.assertTrue((endTime - startTime) / Long.parseLong("1000") < timeout); hideControl.click(); startTime = System.currentTimeMillis(); thrown.expect(TimeoutException.class); hideControl.getPause().untilVisible((int)timeout); endTime = System.currentTimeMillis(); Assert.assertTrue((endTime - startTime) / Long.parseLong("1000") >= timeout); iface.go("<LINK_1>"); }

Target:
public void pauseUntilVisibleTest() throws Exception { long timeout = 10; long startTime = 0; long endTime = 0; iface.go("<LINK_0>"); VControl hideControl = iface.getControl(Strategy.XPATH, " startTime = System.currentTimeMillis(); hideControl.pause.untilVisible((int)timeout); endTime = System.currentTimeMillis(); Assert.assertTrue((endTime - startTime) / Long.parseLong("1000") < timeout); hideControl.click(); startTime = System.currentTimeMillis(); thrown.expect(TimeoutException.class); hideControl.pause.untilVisible((int)timeout); endTime = System.currentTimeMillis(); Assert.assertTrue((endTime - startTime) / Long.parseLong("1000") >= timeout); iface.go("<LINK_1>"); }
Source:
public void onLoginSuccessful(User user) { Toaster.show(findViewById(android.R.id.content), getString(R.string.toast_welcome) + " " + user.getUsername()); PrefManager.saveUser(user); startActivity(new Intent(this, DashboardActivity.class)); finish(); }

Target:
public void onLoginSuccessful(User user) { Toaster.show(findViewById(android.R.id.content), getString(R.string.toast_welcome) + " " + user.getUsername()); PrefManager.setUserId(user.getUserId()); PrefManager.saveToken("Basic " + user.getBase64EncodedAuthenticationKey()); PrefManager.saveUser(user); startActivity(new Intent(this, DashboardActivity.class)); finish(); }
Source:
public void restorePreMothballInfo(Unit unit, Campaign campaign) { if (tech != null) { unit.setTech(tech); } for (Person driver : drivers) { if (driver.getStatus().isActive() && driver.getUnitId() == null) { unit.addDriver(driver); } } for (Person gunner : gunners) { if (gunner.getStatus().isActive() && ((gunner.getUnitId() == null) || (gunner.getUnitId() == unit.getId()))) { unit.addGunner(gunner); } } for (Person crew : vesselCrew) { if (crew.getStatus().isActive() && crew.getUnitId() == null) { unit.addVesselCrew(crew); } } if (techOfficer != null && techOfficer.getStatus().isActive() && techOfficer.getUnitId() == null) { unit.setTechOfficer(techOfficer); } if (navigator != null && navigator.getStatus().isActive() && navigator.getUnitId() == null) { unit.setNavigator(navigator); } if (campaign.getForce(forceID) != null) { campaign.addUnitToForce(unit, forceID); } unit.resetEngineer(); }

Target:
public void restorePreMothballInfo(Unit unit, Campaign campaign) { if (tech != null) { unit.setTech(tech); } for (Person driver : drivers) { if (driver.getStatus().isActive() && (driver.getUnitId() == null)) { unit.addDriver(driver); } } for (Person gunner : gunners) { if (gunner.getStatus().isActive() && ((gunner.getUnitId() == null) || (gunner.getUnitId() == unit.getId()))) { unit.addGunner(gunner); } } for (Person crew : vesselCrew) { if (crew.getStatus().isActive() && (crew.getUnitId() == null)) { unit.addVesselCrew(crew); } } if (techOfficer != null && techOfficer.getStatus().isActive() && techOfficer.getUnitId() == null) { unit.setTechOfficer(techOfficer); } if (navigator != null && navigator.getStatus().isActive() && navigator.getUnitId() == null) { unit.setNavigator(navigator); } if (campaign.getForce(forceID) != null) { campaign.addUnitToForce(unit, forceID); } unit.resetEngineer(); }
Source:
public Map<String, Integer> getTasksByPriority() { Map<String, Object> tasksByPriority = (Map<String, Object>) getRealtime().get(TASKS_BY_PRIORITY_PROPERTY); Map<String, Integer> tasksByPriorityMap = new HashMap<String, Integer>(); for (String priorityKey : tasksByPriority.keySet()) { tasksByPriorityMap.put(priorityKey, (Integer) tasksByPriority.get(priorityKey)); } return tasksByPriorityMap; }

Target:
public Map<String, Integer> getTasksByPriority() { Map<String, Object> tasksByPriority = (Map<String, Object>) getRealtime().get(TASKS_BY_PRIORITY_PROPERTY); Map<String, Integer> tasksByPriorityMap = new HashMap<String, Integer>(); for (Entry<String, Object> entry : tasksByPriority.entrySet()) { tasksByPriorityMap.put(entry.getKey(), (Integer) entry.getValue()); } return tasksByPriorityMap; }
Source:
protected void doWriteContent(Content content, @Nullable Content previous) { calledMeter.mark(); try { long id = content.getId().longValue(); MutationBatch batch = keyspace.prepareMutationBatch(); batch.setConsistencyLevel(writeConsistency); marshaller.marshallInto( content.getId(), batch.withRow(mainCf, id), content, java.util.Optional.ofNullable(previous), true ); batch.mergeShallow(aliasIndex.mutateAliases(content, previous)); batch.execute(); log.trace("Written content id " + id); } catch (Exception e) { failureMeter.mark(); throw new CassandraPersistenceException(content.toString(), e); } }

Target:
protected void doWriteContent(Content content, @Nullable Content previous) { try { long id = content.getId().longValue(); MutationBatch batch = keyspace.prepareMutationBatch(); batch.setConsistencyLevel(writeConsistency); marshaller.marshallInto( content.getId(), batch.withRow(mainCf, id), content, java.util.Optional.ofNullable(previous), true ); batch.mergeShallow(aliasIndex.mutateAliases(content, previous)); batch.execute(); log.trace("Written content id " + id); } catch (Exception e) { throw new CassandraPersistenceException(content.toString(), e); } }
Source:
private void updateProjectZip(final File zipFile, final File folder) { try { File newZipFile = new File(zipFile.getAbsolutePath().concat(".byte-ray.new")); Utils.zipFolderContent(folder, newZipFile); FileUtils.deleteQuietly(zipFile); FileUtils.moveFile(newZipFile, zipFile); } catch (IOException e) { folder.deleteOnExit(); throw new ProjectManagerException("Error when generating the modified zip.", e); } }

Target:
private void updateProjectZip(final File zipFile, final File folder) { try { File newZipFile = new File(zipFile.getAbsolutePath().concat(TMP_MODIFIED_ZIP_POSTFIX)); Utils.zipFolderContent(folder, newZipFile); FileUtils.deleteQuietly(zipFile); FileUtils.moveFile(newZipFile, zipFile); } catch (IOException e) { folder.deleteOnExit(); throw new ProjectManagerException("Error when generating the modified zip.", e); } }
Source:
public void setup() { parent .addZone(new Zone("Above ground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), ABOVE_GROUND))) .addZone(new Zone("Ground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), GROUND))) .addZone(new Zone("Low sky", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), LOW_SKY))) .addZone(new Zone("Medium sky", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), MEDIUM_SKY))) .addZone(new Zone("Shallow underground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), SHALLOW_UNDERGROUND))) .addZone(new Zone("Medium underground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), MEDIUM_UNDERGROUND))); parent.setSeed(12345); parent.initialize(); ListMultimap<Class<? extends WorldFacet>, FacetProvider> facetProviderChains = ArrayListMultimap.create(); facetProviderChains.put(SurfaceHeightFacet.class, (generatingRegion) -> { SurfaceHeightFacet facet = new SurfaceHeightFacet(generatingRegion.getRegion(), generatingRegion.getBorderForFacet(SurfaceHeightFacet.class)); for (BaseVector2i pos : facet.getRelativeRegion().contents()) { facet.set(pos, 100); } generatingRegion.setRegionFacet(SurfaceHeightFacet.class, facet); }); Map<Class<? extends WorldFacet>, Border3D> borders = new HashMap<>(); borders.put(SurfaceHeightFacet.class, new Border3D(0, 0, 0)); region = new RegionImpl(Region3i.createFromCenterExtents(new Vector3i(0, 0, 0), 4), facetProviderChains, borders); }

Target:
public void setup() { parent.addZone(new Zone("Medium sky", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), MEDIUM_SKY))) .addZone(new Zone("Low sky", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), LOW_SKY))) .addZone(new Zone("Above ground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), ABOVE_GROUND))) .addZone(new Zone("Ground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), GROUND))) .addZone(new Zone("Shallow underground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), SHALLOW_UNDERGROUND))) .addZone(new Zone("Medium underground", new LayeredZoneRegionFunction(new MinMaxLayerThickness(100, 100), MEDIUM_UNDERGROUND))); parent.setSeed(12345); parent.initialize(); ListMultimap<Class<? extends WorldFacet>, FacetProvider> facetProviderChains = ArrayListMultimap.create(); facetProviderChains.put(SurfaceHeightFacet.class, (generatingRegion) -> { SurfaceHeightFacet facet = new SurfaceHeightFacet(generatingRegion.getRegion(), generatingRegion.getBorderForFacet(SurfaceHeightFacet.class)); for (BaseVector2i pos : facet.getRelativeRegion().contents()) { facet.set(pos, 100); } generatingRegion.setRegionFacet(SurfaceHeightFacet.class, facet); }); Map<Class<? extends WorldFacet>, Border3D> borders = new HashMap<>(); borders.put(SurfaceHeightFacet.class, new Border3D(0, 0, 0)); region = new RegionImpl(Region3i.createFromCenterExtents(new Vector3i(0, 0, 0), 4), facetProviderChains, borders); }
Source:
public void testPendingBulkIsNotCancelled() throws InterruptedException, ExecutionException { final PhysicalSlotRequestBulkWithCancellationTracking bulk = new PhysicalSlotRequestBulkWithCancellationTracking(ResourceProfile.ANY); bulkChecker.schedulePendingRequestBulkTimeoutCheck(bulk, TIMEOUT); bulk.checkNotCancelledAfter(TIMEOUT.toMilliseconds() + 10); }

Target:
public void testPendingBulkIsNotCancelled() throws InterruptedException, ExecutionException { final CompletableFuture<SlotRequestId> cancellationFuture = new CompletableFuture<>(); final PhysicalSlotRequestBulk bulk = createPhysicalSlotRequestBulkWithCancellationFuture(cancellationFuture, new SlotRequestId()); bulkChecker.schedulePendingRequestBulkTimeoutCheck(bulk, TIMEOUT); checkNotCancelledAfter(cancellationFuture, 2 * TIMEOUT.toMilliseconds()); }
Source:
public void run() { int delayTime = getRegistry().getDelay(); if (this.time < listener.lastEventTime) { return; } else if (delayTime <= 0) { listener.doNotify(listener.rawAddresses); listener.lastExecuteTime = System.currentTimeMillis(); } else if (System.currentTimeMillis() - listener.lastExecuteTime < delayTime) { scheduler.schedule(new NotificationTask(this.listener, this.time), System.currentTimeMillis() - listener.lastExecuteTime, TimeUnit.MILLISECONDS); } else { listener.doNotify(listener.rawAddresses); listener.lastExecuteTime = System.currentTimeMillis(); } }

Target:
public void run() { if (this.time == listener.lastEventTime) { listener.doNotify(listener.rawAddresses); listener.lastExecuteTime = System.currentTimeMillis(); } }
Source:
public VMImage getImage(final String id) { String[] fields = VMImageToImage.decodeFieldsFromUniqueId(id); if (fields[2].substring(0, CUSTOM_IMAGE_PREFIX.length()).equals(CUSTOM_IMAGE_PREFIX)) { String storage = fields[2].substring(CUSTOM_IMAGE_PREFIX.length()); String vhd = fields[3]; VMImage ref = new VMImage(CUSTOM_IMAGE_PREFIX + azureGroup, CUSTOM_IMAGE_PREFIX + storage, vhd, null, fields[0]); return ref; } Iterable<VMImage> images = listImages(); for (VMImage image : images) { String imageId = VMImageToImage.encodeFieldsToUniqueId(image); if (id.equals(imageId)){ return image; } } return null; }

Target:
public VMImage getImage(final String id) { String[] fields = VMImageToImage.decodeFieldsFromUniqueId(id); if (fields[2].startsWith(CUSTOM_IMAGE_PREFIX)) { String storage = fields[2].substring(CUSTOM_IMAGE_PREFIX.length()); String vhd = fields[3]; VMImage ref = VMImage.create(CUSTOM_IMAGE_PREFIX + azureGroup, CUSTOM_IMAGE_PREFIX + storage, vhd, null, fields[0], false); return ref; } Iterable<VMImage> images = listImages(); for (VMImage image : images) { String imageId = VMImageToImage.encodeFieldsToUniqueId(image); if (id.equals(imageId)){ return image; } } return null; }
Source:
public static void setUp() throws Exception { WAL_UTIL.startMiniCluster(3); Configuration conf = HFILE_UTIL.getConfiguration(); conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, false); CHORE_SERVICE = new ChoreService("TestLocalRegionOnTwoFileSystems"); CLEANER_POOL = new DirScanPool(conf); Server server = mock(Server.class); when(server.getConfiguration()).thenReturn(conf); when(server.getServerName()) .thenReturn(ServerName.valueOf("localhost", 12345, System.currentTimeMillis())); when(server.getChoreService()).thenReturn(CHORE_SERVICE); Path rootDir = HFILE_UTIL.getDataTestDir(); CommonFSUtils.setRootDir(conf, rootDir); Path walRootDir = WAL_UTIL.getDataTestDirOnTestFS(); FileSystem walFs = WAL_UTIL.getTestFileSystem(); CommonFSUtils.setWALRootDir(conf, walRootDir.makeQualified(walFs.getUri(), walFs.getWorkingDirectory())); LocalRegionParams params = new LocalRegionParams(); params.server(server).regionDirName(REGION_DIR_NAME).tableDescriptor(TD) .flushSize(TableDescriptorBuilder.DEFAULT_MEMSTORE_FLUSH_SIZE).flushPerChanges(1_000_000) .flushIntervalMs(TimeUnit.MINUTES.toMillis(15)).compactMin(COMPACT_MIN).maxWals(32) .useHsync(false).ringBufferSlotCount(16).rollPeriodMs(TimeUnit.MINUTES.toMillis(15)) .archivedWalSuffix(LocalStore.ARCHIVED_WAL_SUFFIX) .archivedHFileSuffix(LocalStore.ARCHIVED_HFILE_SUFFIX); REGION = LocalRegion.create(params); }

Target:
public static void setUp() throws Exception { WAL_UTIL.startMiniCluster(3); Configuration conf = HFILE_UTIL.getConfiguration(); conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, false); Path rootDir = HFILE_UTIL.getDataTestDir(); CommonFSUtils.setRootDir(conf, rootDir); Path walRootDir = WAL_UTIL.getDataTestDirOnTestFS(); FileSystem walFs = WAL_UTIL.getTestFileSystem(); CommonFSUtils.setWALRootDir(conf, walRootDir.makeQualified(walFs.getUri(), walFs.getWorkingDirectory())); }
Source:
private Optional<String> uriFor(BtVodDataRow row) { String brandId = row.getColumnValue(BtVodFileColumn.BRANDIA_ID); if (!shouldSynthesizeBrand(row) && brandId == null) { return Optional.absent(); } if (shouldSynthesizeBrand(row)) { return Optional.of(uriPrefix + "synthesized/brands/" + ensureSynthesizedKey(row)); } return Optional.of(uriPrefix + "brands/" + row.getColumnValue(BtVodFileColumn.BRANDIA_ID)); }

Target:
private Optional<String> uriFor(BtVodDataRow row) { if (!shouldSynthesizeBrand(row) && !isBrand(row)) { return Optional.absent(); } else if (shouldSynthesizeBrand(row)) { return Optional.of(uriPrefix + "synthesized/brands/" + ensureSynthesizedKey(row)); } else if (isBrand(row)) { return Optional.of(uriPrefix + "brands/" + getBrandId(row)); } return Optional.absent(); }
Source:
public void shouldExecuteAsBlockingAfterSubscription() { final PreparedWriteOperation preparedOperation = mock(PreparedWriteOperation.class); TestSubscriber testSubscriber = new TestSubscriber(); Completable.create(OnSubscribeExecuteAsBlockingCompletable.newInstance(preparedOperation)) .subscribe(testSubscriber); testSubscriber.assertNoErrors(); testSubscriber.assertCompleted(); verify(preparedOperation).executeAsBlocking(); verify(preparedOperation, times(0)).asRxObservable(); verify(preparedOperation, times(0)).asRxSingle(); verify(preparedOperation, times(0)).asRxComletable(); }

Target:
public void shouldExecuteAsBlockingAfterSubscription() { final PreparedWriteOperation preparedOperation = mock(PreparedWriteOperation.class); TestSubscriber testSubscriber = new TestSubscriber(); verifyZeroInteractions(preparedOperation); Completable completable = Completable.create(OnSubscribeExecuteAsBlockingCompletable.newInstance(preparedOperation)); verifyZeroInteractions(preparedOperation); completable.subscribe(testSubscriber); testSubscriber.assertNoErrors(); testSubscriber.assertCompleted(); verify(preparedOperation).executeAsBlocking(); verify(preparedOperation, times(0)).asRxObservable(); verify(preparedOperation, times(0)).asRxSingle(); verify(preparedOperation, times(0)).asRxComletable(); }
Source:
public String showPage(Model model) { PublicSiteUser user = currentUserService.getCurrentUser(); boolean userLoggedIn = (user != null); boolean userIsSEEG = userLoggedIn && expertService.getExpertById(user.getId()).isSeegMember(); Integer diseaseOccurrenceReviewCount = 0; Integer adminUnitReviewCount = 0; if (userLoggedIn) { int expertId = user.getId(); diseaseOccurrenceReviewCount = expertService.getDiseaseOccurrenceReviewCount(expertId).intValue(); adminUnitReviewCount = expertService.getAdminUnitReviewCount(expertId).intValue(); List<ValidatorDiseaseGroup> diseaseInterests = expertService.getDiseaseInterests(expertId); model.addAttribute("diseaseInterests", diseaseInterests); model.addAttribute("allOtherDiseases", getAllValidatorDiseaseGroupsExcludingDiseaseInterests(diseaseInterests)); model.addAttribute("validatorDiseaseGroupMap", diseaseService.getValidatorDiseaseGroupMap(userIsSEEG)); } else { model.addAttribute("defaultValidatorDiseaseGroupName", DEFAULT_VALIDATOR_DISEASE_GROUP_NAME); model.addAttribute("defaultDiseaseGroupShortName", DEFAULT_DISEASE_GROUP_SHORT_NAME); } model.addAttribute("userLoggedIn", userLoggedIn); model.addAttribute("diseaseOccurrenceReviewCount", diseaseOccurrenceReviewCount); model.addAttribute("adminUnitReviewCount", adminUnitReviewCount); return "datavalidation/content"; }

Target:
public String showPage(Model model) { PublicSiteUser user = currentUserService.getCurrentUser(); boolean userLoggedIn = (user != null); boolean userIsSEEG = userLoggedIn && checkIfSeegMember(user); Integer diseaseOccurrenceReviewCount = 0; Integer adminUnitReviewCount = 0; if (userLoggedIn) { int expertId = user.getId(); diseaseOccurrenceReviewCount = expertService.getDiseaseOccurrenceReviewCount(expertId).intValue(); adminUnitReviewCount = expertService.getAdminUnitReviewCount(expertId).intValue(); List<ValidatorDiseaseGroup> diseaseInterests = expertService.getDiseaseInterests(expertId); model.addAttribute("diseaseInterests", diseaseInterests); model.addAttribute("allOtherDiseases", getAllValidatorDiseaseGroupsExcludingDiseaseInterests(diseaseInterests)); model.addAttribute("validatorDiseaseGroupMap", diseaseService.getValidatorDiseaseGroupMap(userIsSEEG)); } else { model.addAttribute("defaultValidatorDiseaseGroupName", DEFAULT_VALIDATOR_DISEASE_GROUP_NAME); model.addAttribute("defaultDiseaseGroupShortName", DEFAULT_DISEASE_GROUP_SHORT_NAME); } model.addAttribute("userLoggedIn", userLoggedIn); model.addAttribute("diseaseOccurrenceReviewCount", diseaseOccurrenceReviewCount); model.addAttribute("adminUnitReviewCount", adminUnitReviewCount); return "datavalidation/content"; }
Source:
private void visitTypeAlias( JSType registryType, String unqualifiedName, boolean emitNeverBrand) { emit("type"); emit(unqualifiedName); emit("="); visitType(registryType, true, false); if (emitNeverBrand) emit("&{brand: never}"); emit(";"); emitBreak(); }

Target:
private void visitTypeAlias( JSType registryType, String unqualifiedName, boolean emitNeverBrand) { emit("type"); emit(unqualifiedName); emit("="); visitType(registryType, true, false); if (emitNeverBrand) emit("&{clutzEnumBrand: never}"); emit(";"); emitBreak(); }
Source:
public InstallModel() { setUserPassword(new EntityModel()); setOVirtISO(new ListModel()); setHostVersion(new EntityModel()); setOverrideIpTables(new EntityModel()); getOverrideIpTables().setEntity(false); setUserName(new EntityModel()); getUserName().setEntity(RootUserName); getUserName().setIsChangable(false); setPublicKey(new EntityModel()); getPublicKey().setEntity(constants.empty()); fetchPublicKey(); setNetworkProviderModel(new HostNetworkProviderModel()); }

Target:
public InstallModel() { setUserPassword(new EntityModel()); setOVirtISO(new ListModel()); setHostVersion(new EntityModel()); setOverrideIpTables(new EntityModel()); getOverrideIpTables().setEntity(false); setUserName(new EntityModel()); getUserName().setEntity(HostModel.RootUserName); getUserName().setIsChangable(false); setPublicKey(new EntityModel()); getPublicKey().setEntity(constants.empty()); fetchPublicKey(); setNetworkProviderModel(new HostNetworkProviderModel()); }
Source:
public void handleQuotaColumnVisibility() { isQuotaVisible = false; SystemTreeItemModel treeItem = (SystemTreeItemModel) CommonModel.getInstance().getSystemTree().getSelectedItem(); if (treeItem != null && SystemTreeItemType.DataCenter.equals(treeItem.getType())) { StoragePool storagePool = (StoragePool) treeItem.getEntity(); if (!QuotaEnforcementTypeEnum.DISABLED.equals(storagePool.getQuotaEnforcementType())) { isQuotaVisible = true; } } onDiskViewTypeChanged(); }

Target:
public void handleQuotaColumnVisibility() { isQuotaVisible = false; SystemTreeItemModel treeItem = (SystemTreeItemModel) CommonModel.getInstance().getSystemTree().getSelectedItem(); if (treeItem != null && SystemTreeItemType.DataCenter == treeItem.getType()) { StoragePool storagePool = (StoragePool) treeItem.getEntity(); if (QuotaEnforcementTypeEnum.DISABLED != storagePool.getQuotaEnforcementType()) { isQuotaVisible = true; } } onDiskViewTypeChanged(); }
Source:
public static boolean isScriptRunSuccessfully(String directory, String[] cmdArray, String expectedString) throws IOException { boolean isFoundTheMessage = false; BufferedReader br = null; Process process = null; try { File commandDir = new File(directory); process = Runtime.getRuntime().exec(cmdArray, null, commandDir); String line; long startTime = System.currentTimeMillis(); while ((System.currentTimeMillis() - startTime) < TIMEOUT) { br = new BufferedReader(new InputStreamReader(process.getInputStream(), "UTF-8")); while ((line = br.readLine()) != null) { log.info(line); if (line.contains(expectedString)) { log.info("found the string " + expectedString + " in line " + line); isFoundTheMessage = true; break; } } if (isFoundTheMessage) { break; } } return isFoundTheMessage; } catch (IOException ex) { log.error("Error when reading the InputStream when running shell script " + ex.getMessage(), ex); throw new IOException("Error when reading the InputStream when running shell script " + ex.getMessage(), ex); } finally { if (br != null) { br.close(); } if (process != null) { process.destroy(); } } }

Target:
public static boolean isScriptRunSuccessfully(String directory, String[] cmdArray, String expectedString) throws CarbonToolsIntegrationTestException { boolean isFoundTheMessage = false; BufferedReader br = null; Process process = null; try { File commandDir = new File(directory); process = Runtime.getRuntime().exec(cmdArray, null, commandDir); String line; long startTime = System.currentTimeMillis(); while ((System.currentTimeMillis() - startTime) < TIMEOUT) { br = new BufferedReader(new InputStreamReader(process.getInputStream(), "UTF-8")); while ((line = br.readLine()) != null) { log.info(line); if (line.contains(expectedString)) { log.info("found the string " + expectedString + " in line " + line); isFoundTheMessage = true; break; } } if (isFoundTheMessage) { break; } } return isFoundTheMessage; } catch (IOException ex) { log.error("Error when reading the InputStream when running shell script ", ex); throw new CarbonToolsIntegrationTestException("Error when reading the InputStream when " + "running shell script ", ex); } finally { if (br != null) { try { br.close(); } catch (IOException e) { log.error("Error when closing BufferedReader ", e); } } if (process != null) { process.destroy(); } } }
Source:
public void run() { try { synchronized (lock) { cdl.countDown(); while (true) { lock.wait(); } } } catch (InterruptedException ex) { synchronized (lock) { wasInterrupted = true; } } }

Target:
public void run() { synchronized (lock) { try { cdl.countDown(); while (true) { lock.wait(); } } catch (InterruptedException ex) { wasInterrupted = true; } } }
Source:
public void configure(ResourceServerSecurityConfigurer resources) { resources .resourceId("oauth2res") .tokenServices(accessTokenValidationService) .expressionHandler(new DefaultWebSecurityExpressionHandler()); }

Target:
public void configure(ResourceServerSecurityConfigurer resources) { resources.resourceId("oauth2res") .tokenServices(accessTokenValidationService) .expressionHandler(new OsiamMethodSecurityExpressionHandler()); }
Source:
private String getSerializedInput(Block block, boolean craftLast) { BlockMenu menu = BlockStorage.getInventory(block); StringBuilder builder = new StringBuilder(); int i = 0; boolean lastIteration = false; for (int j = 0; j < 9; j++) { if (i > 0) { builder.append(" </slot> "); } ItemStack item = menu.getItemInSlot(getInputSlots()[j]); if (craftLast) { if (item != null && item.getAmount() == 1) lastIteration = true; } else { if (item != null && item.getAmount() == 1) return ""; } builder.append(CustomItemSerializer.serialize(item, ItemFlag.MATERIAL, ItemFlag.ITEMMETA_DISPLAY_NAME, ItemFlag.ITEMMETA_LORE)); i++; } if (craftLast && !lastIteration) return ""; return builder.toString(); }

Target:
private String getSerializedInput(Block block, boolean craftLast) { BlockMenu menu = BlockStorage.getInventory(block); StringBuilder builder = new StringBuilder(); int i = 0; boolean lastIteration = false; for (int j = 0; j < 9; j++) { if (i > 0) { builder.append(" </slot> "); } ItemStack item = menu.getItemInSlot(getInputSlots()[j]); if (item != null && item.getAmount() == 1) { if (craftLast) lastIteration = true; else return ""; } builder.append(CustomItemSerializer.serialize(item, ItemFlag.MATERIAL, ItemFlag.ITEMMETA_DISPLAY_NAME, ItemFlag.ITEMMETA_LORE)); i++; } if (craftLast && !lastIteration) return ""; return builder.toString(); }
Source:
public E username(String username) { this.username = username; return (E) this; }

Target:
public E username(String username) { Misc.checkNotNull(username, "username"); this.username = username; return (E) this; }
Source:
public Bitstream setLogo(Context context, Collection collection, MultipartFile uploadfile) throws IOException, AuthorizeException, SQLException { if (collection.getLogo() != null) { throw new UnprocessableEntityException( "The collection with the given uuid already has a logo: " + collection.getID()); } Bitstream bitstream = cs.setLogo(context, collection, uploadfile.getInputStream()); cs.update(context, collection); bitstreamService.update(context, bitstream); return bitstream; }

Target:
public BitstreamRest setLogo(Context context, Collection collection, MultipartFile uploadfile) throws IOException, AuthorizeException, SQLException { if (collection.getLogo() != null) { throw new UnprocessableEntityException( "The collection with the given uuid already has a logo: " + collection.getID()); } Bitstream bitstream = cs.setLogo(context, collection, uploadfile.getInputStream()); cs.update(context, collection); bitstreamService.update(context, bitstream); return bitstreamConverter.fromModel(context.reloadEntity(bitstream)); }
Source:
public SearchResult query(SearchQuery query) { final List<Requisition> requisitions = Lists.newArrayList(requisitionAccessService.getRequisitions()) .stream() .filter(r -> QueryUtils.matches(r.getForeignSource(), query.getInput())) .sorted(Comparator.comparing(Requisition::getForeignSource)) .limit(query.getMaxResults()) .collect(Collectors.toList()); final List<SearchResultItem> resultItems = requisitions.stream().map(r -> { final SearchResultItem searchResultItem = new SearchResultItem(); searchResultItem.setIdentifier(r.getForeignSource()); searchResultItem.setUrl(String.format("admin/ng-requisitions/index.jsp#/requisitions/%s",r.getForeignSource())); searchResultItem.setLabel(String.format("Edit Requisition '%s'", r.getForeignSource())); searchResultItem.setIcon("fa fa-pencil"); return searchResultItem; }) .collect(Collectors.toList()); final SearchResult searchResult = new SearchResult(Contexts.Action) .withMore(requisitions, resultItems) .withResults(resultItems); return searchResult; }

Target:
public SearchResult query(SearchQuery query) { final List<Requisition> requisitions = Lists.newArrayList(requisitionAccessService.getRequisitions()) .stream() .filter(r -> QueryUtils.matches(r.getForeignSource(), query.getInput())) .sorted(Comparator.comparing(Requisition::getForeignSource)) .limit(query.getMaxResults()) .collect(Collectors.toList()); final List<SearchResultItem> resultItems = requisitions.stream().map(r -> { final SearchResultItem searchResultItem = new SearchResultItem(); searchResultItem.setIdentifier(r.getForeignSource()); searchResultItem.setUrl(String.format("admin/ng-requisitions/index.jsp#/requisitions/%s", UrlUtils.encode(r.getForeignSource()))); searchResultItem.setLabel(String.format("Edit Requisition '%s'", r.getForeignSource())); searchResultItem.setIcon("fa fa-pencil"); return searchResultItem; }) .collect(Collectors.toList()); final SearchResult searchResult = new SearchResult(Contexts.Action) .withMore(requisitions, resultItems) .withResults(resultItems); return searchResult; }
Source:
public static ZkMetadataStoreDirectory getInstance(String namespace, String zkAddress) throws InvalidRoutingDataException { if (_zkMetadataStoreDirectoryInstance == null) { synchronized (ZkMetadataStoreDirectory.class) { if (_zkMetadataStoreDirectoryInstance == null) { _zkMetadataStoreDirectoryInstance = new ZkMetadataStoreDirectory(); } } } _zkMetadataStoreDirectoryInstance.init(namespace, zkAddress); return _zkMetadataStoreDirectoryInstance; }

Target:
public static ZkMetadataStoreDirectory getInstance(String namespace, String zkAddress) throws InvalidRoutingDataException { getInstance().init(namespace, zkAddress); return _zkMetadataStoreDirectoryInstance; }
Source:
public void testReadMultivalueXmlCsvJson() throws IOException { testReadMultivalue( ResultsReaderXml.class, "resultsMV.xml"); testReadMultivalue( ResultsReaderCsv.class, "resultsMV.csv"); testReadMultivalue( ResultsReaderJson.class, "resultsMV4.json"); testReadMultivalue( ResultsReaderJson.class, "resultsMV5.json"); testReadMultivalue( ResultsReaderXml.class, "resultsMVOneshot.xml"); testReadMultivalue( ResultsReaderCsv.class, "resultsMVOneshot.csv"); testReadMultivalue( ResultsReaderJson.class, "resultsMVOneshot4.json"); testReadMultivalue( ResultsReaderJson.class, "resultsMVOneshot5.json"); }

Target:
public void testReadMultivalueXmlCsvJson() throws IOException { String search = "search index=_internal | head 1"; testReadMultivalue( ResultsReaderXml.class, "resultsMV.xml"); testReadMultivalue( ResultsReaderCsv.class, "resultsMV.csv"); testReadMultivalue( ResultsReaderJson.class, "resultsMV4.json"); testReadMultivalue( ResultsReaderJson.class, "resultsMV5.json"); testReadMultivalue( ResultsReaderXml.class, "resultsMVOneshot.xml"); testReadMultivalue( ResultsReaderCsv.class, "resultsMVOneshot.csv"); testReadMultivalue( ResultsReaderJson.class, "resultsMVOneshot4.json"); testReadMultivalue( ResultsReaderJson.class, "resultsMVOneshot5.json"); testReadMultivalue( ResultsReaderXml.class, "splunk_search:blocking/xml/" + search); testReadMultivalue( ResultsReaderCsv.class, "splunk_search:blocking/csv/" + search); testReadMultivalue( ResultsReaderJson.class, "splunk_search:blocking/json/" + search); testReadMultivalue( ResultsReaderXml.class, "splunk_search:oneshot/xml/" + search); testReadMultivalue( ResultsReaderCsv.class, "splunk_search:oneshot/csv/" + search); testReadMultivalue( ResultsReaderJson.class, "splunk_search:oneshot/json/" + search); }
Source:
public void projectDirectoryRenameSlashTest() throws IOException { String absoluteRenamedDirectoryPath = defaultProject.getDirectory().getParent() + "/" + slashEncodedRenamedProject; File renamedDirectory = ProjectRenameTask.task(defaultProject.getDirectory(), slashRenamedProject); assertEquals(renamedDirectory.getAbsolutePath(), absoluteRenamedDirectoryPath); }

Target:
public void projectDirectoryRenameSlashTest() throws IOException { File expectedDirectory = new File(defaultProject.getDirectory().getParent(), slashEncodedRenamedProject); File renamedDirectory = ProjectRenameTask.task(defaultProject.getDirectory(), slashRenamedProject); assertEquals(expectedDirectory, renamedDirectory); }
Source:
private static boolean decodeStatus(int statusCode, String pluginName) { switch (statusCode) { case HttpURLConnection.HTTP_OK: logger.info("Gerrit Plugin " + pluginName + " is installed"); return true; case HttpURLConnection.HTTP_NOT_FOUND: logger.info("Gerrit Plugin " + pluginName + " is NOT installed"); return false; case HttpURLConnection.HTTP_UNAUTHORIZED: logger.warn(NOT_ABLE_TO_VERIFY_IF_GERRIT_PLUGIN + pluginName + " is installed. User is not NOT AUTHORIZED! Error: " + Messages.HttpConnectionUnauthorized()); return false; case HttpURLConnection.HTTP_FORBIDDEN: logger.warn(NOT_ABLE_TO_VERIFY_IF_GERRIT_PLUGIN + pluginName + " is installed. User is Forbidden! Error: " + Messages.HttpConnectionUnauthorized()); return false; default: logger.warn(NOT_ABLE_TO_VERIFY_IF_GERRIT_PLUGIN + pluginName + " is installed. Error: " + Messages.HttpConnectionError(statusCode)); return false; } }

Target:
private static boolean decodeStatus(int statusCode, String pluginName) { switch (statusCode) { case HttpURLConnection.HTTP_OK: logger.info(Messages.PluginInstalled(pluginName)); return true; case HttpURLConnection.HTTP_NOT_FOUND: logger.info(Messages.PluginNotInstalled(pluginName)); return false; case HttpURLConnection.HTTP_UNAUTHORIZED: logger.warn(Messages.PluginHttpConnectionUnauthorized(pluginName, Messages.HttpConnectionUnauthorized())); return false; case HttpURLConnection.HTTP_FORBIDDEN: logger.warn(Messages.PluginHttpConnectionForbidden(pluginName, Messages.HttpConnectionUnauthorized())); return false; default: logger.warn(Messages.PluginHttpConnectionGeneralError(pluginName, Messages.HttpConnectionError(statusCode))); return false; } }
Source:
@Override public void handleClick(MonthCellDescriptor cell) { Date clickedDate = cell.getDate(); if (!betweenDates(clickedDate, minCal, maxCal) || !isDateSelectable(clickedDate)) { if (invalidDateListener != null) { invalidDateListener.onInvalidDateSelected(clickedDate); } } else { boolean wasSelected = doSelectDate(clickedDate, cell); if (wasSelected && dateListener != null) { dateListener.onDateSelected(clickedDate); } else if (!wasSelected && dateListener != null) { dateListener.onDateUnselected(clickedDate); } } }

Target:
@Override public void handleClick(MonthCellDescriptor cell) { Date clickedDate = cell.getDate(); if (!betweenDates(clickedDate, minCal, maxCal) || !isDateSelectable(clickedDate)) { if (invalidDateListener != null) { invalidDateListener.onInvalidDateSelected(clickedDate); } } else if (dateListener != null) { boolean wasSelected = doSelectDate(clickedDate, cell); if (wasSelected) { dateListener.onDateSelected(clickedDate); } else { dateListener.onDateUnselected(clickedDate); } } }
Source:
public void run(String[] args) { if (0 == args.length) { System.out.println(getHelp()); } else { LanguageDetectorModel model = new LanguageDetectorModelLoader().load(new File(args[0])); LanguageDetector langDetectME = new LanguageDetectorME(model); ObjectStream<String> documentStream; PerformanceMonitor perfMon = new PerformanceMonitor(System.err, "doc"); perfMon.start(); try { documentStream = new ParagraphStream(new PlainTextByLineStream( new SystemInputStreamFactory(), SystemInputStreamFactory.encoding())); String document; while ((document = documentStream.read()) != null) { Language lang = langDetectME.predictLanguage(document); LanguageDetectorSample sample = new LanguageDetectorSample(lang, document); System.out.println(sample.toString()); perfMon.incrementCounter(); } } catch (IOException e) { CmdLineUtil.handleStdinIoError(e); } perfMon.stopAndPrintFinalResult(); } }

Target:
public void run(String[] args) { if (0 == args.length) { System.out.println(getHelp()); } else { LanguageDetectorModel model = new LanguageDetectorModelLoader().load(new File(args[0])); LanguageDetector langDetectME = new LanguageDetectorME(model); ObjectStream<String> documentStream; PerformanceMonitor perfMon = new PerformanceMonitor(System.err, "doc"); perfMon.start(); try { documentStream = new ParagraphStream(new PlainTextByLineStream( new SystemInputStreamFactory(), SystemInputStreamFactory.encoding())); String document; while ((document = documentStream.read()) != null) { Language lang = langDetectME.predictLanguage(document); LanguageSample sample = new LanguageSample(lang, document); System.out.println(sample.toString()); perfMon.incrementCounter(); } } catch (IOException e) { CmdLineUtil.handleStdinIoError(e); } perfMon.stopAndPrintFinalResult(); } }
Source:
public void clickModerationHintButton() { click(By.id("moderationHintButton")); }

Target:
public void clickModerationHintButton() { click(moderationHintButton); }
Source:
public TemporaryJobJsonReports(final Path outputDir) { this.outputDir = outputDir; this.outputDir.toFile().mkdirs(); }

Target:
public TemporaryJobJsonReports(final Path outputDir) { this.outputDir = outputDir; final File path = this.outputDir.toFile(); if (!path.mkdirs() && !path.isDirectory()) { throw new IllegalStateException(format("failed to create directory \"%s\"", outputDir)); } }
Source:
private static boolean isForEachReturningFirstElement(Tree loop, Tree jump) { if (!loop.is(Tree.Kind.FOREACH_STATEMENT) || !jump.is(Tree.Kind.RETURN_STATEMENT)) { return false; } ReturnStatementTree returnTree = (ReturnStatementTree) jump; ForEachStatementTree forEachTree = (ForEachStatementTree) loop; return areSyntacticallyEquivalent(returnTree.expression(), forEachTree.value()) || areSyntacticallyEquivalent(returnTree.expression(), forEachTree.key()); }

Target:
private static boolean isForEachReturningFirstElement(Tree loop, Tree jump) { if (!loop.is(Tree.Kind.FOREACH_STATEMENT, Tree.Kind.ALTERNATIVE_FOREACH_STATEMENT) || !jump.is(Tree.Kind.RETURN_STATEMENT)) { return false; } ReturnStatementTree returnTree = (ReturnStatementTree) jump; ForEachStatementTree forEachTree = (ForEachStatementTree) loop; if (hasMoreThanOneStatement(forEachTree)) { return false; } return areSyntacticallyEquivalent(returnTree.expression(), forEachTree.value()) || areSyntacticallyEquivalent(returnTree.expression(), forEachTree.key()); }