auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ModuleMetaData deserialiseModule(String module) { ModuleMetaDataImpl result; try { <START> ObjectMapper mapper = new ObjectMapper(); <END> SimpleModule m = new SimpleModule(); m.addAbstractTypeMapping(ModuleMetaData.class, ModuleMetaDataImpl.class); m.addAbstractTypeMapping(FlowMetaData.class, FlowMetaDataImpl.class); m.addAbstractTypeMapping(FlowElementMetaData.class, FlowElementMetaDataImpl.class); m.addAbstractTypeMapping(Transition.class, TransitionImpl.class); mapper.registerModule(m); result = mapper.readValue(module, ModuleMetaDataImpl.class); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating module meta data object!", e); } return result; }</code><technical_language>mapper initialised in constructor</technical_language>

Target:
public ModuleMetaData deserialiseModule(String module) { ModuleMetaDataImpl result; try { result = this.mapper.readValue(module, ModuleMetaDataImpl.class); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating module meta data object!", e); } return result; }
Source:
<code>public boolean isTrue(State state, String[] params) { <START> if ((this.spaceName != null && !this.spaceName.equals("")) && !this.spaceName.equals(params[1])) { <END> return false; } ObjectInstance space = state.getObject(params[1]); return SpaceFactory.getOnOff(space); }</code><technical_language>!this.spaceName.equals("") -> !this.spaceName.isEmpty()</technical_language>

Target:
public boolean isTrue(State state, String[] params) { if ((this.spaceName != null && !this.spaceName.isEmpty()) && !this.spaceName.equals(params[1])) { return false; } ObjectInstance space = state.getObject(params[1]); return SpaceFactory.getOnOff(space); }
Source:
<code>private static void addShutdownMessageHook() { <START> Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { <END> @Override public void run() { LOGGER.info("Stopping boot microservices..."); for (Process process : bootMicroservicesProcesses) process.destroyForcibly(); LOGGER.info("Shutting down..."); if (discoveryService != null) { discoveryService.stop(); } } })); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') this anonymous class a lambda [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private static void addShutdownMessageHook() { Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { LOGGER.info("Stopping boot microservices..."); for (Process process : bootMicroservicesProcesses) { process.destroyForcibly(); } LOGGER.info("Shutting down..."); if (discoveryService != null) { discoveryService.stop(); } } })); }
Source:
<code>RebalanceFuture( CacheGroupContext grp, GridDhtPreloaderAssignments assignments, IgniteLogger log, long rebalanceId, RebalanceFuture next, AtomicLong lastCancelledTime) { assert assignments != null; this.rebalancingParts = U.newHashMap(assignments.size()); this.assignments = assignments; exchId = assignments.exchangeId(); topVer = assignments.topologyVersion(); this.next = next; this.lastCancelledTime = lastCancelledTime; assignments.forEach((k, v) -> { assert v.partitions() != null : "Partitions are null [grp=" + grp.cacheOrGroupName() + ", fromNode=" + k.id() + "]"; remaining.put(k.id(), v.partitions()); partitionsLeft.addAndGet(v.partitions().size()); <START> rebalancingParts.put(k, new HashSet<Integer>() {{ <END> addAll(v.partitions().historicalSet()); addAll(v.partitions().fullSet()); }}); historical.addAll(v.partitions().historicalSet()); Stream.concat(v.partitions().historicalSet().stream(), v.partitions().fullSet().stream()) .forEach( p -> { queued.put(p, new LongAdder()); processed.put(p, new LongAdder()); }); }); this.routines = remaining.size(); this.grp = grp; this.log = log; this.rebalanceId = rebalanceId; ctx = grp.shared(); cancelLock = new ReentrantReadWriteLock(); }</code><technical_language>initial capacity set</technical_language>

Target:
RebalanceFuture( CacheGroupContext grp, GridDhtPreloaderAssignments assignments, IgniteLogger log, long rebalanceId, RebalanceFuture next, AtomicLong lastCancelledTime) { assert assignments != null; this.rebalancingParts = U.newHashMap(assignments.size()); this.assignments = assignments; exchId = assignments.exchangeId(); topVer = assignments.topologyVersion(); this.next = next; this.lastCancelledTime = lastCancelledTime; assignments.forEach((k, v) -> { assert v.partitions() != null : "Partitions are null [grp=" + grp.cacheOrGroupName() + ", fromNode=" + k.id() + "]"; remaining.put(k.id(), v.partitions()); partitionsLeft.addAndGet(v.partitions().size()); rebalancingParts.put(k, new HashSet<Integer>(v.partitions().size()) {{ addAll(v.partitions().historicalSet()); addAll(v.partitions().fullSet()); }}); historical.addAll(v.partitions().historicalSet()); Stream.concat(v.partitions().historicalSet().stream(), v.partitions().fullSet().stream()) .forEach( p -> { queued.put(p, new LongAdder()); processed.put(p, new LongAdder()); }); }); this.routines = remaining.size(); this.grp = grp; this.log = log; this.rebalanceId = rebalanceId; ctx = grp.shared(); cancelLock = new ReentrantReadWriteLock(); }
Source:
<code>private void setup() { if (!mReady) { mSetupPending = true; return; } if (mBitmap == null) { return; } mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint.setStyle(Paint.Style.STROKE); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor); mBorderPaint.setStrokeWidth(mBorderWidth); mBitmapHeight = mBitmap.getHeight(); mBitmapWidth = mBitmap.getWidth(); mBorderRect.set(0, 0, getWidth(), getHeight()); mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); mDrawableRect.set(mBorderRect); <START> if (mBorderInset) mDrawableRect.inset(mBorderWidth, mBorderWidth); <END> mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); updateShaderMatrix(); invalidate(); }</code><technical_language>Multi-line if statements preferred</technical_language>

Target:
private void setup() { if (!mReady) { mSetupPending = true; return; } if (mBitmap == null) { return; } mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint.setStyle(Paint.Style.STROKE); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor); mBorderPaint.setStrokeWidth(mBorderWidth); mBitmapHeight = mBitmap.getHeight(); mBitmapWidth = mBitmap.getWidth(); mBorderRect.set(0, 0, getWidth(), getHeight()); mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); mDrawableRect.set(mBorderRect); if (!mBorderOverlay) { mDrawableRect.inset(mBorderWidth, mBorderWidth); } mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); updateShaderMatrix(); invalidate(); }
Source:
<code>public void restoreAndSaveState() { <START> webView.restoreState(Bundle()); <END> webView.saveState(Bundle()); }</code><technical_language>suggestion webView.restoreState(new Bundle());</technical_language>

Target:
public void restoreAndSaveState() { webView.restoreState(new Bundle()); webView.saveState(new Bundle()); }
Source:
<code>public static List<Filter> getDistinctPositionFilters(Filter filter) { if (filter == null) { return ImmutableList.of(); } if (filter instanceof PositionalFilter) { <START> return ((PositionalFilter) filter).getParent().getFilters().entrySet().stream().map(c -> c.getValue()).collect(toList()); <END> } return ImmutableList.of(filter); }</code><technical_language>.entrySet().stream().map(c -> c.getValue()) is equivalent .values().stream() - this simplified return ImmutableList.copyOf(((PositionalFilter) filter).getParent().getFilters().values());</technical_language>

Target:
public static List<Filter> getDistinctPositionFilters(Filter filter) { if (filter == null) { return ImmutableList.of(); } if (filter instanceof PositionalFilter) { return ImmutableList.copyOf(((PositionalFilter) filter).getParent().getFilters().values()); } return ImmutableList.of(filter); }
Source:
<code>public ProcessInstance start(StartProcessPayload startProcessPayload) { ProcessDefinition processDefinition = null; if (startProcessPayload.getProcessDefinitionId() != null) { processDefinition = processDefinition(startProcessPayload.getProcessDefinitionId()); } if (processDefinition == null && startProcessPayload.getProcessDefinitionKey() != null) { processDefinition = processDefinition(startProcessPayload.getProcessDefinitionKey()); } if (processDefinition == null) { throw new IllegalStateException("At least Process Definition Id or Key needs to be provided to start a process"); } <START> if (!securityPoliciesManager.canWrite(processDefinition.getKey())) { <END> throw new ActivitiForbiddenException("Operation not permitted for " + processDefinition.getKey() + " due security policy violation"); } processVariablesValidator.checkStartProcessPayloadVariables(startProcessPayload, startProcessPayload.getProcessDefinitionKey()); return processInstanceConverter.from(runtimeService .createProcessInstanceBuilder() .processDefinitionId(startProcessPayload.getProcessDefinitionId()) .processDefinitionKey(startProcessPayload.getProcessDefinitionKey()) .businessKey(startProcessPayload.getBusinessKey()) .variables(startProcessPayload.getVariables()) .name(startProcessPayload.getName()) .start()); }</code><technical_language>some parts of code in this class repeated, evaluate refactoring</technical_language>

Target:
public ProcessInstance start(StartProcessPayload startProcessPayload) { ProcessDefinition processDefinition = getProcessDefinitionAndCheckUserHasRights(startProcessPayload.getProcessDefinitionId(), startProcessPayload.getProcessDefinitionKey()); processVariablesValidator.checkStartProcessPayloadVariables(startProcessPayload, processDefinition.getKey()); return processInstanceConverter.from(runtimeService .createProcessInstanceBuilder() .processDefinitionId(processDefinition.getId()) .processDefinitionKey(processDefinition.getKey()) .businessKey(startProcessPayload.getBusinessKey()) .variables(startProcessPayload.getVariables()) .name(startProcessPayload.getName()) .start()); }
Source:
<code>public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { return builder .withValue(TaskContract.Instances.INSTANCE_START, new Mapped<>(DateTime::getTimestamp, mInstanceStart).value(null)) .withValue(TaskContract.Instances.INSTANCE_START_SORTING, new Mapped<>(DateTime::getInstance, mInstanceStart).value(null)) .withValue(TaskContract.Instances.INSTANCE_DUE, new Mapped<>(DateTime::getTimestamp, mInstanceDue).value(null)) .withValue(TaskContract.Instances.INSTANCE_DUE_SORTING, new Mapped<>(DateTime::getInstance, mInstanceDue).value(null)) <START> .withValue(TaskContract.Instances.INSTANCE_DURATION, <END> new Zipped<>(mInstanceStart, mInstanceDue, (start, due) -> (due.getTimestamp() - start.getTimestamp())).value(null)) .withValue(TaskContract.Instances.INSTANCE_ORIGINAL_TIME, mOriginalTime.value(new DateTime(0)).getTimestamp()) .withValue(TaskContract.Instances.DISTANCE_FROM_CURRENT, mDistanceFromCurrent) .withValue(TaskContract.Instances.DTSTART, new Mapped<>(DateTime::getTimestamp, mInstanceStart).value(null)) .withValue(TaskContract.Instances.DUE, new Mapped<>(DateTime::getTimestamp, mInstanceDue).value(null)) .withValue(TaskContract.Instances.DURATION, null) .withValue(TaskContract.Instances.RRULE, null) .withValue(TaskContract.Instances.RDATE, null) .withValue(TaskContract.Instances.EXDATE, null); }</code><technical_language>Is Instances.INSTANCE_DURATION column need if is DUE is used</technical_language>

Target:
public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { return builder .withValue(TaskContract.Instances.INSTANCE_START, new Mapped<>(DateTime::getTimestamp, mInstanceStart).value(null)) .withValue(TaskContract.Instances.INSTANCE_START_SORTING, new Mapped<>(DateTime::getInstance, mInstanceStart).value(null)) .withValue(TaskContract.Instances.INSTANCE_DUE, new Mapped<>(DateTime::getTimestamp, mInstanceDue).value(null)) .withValue(TaskContract.Instances.INSTANCE_DUE_SORTING, new Mapped<>(DateTime::getInstance, mInstanceDue).value(null)) .withValue(TaskContract.Instances.INSTANCE_DURATION, new Zipped<>(mInstanceStart, mInstanceDue, (start, due) -> (due.getTimestamp() - start.getTimestamp())).value(null)) .withValue(TaskContract.Instances.INSTANCE_ORIGINAL_TIME, new Mapped<>(DateTime::getTimestamp, mOriginalTime).value(null)) .withValue(TaskContract.Instances.DISTANCE_FROM_CURRENT, mDistanceFromCurrent) .withValue(TaskContract.Instances.DTSTART, new Mapped<>(DateTime::getTimestamp, mInstanceStart).value(null)) .withValue(TaskContract.Instances.DUE, new Mapped<>(DateTime::getTimestamp, mInstanceDue).value(null)) .withValue(TaskContract.Instances.ORIGINAL_INSTANCE_TIME, new Mapped<>(DateTime::getTimestamp, mOriginalTime).value(null)) .withValue(TaskContract.Instances.DURATION, null) .withValue(TaskContract.Instances.RRULE, null) .withValue(TaskContract.Instances.RDATE, null) .withValue(TaskContract.Instances.EXDATE, null); }
Source:
<code>public synchronized void onAssignmentChange(List<DatastreamTask> tasks) { _logger.info("onAssignmentChange called with tasks {}", tasks); synchronized (_runningTasks) { <START> HashSet<DatastreamTask> toCancel = new HashSet<>(_runningTasks.keySet()); <END> toCancel.removeAll(tasks); for (DatastreamTask task : toCancel) { ConnectorTaskEntry connectorTaskEntry = _runningTasks.remove(task); connectorTaskEntry.getConnectorTask().stop(); } for (DatastreamTask task : tasks) { ConnectorTaskEntry connectorTaskEntry = _runningTasks.get(task); if (connectorTaskEntry != null) { AbstractKafkaBasedConnectorTask kafkaBasedConnectorTask = connectorTaskEntry.getConnectorTask(); kafkaBasedConnectorTask.checkForUpdateTask(task); _runningTasks.put(task, new ConnectorTaskEntry(kafkaBasedConnectorTask, connectorTaskEntry.getThread())); continue; } createKafkaConnectorTask(task); } } }</code><technical_language>fault nit: please change type of toCancel Set<DatastreamTask></technical_language>

Target:
public synchronized void onAssignmentChange(List<DatastreamTask> tasks) { _logger.info("onAssignmentChange called with tasks {}", tasks); synchronized (_runningTasks) { Set<DatastreamTask> toCancel = new HashSet<>(_runningTasks.keySet()); toCancel.removeAll(tasks); for (DatastreamTask task : toCancel) { ConnectorTaskEntry connectorTaskEntry = _runningTasks.remove(task); connectorTaskEntry.getConnectorTask().stop(); } for (DatastreamTask task : tasks) { ConnectorTaskEntry connectorTaskEntry = _runningTasks.get(task); if (connectorTaskEntry != null) { AbstractKafkaBasedConnectorTask kafkaBasedConnectorTask = connectorTaskEntry.getConnectorTask(); kafkaBasedConnectorTask.checkForUpdateTask(task); _runningTasks.put(task, connectorTaskEntry); continue; } _runningTasks.put(task, createKafkaConnectorTask(task)); } } }
Source:
<code>private void waitTillFirstTopicIsAdded() { while (!topicAdded.get()) { try { firstTopicAdded.await(1, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.info("Interrupted before first topic was added. Terminating Kafka RPC consumer thread.", e); closed.set(true); return; } catch(Throwable e) { <START> LOG.error("Unknown exception before first topic is added, Terminating Kafka RPC consumer thread", e); <END> closed.set(true); return; } } }</code><technical_language>suggestion LOG.error("Unknown exception topic is added. Terminating Kafka RPC consumer thread.", e);</technical_language>

Target:
private void waitTillFirstTopicIsAdded() { while (!topicAdded.get()) { try { firstTopicAdded.await(1, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.info("Interrupted before first topic was added. Terminating Kafka RPC consumer thread.", e); return; } catch(Throwable e) { LOG.error("Unknown exception before first topic is added. Terminating Kafka RPC consumer thread.", e); return; } } }
Source:
<code>public int hashCode() { return Objects.hash( account, uuid, state, invoiceNumber, poNumber, vatNumber, <START> subtotalInCents, <END> taxInCents, currency, createdAt, collectionMethod, netTerms, lineItems, transactions ); }</code><technical_language>Missing totalInCents</technical_language>

Target:
public int hashCode() { return Objects.hashCode( account, uuid, state, invoiceNumber, poNumber, vatNumber, subtotalInCents, totalInCents, taxInCents, currency, createdAt, collectionMethod, netTerms, lineItems, transactions ); }
Source:
<code>private void loadClientDetails() { final User loggedInUser = PrefManager.getUser(); <START> TextView textViewUsername = (TextView) mNavigationHeader.findViewById(R.id.tv_user_name); <END> textViewUsername.setText(loggedInUser.getUsername()); ImageView imageViewUserPicture = (ImageView) mNavigationHeader .findViewById(R.id.iv_user_picture); imageViewUserPicture.setImageResource(R.drawable.ic_account_circle); }</code><technical_language>ButterKnife please avoid of findViewById. This ensures code structure is app</technical_language>

Target:
private void loadClientDetails() { final User loggedInUser = PrefManager.getUser(); TextView textViewUsername = ButterKnife.findById(mNavigationHeader, R.id.tv_user_name); textViewUsername.setText(loggedInUser.getUsername()); ImageView imageViewUserPicture = ButterKnife .findById(mNavigationHeader, R.id.iv_user_picture); imageViewUserPicture.setImageResource(R.drawable.ic_account_circle); }
Source:
<code>public Instant getDateOfEarliestLog() throws DateTimeParseException { <START> DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss.SSS"); <END> String dateTimeString = getLogsTable().findElement(By.cssSelector("tr:last-child > td > a")).getText(); return LocalDateTime.parse(dateTimeString, formatter).atZone(Const.SystemParams.ADMIN_TIME_ZONE_ID).toInstant(); }</code><technical_language>new method TimeHelper#parseLocalDateTime</technical_language>

Target:
public Instant getDateOfEarliestLog() { String dateTimeString = getLogsTable().findElement(By.cssSelector("tr:last-child > td > a")).getText(); return TimeHelper.parseLocalDateTime(dateTimeString, "dd/MM/yyyy HH:mm:ss.SSS") .atZone(Const.SystemParams.ADMIN_TIME_ZONE_ID).toInstant(); }
Source:
<code>public void monitorPendingOperations() { <START> for (PerChannelBookieClientPool clientPool : channels.values()) { <END> clientPool.checkTimeoutOnPendingOperations(); } }</code><technical_language>channels.values().forEach</technical_language>

Target:
private void monitorPendingOperations() { for (PerChannelBookieClientPool clientPool : channels.values()) { clientPool.checkTimeoutOnPendingOperations(); } }
Source:
<code>public static GraphRequest newCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, String applicationId, Callback callback) { if (applicationId == null && accessToken != null) { applicationId = accessToken.getApplicationId(); } if (applicationId == null) { applicationId = Utility.getMetadataApplicationId(context); } if (applicationId == null) { throw new FacebookException("Facebook App ID cannot be determined"); } String endpoint = applicationId + "/custom_audience_third_party_id"; AttributionIdentifiers attributionIdentifiers = AttributionIdentifiers.getAttributionIdentifiers(context); Bundle parameters = new Bundle(); if (accessToken == null) { try { String udid = attributionIdentifiers.getAttributionId() != null ? attributionIdentifiers.getAttributionId() : attributionIdentifiers.getAndroidAdvertiserId(); if (attributionIdentifiers.getAttributionId() != null) { parameters.putString("udid", udid); } <START> } catch (NullPointerException e) { <END> throw new FacebookException("attributionIdentifiers or attributionID or androidAdvertiserId is null"); } } if (FacebookSdk.getLimitEventAndDataUsage(context) || attributionIdentifiers.isTrackingLimited()) { parameters.putString("limit_event_usage", "1"); } return new GraphRequest(accessToken, endpoint, parameters, HttpMethod.GET, callback); }</code><technical_language>Please check attributionIdentifiers is null catching NPE. attributionIdentifiers is 625 well</technical_language>

Target:
public static GraphRequest newCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, String applicationId, Callback callback) { if (applicationId == null && accessToken != null) { applicationId = accessToken.getApplicationId(); } if (applicationId == null) { applicationId = Utility.getMetadataApplicationId(context); } if (applicationId == null) { throw new FacebookException("Facebook App ID cannot be determined"); } String endpoint = applicationId + "/custom_audience_third_party_id"; AttributionIdentifiers attributionIdentifiers = AttributionIdentifiers.getAttributionIdentifiers(context); Bundle parameters = new Bundle(); if (accessToken == null) { if (attributionIdentifiers == null) { throw new FacebookException("There is no access token and attribution identifiers could not be retrieved"); } String udid = attributionIdentifiers.getAttributionId() != null ? attributionIdentifiers.getAttributionId() : attributionIdentifiers.getAndroidAdvertiserId(); if (attributionIdentifiers.getAttributionId() != null) { parameters.putString("udid", udid); } } if (FacebookSdk.getLimitEventAndDataUsage(context) || (attributionIdentifiers != null && attributionIdentifiers.isTrackingLimited())) { parameters.putString("limit_event_usage", "1"); } return new GraphRequest(accessToken, endpoint, parameters, HttpMethod.GET, callback); }
Source:
<code>public DataSet< V> intersect(DataSet< V> dataSet) { return subtract(dataSet,"Intersect Operator",null,false,null); <START> } <END></code><technical_language>subtract implement intersect</technical_language>

Target:
public DataSet< V> intersect(DataSet< V> dataSet) { return intersect(dataSet,"Intersect Operator",null,false,null); }
Source:
<code>public StreamNode parse(String name, String stream) { this.expressionString = stream; Tokenizer tokenizer = new Tokenizer(expressionString); tokenStream = tokenizer.getTokens(); tokenStreamLength = tokenStream.size(); tokenStreamPointer = 0; StreamNode ast = eatStream(); if (ast.getName() != null) { <START> if (!isValidStreamName(ast.getName())) { <END> throw new StreamDefinitionException(ast.getName(), 0, XDDSLMessages.ILLEGAL_STREAM_NAME, ast.getName()); } } if (name != null && !isValidStreamName(name)) { throw new StreamDefinitionException(name, 0, XDDSLMessages.ILLEGAL_STREAM_NAME, name); } if (ast.getModule(name) != null) { throw new StreamDefinitionException(stream, stream.indexOf(name), XDDSLMessages.STREAM_NAME_MATCHING_MODULE_NAME, name); } if (moreTokens()) { throw new StreamDefinitionException(this.expressionString, peekToken().startpos, XDDSLMessages.MORE_INPUT, toString(nextToken())); } ast.resolve(this); return ast; }</code><technical_language>reason combine 2 a single if condition</technical_language>

Target:
public StreamNode parse(String name, String stream) { this.expressionString = stream; Tokenizer tokenizer = new Tokenizer(expressionString); tokenStream = tokenizer.getTokens(); tokenStreamLength = tokenStream.size(); tokenStreamPointer = 0; StreamNode ast = eatStream(); if (ast.getName() != null && !isValidStreamName(ast.getName())) { throw new StreamDefinitionException(ast.getName(), 0, XDDSLMessages.ILLEGAL_STREAM_NAME, ast.getName()); } if (name != null && !isValidStreamName(name)) { throw new StreamDefinitionException(name, 0, XDDSLMessages.ILLEGAL_STREAM_NAME, name); } if (ast.getModule(name) != null) { throw new StreamDefinitionException(stream, stream.indexOf(name), XDDSLMessages.STREAM_NAME_MATCHING_MODULE_NAME, name); } if (moreTokens()) { throw new StreamDefinitionException(this.expressionString, peekToken().startpos, XDDSLMessages.MORE_INPUT, toString(nextToken())); } ast.resolve(this); return ast; }
Source:
<code>protected String getVersionString(){ <START> return "CommCare CLI: " + mPlatform.getMajorVersion() + "." + mPlatform.getMinorVersion(); <END> }</code><technical_language>This is of CLI code core, right? accept version string device ID arguments and/or continue keeping a CLI specific version overrides abstract methods</technical_language>

Target:
protected String getVersionString(){ return "CommCare Version: " + mPlatform.getMajorVersion() + "." + mPlatform.getMinorVersion(); }
Source:
<code>private void setDefaultUpstreamConfig() { String branchName = <START> Repository.shortenRefName(this.fullBranch); <END> BranchConfig branchConfig = new BranchConfig(repository.getConfig(), branchName); boolean alreadyConfigured = branchConfig.getMerge() != null; BranchRebaseMode config; if (alreadyConfigured) { config = PullCommand.getRebaseMode(branchName, repository.getConfig()); } else { config = CreateLocalBranchOperation .getDefaultUpstreamConfig(repository, Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/" + branchName); } this.upstreamConfig = config; }</code><technical_language>problem here</technical_language>

Target:
private void setDefaultUpstreamConfig() { if (fullBranch == null) { return; } String branchName = Repository.shortenRefName(this.fullBranch); BranchConfig branchConfig = new BranchConfig(repository.getConfig(), branchName); boolean alreadyConfigured = branchConfig.getMerge() != null; BranchRebaseMode config; if (alreadyConfigured) { config = PullCommand.getRebaseMode(branchName, repository.getConfig()); } else { config = CreateLocalBranchOperation .getDefaultUpstreamConfig(repository, Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/" + branchName); } this.upstreamConfig = config; }
Source:
<code>public SampleAliquot createAliquotFromParent(Sample stock) throws IOException { SampleAliquot aliquot = new SampleAliquotImpl(); DetailedSample sample = (DetailedSample) stock; aliquot.setScientificName(sample.getScientificName()); aliquot.setSampleType(sample.getSampleType()); aliquot.setParent(sample); if (sample.getSubproject() != null) aliquot.setSubproject(sample.getSubproject()); aliquot.setGroupId(sample.getGroupId()); aliquot.setGroupDescription(sample.getGroupDescription()); aliquot.setSampleClass(sampleClassService.getAll().stream() .filter(sampleClass -> { try { return sampleClass.getSampleCategory().equals("Aliquot") && sampleValidRelationshipService.getAll().stream() .anyMatch( validRelationship -> !validRelationship.getArchived() && validRelationship.getChild().getId() == sampleClass.getId() && validRelationship.getParent().getId() == sample.getSampleClass().getId()); } catch (IOException e) { <START> e.printStackTrace(); <END> return false; } }) .findFirst().orElse(null)); aliquot.setSamplePurpose(samplePurposeService.getAll().stream().filter(samplePurpose -> samplePurpose.getAlias().equals("Library")) .findFirst().orElse(null)); aliquot.setProject(sample.getProject()); return aliquot; }</code><technical_language>Instead of e.printStackTrace(), please log error: log.error("Error SampleValidRelationship", e); return false;</technical_language>

Target:
public SampleAliquot createAliquotFromParent(Sample stock) throws IOException { SampleAliquot aliquot = new SampleAliquotImpl(); DetailedSample sample = (DetailedSample) stock; aliquot.setScientificName(sample.getScientificName()); aliquot.setSampleType(sample.getSampleType()); aliquot.setParent(sample); if (sample.getSubproject() != null) aliquot.setSubproject(sample.getSubproject()); aliquot.setGroupId(sample.getGroupId()); aliquot.setGroupDescription(sample.getGroupDescription()); aliquot.setSampleClass(sampleClassService.getAll().stream() .filter(sampleClass -> { try { return sampleClass.getSampleCategory().equals("Aliquot") && sampleValidRelationshipService.getAll().stream() .anyMatch( validRelationship -> !validRelationship.getArchived() && validRelationship.getChild().getId().equals(sampleClass.getId()) && validRelationship.getParent().getId().equals(sample.getSampleClass().getId())); } catch (IOException e) { log.error("Error getting SampleValidRelationship", e); return false; } }) .findFirst().orElse(null)); aliquot.setSamplePurpose(samplePurposeService.getAll().stream().filter(samplePurpose -> samplePurpose.getAlias().equals("Library")) .findFirst().orElse(null)); aliquot.setProject(sample.getProject()); return aliquot; }
Source:
<code>private String getServiceName(String host) { <START> return host.replaceAll("\\.", "-"); <END> }</code><technical_language>want hostnames\IP's in labels. need cut URL IP dot in case of custom DNS</technical_language>

Target:
private String getServiceName(String host) { int idx = host.indexOf("."); if (idx > 1) { return host.substring(0, idx - 1); } else { return host; } }
Source:
<code>protected SerializationContextInitializer[] contextInitializers() { SerializationContextInitializer sci = contextInitializer(); <START> return sci == null ? new SerializationContextInitializer[0] : new SerializationContextInitializer[]{sci}; <END> }</code><technical_language>remove contextInitializer() this method return a List, subclasses do return Arrays.asList(...)</technical_language>

Target:
protected List<SerializationContextInitializer> contextInitializers() { SerializationContextInitializer sci = contextInitializer(); return sci == null ? Collections.emptyList() : Arrays.asList(sci); }
Source:
<code>public boolean removeQueueNames(String... queueNames) { Assert.notNull(queueNames, "'queueNames' cannot be null"); Assert.noNullElements(queueNames, "'queueNames' cannot contain null elements"); AtomicBoolean result = new AtomicBoolean(); if (this.queues.size() > 0) { Set<String> toRemove = new HashSet<>(Arrays.asList(queueNames)); <START> this.queues.stream().forEach(q -> { <END> if (toRemove.contains(q.getName()) || toRemove.contains(q.getDeclaredName())) { this.queues.remove(q); result.set(true); } }); } return result.get(); }</code><technical_language>is forEach() Collection. intentionally</technical_language>

Target:
public boolean removeQueueNames(String... queueNames) { Assert.notNull(queueNames, "'queueNames' cannot be null"); Assert.noNullElements(queueNames, "'queueNames' cannot contain null elements"); if (this.queues.size() > 0) { Set<String> toRemove = new HashSet<>(Arrays.asList(queueNames)); return this.queues.removeIf( q -> toRemove.contains(q.getActualName())); } return false; }
Source:
<code>public Response getTheDataSource( @PathParam("dataSourceName") final String dataSourceName, @QueryParam("full") final String full ) { final ImmutableDruidDataSource dataSource = getDataSource(dataSourceName); if (dataSource == null) { return Response.noContent().build(); } if (full != null) { <START> final Map<String, Object> fullResult = ImmutableMap.of( <END> "name", dataSource.getName(), "properties", dataSource.getProperties(), "segments", dataSource.getIdToSegments().values() ); return Response.ok(fullResult).build(); } return Response.ok(getSimpleDatasource(dataSourceName)).build(); }</code><technical_language>Instead of this, @JsonProperty getSegments() method, @JsonCreator constructor accept segments map out of it? equivalent cleaner -- try handle serde annotations</technical_language>

Target:
public Response getTheDataSource( @PathParam("dataSourceName") final String dataSourceName, @QueryParam("full") final String full ) { final ImmutableDruidDataSource dataSource = getDataSource(dataSourceName); if (dataSource == null) { return Response.noContent().build(); } if (full != null) { return Response.ok(dataSource).build(); } return Response.ok(getSimpleDatasource(dataSourceName)).build(); }
Source:
<code>public void onErratumSelectionChange(ErrataSelectionChangeEvent event) { <START> logger.info(this.getClass().toString() + " onErratumSelectionChange"); END> updateMainTabSelection(event.getSelectedItems()); }</code><technical_language>debug/trace/remove</technical_language>

Target:
public void onErratumSelectionChange(ErrataSelectionChangeEvent event) { updateMainTabSelection(event.getSelectedItems()); }
Source:
<code>private void validateNotifySettingsRequest(JsonNode payload){ String op = payload.get(FIELD_OPERATION).asText(); if (!VALID_ATTRIBUTE_UPDATE_OPERATIONS.get(FIELD_OPERATION).contains(op)) { throw new ValidationException(Collections.singletonList(format("Operation [%s] is not valid for path [%s]", op, FIELD_OPERATION))); } if (!op.equalsIgnoreCase("remove")) { JsonNode valueNode = payload.get(FIELD_VALUE); <START> if(null == valueNode) { <END> throw new ValidationException(Collections.singletonList(format("Field [%s] is required", FIELD_VALUE))); } List<String> missingMandatoryFields = requestValidator.checkIfExistsOrEmpty(valueNode, FIELD_NOTIFY_API_TOKEN, FIELD_NOTIFY_TEMPLATE_ID); if (!missingMandatoryFields.isEmpty()) { throw new ValidationException(missingMandatoryFields); } } }</code><technical_language>I this this this a NullNode</technical_language>

Target:
private void validateNotifySettingsRequest(JsonNode payload) { String op = payload.get(FIELD_OPERATION).asText(); if (!VALID_ATTRIBUTE_UPDATE_OPERATIONS.get(FIELD_OPERATION).contains(op)) { throw new ValidationException(Collections.singletonList(format("Operation [%s] is not valid for path [%s]", op, FIELD_OPERATION))); } if (!op.equalsIgnoreCase("remove")) { JsonNode valueNode = payload.get(FIELD_VALUE); if(null == valueNode || valueNode.isNull()) { throw new ValidationException(Collections.singletonList(format("Field [%s] is required", FIELD_VALUE))); } List<String> missingMandatoryFields = requestValidator.checkIfExistsOrEmpty(valueNode, FIELD_NOTIFY_API_TOKEN, FIELD_NOTIFY_PAYMENT_CONFIRMED_TEMPLATE_ID); if (!missingMandatoryFields.isEmpty()) { throw new ValidationException(missingMandatoryFields); } } }
Source:
<code>private RegionScannerHolder newRegionScanner(ScanRequest request, ScanResponse.Builder builder) throws IOException { HRegion region = getRegion(request.getRegion()); rejectIfInStandByState(region); ClientProtos.Scan protoScan = request.getScan(); boolean isLoadingCfsOnDemandSet = protoScan.hasLoadColumnFamiliesOnDemand(); Scan scan = ProtobufUtil.toScan(protoScan); if (!isLoadingCfsOnDemandSet) { scan.setLoadColumnFamiliesOnDemand(region.isLoadingCfsOnDemandDefault()); } if (!scan.hasFamilies()) { for (byte[] family : region.getTableDescriptor().getColumnFamilyNames()) { scan.addFamily(family); } } if (region.getCoprocessorHost() != null) { region.getCoprocessorHost().preScannerOpen(scan); } RegionScannerImpl coreScanner = region.getScanner(scan); Shipper shipper = coreScanner; RegionScanner scanner = coreScanner; if (region.getCoprocessorHost() != null) { scanner = region.getCoprocessorHost().postScannerOpen(scan, scanner); } long scannerId = scannerIdGenerator.generateNewScannerId(); builder.setScannerId(scannerId); builder.setMvccReadPoint(scanner.getMvccReadPoint()); builder.setTtl(scannerLeaseTimeoutPeriod); String scannerName = String.valueOf(scannerId); boolean isFullRegionScan = false; if(!region.getRegionInfo().getTable().isSystemTable()) { if(checkFullRegionScan(scan, region)){ isFullRegionScan = true; } else { isFullRegionScan = false; } } else { <START> isFullRegionScan = false; <END> } return addScanner(scannerName, scanner, shipper, region, scan.isNeedCursorResult(), isFullRegionScan); }</code><technical_language>This needed. inited false na</technical_language>

Target:
private RegionScannerHolder newRegionScanner(ScanRequest request, ScanResponse.Builder builder) throws IOException { HRegion region = getRegion(request.getRegion()); rejectIfInStandByState(region); ClientProtos.Scan protoScan = request.getScan(); boolean isLoadingCfsOnDemandSet = protoScan.hasLoadColumnFamiliesOnDemand(); Scan scan = ProtobufUtil.toScan(protoScan); if (!isLoadingCfsOnDemandSet) { scan.setLoadColumnFamiliesOnDemand(region.isLoadingCfsOnDemandDefault()); } if (!scan.hasFamilies()) { for (byte[] family : region.getTableDescriptor().getColumnFamilyNames()) { scan.addFamily(family); } } if (region.getCoprocessorHost() != null) { region.getCoprocessorHost().preScannerOpen(scan); } RegionScannerImpl coreScanner = region.getScanner(scan); Shipper shipper = coreScanner; RegionScanner scanner = coreScanner; if (region.getCoprocessorHost() != null) { scanner = region.getCoprocessorHost().postScannerOpen(scan, scanner); } long scannerId = scannerIdGenerator.generateNewScannerId(); builder.setScannerId(scannerId); builder.setMvccReadPoint(scanner.getMvccReadPoint()); builder.setTtl(scannerLeaseTimeoutPeriod); String scannerName = String.valueOf(scannerId); boolean fullRegionScan = !region.getRegionInfo().getTable().isSystemTable() && isFullRegionScan(scan, region); return addScanner(scannerName, scanner, shipper, region, scan.isNeedCursorResult(), fullRegionScan); }
Source:
<code>private void recycleConnection(PooledConnection pc) { int active = activeConnections.decrementAndGet(); <START> if (active < 0) { <END> throw new AssertionError(); } if (!isDisposed.get() && active < maxConnections) { recycledConnections.add(pc); if (isDisposed.get()) { dispose(); } } else { closeConnection(pc); } }</code><technical_language>need increment throwing AssertionError leave in a permanentaly broken state</technical_language>

Target:
private void recycleConnection(PooledConnection pc) { int active = activeConnections.decrementAndGet(); if (active < 0) { activeConnections.incrementAndGet(); throw new AssertionError(); } if (!isDisposed.get() && active < maxConnections) { recycledConnections.add(pc); if (isDisposed.get()) { dispose(); } } else { closeConnection(pc); } }
Source:
<code>public void statelessTopologyShouldNotCreateStateDirectory() throws Exception { final String inputTopic = testName.getMethodName() + "-input"; final String outputTopic = testName.getMethodName() + "-output"; final Topology topology = new Topology(); topology.addSource("source", Serdes.String().deserializer(), Serdes.String().deserializer(), inputTopic) .addProcessor("process", (ProcessorSupplier<String, String>) () -> new AbstractProcessor<String, String>() { <START> @Override <END> public void process(final String key, final String value) { if (value.length() % 2 == 0) { context().forward(key, key + value); } } }, "source") .addSink("sink", outputTopic, new StringSerializer(), new StringSerializer(), "process"); startStreamsAndCheckDirExists(topology, false); }</code><technical_language>I inferred before, type ProcessorSupplier<Object, Object> (just theory). I if code fail compile, change public API. Note, existing methods deprecated part of implementing KIP-478 anyway, leave public APIs alone</technical_language>

Target:
public void statelessTopologyShouldNotCreateStateDirectory() throws Exception { final String inputTopic = testName.getMethodName() + "-input"; final String outputTopic = testName.getMethodName() + "-output"; final Topology topology = new Topology(); topology.addSource("source", Serdes.String().deserializer(), Serdes.String().deserializer(), inputTopic) .addProcessor("process", () -> new AbstractProcessor<String, String>() { @Override public void process(final String key, final String value) { if (value.length() % 2 == 0) { context().forward(key, key + value); } } }, "source") .addSink("sink", outputTopic, new StringSerializer(), new StringSerializer(), "process"); startStreamsAndCheckDirExists(topology, false); }
Source:
<code>public State convertToState(int[] data, ComfoAirCommandType commandType) { int[] get_reply_data_pos = commandType.getGetReplyDataPos(); int value = 0; int base = 0; for (int i = get_reply_data_pos.length - 1; i >= 0; i--) { <START> if (get_reply_data_pos[i] < data.length) { <END> value += data[get_reply_data_pos[i]] << base; base += 8; } else { return null; } } int[] possibleValues = commandType.getPossibleValues(); if (possibleValues != null) { for (int possibleValue : possibleValues) { if ((value & possibleValue) == possibleValue) { return new DecimalType(value); } } return null; } return new DecimalType(value); }</code><technical_language>This method needs protect parameters null (data commandType)</technical_language>

Target:
public State convertToState(int[] data, ComfoAirCommandType commandType) { if (data == null || commandType == null) { logger.trace("\"DataTypeNumber\" class \"convertToState\" method parameter: null"); return null; } else { int[] get_reply_data_pos = commandType.getGetReplyDataPos(); int value = 0; int base = 0; for (int i = get_reply_data_pos.length - 1; i >= 0; i--) { if (get_reply_data_pos[i] < data.length) { value += data[get_reply_data_pos[i]] << base; base += 8; } else { return null; } } int[] possibleValues = commandType.getPossibleValues(); if (possibleValues != null) { for (int possibleValue : possibleValues) { if ((value & possibleValue) == possibleValue) { return new DecimalType(value); } } return null; } return new DecimalType(value); } }
Source:
<code>public Response cancelCharge(@Auth String accountId, @PathParam(PAYMENT_KEY) String chargeId) { logger.info("received cancel payment request: [{}]", chargeId); Response connectorResponse = client.target(chargeUrl + "/" + chargeId + "/cancel") .request() .post(Entity.json(jsonStringBuilder() <START> .add(GATEWAY_ACCOUNT_KEY, accountId) <END> .build())); if (connectorResponse.getStatus() == HttpStatus.SC_NO_CONTENT) { return Response.noContent().build(); } return badRequestResponse(logger, "Cancellation of charge failed."); }</code><technical_language>GATEWAY_ACCOUNT_ID</technical_language>

Target:
public Response cancelCharge(@Auth String accountId, @PathParam(PAYMENT_KEY) String chargeId) { logger.info("received cancel payment request: [{}]", chargeId); Response connectorResponse = client.target(connectorUrl + format(CONNECTOR_ACCOUNT_CHARGE_CANCEL_RESOURCE, accountId, chargeId)) .request() .post(Entity.json("{}")); if (connectorResponse.getStatus() == HttpStatus.SC_NO_CONTENT) { return Response.noContent().build(); } return badRequestResponse(logger, "Cancellation of charge failed."); }
Source:
<code>public void run() { if ( resources == null || resources.isEmpty() ) { logger.info( "No resources for downloading" ); return; } logger.info( "Start downloading: {}", resources ); final AtomicBoolean scheduled = new AtomicBoolean( false ); for ( Map.Entry<RemoteRepository, List<ConcreteResource>> entry : resources.entrySet() ) { final RemoteRepository repo = entry.getKey(); final List<ConcreteResource> res = entry.getValue(); res.forEach( r -> { try { final String path = r.getPath(); if ( path == null || path.equals( "" ) || path.endsWith( "/" ) || path.endsWith( LISTING_HTML_FILE ) ) { List<String> dirPaths = buildPaths( r ); logger.info( "{} is folder, will use it to schedule new Resources {}", r, dirPaths ); frontier.scheduleRepo( repo, dirPaths ); scheduled.set( true ); } else { logger.info( "{} is file", r ); final Transfer tr = transfers.retrieve( r ); <START> if ( !exists( tr ) ) <END> { logger.warn( "Download failed during prefetch for {}, reason is resource not exists", r ); } } } catch ( TransferException e ) { logger.error( "Download failed during prefetch because of transfer getting failed for {}, Reason: {}", r, e.getMessage() ); } } ); } if ( scheduled.get() ) { prefetchManager.triggerWorkers(); } }</code><technical_language>Do need wait for download complete this? I retrieve returns download starts..</technical_language>

Target:
public void run() { if ( resources == null || resources.isEmpty() ) { logger.trace( "No resources for downloading" ); return; } logger.trace( "Start downloading: {}", resources ); final AtomicBoolean scheduled = new AtomicBoolean( false ); for ( Map.Entry<RemoteRepository, List<ConcreteResource>> entry : resources.entrySet() ) { final RemoteRepository repo = entry.getKey(); final List<ConcreteResource> res = entry.getValue(); res.forEach( r -> { try { final String path = r.getPath(); if ( path == null || path.equals( "" ) || path.endsWith( "/" ) || path.endsWith( LISTING_HTML_FILE ) ) { List<String> dirPaths = buildPaths( r ); logger.trace( "{} is folder, will use it to schedule new Resources {}", r, dirPaths ); frontier.scheduleRepo( repo, dirPaths ); scheduled.set( true ); } else { logger.trace( "{} is file", r ); transfers.retrieve( r ); } } catch ( TransferException e ) { logger.error( "Download failed during prefetch because of transfer getting failed for {}, Reason: {}", r, e.getMessage() ); } } ); } if ( scheduled.get() ) { prefetchManager.triggerWorkers(); } }
Source:
<code>public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { try { CommCareApplication._().getUserDbHandle(); } catch(SessionUnavailableException sue) { return null; } int match = CaseDataAPI.UriMatch(uri); <START> System.out.println("428 match is: " + match); <END> switch(match) { case CaseDataAPI.MetadataColumns.MATCH_CASES: case CaseDataAPI.MetadataColumns.MATCH_CASE: return queryCaseList(uri, projection, selection, selectionArgs, sortOrder); case CaseDataAPI.DataColumns.MATCH_DATA: return queryCaseData(uri.getLastPathSegment(), projection, selection, selectionArgs, sortOrder); case CaseDataAPI.AttachmentColumns.MATCH_ATTACHMENTS: return queryCaseAttachments(uri.getLastPathSegment(), projection, selection, selectionArgs, sortOrder); case CaseDataAPI.IndexColumns.MATCH_INDEX: return null; } throw new IllegalArgumentException("URI: " + uri.toString() +" is not a valid content path for CommCare Case Data"); }</code><technical_language>good remove merging</technical_language>

Target:
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { try { CommCareApplication._().getUserDbHandle(); } catch(SessionUnavailableException sue) { return null; } int match = CaseDataAPI.UriMatch(uri); switch(match) { case CaseDataAPI.MetadataColumns.MATCH_CASES: case CaseDataAPI.MetadataColumns.MATCH_CASE: return queryCaseList(uri, projection, selection, selectionArgs, sortOrder); case CaseDataAPI.DataColumns.MATCH_DATA: return queryCaseData(uri.getLastPathSegment()); case CaseDataAPI.AttachmentColumns.MATCH_ATTACHMENTS: return queryCaseAttachments(uri.getLastPathSegment()); case CaseDataAPI.IndexColumns.MATCH_INDEX: return null; } throw new IllegalArgumentException("URI: " + uri.toString() +" is not a valid content path for CommCare Case Data"); }
Source:
<code>private String appendXMLRPCPath(String url) throws IllegalArgumentException { if (!URLUtil.isValidUrl(url)) { throw new IllegalArgumentException("Input URL " + url + " is not valid!"); } if (!url.contains("xmlrpc.php")) { <START> if (url.substring(url.length() - 1, url.length()).equals("/")) { <END> url = url.substring(0, url.length() - 1); } url += "/xmlrpc.php"; if (!URLUtil.isValidUrl(url)) { throw new IllegalArgumentException("The new URL " + url + " is not valid!"); } } return url; }</code><technical_language>minor nitpick: charAt this a bit more readable: if (url.charAt(url.length() - 1) == '/')</technical_language>

Target:
private String appendXMLRPCPath(String url) throws IllegalArgumentException { if (!URLUtil.isValidUrl(url)) { throw new IllegalArgumentException("Input URL " + url + " is not valid!"); } if (!url.contains("xmlrpc.php")) { if (url.charAt(url.length() - 1) == '/') { url = url.substring(0, url.length() - 1); } url += "/xmlrpc.php"; if (!URLUtil.isValidUrl(url)) { throw new IllegalArgumentException("The new URL " + url + " is not valid!"); } } return url; }
Source:
<code>protected A play(I id, AggregateHistory history) { A result = create(id); AggregateTransaction<I, ?, ?> tx = AggregateTransaction.start(result); BatchDispatchOutcome outcome = result.play(history); boolean success = outcome.getSuccessful(); tx.commitIfActive(); if (!success) { lifecycleOf(id).onCorruptedState(outcome); <START> throw newIllegalStateException( <END> "Aggregate %s (ID: %s) cannot be loaded.%n", aggregateClass().value().getName(), result.idAsString() ); } return result; }</code><technical_language>Please revert formatting. policy is split method param if possible, i.e. if char count is big</technical_language>

Target:
protected A play(I id, AggregateHistory history) { A result = create(id); AggregateTransaction<I, ?, ?> tx = AggregateTransaction.start(result); BatchDispatchOutcome outcome = result.play(history); boolean success = outcome.getSuccessful(); tx.commitIfActive(); if (!success) { lifecycleOf(id).onCorruptedState(outcome); throw newIllegalStateException("Aggregate `%s` (ID: %s) cannot be loaded.%n", aggregateClass().value() .getName(), result.idAsString()); } return result; }