auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void adsVelesWithBidderOfferEvent() { networkTrafficInterceptor.startIntercepting(); String url = TEST_PAGE_BIDDER.getUrl(); AdsVelesObject velesAds = new AdsVelesObject(driver, urlBuilder.appendQueryStringToURL(url, APPNEXUS_DEBUG_MODE)); Assertion.assertTrue(velesAds.isVelesPlayerInIncontentSlotDisplayed()); velesAds.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, AdsVelesObject.BIDDER_PLAYER_EVENT_PATTERN); }

Target:
public void adsVelesWithBidderOfferEvent() { networkTrafficInterceptor.startIntercepting(); String url = TEST_PAGE_BIDDER.getUrl(); AdsVelesObject velesAds = new AdsVelesObject(driver, urlBuilder.appendQueryStringToURL(url, APPNEXUS_DEBUG_MODE)); Assertion.assertTrue(velesAds.isVelesPlayerInIncontentSlotDisplayed(), ASSERTION_VELES_PLAYER_NOT_RENDERED); velesAds.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, AdsVelesObject.BIDDER_PLAYER_EVENT_PATTERN); }
Source:
public Curve createCurve(PointArray points, boolean closed) throws MismatchedReferenceSystemException, MismatchedDimensionException { if (points == null) throw new NullPointerException("Points are required to create a curve"); List segmentList = new ArrayList (); for( int i = 0; i < points.size() - 1; i++){ int start = i; int end = i + 1; DirectPosition point1 = points.getDirectPosition( start, null ); DirectPosition point2 = points.getDirectPosition( end, null ); LineSegment segment = createLineSegment( point1, point2 ); segmentList.add( segment ); } if(closed) { LineSegment first = (LineSegment) segmentList.get(0); LineSegment last = (LineSegment) segmentList.get(segmentList.size() - 1); if(!first.getStartPoint().equals(last.getEndPoint())) { LineSegment segment = createLineSegment(last.getEndPoint(), first.getStartPoint()); segmentList.add( segment ); } } return getPrimitiveFactory().createCurve( segmentList ); }

Target:
public Curve createCurve(PointArray points, boolean closed) throws MismatchedReferenceSystemException, MismatchedDimensionException { if (points == null) throw new NullPointerException("Points are required to create a curve"); if (points.size() < 2) throw new IllegalArgumentException( "At least two points are required to create a curve"); List segmentList = new ArrayList (); for (int i = 0; i < points.size() - 1; i++) { int start = i; int end = i + 1; DirectPosition point1 = points.getDirectPosition(start, null); DirectPosition point2 = points.getDirectPosition(end, null); LineSegment segment = createLineSegment(point1, point2); segmentList.add(segment); } if (closed) { LineSegment first = (LineSegment) segmentList.get(0); LineSegment last = (LineSegment) segmentList.get(segmentList.size() - 1); if (!first.getStartPoint().equals(last.getEndPoint())) { LineSegment segment = createLineSegment(last.getEndPoint(), first.getStartPoint()); segmentList.add(segment); } } return getPrimitiveFactory().createCurve(segmentList); }
Source:
public List<OrganizationType> getAllOrganizations(String exchangeName) throws ExchangeManagerException { refreshExchangeCacheIfRequired(); List<OrganizationType> orgList = new ArrayList<>(); String exName = StringUtils.isNotEmpty(exchangeName) ? exchangeName : getDefaultExchange(); Map<String, OrganizationType> orgMap = exCache.get(exName); if (null != orgMap) { for (Entry<String, OrganizationType> hcidKey : orgMap.entrySet()) { OrganizationType org = orgMap.get(hcidKey.getKey()); orgList.add(syncWithOverrides(org, hcidKey.getKey())); } } return orgList; }

Target:
public List<OrganizationType> getAllOrganizations(String exchangeName) throws ExchangeManagerException { refreshExchangeCacheIfRequired(); List<OrganizationType> orgList = new ArrayList<>(); String exName = StringUtils.isNotEmpty(exchangeName) ? exchangeName : getDefaultExchange(); Map<String, OrganizationType> orgMap = exCache.get(exName); if (null != orgMap) { for (Entry<String, OrganizationType> hcidKey : orgMap.entrySet()) { orgList.add(syncWithOverrides(hcidKey.getValue(), hcidKey.getKey())); } } return orgList; }
Source:
private static Class<?>[] getSuiteClasses(Class<?> klass, Class<?>[] classes) throws SecurityException { final List<Class<?>> suiteClassList = new ArrayList<Class<?>>(); for (Annotation annotation : klass.getAnnotations()) { if ("org.eclipse.mylyn.commons.sdk.util.ManagedSuite.TestConfigurationProperty" .equals(annotation.annotationType().getCanonicalName())) { if (getTestConfiguration() == null) { TestConfigurationProperty configurationProperty = (TestConfigurationProperty) annotation; TestConfiguration testConfiguration = new TestConfiguration(configurationProperty.kind()); testConfiguration.setLocalOnly(configurationProperty.localOnly()); testConfiguration.setDefaultOnly(configurationProperty.defaultOnly()); testConfiguration.setHeadless(configurationProperty.headless()); setTestConfiguration(testConfiguration); } } else if ("org.junit.runners.Suite.SuiteClasses".equals(annotation.annotationType().getCanonicalName())) { SuiteClasses suiteClasses = (SuiteClasses) annotation; for (Class<?> suiteClass : suiteClasses.value()) { suiteClassList.add(suiteClass); } } } if (getTestConfiguration() == null) { setTestConfiguration(TestConfiguration.getDefault()); } try { Method method = klass.getMethod("add2SuiteClasses", java.util.List.class, org.eclipse.mylyn.commons.sdk.util.TestConfiguration.class); if (method != null) { TestConfiguration conf = getTestConfiguration(); method.invoke(null, suiteClassList, conf); } } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException e) { } return suiteClassList.toArray(new Class<?>[suiteClassList.size()]); }

Target:
private static Class<?>[] getSuiteClasses(Class<?> klass, Class<?>[] classes) throws SecurityException { final List<Class<?>> suiteClassList = new ArrayList<Class<?>>(); for (Annotation annotation : klass.getAnnotations()) { if (annotation.annotationType() == TestConfigurationProperty.class) { if (getTestConfiguration() == null) { TestConfigurationProperty configurationProperty = (TestConfigurationProperty) annotation; TestConfiguration testConfiguration = new TestConfiguration(configurationProperty.kind()); testConfiguration.setLocalOnly(configurationProperty.localOnly()); testConfiguration.setDefaultOnly(configurationProperty.defaultOnly()); testConfiguration.setHeadless(configurationProperty.headless()); setTestConfiguration(testConfiguration); } } else if (annotation.annotationType() == SuiteClasses.class) { SuiteClasses suiteClasses = (SuiteClasses) annotation; for (Class<?> suiteClass : suiteClasses.value()) { suiteClassList.add(suiteClass); } } } if (getTestConfiguration() == null) { setTestConfiguration(TestConfiguration.getDefault()); } try { Method method = klass.getMethod("add2SuiteClasses", java.util.List.class, org.eclipse.mylyn.commons.sdk.util.TestConfiguration.class); if (method != null) { TestConfiguration conf = getTestConfiguration(); method.invoke(null, suiteClassList, conf); } } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException e) { } return suiteClassList.toArray(new Class<?>[suiteClassList.size()]); }
Source:
public static void cleanup(@NonNull final String traceTypeId) { TmfWorkspaceModifyOperation operation = new TmfWorkspaceModifyOperation() { @Override public void execute(IProgressMonitor monitor) throws CoreException { for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { if (project.hasNature(TmfProjectNature.ID)) { TmfProjectElement projectElement = TmfProjectRegistry.getProject(project, true); final TmfTraceFolder tracesFolder = projectElement.getTracesFolder(); if (tracesFolder != null) { for (final TmfTraceElement trace : tracesFolder.getTraces()) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } if (traceTypeId.equals(trace.getTraceType())) { Display.getDefault().syncExec(() -> trace.closeEditors()); trace.deleteSupplementaryResources(); trace.refreshSupplementaryFolder(); } } } } } TmfTableColumnUtils.clearColumnOrder(traceTypeId); TmfTableColumnUtils.clearColumnWidth(traceTypeId); TmfTableColumnUtils.clearColumnResizable(traceTypeId); } }; try { PlatformUI.getWorkbench().getProgressService().run(true, true, operation); } catch (InterruptedException e) { } catch (InvocationTargetException e) { TraceUtils.displayErrorMsg(e.toString(), e.getTargetException().toString()); } }

Target:
public static void cleanup(@NonNull final String traceTypeId) { TmfWorkspaceModifyOperation operation = new TmfWorkspaceModifyOperation() { @Override public void execute(IProgressMonitor monitor) throws CoreException { for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { if (project.hasNature(TmfProjectNature.ID)) { TmfProjectElement projectElement = TmfProjectRegistry.getProject(project, true); final TmfTraceFolder tracesFolder = projectElement.getTracesFolder(); if (tracesFolder != null) { for (final TmfTraceElement trace : tracesFolder.getTraces()) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } if (traceTypeId.equals(trace.getTraceType())) { Display.getDefault().syncExec(trace::closeEditors); trace.deleteSupplementaryResources(); trace.refreshSupplementaryFolder(); } } } } } TmfTableColumnUtils.clearColumnOrder(traceTypeId); TmfTableColumnUtils.clearColumnWidth(traceTypeId); TmfTableColumnUtils.clearColumnResizable(traceTypeId); } }; try { PlatformUI.getWorkbench().getProgressService().run(true, true, operation); } catch (InterruptedException e) { } catch (InvocationTargetException e) { TraceUtils.displayErrorMsg(e.toString(), e.getTargetException().toString()); } }
Source:
public int open() { textChanged(newName); text.selectAll(); return super.open(); }

Target:
public int open() { textChanged(text.getText()); text.selectAll(); return super.open(); }
Source:
public Iterator<E> find(EntityFilters filters, FieldMask fieldMask) { checkNotNull(filters); checkNotNull(fieldMask); final EntityQuery<I> entityQuery = EntityQueries.from(filters, getEntityClass()); final EntityQuery<I> completeQuery = toCompleteQuery(entityQuery); final Iterator<EntityRecord> records = recordStorage().readAll(completeQuery, fieldMask); final Function<EntityRecord, E> transformer = entityConverter().reverse(); final Iterator<E> result = transform(records, transformer); return result; }

Target:
public Iterator<E> find(EntityFilters filters, FieldMask fieldMask) { checkNotNull(filters); checkNotNull(fieldMask); final EntityQuery<I> entityQuery = EntityQueries.from(filters, getEntityClass()); final EntityQuery<I> completeQuery = toCompleteQuery(entityQuery); final Iterator<EntityRecord> records = recordStorage().readAll(completeQuery, fieldMask); final Function<EntityRecord, E> toEntity = entityConverter().reverse(); final Iterator<E> result = transform(records, toEntity); return result; }
Source:
public static void setupServer(boolean updateable, SecurityHandler sh) { dsgTesting = DatasetGraphFactory.createTxnMem(); server = FusekiEmbeddedServer.create() .add(datasetPath(), dsgTesting) .setPort(port()) .setSecurityHandler(sh) .build() .start(); }

Target:
public static void setupServer(boolean updateable, SecurityHandler sh) { setupServer(updateable, sh, DatasetGraphFactory.createTxnMem()); }
Source:
private TaskConfigurer getDefaultConfigurer() { verifyEnvironment(); int configurers = this.context.getBeanNamesForType(TaskConfigurer.class).length; if (configurers < 1) { if(!CollectionUtils.isEmpty(this.dataSources) && this.dataSources.size() == 1) { return new DefaultTaskConfigurer( this.dataSources.iterator().next(), taskProperties.getTablePrefix()); } else { return new DefaultTaskConfigurer(null, taskProperties.getTablePrefix()); } } else { if(configurers == 1) { return this.context.getBean(TaskConfigurer.class); } else { throw new IllegalStateException("Expected one TaskConfigurer but found " + configurers); } } }

Target:
private TaskConfigurer getDefaultConfigurer() { verifyEnvironment(); int configurers = this.context.getBeanNamesForType(TaskConfigurer.class).length; if (configurers < 1) { TaskConfigurer taskConfigurer; if(!CollectionUtils.isEmpty(this.dataSources) && this.dataSources.size() == 1) { taskConfigurer = new DefaultTaskConfigurer( this.dataSources.iterator().next(), taskProperties.getTablePrefix()); } else { taskConfigurer = new DefaultTaskConfigurer( taskProperties.getTablePrefix()); } this.context.getBeanFactory().registerSingleton("taskConfigurer", taskConfigurer); return taskConfigurer; } else { if(configurers == 1) { return this.context.getBean(TaskConfigurer.class); } else { throw new IllegalStateException("Expected one TaskConfigurer but found " + configurers); } } }
Source:
private void renderCommands() { commandTable.removeAllRows(); if (scheme.getItemCount() > 0) { FetchInfo fetchInfo = fetch.get(scheme.getValue(scheme.getSelectedIndex())); for (String commandName : Natives.keys(fetchInfo.commands())) { String command = fetchInfo.command(commandName); if (command.contains("@*:")) { command = command.replace("@*:", "@" + Window.Location.getHostName() + ":"); } CopyableLabel copyLabel = new CopyableLabel(command); copyLabel.setStyleName(style.clippy()); insertCommand(commandName, copyLabel); } } insertPatch(); insertCommand(null, scheme); }

Target:
private void renderCommands() { commandTable.removeAllRows(); if (scheme.getItemCount() > 0) { FetchInfo fetchInfo = fetch.get(scheme.getValue(scheme.getSelectedIndex())); for (String commandName : Natives.keys(fetchInfo.commands())) { CopyableLabel copyLabel = new CopyableLabel(fetchInfo.command(commandName)); copyLabel.setStyleName(style.clippy()); insertCommand(commandName, copyLabel); } } insertPatch(); insertCommand(null, scheme); }
Source:
public SpiderPanel(ExtensionSpider extension, SpiderParam spiderScanParam) { super("spider", new ImageIcon(SpiderPanel.class.getResource("/resource/icon/16/spider.png")), extension); tabbedPane = new JTabbedPane(); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { switch(tabbedPane.getSelectedIndex()) { case 0: getUrlsExportButton().setEnabled(true); getUrlsExportButton().setVisible(true); getMessagesExportButton().setEnabled(false); getMessagesExportButton().setVisible(false); break; case 1: getUrlsExportButton().setEnabled(false); getUrlsExportButton().setVisible(false); getMessagesExportButton().setEnabled(true); getMessagesExportButton().setVisible(true); break; } } }); this.extension = extension; this.setDefaultAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK, false)); this.setMnemonic(Constant.messages.getChar("spider.panel.mnemonic")); }

Target:
public SpiderPanel(ExtensionSpider extension, SpiderParam spiderScanParam) { super("spider", new ImageIcon(SpiderPanel.class.getResource("/resource/icon/16/spider.png")), extension); tabbedPane = new JTabbedPane(); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { switch(tabbedPane.getSelectedIndex()) { case 0: getExportButton().setTable(getUrlsTable()); break; case 1: getExportButton().setTable(getMessagesTable()); break; } } }); this.extension = extension; this.setDefaultAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK, false)); this.setMnemonic(Constant.messages.getChar("spider.panel.mnemonic")); }
Source:
public void planCanPointToPublishedSurvey() { GuidCreatedOnVersionHolder surveyKeys = null; GuidVersionHolder keys = null; try { Survey survey = TestSurvey.getSurvey(SchedulePlanTest.class); surveyKeys = developerClient.createSurvey(survey); SchedulePlan plan = Tests.getSimpleSchedulePlan(); SimpleScheduleStrategy strategy = (SimpleScheduleStrategy) plan.getStrategy(); Activity activity = new Activity("Test", null, new SurveyReference(surveyKeys.getGuid(), surveyKeys.getCreatedOn())); assertEquals(ActivityType.SURVEY, activity.getActivityType()); strategy.getSchedule().getActivities().clear(); strategy.getSchedule().getActivities().add(activity); keys = developerClient.createSchedulePlan(plan); SchedulePlan newPlan = developerClient.getSchedulePlan(keys.getGuid()); plan.setGuid(newPlan.getGuid()); plan.setModifiedOn(newPlan.getModifiedOn()); Tests.getActivitiesFromSimpleStrategy(plan).set(0, Tests.getActivityFromSimpleStrategy(newPlan)); assertEquals(plan, newPlan); } catch(Exception e) { e.printStackTrace(); } finally { developerClient.deleteSchedulePlan(keys.getGuid()); admin.getSession().getAdminClient().deleteSurveyPermanently(surveyKeys); } }

Target:
public void planCanPointToPublishedSurvey() { GuidCreatedOnVersionHolder surveyKeys = null; GuidVersionHolder keys = null; try { Survey survey = TestSurvey.getSurvey(SchedulePlanTest.class); surveyKeys = developerClient.createSurvey(survey); SchedulePlan plan = Tests.getSimpleSchedulePlan(); SimpleScheduleStrategy strategy = (SimpleScheduleStrategy) plan.getStrategy(); Activity activity = new Activity("Test", null, new SurveyReference(surveyKeys.getGuid(), surveyKeys.getCreatedOn())); assertEquals(ActivityType.SURVEY, activity.getActivityType()); strategy.getSchedule().getActivities().clear(); strategy.getSchedule().getActivities().add(activity); keys = developerClient.createSchedulePlan(plan); SchedulePlan newPlan = developerClient.getSchedulePlan(keys.getGuid()); plan.setGuid(newPlan.getGuid()); plan.setModifiedOn(newPlan.getModifiedOn()); Tests.getActivitiesFromSimpleStrategy(plan).set(0, Tests.getActivityFromSimpleStrategy(newPlan)); assertEquals(plan, newPlan); } finally { developerClient.deleteSchedulePlan(keys.getGuid()); admin.getSession().getAdminClient().deleteSurveyPermanently(surveyKeys); } }
Source:
public void testList() throws StripeException { final ApplicationFee fee = ApplicationFee.retrieve(FEE_ID); final FeeRefundCollection reversals = fee.getRefunds().list(null); assertNotNull(reversals); assertEquals(1, reversals.getData().size()); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/application_fees/%s/refunds", fee.getId()) ); }

Target:
public void testList() throws StripeException { final ApplicationFee fee = getFeeFixture(); final Map<String, Object> params = new HashMap<String, Object>(); params.put("limit", 1); final FeeRefundCollection refunds = fee.getRefunds().list(params); assertNotNull(refunds); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/application_fees/%s/refunds", fee.getId()), params ); }
Source:
private void commonEvaluateFieldTypeMap(BlockStmt blockStmt, Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, int expectedMethodCallSize) { List<MethodCallExpr> retrieved = getMethodCallExprList(blockStmt, expectedMethodCallSize, "fieldTypeMap", "put"); for (Map.Entry<String, KiePMMLOriginalTypeGeneratedType> entry : fieldTypeMap.entrySet()) { assertTrue(retrieved.stream() .map(MethodCallExpr::getArguments) .anyMatch(arguments -> { boolean toReturn = arguments.size() == 2; Expression firstArgument = arguments.get(0); Expression secondArgument = arguments.get(1); toReturn &= firstArgument.isStringLiteralExpr() && ((StringLiteralExpr) firstArgument).getValue().equals(entry.getKey()); toReturn &= secondArgument.isObjectCreationExpr() && ((ObjectCreationExpr) secondArgument).getArgument(0).isStringLiteralExpr() && ((StringLiteralExpr) ((ObjectCreationExpr) secondArgument).getArgument(0)).getValue().equals(entry.getValue().getOriginalType()) && ((ObjectCreationExpr) secondArgument).getArgument(1).isStringLiteralExpr() && ((StringLiteralExpr) ((ObjectCreationExpr) secondArgument).getArgument(1)).getValue().equals(entry.getValue().getGeneratedType()); return toReturn; })); } }

Target:
private void commonEvaluateFieldTypeMap(BlockStmt blockStmt, Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, int expectedMethodCallSize) { List<MethodCallExpr> retrieved = getMethodCallExprList(blockStmt, expectedMethodCallSize, "fieldTypeMap", "put"); for (Map.Entry<String, KiePMMLOriginalTypeGeneratedType> entry : fieldTypeMap.entrySet()) { assertTrue(retrieved.stream() .map(MethodCallExpr::getArguments) .anyMatch(arguments -> evaluateFieldTypeMapPopulation(entry, arguments))); } }
Source:
public JsonElement view(@QueryParam("processNumber") String processNumber) { if (processNumber == null || processNumber.isEmpty()) { throw new WebApplicationException(400); } List<Mission> missions; try { final SearchMissionsDTO searchMissions = new SearchMissionsDTO(); searchMissions.setProcessNumber(processNumber); missions = searchMissions.sortedSearch(); } catch (final Exception e) { throw new WebApplicationException(404); } if (missions.isEmpty() || missions.size() > 1) { throw new WebApplicationException(404); } final Mission mission = missions.get(0); final JsonObject obj = super.view(mission).getAsJsonObject(); return obj; }

Target:
public JsonElement view(@QueryParam("processNumber") String processNumber) { if (processNumber == null || processNumber.isEmpty()) { throw new WebApplicationException(400); } List<Mission> missions; try { final SearchMissionsDTO searchMissions = new SearchMissionsDTO(); searchMissions.setProcessNumber(processNumber); missions = searchMissions.sortedSearch(); } catch (final Exception e) { throw new WebApplicationException(404); } if (missions.isEmpty() || missions.size() > 1) { throw new WebApplicationException(404); } final Mission mission = missions.get(0); return super.view(mission).getAsJsonObject(); }
Source:
public void millisSinceLastSweptUpdatesAsClockUpdates() { metrics.updateProgressForShard(CONS_ZERO, 100); waitForProgressToRecompute(); puncherStore.put(0, 50); assertMillisSinceLastSweptConservativeEquals(50); for (int i = 0; i < 10; i++) { clockTime = i; assertMillisSinceLastSweptConservativeEquals(50); } }

Target:
public void millisSinceLastSweptUpdatesAsClockUpdates() { metrics.updateProgressForShard(CONS_ZERO, 100); waitForProgressToRecompute(); puncherStore.put(0, 50); assertMillisSinceLastSweptConservativeEqualsClockTimeMinus(50); for (int i = 0; i < 10; i++) { clockTime = i; assertMillisSinceLastSweptConservativeEqualsClockTimeMinus(50); } }
Source:
private Constraint machineMoveCost(ConstraintFactory factory) { return factory.from(MrProcessAssignment.class) .filter(MrProcessAssignment::isMoved) .penalizeLong(MrConstraints.MACHINE_MOVE_COST, HardSoftLongScore.ofSoft(1L), MrProcessAssignment::getMachineMoveCost); }

Target:
private Constraint machineMoveCost(ConstraintFactory factory) { return factory.from(MrProcessAssignment.class) .filter(MrProcessAssignment::isMoved) .penalizeLong(MrConstraints.MACHINE_MOVE_COST, HardSoftLongScore.ONE_SOFT, MrProcessAssignment::getMachineMoveCost); }
Source:
public String getName() { return fType.getName(); }

Target:
public String getName() { ITmfEventType type = fType; if(type != null) { return type.getName(); } return ""; }
Source:
public List<CommandType> getCommandTypes() { return new ArrayList<>(commandTypes.values()); }

Target:
public List<CommandType> getCommandTypes() { return unmodifiableList(new ArrayList<>(commandTypes.values())); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!areCameraAndRecordAudioPermissionsGranted(this)) { finish(); return; } setContentView(R.layout.activity_capture_selfie_video_new_api); if (null == savedInstanceState) { getFragmentManager().beginTransaction() .replace(R.id.container, Camera2VideoFragment.newInstance()) .commit(); } ToastUtils.showLongToast(getString(R.string.start_video_capture_instruction)); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!areCameraAndRecordAudioPermissionsGranted(this)) { finish(); return; } setContentView(R.layout.activity_capture_selfie_video); if (null == savedInstanceState) { getFragmentManager().beginTransaction() .replace(R.id.container, Camera2VideoFragment.newInstance()) .commit(); } ToastUtils.showLongToast(getString(R.string.start_video_capture_instruction)); }
Source:
public Iterable<ChromeDevtoolsDomain> get() { Stetho.DefaultInspectorModulesBuilder builder = new Stetho.DefaultInspectorModulesBuilder(mContext); if (Build.VERSION.SDK_INT >= DatabaseConstants.MIN_API_LEVEL) { ContentProviderSchema calendarsSchema = new ContentProviderSchema.Builder() .table(new Table.Builder() .uri(CalendarContract.Calendars.CONTENT_URI) .projection(new String[] { CalendarContract.Calendars._ID, CalendarContract.Calendars.NAME, CalendarContract.Calendars.ACCOUNT_NAME, CalendarContract.Calendars.IS_PRIMARY, }) .build()) .build(); ContentProviderSchema eventsSchema = new ContentProviderSchema.Builder() .table(new Table.Builder() .uri(CalendarContract.Events.CONTENT_URI) .projection(new String[]{ CalendarContract.Events._ID, CalendarContract.Events.TITLE, CalendarContract.Events.DESCRIPTION, CalendarContract.Events.ACCOUNT_NAME, CalendarContract.Events.DTSTART, CalendarContract.Events.DTEND, CalendarContract.Events.CALENDAR_ID, }) .build()) .build(); Database database = new Database(); database.add(new SqliteDatabaseDriver(mContext, new DefaultDatabaseFilesProvider(mContext))); database.add(new ContentProviderDatabaseDriver(mContext, calendarsSchema, eventsSchema)); builder.provide(database); } return builder.finish(); }

Target:
public Iterable<ChromeDevtoolsDomain> get() { return new Stetho.DefaultInspectorModulesBuilder(mContext) .provideDatabaseDriver(createContentProviderDatabaseDriver(mContext)) .finish(); }
Source:
} catch (Exception e) { LOG.error("Unable to expose RPS/JSON result field"); resultField = null; }

Target:
} catch (Exception e) { log.error("Unable to expose RPS/JSON result field"); }
Source:
public XHMMModel(final double eventStartProbability, final double meanEventSize, final double deletionMeanShift, final double duplicationMeaShift) { super(new XHMMEmissionProbabilityCalculator( ParamUtils.isNegativeOrZero(deletionMeanShift, "Deletion coverage shift must be negative."), ParamUtils.isPositiveOrZero(duplicationMeaShift, "Duplication coverage shift must be positive"), EMISSION_SD, RandomGeneratorFactory.createRandomGenerator(new Random(RANDOM_SEED))), eventStartProbability, meanEventSize); }

Target:
public XHMMModel(final double eventStartProbability, final double meanEventSize, final double deletionMeanShift, final double duplicationMeaShift) { super(new XHMMEmissionProbabilityCalculator( deletionMeanShift, duplicationMeaShift, EMISSION_SD, RandomGeneratorFactory.createRandomGenerator(new Random(RANDOM_SEED))), eventStartProbability, meanEventSize); }
Source:
protected void writeNativeFields(Native nativ, JsonGenerator gen) throws IOException { switch (nativ.getRequestOneofCase()) { case REQUEST_NATIVE: writeNativeObject(nativ, gen); break; case REQUEST: gen.writeStringField("request", nativ.getRequest()); break; case REQUESTONEOF_NOT_SET: checkRequired(false); } if (nativ.hasVer()) { gen.writeStringField("ver", nativ.getVer()); } writeEnums("api", nativ.getApiList(), gen); writeEnums("battr", nativ.getBattrList(), gen); }

Target:
protected void writeNativeFields(Native nativ, JsonGenerator gen) throws IOException { switch (nativ.getRequestOneofCase()) { case REQUEST_NATIVE: { if(factory().isForceNativeAsObject()) { gen.writeFieldName("request"); nativeWriter().writeNativeRequest(nativ.getRequestNative(), gen); } else { String nativeString = factory().newNativeWriter().writeNativeRequest(nativ.getRequestNative()); gen.writeStringField("request", nativeString); } } break; case REQUEST: gen.writeStringField("request", nativ.getRequest()); break; case REQUESTONEOF_NOT_SET: checkRequired(false); } if (nativ.hasVer()) { gen.writeStringField("ver", nativ.getVer()); } writeEnums("api", nativ.getApiList(), gen); writeEnums("battr", nativ.getBattrList(), gen); }
Source:
public static boolean hasLogMessage(String logFileName, String logMessage, Predicate<String>... filters) throws Exception { Path logPath = LoggingUtil.getInServerLogPath(logFileName); return isMessageInLogFile(logPath, logMessage); }

Target:
public static boolean hasLogMessage(String logFileName, String logMessage, Predicate<String>... filters) throws Exception { Path logPath = LoggingUtil.getInServerLogPath(logFileName); return isMessageInLogFile(logPath, logMessage, filters); }
Source:
public Response updateIssue(@Context HttpServletRequest request, @PathParam("issueId") long issueId, @FormParam("title") String title, @FormParam("description") String description, @FormParam("assignee") String assigneeNetID, @FormParam("status") Boolean status) throws IOException { Issue issue = issues.findIssueById(getRepositoryEntity(), issueId).get(0); issue.setTitle(title); issue.setDescription(description); if (!assigneeNetID.isEmpty()) { User assignee = users.findByNetId(assigneeNetID); checkCollaborator(assignee); issue.setAssignee(assignee); } if(status != null && status){ issue.setOpen(true); } else if (status != null && !status) { issue.setOpen(false); issue.setClosed(new Date()); } issues.merge(issue); return redirect(issue.getURI()); }

Target:
public Response updateIssue(@Context HttpServletRequest request, @PathParam("issueId") long issueId, @FormParam("title") String title, @FormParam("description") String description, @FormParam("assignee") String assigneeNetID, @FormParam("status") Boolean status) throws IOException { Issue issue = issues.findIssueById(getRepositoryEntity(), issueId).get(0); issue.setTitle(title); issue.setDescription(description); if (!Strings.isNullOrEmpty(assigneeNetID)) { User assignee = users.findByNetId(assigneeNetID); checkCollaborator(assignee); issue.setAssignee(assignee); } else { issue.setAssignee(null); } if(status != null && status){ issue.setOpen(true); } else if (status != null && !status) { issue.setOpen(false); issue.setClosed(new Date()); } issues.merge(issue); return redirect(issue.getURI()); }
Source:
public long getZkBarrierTimeoutMs() { return getLong(ZK_BARRIER_TIMEOUT_MS, DEFAULT_BARRIER_TIMEOUT_MS); }

Target:
public int getZkBarrierTimeoutMs() { return getInt(ZK_CONSENSUS_TIMEOUT_MS, DEFAULT_CONSENSUS_TIMEOUT_MS); }
Source:
public List<ChangeData> queryChanges(final String queryString) throws OrmException, QueryParseException { final Predicate<ChangeData> visibleToMe = queryBuilder.is_visible(); Predicate<ChangeData> s = compileQuery(queryString, visibleToMe); List<ChangeData> results = new ArrayList<ChangeData>(); HashSet<Change.Id> want = new HashSet<Change.Id>(); for (ChangeData d : ((ChangeDataSource) s).read()) { if (d.hasChange()) { if (visibleToMe.match(d)) { results.add(d); } } else { want.add(d.getId()); } } if (!want.isEmpty()) { for (Change c : db.get().changes().get(want)) { ChangeData d = new ChangeData(c); if (visibleToMe.match(d)) { results.add(d); } } } Collections.sort(results, sortkeyAfter != null ? cmpAfter : cmpBefore); int limit = limit(s); if(results.size() > maxLimit){ setMoreResults(true); } if (limit < results.size()) { results = results.subList(0, limit); } if (sortkeyAfter != null) { Collections.reverse(results); } return results; }

Target:
public List<ChangeData> queryChanges(final String queryString) throws OrmException, QueryParseException { final Predicate<ChangeData> visibleToMe = queryBuilder.is_visible(); Predicate<ChangeData> s = compileQuery(queryString, visibleToMe); List<ChangeData> results = new ArrayList<ChangeData>(); HashSet<Change.Id> want = new HashSet<Change.Id>(); for (ChangeData d : ((ChangeDataSource) s).read()) { if (d.hasChange()) { if (visibleToMe.match(d)) { results.add(d); } } else { want.add(d.getId()); } } if (!want.isEmpty()) { for (Change c : db.get().changes().get(want)) { ChangeData d = new ChangeData(c); if (visibleToMe.match(d)) { results.add(d); } } } Collections.sort(results, sortkeyAfter != null ? cmpAfter : cmpBefore); int limit = limit(s); if (results.size() > maxLimit) { moreResults = true; } if (limit < results.size()) { results = results.subList(0, limit); } if (sortkeyAfter != null) { Collections.reverse(results); } return results; }
Source:
HL7Parser201305Utils() { }

Target:
private HL7Parser201305Utils() { }
Source:
public void setUp() throws Exception { user = accounts.user(); admin = accounts.admin(); initSsh(admin); project = new Project.NameKey("p"); session = new RestSession(server, user); SshSession sshSession = new SshSession(server, admin); createProject(sshSession, project.get()); git = cloneProject(sshSession.getUrl() + "/" + project.get()); db = reviewDbProvider.open(); atrScope.set(atrScope.newContext(reviewDbProvider, sshSession, identifiedUserFactory.create(Providers.of(db), user.getId()))); ProjectConfig cfg = projectCache.checkedGet(allProjects).getConfig(); AccountGroup.UUID anonymousUsers = SystemGroupBackend.getGroup(ANONYMOUS_USERS).getUUID(); grant(cfg, Permission.forLabel("Code-Review"), -2, 2, anonymousUsers, "refs/heads/*"); grant(cfg, Permission.SUBMIT, anonymousUsers, "refs/heads/*"); codeReview = checkNotNull(cfg.getLabelSections().get("Code-Review")); codeReview.setCopyMinScore(false); codeReview.setCopyMaxScore(false); codeReview.setCopyAllScoresOnTrivialRebase(false); codeReview.setCopyAllScoresIfNoCodeChange(false); saveProjectConfig(cfg); }

Target:
public void setUp() throws Exception { user = accounts.user(); admin = accounts.admin(); initSsh(admin); project = new Project.NameKey("p"); session = new RestSession(server, user); SshSession sshSession = new SshSession(server, admin); createProject(sshSession, project.get()); git = cloneProject(sshSession.getUrl() + "/" + project.get()); db = reviewDbProvider.open(); atrScope.set(atrScope.newContext(reviewDbProvider, sshSession, identifiedUserFactory.create(Providers.of(db), user.getId()))); sshSession.close(); ProjectConfig cfg = projectCache.checkedGet(allProjects).getConfig(); AccountGroup.UUID anonymousUsers = SystemGroupBackend.getGroup(ANONYMOUS_USERS).getUUID(); grant(cfg, Permission.forLabel("Code-Review"), -2, 2, anonymousUsers, "refs/heads/*"); grant(cfg, Permission.SUBMIT, anonymousUsers, "refs/heads/*"); codeReview = checkNotNull(cfg.getLabelSections().get("Code-Review")); codeReview.setCopyMinScore(false); codeReview.setCopyMaxScore(false); codeReview.setCopyAllScoresOnTrivialRebase(false); codeReview.setCopyAllScoresIfNoCodeChange(false); saveProjectConfig(cfg); }
Source:
private Map<String, File> createOutputMapFromFile(final File outputMapFile) { final Map<String, File> outputMap = new HashMap<String, File>(); final TabbedTextFileWithHeaderParser parser = new TabbedTextFileWithHeaderParser(outputMapFile); for (final TabbedTextFileWithHeaderParser.Row row : parser) { final String id = row.getField("READ_GROUP_ID"); final String output = row.getField("OUTPUT"); final File outputPath = new File(output); outputMap.put(id, outputPath); } parser.close(); return outputMap; }

Target:
private static Map<String, File> createOutputMapFromFile(final File outputMapFile) { final Map<String, File> outputMap = new HashMap<String, File>(); final TabbedTextFileWithHeaderParser parser = new TabbedTextFileWithHeaderParser(outputMapFile); for (final TabbedTextFileWithHeaderParser.Row row : parser) { final String id = row.getField("READ_GROUP_ID"); final String output = row.getField("OUTPUT"); final File outputPath = new File(output); outputMap.put(id, outputPath); } CloserUtil.close(parser); return outputMap; }
Source:
public Update createStatement(String sql) { Foreman updateForeman = foreman.createChild(); return new Update(this, statementLocator, statementRewriter, statementBuilder, sql, new ConcreteStatementContext(globalStatementAttributes, MappingRegistry.copyOf(mappingRegistry), updateForeman), timingCollector, updateForeman, collectorFactoryRegistry); }

Target:
public Update createStatement(String sql) { Foreman updateForeman = foreman.createChild(); CollectorFactoryRegistry updateCollectors = collectorFactoryRegistry.createChild(); return new Update(this, statementLocator, statementRewriter, statementBuilder, sql, new ConcreteStatementContext(globalStatementAttributes, MappingRegistry.copyOf(mappingRegistry), updateForeman, updateCollectors), timingCollector, updateForeman, updateCollectors); }
Source:
public void generatePreviewForSliceTheoremPaperUsingAbbr() throws Exception { BstPreviewLayout bstPreviewLayout = new BstPreviewLayout(Paths.get(BstPreviewLayoutTest.class.getResource("abbrv.bst").toURI())); String preview = bstPreviewLayout.generatePreview(getSliceTheoremPaper(), bibDatabase); assertEquals("T. Diez. Slice theorem for fréchet group actions and covariant symplectic field theory. #may# 2014.", preview); }

Target:
public void generatePreviewForSliceTheoremPaperUsingAbbr() throws Exception { BstPreviewLayout bstPreviewLayout = new BstPreviewLayout(Paths.get(BstPreviewLayoutTest.class.getResource("abbrv.bst").toURI())); String preview = bstPreviewLayout.generatePreview(getSliceTheoremPaper(), bibDatabase); assertEquals("T. Diez. Slice theorem for fréchet group actions and covariant symplectic field theory. May 2014.", preview); }
Source:
public VisualEditorEditTemplateDialog selectSuggestedTemplate(int index) { switchToIFrame(); waitForElementVisibleByElement(suggestedWidget); WebElement selected = suggestedTemplates.get(index).findElement(labelBy); selected.click(); switchOutOfIFrame(); PageObjectLogging.log("selectSuggestedTemplate", "Template selected: " + selected.getText(), true); return new VisualEditorEditTemplateDialog(driver); }

Target:
public VisualEditorEditTemplateDialog selectSuggestedTemplate(int index) { switchToIFrame(); try { waitForElementVisibleByElement(suggestedWidget); WebElement selected = suggestedTemplates.get(index).findElement(labelBy); selected.click(); PageObjectLogging.log( "selectSuggestedTemplate", "Suggested template selected: " + selected.getText(), true ); return new VisualEditorEditTemplateDialog(driver); } finally { switchOutOfIFrame(); } }
Source:
public TkLogged(final Take take, final Target trget) { this.target = trget; this.origin = take; }

Target:
TkLogged(final Take take, final Target trget) { this.target = trget; this.origin = take; }
Source:
private void lockTouchedVm(Guid vmId) { if (!touchedVms.contains(vmId)) { lock(vmId); touchedVms.add(vmId); touchedVmsOrdered.push(vmId); } }

Target:
private void lockTouchedVm(Guid vmId) { lockOnce(vmId); touchedVms.push(vmId); }
Source:
private Serializer() { dateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; localDateFormatter = DateTimeFormatter.ISO_DATE; objectMapper = new ObjectMapper() .registerModule(new JavaTimeModule() .addSerializer(ZonedDateTime.class, new ZonedDateTimeSerializer(dateTimeFormatter)) .addSerializer(LocalDate.class, new LocalDateSerializer(localDateFormatter))) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) .configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); }

Target:
private Serializer() { dateTimeFormatter = DateTimeFormatter.ISO_INSTANT; localDateFormatter = DateTimeFormatter.ISO_DATE; objectMapper = new ObjectMapper() .registerModule(new JavaTimeModule() .addSerializer(LocalDate.class, new LocalDateSerializer(localDateFormatter))) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) .configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); }
Source:
public void testEmptyMenu() { SessionWrapper session = mApp.getSession(); MenuLoader menuLoader = new MenuLoader(session.getPlatform(), session, "root", new TestLogger()); this.mChoices = menuLoader.getMenus(); Assert.assertEquals("Number of Menu roots in empty example", this.mChoices, 1); }

Target:
public void testEmptyMenu() { SessionWrapper session = mApp.getSession(); MenuLoader menuLoader = new MenuLoader(session.getPlatform(), session, "root", new TestLogger()); this.mChoices = menuLoader.getMenus(); Assert.assertEquals("Number of Menu roots in empty example", this.mChoices.length, 1); }
Source:
public void init() throws DBException { try { prop = getProperties(); fieldCount = Integer.parseInt(prop.getProperty(CoreWorkload.FIELD_COUNT_PROPERTY, CoreWorkload.FIELD_COUNT_PROPERTY_DEFAULT)); String keyClass = prop.getProperty("key.class", "java.lang.String"); String persistentClass = prop.getProperty("persistent.class", "generated.User"); Properties p = DataStoreFactory.createProps(); dataStore = DataStoreFactory.getDataStore(keyClass, persistentClass, p, new Configuration()); synchronized(GoraBenchmarkClient.class) { if(executed) return; executed = true; goraBenchmarkUtils.generateAvroSchema(fieldCount); String dataStoreName = goraBenchmarkUtils.getDataStore(p); goraBenchmarkUtils.generateMappingFile(dataStoreName); goraBenchmarkUtils.generateDataBeans(); } } catch (GoraException e) { } }

Target:
public void init() throws DBException { try { synchronized (GoraBenchmarkClient.class) { prop = getProperties(); totalFieldCount = Integer .parseInt(prop.getProperty(CoreWorkload.FIELD_COUNT_PROPERTY, CoreWorkload.FIELD_COUNT_PROPERTY_DEFAULT)); Properties properties = DataStoreFactory.createProps(); if (!executed) { executed = true; GoraBenchmarkUtils.generateAvroSchema(totalFieldCount); String dataStoreName = GoraBenchmarkUtils.getDataBase(properties); GoraBenchmarkUtils.generateMappingFile(dataStoreName); GoraBenchmarkUtils.generateDataBeans(); } String keyClass = prop.getProperty(Constants.KEY_CLASS_KEY, Constants.KEY_CLASS_VALUE); String persistentClass = prop.getProperty(Constants.PERSISTENCE_CLASS_KEY, Constants.PERSISTENCE_CLASS_VALUE); dataStore = DataStoreFactory.getDataStore(keyClass, persistentClass, properties, new Configuration()); } } catch (GoraException e) { LOG.info("There is a problem in initialising the DataStore \n {}", e.getMessage(), e); } }
Source:
public void execute(JobDelegateDataBean data) { try { executeDelegate(data); } catch (Exception e) { Logger.error(this, "An error occurred when running the Job Delegate: " + this.getClass(), e); } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { Logger.warn(this, e.getMessage(), e); } } }

Target:
public void execute(JobDelegateDataBean data) { try { executeDelegate(data); } catch (Exception e) { Logger.error(this, "An error occurred when running the Job Delegate: " + this.getClass(), e); } }
Source:
public void test() throws Exception { Element assertion = null; try { LOGGER.info("Invoking token service to get SAML assertion for " + USERNAME); assertion = wsClient.issueToken(SAMLUtil.SAML2_TOKEN_TYPE); String domElementAsString = DocumentUtil.getDOMElementAsString(assertion); System.out.println("assertion: " + domElementAsString); LOGGER.info("SAML assertion for " + USERNAME + " successfully obtained!"); } catch (WSTrustException wse) { LOGGER.error("Unable to issue assertion: " + wse.getMessage()); wse.printStackTrace(); System.exit(1); } URL wsdl = new URL("http://localhost:8080/picketlink-sts-ws/EchoService?wsdl"); QName serviceName = new QName("<LINK_0>", "EchoServiceService"); Service service = Service.create(wsdl, serviceName); EchoServiceRemote port = service.getPort(new QName("<LINK_0>", "EchoServicePort"), EchoServiceRemote.class); BindingProvider bp = (BindingProvider) port; ClientConfigUtil.setConfigHandlers(bp, "standard-jaxws-client-config.xml", "SAML WSSecurity Client"); bp.getRequestContext().put(SAML2Constants.SAML2_ASSERTION_PROPERTY, assertion); try { port.echo("Test"); } catch (Exception e) { LOGGER.error(e.getMessage(), e); fail(e.getMessage()); } if (wsClient != null) { wsClient.close(); } }

Target:
public void test() throws Exception { Element assertion = null; try { LOGGER.debug("Invoking token service to get SAML assertion for " + USERNAME); assertion = wsClient.issueToken(SAMLUtil.SAML2_TOKEN_TYPE); String domElementAsString = DocumentUtil.getDOMElementAsString(assertion); LOGGER.debug("assertion: " + domElementAsString); LOGGER.debug("SAML assertion for " + USERNAME + " successfully obtained!"); } catch (WSTrustException wse) { LOGGER.error("Unable to issue assertion: " + wse.getMessage()); wse.printStackTrace(); System.exit(1); } try { URL wsdl = new URL("http://localhost:8080/picketlink-sts-ws/EchoService?wsdl"); QName serviceName = new QName("<LINK_0>", "EchoServiceService"); Service service = Service.create(wsdl, serviceName); EchoServiceRemote port = service.getPort(new QName("<LINK_0>", "EchoServicePort"), EchoServiceRemote.class); BindingProvider bp = (BindingProvider) port; ClientConfigUtil.setConfigHandlers(bp, "standard-jaxws-client-config.xml", "SAML WSSecurity Client"); bp.getRequestContext().put(SAML2Constants.SAML2_ASSERTION_PROPERTY, assertion); port.echo("Test"); } finally { if (wsClient != null) { wsClient.close(); } } }
Source:
public Map createVolume(String sdUUID, String spUUID, String imgUUID, String size, Integer volFormat, Integer preallocate, Integer diskType, String volUUID, String desc, String srcImgUUID, String srcVolUUID) { try { DataCenter dataCenter = getDataCenterById(spUUID); StorageDomain storageDomain = dataCenter.getStorageDomainMap().get(sdUUID); final Volume volume = new Volume(); volume.setId(volUUID); volume.setSize(size); volume.setVolFormat(volFormat); volume.setPreallocate(preallocate); volume.setDiskType(diskType); volume.setImgUUID(imgUUID); volume.setDesc(desc); volume.setSrcImgUUID(srcImgUUID); volume.setSrcVolUUID(srcVolUUID); log.info("Adding volume: for sp: {}, sd: {}", new Object[] { volUUID, spUUID, sdUUID }); storageDomain.getVolumes().put(volUUID, volume); updateDataCenter(dataCenter); final Map resultMap = getOKStatus(); final Task task = new Task(getUuid()); resultMap.put("uuid", task.getId()); final Host host = VdsmManager.getInstance().getSpmMap().get(spUUID); syncTask(host, task); TaskProcessor.getInstance().addTask(new TaskRequest(TaskType.FINISH_CREATE_VOLUME, 3000l, task)); return resultMap; } catch (Exception e) { throw error(e); } }

Target:
public Map createVolume(String sdUUID, String spUUID, String imgUUID, String size, Integer volFormat, Integer preallocate, Integer diskType, String volUUID, String desc, String srcImgUUID, String srcVolUUID) { try { DataCenter dataCenter = getDataCenterById(spUUID); StorageDomain storageDomain = dataCenter.getStorageDomainMap().get(sdUUID); final Volume volume = new Volume(); volume.setId(volUUID); volume.setSize(size); volume.setVolFormat(volFormat); volume.setPreallocate(preallocate); volume.setDiskType(diskType); volume.setImgUUID(imgUUID); volume.setDesc(desc); volume.setSrcImgUUID(srcImgUUID); volume.setSrcVolUUID(srcVolUUID); log.info("Adding volume: for sp: {}, sd: {}", new Object[] { volUUID, spUUID, sdUUID }); storageDomain.getVolumes().put(volUUID, volume); updateDataCenter(dataCenter); final Map resultMap = getOKStatus(); final Task task = new Task(getUuid()); resultMap.put("uuid", task.getId()); syncTask((Host) VdsmManager.getInstance().getSpmHost(spUUID), task); TaskProcessor.getInstance().addTask(new TaskRequest(TaskType.FINISH_CREATE_VOLUME, 3000l, task)); return resultMap; } catch (Exception e) { throw error(e); } }
Source:
public static void init() throws IOException { Path appDataRoot = getAppDataRoot(); if (Files.notExists(appDataRoot)) { LOG.info("Creating application data root directory: {}", appDataRoot.toString()); Files.createDirectory(appDataRoot); } else { if (!Files.isDirectory(appDataRoot)) { throw new IOException( format("Application data root path '%s' is not a directory", appDataRoot.toString())); } if (!Files.isWritable(appDataRoot)) { throw new IOException( format("Application data root directory '%s' is not writable", appDataRoot.toString())); } } LOG.info("Application data directory: {}", appDataRoot.toString()); AppDataRootProvider.setAppDataRoot(appDataRoot); }

Target:
public static void init() throws IOException { Path appDataRoot = getAppDataRoot(); if (!appDataRoot.toFile().exists()) { LOG.info("Creating application data root directory: {}", appDataRoot); Files.createDirectory(appDataRoot); } else { if (!appDataRoot.toFile().isDirectory()) { throw new IOException(format("Application data root path '%s' is not a directory", appDataRoot)); } if (!Files.isWritable(appDataRoot)) { throw new IOException(format("Application data root directory '%s' is not writable", appDataRoot)); } } LOG.info("Application data directory: {}", appDataRoot.toString()); AppDataRootProvider.setAppDataRoot(appDataRoot); }