auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void assertContainsInstallableUnitOperand(String message, List<Operand> operands, InstallableUnitOperand operand) { for (Operand <START> operand2 : <END> operands) { if (!(operand2 instanceof InstallableUnitOperand)) continue; InstallableUnitOperand cmp = (InstallableUnitOperand) operand2; if (cmp.first() != null && cmp.first().equals(operand.first()) && cmp.second() != null && cmp.second().equals(operand.second())) return; } fail(message); }</code><technical_language>rename op</technical_language>

Target:
private void assertContainsInstallableUnitOperand(String message, List<Operand> operands, InstallableUnitOperand operand) { for (Operand op : operands) { if (!(op instanceof InstallableUnitOperand)) continue; InstallableUnitOperand cmp = (InstallableUnitOperand) op; if (cmp.first() != null && cmp.first().equals(operand.first()) && cmp.second() != null && cmp.second().equals(operand.second())) return; } fail(message); }
Source:
<code>protected String cmdString(String... cmds) { if (cmds.length == 0) return ""; else if (cmds.length == 1) return "\"" + escapeJava(cmds[0]) + "\""; else { <START> StringBuffer sb = new StringBuffer(cmdString(cmds[0])); <END> for (int i=1; i<cmds.length; i++) { sb.append(", "); sb.append(cmdString(cmds[i])); } return sb.toString(); } }</code><technical_language>StringBuilder instead</technical_language>

Target:
protected String cmdString(String... cmds) { if (cmds.length == 0) return ""; else if (cmds.length == 1) return "\"" + escapeJava(cmds[0]) + "\""; else { StringBuilder sb = new StringBuilder(cmdString(cmds[0])); for (int i=1; i<cmds.length; i++) { sb.append(", "); sb.append(cmdString(cmds[i])); } return sb.toString(); } }
Source:
<code>private void grow() { <START> data = Arrays.copyOf(data, data.length << 1); <END> }</code><technical_language>I generally issue wit bitshifts useful obfuscates code for people</technical_language>

Target:
private void grow() { Object[] newData = new Object[data.length * 2]; int newStart = newData.length / 4; System.arraycopy(data, start, newData, newStart, size); data = newData; start = newStart; }
Source:
<code>List<String> getSuitablePnpm(String dir) { final List<String> pnpmCommand = getPnpmExecutable(dir, false); if (pnpmCommand.isEmpty()) { return Collections.emptyList(); } try { List<String> versionCmd = new ArrayList<>(pnpmCommand); versionCmd.add("--version"); FrontendVersion pnpmVersion = FrontendUtils.getVersion("pnpm", versionCmd); if (FrontendUtils.isVersionAtLeast(pnpmVersion, SUPPORTED_PNPM_VERSION) && pnpmVersion.isOlderThan(BREAKING_PNPM_VERSION)) { return pnpmCommand; } else { final String pnpmCommandString = String.join(" ", pnpmCommand); getLogger().warn( "installed pnpm ('{}', version {}) is not in the compatible versions range (>={}, <{})", pnpmCommandString, pnpmVersion.getFullVersion(), SUPPORTED_PNPM_VERSION.getFullVersion(), BREAKING_PNPM_VERSION.getFullVersion()); <START> if (FrontendUtils.skippingVersionCheck()) { <END> getLogger().info("using '{}' anyway", pnpmCommandString); return pnpmCommand; } else { getLogger().info("installing pnpm version locally", SUPPORTED_PNPM_VERSION.getFullVersion()); } } } catch (UnknownVersionException e) { getLogger().warn( "Error checking pnpm version, installing pnpm locally", e); } return Collections.emptyList(); }</code><technical_language>issues here: - skip version check is done version check. Version check throw exception skip skip. - FrontendTools created avoid static FrontendUtils.skippingVersionCheck. skip version check flag passed FrontendTools CTOR. FrontendUtils a helper class helper generic methods. else a state of FrontendTools direction FrontendTools</technical_language>

Target:
List<String> getSuitablePnpm(String dir) { List<String> pnpmCommand = getPnpmExecutable(dir, false); String pnpmCommandString = String.join(" ", pnpmCommand); if (!ignoreVersionChecks && !pnpmCommand.isEmpty()) { try { List<String> versionCmd = new ArrayList<>(pnpmCommand); versionCmd.add("--version"); FrontendVersion pnpmVersion = FrontendUtils.getVersion("pnpm", versionCmd); if (!(FrontendUtils.isVersionAtLeast(pnpmVersion, SUPPORTED_PNPM_VERSION) && pnpmVersion.isOlderThan(BREAKING_PNPM_VERSION))) { getLogger().warn( "installed pnpm ('{}', version {}) is not in the compatible versions range (>={}, <{})", pnpmCommandString, pnpmVersion.getFullVersion(), SUPPORTED_PNPM_VERSION.getFullVersion(), BREAKING_PNPM_VERSION.getFullVersion()); pnpmCommand = Collections.emptyList(); } } catch (UnknownVersionException e) { getLogger().warn("error checking pnpm version", e); } } if (!pnpmCommand.isEmpty()) { getLogger().info("using '{}' for frontend package installation", pnpmCommandString); } else { getLogger().info("installing pnpm version locally", SUPPORTED_PNPM_VERSION.getFullVersion()); } return pnpmCommand; }
Source:
<code>private TaskStatus createTaskStatus(TaskHolder taskHolder) { long versionNumber = nextTaskInfoVersion.getAndIncrement(); TaskState state = taskStateMachine.getState(); List<ExecutionFailureInfo> failures = ImmutableList.of(); if (state == TaskState.FAILED) { failures = toFailures(taskStateMachine.getFailureCauses()); } int queuedPartitionedDrivers = 0; int runningPartitionedDrivers = 0; DataSize memoryReservation = new DataSize(0, BYTE); if (taskHolder.getFinalTaskInfo() != null) { TaskStats taskStats = taskHolder.getFinalTaskInfo().getStats(); queuedPartitionedDrivers = taskStats.getQueuedPartitionedDrivers(); runningPartitionedDrivers = taskStats.getRunningPartitionedDrivers(); memoryReservation = taskStats.getMemoryReservation(); } else if (taskHolder.getTaskExecution() != null) { TaskContext taskContext = taskHolder.getTaskExecution().getTaskContext(); <START> queuedPartitionedDrivers = taskContext.getPipelineContexts().stream().mapToInt(context -> context.getPipelineStatus().getQueuedPartitionedDrivers()).sum(); <END> runningPartitionedDrivers = taskContext.getPipelineContexts().stream().mapToInt(context -> context.getPipelineStatus().getRunningPartitionedDrivers()).sum(); memoryReservation = taskContext.getMemoryReservation(); } return new TaskStatus(taskStateMachine.getTaskId(), taskInstanceId, versionNumber, state, location, nodeId, failures, queuedPartitionedDrivers, runningPartitionedDrivers, memoryReservation); }</code><technical_language>do this a traditional for loop do sums time</technical_language>

Target:
private TaskStatus createTaskStatus(TaskHolder taskHolder) { long versionNumber = nextTaskInfoVersion.getAndIncrement(); TaskState state = taskStateMachine.getState(); List<ExecutionFailureInfo> failures = ImmutableList.of(); if (state == TaskState.FAILED) { failures = toFailures(taskStateMachine.getFailureCauses()); } int queuedPartitionedDrivers = 0; int runningPartitionedDrivers = 0; DataSize memoryReservation = new DataSize(0, BYTE); if (taskHolder.getFinalTaskInfo() != null) { TaskStats taskStats = taskHolder.getFinalTaskInfo().getStats(); queuedPartitionedDrivers = taskStats.getQueuedPartitionedDrivers(); runningPartitionedDrivers = taskStats.getRunningPartitionedDrivers(); memoryReservation = taskStats.getMemoryReservation(); } else if (taskHolder.getTaskExecution() != null) { TaskContext taskContext = taskHolder.getTaskExecution().getTaskContext(); for (PipelineContext pipelineContext : taskContext.getPipelineContexts()) { PipelineStatus pipelineStatus = pipelineContext.getPipelineStatus(); queuedPartitionedDrivers += pipelineStatus.getQueuedPartitionedDrivers(); runningPartitionedDrivers += pipelineStatus.getRunningPartitionedDrivers(); } memoryReservation = taskContext.getMemoryReservation(); } return new TaskStatus(taskStateMachine.getTaskId(), taskInstanceId, versionNumber, state, location, nodeId, failures, queuedPartitionedDrivers, runningPartitionedDrivers, memoryReservation); }
Source:
<code>public void testMemoryLeak_with_RestConnections() throws IOException { Config config = new Config(); config.setClusterName(randomName()); config.setProperty(GroupProperty.IO_BALANCER_INTERVAL_SECONDS.getName(), "1"); <START> <END> HazelcastInstance instance = Hazelcast.newHazelcastInstance(config); HTTPCommunicator communicator = new HTTPCommunicator(instance); for (int i = 0; i < 100; i++) { communicator.getClusterInfo(); } final IOBalancer ioBalancer = getIoBalancer(instance); assertTrueEventually(() -> { int inPipelineSize = ioBalancer.getInLoadTracker().getPipelines().size(); int outPipelineSize = ioBalancer.getOutLoadTracker().getPipelines().size(); assertEquals(0, inPipelineSize); assertEquals(0, outPipelineSize); }); }</code><technical_language>rest API config, needs enabled here</technical_language>

Target:
public void testMemoryLeak_with_RestConnections() throws IOException { Config config = new Config(); config.setClusterName(randomName()); config.getNetworkConfig().getRestApiConfig().setEnabled(true); config.setProperty(GroupProperty.IO_BALANCER_INTERVAL_SECONDS.getName(), "1"); HazelcastInstance instance = Hazelcast.newHazelcastInstance(config); HTTPCommunicator communicator = new HTTPCommunicator(instance); for (int i = 0; i < 100; i++) { communicator.getClusterInfo(); } final IOBalancer ioBalancer = getIoBalancer(instance); assertTrueEventually(() -> { int inPipelineSize = ioBalancer.getInLoadTracker().getPipelines().size(); int outPipelineSize = ioBalancer.getOutLoadTracker().getPipelines().size(); assertEquals(0, inPipelineSize); assertEquals(0, outPipelineSize); }); }
Source:
<code>public Set<WorkflowVersion> updateWorkflowPath(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Workflow to modify.", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "Workflow with updated information", required = true) Workflow workflow){ <START> <END> Workflow c = workflowDAO.findById(workflowId); Set<WorkflowVersion> versions = c.getVersions(); for(WorkflowVersion version : versions){ version.setWorkflowPath(workflow.getDefaultWorkflowPath()); } return versions; }</code><technical_language>need add Helper.checkEntry(workflow); Helper.checkUser(user, workflow); ala resource in order people editing entries (and workflow exists)</technical_language>

Target:
public Workflow updateWorkflowPath(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Workflow to modify.", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "Workflow with updated information", required = true) Workflow workflow){ Workflow c = workflowDAO.findById(workflowId); Helper.checkEntry(c); Helper.checkUser(user, c); Set<WorkflowVersion> versions = c.getVersions(); for(WorkflowVersion version : versions){ version.setWorkflowPath(workflow.getDefaultWorkflowPath()); } return c; }
Source:
<code>public int compareTo(HealthReport o) { <START> return (Integer.compare(this.score, o.score)); <END> }</code><technical_language>suggestion return Integer.compare(this.score, o.score);</technical_language>

Target:
public int compareTo(HealthReport o) { return Integer.compare(this.score, o.score); }
Source:
<code>public void updateAllStackConfigsByCrn(String envCrn) { <START> String accountId = Crn.fromString(envCrn).getAccountId(); if (accountId == null) { throw new NotFoundException(String.format("No account id found for crn '%s'", envCrn)); } <END> Environment environment = environmentService .findByResourceCrnAndAccountIdAndArchivedIsFalse(envCrn, accountId). orElseThrow(() -> new NotFoundException( String.format("No environment found with crn '%s'", envCrn))); String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); reactorFlowManager .triggerStackConfigUpdatesFlow(environment, userCrn); }</code><technical_language>I if switch safeFromString method guarantee a valid crn account id Exception thrown</technical_language>

Target:
public void updateAllStackConfigsByCrn(String envCrn) { String accountId = Crn.safeFromString(envCrn).getAccountId(); Environment environment = environmentService .findByResourceCrnAndAccountIdAndArchivedIsFalse(envCrn, accountId). orElseThrow(() -> new NotFoundException( String.format("No environment found with crn '%s'", envCrn))); String userCrn = ThreadBasedUserCrnProvider.getUserCrn(); reactorFlowManager .triggerStackConfigUpdatesFlow(environment, userCrn); }
Source:
<code>public void setServerBootSource(@Nonnull ServerCreateBuilder builder, @Nonnull Openstack os) throws JCloudsCloud.ProvisioningFailedException { final List<String> matchingIds = getDescriptor().findMatchingIds(os, name); final String id = selectIdFromListAndLogProblems(matchingIds, name, "Images"); if (createNewVolume) { final BlockDeviceMappingBuilder volumeBuilder = Builders.blockDeviceMapping() .sourceType(BDMSourceType.IMAGE) .destinationType(BDMDestType.VOLUME) <START> .uuid(id) <END> .volumeSize(volumeSize) .deleteOnTermination(true) .bootIndex(0); builder.blockDevice(volumeBuilder.build()); } else { builder.image(id); } }</code><technical_language>IIUC this takes configured template configuration drive UUID in openstack. need unique, this lead collisions multiple machines booted single template? Also, I do need UUID for this use-case</technical_language>

Target:
public void setServerBootSource(@Nonnull ServerCreateBuilder builder, @Nonnull Openstack os) throws JCloudsCloud.ProvisioningFailedException { final List<String> matchingIds = getDescriptor().findMatchingIds(os, name); final String id = selectIdFromListAndLogProblems(matchingIds, name, "Images"); if (volumeSize != null && volumeSize > 0) { final BlockDeviceMappingBuilder volumeBuilder = Builders.blockDeviceMapping() .sourceType(BDMSourceType.IMAGE) .destinationType(BDMDestType.VOLUME) .uuid(id) .volumeSize(volumeSize) .deleteOnTermination(true) .bootIndex(0); builder.blockDevice(volumeBuilder.build()); } else { builder.image(id); } }
Source:
<code>public void editTargetPassword() throws Exception { final String VALUE = RandomStringUtils.randomAlphanumeric(5); <START> ModelNodeResult defaultValueResult = operations.readAttribute(JMS_BRIDGE_ADDRESS, TARGET_PASSWORD_IDENTIFIER); <END> defaultValueResult.assertSuccess(); ModelNode defaultValue = defaultValueResult.value(); try { new ConfigChecker.Builder(client, JMS_BRIDGE_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, TARGET_PASSWORD_IDENTIFIER, VALUE) .verifyFormSaved() .verifyAttribute(TARGET_PASSWORD_IDENTIFIER, VALUE); } finally { operations.writeAttribute(JMS_BRIDGE_ADDRESS, TARGET_PASSWORD_IDENTIFIER, defaultValue); } }</code><technical_language>backuping value, is good read ignoring defaults => ReadAttributeOption.NOT_INCLUDE_DEFAULTS. => default undefined values :-)</technical_language>

Target:
public void editTargetPassword() throws Exception { final String VALUE = RandomStringUtils.randomAlphanumeric(5); ModelNodeResult origValueResult = operations.readAttribute(JMS_BRIDGE_ADDRESS, TARGET_PASSWORD_IDENTIFIER, ReadAttributeOption.NOT_INCLUDE_DEFAULTS); origValueResult.assertSuccess(); ModelNode origValue = origValueResult.value(); try { new ConfigChecker.Builder(client, JMS_BRIDGE_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, TARGET_PASSWORD_IDENTIFIER, VALUE) .verifyFormSaved() .verifyAttribute(TARGET_PASSWORD_IDENTIFIER, VALUE); } finally { operations.writeAttribute(JMS_BRIDGE_ADDRESS, TARGET_PASSWORD_IDENTIFIER, origValue); } }
Source:
<code>private long checkLatency(int value) { RemoteService service = RemoteService.getRemoteService(); long startTime = System.currentTimeMillis(); <START> long result = service.doRemoteFunction(value); <END> long timeTaken = System.currentTimeMillis() - startTime; LOGGER.info("Time taken (ms): " + timeTaken); return result; }</code><technical_language>written line RemoteService.getRemoteService().doRemoteFunction(value)</technical_language>

Target:
private long checkLatency(int value) { long startTime = System.currentTimeMillis(); long result = RemoteService.getRemoteService().doRemoteFunction(value); long timeTaken = System.currentTimeMillis() - startTime; LOGGER.info("Time taken (ms): " + timeTaken); return result; }
Source:
<code>public PathFinder(final Vector startNode, final Vector endNode) { this.startNode = startNode; this.endNode = endNode; <START> path = new ArrayList<Vector>(); <END> }</code><technical_language>Change this.path = new ArrayList<>();</technical_language>

Target:
public PathFinder(final Vector startNode, final Vector endNode) { this.startNode = startNode; this.endNode = endNode; this.path = new ArrayList<Vector>(); }
Source:
<code>private Collection<AMRMClient.ContainerRequest> getPendingRequestsAndCheckConsistency( Priority priority, Resource resource, int expectedNum) { final List<AMRMClient.ContainerRequest> matchingRequests = resourceManagerClient.getMatchingRequests(priority, ResourceRequest.ANY, resource) .stream() <START> .flatMap(requests -> requests.stream()) <END> .collect(Collectors.toList()); Preconditions.checkState( matchingRequests.size() == expectedNum, "The RMClient's and YarnResourceManagers internal state about the number of pending container requests for priority %s has diverged. " + "Number client's pending container requests %s != Number RM's pending container requests %s.", priority.getPriority(), matchingRequests.size(), expectedNum); return matchingRequests; }</code><technical_language>suggestion .flatMap(Collection::stream)</technical_language>

Target:
private Collection<AMRMClient.ContainerRequest> getPendingRequestsAndCheckConsistency( Priority priority, Resource resource, int expectedNum) { final List<AMRMClient.ContainerRequest> matchingRequests = resourceManagerClient.getMatchingRequests(priority, ResourceRequest.ANY, resource) .stream() .flatMap(Collection::stream) .collect(Collectors.toList()); Preconditions.checkState( matchingRequests.size() == expectedNum, "The RMClient's and YarnResourceManagers internal state about the number of pending container requests for priority %s has diverged. " + "Number client's pending container requests %s != Number RM's pending container requests %s.", priority.getPriority(), matchingRequests.size(), expectedNum); return matchingRequests; }
Source:
<code>public void setUp() { this.checkConfig = createCheckConfig(UnstableAnnotationCheck.class); <START> this.checkConfig.addAttribute("currentVersion", "8.2-SNAPSHOT"); <END> }</code><technical_language>I need change this version Checkstyle version</technical_language>

Target:
public void setUp() { this.checkConfig = createCheckConfig(UnstableAnnotationCheck.class); this.checkConfig.addAttribute("currentVersion", "8.1-SNAPSHOT"); }
Source:
<code>private void initializeInstances(List<InstanceConfig> instanceConfigs) throws Exception { logger.info("Initializing cluster information from {}", dcName); for (InstanceConfig instanceConfig : instanceConfigs) { int schemaVersion = getSchemaVersion(instanceConfig); switch (schemaVersion) { case 0: String instanceName = instanceConfig.getInstanceName(); long instanceXid = getXid(instanceConfig); <START> if (instanceXid <= currentXid) { <END> logger.info("Adding node and its disks and replicas", instanceName); AmbryDataNode datanode = new AmbryDataNode(getDcName(instanceConfig), clusterMapConfig, instanceConfig.getHostName(), Integer.valueOf(instanceConfig.getPort()), getRackId(instanceConfig), getSslPortStr(instanceConfig)); initializeDisksAndReplicasOnNode(datanode, instanceConfig); instanceNameToAmbryDataNode.put(instanceName, datanode); allInstances.add(instanceName); } else { logger.info( "Ignoring instanceConfig for because the xid associated with it ({}) is later than current xid ({})", instanceName, instanceXid, currentXid); } break; default: logger.error("Unknown InstanceConfig schema version: {}, ignoring.", schemaVersion); break; } } logger.info("Initialized cluster information from {}", dcName); }</code><technical_language>able test this method ? for updateStateOfReplicas method</technical_language>

Target:
private void initializeInstances(List<InstanceConfig> instanceConfigs) throws Exception { logger.info("Initializing cluster information from {}", dcName); for (InstanceConfig instanceConfig : instanceConfigs) { int schemaVersion = getSchemaVersion(instanceConfig); switch (schemaVersion) { case 0: String instanceName = instanceConfig.getInstanceName(); long instanceXid = getXid(instanceConfig); if (instanceXid <= currentXid) { logger.info("Adding node and its disks and replicas", instanceName); AmbryDataNode datanode = new AmbryDataNode(getDcName(instanceConfig), clusterMapConfig, instanceConfig.getHostName(), Integer.valueOf(instanceConfig.getPort()), getRackId(instanceConfig), getSslPortStr(instanceConfig)); initializeDisksAndReplicasOnNode(datanode, instanceConfig); instanceNameToAmbryDataNode.put(instanceName, datanode); allInstances.add(instanceName); } else { logger.info( "Ignoring instanceConfig for because the xid associated with it ({}) is later than current xid ({})", instanceName, instanceXid, currentXid); helixClusterManagerMetrics.ignoredUpdatesCount.inc(); } break; default: logger.error("Unknown InstanceConfig schema version: {}, ignoring.", schemaVersion); break; } } logger.info("Initialized cluster information from {}", dcName); }
Source:
<code>public static long readNumberFromFile(final Path filePath) throws IOException, NumberFormatException { <START> try (BufferedReader reader = Files <END> .newBufferedReader(filePath, StandardCharsets.UTF_8)) { final long num = Long.parseLong(reader.readLine()); return num; } catch (final IOException | NumberFormatException e) { logger.error(String.format("Failed to read the number from the file %s", filePath), e); throw e; } }</code><technical_language>considered <LINK_0>,%20java.nio.charset.Charset)</technical_language>

Target:
public static long readNumberFromFile(final Path filePath) throws IOException, NumberFormatException { final List<String> allLines = Files.readAllLines(filePath); if (!allLines.isEmpty()) { return Long.parseLong(allLines.get(0)); } else { throw new NumberFormatException("unable to parse empty file " + filePath.toString()); } }
Source:
<code>public void paintControl(@Nullable PaintEvent e) { if (e == null || !isSelected()) { return; } Iterator<Color> colorsIt = Iterators.cycle(COLORS); GC gc = e.gc; for (ISeries series : getChart().getSeriesSet().getSeries()) { Color color = colorsIt.next(); for (int index : getSelection()) { int graphIndex = getGraphIndexFromTableEntryIndex(series, index); if (graphIndex < 0) { continue; } <START> Rectangle rectangle = ((IBarSeries) series).getBounds()[graphIndex]; <END> gc.setBackground(color); gc.fillRectangle(rectangle); } } }</code><technical_language>I ArrayIndexOutOfBoundsException here. I reproduced: I/O operations log + scatter chart: call duration vs. read/write size bytes + bar chart: (call duration & system call out of range?) vs. process name click a point in scatter chart. I patch 72101/2 checked out</technical_language>

Target:
public void paintControl(@Nullable PaintEvent e) { if (e == null || !isSelected()) { return; } Iterator<Color> colorsIt = Iterators.cycle(COLORS); GC gc = e.gc; for (ISeries series : getChart().getSeriesSet().getSeries()) { Color color = colorsIt.next(); for (int index : getSelection()) { int graphIndex = getGraphIndexFromTableEntryIndex(series, index); if (graphIndex < 0) { continue; } Rectangle[] bounds = ((IBarSeries) series).getBounds(); if (bounds.length != fCategories.length) { continue; } Rectangle rectangle = bounds[graphIndex]; gc.setBackground(color); gc.fillRectangle(rectangle); } } }
Source:
<code>public ReadOnlyByteBuf(ByteBuf buffer) { <START> super(buffer.capacity()); END> if (buffer instanceof ReadOnlyByteBuf || buffer instanceof DuplicatedByteBuf) { this.buffer = buffer.unwrap(); } else { this.buffer = buffer; } setIndex(buffer.readerIndex(), buffer.writerIndex()); }</code><technical_language>a read-only view of existing buffer, some users expect able read initial capacity if source buffer's capacity increases this created. This buffer end in a kind of weird state buf.capacity() > buf.maxCapacity()..</technical_language>

Target:
public ReadOnlyByteBuf(ByteBuf buffer) { super(buffer.maxCapacity()); if (buffer instanceof ReadOnlyByteBuf || buffer instanceof DuplicatedByteBuf) { this.buffer = buffer.unwrap(); } else { this.buffer = buffer; } setIndex(buffer.readerIndex(), buffer.writerIndex()); }
Source:
<code>void reset() { chunkOperationTracker = null; chunkCompleted = false; retainChunkExceptionOnSuccess = false; chunkBlobId = null; chunkIndex = -1; chunkException = null; successfullyDeserialized = false; blobContentAvailableToProcess = false; <START> decryptCallbackResultInfo = new AtomicReference<>(); <END> decryptCallbackResultInfo.set(new DecryptCallBackResultInfo()); correlationIdToGetRequestInfo.clear(); state = ChunkState.Free; }</code><technical_language>change for DecryptCallbackResultInfo in GetBlobInfoOperation</technical_language>

Target:
void reset() { chunkOperationTracker = null; chunkCompleted = false; retainChunkExceptionOnSuccess = false; chunkBlobId = null; chunkIndex = -1; chunkException = null; successfullyDeserialized = false; progressTracker = null; decryptCallbackResultInfo = null; correlationIdToGetRequestInfo.clear(); state = ChunkState.Free; }
Source:
<code><START> private boolean publishMessageUnbound(DataMessage message) throws KuraException { <END> publishInternal(message); DataServiceImpl.this.dataServiceListeners.onMessagePublished(message.getId(), message.getTopic()); return true; }</code><technical_language>return void</technical_language>

Target:
private void publishMessageUnbound(DataMessage message) throws KuraException { publishInternal(message); DataServiceImpl.this.dataServiceListeners.onMessagePublished(message.getId(), message.getTopic()); }
Source:
<code>public static Collection<BaseKey> getAllRegisteredKeys() { <START> return registeredKeys.values(); <END> }</code><technical_language>in case, please wrap Collections.unmodifiableCollection()</technical_language>

Target:
public static Collection<BaseKey> getAllRegisteredKeys() { return Collections.unmodifiableCollection(registeredKeys.values()); }
Source:
<code>public void openFile(File file) throws CheckstyleException { if (file != null) { try { currentFile = file; title = "Checkstyle GUI : " + file.getName(); reloadActionEnabled = true; final DetailAST parseTree; <START> if (parseMode.equals(ParseMode.PLAIN_JAVA)) { <END> parseTree = parseFile(file); } else { parseTree = parseFileWithComments(file); } parseTreeTableModel.setParseTree(parseTree); parseTreeTableModel.setParseMode(parseMode); final String[] sourceLines = getFileText(file).toLinesArray(); linesToPosition.clear(); linesToPosition.add(0); final StringBuilder sb = new StringBuilder(); for (final String element : sourceLines) { linesToPosition.add(sb.length()); sb.append(element).append(System.lineSeparator()); } text = sb.toString(); } catch (IOException | ANTLRException ex) { final String exceptionMsg = String.format(Locale.ROOT, "%s occurred while opening file %s.", ex.getClass().getSimpleName(), file.getPath()); throw new CheckstyleException(exceptionMsg, ex); } } }</code><technical_language>enumerations need equals method, == operator</technical_language>

Target:
public void openFile(File file) throws CheckstyleException { if (file != null) { try { currentFile = file; title = "Checkstyle GUI : " + file.getName(); reloadActionEnabled = true; final DetailAST parseTree; switch (parseMode) { case PLAIN_JAVA: parseTree = parseFile(file); break; case JAVA_WITH_COMMENTS: case JAVA_WITH_JAVADOC_AND_COMMENTS: parseTree = parseFileWithComments(file); break; default: throw new IllegalArgumentException("Unknown mode: " + parseMode); } parseTreeTableModel.setParseTree(parseTree); parseTreeTableModel.setParseMode(parseMode); final String[] sourceLines = getFileText(file).toLinesArray(); linesToPosition.clear(); linesToPosition.add(0); final StringBuilder sb = new StringBuilder(); for (final String element : sourceLines) { linesToPosition.add(sb.length()); sb.append(element).append(System.lineSeparator()); } text = sb.toString(); } catch (IOException | ANTLRException ex) { final String exceptionMsg = String.format(Locale.ROOT, "%s occurred while opening file %s.", ex.getClass().getSimpleName(), file.getPath()); throw new CheckstyleException(exceptionMsg, ex); } } }
Source:
<code>@Test public void overloads() throws Exception { <START> PrintWriter receiver = new PrintWriter(ByteStreams.nullOutputStream()); <END> assertEquals(PrintWriter.class.getMethod("print", Object.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {new Object()})); assertEquals(PrintWriter.class.getMethod("print", String.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {"message"})); assertEquals(PrintWriter.class.getMethod("print", int.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {42})); }</code><technical_language>Related somehow</technical_language>

Target:
@Test public void overloads() throws Exception { PrintWriter receiver = new PrintWriter(new NullOutputStream()); assertEquals(PrintWriter.class.getMethod("print", Object.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {new Object()})); assertEquals(PrintWriter.class.getMethod("print", String.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {"message"})); assertEquals(PrintWriter.class.getMethod("print", int.class), GroovyCallSiteSelector.method(receiver, "print", new Object[] {42})); }
Source:
<code>private void handleNewDatastream() { leaderDoAssignmentScheduled.set(false); List<Datastream> newDatastreams = _adapter.getAllDatastreams(); if (newDatastreams.size() == 0) { return; } try { _destinationManager.populateDatastreamDestination(newDatastreams); <START> newDatastreams = newDatastreams.stream().filter( <END> ds -> ds.getDestination() != null).collect(Collectors.toList()); if (newDatastreams.size() == 0) { return; } newDatastreams.stream().forEach(ds -> { if (!_adapter.updateDatastream(ds)) { LOG.error(String.format("Failed to update datastream destination for datastream %s, " + "This datastream will not be scheduled for producing events ", ds.getName())); } }); _eventQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent()); } catch (Exception e) { LOG.error("Failed to update the destination of new datastreams.", e); if (leaderDoAssignmentScheduled.compareAndSet(false, true)) { LOG.warn("Schedule retry for handling new datastream"); _executor.schedule(() -> _eventQueue.put(CoordinatorEvent.createHandleNewDatastreamEvent()), _config.getRetryIntervalMS(), TimeUnit.MILLISECONDS); } } }</code><technical_language>datastreams dont a valid destination? log error</technical_language>

Target:
private void handleNewDatastream() { leaderDoAssignmentScheduled.set(false); List<Datastream> newDatastreams = _adapter.getAllDatastreams(); if (newDatastreams.size() == 0) { return; } try { _destinationManager.populateDatastreamDestination(newDatastreams); for (Datastream stream: newDatastreams) { if (stream.hasDestination() && !_adapter.updateDatastream(stream)) { LOG.error(String.format("Failed to update datastream destination for datastream %s, " + "This datastream will not be scheduled for producing events ", stream.getName())); } } _eventQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent()); } catch (Exception e) { LOG.error("Failed to update the destination of new datastreams.", e); if (leaderDoAssignmentScheduled.compareAndSet(false, true)) { LOG.warn("Schedule retry for handling new datastream"); _executor.schedule(() -> _eventQueue.put(CoordinatorEvent.createHandleNewDatastreamEvent()), _config.getRetryIntervalMS(), TimeUnit.MILLISECONDS); } } }
Source:
<code>public static Nucleotide inferAltFromPileup(final Map<Nucleotide, List<BaseQuality>> baseQualities, final Nucleotide refBase) { <START> Nucleotide[] bases = BASES; <END> Arrays.sort(bases, (L, R) -> Integer.compare(baseQualities.get(R).size(), baseQualities.get(L).size())); for (Nucleotide base : bases) { if (base != refBase) { return base; } } throw new GATKException.ShouldNeverReachHereException("The Alt base can not be inferred from the " + "pileup. The size of the pileup is: " + baseQualities.size()); }</code><technical_language>I single-thread, a matter of principle modify order of array is declared a constant: final Nucleotide[] bases = BASE.clone()</technical_language>

Target:
static Nucleotide inferAltFromPileup(final Map<Nucleotide, List<BaseQuality>> baseQualities, final Nucleotide refBase) { final Nucleotide[] bases = BASES.clone(); Arrays.sort(bases, (L, R) -> Integer.compare(baseQualities.get(R).size(), baseQualities.get(L).size())); for (Nucleotide base : bases) { if (base != refBase) { return base; } } throw new GATKException.ShouldNeverReachHereException("The Alt base can not be inferred from the " + "pileup. The size of the pileup is: " + baseQualities.size()); }
Source:
<code>public List<Installment> calculateInstallments(int amount, int freeInstallments, double interestRate, int maxInstallments) throws PagarMeException { final PagarMeRequest request = new PagarMeRequest(HttpMethod.GET, "/transactions/calculate_installments_amount"); Map<String, Object> params = new HashMap<String, Object>(); params.put("amount", amount); params.put("max_installments", maxInstallments); params.put("free_installments", freeInstallments); params.put("interest_rate", interestRate); request.setParameters(params); JsonObject response = request.execute(); JsonObject installmentsArray = response.getAsJsonObject("installments"); List<Installment> installments = new ArrayList<Installment>(); for (int i = 1; i <= maxInstallments; i++) { Installment objInstallment = new Installment(); <START> JsonObject installment = installmentsArray.getAsJsonObject(""+i); <END> objInstallment.setInstallment_amount(Integer.parseInt(installment.get("installment_amount").toString())); objInstallment.setAmount(Integer.parseInt(installment.get("amount").toString())); objInstallment.setInstallment(Integer.parseInt(installment.get("installment").toString())); installments.add(objInstallment); } return installments; }</code><technical_language>Is ""+i a conversion int String</technical_language>

Target:
public List<Installment> calculateInstallments(int amount, int freeInstallments, double interestRate, int maxInstallments) throws PagarMeException { final PagarMeRequest request = new PagarMeRequest(HttpMethod.GET, "/transactions/calculate_installments_amount"); Map<String, Object> params = new HashMap<String, Object>(); params.put("amount", amount); params.put("max_installments", maxInstallments); params.put("free_installments", freeInstallments); params.put("interest_rate", interestRate); request.setParameters(params); JsonObject response = request.execute(); JsonObject installmentsArray = response.getAsJsonObject("installments"); List<Installment> installments = new ArrayList<Installment>(); for (int i = 1; i <= maxInstallments; i++) { Installment objInstallment = new Installment(); JsonObject installment = installmentsArray.getAsJsonObject(""+i); objInstallment.setInstallmentAmount(Integer.parseInt(installment.get("installment_amount").toString())); objInstallment.setAmount(Integer.parseInt(installment.get("amount").toString())); objInstallment.setInstallment(Integer.parseInt(installment.get("installment").toString())); installments.add(objInstallment); } return installments; }
Source:
<code>private LinkdHopCriteria(String nodeId, String nodeLabel) { super(nodeLabel); <START> setId(nodeId); <END> m_nodeId = nodeId; }</code><technical_language>super constructor? super(nodeId, nodeLabel)</technical_language>

Target:
private LinkdHopCriteria(String nodeId, String nodeLabel) { super(nodeId,nodeLabel); m_nodeId = nodeId; }
Source:
<code>private static void initClusterSeverities() { severities.put(AuditLogType.USER_ADD_VDS_GROUP, AuditLogSeverity.NORMAL); severities.put(AuditLogType.USER_ADD_VDS_GROUP_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.USER_UPDATE_VDS_GROUP, AuditLogSeverity.NORMAL); severities.put(AuditLogType.USER_UPDATE_VDS_GROUP_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.USER_REMOVE_VDS_GROUP, AuditLogSeverity.NORMAL); severities.put(AuditLogType.USER_REMOVE_VDS_GROUP_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.SYSTEM_UPDATE_VDS_GROUP, AuditLogSeverity.NORMAL); severities.put(AuditLogType.SYSTEM_UPDATE_VDS_GROUP_FAILED, AuditLogSeverity.NORMAL); severities.put(AuditLogType.USER_UPDATE_VM_CLUSTER_DEFAULT_HOST_CLEARED, AuditLogSeverity.NORMAL); severities.put(AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FROM_TRUSTED_TO_UNTRUSTED, AuditLogSeverity.NORMAL); severities.put(AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FROM_UNTRUSTED_TO_TRUSTED, AuditLogSeverity.NORMAL); severities.put(AuditLogType.IMPORTEXPORT_IMPORT_VM_FROM_TRUSTED_TO_UNTRUSTED, AuditLogSeverity.NORMAL); <START> severities.put(AuditLogType.IMPORTEXPORT_IMPORT_VM_FROM_UNTRUSTED_TO_TRUSTED, AuditLogSeverity.NORMAL); <END> }</code><technical_language>please change "WARNING" instead of "NORMAL"</technical_language>

Target:
private static void initClusterSeverities() { severities.put(AuditLogType.USER_ADD_VDS_GROUP, AuditLogSeverity.NORMAL); severities.put(AuditLogType.USER_ADD_VDS_GROUP_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.USER_UPDATE_VDS_GROUP, AuditLogSeverity.NORMAL); severities.put(AuditLogType.USER_UPDATE_VDS_GROUP_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.USER_REMOVE_VDS_GROUP, AuditLogSeverity.NORMAL); severities.put(AuditLogType.USER_REMOVE_VDS_GROUP_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.SYSTEM_UPDATE_VDS_GROUP, AuditLogSeverity.NORMAL); severities.put(AuditLogType.SYSTEM_UPDATE_VDS_GROUP_FAILED, AuditLogSeverity.NORMAL); severities.put(AuditLogType.USER_UPDATE_VM_CLUSTER_DEFAULT_HOST_CLEARED, AuditLogSeverity.NORMAL); severities.put(AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FROM_TRUSTED_TO_UNTRUSTED, AuditLogSeverity.NORMAL); severities.put(AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_FROM_UNTRUSTED_TO_TRUSTED, AuditLogSeverity.NORMAL); severities.put(AuditLogType.IMPORTEXPORT_IMPORT_VM_FROM_TRUSTED_TO_UNTRUSTED, AuditLogSeverity.WARNING); severities.put(AuditLogType.IMPORTEXPORT_IMPORT_VM_FROM_UNTRUSTED_TO_TRUSTED, AuditLogSeverity.WARNING); }
Source:
<code>public Info(boolean maturity, boolean eom, Frequency frequency, LocalDate periodEnd, SchedulePeriodType type) { <START> super(); <END> this.maturity = maturity; this.eom = eom; this.frequency = frequency; this.periodEnd = periodEnd; this.type = type; }</code><technical_language>redundant super call</technical_language>

Target:
public Info(boolean maturity, boolean eom, Frequency frequency, LocalDate periodEnd, SchedulePeriodType type) { this.maturity = maturity; this.eom = eom; this.frequency = frequency; this.periodEnd = periodEnd; this.type = type; }
Source:
<code>public static void updateAutoTuningParameters(Props props) { int count = 0; boolean noException = false; Map<String, String> params = null; <START> if(props.containsKey(TuningCommonConstants.TUNING_API_END_POINT)==false) <END> { log.error("Tuning API End Point not found in properties. Not applying auto tuning. "); return; } int retryCount = DEFAULT_TUNING_API_RETRY_COUNT; if (props.containsKey(TUNING_API_RETRY_COUNT)) { retryCount = props.getInt(TUNING_API_RETRY_COUNT); } while (!noException && count < retryCount) { try { count++; log.info("Calling get current run parameters. Try count " + count); params = getCurrentRunParameters(props); log.info("Parameters are " + params.toString()); noException = true; } catch (IOException e) { log.error("Error in getting current run parameter ", e); } catch (Exception e) { log.error("Error in getting current run parameter ", e); } } if (params != null) { for (Map.Entry<String, String> param : params.entrySet()) { props.put(HadoopConfigurationInjector.INJECT_PREFIX + param.getKey(), param.getValue()); log.info("Applied parameter " + param.getKey() + " with value " + param.getValue()); } props.put(HadoopConfigurationInjector.INJECT_PREFIX + "auto.tuning.enabled", "true"); } }</code><technical_language>==false. style of if-statement</technical_language>

Target:
public void updateAutoTuningParameters(Props props) { int retryCount = 0; Map<String, String> params = null; if (!props.containsKey(TuningCommonConstants.TUNING_API_END_POINT)) { log.error("Tuning API End Point not found in properties. Not applying auto tuning. "); return; } int maxRetryCount = DEFAULT_TUNING_API_RETRY_COUNT; if (props.containsKey(TUNING_API_RETRY_COUNT)) { maxRetryCount = props.getInt(TUNING_API_RETRY_COUNT); } while (retryCount < maxRetryCount) { try { retryCount++; log.info("Calling get current run parameters. Try count " + retryCount); params = getCurrentRunParameters(props); break; } catch (Exception e) { log.error("Error in getting current run parameter ", e); } } if (params != null) { for (Map.Entry<String, String> param : params.entrySet()) { props.put(HadoopConfigurationInjector.INJECT_PREFIX + param.getKey(), param.getValue()); log.info("Applied parameter " + param.getKey() + " with value " + param.getValue()); } props.put(HadoopConfigurationInjector.INJECT_PREFIX + TuningCommonConstants.AUTO_TUNING_ENABLED, "true"); } }
Source:
<code>protected void handleAttemptLockout(long elapsedRealtimeDeadline) { setPasswordEntryEnabled(false); long elapsedRealtime = SystemClock.elapsedRealtime(); new CountDownTimer(elapsedRealtimeDeadline - elapsedRealtime, <START> 200) { <END> @Override public void onTick(long millisUntilFinished) { int secondsRemaining = (int) Math.ceil(millisUntilFinished / 1000.0); mSecurityMessageDisplay.setMessage( R.string.kg_too_many_failed_attempts_countdown, true, secondsRemaining); } @Override public void onFinish() { mSecurityMessageDisplay.setMessage("", false); resetState(true); } }.start(); }</code><technical_language>this hacky - is this needed? in worst case, a delay of 1.2 seconds ticks. do this in a more exact way</technical_language>

Target:
protected void handleAttemptLockout(long elapsedRealtimeDeadline) { setPasswordEntryEnabled(false); long elapsedRealtime = SystemClock.elapsedRealtime(); long millisInFuture = ((long) Math.ceil( (elapsedRealtimeDeadline - elapsedRealtime) / 1000.0) + 2) * 1000; new CountDownTimer(millisInFuture, 1000) { @Override public void onTick(long millisUntilFinished) { int secondsRemaining = (int) Math.round(millisUntilFinished / 1000.0) - 2; if (secondsRemaining > 0) { mSecurityMessageDisplay.setMessage( R.string.kg_too_many_failed_attempts_countdown, true, secondsRemaining); } else { mSecurityMessageDisplay.setMessage("", false); resetState(true ); cancel(); } } @Override public void onFinish() { } }.start(); }
Source:
<code>public void setSparkObject(Object sparkObject) throws StandardException { <START> value = sparkObject; <END> }</code><technical_language>sparkObject a byte[], setSparkObject call deserialize here, code added in getLength()</technical_language>

Target:
public void setSparkObject(Object sparkObject) throws StandardException { if (sparkObject instanceof byte[]) { value = SerializationUtils.deserialize((byte[]) sparkObject); } else { value = sparkObject; } }
Source:
<code>public Control createContents(Composite parent) { <START> if(mappingsViewer.mappings == <END> null) { setErrorMessage("Can not read pom.xml"); return parent; } mappingsViewer.setShell(parent.getShell()); return mappingsViewer.createContents(parent); }</code><technical_language>Please create a method test for error condition. isValid() maybe</technical_language>

Target:
public Control createContents(Composite parent) { if(!mappingsViewer.isValid()) { setErrorMessage(Messages.LifecycleMappingPropertyPage_invalidPom); return parent; } mappingsViewer.setShell(parent.getShell()); return mappingsViewer.createContents(parent); }
Source:
<code>private void parseReportsXML() { try { constructServiceRequestBuilder(ReportXmlService).sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { <START> if (!reportBaseUrl.trim().isEmpty() && !scheduledStatusCheckInProgress && !reportsWebappDeployed) { <END> scheduleCheckStatus(); } setXmlInitialized(); } @Override public void onResponseReceived(Request request, Response response) { switch (response.getStatusCode()) { case Response.SC_NOT_FOUND: if (!reportBaseUrl.trim().isEmpty() && !scheduledStatusCheckInProgress && !reportsWebappDeployed) { scheduleCheckStatus(); } setXmlInitialized(); break; case Response.SC_OK: try { if (ReportParser.getInstance().parseReport(response.getText())) { resourceMap = ReportParser.getInstance().getResourceMap(); dashboardMap = ReportParser.getInstance().getDashboardMap(); isCommunityEdition = ReportParser.getInstance().isCommunityEdition(); } } catch (DOMParseException e) { } finally { setXmlInitialized(); } break; } } }); } catch (RequestException e) { setXmlInitialized(); } }</code><technical_language>'if (!reportBaseUrl.trim().isEmpty())' is needed anymore- is part of init</technical_language>

Target:
private void parseReportsXML() { try { constructServiceRequestBuilder(ReportXmlService).sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { scheduleCheckStatus(); setXmlInitialized(); } @Override public void onResponseReceived(Request request, Response response) { switch (response.getStatusCode()) { case Response.SC_NOT_FOUND: scheduleCheckStatus(); setXmlInitialized(); break; case Response.SC_OK: try { if (ReportParser.getInstance().parseReport(response.getText())) { resourceMap = ReportParser.getInstance().getResourceMap(); dashboardMap = ReportParser.getInstance().getDashboardMap(); isCommunityEdition = ReportParser.getInstance().isCommunityEdition(); } } catch (DOMParseException e) { } finally { setXmlInitialized(); } break; } } }); } catch (RequestException e) { setXmlInitialized(); } }
Source:
<code>public void handle() { final TaskDetails details = running.get(task.getId()); if (details == null) { <START> log.warn("Got status notice for task [%s] that isn't running...", task.getId()); <END> return; } if (!status.isComplete()) { log.warn( "Got status notice for task [%s] that isn't complete (status = [%s])...", task.getId(), status.getStatusCode() ); return; } details.status = status.withDuration(System.currentTimeMillis() - details.startTime); try { workerCuratorCoordinator.updateAnnouncement( TaskAnnouncement.create( details.task, details.status, details.location ) ); log.info( "Job's finished. Completed [%s] with status [%s]", task.getId(), status.getStatusCode() ); } catch (Exception e) { log.makeAlert(e, "Failed to update task announcement") .addData("task", task.getId()) .emit(); } finally { running.remove(task.getId()); } }</code><technical_language>notification? i more clear is happening notice</technical_language>

Target:
public void handle() { final TaskDetails details = running.get(task.getId()); if (details == null) { log.warn("Got status notice for task [%s] that isn't running...", task.getId()); return; } if (!status.isComplete()) { log.warn( "WTF?! Got status notice for task [%s] that isn't complete (status = [%s])...", task.getId(), status.getStatusCode() ); return; } details.status = status.withDuration(System.currentTimeMillis() - details.startTime); try { workerCuratorCoordinator.updateTaskStatusAnnouncement( TaskAnnouncement.create( details.task, details.status, details.location ) ); log.info( "Job's finished. Completed [%s] with status [%s]", task.getId(), status.getStatusCode() ); } catch (Exception e) { log.makeAlert(e, "Failed to update task announcement") .addData("task", task.getId()) .emit(); } finally { running.remove(task.getId()); } }
Source:
<code>public void update(Object obj) { try { execute(session -> { session.update(obj); return null; }); } catch (OptimisticLockException ex) { throw new ConcurrentModificationException("Row has the wrong version number; it may have " + "been saved in the background."); } catch (PersistenceException ex) { if (ex.getCause() instanceof ConstraintViolationException) { <START> throw new ConcurrentModificationException(ex.getMessage()); <END> } else { throw ex; } } }</code><technical_language>error message this be? add error message easier read in logs</technical_language>

Target:
public void update(Object obj) { try { execute(session -> { session.update(obj); return null; }); } catch (OptimisticLockException ex) { throw new ConcurrentModificationException("Row has the wrong version number; it may have " + "been saved in the background."); } catch (PersistenceException ex) { if (ex.getCause() instanceof org.hibernate.exception.ConstraintViolationException) { throw new ConstraintViolationException.Builder() .withMessage("Email or phone number conflicts with an existing account.").build(); } else { throw ex; } } }