auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private int indexWarcRecord(WarcRecord warcRecord) throws IOException { if (!RESPONSE.equals(warcRecord.type())) return 0; String id = warcRecord.id(); org.jsoup.nodes.Document jDoc; try { jDoc = Jsoup.parse(warcRecord.content()); } catch (java.lang.IllegalArgumentException iae) { LOG.error("Parsing document with JSoup failed, skipping document : " + id, iae); System.err.println(id); return 1; } String contents = jDoc.text(); if (contents.trim().length() == 0) { System.err.println(id); return 1; } Document document = new Document(); document.add(new StringField(FIELD_ID, id, Field.Store.YES)); FieldType fieldType = new FieldType(); fieldType.setStored(true); fieldType.setStoreTermVectors(true); if (positions) { fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS); fieldType.setStoreTermVectorPositions(true); document.add(new Field(FIELD_BODY, contents, fieldType)); } else { fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS); document.add(new Field(FIELD_BODY, contents, fieldType)); } writer.addDocument(document); return 1; }

Target:
private int indexWarcRecord(WarcRecord warcRecord) throws IOException { if (!RESPONSE.equals(warcRecord.type())) return 0; String id = warcRecord.id(); org.jsoup.nodes.Document jDoc; try { jDoc = Jsoup.parse(warcRecord.content()); } catch (java.lang.IllegalArgumentException iae) { LOG.error("Parsing document with JSoup failed, skipping document : " + id, iae); System.err.println(id); return 1; } String contents = jDoc.text(); if (contents.trim().length() == 0) { System.err.println(id); return 1; } Document document = new Document(); document.add(new StringField(FIELD_ID, id, Field.Store.YES)); FieldType fieldType = new FieldType(); if (positions) { if (docVectors) { fieldType.setStoreTermVectors(true); fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS); fieldType.setStoreTermVectorPositions(true); document.add(new Field(FIELD_BODY, contents, fieldType)); } else { document.add(new TextField(FIELD_BODY, contents, Field.Store.NO)); } } else { if (docVectors) { fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS); document.add(new Field(FIELD_BODY, contents, fieldType)); } else { document.add(new NoPositionsTextField(FIELD_BODY, contents)); } } writer.addDocument(document); return 1; }
Source:
private void addPluginActionButtons(List<ActionButtonDefinition<?>> pluginActionButtonList) { if (getActionPanelPresenterWidget() != null) { for(ActionButtonDefinition<?> buttonDef: pluginActionButtonList) { int order = 0; if (buttonDef.getPriority() > 0) { order = (int) buttonDef.getPriority(); } getActionPanelPresenterWidget().addActionButton((ActionButtonDefinition) buttonDef, order); } } }

Target:
private void addPluginActionButtons(List<ActionButtonDefinition<?>> pluginActionButtonList) { if (getActionPanelPresenterWidget() != null) { for(ActionButtonDefinition<?> buttonDef: pluginActionButtonList) { if (buttonDef.getPriority() < 0) { buttonDef.setPriority(0); } getActionPanelPresenterWidget().addActionButton((ActionButtonDefinition) buttonDef); } } }
Source:
public MachineSet all(Function<MachineSet, MachineSet> ...ops) { return compose(ops).apply(getAllMachines()); }

Target:
public MachineSet all(Function<MachineSet, MachineSet> ...ops) { return compose(ops).apply(all()); }
Source:
public IntegerCopyNumberTransitionMatrixCollection() { sexGenotypeAndContigToTransitionMatrixMap = new HashMap<>(); maxCopyNumberInCollection = -1; }

Target:
public IntegerCopyNumberTransitionMatrixCollection() { sexGenotypeAndContigToTransitionMatrixMap = new HashMap<>(); maxCopyNumberInCollection = MAX_COPY_NUMBER_IN_EMPTY_COLLECTION; }
Source:
public void dcConfigChangePropagated() throws Exception { domainConfig.getSlaveConfiguration().setCachedDC(true); domainManager = DomainTestSupport.create(domainConfig); domainManager.start(); domainManager.getDomainSlaveLifecycleUtil().awaitHostController(System.currentTimeMillis()); domainManager.getDomainMasterLifecycleUtil() .executeForResult(getCreateOperationTestLoggingCategory()); domainManager.stop(); domainManager.getDomainSlaveLifecycleUtil().startAsync(); try (DomainClient client = getDomainClient(domainConfig.getSlaveConfiguration())) { waitForHostControllerBeingStarted(TIMEOUT_S, client); waitForServersBeingStarted(TIMEOUT_S, client); checkTestLoggerFromSlaveHost(client); } }

Target:
public void dcConfigChangePropagated() throws Exception { domainConfig.getSlaveConfiguration().setCachedDC(true); domainManager = DomainTestSupport.create(domainConfig); domainManager.start(); domainManager.getDomainMasterLifecycleUtil() .executeForResult(getCreateOperationTestLoggingCategory()); domainManager.stop(); domainManager.getDomainSlaveLifecycleUtil().startAsync(); try (DomainClient client = getDomainClient(domainConfig.getSlaveConfiguration())) { waitForHostControllerBeingStarted(TIMEOUT_S, client); waitForServersBeingStarted(TIMEOUT_S, client); checkTestLoggerFromSlaveHost(client); } }
Source:
public DefaultTokenCacheStore(Context context) throws NoSuchAlgorithmException, NoSuchPaddingException { mContext = context; if (context != null) { mPrefs = mContext.getSharedPreferences(SHARED_PREFERENCE_NAME, Activity.MODE_PRIVATE); } else { throw new IllegalArgumentException("Context is null"); } if (sHelper == null) { Logger.v(TAG, "Started to initialize storage helper"); sHelper = new StorageHelper(context); Logger.v(TAG, "Finished to initialize storage helper"); } }

Target:
public DefaultTokenCacheStore(Context context) throws NoSuchAlgorithmException, NoSuchPaddingException { mContext = context; if (context != null) { mPrefs = mContext.getSharedPreferences(SHARED_PREFERENCE_NAME, Activity.MODE_PRIVATE); } else { throw new IllegalArgumentException("Context is null"); } synchronized (sLock) { if (sHelper == null) { Logger.v(TAG, "Started to initialize storage helper"); sHelper = new StorageHelper(context); Logger.v(TAG, "Finished to initialize storage helper"); } } }
Source:
public boolean isFeaturedVideo() { return featuredVideo.isDisplayed(); }

Target:
public boolean isFeaturedVideo() { wait.forElementVisible(featuredVideo); return featuredVideo.isDisplayed(); }
Source:
public void testDeltaWarning() { int distance = 1000000; ghStorage.edge(1, 2, distance, false); ghStorage.edge(2, 3, distance, false); ghStorage.edge(3, 4, distance, false); ghStorage.edge(4, 5, distance, false); ghStorage.edge(5, 6, distance, false); ghStorage.edge(6, 1, distance, false); ghStorage.edge(1, 7, distance, true); ghStorage.edge(7, 8, distance, true); ghStorage.edge(8, 9, distance, true); ghStorage.edge(6, 10, distance, true); ghStorage.edge(10, 11, distance, true); ghStorage.edge(11, 12, distance, true); LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), new FastestWeighting(encoder), 2); storage.createLandmarks(); }

Target:
public void testDeltaWarning() { int distance = 1000000; ghStorage.edge(1, 2, distance, false); ghStorage.edge(2, 3, distance, false); ghStorage.edge(3, 4, distance, false); ghStorage.edge(4, 5, distance, false); ghStorage.edge(5, 6, distance, false); ghStorage.edge(6, 1, distance, false); ghStorage.edge(1, 7, distance, true); ghStorage.edge(7, 8, distance, true); ghStorage.edge(8, 9, distance, true); ghStorage.edge(6, 10, distance, true); ghStorage.edge(10, 11, distance, true); ghStorage.edge(11, 12, distance, true); LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), new FastestWeighting(encoder), 2); storage.createLandmarks(); assertEquals(12, storage.getLandmarks(1)[0]); assertEquals(9, storage.getLandmarks(1)[1]); assertEquals((int) Math.pow(2, 13) - 2, storage.getToWeight(0, 9) - storage.getFromWeight(0, 9)); assertEquals((int) -Math.pow(2, 13), storage.getToWeight(1, 12) - storage.getFromWeight(1, 12)); }
Source:
void assertLockStream(BiConsumer<Cache<Object, Object>, CacheEntry<Object, Object>> consumer) throws Throwable { for (int i = 0; i < 10; i++) { cache.put(i, "value" + i); } CyclicBarrier barrier = new CyclicBarrier(2); int key = 4; LockedStream<Object, Object> stream = cache.getAdvancedCache().lockedStream(); Future<?> forEachFuture = fork(() -> stream.forEach((c, e) -> { if (e.getKey().equals(key)) { try { barrier.await(10, TimeUnit.SECONDS); consumer.accept(c, e); barrier.await(10, TimeUnit.SECONDS); } catch (InterruptedException | BrokenBarrierException | TimeoutException e1) { throw new RuntimeException(e1); } } })); barrier.await(10, TimeUnit.SECONDS); Future<Object> putFuture = fork(() -> cache.put(key, "value" + key + "-new")); Exceptions.expectException(TimeoutException.class, () -> putFuture.get(50, TimeUnit.MILLISECONDS)); barrier.await(10, TimeUnit.SECONDS); forEachFuture.get(10, TimeUnit.SECONDS); assertEquals("value" + key + "-other", putFuture.get(10, TimeUnit.SECONDS)); assertEquals("value" + key + "-new", cache.get(key)); LockManager lockManager = TestingUtil.extractComponent(cache, LockManager.class); assertEquals(0, lockManager.getNumberOfLocksHeld()); }

Target:
void assertLockStream(BiConsumer<Cache<Object, Object>, CacheEntry<Object, Object>> consumer) throws Throwable { for (int i = 0; i < 10; i++) { cache.put(i, "value" + i); } CyclicBarrier barrier = new CyclicBarrier(2); int key = 4; LockedStream<Object, Object> stream = cache.getAdvancedCache().lockedStream(); Future<?> forEachFuture = fork(() -> stream.forEach((c, e) -> { Object innerKey = e.getKey(); if (innerKey.equals(key)) { try { barrier.await(10, TimeUnit.SECONDS); consumer.accept(c, e); InfinispanLock lock = TestingUtil.extractComponent(c, LockManager.class).getLock(innerKey); assertNotNull(lock); assertEquals(innerKey, lock.getLockOwner()); barrier.await(10, TimeUnit.SECONDS); } catch (InterruptedException | BrokenBarrierException | TimeoutException e1) { throw new RuntimeException(e1); } } })); barrier.await(10, TimeUnit.SECONDS); Future<Object> putFuture = fork(() -> cache.put(key, "value" + key + "-new")); Exceptions.expectException(TimeoutException.class, () -> putFuture.get(50, TimeUnit.MILLISECONDS)); barrier.await(10, TimeUnit.SECONDS); forEachFuture.get(10, TimeUnit.SECONDS); assertEquals("value" + key + "-other", putFuture.get(10, TimeUnit.SECONDS)); assertEquals("value" + key + "-new", cache.get(key)); LockManager lockManager = TestingUtil.extractComponent(cache, LockManager.class); assertEquals(0, lockManager.getNumberOfLocksHeld()); }
Source:
public SamplesArguments(String[] args) { Options options = new Options(); Option input = new Option("d", DIGITALTWINS_URL, false, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, false, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, false, "AAD Client Id"); Option clientSecret = new Option("s", CLIENT_SECRET, false, "AAD Client Secret"); input.setRequired(true); tenantId.setRequired(true); clientId.setRequired(true); clientSecret.setRequired(true); options.addOption(input); options.addOption(tenantId); options.addOption(clientId); options.addOption(clientSecret); CommandLineParser parser = new DefaultParser(); HelpFormatter formatter = new HelpFormatter(); CommandLine cmd = null; try { cmd = parser.parse(options, args); } catch (ParseException e) { System.out.println(e.getMessage()); formatter.printHelp("java <sampleClass>.jar", options); System.exit(1); } this.digitalTwinUrl = cmd.getOptionValue(DIGITALTWINS_URL); this.tenantId = cmd.getOptionValue(TENANT_ID); this.clientId = cmd.getOptionValue(CLIENT_ID); this.clientSecret = cmd.getOptionValue(CLIENT_SECRET); }

Target:
public SamplesArguments(String[] args) { Option endpoint = new Option("d", DIGITALTWINS_URL, true, "DigitalTwins endpoint URL"); Option tenantId = new Option("t", TENANT_ID, true, "AAD Tenant Id"); Option clientId = new Option("c", CLIENT_ID, true, "AAD Client Id"); Option clientSecret = new Option("s", CLIENT_SECRET, true, "AAD Client Secret"); Option logLevel = new Option("l", LOG_DETAIL_LEVEL, true, "Http logging detail level \n 0 -> NONE \n 1 -> BASIC \n 2 -> HEADERS \n 3 -> BODY \n 4 -> BODY_AND_HEADERS"); endpoint.setRequired(true); tenantId.setRequired(true); clientId.setRequired(true); clientSecret.setRequired(true); logLevel.setRequired(false); Options options = new Options() .addOption(endpoint) .addOption(tenantId) .addOption(clientId) .addOption(clientSecret) .addOption(logLevel); CommandLineParser parser = new DefaultParser(); HelpFormatter formatter = new HelpFormatter(); CommandLine cmd = null; try { cmd = parser.parse(options, args); } catch (ParseException e) { System.out.println(e.getMessage()); formatter.printHelp("java <sampleClass>.jar", options); System.exit(1); } this.digitalTwinEndpoint = cmd.getOptionValue(DIGITALTWINS_URL); this.tenantId = cmd.getOptionValue(TENANT_ID); this.clientId = cmd.getOptionValue(CLIENT_ID); this.clientSecret = cmd.getOptionValue(CLIENT_SECRET); String inputLogLevel = cmd.getOptionValue(LOG_DETAIL_LEVEL); if (inputLogLevel != null && inputLogLevel.trim().length() > 0) { try { int providedLogDetailLevel = Integer.parseInt(inputLogLevel); this.httpLogDetailLevel = convertFromInt(providedLogDetailLevel); } catch (NumberFormatException e) { System.out.println("Provided log detail level must be an integer ranging from 0 - 4"); formatter.printHelp("java <sampleClass>.jar", options); System.exit(1); } } }
Source:
public DatanodeInfo[] getCachedDatanodeReport(DatanodeReportType type) throws IOException { try { DatanodeInfo[] dns = this.dnCache.get(type); if (dns == null) { LOG.debug("Get null DN report from cache"); dns = getCachedDatanodeReportImpl(type); this.dnCache.put(type, dns); } return dns; } catch (ExecutionException e) { LOG.error("Cannot get the DN report for {}", type, e); Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } else { throw new IOException(cause); } } }

Target:
DatanodeInfo[] getCachedDatanodeReport(DatanodeReportType type) throws IOException { try { DatanodeInfo[] dns = this.dnCache.get(type); if (dns == null) { LOG.debug("Get null DN report from cache"); dns = getCachedDatanodeReportImpl(type); this.dnCache.put(type, dns); } return dns; } catch (ExecutionException e) { LOG.error("Cannot get the DN report for {}", type, e); Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } else { throw new IOException(cause); } } }
Source:
public static double getLivingVisibility(LivingEntity living, @Nullable Entity lookingEntity, double visibility) { LivingVisibilityEvent event = new LivingVisibilityEvent(living, lookingEntity, visibility); MinecraftForge.EVENT_BUS.post(event); double value = event.getVisibility(); if(living instanceof PlayerEntity) { value = getPlayerVisibilityDistance((PlayerEntity)living, value, visibility); } return value; }

Target:
public static double getLivingVisibility(LivingEntity living, @Nullable Entity lookingEntity, double visibility) { double value = visibility; if(living instanceof PlayerEntity) { value = getPlayerVisibilityDistance((PlayerEntity)living, visibility, visibility); } LivingVisibilityEvent event = new LivingVisibilityEvent(living, lookingEntity, value); MinecraftForge.EVENT_BUS.post(event); return event.getVisibility(); }
Source:
public void checkMainFeaturesPhpLS() { consoles.waitExpectedTextIntoConsole( "Initialized language server 'org.eclipse.che.plugin.php.languageserver"); checkCodeValidation(); checkAutocompletion(); checkCodeAssistant(); checkGoToDefinition(); }

Target:
public void checkMainFeaturesPhpLS() { consoles.waitExpectedTextIntoConsole(INITIALIZE_LANG_SERVER_MESSAGE); checkCodeValidation(); checkAutocompletion(); checkCodeAssistant(); checkGoToDefinition(); }
Source:
public Option<T> filter(Predicate<? super T> predicate) { T v = get(); return Option.when(predicate.test(v), () -> v); }

Target:
public Option<T> filter(Predicate<? super T> predicate) { T v = get(); return predicate.test(v) ? Option.some(v) : Option.none(); }
Source:
public HashCode buildHashCode() { final List<HashCode> hashes = Lists.newArrayListWithCapacity(3); hashes.add(super.buildHashCode()); Hasher hasher = Const.HASH_FUNCTION().newHasher(); hasher.putBoolean(counter) .putBoolean(drop_resets) .putBoolean(delta_only) .putLong(counter_max) .putLong(reset_value) .putString(interval, Const.UTF8_CHARSET); if (id !=null) { hasher.putString(id, Const.UTF8_CHARSET); } hashes.add(hasher.hash()); return Hashing.combineOrdered(hashes); }

Target:
public HashCode buildHashCode() { final List<HashCode> hashes = Lists.newArrayListWithCapacity(3); hashes.add(super.buildHashCode()); Hasher hasher = Const.HASH_FUNCTION().newHasher(); hasher.putBoolean(counter) .putBoolean(drop_resets) .putBoolean(delta_only) .putLong(counter_max) .putLong(reset_value) .putString(interval, Const.UTF8_CHARSET) .putBoolean(rate_to_count); if (id !=null) { hasher.putString(id, Const.UTF8_CHARSET); } hashes.add(hasher.hash()); return Hashing.combineOrdered(hashes); }
Source:
public void run() { IJobManager manager = Job.getJobManager(); try { manager.beginRule(rule, getEventLoopMonitor()); context.run(false, false, runnable); } catch (InvocationTargetException | InterruptedException e) { status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage(), e); } catch (OperationCanceledException e) { status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage(), e); } finally { manager.endRule(rule); } }

Target:
public void run() { IJobManager manager = Job.getJobManager(); try { manager.beginRule(rule, getEventLoopMonitor()); context.run(false, false, runnable); } catch (InvocationTargetException | InterruptedException | OperationCanceledException e) { status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage(), e); } finally { manager.endRule(rule); } }
Source:
public final static void writeInt(BytesRef dst, int i) { dst.bytes[dst.offset++] = ((byte) (i >> 24)); dst.bytes[dst.offset++] = ((byte) (i >> 16)); dst.bytes[dst.offset++] = ((byte) (i >> 8)); dst.bytes[dst.offset++] = ((byte) i); }

Target:
public final static void writeInt(BytesRef dst, int i) { dst.bytes[dst.offset] = ((byte) (i >> 24)); dst.bytes[dst.offset + 1] = ((byte) (i >> 16)); dst.bytes[dst.offset + 2] = ((byte) (i >> 8)); dst.bytes[dst.offset + 3] = ((byte) i); dst.offset += 4; }
Source:
public VertxOptions setFileResolverCachingEnabled(boolean fileResolverCachingEnabled) { this.fileSystemOptions.setFileResolverCachingEnabled(fileResolverCachingEnabled); return this; }

Target:
public VertxOptions setFileResolverCachingEnabled(boolean fileResolverCachingEnabled) { if (fileSystemOptions == null) { fileSystemOptions = new FileSystemOptions(); } this.fileSystemOptions.setFileResolverCachingEnabled(fileResolverCachingEnabled); return this; }
Source:
public Configuration toConfiguration(final CommandLine commandLine) { final Configuration resultConfiguration = new Configuration(); if (configuration.getOptional(DeploymentOptions.TARGET).isPresent()) { resultConfiguration.set( DeploymentOptions.TARGET, configuration.get(DeploymentOptions.TARGET)); } final String executorName = commandLine.getOptionValue(executorOption.getOpt()); if (executorName != null) { resultConfiguration.setString(DeploymentOptions.TARGET, executorName); } final String targetName = commandLine.getOptionValue(targetOption.getOpt()); if (targetName != null) { resultConfiguration.setString(DeploymentOptions.TARGET, targetName); } DynamicPropertiesUtil.encodeDynamicProperties(commandLine, resultConfiguration); resultConfiguration.set(DeploymentOptionsInternal.CONF_DIR, configurationDir); return resultConfiguration; }

Target:
public Configuration toConfiguration(final CommandLine commandLine) { final Configuration resultConfiguration = new Configuration(); final String executorName = commandLine.getOptionValue(executorOption.getOpt()); if (executorName != null) { resultConfiguration.setString(DeploymentOptions.TARGET, executorName); } final String targetName = commandLine.getOptionValue(targetOption.getOpt()); if (targetName != null) { resultConfiguration.setString(DeploymentOptions.TARGET, targetName); } DynamicPropertiesUtil.encodeDynamicProperties(commandLine, resultConfiguration); resultConfiguration.set(DeploymentOptionsInternal.CONF_DIR, configurationDir); return resultConfiguration; }
Source:
public Transaction process(Transaction transaction) throws IOException, JSONException { LOGGER.info("Attempting to process user with id={}", transaction.getUserId()); System.out.println("Attempting to process user with id=" + transaction.getUserId()); HttpResponse response = fetchMoreUserDetails(transaction.getUserId()); String result = EntityUtils.toString(response.getEntity()); JSONObject userObject = new JSONObject(result); transaction.setAge(Integer.parseInt(userObject.getString("age"))); transaction.setPostCode(userObject.getString("postCode")); return transaction; }

Target:
public Transaction process(Transaction transaction) throws IOException, JSONException { LOGGER.info("Attempting to process user with id={}", transaction.getUserId()); HttpResponse response = fetchMoreUserDetails(transaction.getUserId()); String result = EntityUtils.toString(response.getEntity()); JSONObject userObject = new JSONObject(result); transaction.setAge(Integer.parseInt(userObject.getString("age"))); transaction.setPostCode(userObject.getString("postCode")); return transaction; }
Source:
public void print(TaskListener listener) { listener.getLogger().println(Messages.Cause_UserIdCause_ShortDescription( ModelHyperlinkNote.encodeTo(User.getOrCreateByIdOrFullName(getUserIdOrUnknown())))); }

Target:
public void print(TaskListener listener) { User user = getUserId() == null ? null : User.getById(getUserId(), false); if (user != null) { listener.getLogger().println(Messages.Cause_UserIdCause_ShortDescription( ModelHyperlinkNote.encodeTo(user))); } else { listener.getLogger().println(Messages.Cause_UserIdCause_ShortDescription( "unknown or anonymous")); } }
Source:
public synchronized void releaseEditor() { if (!locked) { throw new IllegalStateException("Editor not locked!"); } List<Action> singletonList = new ArrayList<>(); singletonList.add((support) -> releaseInternal()); executeAsync(singletonList); }

Target:
public synchronized void releaseEditor() { if (!locked) { throw new IllegalStateException("Editor not locked!"); } List<Action> singletonList = new ArrayList<>(); singletonList.add((support) -> releaseEditorInternal()); executeAsync(singletonList); }
Source:
public void clearCooldown() { SplitFileInserterSender s; synchronized(this) { s = sender; } if(s != null) s.clearWakeupTime(context); else Logger.error(this, "Sender is null in clearCooldown()!", new Exception()); }

Target:
public void clearCooldown() { sender.clearWakeupTime(context); }
Source:
protected void init() { smtpFromAddress = computeFrom(); if (changeMessage != null && changeMessage.getWrittenOn() != null) { setHeader("Date", new Date(changeMessage.getWrittenOn().getTime())); } else { setHeader("Date", new Date()); } headers.put("From", new EmailHeader.AddressList(smtpFromAddress)); headers.put(HDR_TO, new EmailHeader.AddressList()); headers.put(HDR_CC, new EmailHeader.AddressList()); if (change != null) { setChangeSubjectHeader(); } setHeader("Message-ID", ""); setHeader("MIME-Version", "1.0"); setHeader("Content-Type", "text/plain; charset=UTF-8"); setHeader("Content-Disposition", "inline"); setHeader("User-Agent", "Gerrit/" + Version.getVersion()); setHeader("X-Gerrit-MessageType", messageClass); if (change != null) { setHeader("X-Gerrit-ChangeId", "" + change.getChangeId()); setListIdHeader(); setChangeUrlHeader(); setCommitIdHeader(); } body = new StringBuilder(); inFooter = false; if (change != null && db != null) { if (patchSet == null) { try { patchSet = db.patchSets().get(change.currentPatchSetId()); } catch (OrmException err) { patchSet = null; } } if (patchSet != null && patchSetInfo == null) { try { patchSetInfo = PatchSetInfoFactory.patchSetInfoFromPatchSetId(patchSet.getId()); } catch (PatchSetInfoNotAvailableException err) { patchSetInfo = null; } } } }

Target:
protected void init() { smtpFromAddress = computeFrom(); if (changeMessage != null && changeMessage.getWrittenOn() != null) { setHeader("Date", new Date(changeMessage.getWrittenOn().getTime())); } else { setHeader("Date", new Date()); } headers.put("From", new EmailHeader.AddressList(smtpFromAddress)); headers.put(HDR_TO, new EmailHeader.AddressList()); headers.put(HDR_CC, new EmailHeader.AddressList()); if (change != null) { setChangeSubjectHeader(); } setHeader("Message-ID", ""); setHeader("X-Gerrit-MessageType", messageClass); if (change != null) { setHeader("X-Gerrit-ChangeId", "" + change.getChangeId()); setListIdHeader(); setChangeUrlHeader(); setCommitIdHeader(); } body = new StringBuilder(); inFooter = false; if (change != null && db != null) { if (patchSet == null) { try { patchSet = db.patchSets().get(change.currentPatchSetId()); } catch (OrmException err) { patchSet = null; } } if (patchSet != null && patchSetInfo == null) { try { patchSetInfo = patchSetInfoFactory.get(patchSet.getId()); } catch (PatchSetInfoNotAvailableException err) { patchSetInfo = null; } } } }
Source:
private static void copyAssetFileIfNeeded(RealmConfiguration configuration) { if (configuration.hasAssetFile()) { File realmFile = new File(configuration.getRealmFolder(), configuration.getRealmFileName()); InputStream inputStream = null; FileOutputStream outputStream = null; try { inputStream = configuration.getAssetFile(); if (inputStream == null) { throw new RealmIOException("Invalid input stream to asset file."); } outputStream = new FileOutputStream(realmFile); byte[] buf = new byte[4096]; int bytesRead; while ((bytesRead = inputStream.read(buf)) > -1) { outputStream.write(buf, 0, bytesRead); } } catch (IOException e) { throw new RealmIOException("Could not resolve the path to the Realm asset file.", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } } } }

Target:
private static void copyAssetFileIfNeeded(RealmConfiguration configuration) { if (configuration.hasAssetFile()) { File realmFile = new File(configuration.getRealmFolder(), configuration.getRealmFileName()); if (realmFile.exists()) { return; } InputStream inputStream = null; FileOutputStream outputStream = null; try { inputStream = configuration.getAssetFile(); if (inputStream == null) { throw new RealmIOException("Invalid input stream to asset file."); } outputStream = new FileOutputStream(realmFile); byte[] buf = new byte[4096]; int bytesRead; while ((bytesRead = inputStream.read(buf)) > -1) { outputStream.write(buf, 0, bytesRead); } } catch (IOException e) { throw new RealmIOException("Could not resolve the path to the Realm asset file.", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { throw new RealmIOException("Invalid output stream to " + realmFile.getPath(), e); } } } } }
Source:
public void run() { Object operationResult = null; Exception exception = null; try { switch (opType) { case GetBlob: BlobOutput blobOutput = coordinator.getBlob(blobId); operationResult = new DataStreamChannel(blobOutput.getStream(), blobOutput.getSize()); break; case GetBlobInfo: blobProperties = coordinator.getBlobProperties(blobId); ByteBuffer usermetadataBuffer = coordinator.getBlobUserMetadata(blobId); if (usermetadataBuffer.hasArray()) { usermetadata = usermetadataBuffer.array(); } else { usermetadata = new byte[usermetadataBuffer.capacity()]; usermetadataBuffer.get(usermetadata); } operationResult = new BlobInfo(blobProperties, usermetadata); break; case PutBlob: operationResult = coordinator .putBlob(blobProperties, ByteBuffer.wrap(usermetadata), new ReadableStreamChannelInputStream(channel)); break; case DeleteBlob: coordinator.deleteBlob(blobId); break; } } catch (CoordinatorException e) { exception = new RouterException(e, RouterErrorCode.convertCoordinatorErrorToRouterErrorCode(e.getErrorCode())); } catch (Exception e) { exception = new RouterException(e, RouterErrorCode.UnexpectedInternalError); } finally { RuntimeException runtimeException = null; if (exception != null) { runtimeException = new RuntimeException(exception); } futureRouterResult.done(operationResult, runtimeException); if (callback != null) { callback.onCompletion(operationResult, exception); } } }

Target:
public void run() { Object operationResult = null; Exception exception = null; try { switch (opType) { case GetBlob: BlobOutput blobOutput = coordinator.getBlob(blobId); byte[] buf = Utils.readBytesFromStream(blobOutput.getStream(), (int) blobOutput.getSize()); operationResult = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(buf)); break; case GetBlobInfo: blobProperties = coordinator.getBlobProperties(blobId); ByteBuffer usermetadataBuffer = coordinator.getBlobUserMetadata(blobId); if (usermetadataBuffer.hasArray()) { usermetadata = usermetadataBuffer.array(); } else { usermetadata = new byte[usermetadataBuffer.capacity()]; usermetadataBuffer.get(usermetadata); } operationResult = new BlobInfo(blobProperties, usermetadata); break; case PutBlob: operationResult = coordinator .putBlob(blobProperties, ByteBuffer.wrap(usermetadata), new ReadableStreamChannelInputStream(channel)); break; case DeleteBlob: coordinator.deleteBlob(blobId); break; default: throw new IllegalStateException("Unsupported CoordinatorOperationType - " + opType); } } catch (CoordinatorException e) { exception = new RouterException(e, RouterErrorCode.convertCoordinatorErrorToRouterErrorCode(e.getErrorCode())); } catch (Exception e) { exception = new RouterException(e, RouterErrorCode.UnexpectedInternalError); } finally { CoordinatorBackedRouter.completeOperation(futureRouterResult, callback, operationResult, exception); } }
Source:
void handleUncaughtExceptionFromAsyncCall(Throwable t) { final boolean tempClosed = closed; if (closed) { LOG.debug("Caught exception when shutting down the SourceCoordinatorContext.", t); return; } System.out.println(tempClosed); ExceptionUtils.rethrowIfFatalErrorOrOOM(t); LOG.error("Exception while handling result from async call in {}. Triggering job failover.", coordinatorThreadName, t); failJob(t); }

Target:
void handleUncaughtExceptionFromAsyncCall(Throwable t) { if (closed) { LOG.debug("Caught exception when shutting down the SourceCoordinatorContext.", t); return; } ExceptionUtils.rethrowIfFatalErrorOrOOM(t); LOG.error("Exception while handling result from async call in {}. Triggering job failover.", coordinatorThreadName, t); failJob(t); }
Source:
public static boolean hasValidJarContent(File jarFile) { JarInputStream jarInputStream = null; boolean valid = false; try { jarInputStream = new JarInputStream(new FileInputStream(jarFile)); valid = jarInputStream.getNextJarEntry() != null; } catch (IOException ignore) { } finally { try { if (jarInputStream != null) { jarInputStream.close(); } } catch (IOException ignored) { } } return valid; }

Target:
public static boolean hasValidJarContent(File jarFile) { JarInputStream jarInputStream = null; boolean valid = false; try { jarInputStream = new JarInputStream(new FileInputStream(jarFile)); valid = jarInputStream.getNextJarEntry() != null; } catch (IOException ignore) { } finally { if (jarInputStream != null) { try { jarInputStream.close(); } catch (IOException e) { } } } return valid; }
Source:
private String getKeystorePassword(File agentFile) { s_logger.debug("Retrieving keystore password from agent.properties file"); String privatePasswordFormat = "sed -n '/keystore.passphrase/p' '%s' 2>/dev/null | sed 's/keystore.passphrase= String privatePasswordCmd = String.format(privatePasswordFormat, agentFile.getAbsolutePath()); return Script.runSimpleBashScript(privatePasswordCmd); }

Target:
private String getKeystorePassword(File agentFile) { String pass = null; if (agentFile != null) { try { pass = PropertiesUtil.loadFromFile(agentFile).getProperty(KeyStoreUtils.KS_PASSPHRASE_PROPERTY); } catch (IOException e) { s_logger.error("Could not get 'keystore.passphrase' property value due to: " + e.getMessage()); } } return pass; }
Source:
public String toString() { final String headers = this.headers == null ? "null" : this.headers.toString(); final String key = this.key == null ? "null" : this.key.toString(); final String value = this.value == null ? "null" : this.value.toString(); final String recordTime = this.recordTime == null ? "null" : this.recordTime.toString(); return "TestRecord(headers=" + headers + ", key=" + key + ", value=" + value + ", recordTime=" + recordTime + ")"; }

Target:
public String toString() { return new StringJoiner(", ", TestRecord.class.getSimpleName() + "[", "]") .add("key=" + key) .add("value=" + value) .add("headers=" + headers) .add("recordTime=" + recordTime) .toString(); }
Source:
private void unpackMediaIntent(@NonNull Intent intent) { @SuppressWarnings("unchecked") List<MediaModel> mediaList = (List<MediaModel>) intent.getSerializableExtra(KEY_MEDIA_LIST); if (mediaList != null && !mediaList.isEmpty()) { if (!intent.getBooleanExtra(KEY_UPLOAD_MEDIA_FROM_EDITOR, false)) { PostUploadNotifier.cancelFinalNotificationForMedia(this, mSiteStore.getSiteByLocalId( mediaList.get(0).getLocalSiteId())); mMediaBatchUploaded.addAll(mediaList); } registerPostModelsForMedia(mediaList, intent.getBooleanExtra(KEY_SHOULD_RETRY, false)); ArrayList<MediaModel> toBeUploadedMediaList = new ArrayList<>(mediaList); for (MediaModel media : mediaList) { MediaModel localMedia = mMediaStore.getMediaWithLocalId(media.getId()); if (localMedia != null && MediaUploadState.fromString(localMedia.getUploadState()) == MediaUploadState.UPLOADED) { toBeUploadedMediaList.remove(media); continue; } mMediaUploadHandler.upload(media); } if (!toBeUploadedMediaList.isEmpty()) { mPostUploadNotifier.addMediaInfoToForegroundNotification(toBeUploadedMediaList); } } }

Target:
private void unpackMediaIntent(@NonNull Intent intent) { @SuppressWarnings("unchecked") List<MediaModel> mediaList = (List<MediaModel>) intent.getSerializableExtra(KEY_MEDIA_LIST); if (mediaList != null && !mediaList.isEmpty()) { if (!intent.getBooleanExtra(KEY_UPLOAD_MEDIA_FROM_EDITOR, false)) { PostUploadNotifier.cancelFinalNotificationForMedia(this, mSiteStore.getSiteByLocalId( mediaList.get(0).getLocalSiteId())); mMediaBatchUploaded.addAll(mediaList); } registerPostModelsForMedia(mediaList, intent.getBooleanExtra(KEY_SHOULD_RETRY, false)); ArrayList<MediaModel> toBeUploadedMediaList = new ArrayList<>(); for (MediaModel media : mediaList) { MediaModel localMedia = mMediaStore.getMediaWithLocalId(media.getId()); boolean notUploadedYet = localMedia != null && MediaUploadState.fromString(localMedia.getUploadState()) != MediaUploadState.UPLOADED; if (notUploadedYet) { toBeUploadedMediaList.add(localMedia); } } for (MediaModel media : toBeUploadedMediaList) { mMediaUploadHandler.upload(media); } if (!toBeUploadedMediaList.isEmpty()) { mPostUploadNotifier.addMediaInfoToForegroundNotification(toBeUploadedMediaList); } } }
Source:
private Stack<TextLeaf> parse(String text) { while (text.contains("\b")) { text = text.replaceAll("^\b+|[^\b]\b", ""); } int controlStartPosition; int lastControlPosition = 0; int controlEndPosition; while (true) { controlStartPosition = text.indexOf("\033[", lastControlPosition); if (controlStartPosition == -1) { break; } textLeaf.text = text.substring(lastControlPosition, controlStartPosition); if (isResetLineEscape(text, controlStartPosition)) { controlEndPosition = text.indexOf('K', controlStartPosition + 2); int i; while (true) { i = Math.max(textLeaf.text.lastIndexOf("\r"), textLeaf.text.lastIndexOf("\n")); if (i != -1) { break; } if(result.isEmpty()) { break; } textLeaf = result.pop(); } if (textLeaf.text.length() > i && i > 0) { String end = textLeaf.text.substring(i - 1, i + 1); textLeaf.text = textLeaf.text.substring(0, i); if (end.equals("\r\n") || end.equals("\n\r")) { textLeaf.text = textLeaf.text.substring(0, i - 1); } } else { textLeaf.text = ""; } } else { controlEndPosition = text.indexOf('m', controlStartPosition + 2); if (controlEndPosition == -1) { break; } String matchingData = text.substring(controlStartPosition + 2, controlEndPosition); ansiStates = matchingData.split(";"); } if (!textLeaf.text.isEmpty()) { result.add(textLeaf); textLeaf = new TextLeaf(); } textLeaf.addAnsiCodes(ansiStates); lastControlPosition = controlEndPosition + 1; } textLeaf.text = text.substring(lastControlPosition); if (!textLeaf.text.isEmpty() || result.isEmpty()) { result.add(textLeaf); } return result; }

Target:
private Stack<TextLeaf> parse(String text) { while (text.contains("\b")) { text = text.replaceAll("^\b+|[^\b]\b", ""); } int controlStartPosition; int lastControlPosition = 0; int controlEndPosition; while (true) { controlStartPosition = text.indexOf("\033[", lastControlPosition); if (controlStartPosition == -1) { break; } String textBeforeEscape = text.substring(lastControlPosition, controlStartPosition); emitText(textBeforeEscape); if (isResetLineEscape(text, controlStartPosition)) { controlEndPosition = text.indexOf('K', controlStartPosition + 2); removeCurrentLine(); mOptions = new FormattingOptions(); } else { controlEndPosition = text.indexOf('m', controlStartPosition + 2); if (controlEndPosition == -1) { break; } String matchingData = text.substring(controlStartPosition + 2, controlEndPosition); String[] ansiStates = matchingData.split(";"); mOptions = FormattingOptions.fromAnsiCodes(ansiStates); } lastControlPosition = controlEndPosition + 1; } emitText(text.substring(lastControlPosition)); if (mResult.isEmpty()) { mResult.push(new TextLeaf()); } return mResult; }
Source:
AmqpOutboundChannelAdapterSpec(AmqpTemplate amqpTemplate) { super(amqpTemplate, false); }

Target:
protected AmqpOutboundChannelAdapterSpec(AmqpTemplate amqpTemplate) { super(amqpTemplate, false); }
Source:
public void waitUntilDiscussionPageLoaded() { for (int i = 0; i < WAIT_PAGE_LOAD_MAX_RETRY; i++) { if (!isCurrentUrlDiscussion()) { try { Thread.sleep(WAIT_PAGE_LOAD_SLEEP_TIME); } catch (IllegalArgumentException | InterruptedException e) { logger.warn(e); } } else { return; } } }

Target:
public void waitUntilDiscussionPageLoaded() { for (int i = 0; i < WAIT_PAGE_LOAD_MAX_RETRY && !isCurrentUrlDiscussion(); i++) { try { Thread.sleep(WAIT_PAGE_LOAD_SLEEP_TIME); } catch (IllegalArgumentException | InterruptedException e) { logger.warn(e); } } }
Source:
public Project.NameKey getParentName(final Project project) { if (project.getParent() != null) { return project.getParent(); } if (project.getNameKey().equals(allProjectsName)) { return null; } return allProjectsName; }

Target:
private Project.NameKey getParentName(final Project project) { if (project.getParent() != null) { return project.getParent(); } if (project.getNameKey().equals(allProjectsName)) { return null; } return allProjectsName; }
Source:
private static ProxySelector createProxySelector(Optional<ProxyConfiguration> proxyConfig) { if (!proxyConfig.isPresent()) { return ProxySelector.getDefault(); } switch (proxyConfig.get().type()) { case DIRECT: return fixedProxySelectorFor(Proxy.NO_PROXY); case HTTP: HostAndPort hostAndPort = HostAndPort.fromString(proxyConfig.get().hostAndPort() .orElseThrow(() -> new IllegalStateException( "Expected to find proxy hostAndPort configuration for HTTP proxy"))); InetSocketAddress addr = new InetSocketAddress(hostAndPort.getHostText(), hostAndPort.getPort()); return fixedProxySelectorFor(new Proxy(Proxy.Type.HTTP, addr)); default: } throw new IllegalStateException("Failed to create ProxySelector for proxy configuration: " + proxyConfig); }

Target:
private static ProxySelector createProxySelector(Optional<ProxyConfiguration> proxyConfig) { if (!proxyConfig.isPresent()) { return ProxySelector.getDefault(); } switch (proxyConfig.get().type()) { case DIRECT: return fixedProxySelectorFor(Proxy.NO_PROXY); case HTTP: HostAndPort hostAndPort = HostAndPort.fromString(proxyConfig.get().hostAndPort() .orElseThrow(() -> new IllegalArgumentException( "Expected to find proxy hostAndPort configuration for HTTP proxy"))); InetSocketAddress addr = new InetSocketAddress(hostAndPort.getHostText(), hostAndPort.getPort()); return fixedProxySelectorFor(new Proxy(Proxy.Type.HTTP, addr)); default: } throw new IllegalStateException("Failed to create ProxySelector for proxy configuration: " + proxyConfig); }
Source:
public boolean hasTasks() { return !(fForegroundTasks.isEmpty() && fBackgroundTasks.isEmpty()); }

Target:
private boolean hasTasks() { return !(fForegroundTasks.isEmpty() && fBackgroundTasks.isEmpty()); }
Source:
public ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); Assumption.assertNotNull(studentEmail); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId); new GateKeeper().verifyAccessible( instructor, logic.getCourse(courseId), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_NOT_FOUND_FOR_EDIT, StatusMessageColor.DANGER)); isError = true; return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); } boolean hasSection = logic.hasIndicatedSections(courseId); boolean isAnyEmailSentForTheCourse = logic.isAnyEmailSentForTheCourse(courseId); InstructorCourseStudentDetailsEditPageData data = new InstructorCourseStudentDetailsEditPageData(account, student, student.email, hasSection, isAnyEmailSentForTheCourse); statusToAdmin = "instructorCourseStudentEdit Page Load<br>" + "Editing Student <span class=\"bold\">" + studentEmail + "'s</span> details " + "in Course <span class=\"bold\">[" + courseId + "]</span>"; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_STUDENT_EDIT, data); }

Target:
public ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); Assumption.assertNotNull(studentEmail); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId); gateKeeper.verifyAccessible( instructor, logic.getCourse(courseId), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_NOT_FOUND_FOR_EDIT, StatusMessageColor.DANGER)); isError = true; return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); } boolean hasSection = logic.hasIndicatedSections(courseId); boolean isOpenOrPublishedEmailSentForTheCourse = logic.isOpenOrPublishedEmailSentForTheCourse(courseId); InstructorCourseStudentDetailsEditPageData data = new InstructorCourseStudentDetailsEditPageData(account, student, student.email, hasSection, isOpenOrPublishedEmailSentForTheCourse); statusToAdmin = "instructorCourseStudentEdit Page Load<br>" + "Editing Student <span class=\"bold\">" + studentEmail + "'s</span> details " + "in Course <span class=\"bold\">[" + courseId + "]</span>"; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_STUDENT_EDIT, data); }
Source:
private static IStatus createStatusForInternalAutFailure(Throwable e) { return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, IStatus.ERROR, "Internal aut failure. Cause: " + e.getMessage(), e); }

Target:
private static IStatus createStatusForInternalAutFailure(Throwable e) { return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, IProcess.INTERNAL_AUT_FAILURE, "Internal aut failure. Cause: " + e.getMessage(), e); }
Source:
public void refresh() { removeAll(); setEnabled(false); for (OutputDataStream outputDataStream : _componentBuilder.getOutputDataStreams()) { setEnabled(true); List<InputColumn<?>> inputColumns = new ArrayList<>(); for (Column column : outputDataStream.getTable().getColumns()) { MetaModelInputColumn inputColumn = new MetaModelInputColumn(column); inputColumns.add(inputColumn); } final JLabel tableNameLabel = new JLabel(outputDataStream.getName(), ImageManager.get().getImageIcon( IconUtils.OUTPUT_DATA_STREAM_PATH, IconUtils.ICON_SIZE_SMALL), JLabel.LEFT); tableNameLabel.setOpaque(false); tableNameLabel.setFont(WidgetUtils.FONT_HEADER1); tableNameLabel.setBorder(new EmptyBorder(5, 5, 0, 5)); final ColumnListTable columnListTable = new ColumnListTable(inputColumns, _componentBuilder.getAnalysisJobBuilder(), true, false, null); columnListTable.setBorder(new EmptyBorder(0, 5, 5, 5)); add(tableNameLabel); add(columnListTable); } }

Target:
public void refresh() { removeAll(); setEnabled(false); for (OutputDataStream outputDataStream : _componentBuilder.getOutputDataStreams()) { setEnabled(true); final List<InputColumn<?>> inputColumns = new ArrayList<>(); for (Column column : outputDataStream.getTable().getColumns()) { inputColumns.add(new MetaModelInputColumn(column)); } final JLabel tableNameLabel = new JLabel(outputDataStream.getName(), ImageManager.get().getImageIcon( IconUtils.OUTPUT_DATA_STREAM_PATH, IconUtils.ICON_SIZE_SMALL), JLabel.LEFT); tableNameLabel.setOpaque(false); tableNameLabel.setFont(WidgetUtils.FONT_HEADER1); tableNameLabel.setBorder(new EmptyBorder(5, 5, 0, 5)); final ColumnListTable columnListTable = new ColumnListTable(inputColumns, _componentBuilder.getAnalysisJobBuilder(), true, false, null); columnListTable.setBorder(new EmptyBorder(0, 5, 5, 5)); add(tableNameLabel); add(columnListTable); } }
Source:
protected CompletionStage<Collection<KV<K, V>>> handleMessageAsync(KV<K, V> message, MessageCollector collector, TaskCoordinator coordinator) { table.put(message.getKey(), message.getValue()); return CompletableFuture.completedFuture(new ArrayList<KV<K, V>>(Arrays.asList(message))); }

Target:
protected CompletionStage<Collection<KV<K, V>>> handleMessageAsync(KV<K, V> message, MessageCollector collector, TaskCoordinator coordinator) { table.put(message.getKey(), message.getValue()); return CompletableFuture.completedFuture(Collections.singleton(message)); }
Source:
public List<CytoscapeLinkObject> getLinks(List<Link> links){ List<CytoscapeLinkObject> cytoscapeLinkList = new ArrayList<CytoscapeLinkObject>(); for (int i = 0; i < links.size(); i++) { CytoscapeLinkDataObject dataObj = new CytoscapeLinkDataObject(); dataObj.setId(""+i); dataObj.setSource(links.get(i).getSubject().getId()); dataObj.setTarget(links.get(i).getObject().getId()); dataObj.setLabel(links.get(i).getLabel()); dataObj.setSourceReference(links.get(i).getSourceReference()); dataObj.setStatementIds(new ArrayList<String>()); dataObj.getStatementIds().add(links.get(i).getStatementId()) ; CytoscapeLinkObject obj = new CytoscapeLinkObject(); obj.setData(dataObj); cytoscapeLinkList.add(obj); } return cytoscapeLinkList; }

Target:
public List<CytoscapeLinkObject> getLinks(List<Link> links){ List<CytoscapeLinkObject> cytoscapeLinkList = new ArrayList<CytoscapeLinkObject>(); int i = 0; for(Link link : links){ cytoscapeLinkList.add(createCytoscapeLinkObject(link)); cytoscapeLinkList.get(i).getData().setId(""+i); i++; } return cytoscapeLinkList; }
Source:
public void onSubscribe(Subscription s) { this.s = s; s.request(1); }

Target:
public synchronized void onSubscribe(Subscription s) { this.s = s; if (!cancelled) { s.request(1); } else { s.cancel(); } }