auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static boolean format(ServerConfiguration conf, boolean isInteractive, boolean force) { for (File journalDir : conf.getJournalDirs()) { String[] journalDirFiles = journalDir.exists() && journalDir.isDirectory() ? journalDir.list() : null; if (journalDirFiles != null && journalDirFiles.length != 0) { try { boolean confirm = false; if (!isInteractive) { if (force) { confirm = true; } else { confirm = false; } } else { confirm = IOUtils .confirmPrompt("Are you sure to format Bookie data..?"); } if (!confirm) { LOG.error("Bookie format aborted!!"); return false; } } catch (IOException e) { LOG.error("Error during bookie format", e); return false; } } if (!cleanDir(journalDir)) { LOG.error("Formatting journal directory failed"); return false; } File[] ledgerDirs = conf.getLedgerDirs(); for (File dir : ledgerDirs) { if (!cleanDir(dir)) { LOG.error("Formatting ledger directory " + dir + " failed"); return false; } } File[] indexDirs = conf.getIndexDirs(); if (null != indexDirs) { for (File dir : indexDirs) { if (!cleanDir(dir)) { LOG.error("Formatting ledger directory " + dir + " failed"); return false; } } } File metadataDir = new File(conf.getGcEntryLogMetadataCachePath()); if (!cleanDir(metadataDir)) { LOG.error("Formatting ledger metadata directory " + metadataDir + " failed"); return false; } } LOG.info("Bookie format completed successfully"); return true; }

Target:
public static boolean format(ServerConfiguration conf, boolean isInteractive, boolean force) { for (File journalDir : conf.getJournalDirs()) { String[] journalDirFiles = journalDir.exists() && journalDir.isDirectory() ? journalDir.list() : null; if (journalDirFiles != null && journalDirFiles.length != 0) { try { boolean confirm = false; if (!isInteractive) { if (force) { confirm = true; } else { confirm = false; } } else { confirm = IOUtils .confirmPrompt("Are you sure to format Bookie data..?"); } if (!confirm) { LOG.error("Bookie format aborted!!"); return false; } } catch (IOException e) { LOG.error("Error during bookie format", e); return false; } } if (!cleanDir(journalDir)) { LOG.error("Formatting journal directory failed"); return false; } File[] ledgerDirs = conf.getLedgerDirs(); for (File dir : ledgerDirs) { if (!cleanDir(dir)) { LOG.error("Formatting ledger directory " + dir + " failed"); return false; } } File[] indexDirs = conf.getIndexDirs(); if (null != indexDirs) { for (File dir : indexDirs) { if (!cleanDir(dir)) { LOG.error("Formatting ledger directory " + dir + " failed"); return false; } } } File metadataDir = new File(conf.getGcEntryLogMetadataCachePath()); if (!cleanDir(metadataDir)) { LOG.error("Formatting ledger metadata directory failed", metadataDir); return false; } } LOG.info("Bookie format completed successfully"); return true; }
Source:
public void afterPropertiesSet() { if (!applicationContext.isPrototype(prototypeBeanName)) { throw new IncompatibleAggregateException( format("Cannot initialize repository '%s'. " + "The bean with name '%s' does not have the 'prototype' scope.", beanName, prototypeBeanName)); } AggregateModel<T> model; if (applicationContext.getBeanNamesForType(Configuration.class).length > 0) { Configuration configuration = applicationContext.getBean(Configuration.class); model = AnnotatedAggregateMetaModelFactory.inspectAggregate(getAggregateType(), configuration.parameterResolverFactory(), configuration .handlerDefinition(getAggregateType()), subtypes.keySet()); } else { model = AnnotatedAggregateMetaModelFactory.inspectAggregate(getAggregateType(), subtypes.keySet()); } this.delegate = new AbstractAggregateFactory<T>(model) { @Override protected T doCreateAggregate(String aggregateIdentifier, DomainEventMessage firstEvent) { return (T) applicationContext.getBean(prototype(firstEvent.getType())); } private String prototype(String firstEventType) { return aggregateModel.type(firstEventType) .map(subtypes::get) .orElseThrow(() -> new IncompatibleAggregateException(format( "The [%s] aggregate does not exist.", firstEventType))); } @Override protected T postProcessInstance(T aggregate) { applicationContext.getAutowireCapableBeanFactory() .configureBean(aggregate, subtypes.get(aggregate.getClass())); return aggregate; } }; }

Target:
public void afterPropertiesSet() { if (!applicationContext.isPrototype(prototypeBeanName)) { throw new IncompatibleAggregateException( format("Cannot initialize repository '%s'. " + "The bean with name '%s' does not have the 'prototype' scope.", beanName, prototypeBeanName)); } AggregateModel<T> model; if (applicationContext.getBeanNamesForType(Configuration.class).length > 0) { Configuration configuration = applicationContext.getBean(Configuration.class); model = AnnotatedAggregateMetaModelFactory.inspectAggregate(getAggregateType(), configuration.parameterResolverFactory(), configuration .handlerDefinition(getAggregateType()), subtypes.keySet()); } else { model = AnnotatedAggregateMetaModelFactory.inspectAggregate(getAggregateType(), subtypes.keySet()); } this.delegate = new AbstractAggregateFactory<T>(model) { @Override protected T doCreateAggregate(String aggregateIdentifier, DomainEventMessage firstEvent) { return (T) applicationContext.getBean(prototype(firstEvent.getType())); } private String prototype(String aggregateType) { return aggregateModel().type(aggregateType) .map(subtypes::get) .orElse(prototypeBeanName); } @Override protected T postProcessInstance(T aggregate) { applicationContext.getAutowireCapableBeanFactory() .configureBean(aggregate, subtypes.get(aggregate.getClass())); return aggregate; } }; }
Source:
@Override public <T> Supplier<CompletableFuture<T>> execute(RexNode node) { return () -> { final CompletableFuture<T> f = new CompletableFuture<>(); Scalar s = scalar(node, null); final Row r = ctx.rowHandler().factory(typeFactory.getJavaClass(node.getType())).create(); ctx.execute(() -> { try { s.execute(ctx, null, r); f.complete((T)ctx.rowHandler().get(0, r)); } catch (Throwable t) { f.completeExceptionally(t); } }); return f; }; }

Target:
@Override public <T> Supplier<T> execute(RexNode node) { return () -> { Scalar s = scalar(node, null); final Row r = ctx.rowHandler().factory(typeFactory.getJavaClass(node.getType())).create(); s.execute(ctx, null, r); return (T)ctx.rowHandler().get(0, r); }; }
Source:
public JavaLanguageModule() { super(NAME, null, TERSE_NAME, JavaRuleChainVisitor.class, "java"); addVersion("1.3", new JavaLanguageHandler(3), false); addVersion("1.4", new JavaLanguageHandler(4), false); addVersion("1.5", new JavaLanguageHandler(5), false, "5"); addVersion("1.6", new JavaLanguageHandler(6), false, "6"); addVersion("1.7", new JavaLanguageHandler(7), false, "7"); addVersion("1.8", new JavaLanguageHandler(8), false, "8"); addVersion("9", new JavaLanguageHandler(9), false, "1.9"); addVersion("10", new JavaLanguageHandler(10), false, "1.10"); addVersion("11", new JavaLanguageHandler(11), false); addVersion("12", new JavaLanguageHandler(12), false); addVersion("13", new JavaLanguageHandler(13), false); addVersion("13-preview", new JavaLanguageHandler(13, true), false); addVersion("14", new JavaLanguageHandler(14), true); addVersion("14-preview", new JavaLanguageHandler(14, true), false); }

Target:
public JavaLanguageModule() { super(NAME, null, TERSE_NAME, JavaRuleChainVisitor.class, "java"); addVersion("1.3", new JavaLanguageHandler(3)); addVersion("1.4", new JavaLanguageHandler(4)); addVersion("1.5", new JavaLanguageHandler(5), "5"); addVersion("1.6", new JavaLanguageHandler(6), "6"); addVersion("1.7", new JavaLanguageHandler(7), "7"); addVersion("1.8", new JavaLanguageHandler(8), "8"); addVersion("9", new JavaLanguageHandler(9), "1.9"); addVersion("10", new JavaLanguageHandler(10), "1.10"); addVersion("11", new JavaLanguageHandler(11)); addVersion("12", new JavaLanguageHandler(12)); addVersion("13", new JavaLanguageHandler(13)); addVersion("13-preview", new JavaLanguageHandler(13, true)); addDefaultVersion("14", new JavaLanguageHandler(14)); addVersion("14-preview", new JavaLanguageHandler(14, true)); }
Source:
public void testSingleResultQueryWithProjection() throws Exception { begin(); EntityManager em = createEntityManager(); String nativeQuery = "db.WILDE_POEM.find( " + "{ '$and' : [ { 'name' : 'Portia' }, { 'author' : 'Oscar Wilde' } ] }, " + "{ 'name' : 1 }" + " )"; String result = (String) em.createNativeQuery( nativeQuery, "poemAuthorNameMapping" ).getSingleResult(); assertThat( result ).isEqualTo( "Portia" ); commit(); close( em ); }

Target:
public void testSingleResultQueryWithProjection() throws Exception { begin(); EntityManager em = createEntityManager(); String nativeQuery = "db.WILDE_POEM.find( " + "{ '$and' : [ { 'name' : 'Portia' }, { 'author' : 'Oscar Wilde' } ] }, " + "{ 'name' : 1 }" + " )"; String result = (String) em.createNativeQuery( nativeQuery, "poemNameMapping" ).getSingleResult(); assertThat( result ).isEqualTo( "Portia" ); commit(); close( em ); }
Source:
private void toggleMicToolBar() { if ( mMicToolBar == null ) { tempAudioPath = AudioView.generateTempAudioFile(this); mMicToolBar = AudioView.createRecorderInstance(this, R.drawable.av_play, R.drawable.av_pause, R.drawable.av_stop, R.drawable.av_rec, R.drawable.av_rec_stop, tempAudioPath); FrameLayout.LayoutParams lp2 = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mMicToolBar.setLayoutParams(lp2); LinearLayout micToolBarLayer = findViewById(R.id.mic_tool_bar_layer); micToolBarLayer.addView(mMicToolBar); } else { if( mMicToolBar.getVisibility() != View.VISIBLE) { mMicToolBar.setVisibility(View.VISIBLE); } else { mMicToolBar.setVisibility(View.GONE); } } }

Target:
private void toggleMicToolBar() { if (mMicToolBar != null) { if (mMicToolBar.getVisibility() != View.VISIBLE) { mMicToolBar.setVisibility(View.VISIBLE); } else { mMicToolBar.setVisibility(View.GONE); } } else { mTempAudioPath = AudioView.generateTempAudioFile(this); if (mTempAudioPath == null) { return; } mMicToolBar = AudioView.createRecorderInstance(this, R.drawable.av_play, R.drawable.av_pause, R.drawable.av_stop, R.drawable.av_rec, R.drawable.av_rec_stop, mTempAudioPath); if (mMicToolBar == null) { mTempAudioPath = null; return; } FrameLayout.LayoutParams lp2 = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mMicToolBar.setLayoutParams(lp2); LinearLayout micToolBarLayer = findViewById(R.id.mic_tool_bar_layer); micToolBarLayer.addView(mMicToolBar); } }
Source:
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); mBlogId = getArguments().getLong(ARG_BLOG_ID); mPostId = getArguments().getLong(ARG_POST_ID); }

Target:
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mBlogId = getArguments().getLong(ARG_BLOG_ID); mPostId = getArguments().getLong(ARG_POST_ID); }
Source:
private void handleMessage(Message message) { try { messageHandler.handleMessage(message); getSuccessCounter().increment(); } catch (Exception e) { log.error("failed to process message {}", message, e); getErrorCounter(e).increment(); } }

Target:
private void handleMessage(Message message) { Exception caught = null; try { messageHandler.handleMessage(message); getSuccessCounter().increment(); } catch (Exception e) { log.error("failed to process message {}", message, e); getErrorCounter(e).increment(); caught = e; } if (caught == null) { messageAcknowledger.ack(subscriptionInfo, message); } else { messageAcknowledger.nack(subscriptionInfo, message); } }
Source:
public Observable<DynamicRealmObject> from(DynamicRealm realm, final DynamicRealmObject object) { final RealmConfiguration realmConfig = realm.getConfiguration(); return Observable.create(new Observable.OnSubscribe<DynamicRealmObject>() { @Override public void call(final Subscriber<? super DynamicRealmObject> subscriber) { final DynamicRealm observableRealm = DynamicRealm.getInstance(realmConfig); objectRefs.get().acquireReference(object); final RealmChangeListener<DynamicRealmObject> listener = new RealmChangeListener<DynamicRealmObject>() { @Override public void onChange(DynamicRealmObject result) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(object); } } }; RealmObject.addChangeListener(object, listener); subscriber.add(Subscriptions.create(new Action0() { @Override public void call() { RealmObject.removeChangeListener(object, listener); observableRealm.close(); objectRefs.get().releaseReference(object); } })); subscriber.onNext(object); } }); }

Target:
public Observable<DynamicRealmObject> from(DynamicRealm realm, final DynamicRealmObject object) { final RealmConfiguration realmConfig = realm.getConfiguration(); return Observable.create(new Observable.OnSubscribe<DynamicRealmObject>() { @Override public void call(final Subscriber<? super DynamicRealmObject> subscriber) { final DynamicRealm observableRealm = DynamicRealm.getInstance(realmConfig); objectRefs.get().acquireReference(object); final RealmChangeListener<DynamicRealmObject> listener = new RealmChangeListener<DynamicRealmObject>() { @Override public void onChange(DynamicRealmObject object) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(object); } } }; RealmObject.addChangeListener(object, listener); subscriber.add(Subscriptions.create(new Action0() { @Override public void call() { RealmObject.removeChangeListener(object, listener); observableRealm.close(); objectRefs.get().releaseReference(object); } })); subscriber.onNext(object); } }); }
Source:
public void writeSelf(File file, long pos) { fLock.readLock().lock(); try (FileOutputStream fos = new FileOutputStream(file, true); FileChannel fc = fos.getChannel();) { fc.position(pos); try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeInt(ATTRIB_TREE_MAGIC_NUMBER); List<String[]> list = new ArrayList<>(fAttributeList.size()); String[] prevFullAttribute = null; for (Attribute entry : fAttributeList) { String[] curFullAttribute = entry.getFullAttribute(); String[] curEncodedAttribute = encodeFullAttribute(prevFullAttribute, entry.getFullAttribute()); list.add(curEncodedAttribute); prevFullAttribute = curFullAttribute; } oos.writeObject(list); } } catch (IOException e) { Activator.getDefault().logError("Error writing the file "+file+" ", e); } finally { fLock.readLock().unlock(); } }

Target:
public void writeSelf(File file, long pos) { fLock.readLock().lock(); try (FileOutputStream fos = new FileOutputStream(file, true); FileChannel fc = fos.getChannel();) { fc.position(pos); try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeInt(ATTRIB_TREE_MAGIC_NUMBER); List<String[]> list = new ArrayList<>(fAttributeList.size()); String[] prevFullAttribute = null; for (Attribute entry : fAttributeList) { String[] curFullAttribute = entry.getFullAttribute(); String[] curEncodedAttribute = encodeFullAttribute(prevFullAttribute, entry.getFullAttribute()); list.add(curEncodedAttribute); prevFullAttribute = curFullAttribute; } oos.writeObject(list); } } catch (IOException e) { Activator.getDefault().logError("Error writing the file"+file, e); } finally { fLock.readLock().unlock(); } }
Source:
private static void mergeSequences( final ArrayList<Move> sequence, final List<ArrayList<Move>> sequences) { for (final var otherSequence : sequences) { boolean merge = (otherSequence.size() == sequence.size()); for (int j = 0; merge && j < sequence.size(); j++) { merge = sequence.get(j).canMergeWith(otherSequence.get(j)); } if (!merge) { continue; } for (int j = 0; j < sequence.size(); j++) { if (!sequence.get(j).mergeWith(otherSequence.get(j))) { throw new RuntimeException("Unexpected"); } } otherSequence.clear(); } }

Target:
private static void mergeSequences( final ArrayList<Move> sequence, final List<ArrayList<Move>> sequences) { for (final var otherSequence : sequences) { boolean merge = (otherSequence.size() == sequence.size()); for (int i = 0; merge && i < sequence.size(); i++) { merge = sequence.get(i).canMergeWith(otherSequence.get(i)); } if (!merge) { continue; } for (int i = 0; i < sequence.size(); i++) { if (!sequence.get(i).mergeWith(otherSequence.get(i))) { throw new IllegalStateException( "Could not merge move despite checking canMergeWith() earlier."); } } otherSequence.clear(); } }
Source:
public void start() { this.stateCache = cacheManager .<ScopedState, CounterConfiguration>getCache(GlobalConfigurationManager.CONFIG_STATE_CACHE_NAME) .getAdvancedCache(); listener = new CounterConfigurationListener(); Map<String, CounterConfiguration> persisted = storage.loadAll(); persisted.forEach((name, cfg) -> stateCache.putIfAbsent(stateKey(name), cfg)); counterCacheStarted.set(false); stateCache.addFilteredListener(listener, new ScopeFilter(COUNTER_SCOPE), null, Util.asSet(CacheEntryCreated.class, CacheEntryModified.class)); if (!persisted.isEmpty() || stateCache.keySet().stream() .anyMatch(scopedState -> COUNTER_SCOPE.equals(scopedState.getScope()))) { startCounterCache(); } }

Target:
public void start() { this.stateCache = cacheManager .<ScopedState, CounterConfiguration>getCache(GlobalConfigurationManager.CONFIG_STATE_CACHE_NAME) .getAdvancedCache(); listener = new CounterConfigurationListener(); Map<String, CounterConfiguration> persisted = storage.loadAll(); persisted.forEach((name, cfg) -> stateCache.putIfAbsent(stateKey(name), cfg)); counterCacheStarted.set(false); stateCache.addListener(listener, new ScopeFilter(COUNTER_SCOPE), null); if (!persisted.isEmpty() || stateCache.keySet().stream() .anyMatch(scopedState -> COUNTER_SCOPE.equals(scopedState.getScope()))) { startCounterCache(); } }
Source:
public static void main(String[] args) { TestChunkerModels test = null; if (args.length != 3) { if (args.length == 1) test = new TestChunkerModels(null, args[0], null); else { logger.error("Usage: " + NAME + " testData modelDir modelName"); logger.error("OR " + NAME + " testData"); System.exit(-1); } } else test = new TestChunkerModels(args[1], args[0], args[2]); test.testAccuracy(); }

Target:
public static void main(String[] args) { TestChunkerModels test = null; if (args.length != 3) { if (args.length == 1) test = new TestChunkerModels(null, args[0], null); else { System.err.println("Usage: " + NAME + " testData modelDir modelName"); System.err.println("OR " + NAME + " testData"); System.exit(-1); } } else test = new TestChunkerModels(args[1], args[0], args[2]); test.testAccuracy(); }
Source:
public List<Sentence> collectAndRemoveListProds(List<Sentence> sentences) { listProds = new HashMap<>(); List<Sentence> ret = new ArrayList<>(sentences); Iterator<Sentence> iter = ret.iterator(); while (iter.hasNext()) { Sentence sentence = iter.next(); if (sentence instanceof SyntaxProduction) { SyntaxProduction prod = (SyntaxProduction) sentence; List<K> attrs = stream(prod.att().att()).collect(Collectors.toList()); Option<String> listType = prod.att().getString("userList"); if (!listType.isEmpty()) { List<SyntaxProduction> prods = listProds.get(listType.get()); if (prods == null) { prods = new ArrayList<>(3); listProds.put(listType.get(), prods); } prods.add(prod); iter.remove(); } } } generateUserLists(); return ret; }

Target:
public List<Sentence> collectAndRemoveListProds(List<Sentence> sentences) { listProds = new HashMap<>(); List<Sentence> ret = new ArrayList<>(sentences); Iterator<Sentence> iter = ret.iterator(); while (iter.hasNext()) { Sentence sentence = iter.next(); if (sentence instanceof SyntaxProduction) { SyntaxProduction prod = (SyntaxProduction) sentence; List<K> attrs = stream(prod.att().att()).collect(Collectors.toList()); Optional<String> listType = prod.att().getOptionalString("userList"); if (listType.isPresent()) { List<SyntaxProduction> prods = listProds.get(listType.get()); if (prods == null) { prods = new ArrayList<>(3); listProds.put(listType.get(), prods); } prods.add(prod); iter.remove(); } } } generateUserLists(); return ret; }
Source:
public void handleNotification(Notification notification) { try { if (acquireScanLock()) { ROOT_LOGGER.warn("Notification processed"); switch (notification.getType()) { case DEPLOYMENT_DEPLOYED_NOTIFICATION: { String runtimeName = notification.getData().get(DEPLOYMENT).asString(); if (!deployed.containsKey(runtimeName)) { updateDeploymentStatusAfterNotification(deploymentDir.toPath(), runtimeName); } break; } case DEPLOYMENT_UNDEPLOYED_NOTIFICATION: { String runtimeName = notification.getData().get(DEPLOYMENT).asString(); if (deployed.containsKey(runtimeName)) { clearMarkers(deployed.get(runtimeName).parentFolder.toPath(), runtimeName); deployed.remove(runtimeName); } break; } default: } } } finally { releaseScanLock(); } }

Target:
public void handleNotification(Notification notification) { if (acquireScanLock()) { try { switch (notification.getType()) { case DEPLOYMENT_DEPLOYED_NOTIFICATION: { String runtimeName = notification.getData().get(DEPLOYMENT).asString(); if (!deployed.containsKey(runtimeName)) { updateDeploymentStatusAfterNotification(deploymentDir.toPath(), runtimeName); } break; } case DEPLOYMENT_UNDEPLOYED_NOTIFICATION: { String runtimeName = notification.getData().get(DEPLOYMENT).asString(); if (deployed.containsKey(runtimeName)) { clearMarkers(deployed.get(runtimeName).parentFolder.toPath(), runtimeName); deployed.remove(runtimeName); } break; } default: } } finally { releaseScanLock(); } } }
Source:
void setup() { Constant.getInstance(); I18N i18n = Mockito.mock(I18N.class, withSettings().lenient()); given(i18n.getString(anyString())).willReturn(""); given(i18n.getString(anyString(), any())).willReturn(""); given(i18n.getLocal()).willReturn(Locale.getDefault()); Constant.messages = i18n; extensionAuthentication = new ExtensionAuthentication(); }

Target:
void setup() { extensionAuthentication = new ExtensionAuthentication(); }
Source:
private int atEnd(int res) { URI nested = compensateURI != null ? extractParentLRA(compensateURI) : null; boolean notifyForget = (nested != null && forgetURI != null); if (!isFinished() || !lra.isFinished()) { if (afterURI != null || notifyForget) { return TwoPhaseOutcome.HEURISTIC_HAZARD; } return res; } boolean r1 = afterURI == null || request(afterURI, lra, lra.getLRAStatus().name()); boolean r2 = !notifyForget || request(forgetURI, lra, lra.getLRAStatus().name()); if (r1) { afterURI = null; } if (r2) { forgetURI = null; } return r1 && r2 ? TwoPhaseOutcome.FINISH_OK : TwoPhaseOutcome.HEURISTIC_HAZARD; }

Target:
private int atEnd(int res) { if (!isFinished() || !lra.isFinished()) { if (afterURI != null) { return TwoPhaseOutcome.HEURISTIC_HAZARD; } return res; } if (afterURI == null || afterLRARequest(afterURI, lra.getLRAStatus().name())) { afterURI = null; return TwoPhaseOutcome.FINISH_OK; } return TwoPhaseOutcome.HEURISTIC_HAZARD; }
Source:
public LocalCacheFileSystem(FileSystem fs, FileSystemContext fsContext) { super(fs); mFsContext = fsContext; mLocalCacheManager = new LocalCacheManager(mFsContext); }

Target:
public LocalCacheFileSystem(FileSystem fs, FileSystemContext fsContext) { super(fs); mFsContext = fsContext; }
Source:
public static ConfigDef getConfig() { Set<String> skip = new HashSet<>(); skip.add(STORAGE_CLASS_CONFIG); skip.add(FORMAT_CLASS_CONFIG); skip.add(TOPICS_DIR_CONFIG); ConfigDef visible = new ConfigDef(); addAllConfigKeys(visible, newConfigDef(), skip); addAllConfigKeys(visible, StorageCommonConfig.newConfigDef(STORAGE_CLASS_RECOMMENDER), skip); addAllConfigKeys(visible, PartitionerConfig.newConfigDef(PARTITIONER_CLASS_RECOMMENDER), skip); addAllConfigKeys(visible, HiveConfig.getConfig(), skip); visible.define( STORAGE_CLASS_CONFIG, Type.CLASS, HdfsStorage.class.getName(), Importance.HIGH, STORAGE_CLASS_DOC, "Storage", 1, Width.NONE, STORAGE_CLASS_DISPLAY, STORAGE_CLASS_RECOMMENDER ); visible.define( FORMAT_CLASS_CONFIG, Type.CLASS, AvroFormat.class.getName(), Importance.HIGH, FORMAT_CLASS_DOC, "Connector", 1, Width.NONE, FORMAT_CLASS_DISPLAY, FORMAT_CLASS_RECOMMENDER ); visible.define( "topics.dir", Type.STRING, "topics", Importance.HIGH, "Top level directory to store the data ingested from Kafka. " + "Supports ``${topic}`` in the value, which will be replaced by the actual" + " topic name. Supports ``${1}``, ..., ``${n}`` in conjunction with " + TOPIC_REGEX_CAPTURE_GROUP_CONFIG + ". See " + TOPIC_REGEX_CAPTURE_GROUP_CONFIG + " configuration documentation for details.", "Storage", 2, Width.NONE, "Topics directory" ); return visible; }

Target:
public static ConfigDef getConfig() { Set<String> skip = new HashSet<>(); skip.add(STORAGE_CLASS_CONFIG); skip.add(FORMAT_CLASS_CONFIG); skip.add(TOPICS_DIR_CONFIG); ConfigDef visible = new ConfigDef(); addAllConfigKeys(visible, newConfigDef(), skip); addAllConfigKeys(visible, StorageCommonConfig.newConfigDef(STORAGE_CLASS_RECOMMENDER), skip); addAllConfigKeys(visible, PartitionerConfig.newConfigDef(PARTITIONER_CLASS_RECOMMENDER), skip); addAllConfigKeys(visible, HiveConfig.getConfig(), skip); visible.define( STORAGE_CLASS_CONFIG, Type.CLASS, HdfsStorage.class.getName(), Importance.HIGH, STORAGE_CLASS_DOC, "Storage", 1, Width.NONE, STORAGE_CLASS_DISPLAY, STORAGE_CLASS_RECOMMENDER ); visible.define( FORMAT_CLASS_CONFIG, Type.CLASS, AvroFormat.class.getName(), Importance.HIGH, FORMAT_CLASS_DOC, "Connector", 1, Width.NONE, FORMAT_CLASS_DISPLAY, FORMAT_CLASS_RECOMMENDER ); visible.define( TOPICS_DIR_CONFIG, Type.STRING, TOPICS_DIR_DEFAULT, Importance.HIGH, TOPICS_DIR_DOC + DIR_REGEX_DOC, "Storage", 2, Width.NONE, TOPICS_DIR_DISPLAY ); return visible; }
Source:
protected IStatus run(IProgressMonitor monitor) { boolean successful = true; for (InstanceValidator validator : this.validators) { IOReporter defaultReporter = validator.createReporter(); defaultReporter.setSuccess(false); IOReport report = defaultReporter; try { ATransaction trans = log.begin(defaultReporter.getTaskName()); try { if (writer != null) { List<? extends Locatable> schemas = writer.getValidationSchemas(); validator.setSchemas(schemas.toArray(new Locatable[schemas.size()])); } IOReport result = validator.execute(new ProgressMonitorIndicator(monitor)); if (result != null) { report = result; } else { defaultReporter.setSuccess(true); } } catch (Throwable e) { defaultReporter.error(new IOMessageImpl(e.getLocalizedMessage(), e)); } finally { trans.end(); } } catch (Throwable e) { defaultReporter.error(new IOMessageImpl(e.getLocalizedMessage(), e)); } if (monitor.isCanceled()) { reset(); return Status.CANCEL_STATUS; } reportHandler.publishReport(report); if (report.isSuccess()) { log.userInfo(report.getSummary()); } else { log.userError(report.getSummary()); successful = false; } } reset(); if (successful) { return Status.OK_STATUS; } else { return ERROR_STATUS; } }

Target:
protected IStatus run(IProgressMonitor monitor) { boolean successful = true; for (InstanceValidator validator : this.validators) { IOReporter defaultReporter = validator.createReporter(); defaultReporter.setSuccess(false); IOReport report = defaultReporter; try { ATransaction trans = log.begin(defaultReporter.getTaskName()); try { if (writer != null) { List<? extends Locatable> schemas = writer.getValidationSchemas(); validator.setSchemas(schemas.toArray(new Locatable[schemas.size()])); } IOReport result = validator.execute(new ProgressMonitorIndicator(monitor)); if (result != null) { report = result; } else { defaultReporter.setSuccess(true); } } catch (Throwable e) { defaultReporter.error(new IOMessageImpl(e.getLocalizedMessage(), e)); } finally { trans.end(); } } catch (Throwable e) { defaultReporter.error(new IOMessageImpl(e.getLocalizedMessage(), e)); } if (monitor.isCanceled()) { reset(); return Status.CANCEL_STATUS; } reportHandler.publishReport(report); if (report.isSuccess()) { log.info(report.getSummary()); } else { log.error(report.getSummary()); successful = false; } } reset(); if (successful) { log.userInfo("All validations completed successfully."); return Status.OK_STATUS; } else { log.userError("There were validation failures. Please check the reports for details."); return ERROR_STATUS; } }
Source:
public static boolean onLivingKnockBack(EntityLivingBase target, Entity attacker, float strength, double ratioX, double ratioZ) { return !MinecraftForge.EVENT_BUS.post(new LivingKnockBackEvent(target, attacker, strength, ratioX, ratioZ)); }

Target:
public static LivingKnockBackEvent onLivingKnockBack(EntityLivingBase target, Entity attacker, float strength, double ratioX, double ratioZ) { LivingKnockBackEvent event = new LivingKnockBackEvent(target, attacker, strength, ratioX, ratioZ); MinecraftForge.EVENT_BUS.post(event); return event; }
Source:
public List<KeyValue> getKeyValues() { Collection<AgencyOrigin> agencyOrigins = getKeyValuesService().findAll(AgencyOrigin.class); List<KeyValue> keyValues = new ArrayList<>(); keyValues.add(new ConcreteKeyValue(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING)); agencyOrigins.stream() .map(agencyOrigin -> new ConcreteKeyValue(agencyOrigin.getCode(), agencyOrigin.getName())) .forEach(keyValues::add); return keyValues; }

Target:
public List<KeyValue> getKeyValues() { Collection<AgencyOrigin> agencyOrigins = getKeyValuesService().findAllOrderBy( AgencyOrigin.class, KFSPropertyConstants.CODE, false); List<KeyValue> keyValues = new ArrayList<>(); keyValues.add(new ConcreteKeyValue(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING)); agencyOrigins.stream() .map(agencyOrigin -> new ConcreteKeyValue(agencyOrigin.getCode(), agencyOrigin.getName())) .forEach(keyValues::add); return keyValues; }
Source:
public void fireProgress(float progress, String task) { if (progress > status.progress || StringUtils.equals(task, status.task)) { if (status.getPhase() == ProcessState.QUEUED) { status.setPhase(ProcessState.RUNNING); } status.setProgress(progress); status.setTask(task); if (progress > 0) { long timeEalpsedMillis = (new Date().getTime() - status.getCreationTime().getTime()); int estimatedCompletionMillis = (int) ((timeEalpsedMillis / progress) * timeEalpsedMillis + timeEalpsedMillis); Calendar calendar = Calendar.getInstance(); calendar.setTime(status.getCreationTime()); calendar.add(Calendar.MILLISECOND, estimatedCompletionMillis); status.setEstimatedCompletion(calendar.getTime()); } ProcessEvent event = new ProcessEvent(status, inputs, outputs); for (ProcessListener listener : listeners) { listener.progress(event); } } }

Target:
public void fireProgress(float progress, String task) { if (progress > status.progress || StringUtils.equals(task, status.task)) { if (status.getPhase() == ProcessState.QUEUED) { status.setPhase(ProcessState.RUNNING); } status.setProgress(progress); status.setTask(task); if (progress > 0) { long timeElapsedMillis = (new Date().getTime() - status.getCreationTime().getTime()); int estimatedCompletionMillis = (int) ((timeElapsedMillis / progress) * timeElapsedMillis + timeElapsedMillis); Calendar calendar = Calendar.getInstance(); calendar.setTime(status.getCreationTime()); calendar.add(Calendar.MILLISECOND, estimatedCompletionMillis); status.setEstimatedCompletion(calendar.getTime()); } ProcessEvent event = new ProcessEvent(status, inputs, outputs); for (ProcessListener listener : listeners) { listener.progress(event); } } }
Source:
static List<HiveSplit> drainSplits(HiveSplitSource source) throws Exception { ImmutableList.Builder<HiveSplit> splits = ImmutableList.builder(); while (!source.isFinished()) { source.getNextBatch(NOT_PARTITIONED, 100).get() .getSplits().stream() .map(HiveSplit.class::cast) .forEach(splits::add); } return splits.build(); }

Target:
private static List<HiveSplit> drainSplits(HiveSplitSource source) throws Exception { ImmutableList.Builder<HiveSplit> splits = ImmutableList.builder(); while (!source.isFinished()) { source.getNextBatch(NOT_PARTITIONED, 100).get() .getSplits().stream() .map(HiveSplit.class::cast) .forEach(splits::add); } return splits.build(); }
Source:
void searchProductLink() { String url = "<LINK_0>" + code; if (!brand.getText().toString().isEmpty()) { List<String> chipVals = brand.getChipValues(); url = url + " " + StringUtils.join(chipVals, ' '); } if (!name.getText().toString().isEmpty()) { url = url + " " + name.getText().toString(); } url = url + " " + getString(R.string.official_website); CustomTabsIntent customTabsIntent = CustomTabsHelper.getCustomTabsIntent(activity.getBaseContext(), null); CustomTabActivityHelper.openCustomTab(activity, customTabsIntent, Uri.parse(url), new WebViewFallback()); }

Target:
void searchProductLink() { String url = "<LINK_0>" + code; if (!brand.getChipAndTokenValues().isEmpty()) { List<String> brandNames = brand.getChipAndTokenValues(); url = url + " " + StringUtils.join(brandNames, ' '); } if (!name.getText().toString().isEmpty()) { url = url + " " + name.getText().toString(); } url = url + " " + getString(R.string.official_website); CustomTabsIntent customTabsIntent = CustomTabsHelper.getCustomTabsIntent(activity.getBaseContext(), null); CustomTabActivityHelper.openCustomTab(activity, customTabsIntent, Uri.parse(url), new WebViewFallback()); }
Source:
protected void patch(Context context, HttpServletRequest request, String apiCategory, String model, UUID id, Patch patch) throws AuthorizeException, SQLException { Item item = itemService.find(obtainContext(), id); if (item == null) { throw new ResourceNotFoundException(apiCategory + "." + model + " with id: " + id + " not found"); } if (item.getTemplateItemOf() != null) { throw new DSpaceBadRequestException("The given ID resolved to a template item"); } ItemRest itemRest = dsoPatch.patch(findOne(context, id), patch.getOperations()); updateDSpaceObject(item, itemRest); }

Target:
protected void patch(Context context, HttpServletRequest request, String apiCategory, String model, UUID id, Patch patch) throws AuthorizeException, SQLException { Item item = itemService.find(obtainContext(), id); if (item == null) { throw new ResourceNotFoundException(apiCategory + "." + model + " with id: " + id + " not found"); } if (item.getTemplateItemOf() != null) { throw new DSpaceBadRequestException("The ID: " + id + " resolved to a template item"); } ItemRest itemRest = dsoPatch.patch(findOne(context, id), patch.getOperations()); updateDSpaceObject(item, itemRest); }
Source:
protected void activate(BundleContext bundleContext) { XmlDocumentReader<List<?>> thingTypeReader = new ThingDescriptionReader(); thingTypeTracker = new XmlDocumentBundleTracker<List<?>>(bundleContext, XML_DIRECTORY, thingTypeReader, this, READY_MARKER, readyService); trackerJob = scheduler.schedule(() -> { thingTypeTracker.open(); }, 0, TimeUnit.SECONDS); }

Target:
protected void activate(BundleContext bundleContext) { XmlDocumentReader<List<?>> thingTypeReader = new ThingDescriptionReader(); thingTypeTracker = new XmlDocumentBundleTracker<List<?>>(bundleContext, XML_DIRECTORY, thingTypeReader, this, READY_MARKER, readyService); trackerJob = scheduler.submit(() -> { thingTypeTracker.open(); }); }
Source:
private void saveWithDifferentEncoding(Path file, boolean selectedOnly, Charset encoding, Set<Character> encodingProblems, SavePreferences.DatabaseSaveType saveType) throws SaveException { DialogPane pane = new DialogPane(); VBox vbox = new VBox(); vbox.getChildren().addAll( new Text(Localization.lang("The chosen encoding '%0' could not encode the following characters:", encoding.displayName())), new Text(encodingProblems.stream().map(Object::toString).collect(Collectors.joining("."))), new Text(Localization.lang("What do you want to do?"))); pane.setContent(vbox); ButtonType tryDifferentEncoding = new ButtonType(Localization.lang("Try different encoding"), ButtonBar.ButtonData.OTHER); ButtonType ignore = new ButtonType(Localization.lang("Ignore"), ButtonBar.ButtonData.APPLY); boolean saveWithDifferentEncoding = dialogService .showCustomDialogAndWait(Localization.lang("Save library"), pane, ignore, tryDifferentEncoding) .filter(buttonType -> buttonType.equals(tryDifferentEncoding)) .isPresent(); if (saveWithDifferentEncoding) { Optional<Charset> newEncoding = dialogService.showChoiceDialogAndWait(Localization.lang("Save library"), Localization.lang("Select new encoding"), Localization.lang("Save library"), encoding, Encodings.getCharsets()); if (newEncoding.isPresent()) { panel.getBibDatabaseContext().getMetaData().setEncoding(newEncoding.get(), ChangePropagation.DO_NOT_POST_EVENT); saveDatabase(file, selectedOnly, newEncoding.get(), saveType); } } }

Target:
private void saveWithDifferentEncoding(Path file, boolean selectedOnly, Charset encoding, Set<Character> encodingProblems, SavePreferences.DatabaseSaveType saveType) throws SaveException { DialogPane pane = new DialogPane(); VBox vbox = new VBox(); vbox.getChildren().addAll( new Text(Localization.lang("The chosen encoding '%0' could not encode the following characters:", encoding.displayName())), new Text(encodingProblems.stream().map(Object::toString).collect(Collectors.joining("."))), new Text(Localization.lang("What do you want to do?")) ); pane.setContent(vbox); ButtonType tryDifferentEncoding = new ButtonType(Localization.lang("Try different encoding"), ButtonBar.ButtonData.OTHER); ButtonType ignore = new ButtonType(Localization.lang("Ignore"), ButtonBar.ButtonData.APPLY); boolean saveWithDifferentEncoding = dialogService .showCustomDialogAndWait(Localization.lang("Save library"), pane, ignore, tryDifferentEncoding) .filter(buttonType -> buttonType.equals(tryDifferentEncoding)) .isPresent(); if (saveWithDifferentEncoding) { Optional<Charset> newEncoding = dialogService.showChoiceDialogAndWait(Localization.lang("Save library"), Localization.lang("Select new encoding"), Localization.lang("Save library"), encoding, Encodings.getCharsets()); if (newEncoding.isPresent()) { libraryTab.getBibDatabaseContext().getMetaData().setEncoding(newEncoding.get(), ChangePropagation.DO_NOT_POST_EVENT); saveDatabase(file, selectedOnly, newEncoding.get(), saveType); } } }
Source:
public void run() { try { Problem current = toProcess.takeFirst(); while (current != REPORTING_DONE) { handleProblem(current.getSeverity(), current.getReportable()); current = toProcess.takeFirst(); } } catch (InterruptedException e) { logger.log(Level.FINE, "Reporter thread " + Thread.currentThread().getName() + " was interrupted"); Thread.currentThread().interrupt(); } }

Target:
public void run() { try { Problem current; while ((current = toProcess.takeFirst()) != REPORTING_DONE) { handleProblem(current.getSeverity(), current.getReportable()); } } catch (InterruptedException e) { logger.log(Level.FINE, "Reporter thread '" + Thread.currentThread().getName() + "' was interrupted"); Thread.currentThread().interrupt(); } }
Source:
private void sendError(ChannelHandlerContext ctx, HttpResponseStatus status) { HttpResponse response = new DefaultHttpResponse(HTTP_1_1, status); response.setHeader(CONTENT_TYPE, "org/apache/tajo/storage/text/plain; charset=UTF-8"); response.setContent(ChannelBuffers.copiedBuffer( "Failure: " + status.toString() + "\r\n", CharsetUtil.UTF_8)); ctx.getChannel().write(response).addListener(ChannelFutureListener.CLOSE); }

Target:
private void sendError(ChannelHandlerContext ctx, HttpResponseStatus status) { HttpResponse response = new DefaultHttpResponse(HTTP_1_1, status); response.setHeader(CONTENT_TYPE, "text/plain; charset=UTF-8"); response.setContent(ChannelBuffers.copiedBuffer( "Failure: " + status.toString() + "\r\n", CharsetUtil.UTF_8)); ctx.getChannel().write(response).addListener(ChannelFutureListener.CLOSE); }
Source:
public void setPartitionSpilledLookupSourceHandle(int partitionIndex, SpilledLookupSourceHandle spilledLookupSourceHandle) { requireNonNull(spilledLookupSourceHandle, "spilledLookupSourceHandle is null"); boolean completed; rwLock.writeLock().lock(); try { if (destroyed.isDone()) { spilledLookupSourceHandle.dispose(); return; } checkState(!spilledPartitions.containsKey(partitionIndex), "Partition already set as spilled"); spilledPartitions.put(partitionIndex, spilledLookupSourceHandle); spillingInfo = new SpillingInfo(spillingInfo.spillEpoch() + 1, spilledPartitions.keySet()); if (partitions[partitionIndex] != null) { completed = false; } else { partitionsSet++; completed = partitionsSet == partitions.length; } partitions[partitionIndex] = () -> spilledLookupSource; if (lookupSourceSupplier != null) { verify(!completed, "lookupSourceSupplier already exist, so should not think completing now"); verify(!outer, "We are about to reset lookupSourceSupplier which is tracking for outer join's sake"); verify(partitions.length > 1, "We are about to create partitioned lookup source for only one partition"); lookupSourceSupplier = createPartitionedLookupSourceSupplier(ImmutableList.copyOf(partitions), hashChannelTypes, outer); } } finally { rwLock.writeLock().unlock(); } if (completed) { supplyLookupSources(); } }

Target:
public void setPartitionSpilledLookupSourceHandle(int partitionIndex, SpilledLookupSourceHandle spilledLookupSourceHandle) { requireNonNull(spilledLookupSourceHandle, "spilledLookupSourceHandle is null"); boolean completed; lock.writeLock().lock(); try { if (destroyed.isDone()) { spilledLookupSourceHandle.dispose(); return; } checkState(!spilledPartitions.containsKey(partitionIndex), "Partition already set as spilled"); spilledPartitions.put(partitionIndex, spilledLookupSourceHandle); spillingInfo = new SpillingInfo(spillingInfo.spillEpoch() + 1, spilledPartitions.keySet()); if (partitions[partitionIndex] != null) { completed = false; } else { partitionsSet++; completed = (partitionsSet == partitions.length); } partitions[partitionIndex] = () -> spilledLookupSource; if (lookupSourceSupplier != null) { verify(!completed, "lookupSourceSupplier already exist when completing"); verify(!outer, "It is not possible to reset lookupSourceSupplier which is tracking for outer join"); verify(partitions.length > 1, "Spill occurred when only one partition"); lookupSourceSupplier = createPartitionedLookupSourceSupplier(ImmutableList.copyOf(partitions), hashChannelTypes, outer); closeCachedLookupSources(); } else { verify(suppliedLookupSources.isEmpty(), "There are cached LookupSources even though lookupSourceSupplier does not exist"); } } finally { lock.writeLock().unlock(); } if (completed) { supplyLookupSources(); } }
Source:
private void showFormatUpgradeConfirmIfRequired() { StoragePool dc = getEntity(); StorageFormatUpgradeConfirmationModel model = new StorageFormatUpgradeConfirmationModel(); boolean shouldDisplay = model.initialize( selectedStorageDomains, dc, "OnShowFormatUpgrade", "Cancel", this); if (shouldDisplay) { setConfirmWindow(model); } else { UICommand okCommand = UICommand.createDefaultOkUiCommand( "OnShowFormatUpgrade", this); okCommand.execute(); } }

Target:
private void showFormatUpgradeConfirmIfRequired() { StoragePool dc = getEntity(); StorageFormatUpgradeConfirmationModel model = new StorageFormatUpgradeConfirmationModel(); boolean shouldDisplay = model.initialize( selectedStorageDomains, dc, "OnShowFormatUpgrade", "Cancel", this); if (shouldDisplay) { setConfirmWindow(model); model.setHelpTag(HelpTag.attach_storage_from_dc_confirmation); model.setHashName("attach_storage_from_dc_confirmation"); } else { UICommand okCommand = UICommand.createDefaultOkUiCommand( "OnShowFormatUpgrade", this); okCommand.execute(); } }
Source:
public void abortProcessInstances(List<Long> processInstanceIds) { processInstanceIds.stream().filter(processInstanceId -> !hasParentProcessInProcessInstanceList(null, processInstanceId, processInstanceIds)) .forEach(processInstanceId -> abortProcessInstance(processInstanceId)); }

Target:
public void abortProcessInstances(List<Long> processInstanceIds) { processInstanceIds.stream().filter(processInstanceId -> !hasAbortedParentProcessInProcessInstanceList(null, processInstanceId, processInstanceIds)) .forEach(processInstanceId -> abortProcessInstance(processInstanceId)); }
Source:
public void getJobCreatedNotification() throws IOException, SignatureException { final UUID notificationUUID = client.putJobCreatedNotificationRegistrationSpectraS3( new PutJobCreatedNotificationRegistrationSpectraS3Request("test@test.test")) .getJobCreatedNotificationRegistrationResult().getId(); final GetJobCreatedNotificationRegistrationSpectraS3Response response = client .getJobCreatedNotificationRegistrationSpectraS3(new GetJobCreatedNotificationRegistrationSpectraS3Request(notificationUUID)); assertThat(response.getStatusCode(), is(200)); }

Target:
public void getJobCreatedNotification() throws IOException, SignatureException { UUID notificationUUID = null; try { notificationUUID = client.putJobCreatedNotificationRegistrationSpectraS3( new PutJobCreatedNotificationRegistrationSpectraS3Request("test@test.test")) .getJobCreatedNotificationRegistrationResult().getId(); final GetJobCreatedNotificationRegistrationSpectraS3Response response = client .getJobCreatedNotificationRegistrationSpectraS3(new GetJobCreatedNotificationRegistrationSpectraS3Request(notificationUUID)); assertThat(response.getStatusCode(), is(200)); } finally { if (notificationUUID != null) { client.deleteJobCreatedNotificationRegistrationSpectraS3( new DeleteJobCreatedNotificationRegistrationSpectraS3Request(notificationUUID)); } } }
Source:
public void minimalConfig() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-parser.xml", this.getClass()); CassandraMessageHandler<?> handler = TestUtils.getPropertyValue(context.getBean("outbound1.adapter"), "handler", CassandraMessageHandler.class); assertEquals("outbound1.adapter", TestUtils.getPropertyValue(handler, "componentName")); assertEquals(CassandraMessageHandler.Type.INSERT, TestUtils.getPropertyValue(handler, "mode")); assertEquals(context.getBean("cassandraTemplate"), TestUtils.getPropertyValue(handler, "cassandraTemplate")); assertEquals(context.getBean("writeOptions"), TestUtils.getPropertyValue(handler, "writeOptions")); context.close(); }

Target:
public void minimalConfig() { CassandraMessageHandler<?> handler = TestUtils.getPropertyValue(context.getBean("outbound1.adapter"), "handler", CassandraMessageHandler.class); assertEquals("outbound1.adapter", TestUtils.getPropertyValue(handler, "componentName")); assertEquals(CassandraMessageHandler.Type.INSERT, TestUtils.getPropertyValue(handler, "mode")); assertEquals(context.getBean("cassandraTemplate"), TestUtils.getPropertyValue(handler, "cassandraTemplate")); assertEquals(context.getBean("writeOptions"), TestUtils.getPropertyValue(handler, "writeOptions")); }
Source:
public Builder authorization(String scheme, byte[] auth) { this.authInfos = Lists.newArrayList(); this.authInfos.add(new AuthInfo(scheme, (auth != null) ? Arrays.copyOf(auth, auth.length) : null)); return this; }

Target:
public Builder authorization(String scheme, byte[] auth) { return authorization(ImmutableList.of(new AuthInfo(scheme, (auth != null) ? Arrays.copyOf(auth, auth.length) : null))); }
Source:
public Topology getTopology(Map<String, String> options) { int size = getOptionAsInteger(options, BATCH_SIZE_OPT, DEFAULT_BATCH_SIZE); int timer = getOptionAsInteger(options, BATCH_THRESHOLD_MS_OPT, DEFAULT_BATCH_THRESHOLD_MS); return Topology.builder().addComputation(() -> createComputation(size, timer), getIOs()).build(); }

Target:
public Topology getTopology(Map<String, String> options) { int size = getOptionAsInteger(options, BATCH_SIZE_OPT, DEFAULT_BATCH_SIZE); int threshold = getOptionAsInteger(options, BATCH_THRESHOLD_MS_OPT, DEFAULT_BATCH_THRESHOLD_MS); return Topology.builder().addComputation(() -> createComputation(size, threshold), getStreamMapping()).build(); }