auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Collection<JcloudsLocationCustomizer> getCustomizers(ConfigBag setup) { JcloudsLocationCustomizer customizer = setup.get(JCLOUDS_LOCATION_CUSTOMIZER); Collection<JcloudsLocationCustomizer> customizers = setup.get(JCLOUDS_LOCATION_CUSTOMIZERS); String customizerType = setup.get(JCLOUDS_LOCATION_CUSTOMIZER_TYPE); String customizersSupplierType = setup.get(JCLOUDS_LOCATION_CUSTOMIZERS_SUPPLIER_TYPE); List<JcloudsLocationCustomizer> result = new ArrayList<JcloudsLocationCustomizer>(); if (customizer != null) result.add(customizer); if (customizers != null) result.addAll(customizers); if (Strings.isNonBlank(customizerType)) { Optional<JcloudsLocationCustomizer> customizerByType = Reflections.invokeConstructorWithArgs(getManagementContext().getCatalog().getRootClassLoader(), customizerType, setup); if (customizerByType.isPresent()) { result.add(customizerByType.get()); } else { LOG.warn("Cannot load JcloudsLocationCustomizer: " + customizersSupplierType); } } if (Strings.isNonBlank(customizersSupplierType)) { Optional<Supplier<Collection<JcloudsLocationCustomizer>>> supplier = Reflections.invokeConstructorWithArgs(getManagementContext().getCatalog().getRootClassLoader(), customizersSupplierType, setup); if (supplier.isPresent()) { result.addAll(supplier.get().get()); } else { LOG.warn("Cannot load JcloudsLocationCustomizer supplier: " + customizersSupplierType); } } return result; }

Target:
protected Collection<JcloudsLocationCustomizer> getCustomizers(ConfigBag setup) { JcloudsLocationCustomizer customizer = setup.get(JCLOUDS_LOCATION_CUSTOMIZER); Collection<JcloudsLocationCustomizer> customizers = setup.get(JCLOUDS_LOCATION_CUSTOMIZERS); String customizerType = setup.get(JCLOUDS_LOCATION_CUSTOMIZER_TYPE); String customizersSupplierType = setup.get(JCLOUDS_LOCATION_CUSTOMIZERS_SUPPLIER_TYPE); List<JcloudsLocationCustomizer> result = new ArrayList<JcloudsLocationCustomizer>(); if (customizer != null) result.add(customizer); if (customizers != null) result.addAll(customizers); if (Strings.isNonBlank(customizerType)) { Optional<JcloudsLocationCustomizer> customizerByType = Reflections.invokeConstructorWithArgs(getManagementContext().getCatalog().getRootClassLoader(), customizerType, setup); if (customizerByType.isPresent()) { result.add(customizerByType.get()); } else { throw new IllegalStateException("Failed to load JcloudsLocationCustomizer "+customizersSupplierType+" for location "+this); } } if (Strings.isNonBlank(customizersSupplierType)) { Optional<Supplier<Collection<JcloudsLocationCustomizer>>> supplier = Reflections.invokeConstructorWithArgs(getManagementContext().getCatalog().getRootClassLoader(), customizersSupplierType, setup); if (supplier.isPresent()) { result.addAll(supplier.get().get()); } else { throw new IllegalStateException("Failed to load JcloudsLocationCustomizer supplier "+customizersSupplierType+" for location "+this); } } return result; }
Source:
public static Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> getTypeVariableBindings(Class<?> type) { Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> allBindings = new HashMap<>(); Map<TypeVariable<?>, TypeVariable<?>> currentBindings = new HashMap<>(); TypeVariable<?>[] subTypeParameters = type.getTypeParameters(); for ( TypeVariable<?> typeVariable : subTypeParameters ) { currentBindings.put( typeVariable, typeVariable ); } allBindings.put( type, currentBindings ); collectTypeBindings( type, allBindings, currentBindings ); allBindings.put( Object.class, Collections.emptyMap() ); return allBindings; }

Target:
public static Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> getTypeVariableBindings(Class<?> type) { Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> allBindings = new HashMap<>(); Map<TypeVariable<?>, TypeVariable<?>> currentBindings = new HashMap<>(); TypeVariable<?>[] subTypeParameters = type.getTypeParameters(); for ( TypeVariable<?> typeVariable : subTypeParameters ) { currentBindings.put( typeVariable, typeVariable ); } allBindings.put( type, currentBindings ); collectTypeBindings( type, allBindings, currentBindings ); allBindings.put( Object.class, Collections.emptyMap() ); return Collections.unmodifiableMap( allBindings ); }
Source:
public void storeSettings() { preferencesService.storeEntryEditorPreferences(new EntryEditorPreferences( initialEntryEditorPreferences.getEntryEditorTabList(), openOnNewEntryProperty.getValue(), enableRelatedArticlesTabProperty.getValue(), acceptRecommendationsProperty.getValue(), enableLatexCitationsTabProperty.getValue(), defaultSourceProperty.getValue(), enableValidationProperty.getValue())); AutoCompletePreferences.onlyCompleteNameFormat nameFormat = AutoCompletePreferences.onlyCompleteNameFormat.BOTH; if (autoCompleteFirstLastProperty.getValue()) { nameFormat = AutoCompletePreferences.onlyCompleteNameFormat.FIRST_LAST; } else if (autoCompleteLastFirstProperty.getValue()) { nameFormat = AutoCompletePreferences.onlyCompleteNameFormat.LAST_FIRST; } AutoCompleteFirstNameMode firstNameMode = AutoCompleteFirstNameMode.BOTH; if (firstNameModeAbbreviatedProperty.getValue()) { firstNameMode = AutoCompleteFirstNameMode.ONLY_ABBREVIATED; } else if (firstNameModeFullProperty.getValue()) { firstNameMode = AutoCompleteFirstNameMode.ONLY_FULL; } preferencesService.storeAutoCompletePreferences(new AutoCompletePreferences( enableAutoCompleteProperty.getValue(), firstNameMode, nameFormat, FieldFactory.parseFieldList(autoCompleteFieldsProperty.getValue()), preferencesService.getJournalAbbreviationPreferences())); }

Target:
public void storeSettings() { preferencesService.storeEntryEditorPreferences(new EntryEditorPreferences( initialEntryEditorPreferences.getEntryEditorTabList(), openOnNewEntryProperty.getValue(), enableRelatedArticlesTabProperty.getValue(), acceptRecommendationsProperty.getValue(), enableLatexCitationsTabProperty.getValue(), defaultSourceProperty.getValue(), enableValidationProperty.getValue())); AutoCompletePreferences.NameFormat nameFormat = AutoCompletePreferences.NameFormat.BOTH; if (autoCompleteFirstLastProperty.getValue()) { nameFormat = AutoCompletePreferences.NameFormat.FIRST_LAST; } else if (autoCompleteLastFirstProperty.getValue()) { nameFormat = AutoCompletePreferences.NameFormat.LAST_FIRST; } AutoCompleteFirstNameMode firstNameMode = AutoCompleteFirstNameMode.BOTH; if (firstNameModeAbbreviatedProperty.getValue()) { firstNameMode = AutoCompleteFirstNameMode.ONLY_ABBREVIATED; } else if (firstNameModeFullProperty.getValue()) { firstNameMode = AutoCompleteFirstNameMode.ONLY_FULL; } preferencesService.storeAutoCompletePreferences(new AutoCompletePreferences( enableAutoCompleteProperty.getValue(), firstNameMode, nameFormat, FieldFactory.parseFieldList(autoCompleteFieldsProperty.getValue()), preferencesService.getJournalAbbreviationPreferences())); }
Source:
protected void populateManager(final IContributionManager manager, final Collection actions, final String contributionID) { if (actions != null) { List<IAction> sortedActions = Lists.newArrayList(Iterables.filter(actions, IAction.class)); Comparator<IAction> comparator = new Comparator<IAction>() { @Override public int compare(IAction a1, IAction a2) { int returnedInt; if (!priorityMap.containsKey(a1) && !priorityMap.containsKey(a2)) { returnedInt = 0; } else if (!priorityMap.containsKey(a1)) { returnedInt = 1; } else if (!priorityMap.containsKey(a2)) { returnedInt = -1; } else { returnedInt = priorityMap.get(a1) - priorityMap.get(a2); } return returnedInt; } }; Collections.sort(sortedActions, comparator); for (final IAction action : sortedActions) { if (action instanceof CreateChildAction) { ((CreateChildAction) action).getMenuCreator(); } if (contributionID != null) { manager.insertBefore(contributionID, action); } else { manager.add(action); } } } manager.update(true); }

Target:
protected void populateManager(final IContributionManager manager, final Collection actions, final String contributionID) { if (actions != null) { List<IAction> sortedActions = Lists.newArrayList(Iterables.filter(actions, IAction.class)); Comparator<IAction> comparator = new Comparator<IAction>() { @Override public int compare(IAction a1, IAction a2) { int returnedInt; if (!priorityMap.containsKey(a1) && !priorityMap.containsKey(a2)) { returnedInt = 0; } else if (!priorityMap.containsKey(a1) && priorityMap.containsKey(a2)) { returnedInt = 1; } else if (priorityMap.containsKey(a1) && !priorityMap.containsKey(a2)) { returnedInt = -1; } else { returnedInt = priorityMap.get(a1) - priorityMap.get(a2); } if (returnedInt == 0) { returnedInt = Collator.getInstance().compare(a1.getText(), a2.getText()); } return returnedInt; } }; Collections.sort(sortedActions, comparator); for (final IAction action : sortedActions) { if (contributionID != null) { manager.insertBefore(contributionID, action); } else { manager.add(action); } } } manager.update(true); }
Source:
public EventType getEventType(final String name) throws NoSuchEventTypeException, InternalNakadiException { return getCached(name).map(CachedValue::getEventType).orElse(null); }

Target:
public EventType getEventType(final String name) throws NoSuchEventTypeException, InternalNakadiException { return getCached(name).map(CachedValue::getEventType) .orElseThrow(() -> new NoSuchEventTypeException("Event type " + name + " does not exists")); }
Source:
boolean systemConditionsAvailable() { if (ActivityLifecycleHandler.curActivity == null) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver curActivity null"); return false; } try { if (isDialogFragmentShowing(ActivityLifecycleHandler.curActivity)) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver dialog fragment detected"); return false; } } catch (NoClassDefFoundError exception) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.ERROR, "isDialogFragmentShowing AppCompatActivity not imported either used: " + exception); } boolean keyboardUp = OSViewUtils.isKeyboardUp(new WeakReference<>(ActivityLifecycleHandler.curActivity)); if (keyboardUp) { ActivityLifecycleHandler.setSystemConditionObserver(TAG, systemConditionObserver); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver keyboard up detected"); } return !keyboardUp; }

Target:
boolean systemConditionsAvailable() { if (ActivityLifecycleHandler.curActivity == null) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver curActivity null"); return false; } try { if (isDialogFragmentShowing(ActivityLifecycleHandler.curActivity)) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver dialog fragment detected"); return false; } } catch (NoClassDefFoundError exception) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.INFO, "AppCompatActivity is not used in this app, skipping 'isDialogFragmentShowing' check: " + exception); } boolean keyboardUp = OSViewUtils.isKeyboardUp(new WeakReference<>(ActivityLifecycleHandler.curActivity)); if (keyboardUp) { ActivityLifecycleHandler.setSystemConditionObserver(TAG, systemConditionObserver); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver keyboard up detected"); } return !keyboardUp; }
Source:
public WebSocketMessagesViewPayloadFilterVo getPayloadFilter() { if (payloadFilter != null) { return payloadFilter; } return null; }

Target:
public WebSocketMessagesPayloadFilter getPayloadFilter() { return payloadFilter; }
Source:
@Override public void sourceConfInit(FlowProcess<JobConf> fp, Tap<JobConf, RecordReader, OutputCollector> tap, JobConf conf) { MultiInputFormat.setClassConf(byte[].class, conf); if (conf.getBoolean(DelegateCombineFileInputFormat.USE_COMBINED_INPUT_FORMAT, false)) { DeprecatedInputFormatWrapper.setInputFormat(DelegateCombineFileInputFormat.class, conf); DelegateCombineFileInputFormat.setCombinedInputFormatDelegate(conf, MultiInputFormat.class); } else { DeprecatedInputFormatWrapper.setInputFormat(MultiInputFormat.class, conf); } }

Target:
@Override public void sourceConfInit(FlowProcess<JobConf> fp, Tap<JobConf, RecordReader, OutputCollector> tap, JobConf conf) { MultiInputFormat.setClassConf(byte[].class, conf); DelegateCombineFileInputFormat.setDelegateInputFormat(conf, MultiInputFormat.class); }
Source:
public void testSlotAllocationTimeout() throws Exception { final CompletableFuture<Void> secondSlotRequestFuture = new CompletableFuture<>(); final AtomicInteger slotRequestsCount = new AtomicInteger(); final TaskExecutorConnection taskManagerConnection = createTaskExecutorConnection(new TestingTaskExecutorGatewayBuilder() .setRequestSlotFunction(ignored -> { if (slotRequestsCount.getAndAdd(1) == 1) { secondSlotRequestFuture.complete(null); } else { return FutureUtils.completedExceptionally(new AskTimeoutException("timeout")); } return new CompletableFuture<>(); }) .createTestingTaskExecutorGateway()); final SlotReport slotReport = createSlotReport(taskManagerConnection.getResourceID(), 2); final Executor mainThreadExecutor = TestingUtils.defaultExecutor(); try (DeclarativeSlotManager slotManager = createDeclarativeSlotManagerBuilder() .build()) { slotManager.start(ResourceManagerId.generate(), mainThreadExecutor, new TestingResourceActionsBuilder().build()); CompletableFuture.runAsync(() -> slotManager.registerTaskManager(taskManagerConnection, slotReport), mainThreadExecutor) .thenRun(() -> slotManager.processResourceRequirements(createResourceRequirementsForSingleSlot())) .get(5, TimeUnit.SECONDS); secondSlotRequestFuture.get(); } }

Target:
public void testSlotAllocationTimeout() throws Exception { final CompletableFuture<Void> secondSlotRequestFuture = new CompletableFuture<>(); final BlockingQueue<Supplier<CompletableFuture<Acknowledge>>> responseQueue = new ArrayBlockingQueue<>(2); responseQueue.add(() -> FutureUtils.completedExceptionally(new AskTimeoutException("timeout"))); responseQueue.add(() -> { secondSlotRequestFuture.complete(null); return new CompletableFuture<>(); }); final TaskExecutorConnection taskManagerConnection = createTaskExecutorConnection(new TestingTaskExecutorGatewayBuilder() .setRequestSlotFunction(ignored -> responseQueue.remove().get()) .createTestingTaskExecutorGateway()); final SlotReport slotReport = createSlotReport(taskManagerConnection.getResourceID(), 2); final Executor mainThreadExecutor = TestingUtils.defaultExecutor(); try (DeclarativeSlotManager slotManager = createDeclarativeSlotManagerBuilder() .build()) { slotManager.start(ResourceManagerId.generate(), mainThreadExecutor, new TestingResourceActionsBuilder().build()); CompletableFuture.runAsync(() -> slotManager.registerTaskManager(taskManagerConnection, slotReport), mainThreadExecutor) .thenRun(() -> slotManager.processResourceRequirements(createResourceRequirementsForSingleSlot())) .get(5, TimeUnit.SECONDS); secondSlotRequestFuture.get(); } }
Source:
public static ConfigDef enrich(ConfigDef baseConfigDef, Map<String, String> props, AbstractConfig defaultGroupConfig) { List<Object> topicCreationGroups = new ArrayList<>(); Object aliases = ConfigDef.parseType(TOPIC_CREATION_GROUPS_CONFIG, props.get(TOPIC_CREATION_GROUPS_CONFIG), ConfigDef.Type.LIST); if (aliases instanceof List) { topicCreationGroups.addAll((List<?>) aliases); } ConfigDef newDef = new ConfigDef(baseConfigDef); String defaultGroupPrefix = TOPIC_CREATION_PREFIX + DEFAULT_TOPIC_CREATION_GROUP + "."; topicCreationGroups.stream().distinct().forEach(group -> { if (!(group instanceof String)) { throw new ConfigException("Item in " + TOPIC_CREATION_GROUPS_CONFIG + " property is not of type String"); } String alias = (String) group; String prefix = TOPIC_CREATION_PREFIX + alias + "."; String configGroup = TOPIC_CREATION_GROUP + ": " + alias; newDef.embed(prefix, configGroup, 0, TopicCreationConfig.configDef( configGroup, defaultGroupConfig.getShort(defaultGroupPrefix + REPLICATION_FACTOR_CONFIG), defaultGroupConfig.getInt(defaultGroupPrefix + PARTITIONS_CONFIG))); }); return newDef; }

Target:
public static ConfigDef enrich(ConfigDef baseConfigDef, Map<String, String> props, AbstractConfig defaultGroupConfig) { List<Object> topicCreationGroups = new ArrayList<>(); Object aliases = ConfigDef.parseType(TOPIC_CREATION_GROUPS_CONFIG, props.get(TOPIC_CREATION_GROUPS_CONFIG), ConfigDef.Type.LIST); if (aliases instanceof List) { topicCreationGroups.addAll((List<?>) aliases); } ConfigDef newDef = new ConfigDef(baseConfigDef); String defaultGroupPrefix = TOPIC_CREATION_PREFIX + DEFAULT_TOPIC_CREATION_GROUP + "."; short defaultGroupReplicationFactor = defaultGroupConfig.getShort(defaultGroupPrefix + REPLICATION_FACTOR_CONFIG); int defaultGroupPartitions = defaultGroupConfig.getInt(defaultGroupPrefix + PARTITIONS_CONFIG); topicCreationGroups.stream().distinct().forEach(group -> { if (!(group instanceof String)) { throw new ConfigException("Item in " + TOPIC_CREATION_GROUPS_CONFIG + " property is not of type String"); } String alias = (String) group; String prefix = TOPIC_CREATION_PREFIX + alias + "."; String configGroup = TOPIC_CREATION_GROUP + ": " + alias; newDef.embed(prefix, configGroup, 0, TopicCreationConfig.configDef(configGroup, defaultGroupReplicationFactor, defaultGroupPartitions)); }); return newDef; }
Source:
protected void createTableWidget(final EObject sourceElement, final EStructuralFeature feature, final Collection<?> rows){ final Table table = createTable(sourceElement, feature, rows); if (table == null) { displayError("Cannot initialize the table"); return; } nattableManager = NattableModelManagerFactory.INSTANCE.createNatTableModelManager(table, new EObjectSelectionExtractor()); natTableWidget = nattableManager.createNattable(self, SWT.NONE, null); if (nattableManager instanceof TreeNattableModelManager) { ((TreeNattableModelManager) nattableManager).doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null); } self.addDisposeListener(getDisposeListener()); natTableWidget.setBackground(self.getBackground()); final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); int headerHeight = natTableWidget.getPreferredHeight() - nattableManager.getBodyLayerStack().getRowHideShowLayer().getPreferredHeight(); int bodyHeight = nattableManager.getBodyLayerStack().getRowHideShowLayer().getHeight(); int extra = 20; data.minimumHeight = headerHeight + bodyHeight + extra; self.setLayoutData(data); self.layout(); natTableWidget.layout(); }

Target:
protected void createTableWidget(final EObject sourceElement, final EStructuralFeature feature, final Collection<?> rows) { final Table table = createTable(sourceElement, feature, rows); if (table == null) { displayError("Cannot initialize the table"); return; } nattableManager = NattableModelManagerFactory.INSTANCE.createNatTableModelManager(table, new EObjectSelectionExtractor()); natTableWidget = nattableManager.createNattable(self, SWT.NONE, null); if (nattableManager instanceof TreeNattableModelManager) { configureTreeTable((TreeNattableModelManager) nattableManager, sourceElement, feature, rows); ((TreeNattableModelManager) nattableManager).doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null); } self.addDisposeListener(getDisposeListener()); natTableWidget.setBackground(self.getBackground()); configureLayout(); }
Source:
public CompletableFuture<List<Player>> getPlayerObjectsById(@NotNull String id) { System.out.println(id); return fafService.getPlayersByIds(Collections.singletonList(Integer.parseInt(id))); }

Target:
public CompletableFuture<List<Player>> getPlayerObjectsById(@NotNull String id) { return fafService.getPlayersByIds(Collections.singletonList(Integer.parseInt(id))); }
Source:
protected abstract void addResource(XAResource resource, URI uri) throws SystemException; protected abstract void removeResource(XAResource resource) throws XAException; protected abstract void resourceInDoubt(XAResource resource); protected XAResource reloadInDoubtResource(URI uri, String nodeName) { return new SubordinateXAResource(uri, nodeName, this); }

Target:
protected abstract void addResource(XAResource resource, URI uri) throws SystemException; protected abstract void removeResource(XAResource resource) throws XAException; protected abstract void resourceInDoubt(XAResource resource); protected XAResource reloadInDoubtResource(URI uri, String nodeName) { return new SubordinateXAResource(uri, nodeName, FL_COMMITTED | FL_CONFIRMED, this); }
Source:
public String cropOverflowString( String text, IStyle style, String fontFamily, int cellWidth ) { Font font = new Font( fontFamily, Font.PLAIN, WordUtil.parseFontSize( PropertyUtil .getDimensionValue( style.getProperty( StyleConstants.STYLE_FONT_SIZE ) ) ) ); Canvas c = new Canvas( ); FontMetrics fm = c.getFontMetrics( font ); int cellWidthInPointAdv = (cellWidth * (int) WordUtil.PT_TWIPS - 27) / 11; StringBuilder sb = new StringBuilder( text.length( ) + 1 ); int wordEnd = -1; do { wordEnd = text.indexOf( SPACE ); if ( wordEnd != -1 ) { String word = text.substring( 0, wordEnd ); word = cropOverflowWord( word, fm, cellWidthInPointAdv ); sb.append( word ); sb.append( SPACE ); text = text.substring( wordEnd + 1 ); } } while ( wordEnd != -1 && !EMPTY_STRING.equals( text ) ); sb.append( cropOverflowWord( text, fm, cellWidthInPointAdv ) ); return sb.toString( ); }

Target:
public String cropOverflowString( String text, IStyle style, String fontFamily, int cellWidth ) { Font font = new Font( fontFamily, Font.PLAIN, WordUtil.parseFontSize( PropertyUtil.getDimensionValue( style .getProperty( StyleConstants.STYLE_FONT_SIZE ) ) ) ); Canvas c = new Canvas( ); FontMetrics fm = c.getFontMetrics( font ); int cellWidthInPointAdv = ( cellWidth * (int) WordUtil.PT_TWIPS - 27 ) / 11; StringBuilder sb = new StringBuilder( text.length( ) + 1 ); int wordEnd = INDEX_NOTFOUND; do { wordEnd = text.indexOf( SPACE ); if ( wordEnd != INDEX_NOTFOUND ) { String word = text.substring( 0, wordEnd ); word = cropOverflowWord( word, fm, cellWidthInPointAdv ); sb.append( word ); sb.append( SPACE ); text = text.substring( wordEnd + 1 ); } } while ( wordEnd != INDEX_NOTFOUND && !EMPTY_STRING.equals( text ) ); sb.append( cropOverflowWord( text, fm, cellWidthInPointAdv ) ); return sb.toString( ); }
Source:
public byte[] put(ByteBuffer key, byte[] value) { numBytes.addAndGet(key.remaining() + value.length); if (numBytes.get() > sizeInBytes) { Iterator<Map.Entry<ByteBuffer, byte[]>> it = entrySet().iterator(); while (numBytes.get() > sizeInBytes && it.hasNext()) { evictionCount.incrementAndGet(); if (logEvictions && evictionCount.get() % logEvictionCount == 0) { log.info( "Evicting %,dth element. Size[%,d], numBytes[%,d], averageSize[%,d]", evictionCount, size(), numBytes.get(), numBytes.get() / size() ); } Map.Entry<ByteBuffer, byte[]> next = it.next(); long entrySize = next.getKey().remaining() + next.getValue().length; numBytes.addAndGet(-entrySize); it.remove(); } } return super.put(key, value); }

Target:
public byte[] put(ByteBuffer key, byte[] value) { numBytes.addAndGet(key.remaining() + value.length); Iterator<Map.Entry<ByteBuffer, byte[]>> it = entrySet().iterator(); List<ByteBuffer> keysToRemove = new ArrayList<>(); long totalEvictionSize = 0L; while (numBytes.get() - totalEvictionSize > sizeInBytes && it.hasNext()) { evictionCount.incrementAndGet(); if (logEvictions && evictionCount.get() % logEvictionCount == 0) { log.info( "Evicting %,dth element. Size[%,d], numBytes[%,d], averageSize[%,d]", evictionCount, size(), numBytes.get(), numBytes.get() / size() ); } Map.Entry<ByteBuffer, byte[]> next = it.next(); totalEvictionSize += next.getKey().remaining() + next.getValue().length; keysToRemove.add(next.getKey()); } for (ByteBuffer keyToRemove : keysToRemove) { remove(keyToRemove); } return super.put(key, value); }
Source:
public String getAuthMethod() { return "DDF"; }

Target:
public String getAuthMethod() { return DDF_AUTH_METHOD; }
Source:
ProgressManager() { Dialog.setBlockedHandler(new WorkbenchDialogBlockedHandler()); setUpImages(); changeListener = createChangeListener(); notificationListener = createNotificationListener(); Job.getJobManager().setProgressProvider(this); Job.getJobManager().addJobChangeListener(this.changeListener); StatusManager.getManager().addListener(notificationListener); display = PlatformUI.getWorkbench().getDisplay(); refreshJobs = new Throttler(display, Duration.ofMillis(100), () -> { Iterator<JobInfo> iterator = pendingJobUpdates.iterator(); while (iterator.hasNext()) { JobInfo info = iterator.next(); if (!pendingJobUpdates.remove(info)) { return; } GroupInfo group = info.getGroupInfo(); if (group != null) { doRefreshGroup(group); } Object[] listenersArray = listeners.getListeners(); for (int i = 0; i < listenersArray.length; i++) { IJobProgressManagerListener listener = (IJobProgressManagerListener) listenersArray[i]; if (!isCurrentDisplaying(info.getJob(), listener.showsDebug())) { listener.refreshJobInfo(info); } } } }); refreshGroups = new Throttler(display, Duration.ofMillis(100), () -> { Iterator<GroupInfo> iterator = pendingGroupUpdates.iterator(); while (iterator.hasNext()) { GroupInfo groupInfo = iterator.next(); if (!pendingGroupUpdates.remove(groupInfo)) { return; } doRefreshGroup(groupInfo); } }); }

Target:
ProgressManager() { Dialog.setBlockedHandler(new WorkbenchDialogBlockedHandler()); setUpImages(); changeListener = createChangeListener(); notificationListener = createNotificationListener(); Job.getJobManager().setProgressProvider(this); Job.getJobManager().addJobChangeListener(this.changeListener); StatusManager.getManager().addListener(notificationListener); display = PlatformUI.getWorkbench().getDisplay(); uiRefreshThrottler = new Throttler(display, Duration.ofMillis(100), () -> { Iterator<JobInfo> jobUpdatesIterator = pendingJobUpdates.iterator(); while (jobUpdatesIterator.hasNext()) { JobInfo info = jobUpdatesIterator.next(); if (!pendingJobUpdates.remove(info)) { continue; } GroupInfo group = info.getGroupInfo(); if (group != null) { pendingGroupUpdates.remove(group); doRefreshGroup(group); } Object[] listenersArray = listeners.getListeners(); for (int i = 0; i < listenersArray.length; i++) { IJobProgressManagerListener listener = (IJobProgressManagerListener) listenersArray[i]; if (!isCurrentDisplaying(info.getJob(), listener.showsDebug())) { listener.refreshJobInfo(info); } } } Iterator<GroupInfo> groupUpdatesIterator = pendingGroupUpdates.iterator(); while (groupUpdatesIterator.hasNext()) { GroupInfo groupInfo = groupUpdatesIterator.next(); if (!pendingGroupUpdates.remove(groupInfo)) { continue; } doRefreshGroup(groupInfo); } }); }
Source:
public boolean isDirectory () { if (type == FileType.Classpath) return false; if (type == FileType.Internal) { for (String indexpath : assetIndex()) { if (indexpath == path() + "/") return true; } } return file().isDirectory(); }

Target:
public boolean isDirectory () { if (type == FileType.Classpath) return false; if (type == FileType.Internal) { if (assetIndex.size == 0) loadAssetIndex(); if (assetIndex.get(path()) != null) return true; } return file().isDirectory(); }
Source:
private Optional<ConstrainedTerm> addStuckFlagIfNotThere(ConstrainedTerm subject) { Optional<K> theStrategy = ((KApply) subject.term()).klist().stream() .filter(t -> t instanceof KApply && ((KApply) t).klabel().name().contains(" ")) .findFirst(); if (!theStrategy.isPresent()) return Optional.empty(); KApply topOfStrategyCell = (KApply) ((KApply) theStrategy.get()).klist().items().get(0); if (topOfStrategyCell.klabel().name().equals("#sseq")) { topOfStrategyCell = (KApply) topOfStrategyCell.klist().items().get(0); } boolean isStuck = topOfStrategyCell.klabel().name().equals(Att.stuck()); if (isStuck) { return Optional.empty(); } Att emptyAtt = Att.apply(); K stuck = constructor.KApply1(constructor.KLabel(Att.stuck()), constructor.KList(), emptyAtt); List<K> items = new LinkedList<K>(((KApply) theStrategy.get()).klist().items()); items.add(0, stuck); K sContent = constructor.KApply1(constructor.KLabel("#sseq"), constructor.KList(items), emptyAtt); K s = constructor.KApply1(((KApply) theStrategy.get()).klabel(), constructor.KList(sContent), emptyAtt); K entireConf = constructor.KApply1(((KApply) subject.term()).klabel(), constructor.KList(((KApply) subject.term()).klist().stream().map(k -> k instanceof KApply && ((KApply) k).klabel().name().contains(" ") ? s : k).collect(Collectors.toList())), emptyAtt); return Optional.of(new ConstrainedTerm((Term) entireConf, subject.termContext())); }

Target:
private Optional<ConstrainedTerm> addStuckFlagIfNotThere(ConstrainedTerm subject) { Optional<K> theStrategy = ((KApply) subject.term()).klist().stream() .filter(t -> t instanceof KApply && ((KApply) t).klabel().name().contains(Strategy.strategyCellName())) .findFirst(); if (!theStrategy.isPresent()) return Optional.empty(); K topOfStrategyCell = ((KApply) theStrategy.get()).klist().items().get(0); if ((topOfStrategyCell instanceof KApply) && ((KApply) topOfStrategyCell).klabel().name().equals(KLabels.KSEQ)) { topOfStrategyCell = ((KApply) topOfStrategyCell).klist().items().get(0); } boolean isStuck = !(topOfStrategyCell instanceof KApply) || ((KApply) topOfStrategyCell).klabel().name().equals(Att.stuck()); if (isStuck) { return Optional.empty(); } Att emptyAtt = Att.apply(); K stuck = constructor.KApply1(constructor.KLabel(Att.stuck()), constructor.KList(), emptyAtt); List<K> items = new LinkedList<K>(((KApply) theStrategy.get()).klist().items()); items.add(0, stuck); K sContent = constructor.KApply1(constructor.KLabel(KLabels.KSEQ), constructor.KList(items), emptyAtt); K s = constructor.KApply1(((KApply) theStrategy.get()).klabel(), constructor.KList(sContent), emptyAtt); K entireConf = constructor.KApply1(((KApply) subject.term()).klabel(), constructor.KList(((KApply) subject.term()).klist().stream().map(k -> k instanceof KApply && ((KApply) k).klabel().name().contains(Strategy.strategyCellName()) ? s : k).collect(Collectors.toList())), emptyAtt); return Optional.of(new ConstrainedTerm((Term) entireConf, subject.termContext())); }
Source:
public Tuple<Table> table(final String tableName, HiveConf conf) throws HiveException { boolean getColStats = !conf.getBoolVar(HiveConf.ConfVars.REPL_DUMP_METADATA_ONLY); return new Tuple<>(functionForSpec, () -> db.getTable(dbName, tableName, false, false, getColStats)); }

Target:
public Tuple<Table> table(final String tableName, HiveConf conf) throws HiveException { boolean getColStats = !conf.getBoolVar(HiveConf.ConfVars.REPL_DUMP_METADATA_ONLY); return new Tuple<>(functionForSpec, () -> db.getTable(dbName, tableName, true, false, getColStats)); }
Source:
protected void executeVmCommand() { if (getVm().getStatus() == VMStatus.Up || getVm().getStatus() == VMStatus.Paused) { performPlugCommand(getPlugAction(), disk, oldVmDevice); } final List<VmDevice> devices = VmDeviceUtils.updateBootOrderInVmDevice(getVm().getStaticData()); for (VmDevice device:devices) { if (device.getDeviceId().equals(oldVmDevice.getDeviceId())) { device.setIsPlugged(!oldVmDevice.getIsPlugged()); break; } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); getVmDeviceDao().updateAll("UpdateVmDeviceForHotPlugDisk", devices); VmHandler.updateDisksFromDb(getVm()); return null; } }); setSucceeded(true); }

Target:
protected void executeVmCommand() { if (getVm().getStatus().isUpOrPaused()) { performPlugCommand(getPlugAction(), disk, oldVmDevice); } final List<VmDevice> devices = VmDeviceUtils.updateBootOrderInVmDevice(getVm().getStaticData()); for (VmDevice device:devices) { if (device.getDeviceId().equals(oldVmDevice.getDeviceId())) { device.setIsPlugged(!oldVmDevice.getIsPlugged()); break; } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); getVmDeviceDao().updateAll("UpdateVmDeviceForHotPlugDisk", devices); VmHandler.updateDisksFromDb(getVm()); return null; } }); setSucceeded(true); }
Source:
private void updateChangeset() { changesetLabel.setText(tr("{0} Images changed", MapillaryLayer.hasInstance() ? MapillaryLayer.getInstance().getLocationChangeset().size() : 0)); submitButton.setEnabled(!isUploadPending && MapillaryLayer.hasInstance() && !MapillaryLayer.getInstance().getLocationChangeset().isEmpty()); uploadProgress.setVisible(isUploadPending); }

Target:
private void updateChangeset() { int imgChanged = MapillaryLayer.hasInstance() ? MapillaryLayer.getInstance().getLocationChangeset().size() : 0; changesetLabel.setText(trn("{0} Image changed", "{0} Images changed", imgChanged, imgChanged)); submitButton.setEnabled(!isUploadPending && MapillaryLayer.hasInstance() && !MapillaryLayer.getInstance().getLocationChangeset().isEmpty()); uploadProgress.setVisible(isUploadPending); }
Source:
private static void getSegmentNameValue(ITmfEvent event, StringBuilder builder, ITmfXmlStateValue xmlStateValue) { ITmfStateValue value; try { value = xmlStateValue.getValue(event); switch (value.getType()) { case DOUBLE: builder.append(value.unboxDouble()); break; case INTEGER: builder.append(value.unboxInt()); break; case LONG: builder.append(value.unboxLong()); break; case NULL: builder.append(UNKNOWN_STRING); break; case STRING: builder.append(value.unboxStr()); break; default: throw new StateValueTypeException(); } } catch (AttributeNotFoundException e) { Activator.logInfo("Impossible to get the state value", e); } }

Target:
private static void getSegmentNameValue(ITmfEvent event, StringBuilder builder, ITmfXmlStateValue xmlStateValue) { try { ITmfStateValue value; value = xmlStateValue.getValue(event); switch (value.getType()) { case DOUBLE: builder.append(value.unboxDouble()); break; case INTEGER: builder.append(value.unboxInt()); break; case LONG: builder.append(value.unboxLong()); break; case NULL: builder.append(UNKNOWN_STRING); break; case STRING: builder.append(value.unboxStr()); break; default: throw new StateValueTypeException(); } } catch (AttributeNotFoundException e) { Activator.logInfo("Impossible to get the state value", e); } }
Source:
public void run() { if (true == ServiceStateHelper.getInstance(mContext).isLoggedIn()) { ConnectivityManager connManager = (ConnectivityManager) mContext .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) || wifi.isConnected()) { if ((SystemClock.elapsedRealtime() - mLastTxTime >= mTxInterval)) { transmissionService(); } } else { long interval = mTxInterval; SharedPreferences mainPrefs = mContext.getSharedPreferences(SensePrefs.MAIN_PREFS, Context.MODE_PRIVATE); if(mainPrefs.getBoolean(Advanced.MOBILE_INTERNET_ENERGY_SAVING_MODE, true)) interval = ADAPTIVE_TX_INTERVAL; mLastTxBytes = TrafficStats.getMobileTxBytes() - mTxBytes; mTxBytes = TrafficStats.getMobileTxBytes(); if ((SystemClock.elapsedRealtime() - mLastTxTime >= interval)) { transmissionService(); } else if (ADAPTIVE_TX_INTERVAL == interval && (mLastTxBytes >= 500) && (SystemClock.elapsedRealtime() - mLastTxTime >= interval - (long) (interval * 0.2))) { transmissionService(); } else { } } } else { } }

Target:
public void run() { if (true == ServiceStateHelper.getInstance(mContext).isLoggedIn()) { ConnectivityManager connManager = (ConnectivityManager) mContext .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) || wifi.isConnected()) { if ((SystemClock.elapsedRealtime() - mLastTxTime >= mTxInterval)) { transmissionService(); } } else { long interval = mTxInterval; SharedPreferences mainPrefs = mContext.getSharedPreferences(SensePrefs.MAIN_PREFS, Context.MODE_PRIVATE); boolean energy_saving = mainPrefs.getBoolean(Advanced.MOBILE_INTERNET_ENERGY_SAVING_MODE, true); if(energy_saving) interval = ADAPTIVE_TX_INTERVAL; mLastTxBytes = TrafficStats.getMobileTxBytes() - mTxBytes; mTxBytes = TrafficStats.getMobileTxBytes(); if ((SystemClock.elapsedRealtime() - mLastTxTime >= interval)) { transmissionService(); } else if (energy_saving && (mLastTxBytes >= 500) && (SystemClock.elapsedRealtime() - mLastTxTime >= ADAPTIVE_TX_INTERVAL - (long) (ADAPTIVE_TX_INTERVAL * 0.2))) { transmissionService(); } else { } } } else { } }
Source:
public static void propagateIfFatal(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException)throwable); }

Target:
public static void propagateIfFatal(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException)throwable); if (throwable instanceof Error) throw (Error) throwable; }
Source:
private void onCustomPreview() { VM vm = getEntity(); PreviewSnapshotModel previewSnapshotModel = (PreviewSnapshotModel) getWindow(); Snapshot snapshot = previewSnapshotModel.getSnapshotModel().getEntity(); boolean memory = Boolean.TRUE.equals(previewSnapshotModel.getSnapshotModel().getMemory().getEntity()); List<DiskImage> disks = previewSnapshotModel.getSelectedDisks(); Set<Guid> diskImages = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); runTryBackToAllSnapshotsOfVm(previewSnapshotModel, vm, snapshot, memory, diskImages); }

Target:
private void onCustomPreview() { VM vm = getEntity(); PreviewSnapshotModel previewSnapshotModel = (PreviewSnapshotModel) getWindow(); Snapshot snapshot = previewSnapshotModel.getSnapshotModel().getEntity(); boolean memory = Boolean.TRUE.equals(previewSnapshotModel.getSnapshotModel().getMemory().getEntity()); List<DiskImage> disks = previewSnapshotModel.getSelectedDisks(); Set<Guid> diskIds = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); runTryBackToAllSnapshotsOfVm(previewSnapshotModel, vm, snapshot, memory, diskIds); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpSession session = httpRequest.getSession(); if (!isFilteredRequest(httpRequest)) { chain.doFilter(request, response); return; } synchronized (getSynchronizationObject(session)) { if (isRequestInProcess(session)) { enqueueRequest(httpRequest); if (!waitForRelease(httpRequest)) { return; } } setRequestInProgress(httpRequest); } try { chain.doFilter(request, response); } catch (LazyInitializationException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung(Helper.getTranslation("aLazyInitializationErrorOcurred")); } finally { releaseQueuedRequest(httpRequest); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpSession session = httpRequest.getSession(); if (!isFilteredRequest(httpRequest)) { chain.doFilter(request, response); return; } synchronized (getSynchronizationObject(session)) { if (isRequestInProcess(session)) { enqueueRequest(httpRequest); if (!waitForRelease(httpRequest)) { return; } } setRequestInProgress(httpRequest); } try { chain.doFilter(request, response); } catch (LazyInitializationException e) { Helper.setErrorMessage(Helper.getTranslation("aLazyInitializationErrorOcurred"), logger, e); } finally { releaseQueuedRequest(httpRequest); } }
Source:
private static boolean isUsedInLhsOfCompoundAssignment(Tree tree) { CompoundAssignmentStatement compoundAssignmentStatement = ((CompoundAssignmentStatement) TreeUtils.firstAncestorOfKind(tree, COMPOUND_ASSIGNMENT)); if (compoundAssignmentStatement == null) { return false; } return isAccessingExpression(compoundAssignmentStatement.lhsExpression(), tree); }

Target:
private static boolean isUsedInLhsOfCompoundAssignment(Tree tree) { CompoundAssignmentStatement compoundAssignmentStatement = ((CompoundAssignmentStatement) TreeUtils.firstAncestorOfKind(tree, COMPOUND_ASSIGNMENT)); return compoundAssignmentStatement != null && isAccessingExpression(compoundAssignmentStatement.lhsExpression(), tree); }
Source:
public void Execute(Campaign campaign, Unit unit) { if (isGM) { unit.startMothballing(null, true); } else { if (!unit.isSelfCrewed() && (null == techId)) { return; } unit.startMothballing(campaign.getPerson(techId)); } }

Target:
public void Execute(Campaign campaign, Unit unit) { if (isGM) { unit.startMothballing(null, true); } else { if (!unit.isSelfCrewed() && (null == tech)) { return; } unit.startMothballing(tech); } }
Source:
public static String grpcAwareErrorMessage(IOException e) { io.grpc.Status errStatus = io.grpc.Status.fromThrowable(e); if (errStatus != null) { return String.format("%s: %s", errStatus.getCode().name(), errStatus.getDescription()); } return e.getMessage(); }

Target:
public static String grpcAwareErrorMessage(IOException e) { io.grpc.Status errStatus = io.grpc.Status.fromThrowable(e); if (!errStatus.getCode().equals(io.grpc.Status.UNKNOWN.getCode())) { return String.format("%s: %s", errStatus.getCode().name(), errStatus.getDescription()); } return e.getMessage(); }
Source:
public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Resource resource, Group group, boolean withGroupAttributes) throws GroupResourceMismatchException { this.checkGroupIsFromTheSameVoLikeResource(sess, group, resource); List<Attribute> attributes = new ArrayList<>(); attributes.addAll(getAttributesManagerImpl().getRequiredAttributes(sess, services, resource, group)); if (withGroupAttributes) { attributes.addAll(getAttributesManagerImpl().getRequiredAttributes(sess, services, group)); } return attributes; }

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Resource resource, Group group, boolean withGroupAttributes) throws GroupResourceMismatchException { this.checkGroupIsFromTheSameVoLikeResource(sess, group, resource); List<Attribute> attributes = getAttributesManagerImpl().getRequiredAttributes(sess, services, resource, group); if (withGroupAttributes) { attributes.addAll(getAttributesManagerImpl().getRequiredAttributes(sess, services, group)); } return attributes; }
Source:
public QueryBuilder fromBranch(String branchGuid) throws OseeCoreException { return fromBranch(TokenFactory.createBranch(branchGuid, "fromQueryFactory")); }

Target:
public QueryBuilder fromBranch(String branchGuid) throws OseeCoreException { return fromBranch(TokenFactory.createBranch(branchGuid, String.format("N/A>%s:%s", getClass().getSimpleName(), "fromBranch"))); }
Source:
public void addTargetExtension(String name, String extension) { targetExtensions.add(Pair.of(name, extension)); }

Target:
public void addTargetExtension(String name, String extension) { targetExtensions.add(newTargetExtension(name, extension)); }
Source:
private boolean titlesEqual(String subjectTitle, String candidateTitle) { return false && subjectTitle.equals(candidateTitle); }

Target:
private boolean titlesEqual(String subjectTitle, String candidateTitle) { return subjectTitle.equals(candidateTitle); }
Source:
protected PairSupplier<Q, E> getPairSupplier(){ if (endpointProvider == null){ throw new NullPointerException("Init endpoint provider!"); } if (pairSupplier == null){ pairSupplier = pairSupplierFactory.create(queryProvider, endpointProvider); } return pairSupplier; }

Target:
protected PairSupplier<Q, E> getPairSupplier(){ if (endpointProvider == null){ throw new NullPointerException("Init endpoint provider!"); } if (queryProvider == null) { logger.warn("Query provider is null!"); } if (pairSupplier == null){ pairSupplier = pairSupplierFactory.create(queryProvider, endpointProvider); } return pairSupplier; }
Source:
public int getNextNewUserBrickId(String text) { int id = 1; boolean newIdFound = false; while (!newIdFound) { newIdFound = true; for (UserBrick userBrick : userBricks) { if (userBrick.getDefinitionBrick().getName().equals(text + id)) { newIdFound = false; id++; break; } } } return id; }

Target:
public int getNextNewUserBrickId(String text) { int id = 1; boolean newIdFound = false; while (!newIdFound) { newIdFound = true; if (userBrickNameExists(text + id)) { newIdFound = false; id++; } } return id; }
Source:
public void testUploadFindingsPositiveCase() throws Exception { String token = "db975c97-98b1-4988-8d6a-9c3e044dfff3"; String engagementId = "12345"; new MockServerClient("localhost", 1080) .when( request() .withMethod("POST") .withHeader(HttpHeaders.AUTHORIZATION, "Token " + token) .withPath("/defectdojo/api/v2/import-scan") .withBody( params( param("engagement", engagementId) ) ) ) .respond( response() .withStatusCode(201) .withHeader(HttpHeaders.CONTENT_TYPE, "application/json") ); DefectDojoUploader uploader = new DefectDojoUploader(); DefectDojoClient client = new DefectDojoClient(uploader, new URL("https://localhost/defectdojo")); client.uploadDependencyTrackFindings(token, engagementId, new NullInputStream(0)); }

Target:
public void testUploadFindingsPositiveCase() throws Exception { String token = "db975c97-98b1-4988-8d6a-9c3e044dfff3"; String engagementId = "12345"; testClient.when( request() .withMethod("POST") .withHeader(HttpHeaders.AUTHORIZATION, "Token " + token) .withPath("/defectdojo/api/v2/import-scan/") ) .respond( response() .withStatusCode(201) .withHeader(HttpHeaders.CONTENT_TYPE, "application/json") ); DefectDojoUploader uploader = new DefectDojoUploader(); DefectDojoClient client = new DefectDojoClient(uploader, new URL("https://localhost/defectdojo")); client.uploadDependencyTrackFindings(token, engagementId, new NullInputStream(0)); testClient.verify( request() .withMethod("POST") .withPath("/defectdojo/api/v2/import-scan/"), VerificationTimes.exactly(1) ); }
Source:
public VcfReader vcfReader(InputParameters parameters) throws IOException { String fileId = parameters.getVcfId(); String studyId = parameters.getStudyId(); File vcfFile = new File(parameters.getVcf()); if (VariantSource.Aggregation.NONE.equals(parameters.getVcfAggregation())) { return new VcfReader(fileId, studyId, vcfFile); } else { return new AggregatedVcfReader(fileId, studyId, parameters.getVcfAggregation(), parameters.getAggregatedMappingFile(), vcfFile); } }

Target:
public VcfReader vcfReader(InputParameters parameters) throws IOException { String fileId = parameters.getVcfId(); String studyId = parameters.getStudyId(); File vcfFile = new File(parameters.getVcf()); VariantSource.Aggregation vcfAggregation = parameters.getVcfAggregation(); if (VariantSource.Aggregation.NONE.equals(vcfAggregation)) { return new VcfReader(fileId, studyId, vcfFile); } else { return new AggregatedVcfReader(fileId, studyId, vcfAggregation, parameters.getAggregatedMappingFile(), vcfFile); } }