auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private <T> RddAndMore<T> createRdd(SubPlan subPlan, Class<T> outputType) { ImmutableMap.Builder<PlanFragmentId, JavaPairRDD<MutablePartitionId, PrestoSparkMutableRow>> rddInputs = ImmutableMap.builder(); ImmutableMap.Builder<PlanFragmentId, Broadcast<List<PrestoSparkSerializedPage>>> broadcastInputs = ImmutableMap.builder(); ImmutableList.Builder<Broadcast<?>> broadcastDependencies = ImmutableList.builder(); for (SubPlan child : subPlan.getChildren()) { PlanFragment childFragment = child.getFragment(); if (childFragment.getPartitioningScheme().getPartitioning().getHandle().equals(FIXED_BROADCAST_DISTRIBUTION)) { RddAndMore<PrestoSparkSerializedPage> childRdd = createRdd(child, PrestoSparkSerializedPage.class); List<PrestoSparkSerializedPage> broadcastPages = childRdd.collectAndDestroyDependencies().stream() .map(Tuple2::_2) .collect(toList()); Broadcast<List<PrestoSparkSerializedPage>> broadcast = sparkContext.broadcast(broadcastPages); broadcastInputs.put(childFragment.getId(), broadcast); broadcastDependencies.add(broadcast); } else { RddAndMore<PrestoSparkMutableRow> childRdd = createRdd(child, PrestoSparkMutableRow.class); rddInputs.put(childFragment.getId(), childRdd.getRdd()); broadcastDependencies.addAll(childRdd.getBroadcastDependencies()); } } JavaPairRDD<MutablePartitionId, T> rdd = rddFactory.createSparkRdd( sparkContext, session, subPlan.getFragment(), rddInputs.build(), broadcastInputs.build(), executorFactoryProvider, taskStatsCollector, tableWriteInfo, outputType); return new RddAndMore<>(rdd, broadcastDependencies.build()); }

Target:
private <T extends PrestoSparkTaskOutput> RddAndMore<T> createRdd(SubPlan subPlan, Class<T> outputType) { ImmutableMap.Builder<PlanFragmentId, JavaPairRDD<MutablePartitionId, PrestoSparkMutableRow>> rddInputs = ImmutableMap.builder(); ImmutableMap.Builder<PlanFragmentId, Broadcast<List<PrestoSparkSerializedPage>>> broadcastInputs = ImmutableMap.builder(); ImmutableList.Builder<Broadcast<?>> broadcastDependencies = ImmutableList.builder(); for (SubPlan child : subPlan.getChildren()) { PlanFragment childFragment = child.getFragment(); if (childFragment.getPartitioningScheme().getPartitioning().getHandle().equals(FIXED_BROADCAST_DISTRIBUTION)) { RddAndMore<PrestoSparkSerializedPage> childRdd = createRdd(child, PrestoSparkSerializedPage.class); List<PrestoSparkSerializedPage> broadcastPages = childRdd.collectAndDestroyDependencies().stream() .map(Tuple2::_2) .collect(toList()); Broadcast<List<PrestoSparkSerializedPage>> broadcast = sparkContext.broadcast(broadcastPages); broadcastInputs.put(childFragment.getId(), broadcast); broadcastDependencies.add(broadcast); } else { RddAndMore<PrestoSparkMutableRow> childRdd = createRdd(child, PrestoSparkMutableRow.class); rddInputs.put(childFragment.getId(), childRdd.getRdd()); broadcastDependencies.addAll(childRdd.getBroadcastDependencies()); } } JavaPairRDD<MutablePartitionId, T> rdd = rddFactory.createSparkRdd( sparkContext, session, subPlan.getFragment(), rddInputs.build(), broadcastInputs.build(), executorFactoryProvider, taskStatsCollector, tableWriteInfo, outputType); return new RddAndMore<>(rdd, broadcastDependencies.build()); }
Source:
public CreateRequestBuilder metadata(Map<String, Object> metadata) { this.metadata = Collections.unmodifiableMap(metadata); return this; }

Target:
public CreateRequestBuilder metadata(Map<String, Object> metadata) { this.metadata = metadata; return this; }
Source:
public StepContext getNextQueuedContext(boolean inversePrecedence) { if (queuedContexts.size() > 0) { if (!inversePrecedence) { return queuedContexts.remove(0); } else { int newest = 0; int index = 0; int newestIndex = 0; for (StepContext c : queuedContexts) { try { Run<?, ?> run = c.get(Run.class); if (run.getNumber() > newest) { newest = run.getNumber(); newestIndex = index; } } catch (Exception e) { } index++; } return queuedContexts.remove(newestIndex); } } return null; }

Target:
StepContext getNextQueuedContext(boolean inversePrecedence) { if (queuedContexts.size() > 0) { if (!inversePrecedence) { return queuedContexts.remove(0); } else { long newest = 0; int index = 0; int newestIndex = 0; for(Iterator<StepContext> iterator = queuedContexts.iterator(); iterator.hasNext();) { StepContext c = iterator.next(); try { Run<?, ?> run = c.get(Run.class); if (run.getStartTimeInMillis() > newest) { newest = run.getStartTimeInMillis(); newestIndex = index; } } catch (Exception e) { iterator.remove(); LOGGER.log(Level.FINE, "Skipping queued context as it does not hold a Run object", e); } index++; } return queuedContexts.remove(newestIndex); } } return null; }
Source:
public void createControl(Composite parent) { super.createControl(parent); TreeViewer tv = getTreeViewer(); tv.setAutoExpandLevel(2); tv.setContentProvider(new ContentProvider()); tv.setLabelProvider(new LabelProvider()); tv.setInput(mRootWrapper); tv.setComparer(new IElementComparer() { public int hashCode(Object element) { if (element instanceof CanvasViewInfo) { UiViewElementNode key = ((CanvasViewInfo) element).getUiViewKey(); if (key != null) { return key.hashCode(); } } if (element != null) { return element.hashCode(); } return 0; } public boolean equals(Object a, Object b) { if (a instanceof CanvasViewInfo && b instanceof CanvasViewInfo) { UiViewElementNode keyA = ((CanvasViewInfo) a).getUiViewKey(); UiViewElementNode keyB = ((CanvasViewInfo) b).getUiViewKey(); if (keyA != null) { return keyA.equals(keyB); } } if (a != null) { return a.equals(b); } return false; } }); mDragSource = LayoutCanvas.createDragSource(getControl(), new DelegateDragListener()); mDropTarget = LayoutCanvas.createDropTarget(getControl(), new DelegateDropListener()); setupContextMenu(); getSite().getPage().addSelectionListener(this); getControl().addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { dispose(); } }); }

Target:
public void createControl(Composite parent) { super.createControl(parent); TreeViewer tv = getTreeViewer(); tv.setAutoExpandLevel(2); tv.setContentProvider(new ContentProvider()); tv.setLabelProvider(new LabelProvider()); tv.setInput(mRootWrapper); tv.setComparer(new IElementComparer() { public int hashCode(Object element) { if (element instanceof CanvasViewInfo) { UiViewElementNode key = ((CanvasViewInfo) element).getUiViewKey(); if (key != null) { return key.hashCode(); } } if (element != null) { return element.hashCode(); } return 0; } public boolean equals(Object a, Object b) { if (a instanceof CanvasViewInfo && b instanceof CanvasViewInfo) { UiViewElementNode keyA = ((CanvasViewInfo) a).getUiViewKey(); UiViewElementNode keyB = ((CanvasViewInfo) b).getUiViewKey(); if (keyA != null) { return keyA.equals(keyB); } } if (a != null) { return a.equals(b); } return false; } }); mDragSource = LayoutCanvas.createDragSource(getControl(), new DelegateDragListener()); mDropTarget = LayoutCanvas.createDropTarget(getControl(), new DelegateDropListener()); setupContextMenu(); getSite().getPage().addSelectionListener(this); getControl().addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { dispose(); } }); }
Source:
private static String getPropertyName(FeatureState featureState) { String propertyName = featureState.getParameter(PARAM_NAME); if (Strings.isNotBlank(propertyName)) { return propertyName; } Feature feature = featureState.getFeature(); return feature.getClass().getName() + "." + feature.name(); }

Target:
private static String getPropertyName(FeatureState featureState) { String propertyName = featureState.getParameter(PARAM_NAME); if (Strings.isNotBlank(propertyName)) { return propertyName; } return "togglz." + featureState.getFeature().name(); }
Source:
public void loginAsGuest( final AsyncCallback<BackendlessUser> responder, final boolean stayLoggedIn ) { if( !currentUser.getProperties().isEmpty() ) logout( new AsyncCallback<Void>() { @Override public void handleResponse( Void response ) { loginAsGuest( responder, stayLoggedIn ); } @Override public void handleFault( BackendlessFault fault ) { if( responder != null ) responder.handleFault( fault ); } } ); else try { synchronized( currentUserLock ) { Invoker.invokeAsync( USER_MANAGER_SERVER_ALIAS, "loginAsGuest", new Object[] { }, getUserLoginAsyncHandler( responder, stayLoggedIn ) , new AdaptingResponder( BackendlessUser.class, new BackendlessUserAdaptingPolicy() ) ); } } catch( Throwable e ) { if( responder != null ) responder.handleFault( new BackendlessFault( e ) ); } }

Target:
public void loginAsGuest( final AsyncCallback<BackendlessUser> responder, final boolean stayLoggedIn ) { if( currentUser != null && !currentUser.getProperties().isEmpty() ) logout( new AsyncCallback<Void>() { @Override public void handleResponse( Void response ) { loginAsGuest( responder, stayLoggedIn ); } @Override public void handleFault( BackendlessFault fault ) { if( responder != null ) responder.handleFault( fault ); } } ); else try { synchronized( currentUserLock ) { Invoker.invokeAsync( USER_MANAGER_SERVER_ALIAS, "loginAsGuest", new Object[] { }, getUserLoginAsyncHandler( responder, stayLoggedIn ) , new AdaptingResponder( BackendlessUser.class, new BackendlessUserAdaptingPolicy() ) ); } } catch( Throwable e ) { if( responder != null ) responder.handleFault( new BackendlessFault( e ) ); } }
Source:
private String[] getNodeList() throws Exception { if(hcc != null) { Map<String, NodeControllerInfo> nodeControllerInfos = hcc.getNodeControllerInfos(); String[] nodeList = new String[nodeControllerInfos.size()]; int index = 0; for (String node : nodeControllerInfos.keySet()) { nodeList[index++] = node; } return nodeList; } return new String[0]; }

Target:
private String[] getNodeList() throws Exception { if (hcc != null) { Map<String, NodeControllerInfo> nodeControllerInfos = hcc.getNodeControllerInfos(); String[] nodeList = new String[nodeControllerInfos.size()]; int index = 0; for (String node : nodeControllerInfos.keySet()) { nodeList[index++] = node; } return nodeList; } return null; }
Source:
public void init(final IWorkbench workbench, final IStructuredSelection selection) { if (selection.getFirstElement() instanceof Table) { this.exportedTable = (Table) selection.getFirstElement(); } else if (selection instanceof TableStructuredSelection) { final TableStructuredSelection tss = (TableStructuredSelection) selection; final INattableModelManager tableModelManager = (INattableModelManager) tss.getAdapter(INattableModelManager.class); if (null != tableModelManager) { this.exportedTable = tableModelManager.getTable(); } } Assert.isNotNull(this.exportedTable, "We can't found the table to export"); IStatus status = TableChecker.checkTable(this.exportedTable); if (false == status.isOK()) { addPage(new WarningOnCurrentTableWizardPage(status)); } this.outputPage = new DefineOutputPluginWizardPage(); this.tableDataPage = new DefineTableConfigurationDataWizardPage(); this.outputPage.setExportedTable(this.exportedTable); this.tableDataPage.setExportedTable(this.exportedTable); addPage(outputPage); addPage(tableDataPage); }

Target:
public void init(final IWorkbench workbench, final IStructuredSelection selection) { if (selection.getFirstElement() instanceof Table) { this.exportedTable = (Table) selection.getFirstElement(); } else if (selection instanceof TableStructuredSelection) { final TableStructuredSelection tss = (TableStructuredSelection) selection; final INattableModelManager tableModelManager = (INattableModelManager) tss.getAdapter(INattableModelManager.class); if (null != tableModelManager) { this.exportedTable = tableModelManager.getTable(); } } Assert.isNotNull(this.exportedTable, Messages.ExportAsTableConfigurationWizard_WeCantFoundTheTableToExport); IStatus status = TableChecker.checkTable(this.exportedTable); if (false == status.isOK()) { addPage(new WarningOnCurrentTableWizardPage(status)); } this.outputPage = new DefineOutputPluginWizardPage(); this.tableDataPage = new DefineTableConfigurationDataWizardPage(); this.outputPage.setExportedTable(this.exportedTable); this.tableDataPage.setExportedTable(this.exportedTable); addPage(outputPage); addPage(tableDataPage); }
Source:
public Block getBlockFor(BlockUri blockUri) { if (block == null) { if (getURI().equals(blockUri.getFamilyUri())) { try { Side side = Side.valueOf(blockUri.getIdentifier().toString().toUpperCase(Locale.ENGLISH)); return blocks.get(side); } catch (IllegalArgumentException e) { return null; } } } return block; }

Target:
public Block getBlockFor(BlockUri blockUri) { if (block == null && getURI().equals(blockUri.getFamilyUri())) { try { Side side = Side.valueOf(blockUri.getIdentifier().toString().toUpperCase(Locale.ENGLISH)); return blocks.get(side); } catch (IllegalArgumentException e) { logger.error("can't find block with URI: {}", blockUri, e); return null; } } return block; }
Source:
public <API> API getClient(Class<API> apiClass, Endpoint ep, Credentials c) { if (apiClass.equals(EmptyClientAPI.class)) { return (API) new EmptyClientAPI() { }; } return null; }

Target:
public <API> API getClient(Class<API> apiClass, Endpoint ep, Credentials c) { return getClient(apiClass, ep, c, null, null); }
Source:
public void endSpan(Context context, Signal<Void> signal) { String errorCondition = ""; if (!context.getData(OPENTELEMETRY_SPAN_KEY).isPresent()) { return; } if (signal == null) { end("success", null, context); } Throwable throwable = null; if (signal != null && signal.hasError()) { throwable = signal.getThrowable(); if (throwable instanceof AmqpException) { AmqpException exception = (AmqpException) throwable; errorCondition = exception.getErrorCondition().getErrorCondition(); } } end(errorCondition, throwable, context); }

Target:
public void endSpan(Context context, Signal<Void> signal) { Objects.requireNonNull(context, "'context' cannot be null"); Objects.requireNonNull(signal, "'signal' cannot be null"); if (!context.getData(OPENTELEMETRY_SPAN_KEY).isPresent()) { return; } switch (signal.getType()) { case ON_COMPLETE: end("success", null, context); break; case ON_ERROR: String errorCondition = ""; Throwable throwable = null; if (signal.hasError()) { throwable = signal.getThrowable(); if (throwable instanceof AmqpException) { AmqpException exception = (AmqpException) throwable; errorCondition = exception.getErrorCondition().getErrorCondition(); } } end(errorCondition, throwable, context); break; default: break; } }
Source:
public void process(CoreEvent sourceEvent, MessageSourceResponseParametersProcessor respParamProcessor, CompletableCallback<Either<SourcePolicyFailureResult, SourcePolicySuccessResult>> callback) { readWriteLock.withReadLock(() -> { if (!disposed.get()) { SourcePolicyContext ctx = SourcePolicyContext.from(sourceEvent); if (ctx != null) { ctx.configure(respParamProcessor, callback); } policySink.get().next(sourceEvent); } else { MessagingException me = new MessagingException(createStaticMessage("Source policy already disposed"), sourceEvent); me.setProcessedEvent(CoreEvent.builder(sourceEvent) .error(ErrorBuilder.builder(me).errorType(errorTypeRepository.getAnyErrorType()).build()).build()); Supplier<Map<String, Object>> errorParameters = sourcePolicyParametersTransformer.isPresent() ? (() -> sourcePolicyParametersTransformer.get().fromMessageToErrorResponseParameters(sourceEvent.getMessage())) : (() -> respParamProcessor.getFailedExecutionResponseParametersFunction().apply(sourceEvent)); SourcePolicyFailureResult result = new SourcePolicyFailureResult(me, errorParameters); callback.complete(left(result)); } }); }

Target:
public void process(CoreEvent sourceEvent, MessageSourceResponseParametersProcessor respParamProcessor, CompletableCallback<Either<SourcePolicyFailureResult, SourcePolicySuccessResult>> callback) { readWriteLock.withReadLock(() -> { if (!disposed.get()) { SourcePolicyContext ctx = from(sourceEvent); if (ctx != null) { ctx.configure(respParamProcessor, callback); } policySink.get().next(sourceEvent); } else { MessagingException me = new MessagingException(createStaticMessage("Source policy already disposed"), sourceEvent); me.setProcessedEvent(CoreEvent.builder(sourceEvent) .error(ErrorBuilder.builder(me).errorType(errorTypeRepository.getAnyErrorType()).build()).build()); Supplier<Map<String, Object>> errorParameters = sourcePolicyParametersTransformer.isPresent() ? (() -> sourcePolicyParametersTransformer.get().fromMessageToErrorResponseParameters(sourceEvent.getMessage())) : (() -> respParamProcessor.getFailedExecutionResponseParametersFunction().apply(sourceEvent)); SourcePolicyFailureResult result = new SourcePolicyFailureResult(me, errorParameters); callback.complete(left(result)); } }); }
Source:
public void getAge_shouldGetAgeAfterDeath() { Calendar birthdate = Calendar.getInstance(); birthdate.set(1990, Calendar.JUNE, 2); Calendar deathDate = Calendar.getInstance(); deathDate.set(2000, Calendar.JUNE, 3); Person person = new Person(); person.setBirthdate(birthdate.getTime()); person.setDeathDate(deathDate.getTime()); assertEquals(10, person.getAge(), 0); }

Target:
public void getAge_shouldGetAgeAfterDeath() { Calendar birthdate = Calendar.getInstance(); birthdate.set(1990, Calendar.JUNE, 2); Calendar deathDate = Calendar.getInstance(); deathDate.set(2000, Calendar.JUNE, 3); Person person = new Person(); person.setBirthdate(birthdate.getTime()); person.setDead(true); person.setDeathDate(deathDate.getTime()); assertEquals(10, person.getAge(), 0); }
Source:
private Map<String, String> defaultAttributeAnd(String key, String value) { HashMap<String, String> map = new HashMap<>(ATTRIBUTES_MAP); map.put(key, value); return map; }

Target:
private Map<String, String> defaultAttributeAnd(String key, String value) { HashMap<String, String> attributes = new HashMap<>(ATTRIBUTES_MAP); attributes.put(key, value); return attributes; }
Source:
public void init(){ autoEdit = false; mIsBold = false; mIsItalic = false; mIsUnderline = false; this.addTextChangedListener( new TextWatcher() { private int start; private int count; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { this.start = start; this.count = count; } @Override public void afterTextChanged(Editable s) { if (!autoEdit && count>0) { if (mIsUnderline) { s.setSpan(new UnderlineSpan(), start, start + count, 0); } if (mIsBold) { s.setSpan(new StyleSpan(Typeface.BOLD), start, start + count, 0); } if (mIsItalic) { s.setSpan(new StyleSpan(Typeface.ITALIC), start, start + count, 0); } } } } ); }

Target:
public void init(){ mAutoEdit = false; mIsBold = false; mIsItalic = false; mIsUnderline = false; addTextChangedListener( new TextWatcher() { private int mStart; private int mCount; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { mStart = start; mCount = count; } @Override public void afterTextChanged(Editable s) { if (!mAutoEdit && mCount>0) { if (mIsUnderline) { s.setSpan(new UnderlineSpan(), mStart, mStart + mCount, 0); } if (mIsBold) { s.setSpan(new StyleSpan(Typeface.BOLD), mStart, mStart + mCount, 0); } if (mIsItalic) { s.setSpan(new StyleSpan(Typeface.ITALIC), mStart, mStart + mCount, 0); } } } } ); }
Source:
protected EntityBinding getEntityBinding(Class<?> entityClass) { return entityBindings.computeIfAbsent(entityClass, cls -> { if (isMappedInterface(cls)) { return EMPTY_BINDING; } return entityBindings.getOrDefault(lookupEntityClass(cls), EMPTY_BINDING); }); }

Target:
protected EntityBinding getEntityBinding(Class<?> entityClass) { if (isMappedInterface(entityClass)) { return EMPTY_BINDING; } return entityBindings.getOrDefault(lookupEntityClass(entityClass), EMPTY_BINDING); }
Source:
public void setExecutorDao(ExecutorDao executorDao) { this.executorInfo = executorDao; findColumnMaxLengths(); }

Target:
public void setExecutorDao(ExecutorDao executorDao) { this.executorInfo = executorDao; }
Source:
public ConfigDiff guess(ConfigSource config) { config.set("columns", new ObjectMapper().createArrayNode()); ConfigSource guessConfig = createGuessConfig(); GuessExecutor guessExecutor = Exec.getInjector().getInstance(GuessExecutor.class); PluginTask task = config.loadConfig(PluginTask.class); JiraClient jiraClient = getJiraClient(); List<Issue> issues = jiraClient.searchIssues(task, 0, GUESS_RECORDS_COUNT); issues.stream().forEach(issue -> issue.toRecord()); Set<String> uniqAtrribtes = getUniqueAttributes(issues); JsonArray samples = createSamples(issues, uniqAtrribtes); Buffer sample = Buffer.copyOf(samples.toString().getBytes()); JsonNode columns = guessExecutor.guessParserConfig(sample, Exec.newConfigSource(), guessConfig).getObjectNode().get("parser").get("columns"); ConfigDiff configDiff = Exec.newConfigDiff(); configDiff.set("columns", columns); return configDiff; }

Target:
public ConfigDiff guess(ConfigSource config) { config.set("columns", new ObjectMapper().createArrayNode()); PluginTask task = config.loadConfig(PluginTask.class); JiraUtil.validateTaskConfig(task); JiraClient jiraClient = getJiraClient(); jiraClient.checkUserCredentials(task); List<Issue> issues = jiraClient.searchIssues(task, 0, GUESS_RECORDS_COUNT); if (issues.isEmpty()) { throw new ConfigException("Could not guess schema due to empty data set"); } Buffer sample = Buffer.copyOf(createSamples(issues, getUniqueAttributes(issues)).toString().getBytes()); JsonNode columns = Exec.getInjector().getInstance(GuessExecutor.class) .guessParserConfig(sample, Exec.newConfigSource(), createGuessConfig()) .getObjectNode().get("columns"); return Exec.newConfigDiff().set("columns", columns); }
Source:
@Override public boolean remove(Object o) { if (o == null) throw new UnsupportedOperationException("Null values are not supported!"); return remove((int)o); }

Target:
@Override public boolean remove(Object o) { if (o == null) return false; return remove((int)o); }
Source:
private boolean updateCommandWaitingForEvent(CommandEntity cmdEntity) { if (cmdEntity.isWaitingForEvent()) { CallbackTiming callbackTiming = commandsRepository.getCallbackTiming(cmdEntity.getRootCommandId()); if (callbackTiming != null && callbackTiming.getWaitOnEventEndTime() > System.currentTimeMillis()) { commandsRepository.removeEventSubscription(cmdEntity.getId()); cmdEntity.setWaitingForEvent(false); return false; } return true; } return false; }

Target:
private boolean updateCommandWaitingForEvent(CommandEntity cmdEntity) { if (cmdEntity.isWaitingForEvent()) { CallbackTiming callbackTiming = commandsRepository.getCallbackTiming(cmdEntity.getId()); if (callbackTiming != null && callbackTiming.getWaitOnEventEndTime() > System.currentTimeMillis()) { log.info("The command '{}' reached its timeout of waiting for event", cmdEntity.getId()); commandsRepository.removeEventSubscription(cmdEntity.getId()); cmdEntity.setWaitingForEvent(false); return false; } return true; } return false; }
Source:
public IdElementTemplate() { this((clazz, tag, service) -> new TemplateData("", Jsoup.parse("<dom-module id='" + tag + "'><label id='labelId' someattrtibute property-binding='[[foo]]' " + "attribute-binding$='bar' another-binding='{{foo}}'" + "another-attribute='baz'></dom-module>"))); }

Target:
public IdElementTemplate() { this((clazz, tag, service) -> new TemplateData("", Jsoup.parse("<dom-module id='" + tag + "'><label id='labelId' someattribute property-binding='[[foo]]' " + "attribute-binding$='bar' another-binding='{{foo}}'" + "another-attribute='baz'></dom-module>"))); }
Source:
public void setUp() { try { super.setUp(); } catch (Exception e) { e.printStackTrace(); } action1 = mock(ViewAction.class); action2 = mock(ViewAction.class); action3 = mock(ViewAction.class); action4 = mock(ViewAction.class); action5 = mock(ViewAction.class); action6 = mock(ViewAction.class); action7 = mock(ViewAction.class); action8 = mock(ViewAction.class); }

Target:
public void setUp() { super.setUp(); view1Action1 = createMockAction(1, TriggerType.CLICK); listView2Action1 = createMockAction(2, TriggerType.CLICK_LIST_ITEM); view1Action2 = createMockAction(1, TriggerType.LONG_CLICK); listView2Action2 = createMockAction(2, TriggerType.LONG_CLICK_LIST_ITEM); view3Action1 = createMockAction(3, TriggerType.TOUCH); view3Action2 = createMockAction(3, TriggerType.TOUCH_DOWN); view3Action3 = createMockAction(3, TriggerType.TOUCH_UP); view1Action3 = createMockAction(1, TriggerType.CLICK); }
Source:
private Optional<String> getAttributeValue(String name, List<Attachment> attachmentList) { return attachmentList.stream().filter(att -> name.equalsIgnoreCase(att.getDataHandler().getDataSource().getName())).findAny().map(m -> { String ie = null; try { ie = m.getDataHandler().getDataSource().getInputStream().toString(); } catch (IOException e) { log.error("The attribute " + name + " does not exist"); } return Optional.of(ie); }).orElse(Optional.empty()); }

Target:
public Optional<String> getAttributeValue(String name, List<Attachment> attachmentList) { return this.getFile(name, attachmentList).map(inputStream -> { String inputString = null; try { inputString = IOUtils.toString(inputStream); }catch(Exception e) { log.error("there was an error getting adapter name: " + e.getMessage()); } return Optional.ofNullable(inputString); }).orElse(Optional.empty()); }
Source:
public void onRefreshAttributesPanelEvent( final @Observes RefreshAttributesPanelEvent event ) { final GuidedDecisionTableView.Presenter dtPresenter = event.getPresenter(); if ( dtPresenter == null ) { return; } if ( !isDecisionTableAvailable( dtPresenter ) ) { return; } if ( event.getColumns() == null ) { return; } view.refreshAttributeWidget( event.getColumns() ); }

Target:
public void onRefreshAttributesPanelEvent( final @Observes RefreshAttributesPanelEvent event ) { refreshPanel( event.getPresenter(), event.getColumns(), view::refreshAttributeWidget ); }
Source:
public ChunkedReplicatedContent( byte contentType, ByteBufAwareMarshal byteBufAwareMarshal, int chunkSize ) { this.byteBufAwareMarshal = byteBufAwareMarshal; this.chunkSize = chunkSize; if ( chunkSize < 7 ) { throw new IllegalArgumentException( "Chunk size must be at least 4 bytes" ); } this.contentType = contentType; }

Target:
public ChunkedReplicatedContent( byte contentType, ByteBufAwareMarshal byteBufAwareMarshal, int chunkSize ) { this.byteBufAwareMarshal = byteBufAwareMarshal; this.chunkSize = chunkSize; if ( chunkSize < MINIMUM_CHUNK_SIZE ) { throw new IllegalArgumentException( "Chunk size must be at least " + MINIMUM_CHUNK_SIZE + " bytes" ); } this.contentType = contentType; }
Source:
public Map<Long, String> getBootHistory() throws DeviceNotAvailableException { String output = executeShellCommand("getprop persist.sys.boot.reason.history"); Map<Long, String> bootHistory = new HashMap<Long, String>(); if (Strings.isNullOrEmpty(output)) { return bootHistory; } for (String line : output.split("\\n")) { String infoStr[] = line.split(","); String startStr = infoStr[infoStr.length - 1]; try { long startTime = Long.parseLong(startStr.trim()); bootHistory.put(startTime, infoStr[0].trim()); } catch (NumberFormatException e) { CLog.e("Fail to parse boot time from line %s", line); } } return bootHistory; }

Target:
public Map<Long, String> getBootHistory() throws DeviceNotAvailableException { String output = getProperty(DeviceProperties.BOOT_REASON_HISTORY); Map<Long, String> bootHistory = new LinkedHashMap<Long, String>(); if (Strings.isNullOrEmpty(output)) { return bootHistory; } for (String line : output.split("\\n")) { String infoStr[] = line.split(","); String startStr = infoStr[infoStr.length - 1]; try { long startTime = Long.parseLong(startStr.trim()); bootHistory.put(startTime, infoStr[0].trim()); } catch (NumberFormatException e) { CLog.e("Fail to parse boot time from line %s", line); } } return bootHistory; }
Source:
public void testMoveAction() throws Exception { List<PID> subjects = pidList(NUM_TEST_PIDS); Document msgDoc = buildMessage(CDRActions.MOVE.toString(), CDRActions.MOVE.getName(), targetPid, subjects); when(msg.getBody()).thenReturn(msgDoc); when(msg.getHeader(eq("name"))).thenReturn("user_id"); processor.process(exchange); verify(messageSender).sendIndexingOperation(stringCaptor.capture(), pidsCaptor.capture(), actionTypeCaptor.capture()); Collection<PID> pids = pidsCaptor.getValue(); assertEquals(1, pids.size()); assertEquals(targetPid, pids.iterator().next()); String userid = stringCaptor.getValue(); assertEquals("user_id", userid); IndexingActionType actionType = actionTypeCaptor.getValue(); assertEquals(IndexingActionType.MOVE, actionType); }

Target:
public void testMoveAction() throws Exception { List<PID> subjects = pidList(NUM_TEST_PIDS); Document msgDoc = buildMessage(CDRActions.MOVE.toString(), CDRActions.MOVE.getName(), targetPid, subjects); when(msg.getBody()).thenReturn(msgDoc); processor.process(exchange); verify(messageSender).sendIndexingOperation(stringCaptor.capture(), pidCaptor.capture(), pidsCaptor.capture(), actionTypeCaptor.capture()); verifyTargetPid(pidCaptor.getValue()); verifyUserid(stringCaptor.getValue()); verifyChildPids(subjects); verifyActionType(IndexingActionType.MOVE, actionTypeCaptor.getValue()); }
Source:
public static void nailMain(NGContext context) { context.out.println(); context.out.println(" context.getCommand(): " + context.getCommand()); context.out.println(" context.getInetAddress(): " + context.getInetAddress()); context.out.println(" context.getPort(): " + context.getPort()); context.out.println("context.getWorkingDirectory(): " + context.getWorkingDirectory()); context.out.println(" context.getFileSeparator(): " + context.getFileSeparator()); context.out.println(" context.getPathSeparator(): " + context.getPathSeparator()); context.out.println("\ncontext.getArgs():"); for (int i = 0; i < context.getArgs().length; ++i) { context.out.println(" args[" + i + "]=" + context.getArgs()[i]); } context.out.println("\ncontext.getEnv():"); TreeSet keys = new TreeSet(context.getEnv().keySet()); for (Iterator i = keys.iterator(); i.hasNext(); ) { String key = (String) i.next(); context.out.println(" env[\"" + key + "\"]=" + context.getEnv().getProperty(key)); } }

Target:
public static void nailMain(NGContext context) { context.out.println(); context.out.println(" context.getCommand(): " + context.getCommand()); context.out.println(" context.getInetAddress(): " + context.getInetAddress()); context.out.println(" context.getPort(): " + context.getPort()); context.out.println("context.getWorkingDirectory(): " + context.getWorkingDirectory()); context.out.println(" context.getFileSeparator(): " + context.getFileSeparator()); context.out.println(" context.getPathSeparator(): " + context.getPathSeparator()); context.out.println("\ncontext.getArgs():"); for (int i = 0; i < context.getArgs().length; ++i) { context.out.println(" args[" + i + "]=" + context.getArgs()[i]); } context.out.println("\ncontext.getEnv():"); TreeSet keys = new TreeSet(context.getEnv().keySet()); for (Object okey : keys) { String key = (String) okey; context.out.println(" env[\"" + key + "\"]=" + context.getEnv().getProperty(key)); } }
Source:
public void startIndexPopulation( IndexPopulationJob job ) { populationJobs.add( job ); scheduler.schedule( indexPopulation, new IndexPopulationJobWrapper( job, this ) ); }

Target:
void startIndexPopulation( IndexPopulationJob job ) { populationJobs.add( job ); scheduler.schedule( indexPopulation, new IndexPopulationJobWrapper( job, this ) ); }
Source:
public String getCloneBaseUrlOrHost() { return StringUtils.isEmpty(cloneBaseUrl) ? host : cloneBaseUrl; }

Target:
public String getCloneBaseUrlOrHost() { return Strings.isNullOrEmpty(cloneBaseUrl) ? host : cloneBaseUrl; }
Source:
private VariantMetricInformation updateVarianMetricById(PushMessageInformation pmi, final VariantMetricInformation vmi) { return pmi.getVariantInformations().stream() .filter(v -> vmi.getVariantID().equals(v.getVariantID())) .findFirst() .orElse(null); }

Target:
private VariantMetricInformation updateVarianMetricById(PushMessageInformation pmi, final VariantMetricInformation vmi) { return pmi.getVariantInformations().stream() .filter(v -> vmi.getVariantID().equals(v.getVariantID())) .findFirst() .orElseThrow(() -> new IllegalArgumentException("No variant metric found for given id") ); }
Source:
public void testWithInvalidToken(String opHost, String redirectUrl) throws Exception { DevelopersApi client = Tester.api(); RegisterSiteResponseData setupData = RegisterSiteTest.registerSite(client, opHost, redirectUrl); GetClientTokenResponseData tokenResponse = getGetClientTokenResponseData(opHost, client, setupData); assertNotNull(tokenResponse); final String accessToken = tokenResponse.getAccessToken(); final String validHeader = "Bearer " + accessToken; final String invalidToken = accessToken.concat("BlahBlah"); IntrospectAccessTokenParams iatParams = new IntrospectAccessTokenParams(); iatParams.setAccessToken(invalidToken); iatParams.setOxdId(setupData.getOxdId()); ApiResponse<IntrospectAccessTokenResponse> apiIatResponse = client.introspectAccessTokenWithHttpInfo(validHeader, iatParams); assertEquals(apiIatResponse.getStatusCode(), 200); assertNotNull(apiIatResponse.getData()); IntrospectAccessTokenResponseData responseData = apiIatResponse.getData().getData(); assertNotNull(responseData); assertEquals(responseData.isActive(), Boolean.FALSE); }

Target:
public void testWithInvalidToken(String opHost, String redirectUrl) throws Exception { DevelopersApi client = Tester.api(); RegisterSiteResponseData setupData = RegisterSiteTest.registerSite(client, opHost, redirectUrl); GetClientTokenResponseData tokenResponse = getGetClientTokenResponseData(opHost, client, setupData); assertNotNull(tokenResponse); final String accessToken = tokenResponse.getAccessToken(); final String validHeader = "Bearer " + accessToken; final String invalidToken = accessToken.concat("BlahBlah"); IntrospectAccessTokenParams iatParams = new IntrospectAccessTokenParams(); iatParams.setAccessToken(invalidToken); iatParams.setOxdId(setupData.getOxdId()); ApiResponse<IntrospectAccessTokenResponse> apiIatResponse = client.introspectAccessTokenWithHttpInfo(validHeader, iatParams); assertEquals(apiIatResponse.getStatusCode(), 200); assertNotNull(apiIatResponse.getData()); IntrospectAccessTokenResponseData responseData = apiIatResponse.getData().getData(); assertNotNull(responseData); assertFalse(responseData.isActive()); }
Source:
public static IpBlock create(String id, Location location, List<PublicIp> publicIps, List<String> ips) { return new AutoValue_IpBlock(id, location, publicIps, ips); }

Target:
public static IpBlock create(String id, Location location, List<PublicIp> publicIps, List<String> ips) { return new AutoValue_IpBlock(id, location, publicIps, ips != null ? ImmutableList.copyOf(ips) : ImmutableList.<String>of()); }
Source:
public static <T> QueryRunner<T> makeSearchQueryRunner( Segment adapter ) { final SearchQueryConfig config = new SearchQueryConfig(); QueryRunnerFactory factory = new SearchQueryRunnerFactory( new SearchStrategySelector(new Supplier<SearchQueryConfig>() { @Override public SearchQueryConfig get() { return config; } }), new SearchQueryQueryToolChest( config, QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator()), QueryRunnerTestHelper.NOOP_QUERYWATCHER); return new FinalizeResultsQueryRunner<T>( factory.createRunner(adapter), factory.getToolchest() ); }

Target:
public static <T> QueryRunner<T> makeSearchQueryRunner( Segment adapter ) { final SearchQueryConfig config = new SearchQueryConfig(); QueryRunnerFactory factory = new SearchQueryRunnerFactory( new SearchStrategySelector(Suppliers.ofInstance(config)), new SearchQueryQueryToolChest( config, QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator() ), QueryRunnerTestHelper.NOOP_QUERYWATCHER ); return new FinalizeResultsQueryRunner<T>( factory.createRunner(adapter), factory.getToolchest() ); }
Source:
public void rollback() { mPut = null; mEntityId = null; mHopper = null; mId = null; mLGNames = new HashSet<String>(); }

Target:
public void rollback() { Preconditions.checkState(mPut != null, "rollback() must be paired with a call to begin()"); reset(); }
Source:
private String getDuplicateStorageDomainId(StorageServerConnections connection, Guid storagePoolId) { List<StorageServerConnections> connections = null; List<StorageDomain> sd; if (connection.getStorageType() == StorageType.LOCALFS) { List<StorageServerConnections> connectionsForPool = storagePoolId == null ? Collections.emptyList() : storageServerConnectionDao.getAllConnectableStorageSeverConnection(storagePoolId); List<StorageServerConnections> connectionsForPath = storageServerConnectionDao.getAllForStorage(connection.getConnection()); connections = (List<StorageServerConnections>) CollectionUtils.intersection(connectionsForPool, connectionsForPath); } else if (connection.getStorageType().isFileDomain()) { String connectionField = connection.getConnection(); connections = storageServerConnectionDao.getAllForStorage(connectionField); } else { StorageServerConnections sameConnection = iscsiStorageHelper.findConnectionWithSameDetails(connection); connections = sameConnection != null ? Collections.singletonList(sameConnection) : Collections.emptyList(); } return connections.get(0).getId(); }

Target:
private String getDuplicateStorageDomainId(StorageServerConnections connection, Guid storagePoolId) { List<StorageServerConnections> connections = null; List<StorageDomain> sd; if (connection.getStorageType() == StorageType.LOCALFS) { List<StorageServerConnections> connectionsForPool = storagePoolId == null ? Collections.emptyList() : storageServerConnectionDao.getAllConnectableStorageSeverConnection(storagePoolId); List<StorageServerConnections> connectionsForPath = storageServerConnectionDao.getAllForStorage(connection.getConnection()); connections = (List<StorageServerConnections>) CollectionUtils.intersection(connectionsForPool, connectionsForPath); } else if (connection.getStorageType().isFileDomain()) { String connectionField = connection.getConnection(); connections = storageServerConnectionDao.getAllForStorage(connectionField); } else { StorageServerConnections sameConnection = iscsiStorageHelper.findConnectionWithSameDetails(connection); connections = sameConnection != null ? Collections.singletonList(sameConnection) : Collections.emptyList(); } if (connections != null && connections.size() > 0 ) return connections.get(0).getId(); return ""; }
Source:
public void setup() { compactionConfigs = new HashMap<>(); for (int i = 0; i < numDataSources; i++) { final String dataSource = DATA_SOURCE_PREFIX + i; compactionConfigs.put( dataSource, new DataSourceCompactionConfig( dataSource, 0, targetCompactionSizeBytes, targetCompactionSizeBytes, null, null, null, null, null ) ); } dataSources = new HashMap<>(); for (int i = 0; i < numDataSources; i++) { final String dataSource = DATA_SOURCE_PREFIX + i; VersionedIntervalTimeline<String, DataSegment> timeline = new VersionedIntervalTimeline<>( String.CASE_INSENSITIVE_ORDER ); final int startYear = ThreadLocalRandom.current().nextInt(2000, 2040); DateTime date = DateTimes.of(startYear, 1, 1, 0, 0); for (int j = 0; j < numDayIntervalsPerDataSource; j++, date = date.plusDays(1)) { for (int k = 0; k < numPartitionsPerDayInterval; k++) { final ShardSpec shardSpec = new NumberedShardSpec(numPartitionsPerDayInterval, k); final DataSegment segment = new DataSegment( dataSource, new Interval(date, date.plusDays(1)), "version", null, ImmutableList.of(), ImmutableList.of(), shardSpec, 0, segmentSizeBytes ); timeline.add(segment.getInterval(), segment.getMajorVersion(), shardSpec.createChunk(segment)); } } dataSources.put(dataSource, timeline); } }

Target:
public void setup() { compactionConfigs = new HashMap<>(); for (int i = 0; i < numDataSources; i++) { final String dataSource = DATA_SOURCE_PREFIX + i; compactionConfigs.put( dataSource, new DataSourceCompactionConfig( dataSource, 0, targetCompactionSizeBytes, targetCompactionSizeBytes, null, null, null, null, null ) ); } List<DataSegment> segments = new ArrayList<>(); for (int i = 0; i < numDataSources; i++) { final String dataSource = DATA_SOURCE_PREFIX + i; final int startYear = ThreadLocalRandom.current().nextInt(2000, 2040); DateTime date = DateTimes.of(startYear, 1, 1, 0, 0); for (int j = 0; j < numDayIntervalsPerDataSource; j++, date = date.plusDays(1)) { for (int k = 0; k < numPartitionsPerDayInterval; k++) { final ShardSpec shardSpec = new NumberedShardSpec(numPartitionsPerDayInterval, k); final DataSegment segment = new DataSegment( dataSource, new Interval(date, date.plusDays(1)), "version", null, ImmutableList.of(), ImmutableList.of(), shardSpec, 0, segmentSizeBytes ); segments.add(segment); } } } dataSources = DataSourcesSnapshot.fromUsedSegments(segments, ImmutableMap.of()).getUsedSegmentsTimelinesPerDataSource(); }
Source:
private synchronized boolean updateWeatherData() { try { String data = getWeatherData( "SELECT * FROM weather.forecast WHERE u = 'c' AND woeid = " + location.toPlainString()); if (data != null) { if (data.contains("\"results\":null")) { if (isCurrentDataExpired()) { weatherData = null; logger.trace( "The Yahoo Weather API did not return any data. Omiting the old result because it became too old."); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, "The Yahoo Weather API did not return any data."); return false; } else { logger.trace("The Yahoo Weather API did not return any data. Keeping the old result."); return false; } } else { lastUpdateTime = System.currentTimeMillis(); weatherData = data; } updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE, "@text/online"); return true; } } catch (IOException e) { logger.warn("Error accessing Yahoo weather: {}", e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, "@text/offline"); } weatherData = null; return false; }

Target:
private synchronized boolean updateWeatherData() { try { String data = getWeatherData( "SELECT * FROM weather.forecast WHERE u = 'c' AND woeid = " + location.toPlainString()); if (data != null) { if (data.contains("\"results\":null")) { if (isCurrentDataExpired()) { weatherData = null; logger.trace( "The Yahoo Weather API did not return any data. Omiting the old result because it became too old."); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, "@text/offline.no-data"); return false; } else { logger.trace("The Yahoo Weather API did not return any data. Keeping the old result."); return false; } } else { lastUpdateTime = System.currentTimeMillis(); weatherData = data; } updateStatus(ThingStatus.ONLINE); return true; } } catch (IOException e) { logger.warn("Error accessing Yahoo weather: {}", e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, "@text/offline.location [\"" + location.toPlainString() + "\""); } weatherData = null; return false; }
Source:
public void parseArguments(List<String> args) throws Exception { final Map<String, String> substitutions = new HashMap<>(); substitutions.put( "@PROGRAM_NAME@", (String)((Map) context.get(ModuleService.CLI_PARSER_SUBSTITUTIONS)).get("PROGRAM_NAME") ); args.remove(0); Properties props = new Properties(); try ( InputStream in = LoggerServiceImpl.class.getResourceAsStream("arguments.properties"); Reader reader = new InputStreamReader(in); ) { props.load(reader); } ArgumentsParser parser = new ArgumentsParser(props, "module"); parser.getSubstitutions().putAll(substitutions); parser.parse(args); Map<String, Object> moduleArgs = parser.getParsedArgs(); if((Boolean)moduleArgs.get("help")) { System.out.format("Usage: %s", parser.getUsage()); throw new ExitException("Help", 0); } if(!parser.getErrors().isEmpty()) { for(Throwable t : parser.getErrors()) { System.err.format("FATAL: %s%n", t.getMessage()); } throw new ExitException("Parsing error", 1); } if (args.size() < 1) { System.err.println("Action not provided"); throw new ExitException("Action not provided", 1); } try { action = Action.valueOf(args.get(0).toUpperCase().replace("-", "_")); } catch(IllegalArgumentException e) { System.err.printf("Invalid action '%s'%n", args.get(0)); throw new ExitException("Invalid action", 1); } argMap = action.parse(substitutions, props, args); }

Target:
public void parseArguments(List<String> args) throws Exception { args.remove(0); Properties props = new Properties(); try ( InputStream in = LoggerServiceImpl.class.getResourceAsStream("arguments.properties"); Reader reader = new InputStreamReader(in, Charset.forName("UTF-8")); ) { props.load(reader); } Map<String, String> substitutions = (Map)context.get(ModuleService.CLI_PARSER_SUBSTITUTIONS); ArgumentsParser parser = new ArgumentsParser(props, "module"); parser.getSubstitutions().putAll(substitutions); parser.parse(args); Map<String, Object> moduleArgs = parser.getParsedArgs(); if((Boolean)moduleArgs.get("help")) { System.out.format("Usage: %s", parser.getUsage()); throw new ExitException("Help", 0); } if(!parser.getErrors().isEmpty()) { for(Throwable t : parser.getErrors()) { System.err.format("FATAL: %s%n", t.getMessage()); } throw new ExitException("Parsing error", 1); } if (args.size() < 1) { System.err.println("Action not provided"); throw new ExitException("Action not provided", 1); } try { action = Action.valueOf(args.get(0).toUpperCase().replace("-", "_")); } catch(IllegalArgumentException e) { System.err.printf("Invalid action '%s'%n", args.get(0)); throw new ExitException("Invalid action", 1); } argMap = action.parse(substitutions, props, args); }
Source:
public File provisionWorkspace(RunConfiguration configuration, GeoJsonDiseaseOccurrenceFeatureCollection modelData) throws IOException { Path workingDirectoryPath = Paths.get( configuration.getBaseDir().getAbsolutePath(), configuration.getRunName() + "-" + UUID.randomUUID().toString()); LOGGER.info("Provisioning workspace at " + workingDirectoryPath.toString()); File workingDirectory = workingDirectoryPath.toFile(); boolean workingDirectoryCreated = workingDirectory.mkdirs(); File modelDirectory = null; if (workingDirectoryCreated) { Path modelDirectoryPath = Paths.get(workingDirectoryPath.toString(), MODEL_CODE_DIRECTORY_NAME); modelDirectory = modelDirectoryPath.toFile(); workingDirectoryCreated = modelDirectory.mkdir(); } File dataDirectory = null; if (workingDirectoryCreated) { Path dataDirectoryPath = Paths.get(workingDirectoryPath.toString(), MODEL_DATA_DIRECTORY_NAME); dataDirectory = dataDirectoryPath.toFile(); workingDirectoryCreated = dataDirectory.mkdir(); } if (!workingDirectoryCreated) { LOGGER.warn(String.format(LOG_DIRECTORY_ERROR, workingDirectoryPath.toString())); throw new IOException("Directory structure could not be created."); } inputDataManager.writeData(modelData, dataDirectory); sourceCodeManager.provisionVersion(configuration.getModelVersion(), modelDirectory); File runScript = scriptGenerator.generateScript(configuration, workingDirectory, false); LOGGER.info("Workspace successfully provisioned at " + workingDirectoryPath.toString()); return runScript; }

Target:
public File provisionWorkspace(RunConfiguration configuration, GeoJsonDiseaseOccurrenceFeatureCollection modelData) throws IOException { Path workingDirectoryPath = Paths.get( configuration.getBaseDir().getAbsolutePath(), configuration.getRunName() + "-" + UUID.randomUUID().toString()); LOGGER.info(String.format(LOG_PROVISIONING_WORKSPACE, workingDirectoryPath.toString())); File workingDirectory = workingDirectoryPath.toFile(); boolean workingDirectoryCreated = workingDirectory.mkdirs(); File modelDirectory = null; if (workingDirectoryCreated) { Path modelDirectoryPath = Paths.get(workingDirectoryPath.toString(), MODEL_CODE_DIRECTORY_NAME); modelDirectory = modelDirectoryPath.toFile(); workingDirectoryCreated = modelDirectory.mkdir(); } File dataDirectory = null; if (workingDirectoryCreated) { Path dataDirectoryPath = Paths.get(workingDirectoryPath.toString(), MODEL_DATA_DIRECTORY_NAME); dataDirectory = dataDirectoryPath.toFile(); workingDirectoryCreated = dataDirectory.mkdir(); } if (!workingDirectoryCreated) { LOGGER.warn(String.format(LOG_DIRECTORY_ERROR, workingDirectoryPath.toString())); throw new IOException("Directory structure could not be created."); } inputDataManager.writeData(modelData, dataDirectory); sourceCodeManager.provisionVersion(configuration.getModelVersion(), modelDirectory); File runScript = scriptGenerator.generateScript(configuration, workingDirectory, false); LOGGER.info(String.format(LOG_WORKSPACE_SUCCESSFULLY_PROVISIONED, workingDirectoryPath.toString())); return runScript; }