auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public OffsetDateTime getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { return (OffsetDateTime) cs.getObject(columnIndex); }

Target:
public OffsetDateTime getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { return cs.getObject(columnIndex, OffsetDateTime.class); }
Source:
public void setup() { log.info("Navigate to installation details"); new WorkbenchShell().maximize(); new ShellMenuItem(HELP_BUTTON, ABOUT_MENU_BUTTON).select(); DefaultStyledText dt = new DefaultStyledText(); String text = dt.getText(); int versionIndex = 0; jbossToolsVersion = text.substring(versionIndex = text.indexOf("Version:") + 9, text.indexOf("Build id", ++versionIndex)); log.info("JBossTools version: " + jbossToolsVersion); assertFalse("The JBossTools version value is empty!", jbossToolsVersion.isEmpty()); new PushButton(MODAL_DIALOG_ABOUT_DEVSTUDIO_INSTALLATION_DETAILS_BUTTON).click(); TabFolder tabFolder = new DefaultTabItem(MODAL_DIALOG_CONFIG_MENU_BUTTON).getTabFolder(); Optional<TabItem> configurationItem = tabFolder.getItems().stream() .filter(i -> i.getText().matches(MODAL_DIALOG_CONFIG_MENU_BUTTON)).findAny(); assertTrue("Tab item '" + MODAL_DIALOG_CONFIG_MENU_BUTTON + "' is missing", configurationItem.isPresent()); TabItem tabItem = configurationItem.get(); tabItem.activate(); new WaitWhile(new JobIsRunning(new RegexMatcher("Configuration Fetch Job"), true), TimePeriod.LONG); }

Target:
public void setup() { log.info("Navigate to installation details"); WorkbenchShell ws = new WorkbenchShell(); ws.maximize(); if (RunningPlatform.isOSX()) { log.info("Open " + HELP_BUTTON + " -> " + ABOUT_MENU_BUTTON + "directly on Mac OSX"); Display.asyncExec(new Runnable() { @Override public void run() { @SuppressWarnings("restriction") AboutDialog dialog = new AboutDialog(ws.getSWTWidget()); dialog.open(); } }); } else { new ShellMenuItem(HELP_BUTTON, ABOUT_MENU_BUTTON).select(); } about = new DefaultShell(ABOUT_MENU_BUTTON); DefaultStyledText dt = new DefaultStyledText(); String text = dt.getText(); int versionIndex = 0; jbossToolsVersion = text.substring(versionIndex = text.indexOf("Version:") + 9, text.indexOf("Build id", ++versionIndex)); log.info("JBossTools version: " + jbossToolsVersion); assertFalse("The JBossTools version value is empty!", jbossToolsVersion.isEmpty()); new PushButton(MODAL_DIALOG_ABOUT_DEVSTUDIO_INSTALLATION_DETAILS_BUTTON).click(); installationDetails = new DefaultShell(MODAL_DIALOG_ABOUT_DEVSTUDIO_INSTALLATION_DETAILS_TITLE); TabFolder tabFolder = new DefaultTabItem(MODAL_DIALOG_CONFIG_MENU_BUTTON).getTabFolder(); Optional<TabItem> configurationItem = tabFolder.getItems().stream() .filter(i -> i.getText().matches(MODAL_DIALOG_CONFIG_MENU_BUTTON)).findAny(); assertTrue("Tab item '" + MODAL_DIALOG_CONFIG_MENU_BUTTON + "' is missing", configurationItem.isPresent()); TabItem tabItem = configurationItem.get(); tabItem.activate(); new WaitWhile(new JobIsRunning(new RegexMatcher("Configuration Fetch Job"), true), TimePeriod.LONG); }
Source:
public AbstractSubTabAffinityLabelsView(SearchableDetailModelProvider<Label, M, T> modelProvider) { super(modelProvider); generateIds(); entitiesNameMap = new HashMap<>(); entitiesNameMap.putAll(getDetailModel().getEntitiesNameMap().getEntity()); getDetailModel().getEntitiesNameMap().getEntityChangedEvent().addListener((ev, sender, args) -> { entitiesNameMap.putAll(getDetailModel().getEntitiesNameMap().getEntity()); }); initTable(); initWidget(getTable()); }

Target:
public AbstractSubTabAffinityLabelsView(SearchableDetailModelProvider<Label, M, T> modelProvider) { super(modelProvider); generateIds(); updateEntitiesNameMap(); getDetailModel().getEntitiesNameMap().getEntityChangedEvent().addListener((ev, sender, args) -> { updateEntitiesNameMap(); }); initTable(); initWidget(getTable()); }
Source:
public List<AuditMessage> getMessages(PerunSession perunSession, int count) throws InternalErrorException { try { return jdbc.query("select " + auditMessageMappingSelectQuery + " from (select " + auditMessageMappingSelectQuery + Compatibility.getRowNumberOver() + " from auditer_log ORDER BY id Desc limit ?) "+Compatibility.getAsAlias("temp"), AUDIT_MESSAGE_MAPPER, count); } catch (EmptyResultDataAccessException ex) { return new ArrayList<>(); } catch (RuntimeException err) { throw new InternalErrorException(err); } }

Target:
public List<AuditMessage> getMessages(PerunSession perunSession, int count) throws InternalErrorException { try { return jdbc.query("select " + auditMessageMappingSelectQuery + " from (select " + auditMessageMappingSelectQuery + Compatibility.getRowNumberOver() + " from auditer_log ORDER BY id desc) "+Compatibility.getAsAlias("temp")+" where rownumber <= ?", AUDIT_MESSAGE_MAPPER, count); } catch (EmptyResultDataAccessException ex) { return new ArrayList<>(); } catch (RuntimeException err) { throw new InternalErrorException(err); } }
Source:
private Player determinePlayer(Entity source) { if (source instanceof GlowTntPrimed) { return (Player)((GlowTntPrimed)source).getPlayer(); } else if (source instanceof GlowPlayer) { return (Player)source; } else if (source instanceof GlowWolf) { return (Player)((GlowWolf)source).getOwner(); } return null; }

Target:
private Player determinePlayer(Entity source) { if (source instanceof GlowTntPrimed) { return (Player)((GlowTntPrimed) source).getSource(); } if (source instanceof GlowPlayer) { return (Player) source; } if (source instanceof GlowWolf) { return (Player)((GlowWolf) source).getOwner(); } return null; }
Source:
public void testApplicationFailsAsSoonAsOneJobFails() throws Throwable { final ConcurrentLinkedDeque<JobID> submittedJobIds = new ConcurrentLinkedDeque<>(); final TestingDispatcherGateway.Builder dispatcherBuilder = new TestingDispatcherGateway.Builder() .setSubmitFunction(jobGraph -> { submittedJobIds.add(jobGraph.getJobID()); return CompletableFuture.completedFuture(Acknowledge.get()); }) .setRequestJobStatusFunction(jobId -> { if (jobId.equals(submittedJobIds.peek())) { return CompletableFuture.completedFuture(JobStatus.FAILED); } return CompletableFuture.completedFuture(JobStatus.RUNNING); }) .setRequestJobResultFunction(jobId -> { if (jobId.equals(submittedJobIds.peek())) { return CompletableFuture.completedFuture(createFailedJobResult(jobId)); } return new CompletableFuture<>(); }); final CompletableFuture<Void> applicationFuture = runApplication(dispatcherBuilder, 2); assertException(applicationFuture, ApplicationFailedException.class); }

Target:
public void testApplicationFailsAsSoonAsOneJobFails() throws Throwable { final ConcurrentLinkedDeque<JobID> submittedJobIds = new ConcurrentLinkedDeque<>(); final TestingDispatcherGateway.Builder dispatcherBuilder = new TestingDispatcherGateway.Builder() .setSubmitFunction(jobGraph -> { submittedJobIds.add(jobGraph.getJobID()); return CompletableFuture.completedFuture(Acknowledge.get()); }) .setRequestJobStatusFunction(jobId -> { if (jobId.equals(submittedJobIds.peek())) { return CompletableFuture.completedFuture(JobStatus.FAILED); } return CompletableFuture.completedFuture(JobStatus.RUNNING); }) .setRequestJobResultFunction(jobId -> { if (jobId.equals(submittedJobIds.peek())) { return CompletableFuture.completedFuture(createFailedJobResult(jobId)); } return new CompletableFuture<>(); }); final CompletableFuture<Void> applicationFuture = runApplication(dispatcherBuilder, 2); final ApplicationFailureException exception = assertException(applicationFuture, ApplicationFailureException.class); assertEquals(exception.getStatus(), ApplicationStatus.FAILED); }
Source:
public void tearDown() throws Exception { clearCatalogAndWait(); configureRestForGuest(); urlResourceReaderConfigurator.setUrlResourceReaderRootDirs( DEFAULT_URL_RESOURCE_READER_ROOT_RESOURCE_DIRS); for (String resource : resourcesToDelete) { FileUtils.deleteQuietly(new File(resource)); } resourcesToDelete.clear(); cswServer.stop(); getSecurityPolicy().configureRestForGuest(); if (server != null) { server.stop(); } }

Target:
public void tearDown() throws Exception { clearCatalogAndWait(); configureRestForGuest(); urlResourceReaderConfigurator.setUrlResourceReaderRootDirs( DEFAULT_URL_RESOURCE_READER_ROOT_RESOURCE_DIRS); for (String resource : resourcesToDelete) { FileUtils.deleteQuietly(new File(resource)); } resourcesToDelete.clear(); cswServer.stop(); if (server != null) { server.stop(); } }
Source:
public void checkClientTrusted(X509Certificate[] certificates, String authType) throws CertificateException { if (certificates != null) { if (LOGGER.isDebugEnabled()) { for (int c = 0; c < certificates.length; c++) { X509Certificate cert = certificates[c]; LOGGER.debug(" Client certificate " + (c + 1) + ":"); LOGGER.debug(" Subject DN: " + cert.getSubjectDN()); LOGGER.debug(" Signature Algorithm: " + cert.getSigAlgName()); LOGGER.debug(" Valid from: " + cert.getNotBefore()); LOGGER.debug(" Valid until: " + cert.getNotAfter()); LOGGER.debug(" Issuer: " + cert.getIssuerDN()); } } defaultTrustManager.checkClientTrusted(certificates, authType); } }

Target:
public void checkClientTrusted(X509Certificate[] certificates, String authType) throws CertificateException { if (certificates != null) { if (LOGGER.isDebugEnabled()) { debugLogCertificates("Client", certificates); } defaultTrustManager.checkClientTrusted(certificates, authType); } }
Source:
private void updatePath() { mPath.reset(); mBorderPath.reset(); mTempRectangle.set(getBounds()); switch (mType){ case CLIPPING: mTempRectangle.inset(mPadding, mPadding); if (mIsCircle) { mPath.addCircle( mTempRectangle.centerX(), mTempRectangle.centerY(), Math.min(mTempRectangle.width(), mTempRectangle.height()) / 2, Path.Direction.CW); } else { mPath.addRoundRect(mTempRectangle, mRadii, Path.Direction.CW); } mTempRectangle.inset(-mPadding, -mPadding); break; case OVERLAY_COLOR: mTempRectangle.inset(mPadding, mPadding); if (mIsCircle) { mPath.addCircle( mTempRectangle.centerX(), mTempRectangle.centerY(), Math.min(mTempRectangle.width(), mTempRectangle.height()) / 2, Path.Direction.CW); } else { mPath.addRoundRect(mTempRectangle, mRadii, Path.Direction.CW); } mTempRectangle.inset(-mPadding, -mPadding); break; } mTempRectangle.inset(mBorderWidth/2, mBorderWidth/2); if (mIsCircle) { mBorderPath.addCircle( mTempRectangle.centerX(), mTempRectangle.centerY(), Math.min(mTempRectangle.width(), mTempRectangle.height())/2, Path.Direction.CW); } else { mBorderRadii[0] = mBorderRadii[1] = mRadii[0] + mPadding - mBorderWidth/2; mBorderRadii[2] = mBorderRadii[3] = mRadii[2] + mPadding - mBorderWidth/2; mBorderRadii[4] = mBorderRadii[5] = mRadii[4] + mPadding - mBorderWidth/2; mBorderRadii[6] = mBorderRadii[7] = mRadii[6] + mPadding - mBorderWidth/2; mBorderPath.addRoundRect(mTempRectangle, mBorderRadii, Path.Direction.CW); } mTempRectangle.inset(-mBorderWidth/2, -mBorderWidth/2); }

Target:
private void updatePath() { mPath.reset(); mBorderPath.reset(); mTempRectangle.set(getBounds()); mTempRectangle.inset(mPadding, mPadding); if (mIsCircle) { mPath.addCircle( mTempRectangle.centerX(), mTempRectangle.centerY(), Math.min(mTempRectangle.width(), mTempRectangle.height())/2, Path.Direction.CW); } else { mPath.addRoundRect(mTempRectangle, mRadii, Path.Direction.CW); } mTempRectangle.inset(-mPadding, -mPadding); mTempRectangle.inset(mBorderWidth/2, mBorderWidth/2); if (mIsCircle) { float radius = Math.min(mTempRectangle.width(), mTempRectangle.height())/2; mBorderPath.addCircle(mTempRectangle.centerX(), mTempRectangle.centerY(), radius, Path.Direction.CW); } else { for (int i = 0; i < mBorderRadii.length; i++) { mBorderRadii[i] = mRadii[i] + mPadding - mBorderWidth/2; } mBorderPath.addRoundRect(mTempRectangle, mBorderRadii, Path.Direction.CW); } mTempRectangle.inset(-mBorderWidth/2, -mBorderWidth/2); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } I18nMap other = (I18nMap) obj; return values.equals(other.values); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof I18nMap) { I18nMap other = (I18nMap) obj; return Objects.equals(values, other.values); } return false; }
Source:
public void getFieldTest() { assertNotNull(getField(Person.class, "firstName")); assertNotNull(getField(SubPerson.class, "firstName")); Assertions.assertThatThrownBy(() -> getField(Person.class, "notExistingField")) .isInstanceOf(ScenarioException.class) .hasMessageStartingWith("Impossible to find field with name "); }

Target:
public void getFieldTest() { assertNotNull(getField(Person.class, "firstName")); assertNotNull(getField(SubPerson.class, "firstName")); assertNotNull(getField(SubPerson.class, "additionalField")); Assertions.assertThatThrownBy(() -> getField(Person.class, "notExistingField")) .isInstanceOf(ScenarioException.class) .hasMessageStartingWith("Impossible to find field with name "); }
Source:
public void outEvent() { assert (!ioError); if (outsize == 0) { if (encoder == null) { assert (handshaking); return; } outpos.set(null); outsize = encoder.encode(outpos, 0); final int outBatchSize = options.sndbuf > Config.OUT_BATCH_SIZE.getValue() ? options.sndbuf : Config.OUT_BATCH_SIZE.getValue(); while (outsize < outBatchSize) { Msg msg = nextMsg.get(); if (msg == null) { break; } encoder.loadMsg(msg); int n = encoder.encode(outpos, outBatchSize - outsize); assert (n > 0); outsize += n; } if (outsize == 0) { outputStopped = true; ioObject.resetPollOut(handle); return; } encoder.encoded(); } int nbytes = write(outpos.get()); if (nbytes == -1) { ioObject.resetPollOut(handle); return; } outsize -= nbytes; if (handshaking) { if (outsize == 0) { ioObject.resetPollOut(handle); } } }

Target:
public void outEvent() { assert (!ioError); if (outsize == 0) { if (encoder == null) { assert (handshaking); return; } outpos.set(null); outsize = encoder.encode(outpos, 0); final int outBatchSize = Math.max(options.sndbuf, Config.OUT_BATCH_SIZE.getValue()); while (outsize < outBatchSize) { Msg msg = nextMsg.get(); if (msg == null) { break; } encoder.loadMsg(msg); int n = encoder.encode(outpos, outBatchSize - outsize); assert (n > 0); outsize += n; } if (outsize == 0) { outputStopped = true; ioObject.resetPollOut(handle); return; } encoder.encoded(); } int nbytes = write(outpos.get()); if (nbytes == -1) { ioObject.resetPollOut(handle); return; } outsize -= nbytes; if (handshaking) { if (outsize == 0) { ioObject.resetPollOut(handle); } } }
Source:
public void init() { super.init(); connectSensors(); this.addTag(String.format("ibm.mms.tenant.entity:%s", getConfig(BrooklynNode.MANAGEMENT_USER))); getMutableEntityType().addEffector(Effectors.effector(Startable.STOP).impl(new StopAndExpungeEffector()).build()); }

Target:
public void init() { super.init(); connectSensors(); }
Source:
public AccountCreationPolicy setVerificationSuccessEmailStatus(EmailStatus accountVerificationSuccessEmailStatus) { Assert.notNull(accountVerificationSuccessEmailStatus, "verificationSuccessEmailStatus cannot be null."); setProperty(ACCOUNT_VERIFICATION_SUCCESS_EMAIL_STATUS, accountVerificationSuccessEmailStatus.name()); return this; }

Target:
public AccountCreationPolicy setVerificationSuccessEmailStatus(EmailStatus accountVerificationSuccessEmailStatus) { Assert.notNull(accountVerificationSuccessEmailStatus, "accountVerificationSuccessEmailStatus cannot be null."); setProperty(ACCOUNT_VERIFICATION_SUCCESS_EMAIL_STATUS, accountVerificationSuccessEmailStatus.name()); return this; }
Source:
public void measures_on_project_accessors_handled_as_methods() throws Exception { initAndScan(false); ArgumentCaptor<Measure> captor = ArgumentCaptor.forClass(Measure.class); verify(context, atLeastOnce()).saveMeasure(any(org.sonar.api.resources.File.class), captor.capture()); Map<String, Double> metrics = new HashMap<String, Double>(); for (Measure measure : captor.getAllValues()) { if (measure.getValue() != null) { if (metrics.get(measure.getMetricKey()) == null) { metrics.put(measure.getMetricKey(), measure.getValue()); } else { metrics.put(measure.getMetricKey(), metrics.get(measure.getMetricKey()) + measure.getValue()); } } } assertThat(metrics.get("classes").intValue()).isEqualTo(146); assertThat(metrics.get("functions").intValue()).isEqualTo(1429); assertThat(metrics.get("lines").intValue()).isEqualTo(32878); assertThat(metrics.get("ncloc").intValue()).isEqualTo(14007); assertThat(metrics.get("statements").intValue()).isEqualTo(6403); assertThat(metrics.get("complexity").intValue()).isEqualTo(3859); assertThat(metrics.get("comment_lines").intValue()).isEqualTo(7605); assertThat(metrics.get("public_api").intValue()).isEqualTo(1340); }

Target:
public void measures_on_project_accessors_handled_as_methods() throws Exception { initAndScan(false); Map<String, Double> metrics = getMetrics(); verifySameResults(metrics); assertThat(metrics.get("public_api").intValue()).isEqualTo(1340); assertThat(metrics.get("functions").intValue()).isEqualTo(1429); assertThat(metrics.get("complexity").intValue()).isEqualTo(3859); }
Source:
private boolean hasKeepAliveForConnection() { String keepAlive = assertion.getKeepAlive(); if (NullChecker.isNullish(keepAlive)) { keepAlive = getKeepAliveProperty(); } return NullChecker.isNotNullish(keepAlive) && (keepAlive.equalsIgnoreCase("TRUE") || keepAlive.equalsIgnoreCase("T")); }

Target:
private boolean hasKeepAliveForConnection() { String keepAlive = assertion.getKeepAlive(); if (NullChecker.isNullish(keepAlive)) { keepAlive = getKeepAliveProperty(); } return ("TRUE".equalsIgnoreCase(keepAlive) || "T".equalsIgnoreCase(keepAlive)); }
Source:
public void testRemoveIndexesOnTableDrop() throws Exception { IgniteEx ignite = startGrids(1); ignite.cluster().active(true); IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); query(cache, "create table t1 (id integer primary key, p integer, f integer) with \"BACKUPS=1, CACHE_GROUP=grp_test_table\""); query(cache, "create table t2 (id integer primary key, p integer, f integer) with \"BACKUPS=1, CACHE_GROUP=grp_test_table\""); query(cache, "create index t2_idx on t2 (p)"); for (int i = 0; i < 5_000; i++) query(cache, "insert into t2 (id, p, f) values (?, ?, ?)", i, i, i); forceCheckpoint(); CountDownLatch inxDeleteInAsyncTaskLatch = new CountDownLatch(1); LogListener lsnr = new CallbackExecutorLogListener( ".*?Execution of durable background task completed: DROP_SQL_INDEX-PUBLIC.T2_IDX-.*", () -> inxDeleteInAsyncTaskLatch.countDown() ); testLog.registerListener(lsnr); ignite.destroyCache("SQL_PUBLIC_T2"); awaitLatch( inxDeleteInAsyncTaskLatch, "Failed to await for index deletion in async task (either index failed to delete in 1 minute or async task not started)" ); }

Target:
public void testRemoveIndexesOnTableDrop() throws Exception { IgniteEx ignite = startGrids(1); ignite.cluster().active(true); IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); query(cache, "create table t1 (id integer primary key, p integer, f integer) with \"BACKUPS=1, CACHE_GROUP=grp_test_table\""); query(cache, "create table t2 (id integer primary key, p integer, f integer) with \"BACKUPS=1, CACHE_GROUP=grp_test_table\""); query(cache, "create index t2_idx on t2 (p)"); batchQuery(ignite, "insert into t2 (id, p, f) values (?, ?, ?)", batchInsertArgs(5_000, 3)); forceCheckpoint(); CountDownLatch inxDeleteInAsyncTaskLatch = new CountDownLatch(1); LogListener lsnr = new CallbackExecutorLogListener( ".*?Execution of durable background task completed: DROP_SQL_INDEX-PUBLIC.T2_IDX-.*", () -> inxDeleteInAsyncTaskLatch.countDown() ); testLog.registerListener(lsnr); ignite.destroyCache("SQL_PUBLIC_T2"); awaitLatch( inxDeleteInAsyncTaskLatch, "Failed to await for index deletion in async task (either index failed to delete in 1 minute or async task not started)" ); }
Source:
public void userAuthenticated() { Intent intent = new Intent(mOpenMRS.getApplicationContext(), DashboardActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mOpenMRS.getApplicationContext().startActivity(intent); Intent intent1 = new Intent(mOpenMRS.getApplicationContext(), FormListService.class); mOpenMRS.getApplicationContext().startService(intent1); mPresenter.saveLocationsToDatabase(mLocationsList, mDropdownLocation.getSelectedItem().toString()); }

Target:
public void userAuthenticated() { Intent intent = new Intent(mOpenMRS.getApplicationContext(), DashboardActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mOpenMRS.getApplicationContext().startActivity(intent); Intent formListServiceIntent = new Intent(mOpenMRS.getApplicationContext(), FormListService.class); mOpenMRS.getApplicationContext().startService(formListServiceIntent); mPresenter.saveLocationsToDatabase(mLocationsList, mDropdownLocation.getSelectedItem().toString()); }
Source:
public void start() { configuration.getIgnoredCaches().forEach(this::ignoreCache); RestCacheManager restCacheManager = new RestCacheManager(cacheManager, this::isCacheIgnored); server = Optional.of(new Server(configuration, restCacheManager)); if(configuration.startTransport()) { NettyJaxrsServer nettyServer = createNetty(); nettyServer.start(); ResteasyDeployment deployment = nettyServer.getDeployment(); deployment.getRegistry().addSingletonResource(server.get(), DEFAULT_REST_PATH); deployment.getProviderFactory().register(new RestAccessLoggingHandler(), ContainerRequestFilter.class, ContainerResponseFilter.class); log.startRestServer(configuration.host(), configuration.port()); netty = Optional.of(nettyServer); } }

Target:
public void start() { configuration.ignoredCaches().forEach(this::ignoreCache); RestCacheManager restCacheManager = new RestCacheManager(cacheManager, this::isCacheIgnored); server = new Server(configuration, restCacheManager); if(configuration.startTransport()) { NettyJaxrsServer nettyServer = createNetty(); addEncryption(configuration, nettyServer); nettyServer.start(); ResteasyDeployment deployment = nettyServer.getDeployment(); deployment.getRegistry().addSingletonResource(server, DEFAULT_REST_PATH); deployment.getProviderFactory().register(new RestAccessLoggingHandler(), ContainerRequestFilter.class, ContainerResponseFilter.class); log.startRestServer(configuration.host(), configuration.port()); netty = nettyServer; } }
Source:
public Partition[] listPartitions() { try { return readTopology().getPartitions(); } catch (final KeeperException.NoNodeException e) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }

Target:
public Partition[] listPartitions() throws NakadiRuntimeException, SubscriptionNotInitializedException { try { return readTopology().getPartitions(); } catch (final KeeperException.NoNodeException e) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }
Source:
public CompletionTime processOneToOne(String tenantId, Span item) throws RetryAttemptException { if (item.getParentId() == null) { CompletionTime ct = new CompletionTime(); ct.setId(item.getId()); URL url = item.url(); if (url != null) { ct.setUri(url.getPath()); ct.setEndpointType(url.getProtocol() == null ? null : url.getProtocol().toUpperCase()); } else { ct.setEndpointType("Unknown"); } ct.setDuration(TimeUnit.MILLISECONDS.convert(item.getDuration(), TimeUnit.NANOSECONDS)); ct.setTimestamp(item.getTimestamp()/1000); List<Property> spanProperties = item.properties(); ct.getProperties().addAll(spanProperties); ct.setHostName(Span.ipv4Address(spanProperties)); if (log.isLoggable(Level.FINEST)) { log.finest("TraceCompletionTimeDeriver ret=" + ct); } return ct; } return null; }

Target:
public CompletionTime processOneToOne(String tenantId, Span item) throws RetryAttemptException { if (item.getParentId() == null) { CompletionTime ct = new CompletionTime(); ct.setId(item.getId()); URL url = item.url(); if (url != null) { ct.setUri(url.getPath()); ct.setEndpointType(url.getProtocol() == null ? null : url.getProtocol().toUpperCase()); } else { ct.setEndpointType("Unknown"); } ct.setDuration(TimeUnit.MILLISECONDS.convert(item.getDuration(), TimeUnit.NANOSECONDS)); ct.setTimestamp(item.getTimestamp()/1000); List<Property> spanProperties = item.properties(); ct.getProperties().addAll(spanProperties); ct.setHostAddress(Span.ipv4Address(spanProperties)); if (log.isLoggable(Level.FINEST)) { log.finest("TraceCompletionTimeDeriver ret=" + ct); } return ct; } return null; }
Source:
public void handleDownloadProgressMenuItem(Menu menu) { final MenuItem newProgressMenuItem = menu.findItem(R.id.menu_item_download_progress); final View progressView = newProgressMenuItem.getActionView(); final ProgressWheel newProgressWheel = (ProgressWheel) progressView.findViewById(R.id.progress_wheel); if (progressMenuItem != null) { newProgressMenuItem.setVisible(progressMenuItem.isVisible()); newProgressWheel.setProgress(progressWheel.getProgress()); } progressMenuItem = newProgressMenuItem; progressWheel = newProgressWheel; progressView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { environment.getRouter().showDownloads(getActivity()); } }); if (updateDownloadProgressRunnable == null) { updateDownloadProgressRunnable = new Runnable() { @Override public void run() { if (!NetworkUtil.isConnected(getContext()) || !environment.getDatabase().isAnyVideoDownloading(null)) { progressMenuItem.setVisible(false); } else { progressMenuItem.setVisible(true); environment.getStorage().getAverageDownloadProgress( new DataCallback<Integer>() { @Override public void onResult(Integer result) { int progressPercent = result; if (progressPercent >= 0 && progressPercent <= 100) { progressWheel.setProgressPercent(progressPercent); } } @Override public void onFail(Exception ex) { logger.error(ex); } }); } handler.postDelayed(this, DateUtils.SECOND_IN_MILLIS); } }; updateDownloadProgressRunnable.run(); } }

Target:
public void handleDownloadProgressMenuItem(Menu menu) { final MenuItem downloadsMenuItem = menu.findItem(R.id.menu_item_download_progress); final View progressView = downloadsMenuItem.getActionView(); final ProgressWheel progressWheel = (ProgressWheel) progressView.findViewById(R.id.progress_wheel); if (downloadsMenuItem != null) { downloadsMenuItem.setVisible(downloadsMenuItem.isVisible()); progressWheel.setProgress(progressWheel.getProgress()); } progressView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { environment.getRouter().showDownloads(getActivity()); } }); if (updateDownloadProgressRunnable == null) { updateDownloadProgressRunnable = new Runnable() { @Override public void run() { if (!NetworkUtil.isConnected(getContext()) || !environment.getDatabase().isAnyVideoDownloading(null)) { downloadsMenuItem.setVisible(false); } else { downloadsMenuItem.setVisible(true); environment.getStorage().getAverageDownloadProgress( new DataCallback<Integer>() { @Override public void onResult(Integer result) { int progressPercent = result; if (progressPercent >= 0 && progressPercent <= 100) { progressWheel.setProgressPercent(progressPercent); } } @Override public void onFail(Exception ex) { logger.error(ex); } }); } handler.postDelayed(this, DateUtils.SECOND_IN_MILLIS); } }; updateDownloadProgressRunnable.run(); } }
Source:
private void addCopy(StringBuilder b) { if (assemblyUser != null) { String[] userParts = assemblyUser.split(":"); for (CopyEntry entry : copyEntries) { String dest = (basedir.equals("/") ? "" : basedir) + "/" + entry.destination; DockerFileKeyword.ADD.addTo(b, " --chown=" + (userParts.length > 2 ? userParts[0] + ":" + userParts[1] : userParts[0]), entry.source, dest); } } else { addCopyEntries(b, ""); } }

Target:
private void addCopy(StringBuilder b) { if (assemblyUser != null) { String[] userParts = assemblyUser.split(":"); for (CopyEntry entry : copyEntries) { if (userParts.length > 2) { DockerFileKeyword.USER.addTo(b, "root"); } addCopyEntries(b, "", (userParts.length > 1 ? userParts[0] + ":" + userParts[1] : userParts[0])); if (userParts.length > 2) { DockerFileKeyword.USER.addTo(b, userParts[2]); } } } else { addCopyEntries(b, "", null); } }
Source:
private static int compareImports(String import1, String import2) { int result = 0; final String separator = "\\."; final String[] import1Tokens = import1.split(separator); final String[] import2Tokens = import2.split(separator); for (int i = 0; i != import1Tokens.length && i != import2Tokens.length; i++) { final String import1Token = import1Tokens[i]; final String import2Token = import2Tokens[i]; result = import1Token.compareTo(import2Token); if (result != 0) { break; } } return result; }

Target:
private static int compareImports(String import1, String import2) { int result = 0; final String separator = "\\."; final String[] import1Tokens = import1.split(separator); final String[] import2Tokens = import2.split(separator); for (int i = 0; i != import1Tokens.length && i != import2Tokens.length; i++) { final String import1Token = import1Tokens[i]; final String import2Token = import2Tokens[i]; result = import1Token.compareTo(import2Token); if (result != 0) { break; } } if (result == 0) { result = Integer.compare(import1Tokens.length, import2Tokens.length); } return result; }
Source:
protected Set<ConstraintCheckError> doCheck(Element element, AnnotationMirror annotation) { List<? extends AnnotationValue> annotationValue = annotationApiHelper.getAnnotationArrayValue( annotation, "groups" ); Set<ConstraintCheckError> issues = CollectionHelper.newHashSet(); for ( AnnotationValue value : annotationValue ) { if ( value.getValue() instanceof DeclaredType && !( (DeclaredType) value.getValue() ).asElement().getKind().isInterface() ) { issues.add( new ConstraintCheckError( element, annotation, "INVALID_GROUPS_VALUE_ANNOTATION_PARAMETERS" ) ); } } return issues; }

Target:
protected Set<ConstraintCheckError> doCheck(Element element, AnnotationMirror annotation) { List<? extends AnnotationValue> annotationValue = annotationApiHelper.getAnnotationArrayValue( annotation, "groups" ); Set<ConstraintCheckError> issues = CollectionHelper.newHashSet(); for ( AnnotationValue value : annotationValue ) { TypeMirror typeValue = (TypeMirror) value.getValue(); if ( !TypeKind.DECLARED.equals( typeValue.getKind() ) || !( (DeclaredType) typeValue ).asElement().getKind().isInterface() ) { issues.add( new ConstraintCheckError( element, annotation, "INVALID_GROUPS_VALUE_ANNOTATION_PARAMETERS" ) ); } } return issues; }
Source:
private void setupAlert() { alert = new Alert(Alert.AlertType.NONE); alert.setTitle(" "); alert.setHeaderText("Loading..."); alert.getButtonTypes().add(ButtonType.CANCEL); alert.getDialogPane().setContent(progressBar); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); Image icon = new Image(this.getClass().getResourceAsStream(ICON)); stage.getIcons().add(icon); }

Target:
private void setupAlert() { this.setTitle("DNAinator"); this.setHeaderText("Loading..."); this.getButtonTypes().add(ButtonType.CANCEL); this.initOwner(parent.getScene().getWindow()); this.getDialogPane().setContent(progressBar); }
Source:
@Test public void getWithUrlThenPathThrows() { class Example { @GET Call<Object> method(@Url String url, @Path("hey") String hey) { return null; } } try { buildRequest(Example.class, "foo/bar"); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("@Path parameters may not be used with @Url. (parameter #2)\n" + " for method Example.method"); } }

Target:
@Test public void getWithUrlThenPathThrows() { class Example { @GET Call<Object> method(@Url String url, @Path("hey") String hey) { return null; } } try { buildRequest(Example.class, "foo/bar"); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("@Path parameters may not be used with @Url. (parameter #2)\n" + " for method Example.method"); } }
Source:
public static List<List<Migration>> findPaths( Resource resource, Optional<UUID> fromState, Optional<UUID> targetState) { return findPaths(resource, fromState, targetState, new ArrayList<>()); }

Target:
public static List<List<Migration>> findPaths( Resource resource, Optional<UUID> fromState, Optional<UUID> targetState) { if (resource == null) throw new ArgumentNullException("resource"); if (fromState == null) throw new ArgumentNullException("fromState"); if (targetState == null) throw new ArgumentNullException("targetState"); return findPaths(resource, fromState, targetState, new ArrayList<>()); }
Source:
public static List<TurboIssue> reconcile(List<TurboIssue> existing, List<TurboIssue> changed) { List<TurboIssue> existingCopy = new ArrayList<>(existing); for (TurboIssue issue : changed) { int id = issue.getId(); Optional<Integer> correspondingIssueIndex = findIssueWithId(existingCopy, id); if (correspondingIssueIndex.isPresent()) { TurboIssue existingIssue = existingCopy.get(correspondingIssueIndex.get()); TurboIssue newIssue = new TurboIssue(issue); newIssue.transferTransientState(existingIssue); newIssue.reconcile(existingIssue); existingCopy.set(correspondingIssueIndex.get(), newIssue); } else { existingCopy.add(new TurboIssue(issue)); } } return existingCopy; }

Target:
public static List<TurboIssue> reconcile(List<TurboIssue> existing, List<TurboIssue> changed) { List<TurboIssue> existingCopy = new ArrayList<>(existing); for (TurboIssue issue : changed) { int id = issue.getId(); Optional<Integer> correspondingIssueIndex = findIssueWithId(existingCopy, id); if (!correspondingIssueIndex.isPresent()) { existingCopy.add(new TurboIssue(issue)); } else { TurboIssue existingIssue = existingCopy.get(correspondingIssueIndex.get()); TurboIssue newIssue = new TurboIssue(issue); newIssue.transferTransientState(existingIssue); newIssue.reconcile(existingIssue); existingCopy.set(correspondingIssueIndex.get(), newIssue); } } return existingCopy; }
Source:
private DetectorTask detectFailure(PollReport pollReport, Layout layout) { log.trace("Handle failures for the report: {}", pollReport); try { if (IOLatencyDetector.reportSpike() == true) { Set<String> failedNodes = new HashSet<>(); failedNodes.add(serverContext.getLocalEndpoint()); log.info ("detected failure"); return detectFailure(layout, failedNodes, pollReport).get (); } ClusterState clusterState = pollReport.getClusterState(); if (clusterState.size() != layout.getAllServers().size()) { String err = String.format( "Cluster representation is different than layout. Cluster: %s, layout: %s", clusterState, layout ); throw new IllegalStateException(err); } Optional<NodeRank> maybeFailedNode = advisor.failedServer(clusterState); if (maybeFailedNode.isPresent()) { NodeRank failedNode = maybeFailedNode.get(); FailureDetectorMetrics history = FailureDetectorMetrics.builder() .localNode(serverContext.getLocalEndpoint()) .graph(advisor.getGraph(pollReport.getClusterState()).connectivityGraph()) .healed(failedNode) .action(FailureDetectorAction.FAIL) .unresponsiveNodes(layout.getUnresponsiveServers()) .layout(layout.getLayoutServers()) .epoch(layout.getEpoch()) .build(); serverContext.saveFailureDetectorMetrics(history); Set<String> failedNodes = new HashSet<>(); failedNodes.add(failedNode.getEndpoint()); return detectFailure(layout, failedNodes, pollReport).get(); } } catch (Exception e) { log.error("Exception invoking failure handler", e); } return DetectorTask.NOT_COMPLETED; }

Target:
private DetectorTask detectFailure(PollReport pollReport, Layout layout) { log.trace("Handle failures for the report: {}", pollReport); try { ClusterState clusterState = pollReport.getClusterState(); if (FileChannelPerf.reportSpike()) { Set<String> failedNodes = new HashSet<>(); failedNodes.add(serverContext.getLocalEndpoint()); log.info ("detected failure"); return detectFailure(layout, failedNodes, pollReport).get (); } if (clusterState.size() != layout.getAllServers().size()) { String err = String.format( "Cluster representation is different than layout. Cluster: %s, layout: %s", clusterState, layout ); throw new IllegalStateException(err); } Optional<NodeRank> maybeFailedNode = advisor.failedServer(clusterState); if (maybeFailedNode.isPresent()) { NodeRank failedNode = maybeFailedNode.get(); FailureDetectorMetrics history = FailureDetectorMetrics.builder() .localNode(serverContext.getLocalEndpoint()) .graph(advisor.getGraph(pollReport.getClusterState()).connectivityGraph()) .healed(failedNode) .action(FailureDetectorAction.FAIL) .unresponsiveNodes(layout.getUnresponsiveServers()) .layout(layout.getLayoutServers()) .epoch(layout.getEpoch()) .build(); serverContext.saveFailureDetectorMetrics(history); Set<String> failedNodes = new HashSet<>(); failedNodes.add(failedNode.getEndpoint()); return detectFailure(layout, failedNodes, pollReport).get(); } } catch (Exception e) { log.error("Exception invoking failure handler", e); } return DetectorTask.NOT_COMPLETED; }
Source:
public String toString() { return "ExcelConfiguration[columnNameLineNumber=" + columnNameLineNumber + ", skipEmptyLines=" + skipEmptyLines + ", skipEmptyColumns=" + skipEmptyColumns +", detectColumnTypes=" + detectColumnTypes + "]"; }

Target:
public String toString() { return "ExcelConfiguration[columnNameLineNumber=" + columnNameLineNumber + ", skipEmptyLines=" + skipEmptyLines + ", skipEmptyColumns=" + skipEmptyColumns +", detectColumnTypes=" + detectColumnTypes + ", numbersOfLinesToScan=" + numberOfLinesToScan + "]"; }
Source:
private JpaClass(Class<C> clazz) { logger.debug("init {}", clazz); this.members = unmodifiableList(new ArrayList<>(inspectClass(clazz))); logger.debug("init {}: members.", clazz, members.size()); }

Target:
private JpaClass(Class<C> clazz) { this.members = unmodifiableList(new ArrayList<>(inspectClass(clazz))); logger.debug("init {}: members.", clazz, members.size()); }
Source:
public void setFanDirection(int direction) { resetFanToOff(); if (direction < FAN_DIRECTION_FACE || direction > FAN_DIRECTION_FLOOR_DEFROSTER) return; for (ImageView v : mControlMap.keySet()) { if (direction == mControlMap.get(v)) { v.setImageDrawable(mFanMap.get(v).first); v.setAlpha(SELECTED_BUTTON_ALPHA); return; } } }

Target:
public void setFanDirection(int direction) { resetFanToOff(); if (direction < FAN_DIRECTION_FACE || direction > FAN_DIRECTION_FLOOR_DEFROSTER) { Log.i(TAG, "Unexpected fan direction: " + direction); return; } for (Map.Entry<ImageView, Integer> entry : mControlMap.entrySet()) { if (direction == entry.getValue()) { ImageView v = entry.getKey(); v.setImageDrawable(mFanMap.get(v).first); v.setAlpha(SELECTED_BUTTON_ALPHA); return; } } }
Source:
private boolean loadData() { if (currentChunk == null || !currentChunk.hasRemaining()) { if (currentChunk != null) { scheduledWriteChannel.resolveChunk(currentChunk, null); } try { currentChunk = scheduledWriteChannel.getNextChunk(); } catch (InterruptedException e) { throw new IllegalStateException(e); } } return currentChunk != null; }

Target:
private boolean loadData() throws IOException { if (currentChunk == null || !currentChunk.hasRemaining()) { if (currentChunk != null) { asyncWritableChannel.resolveChunk(currentChunk, null); } try { currentChunk = asyncWritableChannel.getNextChunk(); } catch (InterruptedException e) { throw new IllegalStateException(e); } } if (currentChunk == null) { if (callback.exception != null) { if (callback.exception instanceof IOException) { throw (IOException) callback.exception; } else { throw new IllegalStateException(callback.exception); } } else if (bytesAvailable != 0) { throw new IllegalStateException("All the bytes available could not be read"); } } return currentChunk != null; }
Source:
public final void applyToBuilder(SCMSourceBuilder<?, ?> builder) { if (!getDescriptor().isApplicableToBuilder(builder)) { } decorateBuilder((SCMSourceBuilder) builder); }

Target:
public final void applyToBuilder(SCMSourceBuilder<?, ?> builder) { SCMNavigatorTraitDescriptor d = getDescriptor(); if (d.getBuilderClass().isInstance(builder) && d.isApplicableToBuilder(builder)) { decorateBuilder(builder); } }
Source:
public final ScriptResult executeAsync(final Object content) { final Script piece; if (content instanceof Script) { piece = (Script) content; } else { if (content instanceof org.eclipse.core.resources.IFile) { piece = new Script(((org.eclipse.core.resources.IFile) content).getName(), content); } else if (content instanceof java.io.File) { piece = new Script(((java.io.File) content).getName(), content); } else { piece = new Script(content); } } fCodePieces.add(piece); synchronized (this) { notifyAll(); } return piece.getResult(); }

Target:
public final ScriptResult executeAsync(final Object content) { final Script piece; if (content instanceof Script) { piece = (Script) content; } else { piece = new Script(content); } fCodePieces.add(piece); synchronized (this) { notifyAll(); } return piece.getResult(); }
Source:
public ICPPEvaluation getInitializerEvaluation() { ICPPASTDeclarator declarator = (ICPPASTDeclarator)findDeclarator(); if(declarator != null) { IASTInitializer initializer = declarator.getInitializer(); if(hasImplicitlyCalledCtor(declarator)) { ICPPConstructor constructor = (ICPPConstructor)CPPSemantics.findImplicitlyCalledConstructor(declarator); ICPPEvaluation[] arguments = EvalConstructor.extractArguments(initializer, constructor); return new EvalConstructor(getType(), constructor, arguments, declarator); } else if(initializer instanceof IASTEqualsInitializer) { IASTEqualsInitializer equalsInitializer = (IASTEqualsInitializer)initializer; ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)equalsInitializer.getInitializerClause(); return evalOwner.getEvaluation(); } else if(initializer instanceof ICPPASTInitializerList) { ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)initializer; return evalOwner.getEvaluation(); } else if(initializer instanceof ICPPASTConstructorInitializer) { ICPPASTConstructorInitializer ctorInitializer = (ICPPASTConstructorInitializer)initializer; ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)ctorInitializer.getArguments()[0]; return evalOwner.getEvaluation(); } else if(initializer == null) { return null; } } return EvalFixed.INCOMPLETE; }

Target:
public ICPPEvaluation getInitializerEvaluation() { ICPPASTDeclarator declarator = (ICPPASTDeclarator)findDeclarator(); if(declarator != null) { IASTInitializer initializer = declarator.getInitializer(); ICPPConstructor constructor = getImplicitlyCalledCtor(declarator); if(constructor != null) { ICPPEvaluation[] arguments = EvalConstructor.extractArguments(initializer, constructor); return new EvalConstructor(getType(), constructor, arguments, declarator); } else if(initializer instanceof IASTEqualsInitializer) { IASTEqualsInitializer equalsInitializer = (IASTEqualsInitializer)initializer; ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)equalsInitializer.getInitializerClause(); return evalOwner.getEvaluation(); } else if(initializer instanceof ICPPASTInitializerList) { ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)initializer; return evalOwner.getEvaluation(); } else if(initializer instanceof ICPPASTConstructorInitializer) { ICPPASTConstructorInitializer ctorInitializer = (ICPPASTConstructorInitializer)initializer; ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)ctorInitializer.getArguments()[0]; return evalOwner.getEvaluation(); } else if(initializer == null) { return null; } } return EvalFixed.INCOMPLETE; }
Source:
public synchronized void removeProgressListener(ProgressListener listener) { if (listener == null) { return; } Long token = progressListenerToOsTokenMap.remove(listener); if (token != null) { Iterator<Map.Entry<Long, ProgressListener>> it = listenerIdToProgressListenerMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Long, ProgressListener> entry = it.next(); if (entry.getValue().equals(listener)) { it.remove(); break; } } nativeRemoveProgressListener(configuration.getPath(), token); } }

Target:
public synchronized void removeProgressListener(ProgressListener listener) { if (listener == null) { return; } Long token = progressListenerToOsTokenMap.remove(listener); if (token != null) { Iterator<Map.Entry<Long, Pair<ProgressListener, Progress>>> it = listenerIdToProgressListenerMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Long, Pair<ProgressListener, Progress>> entry = it.next(); if (entry.getValue().first.equals(listener)) { it.remove(); break; } } nativeRemoveProgressListener(configuration.getPath(), token); } }
Source:
public void setNumMultiPointRadiusVertices(int numMultiPointRadiusVertices) { this.numMultiPointRadiusVertices = numMultiPointRadiusVertices; }

Target:
public void setNumMultiPointRadiusVertices(int numMultiPointRadiusVertices) { if (numMultiPointRadiusVertices < MIN_NUM_POINT_RADIUS_VERTICES) { this.numMultiPointRadiusVertices = MIN_NUM_POINT_RADIUS_VERTICES; LOGGER.debug( "Admin supplied max number of vertices is too low. Defaulting to the minimum number of vertices", MIN_NUM_POINT_RADIUS_VERTICES); } else if (numMultiPointRadiusVertices > 32) { this.numMultiPointRadiusVertices = MAX_NUM_POINT_RADIUS_VERTICES; LOGGER.debug( "Admin supplied max number of vertices is too high. Defaulting to the maximum number of vertices", MAX_NUM_POINT_RADIUS_VERTICES); } else { this.numMultiPointRadiusVertices = numMultiPointRadiusVertices; } }
Source:
@Override public Subscriber<Integer> createSubscriber() { return new SyncTriggeredDemandSubscriber<Integer>() { private long acc; @Override protected long foreach(final Integer element) { acc += element; return 1; } @Override public void onComplete() { System.out.println("Accumulated: " + acc); } }; }

Target:
@Override public Subscriber<Integer> createSubscriber() { return new SyncTriggeredDemandSubscriber<Integer>() { private long acc; @Override protected long foreach(final Integer element) { acc += element; return 1; } @Override public void onComplete() { } }; }
Source:
public MePage go() { while (!isElementDisplayed(appSettings)) { clickOn(R.id.nav_sites); clickOn(onView(allOf(withId(R.id.me_item), withEffectiveVisibility(Visibility.VISIBLE)))); } if (!isSelfHosted()) { displayName.check(matches(isDisplayed())); } return this; }

Target:
public MePage go() { while (!isElementDisplayed(appSettings)) { clickOn(R.id.nav_sites); clickOn(R.id.me_item); } if (!isSelfHosted()) { displayName.check(matches(isDisplayed())); } return this; }
Source:
public HashMap<ItemIdentifier, Integer> getItemsAndCount() { HashMap<ItemIdentifier, Integer> result = new HashMap<ItemIdentifier, Integer>(); for(int i=0; i < _drawer.getDrawerCount(); i++) { if (!_drawer.isDrawerEnabled(i)) continue; IDrawer drawer = _drawer.getDrawer(i); if(drawer != null && !drawer.isEmpty()) { int count = drawer.getStoredItemCount(); ItemIdentifier ident = ItemIdentifier.get(drawer.getStoredItemCopy()); if(result.containsKey(ident)) { result.put(ident, result.get(ident) + count); } else { result.put(ident, count); } } } return result; }

Target:
public HashMap<ItemIdentifier, Integer> getItemsAndCount() { HashMap<ItemIdentifier, Integer> result = new HashMap<ItemIdentifier, Integer>(); for(int i=0; i < _drawer.getDrawerCount(); i++) { if (!_drawer.isDrawerEnabled(i)) continue; IDrawer drawer = _drawer.getDrawer(i); if(drawer != null && !drawer.isEmpty()) { int count = drawer.getStoredItemCount(); if (count > 0) { ItemIdentifier ident = ItemIdentifier.get(drawer.getStoredItemPrototype()); if (result.containsKey(ident)) { result.put(ident, result.get(ident) + count); } else { result.put(ident, count); } } } } return result; }
Source:
public Dataset<Row> apply(Dataset<Row> df) { df = mergeAlgorithms(df); return filterToBestSuggestions(df); }

Target:
public Dataset<Row> apply(Dataset<Row> df) { df = mergeAlgorithms(df); df = filterToBestSuggestions(df); return df.select("wikiid", "query", "dym"); }
Source:
private String[] updateTagsWithEntityID(String[] tags, String entityID) { if (entityID == null) { entityID = System.getenv(DD_ENTITY_ID_ENV_VAR); } if (entityID != null) { final String entityTag = new StringBuilder(ENTITY_ID_TAG_NAME).append(":").append(entityID).toString(); if (tags == null) { tags = new String[]{entityTag}; } else { tags = Arrays.copyOf(tags, tags.length+1); tags[tags.length] = entityTag; } } return tags; }

Target:
private String[] updateTagsWithEntityID(String[] tags, String entityID) { if(entityID == null || entityID.trim().isEmpty()) { entityID = System.getenv(DD_ENTITY_ID_ENV_VAR); } if(entityID != null && !entityID.trim().isEmpty()) { final String entityTag = new StringBuilder(ENTITY_ID_TAG_NAME).append(":").append(entityID).toString(); if (tags == null) { tags = new String[]{entityTag}; } else { tags = Arrays.copyOf(tags, tags.length+1); tags[tags.length] = entityTag; } } return tags; }