auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response getAssignmentPage(@PathParam("courseCode") String courseCode, @PathParam("editionCode") String editionCode, @PathParam("assignmentId") Long assignmentId) throws IOException { CourseEdition course = courses.find(courseCode, editionCode); if(!(currentUser.isAdmin() || currentUser.isAssisting(course))) { throw new UnauthorizedException(); } Assignment assignment = assignmentsDAO.find(course, assignmentId); List<Delivery> userDeliveries = assignedTAs.getLastDeliveries(assignment, currentUser); List<Delivery> lastDeliveries = deliveriesDAO.getLastDeliveries(assignment); AssignmentStats assignmentStats; if(currentUser.isAdmin()) { assignmentStats = deliveriesBackend.getAssignmentStats(assignment, lastDeliveries); } else { lastDeliveries.removeAll(userDeliveries); assignmentStats = deliveriesBackend.getAssignmentStats(userDeliveries); } Map<String, Object> parameters = Maps.newHashMap(); parameters.put("user", currentUser); parameters.put("course", course); parameters.put("assignment", assignment); parameters.put("assignmentStats", assignmentStats); parameters.put("deliveryStates", Delivery.State.values()); parameters.put("lastDeliveries", lastDeliveries); parameters.put("userDeliveries", userDeliveries); List<Locale> locales = Collections.list(request.getLocales()); return display(templateEngine.process("courses/assignments/assignment-view.ftl", locales, parameters)); }

Target:
public Response getAssignmentPage(@PathParam("courseCode") String courseCode, @PathParam("editionCode") String editionCode, @PathParam("assignmentId") Long assignmentId) throws IOException { CourseEdition course = courses.find(courseCode, editionCode); if(!(currentUser.isAdmin() || currentUser.isAssisting(course))) { throw new UnauthorizedException(); } Assignment assignment = assignmentsDAO.find(course, assignmentId); List<Delivery> currentUserDeliveries = assignedTAs.getLastDeliveries(assignment, currentUser); List<Delivery> allLastDeliveries = deliveriesDAO.getLastDeliveries(assignment); List<Delivery> filteredDeliveries = deliveriesDAO.getLastDeliveries(assignment); filteredDeliveries.removeAll(currentUserDeliveries); AssignmentStats userStats = deliveriesBackend.getAssignmentStats(currentUserDeliveries); AssignmentStats lastStats = deliveriesBackend.getAssignmentStats(assignment, allLastDeliveries); Map<String, Object> parameters = Maps.newHashMap(); parameters.put("user", currentUser); parameters.put("course", course); parameters.put("assignment", assignment); parameters.put("userStats", userStats); parameters.put("lastStats", lastStats); parameters.put("deliveryStates", Delivery.State.values()); parameters.put("userDeliveries", currentUserDeliveries); parameters.put("lastDeliveries", allLastDeliveries); parameters.put("filteredDeliveries", filteredDeliveries); List<Locale> locales = Collections.list(request.getLocales()); return display(templateEngine.process("courses/assignments/assignment-view.ftl", locales, parameters)); }
Source:
private static void assertDoesNotThrow(Executable executable, Object messageOrSupplier) { try { executable.execute(); } catch (Throwable t) { String message = buildPrefix(nullSafeGet(messageOrSupplier)) + "Unexpected exception thrown: " + t.getClass().getName() + addThrowableMessage(t); throw new AssertionFailedError(message, t); } }

Target:
private static void assertDoesNotThrow(Executable executable, Object messageOrSupplier) { try { executable.execute(); } catch (Throwable t) { throw createAssertionFailedError(messageOrSupplier, t); } }
Source:
public List<InetSocketAddress> getAllAddresses() { return new LinkedList<>(addresses); }

Target:
public Set<InetSocketAddress> getAllAddresses() { return Collections.unmodifiableSet(addresses); }
Source:
public EmailBuilder subject(final String val) { subject = val; String suffix = ""; if (!StringUtils.isEmpty(System.getenv("emailSubjectSuffix"))) { suffix = " [" + System.getenv("emailSubjectSuffix") + "]"; subject = subject + " " + suffix; } return this; }

Target:
public EmailBuilder subject(final String val) { subject = val; String suffix = ""; if (!StringUtils.isEmpty(env.getProperty("emailSubjectSuffix"))) { suffix = env.getProperty("emailSubjectSuffix"); subject = subject + " " +suffix; } return this; }
Source:
private Path getXDGConfigHome(FS fs) { String configHomePath = SystemReader.getInstance() .getenv(Constants.XDG_CONFIG_HOME); if (StringUtils.isEmptyOrNull(configHomePath)) { configHomePath = new File(fs.userHome(), ".config") .getAbsolutePath(); } if (!StringUtils.isEmptyOrNull(configHomePath)) { Path xdgHomePath = null; try { xdgHomePath = Paths.get(configHomePath); Files.createDirectories(xdgHomePath); return xdgHomePath; } catch (IOException | InvalidPathException e) { LOG.error(JGitText.get().createXDGConfigHomeFailed, xdgHomePath, e); } } return null; }

Target:
private Path getXDGConfigHome(FS fs) { String configHomePath = getenv(Constants.XDG_CONFIG_HOME); if (StringUtils.isEmptyOrNull(configHomePath)) { configHomePath = new File(fs.userHome(), ".config") .getAbsolutePath(); } Path xdgHomePath = null; try { xdgHomePath = Paths.get(configHomePath); Files.createDirectories(xdgHomePath); return xdgHomePath; } catch (IOException | InvalidPathException e) { LOG.error(JGitText.get().createXDGConfigHomeFailed, xdgHomePath, e); } return null; }
Source:
public static void writeKuraExtendedConfig( NetInterfaceConfig<? extends NetInterfaceAddressConfig> netInterfaceConfig) throws KuraException { NetInterfaceStatus netInterfaceStatus = null; boolean gotNetConfigIP4 = false; List<? extends NetInterfaceAddressConfig> netInterfaceAddressConfigs = netInterfaceConfig .getNetInterfaceAddresses(); if (netInterfaceAddressConfigs != null && !netInterfaceAddressConfigs.isEmpty()) { for (NetInterfaceAddressConfig netInterfaceAddressConfig : netInterfaceAddressConfigs) { List<NetConfig> netConfigs = netInterfaceAddressConfig.getConfigs(); if (netConfigs != null && !netConfigs.isEmpty()) { for (int i = 0; i < netConfigs.size(); i++) { NetConfig netConfig = netConfigs.get(i); if (netConfig instanceof NetConfigIP4) { netInterfaceStatus = ((NetConfigIP4) netConfig).getStatus(); gotNetConfigIP4 = true; } } } } } if (!gotNetConfigIP4) { netInterfaceStatus = NetInterfaceStatus.netIPv4StatusDisabled; } s_logger.debug("Setting NetInterfaceStatus to " + netInterfaceStatus + " for " + netInterfaceConfig.getName()); Properties kuraExtendedProps = KuranetConfig.getProperties(); if (!kuraExtendedProps.isEmpty()) { StringBuilder sb = new StringBuilder().append("net.interface.").append(netInterfaceConfig.getName()) .append(".config.ip4.status"); kuraExtendedProps.put(sb.toString(), netInterfaceStatus.toString()); try { KuranetConfig.storeProperties(kuraExtendedProps); } catch (IOException e) { s_logger.error("Failed to store properties in the kuranet.conf file ", e); throw KuraException.internalError(e.getMessage()); } } }

Target:
public static void writeKuraExtendedConfig( NetInterfaceConfig<? extends NetInterfaceAddressConfig> netInterfaceConfig) throws KuraException { NetInterfaceStatus netInterfaceStatus = null; boolean gotNetConfigIP4 = false; List<? extends NetInterfaceAddressConfig> netInterfaceAddressConfigs = netInterfaceConfig .getNetInterfaceAddresses(); if (netInterfaceAddressConfigs != null) { for (NetInterfaceAddressConfig netInterfaceAddressConfig : netInterfaceAddressConfigs) { List<NetConfig> netConfigs = netInterfaceAddressConfig.getConfigs(); if (netConfigs != null) { for (int i = 0; i < netConfigs.size(); i++) { NetConfig netConfig = netConfigs.get(i); if (netConfig instanceof NetConfigIP4) { netInterfaceStatus = ((NetConfigIP4) netConfig).getStatus(); gotNetConfigIP4 = true; } } } } } if (!gotNetConfigIP4) { netInterfaceStatus = NetInterfaceStatus.netIPv4StatusDisabled; } s_logger.debug("Setting NetInterfaceStatus to " + netInterfaceStatus + " for " + netInterfaceConfig.getName()); Properties kuraExtendedProps = KuranetConfig.getProperties(); if (!kuraExtendedProps.isEmpty()) { StringBuilder sb = new StringBuilder().append("net.interface.").append(netInterfaceConfig.getName()) .append(".config.ip4.status"); kuraExtendedProps.put(sb.toString(), netInterfaceStatus.toString()); try { KuranetConfig.storeProperties(kuraExtendedProps); } catch (IOException e) { s_logger.error("Failed to store properties in the kuranet.conf file.", e); throw KuraException.internalError(e.getMessage()); } } }
Source:
public TestableDataRetrieverTask(Bank bank) { super(Mockito.mock(MainActivity.class), 5); this.banks = new Bank[] { bank }; this.dialog = Mockito.mock(ProgressDialog.class); }

Target:
public TestableDataRetrieverTask(Bank bank) { super(Mockito.mock(MainActivity.class), BANK_ID); this.banks = new Bank[] { bank }; this.dialog = Mockito.mock(ProgressDialog.class); }
Source:
public FunctionLanguage getFunctionLanguage() { throw new UnsupportedOperationException( "This CatalogFunction is a InlineCatalogFunction. This method should not be called."); }

Target:
public FunctionLanguage getFunctionLanguage() { return FunctionLanguage.JAVA; }
Source:
private void ignoreVariable(VariableTree variableTree) { Symbol symbol = variableTree.symbol(); if (isCloseableOrAutoCloseableSubtype(symbol.type())) { executionState.markValueAs(symbol, new CloseableState.Ignored(variableTree)); } }

Target:
private void ignoreVariable(VariableTree variableTree) { executionState.markValueAs(variableTree.symbol(), new CloseableState.Ignored(variableTree)); }
Source:
public String format(LoggingEvent loggingEvent) { GelfMessage gelfMessage = gelfMessageAssembler.createGelfMessage(new Log4jLogEvent(loggingEvent)); return gelfMessage.toJson("") + System.lineSeparator(); }

Target:
public String format(LoggingEvent loggingEvent) { GelfMessage gelfMessage = gelfMessageAssembler.createGelfMessage(new Log4jLogEvent(loggingEvent)); return gelfMessage.toJson("") + Layout.LINE_SEP; }
Source:
public static void activate(final IDiagramEdgeEditPart self) { final DiagramEventBroker broker = DiagramEdgeEditPartOperation.getDiagramEventBroker(self); final RoutingStyle rstyle = (RoutingStyle) self.getNotationView().getStyle(NotationPackage.eINSTANCE.getRoutingStyle()); broker.addNotificationListener(rstyle, self.getEAdapterRoutingStyle()); final IPermissionAuthority auth = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(self.getEditingDomain().getResourceSet()); auth.addAuthorityListener(self.getEditPartAuthorityListener()); EditPartAuthorityListener editModeUpdater = self.getEditPartAuthorityListener(); if (editModeUpdater.shouldRefresh()) { editModeUpdater.refreshEditMode(); } }

Target:
public static void activate(final IDiagramEdgeEditPart self) { final DiagramEventBroker broker = DiagramEdgeEditPartOperation.getDiagramEventBroker(self); final RoutingStyle rstyle = (RoutingStyle) self.getNotationView().getStyle(NotationPackage.eINSTANCE.getRoutingStyle()); broker.addNotificationListener(rstyle, self.getEAdapterRoutingStyle()); final IPermissionAuthority auth = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(self.getEditingDomain().getResourceSet()); EditPartAuthorityListener editPartAuthorityListener = self.getEditPartAuthorityListener(); auth.addAuthorityListener(editPartAuthorityListener); if (editPartAuthorityListener.shouldRefresh()) { editPartAuthorityListener.refreshEditMode(); } }
Source:
public void execute(SensorContext context) { if (rules.length == 0) { LOG.debug("Skipping execution of eslint-based rules because none of them are activated"); return; } try { eslintBridgeServer.startServerLazily(context); Iterable<InputFile> inputFiles = getInputFiles(context); startProgressReport(inputFiles); for (InputFile inputFile : inputFiles) { if (inputFile.filename().endsWith(".vue")) { LOG.debug("Skipping analysis of Vue.js file {}", inputFile.uri()); } else { analyze(inputFile, context); } progressReport.nextFile(); } progressReport.stop(); } catch (NodeCommandException e) { LOG.debug(e.getMessage()); if (analysisWarnings != null) { analysisWarnings.addUnique("Some JavaScript rules were not executed. " + e.getMessage()); } } catch (Exception e) { LOG.error("Failure during analysis, " + eslintBridgeServer.getCommandInfo(), e); } finally { progressReport.cancel(); } }

Target:
public void execute(SensorContext context) { if (rules.length == 0) { LOG.debug("Skipping execution of eslint-based rules because none of them are activated"); return; } try { eslintBridgeServer.startServerLazily(context); Iterable<InputFile> inputFiles = getInputFiles(context); startProgressReport(inputFiles); for (InputFile inputFile : inputFiles) { if (inputFile.filename().endsWith(".vue")) { LOG.debug("Skipping analysis of Vue.js file {}", inputFile.uri()); } else { analyze(inputFile, context); } progressReport.nextFile(); } progressReport.stop(); } catch (ServerAlreadyFailedException e) { LOG.debug("Skipping start of eslint-bridge server due to the failure during first analysis"); LOG.debug("Skipping execution of eslint-based rules due to the problems with eslint-bridge server"); } catch (NodeCommandException e) { LOG.error(e.getMessage(), e); if (analysisWarnings != null) { analysisWarnings.addUnique("Some JavaScript rules were not executed. " + e.getMessage()); } } catch (Exception e) { LOG.error("Failure during analysis, " + eslintBridgeServer.getCommandInfo(), e); } finally { progressReport.cancel(); } }
Source:
public void loadEmptyPage(TabPosition position) { PageTitle title = new PageTitle(Constants.EMPTY_PAGE_TITLE, app.getWikiSite()); HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_MAIN_PAGE); loadPage(title, historyEntry, position); }

Target:
public void loadEmptyPage(TabPosition position) { PageTitle title = new PageTitle(Constants.EMPTY_PAGE_TITLE, app.getWikiSite()); HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_INTERNAL_LINK); loadPage(title, historyEntry, position); }
Source:
public static void readInputStreamAndValidateSize(InputStream inputStream, long expectedLength) throws IOException { int readVal = 0; long numRead = 0; do { readVal = inputStream.read(); numRead++; } while (readVal != -1); numRead--; Assert.assertEquals(expectedLength, numRead); }

Target:
public static void readInputStreamAndValidateSize(InputStream inputStream, long expectedLength) throws IOException { int readVal = 0; long numRead = 0; do { readVal = inputStream.read(); numRead++; } while (readVal != -1); numRead--; Assert.assertEquals("Unexpected inputstream read length", expectedLength, numRead); }
Source:
protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { final String attrName = operation.require(ModelDescriptionConstants.NAME).asString(); ProtocolServerMetrics metric = ProtocolServerMetrics.getStat(attrName); if (metric == null) { context.getFailureDescription().set(String.format("Unknown metric %s", attrName)); } else { final ServiceController<?> controller = context.getServiceRegistry(false) .getService(EndpointUtils.getServiceName(operation, name)); RestService service = (RestService) controller.getService(); ModelNode result = new ModelNode(); switch (metric) { case BYTES_READ: result.set(service.getTransport().getTotalBytesRead()); break; case BYTES_WRITTEN: result.set(service.getTransport().getTotalBytesWritten()); break; case TRANSPORT_RUNNING: result.set(service.getValue().getTransportStatus() == ComponentStatus.RUNNING); break; } context.getResult().set(result); } context.stepCompleted(); }

Target:
protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { final String attrName = operation.require(ModelDescriptionConstants.NAME).asString(); ProtocolServerMetrics metric = ProtocolServerMetrics.getStat(attrName); if (metric == null) { context.getFailureDescription().set(String.format("Unknown metric %s", attrName)); } else { final ServiceController<?> controller = context.getServiceRegistry(false) .getService(EndpointUtils.getServiceName(operation, name)); RestService service = (RestService) controller.getService(); RestServer server = service.getValue(); ModelNode result = new ModelNode(); switch (metric) { case BYTES_READ: result.set(server.getTransport().getTotalBytesRead()); break; case BYTES_WRITTEN: result.set(server.getTransport().getTotalBytesWritten()); break; case TRANSPORT_RUNNING: result.set(server.getTransportStatus() == ComponentStatus.RUNNING); break; } context.getResult().set(result); } context.stepCompleted(); }
Source:
public Volume detachVolumeViaDestroyVM(long vmId, long volumeId) { Volume result = orchestrateDetachVolumeFromVM(vmId, volumeId); return result; }

Target:
public Volume detachVolumeViaDestroyVM(long vmId, long volumeId) { return orchestrateDetachVolumeFromVM(vmId, volumeId); }
Source:
default JsonArray getJsonArray(JsonObject jsonObject) throws DataException { try { return jsonObject.getJsonArray(this.toString()); } catch (RuntimeException e) { throw new DataException("Not possible to retrieve JsonArray value for key " + this.toString() + ". Exception: " + e.getMessage()); } }

Target:
default JsonArray getJsonArray(JsonObject jsonObject) throws DataException { try { return jsonObject.getJsonArray(this.toString()); } catch (ClassCastException | NullPointerException e) { throw new DataException("Not possible to retrieve JsonArray value for key " + this.toString() + ". Exception: " + e.getMessage()); } }
Source:
protected ConnectedAnalysisConfiguration prepareAnalysisConfig(Path projectBaseDir, List<ClientInputFile> inputFiles, Map<String, String> mergedExtraProps) { SonarLintLogger.get().debug("Connected mode (using configuration of '" + binding.projectKey() + "' in server '" + binding.connectionId() + "')"); return ConnectedAnalysisConfiguration.builder() .setProjectKey(binding.projectKey()) .setBaseDir(projectBaseDir) .addInputFiles(inputFiles) .putAllExtraProperties(mergedExtraProps) .build(); }

Target:
protected ConnectedAnalysisConfiguration prepareAnalysisConfig(Path projectBaseDir, List<ClientInputFile> inputFiles, Map<String, String> mergedExtraProps) { SonarLintLogger.get().debug("Connected mode (using configuration of '" + binding.projectKey() + "' in connection '" + binding.connectionId() + "')"); return ConnectedAnalysisConfiguration.builder() .setProjectKey(binding.projectKey()) .setBaseDir(projectBaseDir) .addInputFiles(inputFiles) .putAllExtraProperties(mergedExtraProps) .build(); }
Source:
public RoadAccess getAccess(String highwayTag, TransportationMode transportationMode, RoadAccess _default) { if (transportationMode == TransportationMode.MOTOR_VEHICLE) { if (highwayTag.equals("track")) return RoadAccess.FORESTRY; } return super.getAccess(highwayTag, transportationMode, _default); }

Target:
public RoadAccess getAccess(String highwayTag, TransportationMode transportationMode, RoadAccess _default) { if (transportationMode == TransportationMode.MOTOR_VEHICLE) { if (highwayTag.equals("track")) return RoadAccess.DESTINATION; } return super.getAccess(highwayTag, transportationMode, _default); }
Source:
protected XingUser doInBackground(Activity... params) { XingApi api = new XingApi.Builder() .consumerKey(BuildConfig.OAUTH_CONSUMER_KEY) .consumerSecret(BuildConfig.OAUTH_CONSUMER_SECRET) .accessToken(Prefs.getInstance(ProfileActivity.this).getOauthToken()) .accessSecret(Prefs.getInstance(ProfileActivity.this).getOauthSecret()) .apiEndpoint("<LINK_0>") .logLevel(Level.BODY) .build(); UserProfilesResource profilesResource = api.resource(UserProfilesResource.class); ProfileEditingResource editingResource = api.resource(ProfileEditingResource.class); Response<XingUser, Object> response = null; try { editingResource.updateUserGeneralInformation() .formField("academic_title", "Ing.").enqueue(new Callback<String, String>() { @Override public void onResponse(Response<String, String> response) { if (response.isSuccess()) Log.i("Update res", response.raw().toString()); } @Override public void onFailure(Throwable t) { Log.e("Error", t.getLocalizedMessage(), t); } }); response = profilesResource.getYourProfile().execute(); Response<List<SearchResult>, Object> xingUsers = profilesResource.findUsersByKeyword("Rocco Bruno") .queryParam("user_fields", "display_name, id") .execute(); XingUser ss = xingUsers.body().get(0).getSearchResultItem(); Log.d("Search ResultUser", ss.toString()); Log.d("Search Request", xingUsers.body().toString()); return response.body(); } catch (Exception e) { e.printStackTrace(); } if (response != null) { return response.body(); } else { return null; } }

Target:
protected XingUser doInBackground(Activity... params) { XingApi api = new XingApi.Builder() .consumerKey(BuildConfig.OAUTH_CONSUMER_KEY) .consumerSecret(BuildConfig.OAUTH_CONSUMER_SECRET) .accessToken(Prefs.getInstance(ProfileActivity.this).getOauthToken()) .accessSecret(Prefs.getInstance(ProfileActivity.this).getOauthSecret()) .apiEndpoint("<LINK_0>") .logLevel(Level.BODY) .build(); UserProfilesResource profilesResource = api.resource(UserProfilesResource.class); ProfileEditingResource editingResource = api.resource(ProfileEditingResource.class); Response<XingUser, Object> response = null; try { editingResource.updateUserGeneralInformation() .formField("academic_title", "Ing.").enqueue(new Callback<String, String>() { @Override public void onResponse(Response<String, String> response) { if (response.isSuccess()) { Log.i("Update res", response.raw().toString()); } } @Override public void onFailure(Throwable t) { Log.e("Error", t.getLocalizedMessage(), t); } }); response = profilesResource.getYourProfile().execute(); Response<List<SearchResult>, Object> xingUsers = profilesResource.findUsersByKeyword("Rocco Bruno") .queryParam("user_fields", "display_name, id") .execute(); XingUser ss = xingUsers.body().get(0).getSearchResultItem(); Log.d("Search ResultUser", ss.toString()); Log.d("Search Request", xingUsers.body().toString()); return response.body(); } catch (Exception e) { e.printStackTrace(); } if (response != null) { return response.body(); } else { return null; } }
Source:
public boolean startsWith(Path path) { if (path.getFileSystem() != this.parentFileSystem) { return false; } String[] thisPathElements = this.splitToElements(); String[] otherPathElements = ((AzurePath) path).splitToElements(); if (otherPathElements.length > thisPathElements.length) { return false; } for (int i = 0; i < otherPathElements.length; i++) { if (!otherPathElements[i].equals(thisPathElements[i])) { return false; } } return true; }

Target:
public boolean startsWith(Path path) { if (!path.getFileSystem().equals(this.parentFileSystem)) { return false; } String[] thisPathElements = this.splitToElements(); String[] otherPathElements = ((AzurePath) path).splitToElements(); if (otherPathElements.length > thisPathElements.length) { return false; } for (int i = 0; i < otherPathElements.length; i++) { if (!otherPathElements[i].equals(thisPathElements[i])) { return false; } } return true; }
Source:
public Change insert() throws OrmException, IOException { ReviewDb db = dbProvider.get(); ChangeUpdate update = updateFactory.create(change, change.getCreatedOn()); db.changes().beginTransaction(change.getId()); try { ChangeUtil.insertAncestors(db, patchSet.getId(), commit); db.patchSets().insert(Collections.singleton(patchSet)); db.changes().insert(Collections.singleton(change)); LabelTypes labelTypes = refControl.getProjectControl().getLabelTypes(); approvalsUtil.addReviewers(db, update, labelTypes, change, patchSet, patchSetInfo, reviewers, Collections.<Account.Id> emptySet()); if (changeMessage != null) { db.changeMessages().insert(Collections.singleton(changeMessage)); } db.commit(); } finally { db.rollback(); } CheckedFuture<?, IOException> f = mergeabilityChecker.updateAndIndexAsync(change); update.commit(); gitRefUpdated.fire(change.getProject(), patchSet.getRefName(), ObjectId.zeroId(), commit); if (runHooks) { hooks.doPatchsetCreatedHook(change, patchSet, db); } if (sendMail) { try { CreateChangeSender cm = createChangeSenderFactory.create(change); cm.setFrom(change.getOwner()); cm.setPatchSet(patchSet, patchSetInfo); cm.addReviewers(reviewers); cm.addExtraCC(extraCC); cm.send(); } catch (Exception err) { log.error("Cannot send email for new change " + change.getId(), err); } } f.checkedGet(); return change; }

Target:
public Change insert() throws OrmException, IOException { ReviewDb db = dbProvider.get(); ChangeUpdate update = updateFactory.create(change, change.getCreatedOn()); db.changes().beginTransaction(change.getId()); try { ChangeUtil.insertAncestors(db, patchSet.getId(), commit); db.patchSets().insert(Collections.singleton(patchSet)); db.changes().insert(Collections.singleton(change)); LabelTypes labelTypes = refControl.getProjectControl().getLabelTypes(); approvalsUtil.addReviewers(db, update, labelTypes, change, patchSet, patchSetInfo, reviewers, Collections.<Account.Id> emptySet()); if (changeMessage != null) { db.changeMessages().insert(Collections.singleton(changeMessage)); } db.commit(); } finally { db.rollback(); } update.commit(); CheckedFuture<?, IOException> f = mergeabilityChecker.updateAndIndexAsync(change); gitRefUpdated.fire(change.getProject(), patchSet.getRefName(), ObjectId.zeroId(), commit); if (runHooks) { hooks.doPatchsetCreatedHook(change, patchSet, db); } if (sendMail) { try { CreateChangeSender cm = createChangeSenderFactory.create(change); cm.setFrom(change.getOwner()); cm.setPatchSet(patchSet, patchSetInfo); cm.addReviewers(reviewers); cm.addExtraCC(extraCC); cm.send(); } catch (Exception err) { log.error("Cannot send email for new change " + change.getId(), err); } } f.checkedGet(); return change; }
Source:
public String getResourceContent(String name) throws IOException { if (getEngineContext() != null) { try (InputStream is = getResourceAsStream(name)) { if (is == null) { return FileUtils.readFileToString(new File(name), DEFAULT_ENCODING); } return IOUtils.toString(is, DEFAULT_ENCODING); } catch (Exception e) { } } return null; }

Target:
public String getResourceContent(String name) throws IOException { if (getEngineContext() != null) { try (InputStream is = getResourceAsStream(name)) { if (is != null) { return IOUtils.toString(is, DEFAULT_ENCODING); } } } return FileUtils.readFileToString(new File(name), DEFAULT_ENCODING); }
Source:
public ExperimentModel getExperimentByTypeInstanceId(final Integer experimentType, final Integer instanceId) { try { final Criteria criteria = this.getSession().createCriteria(this.getPersistentClass()); criteria.add(Restrictions.eq("geoLocation.locationId", instanceId)); criteria.add(Restrictions.eq("typeId", experimentType)); final List<ExperimentModel> list = criteria.list(); if (list != null && !list.isEmpty()) { return list.get(0); } } catch (final HibernateException e) { final String message = "Error at getExperimentByProjectIdAndLocation=" + instanceId + " query at ExperimentDao: " + e.getMessage(); ExperimentDao.LOG.error(message, e); throw new MiddlewareQueryException(message, e); } return null; }

Target:
public ExperimentModel getExperimentByTypeInstanceId(final Integer experimentType, final Integer instanceId) { try { final Criteria criteria = this.getSession().createCriteria(this.getPersistentClass()); criteria.add(Restrictions.eq("geoLocation.locationId", instanceId)); criteria.add(Restrictions.eq("typeId", experimentType)); final List<ExperimentModel> list = criteria.list(); if (list != null && !list.isEmpty()) { return list.get(0); } } catch (final HibernateException e) { final String message = "Error at getExperimentByTypeInstanceId=" + instanceId + " query at ExperimentDao: " + e.getMessage(); ExperimentDao.LOG.error(message, e); throw new MiddlewareQueryException(message, e); } return null; }
Source:
private void initDevice() throws FunctionalException { try { this.device = this.domainHelperService.findDlmsDevice(this.deviceIdentification, this.ipAddress); } catch (final ProtocolAdapterException e) { throw new RecoverKeyException(e.getMessage(), e); } if (this.device == null) { throw new IllegalArgumentException("Device " + this.deviceIdentification + " not found."); } }

Target:
private void initDevice() throws FunctionalException { try { this.device = this.domainHelperService.findDlmsDevice(this.deviceIdentification, this.ipAddress); } catch (final ProtocolAdapterException e) { throw new RecoverKeyException(e.getMessage(), e); } }
Source:
public void testHasConstraintsForMethod() { MethodDescriptor parameterConstrainedDescriptor = Executables.parameterConstrainedMethod(); assertFalse( parameterConstrainedDescriptor.hasConstraints(), "Should have no contraints" ); MethodDescriptor returnValueConstrainedDescriptor = Executables.returnValueConstrainedMethod(); assertFalse( returnValueConstrainedDescriptor.hasConstraints(), "Should have no contraints" ); MethodDescriptor crossParameterConstrainedDescriptor = Executables.crossParameterConstrainedMethod(); assertTrue( crossParameterConstrainedDescriptor.hasConstraints(), "Should have contraints" ); }

Target:
public void testHasConstraintsForMethod() { MethodDescriptor parameterConstrainedDescriptor = Executables.parameterConstrainedMethod(); assertFalse( parameterConstrainedDescriptor.hasConstraints(), "Should have no constraints" ); MethodDescriptor returnValueConstrainedDescriptor = Executables.returnValueConstrainedMethod(); assertFalse( returnValueConstrainedDescriptor.hasConstraints(), "Should have no constraints" ); MethodDescriptor crossParameterConstrainedDescriptor = Executables.crossParameterConstrainedMethod(); assertTrue( crossParameterConstrainedDescriptor.hasConstraints(), "Should have constraints" ); }
Source:
public boolean isVisible(ChatType type) { switch ((EntityPlayer.EnumChatVisibility) (Object) this) { case FULL: return true; case SYSTEM: return type == ChatTypes.SYSTEM || type == ChatTypes.ACTION_BAR; case HIDDEN: return false; default: throw new IllegalStateException("unknown type " + this); } }

Target:
public boolean isVisible(ChatType type) { checkNotNull(type, "type"); return this.visibleChatTypes.contains(type); }
Source:
public void close() { if (closed) { return; } boolean wasInTransaction = isInTransaction() && forceEndTransactions && config.get().get(Handles.class).isForceEndTransactions(); extensionMethod.remove(); config.remove(); if (wasInTransaction) { rollback(); } Throwable suppressed = null; try { statementBuilder.close(getConnection()); } catch (Throwable t) { suppressed = t; } finally { try { connection.close(); if (wasInTransaction) { TransactionException txe = new TransactionException("Improper transaction handling detected: A Handle with an open " + "transaction was closed. Transactions must be explicitly committed or rolled back " + "before closing the Handle. " + "Jdbi has rolled back this transaction automatically. " + "This check may be disabled by calling getConfig(Handles.class).setForceEndTransactions(false)."); if (suppressed != null) { txe.addSuppressed(suppressed); } throw txe; } } catch (SQLException e) { CloseException ce = new CloseException("Unable to close Connection", e); if (suppressed != null) { ce.addSuppressed(suppressed); } throw ce; } finally { LOG.trace("Handle released", this); closed = true; } } }

Target:
public void close() { if (closed) { return; } boolean wasInTransaction = isInTransaction() && forceEndTransactions && config.get().get(Handles.class).isForceEndTransactions(); extensionMethod.remove(); config.remove(); if (wasInTransaction) { rollback(); } Throwable suppressed = null; try { statementBuilder.close(getConnection()); } catch (Throwable t) { suppressed = t; } try { connection.close(); if (wasInTransaction) { TransactionException txe = new TransactionException("Improper transaction handling detected: A Handle with an open " + "transaction was closed. Transactions must be explicitly committed or rolled back " + "before closing the Handle. " + "Jdbi has rolled back this transaction automatically. " + "This check may be disabled by calling getConfig(Handles.class).setForceEndTransactions(false)."); if (suppressed != null) { txe.addSuppressed(suppressed); } throw txe; } } catch (SQLException e) { CloseException ce = new CloseException("Unable to close Connection", e); if (suppressed != null) { ce.addSuppressed(suppressed); } throw ce; } finally { LOG.trace("Handle released", this); closed = true; } }
Source:
public static List<Object> mapDataRow(Entity entity) { List<Object> dataRow = new ArrayList<>(); for (Attribute attribute : entity.getEntityType().getAttributes()) { if (attribute.getExpression() != null || attribute.getMappedBy() != null) { dataRow.add(null); } else if (attribute.getDataType() != AttributeType.COMPOUND) { if (isSingleReferenceType(attribute)) { Entity value = entity.getEntity(attribute.getName()); dataRow.add(value != null ? value.getIdValue() : null); } else if (isMultipleReferenceType(attribute)) { Iterable<Entity> values = entity.getEntities(attribute.getName()); String ids = Streams.stream(values) .map(Entity::getIdValue) .map(Object::toString) .collect(joining(",")); dataRow.add(ids); } else { Object value = entity.get(attribute.getName()); dataRow.add(value); } } } return dataRow; }

Target:
public static List<Object> mapDataRow(Entity entity) { List<Object> dataRow = new ArrayList<>(); for (Attribute attribute : entity.getEntityType().getAtomicAttributes()) { if (attribute.hasExpression() || attribute.isMappedBy()) { dataRow.add(null); } else { if (isSingleReferenceType(attribute)) { Entity value = entity.getEntity(attribute.getName()); dataRow.add(value != null ? value.getIdValue() : null); } else if (isMultipleReferenceType(attribute)) { Iterable<Entity> values = entity.getEntities(attribute.getName()); String ids = Streams.stream(values) .map(Entity::getIdValue) .map(Object::toString) .collect(joining(",")); dataRow.add(ids); } else { Object value = entity.get(attribute.getName()); dataRow.add(value); } } } return dataRow; }
Source:
public static ResourceProviderMetaData create(final String resourceType, final List<String> locations, final List<String> apiVersions) { ResourceProviderMetaData.Builder builder = ResourceProviderMetaData.builder() .resourceType(resourceType) .locations(locations == null ? null : ImmutableList.copyOf(locations)) .apiVersions(apiVersions == null ? null : ImmutableList.copyOf(apiVersions)); return builder.build(); }

Target:
public static ResourceProviderMetaData create(final String resourceType, final List<String> locations, final List<String> apiVersions) { ResourceProviderMetaData.Builder builder = ResourceProviderMetaData.builder() .resourceType(resourceType) .locations(locations == null ? ImmutableList.<String>of() : ImmutableList.copyOf(locations)) .apiVersions(apiVersions == null ? ImmutableList.<String>of() : ImmutableList.copyOf(apiVersions)); return builder.build(); }
Source:
private void migrateProperties(SecureStore currentStore, SecureStore newStore) { log.info("Migrate entries"); for (EntryKey key : currentStore.list()) { String[] value = currentStore.getList(key.section, key.subsection, key.name); if (value != null) { newStore.setList(key.section, key.subsection, key.name, Arrays.asList(value)); } else { String msg = String.format("Cannot migrate entry for ", key.section); if (key.subsection != null) { msg = msg + String.format("[%s]", key.subsection); } msg = msg + String.format(".%s", key.name); throw new RuntimeException(msg); } } }

Target:
private void migrateProperties(SecureStore currentStore, SecureStore newStore) { log.info("Migrate entries"); for (EntryKey key : currentStore.list()) { String[] value = currentStore.getList(key.section, key.subsection, key.name); if (value != null) { newStore.setList(key.section, key.subsection, key.name, Arrays.asList(value)); } else { String msg = String.format("Cannot migrate entry for %s", key.section); if (key.subsection != null) { msg = msg + String.format("[%s]", key.subsection); } msg = msg + String.format(".%s", key.name); throw new RuntimeException(msg); } } }
Source:
public U getRequiredUser() { return getUserOrThrowException(getCurrentUser()); }

Target:
public U getRequiredUser() { return getCurrentUser().orElseThrow(this::createMissingUserException); }
Source:
public static RealmAsyncTask loginAsync(final SyncCredentials credentials, final String authenticationUrl, final Callback callback) { if (Looper.myLooper() == null) { throw new IllegalStateException("Asynchronous login is only possible from looper threads."); } final Handler handler = new Handler(Looper.myLooper()); ThreadPoolExecutor networkPoolExecutor = SyncManager.NETWORK_POOL_EXECUTOR; Future<?> authenticateRequest = networkPoolExecutor.submit(new Runnable() { @Override public void run() { try { SyncUser user = login(credentials, authenticationUrl); postSuccess(user); } catch (ObjectServerError e) { postError(e); } } private void postError(final ObjectServerError error) { if (callback != null) { handler.post(new Runnable() { @Override public void run() { try { callback.onError(error); } catch (Exception e) { RealmLog.info("onError has thrown an exception but ignoring it: %s", e.getMessage()); e.printStackTrace(); } } }); } } private void postSuccess(final SyncUser user) { if (callback != null) { handler.post(new Runnable() { @Override public void run() { callback.onSuccess(user); } }); } } }); return new RealmAsyncTaskImpl(authenticateRequest, networkPoolExecutor); }

Target:
public static RealmAsyncTask loginAsync(final SyncCredentials credentials, final String authenticationUrl, final Callback callback) { if (Looper.myLooper() == null) { throw new IllegalStateException("Asynchronous login is only possible from looper threads."); } final Handler handler = new Handler(Looper.myLooper()); ThreadPoolExecutor networkPoolExecutor = SyncManager.NETWORK_POOL_EXECUTOR; Future<?> authenticateRequest = networkPoolExecutor.submit(new Runnable() { @Override public void run() { try { SyncUser user = login(credentials, authenticationUrl); postSuccess(user); } catch (ObjectServerError e) { postError(e); } } private void postError(final ObjectServerError error) { if (callback != null) { handler.post(new Runnable() { @Override public void run() { try { callback.onError(error); } catch (Exception e) { RealmLog.info("onError has thrown an exception but is ignoring it: %s", Util.getStackTrace(e)); } } }); } } private void postSuccess(final SyncUser user) { if (callback != null) { handler.post(new Runnable() { @Override public void run() { callback.onSuccess(user); } }); } } }); return new RealmAsyncTaskImpl(authenticateRequest, networkPoolExecutor); }
Source:
public void test_TempResourceAPI_TempResourceEnabledProperty() throws Exception{ final boolean tempResourceEnabledOriginalValue = Config.getBooleanProperty(TempFileAPI.TEMP_RESOURCE_ENABLED, true); try { final TempFileResource resource = new TempFileResource(); final HttpServletRequest request = mockRequest(); final String fileName = "test.png"; final HttpServletResponse response = new MockHttpResponse(); Config.setProperty(TempFileAPI.TEMP_RESOURCE_ENABLED, false); final Date date = new Date(); final FormDataContentDisposition fileMetaData = FormDataContentDisposition.name("testData") .fileName(fileName).creationDate(date) .modificationDate(date).readDate(date).size(1222).build(); final Response jsonResponse = resource .uploadTempResource(request, response, inputStream(), fileMetaData); assertEquals(Status.FORBIDDEN.getStatusCode(), jsonResponse.getStatus()); }finally { Config.setProperty(TempFileAPI.TEMP_RESOURCE_ENABLED, tempResourceEnabledOriginalValue); } }

Target:
public void test_TempResourceAPI_TempResourceEnabledProperty(){ final boolean tempResourceEnabledOriginalValue = Config.getBooleanProperty(TempFileAPI.TEMP_RESOURCE_ENABLED, true); try { final String fileName = "test.png"; Config.setProperty(TempFileAPI.TEMP_RESOURCE_ENABLED, false); final BodyPart filePart1 = new StreamDataBodyPart(fileName, inputStream()); final MultiPart multipartEntity = new FormDataMultiPart() .bodyPart(filePart1); final Response jsonResponse = resource.uploadTempResourceMulti(request, response, (FormDataMultiPart) multipartEntity); assertEquals(Status.FORBIDDEN.getStatusCode(), jsonResponse.getStatus()); }finally { Config.setProperty(TempFileAPI.TEMP_RESOURCE_ENABLED, tempResourceEnabledOriginalValue); } }
Source:
public Optional<Element> getElementAt(final double x, final double y) { final Optional<Shape> shape = getCanvas().getShapeAt(x, y); if (shape.isPresent()) { final Element element = GraphUtils.getNode(getGraphExecutionContext(), shape.get().getUUID()); return Optional.of(element); } return Optional.empty(); }

Target:
public Optional<Element> getElementAt(final double x, final double y) { final Optional<Shape> shape = getCanvas().getShapeAt(x, y); return shape.flatMap(s -> Optional.of(GraphUtils.getNode(getGraphExecutionContext(), s.getUUID()))); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof TemplatePersistenceData)) return false; TemplatePersistenceData other= (TemplatePersistenceData) obj; return Objects.equals(uniqueIdForEquals, other.getUniqueIdForEquals()); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof TemplatePersistenceData)) { return false; } TemplatePersistenceData other= (TemplatePersistenceData) obj; return Objects.equals(uniqueIdForEquals, other.getUniqueIdForEquals()); }
Source:
@Test public void getPerformanceDataTest() { driver.startActivity("io.appium.android.apis", ".ApiDemos"); List<String> supportedPerformanceDataTypes = driver.getSupportedPerformanceDataTypes(); for(int i = 0 ; i < supportedPerformanceDataTypes.size() ; ++ i){ String dataType = supportedPerformanceDataTypes.get(i); List<List<Object>> valueTable = driver.getPerformanceData("com.example.android.apis", dataType, 60000); int valueTableHeadLength = valueTable.get(0).size(); for(int j = 1 ; j < valueTable.size() ; ++ j){ assert(valueTableHeadLength == valueTable.get(j).size()); } } }

Target:
@Test public void getPerformanceDataTest() throws Exception { driver.startActivity("io.appium.android.apis", ".ApiDemos"); List<String> supportedPerformanceDataTypes = driver.getSupportedPerformanceDataTypes(); for (int i = 0 ; i < supportedPerformanceDataTypes.size() ; ++ i) { String dataType = supportedPerformanceDataTypes.get(i); List<List<Object>> valueTable = driver.getPerformanceData("com.example.android.apis", dataType, 60000); for ( int j = 1 ; j < valueTable.size() ; ++ j) { assertEquals(valueTable.subList(0,0).size(), valueTable.subList(j, j).size()); } } }
Source:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = WidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); View answerView = binding.getRoot(); datePickerDetails = DateTimeUtils.getDatePickerDetails(prompt.getQuestion().getAppearanceAttr()); if (prompt.isReadOnly()) { binding.widgetButton.setVisibility(GONE); } else { binding.widgetButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.widgetButton.setText(getContext().getString(R.string.select_date)); binding.widgetButton.setOnClickListener(v -> onButtonClick(binding.widgetButton.getId())); } binding.widgetAnswerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); if (getFormEntryPrompt().getAnswerValue() == null) { clearAnswer(); } else { date = new LocalDateTime(getFormEntryPrompt().getAnswerValue().getValue()); isNullAnswer = false; DateTimeWidgetUtils.setDateLabel(getContext(), binding.widgetAnswerText, (Date) getAnswer().getValue(), datePickerDetails); } return answerView; }

Target:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = DateWidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); datePickerDetails = DateTimeWidgetUtils.getDatePickerDetails(prompt.getQuestion().getAppearanceAttr()); if (prompt.isReadOnly()) { binding.dateButton.setVisibility(GONE); } else { binding.dateButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.dateButton.setOnClickListener(v -> { DateTimeWidgetUtils.setWidgetWaitingForData(prompt.getIndex()); widgetUtils.showDatePickerDialog(context, datePickerDetails, selectedDate); }); } binding.dateAnswerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); if (prompt.getAnswerValue() == null) { selectedDate = DateTimeUtils.getCurrentDateTime(); } else { selectedDate = DateTimeUtils.getSelectedDate(new LocalDateTime(getFormEntryPrompt().getAnswerValue().getValue()), LocalDateTime.now()); binding.dateAnswerText.setText(DateTimeWidgetUtils.getDateTimeLabel(selectedDate.toDate(), datePickerDetails, false, context)); } return binding.getRoot(); }
Source:
public void delete(String key) { File file = new File(getMapStorePath() + key + PERSISTED_FILE_SUFFIX); if (file.exists()) { try { Files.delete(file.toPath()); } catch (IOException e) { LOGGER.debug("File was unable to be deleted: {}", file.getAbsolutePath()); } } }

Target:
public void delete(String key) { File file = new File(getPersistedFilePathForKey(key)); if (file.exists()) { try { Files.delete(file.toPath()); } catch (IOException e) { LOGGER.debug("File was unable to be deleted: {}", file.getAbsolutePath(), e); LOGGER.warn( "Unable to remove file [{}]. Turn logging to debug for more info.", file.getAbsolutePath()); } } }
Source:
public void testSizeAfterClearInBranchedTransaction() throws Exception { cache.put(1, "v1"); tm().begin(); try { assertEquals("v1", cache.get(1)); Transaction suspended = tm().suspend(); tm().begin(); try { cache.clear(); } finally { tm().commit(); tm().resume(suspended); assertEquals(1, cache.size()); assertEquals("v1", cache.get(1)); } } finally { safeCommit(); } }

Target:
public void testSizeAfterClearInBranchedTransaction() throws Exception { cache.put(1, "v1"); tm().begin(); assertEquals("v1", cache.get(1)); cache.clear(); assertEquals(1, cache.size()); assertEquals("v1", cache.get(1)); safeCommit(false); }
Source:
public @Nullable QuantityType<T> toUnit(Unit<?> targetUnit) { if (!targetUnit.equals(getUnit())) { try { UnitConverter uc = getUnit().getConverterToAny(targetUnit); Quantity<?> result = Quantities.getQuantity(uc.convert(quantity.getValue()), targetUnit); return new QuantityType<T>(result.getValue().doubleValue(), (Unit<T>) targetUnit, conversionUnits); } catch (UnconvertibleException | IncommensurableException e) { logger.debug("Unable to convert unit from to {}", new Object[] { getUnit().toString(), targetUnit.toString() }); return null; } } return this; }

Target:
public @Nullable QuantityType<T> toUnit(Unit<?> targetUnit) { if (!targetUnit.equals(getUnit())) { try { UnitConverter uc = getUnit().getConverterToAny(targetUnit); Quantity<?> result = Quantities.getQuantity(uc.convert(quantity.getValue()), targetUnit); return new QuantityType<T>(result.getValue(), (Unit<T>) targetUnit); } catch (UnconvertibleException | IncommensurableException e) { logger.debug("Unable to convert unit from to {}", getUnit(), targetUnit); return null; } } return this; }
Source:
protected CommandBase(T parameters, CommandContext cmdContext) { log.error("int CommandBase"); if (cmdContext == null) { cmdContext = new CommandContext(new EngineContext().withSessionId(parameters.getSessionId())) .withExecutionContext(new ExecutionContext()); } else if (cmdContext.getEngineContext().getSessionId() == null) { cmdContext.getEngineContext().withSessionId(parameters.getSessionId()); } this.context = cmdContext; _parameters = parameters; Guid commandIdFromParameters = parameters.getCommandId(); if (commandIdFromParameters == null) { commandIdFromParameters = Guid.newGuid(); getParameters().setCommandId(commandIdFromParameters); } commandId = commandIdFromParameters; taskHandlers = initTaskHandlers(); log.error("out CommandBase"); }

Target:
protected CommandBase(T parameters, CommandContext cmdContext) { if (cmdContext == null) { cmdContext = new CommandContext(new EngineContext().withSessionId(parameters.getSessionId())) .withExecutionContext(new ExecutionContext()); } else if (cmdContext.getEngineContext().getSessionId() == null) { cmdContext.getEngineContext().withSessionId(parameters.getSessionId()); } this.context = cmdContext; _parameters = parameters; Guid commandIdFromParameters = parameters.getCommandId(); if (commandIdFromParameters == null) { commandIdFromParameters = Guid.newGuid(); getParameters().setCommandId(commandIdFromParameters); } commandId = commandIdFromParameters; taskHandlers = initTaskHandlers(); }