auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void parseRewind(final ReceiveCommand cmd) { RevCommit newObject; try { newObject = rp.getRevWalk().parseCommit(cmd.getNewId()); } catch (IncorrectObjectTypeException notCommit) { newObject = null; } catch (IOException err) { log.error("Invalid object " + cmd.getNewId().name() + " for " + cmd.getRefName() + " forced update", err); reject(cmd, "invalid object"); return; } RefControl ctl = projectControl.controlForRef(cmd.getRefName()); if (newObject != null) { validateNewCommits(ctl, cmd); if (cmd.getResult() != ReceiveCommand.Result.NOT_ATTEMPTED) { return; } } if (ctl.canForceUpdate()) { } else { cmd.setResult(ReceiveCommand.Result.REJECTED_NONFASTFORWARD); reject(cmd, <START> "For non-fast forward updates, 'Force Push' privilege is needed"); <END> } }</code><technical_language>I concerned 'Force Push' called 'Force Push' (we talked simply calling push some, overwrite else...), if a change ACLs, I suspect forget update this message. I suspect deal this is a constant ACL code instead of hardcoding 'Force Push' here</technical_language>

Target:
private void parseRewind(final ReceiveCommand cmd) { RevCommit newObject; try { newObject = rp.getRevWalk().parseCommit(cmd.getNewId()); } catch (IncorrectObjectTypeException notCommit) { newObject = null; } catch (IOException err) { log.error("Invalid object " + cmd.getNewId().name() + " for " + cmd.getRefName() + " forced update", err); reject(cmd, "invalid object"); return; } RefControl ctl = projectControl.controlForRef(cmd.getRefName()); if (newObject != null) { validateNewCommits(ctl, cmd); if (cmd.getResult() != ReceiveCommand.Result.NOT_ATTEMPTED) { return; } } if (ctl.canForceUpdate()) { } else { cmd.setResult(ReceiveCommand.Result.REJECTED_NONFASTFORWARD); reject(cmd, "For non-fast forward updates, '" + PermissionRule.FORCE_PUSH + "' privilege is needed"); } }
Source:
<code>public String reportProblemForSingle() { this.myDav.uploadFromHome(this.currentStep.getProcess()); this.problem.setId(getIdForCorrection(this.problemTask)); serviceManager.getWorkflowService().setProblem(getProblem()); try { this.currentStep = serviceManager.getWorkflowService().reportProblem(this.currentStep); saveStep(); } catch (DAOException | DataException e) { Helper.setFehlerMeldung("correctionReportProblem"); <START> logger.error(e.getMessage(), e); <END> } setProblem(serviceManager.getWorkflowService().getProblem()); this.problemTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }</code><technical_language>setErrorMessage</technical_language>

Target:
public String reportProblemForSingle() { this.myDav.uploadFromHome(this.currentStep.getProcess()); this.problem.setId(getIdForCorrection(this.problemTask)); serviceManager.getWorkflowControllerService().setProblem(getProblem()); try { this.currentStep = serviceManager.getWorkflowControllerService().reportProblem(this.currentStep); saveStep(); } catch (DAOException | DataException e) { Helper.setErrorMessage("correctionReportProblem", logger, e); } setProblem(serviceManager.getWorkflowControllerService().getProblem()); this.problemTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }
Source:
<code>public void operationComplete(ChannelFuture future) { long writeFinishTime = System.currentTimeMillis(); if (future.isSuccess()) { if (finalResponseMetadata instanceof LastHttpContent) { if (!writeFuture.isDone()) { writeFuture.setSuccess(); completeRequest(!HttpHeaders.isKeepAlive(finalResponseMetadata)); } } else { logger.trace("Starting ChunkedWriteHandler on channel {}", ctx.channel()); writeFuture.addListener(new CallbackInvoker()); ctx.writeAndFlush(new ChunkDispenser(), writeFuture); } } else { handleChannelWriteFailure(future.cause(), true); } long responseAfterWriteProcessingTime = System.currentTimeMillis() - writeFinishTime; long channelWriteTime = writeFinishTime - responseWriteStartTime; nettyMetrics.channelWriteTimeInMs.update(channelWriteTime); nettyMetrics.responseMetadataAfterWriteProcessingTimeInMs.update(responseAfterWriteProcessingTime); if (request != null) { request.getMetricsTracker().nioMetricsTracker.addToResponseProcessingTime(channelWriteTime); <START> request.getMetricsTracker().nioMetricsTracker.addToResponseProcessingTime(responseAfterWriteProcessingTime); <END> } }</code><technical_language>update once. request.getMetricsTracker().nioMetricsTracker.addToResponseProcessingTime(channelWriteTime + responseAfterWriteProcessingTime);</technical_language>

Target:
public void operationComplete(ChannelFuture future) { long writeFinishTime = System.currentTimeMillis(); if (future.isSuccess()) { if (finalResponseMetadata instanceof LastHttpContent) { if (!writeFuture.isDone()) { writeFuture.setSuccess(); completeRequest(!HttpHeaders.isKeepAlive(finalResponseMetadata)); } } else { logger.trace("Starting ChunkedWriteHandler on channel {}", ctx.channel()); writeFuture.addListener(new CallbackInvoker()); ctx.writeAndFlush(new ChunkDispenser(), writeFuture); } } else { handleChannelWriteFailure(future.cause(), true); } long responseAfterWriteProcessingTime = System.currentTimeMillis() - writeFinishTime; long channelWriteTime = writeFinishTime - responseWriteStartTime; nettyMetrics.channelWriteTimeInMs.update(channelWriteTime); nettyMetrics.responseMetadataAfterWriteProcessingTimeInMs.update(responseAfterWriteProcessingTime); if (request != null) { request.getMetricsTracker().nioMetricsTracker .addToResponseProcessingTime(channelWriteTime + responseAfterWriteProcessingTime); } }
Source:
<code>protected String internalTransform(Map<Range, String> data, String source) throws TransformationException { try { final BigDecimal value = new BigDecimal(source); Optional<Range> match = data.keySet().stream().filter(range -> range.contains(value)).findFirst(); if (match.isPresent()) { <START> return data.get(match.get()); <END> } throw new TransformationException("No matching range for '" + source + "'"); } catch (NumberFormatException e) { throw new TransformationException("Scale can only be used with numeric inputs"); } }</code><technical_language>I do this: java return data.entrySet().stream(). filter(e -> e.getKey().contains(value)). findFirst(). map(Map.Entry::getValue). orElseThrow(() -> new TransformationException("No matching range for '" + source + "'"));</technical_language>

Target:
protected String internalTransform(Map<Range, String> data, String source) throws TransformationException { try { final BigDecimal value = new BigDecimal(source); return data.entrySet().stream().filter(e -> e.getKey().contains(value)).findFirst().map(Map.Entry::getValue) .orElseThrow(() -> new TransformationException("No matching range for '" + source + "'")); } catch (NumberFormatException e) { throw new TransformationException("Scale can only be used with numeric inputs"); } }
Source:
<code>public void Set_By_Sorted_Reverse() { <START> Map<Integer, Group> results = BASIC_RESULTS <END> .transform(groupBy(postId).as(postName, sortedSet(commentId, Ordering.natural().reverse()))); Group group = results.get(1); Iterator<Integer> it = group.getSet(commentId).iterator(); assertEquals(3, it.next().intValue()); assertEquals(2, it.next().intValue()); assertEquals(1, it.next().intValue()); }</code><technical_language>BASIC_RESULTS_UNORDERED instead of sorted BASIC_RESULTS? for Set_By_Sorted()</technical_language>

Target:
public void Set_By_Sorted_Reverse() { Map<Integer, Group> results = BASIC_RESULTS_UNORDERED .transform(groupBy(postId).as(postName, sortedSet(commentId, Ordering.natural().reverse()))); Group group = results.get(1); Iterator<Integer> it = group.getSet(commentId).iterator(); assertEquals(3, it.next().intValue()); assertEquals(2, it.next().intValue()); assertEquals(1, it.next().intValue()); }
Source:
<code>public long getQuota(String projectname) throws IOException { String rootDir = settings.DIR_ROOT; String fullProjectPath = File.separator + rootDir + File.separator <START> + projectname; <END> String project = this.extractProjectName(fullProjectPath + File.separator); String projectPath = File.separator + rootDir + File.separator + project; return dfsSingleton.getDfsOps().getQuota(new Path(projectPath)); }</code><technical_language>a global Utility function (static method - e.g., of Settings.java class) get full path, a project name. I code 4/5 places in code. Search for "rootDir + F" find references</technical_language>

Target:
public long getQuota(String projectname) throws IOException { return dfsSingleton.getDfsOps().getQuota(new Path(settings.getProjectPath(projectname))); }
Source:
<code>public void testDefaultPrintHelp() throws IOException, NoSuchMethodException { <START> Iterator i = tajoCli.getContext().getCommands().keySet().iterator(); <END> while (i.hasNext()) { String command = i.next().toString(); if (tajoCli.getContext().getCommands().get(command).getClass().getMethod("printHelp") .getDeclaringClass().toString().equals("class org.apache.tajo.cli.tsql.commands.TajoShellCommand")) { tajoCli.executeMetaCommand("\\help " + command.replace("\\", "")); String result = new String(out.toByteArray()); out.reset(); String expected = tajoCli.getContext().getCommands().get(command).getCommand() + " " + tajoCli.getContext().getCommands().get(command).getUsage() + " - " + tajoCli.getContext().getCommands().get(command).getDescription() + "\n"; assertEquals(result, expected); } } }</code><technical_language>If entrySet() instead of keySet().iterator(), test codes more simple</technical_language>

Target:
public void testDefaultPrintHelp() throws IOException, NoSuchMethodException { for (Map.Entry<String, TajoShellCommand> entry : tajoCli.getContext().getCommands().entrySet()) { TajoShellCommand shellCommand = entry.getValue(); if (!shellCommand.getClass().getMethod("printHelp").getDeclaringClass().equals(shellCommand.getClass())) { tajoCli.executeMetaCommand("\\help " + entry.getKey().replace("\\", "")); String result = new String(out.toByteArray()); out.reset(); String expected = shellCommand.getCommand() + " " + shellCommand.getUsage() + " - " + shellCommand.getDescription() + "\n"; assertEquals(result, expected); } } }
Source:
<code>static Request toOkHttpRequest(feign.Request input) { Request.Builder requestBuilder = new Request.Builder(); requestBuilder.url(input.url()); MediaType mediaType = null; boolean hasAcceptHeader = false; for (String field : input.headers().keySet()) { if (field.equalsIgnoreCase("Accept")) { hasAcceptHeader = true; } for (String value : input.headers().get(field)) { requestBuilder.addHeader(field, value); if (field.equalsIgnoreCase("Content-Type")) { mediaType = MediaType.parse(value); if (input.charset() != null) { mediaType.charset(input.charset()); } } } } if (!hasAcceptHeader) { requestBuilder.addHeader("Accept", "*/*"); } byte[] inputBody = input.body(); boolean isMethodWithBody = HttpMethod.POST == input.httpMethod() || HttpMethod.PUT == input.httpMethod() || HttpMethod.PATCH == input.httpMethod(); if (isMethodWithBody) { requestBuilder.removeHeader("Content-Type"); if (inputBody == null) { inputBody = new byte[0]; } } <START> RequestBody body = inputBody != null ? RequestBody.create(inputBody, mediaType) : null; <END> requestBuilder.method(input.httpMethod().name(), body); return requestBuilder.build(); }</code><technical_language>I deprecated one, feign compatible a wider number releases</technical_language>

Target:
static Request toOkHttpRequest(feign.Request input) { Request.Builder requestBuilder = new Request.Builder(); requestBuilder.url(input.url()); MediaType mediaType = null; boolean hasAcceptHeader = false; for (String field : input.headers().keySet()) { if (field.equalsIgnoreCase("Accept")) { hasAcceptHeader = true; } for (String value : input.headers().get(field)) { requestBuilder.addHeader(field, value); if (field.equalsIgnoreCase("Content-Type")) { mediaType = MediaType.parse(value); if (input.charset() != null) { mediaType.charset(input.charset()); } } } } if (!hasAcceptHeader) { requestBuilder.addHeader("Accept", "*/*"); } byte[] inputBody = input.body(); boolean isMethodWithBody = HttpMethod.POST == input.httpMethod() || HttpMethod.PUT == input.httpMethod() || HttpMethod.PATCH == input.httpMethod(); if (isMethodWithBody) { requestBuilder.removeHeader("Content-Type"); if (inputBody == null) { inputBody = new byte[0]; } } RequestBody body = inputBody != null ? RequestBody.create(mediaType, inputBody) : null; requestBuilder.method(input.httpMethod().name(), body); return requestBuilder.build(); }
Source:
<code>public Mono<OAuth2AccessTokenResponse> getTokenResponse(OAuth2ClientCredentialsGrantRequest authorizationGrantRequest) { return Mono.defer(() -> { ClientRegistration clientRegistration = authorizationGrantRequest.getClientRegistration(); String tokenUri = clientRegistration.getProviderDetails().getTokenUri(); BodyInserters.FormInserter<String> body = body(authorizationGrantRequest); <START> org.springframework.web.reactive.function.client.WebClient.RequestBodyUriSpec spec = webClient.post(); <END> return this.webClient.post() .uri(tokenUri) .accept(MediaType.APPLICATION_JSON) .headers(headers(clientRegistration)) .body(body) .exchange() .flatMap(response -> response.body(oauth2AccessTokenResponse())) .map(response -> { if (response.getAccessToken().getScopes().isEmpty()) { response = OAuth2AccessTokenResponse.withResponse(response) .scopes(authorizationGrantRequest.getClientRegistration().getScopes()) .build(); } return response; }); }); }</code><technical_language>change this import in-lining full package name</technical_language>

Target:
public Mono<OAuth2AccessTokenResponse> getTokenResponse(OAuth2ClientCredentialsGrantRequest authorizationGrantRequest) { return Mono.defer(() -> { ClientRegistration clientRegistration = authorizationGrantRequest.getClientRegistration(); String tokenUri = clientRegistration.getProviderDetails().getTokenUri(); BodyInserters.FormInserter<String> body = body(authorizationGrantRequest); RequestBodyUriSpec spec = webClient.post(); return this.webClient.post() .uri(tokenUri) .accept(MediaType.APPLICATION_JSON) .headers(headers(clientRegistration)) .body(body) .exchange() .flatMap(response ->{ if (!response.statusCode().is2xxSuccessful()){ throw WebClientResponseException.create(response.rawStatusCode(), "Cannot get token, expected 2xx HTTP Status code", null, null, null ); } return response.body(oauth2AccessTokenResponse()); }) .map(response -> { if (response.getAccessToken().getScopes().isEmpty()) { response = OAuth2AccessTokenResponse.withResponse(response) .scopes(authorizationGrantRequest.getClientRegistration().getScopes()) .build(); } return response; }); }); }
Source:
<code>public void onMessage(HTTPCarbonMessage httpResponseMessage) { Util.setupTransferEncodingForResponse(httpResponseMessage, requestDataHolder); sourceContext.channel().eventLoop().execute(() -> { boolean connectionCloseAfterResponse = shouldConnectionClose(httpResponseMessage); if (handlerExecutor != null) { handlerExecutor.executeAtSourceResponseReceiving(httpResponseMessage); } final HttpResponse response = Util .createHttpResponse(httpResponseMessage, connectionCloseAfterResponse); sourceContext.write(response); httpResponseMessage.getHttpContentAsync().setMessageListener(httpContent -> this.sourceContext.channel().eventLoop().execute(() -> { if (Util.isLastHttpContent(httpContent)) { ChannelFuture future = sourceContext.writeAndFlush(httpContent); <START> HttpResponseStatusFuture responseStatusFuture = requestMsg.getHttpResponseStatusFuture(); <END> future.addListener(genericFutureListener -> { if (genericFutureListener.cause() != null) { responseStatusFuture.notifyHttpListener(genericFutureListener.cause()); } responseStatusFuture.notifyHttpListener(requestMsg); }); if (connectionCloseAfterResponse) { future.addListener(ChannelFutureListener.CLOSE); } if (handlerExecutor != null) { handlerExecutor.executeAtSourceResponseSending(httpResponseMessage); } } else { sourceContext.write(httpContent); } })); }); Util.prepareBuiltMessageForTransfer(httpResponseMessage); }</code><technical_language>getHttpOutboundRespStatusFuture</technical_language>

Target:
public void onMessage(HTTPCarbonMessage httpResponseMessage) { Util.setupTransferEncodingForResponse(httpResponseMessage, requestDataHolder); sourceContext.channel().eventLoop().execute(() -> { boolean connectionCloseAfterResponse = shouldConnectionClose(httpResponseMessage); if (handlerExecutor != null) { handlerExecutor.executeAtSourceResponseReceiving(httpResponseMessage); } final HttpResponse response = Util .createHttpResponse(httpResponseMessage, connectionCloseAfterResponse); sourceContext.write(response); httpResponseMessage.getHttpContentAsync().setMessageListener(httpContent -> this.sourceContext.channel().eventLoop().execute(() -> { if (Util.isLastHttpContent(httpContent)) { ChannelFuture outboundChannelFuture = sourceContext.writeAndFlush(httpContent); HttpResponseStatusFuture outboundRespStatusFuture = inboundRequestMsg.getHttpOutboundRespStatusFuture(); outboundChannelFuture.addListener(genericFutureListener -> { if (genericFutureListener.cause() != null) { outboundRespStatusFuture.notifyHttpListener(genericFutureListener.cause()); } else { outboundRespStatusFuture.notifyHttpListener(inboundRequestMsg); } }); if (connectionCloseAfterResponse) { outboundChannelFuture.addListener(ChannelFutureListener.CLOSE); } if (handlerExecutor != null) { handlerExecutor.executeAtSourceResponseSending(httpResponseMessage); } } else { sourceContext.write(httpContent); } })); }); Util.prepareBuiltMessageForTransfer(httpResponseMessage); }
Source:
<code>public void testPackageWithMainlineNetworkStackPermission() { final PackageManager packageManager = mContext.getPackageManager(); final List<PackageInfo> packageList = packageManager.getPackagesHoldingPermissions( new String[]{PERMISSION_MAINLINE_NETWORK_STACK}, PackageManager.MATCH_SYSTEM_ONLY | PackageManager.GET_PERMISSIONS); int packageCount = 0; <START> for (PackageInfo packageInfo : packageList) { <END> if (packageInfo.permissions == null) { break; } for (PermissionInfo permission : packageInfo.permissions) { if (PERMISSION_MAINLINE_NETWORK_STACK.equals(permission.name)) { packageCount++; } } } assertTrue("Package count that declares " + PERMISSION_MAINLINE_NETWORK_STACK + " should be " + EXPECTED_DECLARATION_PERMISSION_COUNT + " but " + packageCount, (packageCount == EXPECTED_DECLARATION_PERMISSION_COUNT)); }</code><technical_language>Instead of iterating packages, do PackageManager#getPermissionInfo(). packageName ? PackageManager.getPackageInfo(packageName, MATCH_SYSTEM_ONLY). thinking package define permission hold ? Right package shares UID signature NetworkStack.apk, OEMs InProcessNetworkStack.apk instead</technical_language>

Target:
public void testPackageWithMainlineNetworkStackPermission() throws Exception { final PackageManager packageManager = mContext.getPackageManager(); assertNotNull(packageManager); int packageCount = 0; final PermissionInfo permissioninfo = packageManager.getPermissionInfo(PERMISSION_MAINLINE_NETWORK_STACK, 0); assertNotNull(permissioninfo); PackageInfo packageInfo = packageManager.getPackageInfo(permissioninfo.packageName, PackageManager.MATCH_SYSTEM_ONLY | PackageManager.GET_PERMISSIONS); assertNotNull(packageInfo.permissions); for (PermissionInfo permission : packageInfo.permissions) { if (PERMISSION_MAINLINE_NETWORK_STACK.equals(permission.name)) { packageCount++; } } assertTrue("Package count that declares " + PERMISSION_MAINLINE_NETWORK_STACK + " should be " + EXPECTED_DECLARATION_PERMISSION_COUNT + " but " + packageCount, (packageCount == EXPECTED_DECLARATION_PERMISSION_COUNT)); }
Source:
<code>private Extractors getExtractorsForMapName(String mapNameOrNull) { if (mapNameOrNull == null) { <START> return Extractors.newBuilder(((InternalSerializationService) serializationService)) <END> .build(); } return mapServiceContext.getExtractors(mapNameOrNull); }</code><technical_language>change serializationService of type internalSerializationService need do this cast place</technical_language>

Target:
private Extractors getExtractorsForMapName(String mapNameOrNull) { if (mapNameOrNull == null) { return Extractors.newBuilder(serializationService) .build(); } return mapServiceContext.getExtractors(mapNameOrNull); }
Source:
<code>public static EC2HardwareBuilder c5d_2xlarge() { return new EC2HardwareBuilder(InstanceType.C5D_2XLARGE).c5() .ram(16384) .processors(ImmutableList.of(new Processor(8.0, 3.0))) .volumes(ImmutableList.<Volume>of( new VolumeBuilder().type(LOCAL).size(10.0f).device("/dev/sda1").bootDevice(true).durable(false).build(), <START> new VolumeBuilder().type(LOCAL).size(200.0f).device("/dev/sdb").bootDevice(false).durable(false).build())) <END> .is64Bit(true); }</code><technical_language>225.0f</technical_language>

Target:
public static EC2HardwareBuilder c5d_2xlarge() { return new EC2HardwareBuilder(InstanceType.C5D_2XLARGE).c5() .ram(16384) .processors(ImmutableList.of(new Processor(8.0, 3.0))) .volumes(ImmutableList.<Volume>of( new VolumeBuilder().type(LOCAL).size(10.0f).device("/dev/sda1").bootDevice(true).durable(false).build(), new VolumeBuilder().type(LOCAL).size(225.0f).device("/dev/sdb").bootDevice(false).durable(false).build())) .is64Bit(true); }
Source:
<code>private K parseConfigVars(KRunOptions options, CompiledDefinition compiledDef) { HashMap<KToken, K> output = new HashMap<>(); for (Map.Entry<String, Pair<String, String>> entry : options.configurationCreation.configVars(compiledDef.languageParsingModule().name()).entrySet()) { String name = entry.getKey(); String value = entry.getValue().getLeft(); String parser = entry.getValue().getRight(); Sort sort = Sorts.K(); K configVar = externalParse(parser, value, sort, Source.apply("<command line: -c" + name + ">"), compiledDef); output.put(KToken("$" + name, Sorts.KConfigVar()), configVar); } if (options.io()) { output.put(KToken("$STDIN", Sorts.KConfigVar()), KToken("\"\"", Sorts.String())); output.put(KToken("$IO", Sorts.KConfigVar()), KToken("\"on\"", Sorts.String())); } else { <START> String stdin = InitialConfigurationProvider.getStdinBuffer(true); <END> output.put(KToken("$STDIN", Sorts.KConfigVar()), KToken("\"" + stdin + "\"", Sorts.String())); output.put(KToken("$IO", Sorts.KConfigVar()), KToken("\"off\"", Sorts.String())); } return plugConfigVars(compiledDef, output); }</code><technical_language>I pass this boolean argument constructor for KRun.java honestly. this true time break if run nailgun, is I want happen impact developer throughput</technical_language>

Target:
private K parseConfigVars(KRunOptions options, CompiledDefinition compiledDef) { HashMap<KToken, K> output = new HashMap<>(); for (Map.Entry<String, Pair<String, String>> entry : options.configurationCreation.configVars(compiledDef.languageParsingModule().name()).entrySet()) { String name = entry.getKey(); String value = entry.getValue().getLeft(); String parser = entry.getValue().getRight(); Sort sort = Sorts.K(); K configVar = externalParse(parser, value, sort, Source.apply("<command line: -c" + name + ">"), compiledDef); output.put(KToken("$" + name, Sorts.KConfigVar()), configVar); } if (options.io()) { output.put(KToken("$STDIN", Sorts.KConfigVar()), KToken("\"\"", Sorts.String())); output.put(KToken("$IO", Sorts.KConfigVar()), KToken("\"on\"", Sorts.String())); } else { String stdin = InitialConfigurationProvider.getStdinBuffer(ttyStdin); output.put(KToken("$STDIN", Sorts.KConfigVar()), KToken("\"" + stdin + "\"", Sorts.String())); output.put(KToken("$IO", Sorts.KConfigVar()), KToken("\"off\"", Sorts.String())); } return plugConfigVars(compiledDef, output); }
Source:
<code>private void initTimeBoxes() { <START> hoursBox = initIntegerValueBox(formStepValues(hourSteps, 1, 12)); <END> addHourSelectionListener(); minutesBox = initIntegerValueBox(formStepValues(minuteSteps, 0, 59)); addMinuteSelectionListener(); amPmBox = initStringValueBox(new ArrayList<String>(Arrays.asList(MORNING, EVENING))); addAmPmSelectionListener(); }</code><technical_language>HOUR_CONSTANT defined about,</technical_language>

Target:
private void initTimeBoxes() { hoursBox = initIntegerValueBox(formStepValues(hourSteps, 1, HOUR_CONSTANT)); addHourSelectionListener(); minutesBox = initIntegerValueBox(formStepValues(minuteSteps, 0, MINUTE_MAX)); addMinuteSelectionListener(); amPmBox = initStringValueBox(new ArrayList<String>(Arrays.asList(MORNING, EVENING))); addAmPmSelectionListener(); }
Source:
<code>public void disconnect(boolean criticalError) { amqpConnection.runLater(() -> { ErrorCondition errorCondition = new ErrorCondition(); errorCondition.setCondition(AmqpSupport.CONNECTION_FORCED); amqpConnection.close(errorCondition); amqpConnection.flush(); }); <START> amqpConnection.runLater(() -> { <END> getTransportConnection().close(); }); }</code><technical_language>is a naive question, 2 separate runLater calls instead of one</technical_language>

Target:
public void disconnect(boolean criticalError) { ErrorCondition errorCondition = new ErrorCondition(); errorCondition.setCondition(AmqpSupport.CONNECTION_FORCED); amqpConnection.close(errorCondition); }
Source:
<code>public Map<Long, ILogData> readAll(RuntimeLayout runtimeLayout, List<Long> globalAddresses) { log.trace("ChainReplicationProtocol-readAll: multiple read for addresses {}", globalAddresses); <START> Long startAddress = globalAddresses.get(0); <END> int numUnits = runtimeLayout.getLayout().getSegmentLength(startAddress); Map<Long, LogData> logResult = CFUtils.getUninterruptibly(runtimeLayout .getLogUnitClient(startAddress, numUnits - 1) .read(globalAddresses)).getAddresses(); return multiRead(runtimeLayout, logResult, startAddress, numUnits, true); }</code><technical_language>magic number</technical_language>

Target:
public Map<Long, ILogData> readAll(RuntimeLayout runtimeLayout, List<Long> globalAddresses) { log.trace("ChainReplicationProtocol-readAll: multiple read for addresses {}", globalAddresses); Long startAddress = Collections.min(globalAddresses); int numUnits = runtimeLayout.getLayout().getSegmentLength(startAddress); Map<Long, LogData> logResult = CFUtils.getUninterruptibly(runtimeLayout .getLogUnitClient(startAddress, numUnits - 1) .read(globalAddresses)).getAddresses(); return multiRead(runtimeLayout, logResult, startAddress, numUnits, true); }
Source:
<code>private Object[] prepareParameters(Method method, MultiValueMap<String, ? extends Object> rawParameters, Pageable pageable, Sort sort) { List<MethodParameter> parameters = new MethodParameters(method, PARAM_ANNOTATION).getParameters(); if (parameters.isEmpty()) { return new Object[0]; } Object[] result = new Object[parameters.size()]; Sort sortToUse = pageable == null ? sort : pageable.getSort(); for (int i = 0; i < result.length; i++) { MethodParameter param = parameters.get(i); Class<?> targetType = param.getParameterType(); if (Pageable.class.isAssignableFrom(targetType)) { result[i] = pageable; } else if (Sort.class.isAssignableFrom(targetType)) { result[i] = sortToUse; } else { final Parameter parameterAnnotation = param.getParameterAnnotation(Parameter.class); String parameterName = null; if (parameterAnnotation != null) { parameterName = parameterAnnotation.value(); } if (parameterName == null) { parameterName = param.getParameterName(); <START> } <END> if (StringUtils.isBlank(parameterName)) { throw new IllegalArgumentException( String.format(NAME_NOT_FOUND, ClassUtils.getQualifiedMethodName(method))); } Object value = unwrapSingleElement(rawParameters.get(parameterName)); result[i] = targetType.isInstance(value) ? value : convert(value, param); } } return result; }</code><technical_language>This a duplicate of line 129 136. move this logic internal private method reuse method in places</technical_language>

Target:
private Object[] prepareParameters(Method method, MultiValueMap<String, ? extends Object> rawParameters, Pageable pageable, Sort sort) { List<MethodParameter> parameters = new MethodParameters(method, PARAM_ANNOTATION).getParameters(); if (parameters.isEmpty()) { return new Object[0]; } Object[] result = new Object[parameters.size()]; Sort sortToUse = pageable == null ? sort : pageable.getSort(); for (int i = 0; i < result.length; i++) { MethodParameter param = parameters.get(i); Class<?> targetType = param.getParameterType(); if (Pageable.class.isAssignableFrom(targetType)) { result[i] = pageable; } else if (Sort.class.isAssignableFrom(targetType)) { result[i] = sortToUse; } else { final Parameter parameterAnnotation = param.getParameterAnnotation(Parameter.class); String parameterName = getParamName(param, parameterAnnotation); if (StringUtils.isBlank(parameterName)) { throw new IllegalArgumentException( String.format(NAME_NOT_FOUND, ClassUtils.getQualifiedMethodName(method))); } Object value = unwrapSingleElement(rawParameters.get(parameterName)); result[i] = targetType.isInstance(value) ? value : convert(value, param); } } return result; }
Source:
<code>public void cancelContinuous(UUID routineId) { if (log.isInfoEnabled()) log.info("Killing continuous query[routineId=" + routineId + ']'); boolean res; try { IgniteClusterImpl cluster = ctx.cluster().get(); IgniteCompute compute = cluster.compute(); <START> ClusterNode srv = U.randomServerNode(ctx); <END> res = compute.execute(new VisorContinuousQueryCancelTask(), new VisorTaskArgument<>(srv.id(), new VisorContinuousQueryCancelTaskArg(routineId), false)); } catch (Exception e) { throw new RuntimeException(e); } if (!res) throw new RuntimeException("Query not found[routineId=" + routineId + ']'); }</code><technical_language>random node? send initiator</technical_language>

Target:
public void cancelContinuous(UUID routineId) { if (log.isInfoEnabled()) log.info("Killing continuous query[routineId=" + routineId + ']'); try { IgniteClusterImpl cluster = ctx.cluster().get(); IgniteCompute compute = cluster.compute(); ClusterNode srv = U.randomServerNode(ctx); boolean res = compute.execute(new VisorContinuousQueryCancelTask(), new VisorTaskArgument<>(srv.id(), new VisorContinuousQueryCancelTaskArg(routineId), false)); if (!res) throw new RuntimeException("Query not found[routineId=" + routineId + ']'); } catch (IgniteException e) { throw new RuntimeException(e); } }
Source:
<code>private List<OOBPayload> processOOB(String text) { ArrayList<OOBPayload> payloads = new ArrayList<OOBPayload>(); Matcher oobMatcher = oobPattern.matcher(text); while (oobMatcher.find()) { String oobPayload = oobMatcher.group(0); Matcher mrlMatcher = mrlPattern.matcher(oobPayload); while (mrlMatcher.find()) { String mrlPayload = mrlMatcher.group(0); OOBPayload payload = parseOOB(mrlPayload); payloads.add(payload); invoke("publishOOBText", mrlPayload); ServiceInterface s = Runtime.getService(payload.getServiceName()); if (s == null) { log.warn("Service name in OOB/MRL tag unknown. {}", mrlPayload); if (payload.getParams() != null) { <START> conversationHistory.add("<font color='#FF0000'><b> -> Missing OOB : " + payload.getParams() + "</b></font>"); <END> } else { conversationHistory.add("<font color='#FF0000'><b> -> Missing OOB : " + payload.getServiceName() + "</b></font>"); } return null; } Object result = null; if (payload.getParams() != null) { result = s.invoke(payload.getMethodName(), payload.getParams().toArray()); conversationHistory.add("<font color='#008000'><b> -> OOB: " + payload.getParams() + "</b></font>"); } else { result = s.invoke(payload.getMethodName()); conversationHistory.add("<font color='#008000'><b> -> OOB: " + payload.getMethodName() + "</b></font>"); } log.info("OOB PROCESSING RESULT: {}", result); } } if (payloads.size() > 0) { return payloads; } else { return null; } }</code><technical_language>HTML markup programmatically here. conversation history fixed length queue of response objects</technical_language>

Target:
private List<OOBPayload> processOOB(String text) { ArrayList<OOBPayload> payloads = new ArrayList<OOBPayload>(); Matcher oobMatcher = oobPattern.matcher(text); while (oobMatcher.find()) { String oobPayload = oobMatcher.group(0); Matcher mrlMatcher = mrlPattern.matcher(oobPayload); while (mrlMatcher.find()) { String mrlPayload = mrlMatcher.group(0); OOBPayload payload = parseOOB(mrlPayload); payloads.add(payload); invoke("publishOOBText", mrlPayload); ServiceInterface s = Runtime.getService(payload.getServiceName()); if (s == null) { log.warn("Service name in OOB/MRL tag unknown. {}", mrlPayload); return null; } Object result = null; if (payload.getParams() != null) { result = s.invoke(payload.getMethodName(), payload.getParams().toArray()); } else { result = s.invoke(payload.getMethodName()); } log.info("OOB PROCESSING RESULT: {}", result); } } if (payloads.size() > 0) { return payloads; } else { return null; } }
Source:
<code>public final void visitMethodInvocation(MethodInvocationTree tree) { scan(tree.methodSelect()); scan(tree.arguments()); for (ExecutionState executionState : currentStates) { SymbolicValue[] arguments = new SymbolicValue[tree.arguments().size()]; <START> for (int i = arguments.length - 1; i >= 0; i -= 1) { <END> arguments[i] = executionState.pop(); } check.onExecutableElementInvocation(executionState, tree, Arrays.asList(arguments)); executionState.invalidateFields(SymbolicEvaluator.this); } }</code><technical_language>@merciesa matter of taste, i-- instead of i -= 1</technical_language>

Target:
public final void visitMethodInvocation(MethodInvocationTree tree) { scan(tree.methodSelect()); scan(tree.arguments()); for (ExecutionState executionState : currentStates) { SymbolicValue[] arguments = new SymbolicValue[tree.arguments().size()]; for (int i = arguments.length - 1; i >= 0; i--) { arguments[i] = executionState.pop(); } check.onExecutableElementInvocation(executionState, tree, Arrays.asList(arguments)); executionState.invalidateFields(SymbolicEvaluator.this); } }
Source:
<code>public void checkTerminalAndBuild() { multiSplitPanel.selectSplitPanel(3); commandsBuilder( TestIntelligentCommandsConstants.CommandsGoals.COMMON_GOAL, TestIntelligentCommandsConstants.CommandsTypes.MAVEN_TYPE); projectExplorer.invokeCommandWithContextMenu(COMMON_GOAL, PROJECT_NAME, BUILD_COMM); consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS, 120); multiSplitPanel.waitTabProcessIsPresent(3, BUILD_COMM); multiSplitPanel.selectSplitPanel(1); consoles.clickOnPlusMenuButton(); consoles.clickOnTerminalItemInContextMenu(); consoles.startTerminalFromProcessesArea("dev-machine"); multiSplitPanel.waitTabProcessIsPresent(1, "Terminal-2"); terminal.waitTerminalIsNotEmpty(2); loader.waitOnClosed(); <START> typeIntoTerminalAndCheckTerminalIsNotEmpty(); <END> multiSplitPanel.waitTabProcessIsNotPresent(2, BUILD_COMM); }</code><technical_language>checkTerminalAcceptsInputProperly() method name is more relevant method does, IMHO</technical_language>

Target:
public void checkTerminalAndBuild() { multiSplitPanel.selectSplitPanel(3); commandsBuilder( TestIntelligentCommandsConstants.CommandsGoals.COMMON_GOAL, TestIntelligentCommandsConstants.CommandsTypes.MAVEN_TYPE); projectExplorer.invokeCommandWithContextMenu(COMMON_GOAL, PROJECT_NAME, BUILD_COMM); consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS, 120); multiSplitPanel.waitTabProcessIsPresent(3, BUILD_COMM); multiSplitPanel.selectSplitPanel(1); consoles.clickOnPlusMenuButton(); consoles.clickOnTerminalItemInContextMenu(); consoles.startTerminalFromProcessesArea("dev-machine"); multiSplitPanel.waitTabProcessIsPresent(1, "Terminal-2"); terminal.waitTerminalIsNotEmpty(2); loader.waitOnClosed(); terminal.typeIntoActiveTerminal(getCommandToCheckTerminal()); terminal.typeIntoActiveTerminal(Keys.ENTER.toString()); terminal.waitTerminalIsNotEmpty(3); loader.waitOnClosed(); checkExpectedTextIsPresent(); multiSplitPanel.waitTabProcessIsNotPresent(2, BUILD_COMM); }
Source:
<code>public static StrictPathRestriction stringToEnum(String strictPathRestrictionInString) { return StrictPathRestriction.valueOf(strictPathRestrictionInString.toUpperCase()); <START> } <END></code><technical_language>I understand lowercase is a bit easier read... is uppercase (setStrictPathRestriction below), lowercase (here). I if consistent (either upper lowercase). I fine if consistently uppercase, if simplifies code (I guess does). In case this method needed</technical_language>

Target:
public static StrictPathRestriction stringToEnum(String strictPathRestrictionInString) { return StrictPathRestriction.valueOf(strictPathRestrictionInString.toUpperCase(Locale.ENGLISH)); }
Source:
<code>public void setYValue(int i, double yvalue) { switch (fType) { case DELTA: double[] absoluteVals = fYAbsoluteValues; <START> if (absoluteVals == null) { throw new IllegalStateException(); } <END> absoluteVals[i] = yvalue; double prevValue = yvalue; if (i > 0) { prevValue = absoluteVals[i - 1]; } fYValues[i] = yvalue - prevValue; break; case ABSOLUTE: default: fYValues[i] = yvalue; break; } }</code><technical_language>Objects.requireNonNull exception message</technical_language>

Target:
public void setYValue(int i, double yvalue) { switch (fType) { case DELTA: double[] absoluteVals = Objects.requireNonNull(fYAbsoluteValues, "Array of absolute value should not be null"); absoluteVals[i] = yvalue; double prevValue = yvalue; if (i > 0) { prevValue = absoluteVals[i - 1]; } fYValues[i] = yvalue - prevValue; break; case ABSOLUTE: default: fYValues[i] = yvalue; break; } }
Source:
<code>public AllergyIntolerance getAllergyById(String uuid) { <START> PatientService allergyService = Context.getService(PatientService.class); <END> org.openmrs.Allergy openMRSAllergy = allergyService.getAllergyByUuid(uuid); return openMRSAllergy != null ? FHIRAllergyIntoleranceUtil.generateAllergyIntolerance(openMRSAllergy) : null; }</code><technical_language>rename this patientService</technical_language>

Target:
public AllergyIntolerance getAllergyById(String uuid) { PatientService patientService = Context.getPatientService(); org.openmrs.Allergy openMRSAllergy = patientService.getAllergyByUuid(uuid); return openMRSAllergy != null ? FHIRAllergyIntoleranceUtil.generateAllergyIntolerance(openMRSAllergy) : null; }
Source:
<code>public void testComplexType() { GuavaOptionalComplexType value = new GuavaOptionalComplexType( Optional.of( new GuavaOptionalComplexType( Optional.absent(), Optional.absent(), Paths.get("/bar"))), Optional.of("baz"), <START> Paths.get("/foo")); <END> assertThat(service.getGuavaComplexType(value), is(value)); }</code><technical_language>this change</technical_language>

Target:
public void testComplexType() { GuavaOptionalComplexType value = new GuavaOptionalComplexType( Optional.of( new GuavaOptionalComplexType( Optional.absent(), Optional.absent(), Paths.get("bar"))), Optional.of("baz"), Paths.get("foo")); assertThat(service.getGuavaComplexType(value), is(value)); }
Source:
<code>public static <R> R doAtomically(String key, Supplier<R> supplier) throws ConcurrentUpdateException { KeyValueStore kvStore = Framework.getService(KeyValueService.class).getKeyValueStore(DOCUMENT_LOCK); try { if (tryLock(key, kvStore)) { try { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); return supplier.get(); } finally { try { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } finally { unlock(key, kvStore); } } } else { throw new ConcurrentUpdateException("Failed to acquire the lock on key " + key); } } catch (InterruptedException e) { throw new NuxeoException(e); <START> } <END> }</code><technical_language>Thread.currentThread().interrupt() throw</technical_language>

Target:
public static <R> R doAtomically(String key, Supplier<R> supplier) throws ConcurrentUpdateException { KeyValueStore kvStore = Framework.getService(KeyValueService.class).getKeyValueStore(DOCUMENT_LOCK); try { if (tryLock(key, kvStore)) { try { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); return supplier.get(); } finally { try { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } finally { unlock(key, kvStore); } } } else { throw new ConcurrentUpdateException("Failed to acquire the lock on key " + key); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new NuxeoException(e); } }
Source:
<code>public boolean isShowSuraTranslatedName() { <START> return prefs.getBoolean(Constants.PREF_SURA_TRANSLATED_NAME, false); <END> }</code><technical_language>default in R.bool.show_sura_names_translation</technical_language>

Target:
public boolean isShowSuraTranslatedName() { return prefs.getBoolean(Constants.PREF_SURA_TRANSLATED_NAME, appContext.getResources().getBoolean(R.bool.show_sura_names_translation)); }
Source:
<code>public ServiceBuilder<GlobalConfiguration> build(ServiceTarget target) { ServiceBuilder<GlobalConfiguration> builder = target.addService(this.getServiceName(), new ValueService<>(this)) .addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ModuleLoader.class, this.loader) ; <START> for (ValueDependency<ThreadPoolConfiguration> poolConfigurationValueDependency : this.pools.values()) { <END> poolConfigurationValueDependency.register(builder); } for (ValueDependency<ThreadPoolConfiguration> threadPoolConfigurationValueDependency : this.schedulers.values()) { threadPoolConfigurationValueDependency.register(builder); } for (ValueDependency<?> dependency : Arrays.asList(this.module, this.transport, this.site, this.server)) { if (dependency != null) { dependency.register(builder); } } return builder; }</code><technical_language>Rename "dependency"</technical_language>

Target:
public ServiceBuilder<GlobalConfiguration> build(ServiceTarget target) { ServiceBuilder<GlobalConfiguration> builder = target.addService(this.getServiceName(), new ValueService<>(this)) .addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ModuleLoader.class, this.loader) ; for (ValueDependency<ThreadPoolConfiguration> dependency : this.pools.values()) { dependency.register(builder); } for (ValueDependency<ThreadPoolConfiguration> dependency : this.schedulers.values()) { dependency.register(builder); } for (ValueDependency<?> dependency : Arrays.asList(this.module, this.transport, this.site, this.server)) { if (dependency != null) { dependency.register(builder); } } return builder; }
Source:
<code>private ICPPEvaluation createOperatorOverloadEvaluation(ICPPFunction overload, IASTNode point, ICPPEvaluation arg) { if(overload instanceof ICPPMethod) { EvalMemberAccess opAccess = new EvalMemberAccess(arg.getType(point), ValueCategory.LVALUE, overload, arg, false, point); ICPPEvaluation[] args = new ICPPEvaluation[]{opAccess}; return new EvalFunctionCall(args, arg, point); } else { ICPPASTName name = new CPPASTName(overload.getNameCharArray()); name.setBinding(overload); IASTIdExpression idExpr = new CPPASTIdExpression(name); <START> ICPPEvaluation op = EvalID.create(idExpr); <END> ICPPEvaluation[] args = new ICPPEvaluation[]{op, arg}; return new EvalFunctionCall(args, null, point); } }</code><technical_language>EvalBinding</technical_language>

Target:
private ICPPEvaluation createOperatorOverloadEvaluation(ICPPFunction overload, IASTNode point, ICPPEvaluation arg) { if(overload instanceof ICPPMethod) { EvalMemberAccess opAccess = new EvalMemberAccess(arg.getType(point), ValueCategory.LVALUE, overload, arg, false, point); ICPPEvaluation[] args = new ICPPEvaluation[]{opAccess}; return new EvalFunctionCall(args, arg, point); } else { EvalBinding op = new EvalBinding(overload, overload.getType(), point); ICPPEvaluation[] args = new ICPPEvaluation[]{op, arg}; return new EvalFunctionCall(args, null, point); } }
Source:
<code>public final void testDiscoverDevicesErrorAddingDeviceToNetwork() throws Exception { XBeeProtocol protocol = XBeeProtocol.ZIGBEE; PowerMockito.when(deviceMock.getXBeeProtocol()).thenReturn(protocol); ATCommandResponsePacket packet = createPacket(1, ATCommandStatus.OK, new XBee16BitAddress("0000"), new XBee64BitAddress("0013A20040A6A0DB"), "Ni string", new XBee16BitAddress("FFFE"), (byte)0x00 , (byte)0x49); ndAnswers.add(packet); DiscoveryListener listener = new DiscoveryListener(); listeners.add(listener); Mockito.when(networkMock.addRemoteDevice(Mockito.any(RemoteXBeeDevice.class))).thenReturn(null); long start = System.currentTimeMillis(); nd.startDiscoveryProcess(listeners); long endBlock = System.currentTimeMillis(); assertThat("The 'discoverDevices' should not block", endBlock - start < TIMEOUT, is(equalTo(true))); assertThat("The 'discoverDevices' should be running", listener.isFinished(), is(equalTo(false))); <START> while(!listener.isFinished()) { <END> Thread.sleep(100); } long end = System.currentTimeMillis(); String error = "Error adding device '0013A20040A6A0DB - Ni string' to the network."; assertThat("The 'discoverDevices' process should finish after " + TIMEOUT + " ms", end - start < TIMEOUT + 150 , is(equalTo(true))); assertThat("The discovered devices list should be empty", listener.getDiscoveredDevices().size(), is(equalTo(0))); assertThat("The discovery error should be " + error, listener.getErrors().get(0), is(equalTo(error))); }</code><technical_language>50ms for sleep: java while (!listener.isFinished()) { Thread.sleep(50); }</technical_language>

Target:
public final void testDiscoverDevicesErrorAddingDeviceToNetwork() throws Exception { XBeeProtocol protocol = XBeeProtocol.ZIGBEE; PowerMockito.when(deviceMock.getXBeeProtocol()).thenReturn(protocol); ATCommandResponsePacket packet = createPacket(1, ATCommandStatus.OK, new XBee16BitAddress("0000"), new XBee64BitAddress("0013A20040A6A0DB"), "Ni string", new XBee16BitAddress("FFFE"), (byte)0x00 , (byte)0x49); ndAnswers.add(packet); DiscoveryListener listener = new DiscoveryListener(); listeners.add(listener); Mockito.when(networkMock.addRemoteDevice(Mockito.any(RemoteXBeeDevice.class))).thenReturn(null); long start = System.currentTimeMillis(); nd.startDiscoveryProcess(listeners); long endBlock = System.currentTimeMillis(); assertThat("The 'discoverDevices' should not block", endBlock - start < TIMEOUT, is(equalTo(true))); assertThat("The 'discoverDevices' should be running", listener.isFinished(), is(equalTo(false))); while(!listener.isFinished()) { Thread.sleep(50); } long end = System.currentTimeMillis(); String error = "Error adding device '0013A20040A6A0DB - Ni string' to the network."; assertThat("The 'discoverDevices' process should finish after " + TIMEOUT + " ms", end - start < TIMEOUT + 150 , is(equalTo(true))); assertThat("The discovered devices list should be empty", listener.getDiscoveredDevices().size(), is(equalTo(0))); assertThat("The discovery error should be " + error, listener.getErrors().get(0), is(equalTo(error))); }
Source:
<code>public void addError(Throwable error) { if (error == null) { throw new NullPointerException("Error cannot be null"); } if (error instanceof AssumptionViolatedException) { AssertionError e = new AssertionError(error.getMessage()); e.initCause(error); <START> error = e; <END> } errors.add(error); }</code><technical_language>Minor thing: generally happy reassigning method parameters</technical_language>

Target:
public void addError(Throwable error) { if (error == null) { throw new NullPointerException("Error cannot be null"); } if (error instanceof AssumptionViolatedException) { AssertionError e = new AssertionError(error.getMessage()); e.initCause(error); errors.add(e); } else { errors.add(error); } }