auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static String loadVersion() { <START> InputStream in = Version.class.getResourceAsStream("/gerrit-common/Version"); <END> if (in == null) { return null; } try { BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8")); try { String vs = r.readLine(); if (vs != null && vs.startsWith("v")) { vs = vs.substring(1); } if (vs != null && vs.isEmpty()) { vs = null; } return vs; } finally { r.close(); } } catch (IOException e) { return null; } }</code><technical_language>This is a bug in build system, code</technical_language>

Target:
private static String loadVersion() { InputStream in = Version.class.getResourceAsStream("Version"); if (in == null) { return null; } try { BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8")); try { String vs = r.readLine(); if (vs != null && vs.startsWith("v")) { vs = vs.substring(1); } if (vs != null && vs.isEmpty()) { vs = null; } return vs; } finally { r.close(); } } catch (IOException e) { return null; } }
Source:
<code><START> public void testApplicationBinding_withPrevious_noImportAdded() throws IllegalAccessException, InterruptedException { <END> AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getTomcatVm(); MsgCmdChangeBinding msg = new MsgCmdChangeBinding( "ext", new HashSet<>( Arrays.asList( "demo1" ))); processor.processMessage( msg ); Assert.assertEquals( 1, processor.applicationBindings.size()); Assert.assertEquals( 0, processor.applicationNameToExternalExports.size()); msg = new MsgCmdChangeBinding( "ext", new HashSet<>( Arrays.asList( "demo2" ))); processor.processMessage( msg ); Assert.assertEquals( 1, processor.applicationBindings.size()); Assert.assertEquals( 1, processor.applicationBindings.get( "ext" ).size()); Assert.assertTrue( processor.applicationBindings.get( "ext" ).contains( "demo2" )); Assert.assertEquals( 0, processor.applicationNameToExternalExports.size()); }</code><technical_language>No, this method throw interrupted exceptions</technical_language>

Target:
public void testApplicationBinding_withPrevious_noImportAdded() throws IllegalAccessException { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getTomcatVm(); MsgCmdChangeBinding msg = new MsgCmdChangeBinding( "ext", new HashSet<>( Arrays.asList( "demo1" ))); processor.processMessage( msg ); Assert.assertEquals( 1, processor.applicationBindings.size()); Assert.assertEquals( 0, processor.applicationNameToExternalExports.size()); msg = new MsgCmdChangeBinding( "ext", new HashSet<>( Arrays.asList( "demo2" ))); processor.processMessage( msg ); Assert.assertEquals( 1, processor.applicationBindings.size()); Assert.assertEquals( 1, processor.applicationBindings.get( "ext" ).size()); Assert.assertTrue( processor.applicationBindings.get( "ext" ).contains( "demo2" )); Assert.assertEquals( 0, processor.applicationNameToExternalExports.size()); }
Source:
<code>private void testAreas(TreeNode rootNode) { Rectangle2D rootBounds = rootNode.getBounds(); if (rootNode instanceof InnerNode) { InnerNode innerNode = (InnerNode) rootNode; double[] rootDimensions = new double[] { rootBounds.getX(), rootBounds.getY(), rootBounds.getWidth(), rootBounds.getHeight() }; Rectangle2D union = Node.union(innerNode.getChildren()); double[] unionDimensions = new double[] {union.getX(), union.getY(), union.getWidth(), union.getHeight()}; assertWithMessage( "The compared bounds are not close enough: rootBounds: %s, unionBounds: %s", rootBounds, union) .that(rootDimensions) .usingTolerance(1.0E-4) .equals(unionDimensions); } <START> for (TreeNode rt : rootNode.getChildren()) { <END> testAreas(rt); } }</code><technical_language>clear if worth creating a custom Subject for java.awt.Shape this stage, I agree. :)</technical_language>

Target:
private void testAreas(TreeNode rootNode) { Rectangle2D rootBounds = rootNode.getBounds(); if (rootNode instanceof InnerNode) { InnerNode innerNode = (InnerNode) rootNode; Rectangle2D unionBounds = Node.union(innerNode.getChildren()); assertThat(rootBounds.getMinX()).isWithin(1.0E-3).of(unionBounds.getMinX()); assertThat(rootBounds.getMinY()).isWithin(1.0E-3).of(unionBounds.getMinY()); assertThat(rootBounds.getMaxX()).isWithin(1.0E-3).of(unionBounds.getMaxX()); assertThat(rootBounds.getMaxY()).isWithin(1.0E-3).of(unionBounds.getMaxY()); } for (TreeNode rt : rootNode.getChildren()) { testAreas(rt); } }
Source:
<code>private boolean isNotAllowed(String parameterString) { <START> return (allowedValues.contains(parameterString)); <END> }</code><technical_language>Do want ignore case hear also? store values constructor in case convert parameterString case contains work</technical_language>

Target:
private boolean isNotAllowed(String parameterString) { return !(ALLOWED_VALUES.contains(parameterString.toUpperCase())); }
Source:
<code>public float getBlockLiquidHeight(World world, BlockPos pos, IBlockState state, Material material) { <START> return getFilledPercentage(world, pos); <END> }</code><technical_language>planning do for negative-density fluids? Specifically: <LINK_0></technical_language>

Target:
public float getBlockLiquidHeight(World world, BlockPos pos, IBlockState state, Material material) { float filled = getFilledPercentage(world, pos); return Math.max(filled, 0); }
Source:
<code>public boolean hasEditedBySection() { try { return post.findElement(By.cssSelector(".post-edited-by-row")) .getAttribute(CLASS_ATTRIBUTE) .contains(POST_EDITED_BY_CLASS_NAME); <START> } catch (NoSuchElementException e) { <END> return false; } }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') log rethrow this exception. [![rule](<LINK_1>](http://sonar-s4/coding_rules#rule_key=squid%3AS1166)</technical_language>

Target:
public boolean hasEditedBySection() { try { return post.findElement(By.cssSelector(".post-edited-by-row")) .getAttribute(CLASS_ATTRIBUTE) .contains(POST_EDITED_BY_CLASS_NAME); } catch (NoSuchElementException e) { PageObjectLogging.log("Element not found", "Edited by section not found", true); return false; } }
Source:
<code>public static void waitUntil(IWaitCondition condition, long maxWait) { long waitStart = System.currentTimeMillis(); Display display = Display.getCurrent(); try { while (!condition.test()) { if (System.currentTimeMillis() - waitStart > maxWait) { throw new WaitTimeoutException(condition.getFailureMessage()); } if (display != null) { if (!display.readAndDispatch()) { try { Thread.sleep(UI_THREAD_SLEEP_INTERVAL_MS); } catch (final InterruptedException e) { } } display.update(); } else { try { Thread.sleep(SLEEP_INTERVAL_MS); } catch (final InterruptedException e) { } } } } catch (Exception e) { throw new WaitTimeoutException(condition.getFailureMessage() + "\n" + e.getClass().getName() + ": " + <START> e.getMessage()); <END> } }</code><technical_language>getMessage() return null, e.toString() e</technical_language>

Target:
public static void waitUntil(IWaitCondition condition, long maxWait) { long waitStart = System.currentTimeMillis(); Display display = Display.getCurrent(); try { while (!condition.test()) { if (System.currentTimeMillis() - waitStart > maxWait) { throw new WaitTimeoutException(condition.getFailureMessage()); } if (display != null) { if (!display.readAndDispatch()) { try { Thread.sleep(UI_THREAD_SLEEP_INTERVAL_MS); } catch (final InterruptedException e) { } } display.update(); } else { try { Thread.sleep(SLEEP_INTERVAL_MS); } catch (final InterruptedException e) { } } } } catch (Exception e) { throw new WaitTimeoutException(condition.getFailureMessage() + "\n" + e); } }
Source:
<code>public boolean hasSecretParams() { return this.getRepository().hasSecretParams() || this.getConfiguration() .stream() <START> .anyMatch(ConfigurationProperty::hasSecretParams); <END> }</code><technical_language>logic for hasSecretParams getSecretParams is repeated classes. Is ok move Configuration class</technical_language>

Target:
public boolean hasSecretParams() { return this.getRepository().hasSecretParams() || this.getConfiguration().hasSecretParams(); }
Source:
<code>private void generateActionHttpPost(Method method) { Name name = method.getName(); buffer.addLine("def %1$s(", pythonNames.getMemberStyleName(name)); buffer.startBlock(); buffer.addLine("self,"); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateFormalParameter); buffer.endBlock(); buffer.addLine("):"); buffer.startBlock(); buffer.addLine("buf = io.BytesIO()"); buffer.addLine("writer = xml.XmlWriter(buf, indent=True)"); buffer.addLine("writer.write_start('action')"); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateWriteActionParameter); buffer.addLine("writer.write_end()"); buffer.addLine("writer.flush()"); buffer.addLine("body = buf.getvalue()"); buffer.addLine("writer.close()"); buffer.addLine("buf.close()"); buffer.addLine("request = http.Request("); buffer.startBlock(); buffer.addLine("method='POST',"); buffer.addLine("path='%%s/%%s' %% (self._path, '%1$s'),", getPath(name)); buffer.addLine("body=body,"); buffer.endBlock(); buffer.addLine(")"); buffer.addLine("response = self._connection.send(request)"); buffer.addLine("if response.code in [200]:"); buffer.startBlock(); <START> buffer.addLine("return self._check_action(response)"); <END> buffer.endBlock(); buffer.addLine("else:"); buffer.startBlock(); buffer.addLine("self._check_fault(response)"); buffer.endBlock(); buffer.endBlock(); buffer.addLine(); }</code><technical_language>Actions return "Action" object, "Action" is internal implementation detail part of specification of API. returned is @Out parameter of method</technical_language>

Target:
private void generateActionHttpPost(Method method) { Name name = method.getName(); buffer.addLine("def %1$s(", pythonNames.getMemberStyleName(name)); buffer.startBlock(); buffer.addLine("self,"); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateFormalParameter); buffer.endBlock(); buffer.addLine("):"); buffer.startBlock(); buffer.addLine("buf = io.BytesIO()"); buffer.addLine("writer = xml.XmlWriter(buf, indent=True)"); buffer.addLine("writer.write_start('action')"); method.parameters() .filter(Parameter::isIn) .sorted() .forEach(this::generateWriteActionParameter); buffer.addLine("writer.write_end()"); buffer.addLine("writer.flush()"); buffer.addLine("body = buf.getvalue()"); buffer.addLine("writer.close()"); buffer.addLine("buf.close()"); buffer.addLine("request = http.Request("); buffer.startBlock(); buffer.addLine("method='POST',"); buffer.addLine("path='%%s/%%s' %% (self._path, '%1$s'),", getPath(name)); buffer.addLine("body=body,"); buffer.endBlock(); buffer.addLine(")"); buffer.addLine("response = self._connection.send(request)"); buffer.addLine("if response.code in [200]:"); buffer.startBlock(); buffer.addLine("action = self._check_action(response)"); method.parameters() .filter(x -> x.isOut()) .findFirst() .ifPresent(this::generateActionResponse); buffer.endBlock(); buffer.addLine("else:"); buffer.startBlock(); buffer.addLine("self._check_fault(response)"); buffer.endBlock(); buffer.endBlock(); buffer.addLine(); }
Source:
<code>private void assumeNotWindows() { <START> Assume.assumeFalse(System.getProperty("os.name").startsWith("Windows")); <END> }</code><technical_language>Functions.isWindows perhaps</technical_language>

Target:
private void assumeNotWindows() { Assume.assumeFalse(Functions.isWindows()); }
Source:
<code>public void checkVariableTypeAndInitializer(VariableTree variableTree) { TypeTree interfaceType = variableTree.type(); ExpressionTree initializer = variableTree.initializer(); if (initializer != null && (initializer.is(Tree.Kind.LAMBDA_EXPRESSION) || isAnonymousClass(initializer))) { <START> matchFunctionalInterface(interfaceType) <END> .ifPresent(treeAndStringInterface -> reportIssue(treeAndStringInterface.classInterface, REPORT_STRING + " '" + treeAndStringInterface.reportString + "'")); } }</code><technical_language>inline variableTree.type()</technical_language>

Target:
public void checkVariableTypeAndInitializer(VariableTree variableTree) { ExpressionTree initializer = variableTree.initializer(); if (initializer != null && (initializer.is(Tree.Kind.LAMBDA_EXPRESSION) || isAnonymousClass(initializer))) { matchFunctionalInterface((variableTree.symbol().type())).ifPresent(reportString -> { TypeTree variableType = variableTree.type(); reportIssue(variableType, reportMessage(new InterfaceTreeAndStringPairReport(reportString, variableType))); }); } }
Source:
<code>public static String fromContext(Context context) { final PackageManager pm = context.getApplicationContext().getPackageManager(); ApplicationInfo ai; try { ai = pm.getApplicationInfo(context.getPackageName(), 0); } catch (final PackageManager.NameNotFoundException e) { ai = null; } <START> return ai != null ? (String) pm.getApplicationLabel(ai) : null; <END> }</code><technical_language>if ai is null, return appLabel. return null. => return ai? -- edit nvm, I guess return null is more explicit</technical_language>

Target:
public static String fromContext(Context context) { final PackageManager pm = context.getApplicationContext().getPackageManager(); try { ApplicationInfo ai = pm.getApplicationInfo(context.getPackageName(), 0); return (String) pm.getApplicationLabel(ai); } catch (PackageManager.NameNotFoundException ignored) { return null; } }
Source:
<code>private void setQcowCompat() { if (getDiskImage().getDiskStorageType() == DiskStorageType.IMAGE && getDiskImage().getVolumeFormat().equals(VolumeFormat.COW)) { DiskImage newDiskImage = getDiskImage(); try { setQcowCompat(newDiskImage.getImage(), newDiskImage.getStoragePoolId(), newDiskImage.getId(), newDiskImage.getImageId(), getParameters().getStorageDomainId(), null); <START> imageDao.update(newDiskImage.getImage()); <END> } catch (EngineException e) { log.error("Unable to update the image info for image '{}' (image group: '{}') on domain '{}'", newDiskImage.getImageId(), newDiskImage.getId(), getParameters().getStorageDomainId()); } } }</code><technical_language>update is unneeded, method is called disk is saved in db in line 131</technical_language>

Target:
private void setQcowCompat() { if (getDiskImage().getDiskStorageType() == DiskStorageType.IMAGE && getDiskImage().getVolumeFormat().equals(VolumeFormat.COW)) { DiskImage newDiskImage = getDiskImage(); try { setQcowCompat(newDiskImage.getImage(), newDiskImage.getStoragePoolId(), newDiskImage.getId(), newDiskImage.getImageId(), getParameters().getStorageDomainId(), null); } catch (EngineException e) { log.error("Unable to update the image info for image '{}' (image group: '{}') on domain '{}'", newDiskImage.getImageId(), newDiskImage.getId(), getParameters().getStorageDomainId()); } } }
Source:
<code><START> protected synchronized HttpResponse post(String url, Map<String, String> payloads) throws IOException { <END> HttpPost postRequest = new HttpPost(url); postRequest.setHeader("Accept", ACCEPT_CONTENT_TYPE); StringEntity entity = new StringEntity(OBJECT_MAPPER.writeValueAsString(payloads), ContentType.APPLICATION_JSON); postRequest.setEntity(entity); HttpResponse httpResponse; int hashCode = url.hashCode() + payloads.hashCode(); try { if (_cachedResults.containsKey(hashCode)) { return _cachedResults.get(hashCode); } LOG.info("Executing request: {}, headers: {}, entity: {}", postRequest.getRequestLine(), postRequest.getAllHeaders(), postRequest.getEntity()); httpResponse = _httpClient.execute(postRequest); _cachedResults.put(hashCode, httpResponse); return httpResponse; } catch (IOException e) { LOG.error("Failed to perform customized health check. Is participant endpoint available?", url, e); throw e; } }</code><technical_language>problem locking this method. blocks node querying. I lock get partition data</technical_language>

Target:
protected HttpResponse post(String url, Map<String, String> payloads) throws IOException { HttpPost postRequest = new HttpPost(url); postRequest.setHeader("Accept", ACCEPT_CONTENT_TYPE); StringEntity entity = new StringEntity(OBJECT_MAPPER.writeValueAsString(payloads), ContentType.APPLICATION_JSON); postRequest.setEntity(entity); try { LOG.info("Executing request: {}, headers: {}, entity: {}", postRequest.getRequestLine(), postRequest.getAllHeaders(), postRequest.getEntity()); return _httpClient.execute(postRequest); } catch (IOException e) { LOG.error("Failed to perform customized health check. Is participant endpoint available?", url, e); throw e; } }
Source:
<code>public void run() { LOG.info("ExchangeScheduled inside run"); while (m_bRunnable) { ExchangeScheduledTask exTask = new ExchangeScheduledTask(); exTask.task(); try { <START> Thread.sleep(refreshInterval); <END> } catch (InterruptedException ex) { LOG.error("Failed to put to sleep: {}", getInstance().getName(), ex.getLocalizedMessage(), ex); } } }</code><technical_language>Optional: For debug purpose, include log.info display refreshInterval</technical_language>

Target:
public void run() { LOG.info("ExchangeScheduled inside run"); while (m_bRunnable) { ExchangeScheduledTask exTask = new ExchangeScheduledTask(); exTask.task(); try { LOG.info("Putting for sleep for milliseconds", getInstance().getName(), refreshInterval); Thread.sleep(refreshInterval); } catch (InterruptedException ex) { LOG.error("Failed to put to sleep: {}", getInstance().getName(), ex.getLocalizedMessage(), ex); } } }
Source:
<code>public Collection<CaseInstance> getSubCaseInstancesByParentCaseId(String parentCaseId, List<CaseStatus> statuses, QueryContext queryContext) { <START> Map<String, Object> params = new HashMap<String, Object>(); params.put("parentCaseId", Arrays.asList(parentCaseId)); params.put("statuses", resolveCaseStatuses(statuses)); applyQueryContext(params, queryContext); applyDeploymentFilter(params); List<CaseInstance> processInstances = commandService.execute(new QueryNameCommand<List<CaseInstance>>("getSubCaseInstancesByParentCaseIds", params)); return processInstances; <END> }</code><technical_language>This block is repeated here: <LINK_0> refactored a private method avoid repetition: > @Override public Collection<CaseInstance> getSubCaseInstancesByParentCaseId(String parentCaseId, List<CaseStatus> statuses, QueryContext queryContext) { List<String> ids = Arrays.asList(parentCaseId); return getSubCaseInstances(ids, statuses, queryContext); } @Override public Collection<CaseInstance> getAllDescendantSubCaseInstancesByParentCaseId(String parentCaseId, List<CaseStatus> statuses, QueryContext queryContext) { // this iterate foreach level. do queries levels in hierarchy List<CaseInstance> cases = new ArrayList<>(); List<String> ids = Arrays.asList(parentCaseId); do { List<CaseInstance> processInstances = getSubCaseInstances(ids, statuses, queryContext); cases.addAll(processInstances); ids = processInstances.stream().map(CaseInstance::getCaseId).collect(Collectors.toList()); } while (!ids.isEmpty()); // empty means more leves return cases; } private List<CaseInstance> getSubCaseInstances(List<String> ids, List<CaseStatus> statuses, QueryContext queryContext) { Map<String, Object> params = new HashMap<>(); params.put("parentCaseId", ids); params.put("statuses", resolveCaseStatuses(statuses)); applyQueryContext(params, queryContext); applyDeploymentFilter(params); return commandService.execute(new QueryNameCommand<List<CaseInstance>>("getSubCaseInstancesByParentCaseIds", params)); }</technical_language>

Target:
public Collection<CaseInstance> getSubCaseInstancesByParentCaseId(String parentCaseId, List<CaseStatus> statuses, QueryContext queryContext) { return getSubCases(Arrays.asList(parentCaseId), statuses, queryContext); }
Source:
<code>protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { log.debug("Initializing FCM based push notification provider implementation bundle"); } if (log.isDebugEnabled()) { <START> log.debug("FCM based push notification provider implementation bundle has been successfully " + <END> "initialized"); } } catch (Throwable e) { log.error("Error occurred while initializing FCM based push notification provider " + "implementation bundle", e); } }</code><technical_language>Do need debug logs here</technical_language>

Target:
protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { log.debug("FCM based push notification provider implementation bundle has been successfully " + "initialized"); } } catch (Throwable e) { log.error("Error occurred while initializing FCM based push notification provider " + "implementation bundle", e); } }
Source:
<code>public void writeBootstrapPage_scriptSrcHasNoDoubleQuotes_attributeIsTransferred() throws IOException { WebComponentBootstrapHandler handler = new WebComponentBootstrapHandler(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); Element head = new Document("").normalise().head(); Element script = head.ownerDocument().createElement("script"); head.appendChild(script); script.attr("src", "foo'bar%20%27?baz%22"); VaadinResponse response = getMockResponse(stream); handler.writeBootstrapPage("", response, head, ""); String resultingScript = stream.toString(StandardCharsets.UTF_8.name()); MatcherAssert.assertThat(resultingScript, CoreMatchers <START> .not(CoreMatchers.containsString("foo'bar %27?baz%22"))); <END> }</code><technical_language>correct assert condition? negated, catch regressions yield exact string</technical_language>

Target:
public void writeBootstrapPage_scriptSrcHasNoDoubleQuotes_attributeIsTransferred() throws IOException { WebComponentBootstrapHandler handler = new WebComponentBootstrapHandler(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); Element head = new Document("").normalise().head(); Element script = head.ownerDocument().createElement("script"); head.appendChild(script); script.attr("src", "foo'bar%20%27?baz%22"); VaadinResponse response = getMockResponse(stream); handler.writeBootstrapPage("", response, head, ""); String resultingScript = stream.toString(StandardCharsets.UTF_8.name()); MatcherAssert.assertThat(resultingScript, CoreMatchers.containsString("foo'bar%20%27?baz%22")); }
Source:
<code>void addRoute(Class<? extends M> messageType, Route<M, C, R> via) throws IllegalStateException { checkNotNull(messageType); checkNotNull(via); Match match = routeFor(messageType); if (match.found()) { String requestedClass = messageType.getName(); String entryClass = match.entryClass() .getName(); if (match.direct()) { throw newIllegalStateException( "The route for the message class `%s` already set. " + "Please remove the route (`%s`) before setting new route.", requestedClass, entryClass); } else { throw newIllegalStateException( "The route for the message class `%s` already defined via " + "the interface `%s`. If you want to have specific routing for " + <START> "the class `%s` please put it before the routing for " + <END> "the super-interface.", requestedClass, entryClass, requestedClass); } } routes.put(messageType, via); }</code><technical_language>, please</technical_language>

Target:
void addRoute(Class<? extends M> messageType, Route<M, C, R> via) throws IllegalStateException { checkNotNull(messageType); checkNotNull(via); Match match = routeFor(messageType); if (match.found()) { String requestedClass = messageType.getName(); String entryClass = match.entryClass() .getName(); if (match.direct()) { throw newIllegalStateException( "The route for the message class `%s` already set. " + "Please remove the route (`%s`) before setting new route.", requestedClass, entryClass); } else { throw newIllegalStateException( "The route for the message class `%s` already defined via " + "the interface `%s`. If you want to have specific routing for " + "the class `%s`, please put it before the routing for " + "the super-interface.", requestedClass, entryClass, requestedClass); } } routes.put(messageType, via); }
Source:
<code>private void setDataBindingField() { <START> dataBindingField = holder.generatedClass.field(JMod.PRIVATE, getClasses().VIEW_DATA_BINDING, "viewDataBinding" + ModelConstants.generationSuffix()); <END> }</code><technical_language>iirc static import for generationSuffix in other classes</technical_language>

Target:
private void setDataBindingField() { dataBindingField = holder.generatedClass.field(JMod.PRIVATE, getClasses().VIEW_DATA_BINDING, "viewDataBinding" + generationSuffix()); }
Source:
<code>private void assignEventProducerToTask(EventProducer eventProducer, DatastreamTask task) { eventProducer.assignTask(task); DatastreamEventProducerImpl datastreamEventProducer = (DatastreamEventProducerImpl) task.getEventProducer(); <START> if(task.getEventProducer() == null) { <END> ((DatastreamTaskImpl) task).setEventProducer(new DatastreamEventProducerImpl(task, _schemaRegistryProvider, eventProducer)); } else { datastreamEventProducer.resetEventProducer(eventProducer); } _taskEventProducerMap.put(task, eventProducer); }</code><technical_language>datastreamEventProducer == null is clearer, missing a whitespace if</technical_language>

Target:
private void assignEventProducerToTask(EventProducer eventProducer, DatastreamTask task) { eventProducer.assignTask(task); DatastreamEventProducerImpl datastreamEventProducer = (DatastreamEventProducerImpl) task.getEventProducer(); if (datastreamEventProducer == null) { ((DatastreamTaskImpl) task).setEventProducer( new DatastreamEventProducerImpl(task, _schemaRegistryProvider, eventProducer)); } else { datastreamEventProducer.resetEventProducer(eventProducer); } _taskEventProducerMap.put(task, eventProducer); }
Source:
<code><START> private boolean hasVirtCluster() { <END> for (VDSGroup cluster: getAllVdsGroupInPool()) { if (cluster.supportsVirtService()) { return true; } } return false; }</code><technical_language>java8 around, please replace with: return getAllVdsGroupInPool().stream().anyMatch(VDSGroup::supportsVirtService);</technical_language>

Target:
private boolean hasVirtCluster() { return getAllVdsGroupInPool().stream().anyMatch(VDSGroup::supportsVirtService); }
Source:
<code>public PluggableAlertRepository( final ObjectMapper objectMapper, final PeriodicMetrics periodicMetrics, final Injector injector, final Environment environment, @Named("AlertJobCoordinator") <START> final ActorRef alertJobCoordinator, <END> @Assisted final Config config ) { this( objectMapper, periodicMetrics, ConfigurationHelper.toInstanceMapped(injector, environment, config.getConfig("configProvider")), UUID.fromString(config.getString("organization")), Optional.of(alertJobCoordinator) ); }</code><technical_language>this marked @Nullable? Question: is provided? Is this cluster singleton runs node? If so, add construct description</technical_language>

Target:
public PluggableAlertRepository( final ObjectMapper objectMapper, final PeriodicMetrics periodicMetrics, final Injector injector, final Environment environment, @Named("AlertJobCoordinator") final ActorRef alertJobCoordinator, @Assisted final Config config ) { this( objectMapper, periodicMetrics, ConfigurationHelper.toInstanceMapped(injector, environment, config.getConfig("configProvider")), UUID.fromString(config.getString("organization")), config.getDuration("openTimeout"), alertJobCoordinator ); }
Source:
<code>public void qcValues(List<SensorValue> values) throws RoutineException { SensorValue prevValue = null; SensorValue currValue = null; SensorValue nextValue = null; List<SensorValue> filteredValues = filterMissingValues(values); int i = 1; while (i < filteredValues.size() - 1) { currValue = filteredValues.get(i); prevValue = filteredValues.get(i - 1); nextValue = filteredValues.get(i + 1); double tDiff = ChronoUnit.SECONDS.between(prevValue.getTime(), currValue.getTime()) / 60.0; double delta = Math .abs(currValue.getDoubleValue() - prevValue.getDoubleValue()) / tDiff; if (delta > maxDelta) { double deltaNext = Math .abs(nextValue.getDoubleValue() - prevValue.getDoubleValue()) / tDiff; if (deltaNext < maxDelta) { addFlag(currValue, Flag.BAD, maxDelta, delta); i++; } else { addFlag(prevValue, Flag.BAD, maxDelta, delta); <START> while ((delta > maxDelta) & (i < filteredValues.size() - 1)) { <END> addFlag(currValue, Flag.BAD, maxDelta, delta); i++; currValue = filteredValues.get(i); prevValue = filteredValues.get(i - 1); tDiff = ChronoUnit.SECONDS.between(prevValue.getTime(), currValue.getTime()) / 60.0; delta = Math.abs( currValue.getDoubleValue() - prevValue.getDoubleValue()) / tDiff; } } } i++; } }</code><technical_language>&&, & & is a operation stuff binary level</technical_language>

Target:
public void qcValues(List<SensorValue> values) throws RoutineException { SensorValue prevValue = null; SensorValue currValue = null; SensorValue nextValue = null; List<SensorValue> filteredValues = filterMissingValues(values); int i = 1; while (i < filteredValues.size() - 1) { currValue = filteredValues.get(i); prevValue = filteredValues.get(i - 1); nextValue = filteredValues.get(i + 1); double tDiff = ChronoUnit.SECONDS.between(prevValue.getTime(), currValue.getTime()) / 60.0; double delta = Math .abs(currValue.getDoubleValue() - prevValue.getDoubleValue()) / tDiff; if (delta > maxDelta) { double deltaNext = Math .abs(nextValue.getDoubleValue() - prevValue.getDoubleValue()) / tDiff; if (deltaNext < maxDelta) { addFlag(currValue, Flag.BAD, maxDelta, delta); i++; } else { addFlag(prevValue, Flag.BAD, maxDelta, delta); while ((delta > maxDelta) && (i < filteredValues.size() - 1)) { addFlag(currValue, Flag.BAD, maxDelta, delta); i++; currValue = filteredValues.get(i); prevValue = filteredValues.get(i - 1); tDiff = ChronoUnit.SECONDS.between(prevValue.getTime(), currValue.getTime()) / 60.0; delta = Math.abs( currValue.getDoubleValue() - prevValue.getDoubleValue()) / tDiff; } } } i++; } }
Source:
<code><START> protected AsyncTaskType getTaskType() { <END> return AsyncTaskType.copyImage; }</code><technical_language>return AsyncTaskType.unsupported executing SPDM flow</technical_language>

Target:
protected AsyncTaskType getTaskType() { return isDataOperationsByHSM() ? AsyncTaskType.notSupported : AsyncTaskType.copyImage; }
Source:
<code>public <T> T makeBlockingRequest( AdvertisedSocketAddress upstream, CatchUpRequest request, CatchUpResponseCallback<T> responseHandler ) throws CatchUpClientException { CompletableFuture<T> future = new CompletableFuture<>(); CatchUpChannel channel = pool.acquire( upstream ); future.whenComplete( ( result, e ) -> { if ( e == null ) { pool.release( channel ); } else { pool.dispose( channel ); } } ); channel.setResponseHandler( responseHandler, future ); try { channel.send( request ); String operation = format( "Timed out executing operation %s on %s ", request, upstream ); <START> return waitForCompletion( future, operation, channel::millisSinceLastResponse, inactivityTimeoutMillis, log ); <END> } catch ( CatchUpClientException e ) { pool.dispose( channel ); throw e; } }</code><technical_language>waitForCompletion(..) try-block, right</technical_language>

Target:
public <T> T makeBlockingRequest( AdvertisedSocketAddress upstream, CatchUpRequest request, CatchUpResponseCallback<T> responseHandler ) throws CatchUpClientException { CompletableFuture<T> future = new CompletableFuture<>(); CatchUpChannel channel = null; try { channel = pool.acquire( upstream ); channel.setResponseHandler( responseHandler, future ); future.whenComplete( new ReleaseOnComplete( channel ) ); channel.send( request ); } catch ( Exception e ) { if ( channel != null ) { pool.dispose( channel ); } throw new CatchUpClientException( "Failed to send request", e ); } String operation = format( "Completed exceptionally when executing operation %s on %s ", request, upstream ); return waitForCompletion( future, operation, channel::millisSinceLastResponse, inactivityTimeoutMillis, log ); }
Source:
<code>public List<Contentlet> dbRelatedContent(final Relationship relationship, final Contentlet contentlet, final boolean hasParent, final boolean live, final String orderBy) throws DotDataException { <START> List<Contentlet> matches = new ArrayList<Contentlet>(); <END> if(contentlet == null || !InodeUtils.isSet(contentlet.getIdentifier())) return matches; String iden = ""; try{ iden = APILocator.getIdentifierAPI().find(contentlet).getInode(); }catch(DotHibernateException dhe){ Logger.error(this.getClass(), "Unable to retrieve Identifier", dhe); } if(!InodeUtils.isSet(iden)) return matches; if (hasParent) { if (live) matches = dbRelatedContentByParent(iden, relationship.getRelationTypeValue(),true, orderBy); else matches = dbRelatedContentByParent(iden, relationship.getRelationTypeValue(),false, orderBy); } else { if (live) matches = dbRelatedContentByChild(iden, relationship.getRelationTypeValue(),true, orderBy); else matches = dbRelatedContentByChild(iden, relationship.getRelationTypeValue(),false, orderBy); } return matches; }</code><technical_language>in mind immutable</technical_language>

Target:
public List<Contentlet> dbRelatedContent(final Relationship relationship, final Contentlet contentlet, final boolean hasParent, final boolean live, final String orderBy) throws DotDataException { List<Contentlet> matches = new ArrayList<Contentlet>(); if(contentlet == null || !InodeUtils.isSet(contentlet.getIdentifier())) { return matches; } String iden = ""; try{ iden = APILocator.getIdentifierAPI().find(contentlet).getInode(); }catch(DotHibernateException dhe){ Logger.error(this.getClass(), "Unable to retrieve Identifier", dhe); } if(!InodeUtils.isSet(iden)) { return matches; } if (hasParent) { matches = live ? dbRelatedContentByParent(iden, relationship.getRelationTypeValue(),true, orderBy): dbRelatedContentByParent(iden, relationship.getRelationTypeValue(),false, orderBy); } else { matches = live ? dbRelatedContentByChild(iden, relationship.getRelationTypeValue(),true, orderBy): dbRelatedContentByChild(iden, relationship.getRelationTypeValue(),false, orderBy); } return matches; }
Source:
<code><START> public ConnectivityMonitorFactory getConnectivityMonitorFactory() { <END> return connectivityMonitorFactory; }</code><technical_language>this package private</technical_language>

Target:
ConnectivityMonitorFactory getConnectivityMonitorFactory() { return connectivityMonitorFactory; }
Source:
<code>protected void pageChange(int pageIndex) { super.pageChange(pageIndex); setContextClassLoader(); switch (pageIndex) { case DESIGN_VIEW_PAGE_INDEX: { String source = sourceEditor.getDocument().get(); MediatorFactoryUtils.registerFactories(); try { handleDesignViewActivatedEvent(); Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { EditorUtils.setLockmode(graphicalEditor, true); final boolean dirty = isDirty(); AbstractEsbNodeDeserializer.relocateStartNodes(); AbstractEsbNodeDeserializer.resizeParentCompartments(); if (!dirty && isDirty()) { getEditor(0).doSave(new NullProgressMonitor()); firePropertyChange(PROP_DIRTY); } EditorUtils.setLockmode(graphicalEditor, false); } }); <START> } catch (Exception e) { <END> setActivePage(SOURCE_VIEW_PAGE_INDEX); sourceEditor.getDocument().set(source); printHandleDesignViewActivatedEventErrorMessage(e); } finally { AbstractEsbNodeDeserializer.cleanupData(); firePropertyChange(PROP_DIRTY); } break; } case SOURCE_VIEW_PAGE_INDEX: { try { updateSequenceDetails(); handleSourceViewActivatedEvent(); } catch (Exception e) { log.error("Cannot update source view", e); String simpleMessage = ExceptionMessageMapper.getNonTechnicalMessage(e.getMessage()); IStatus editorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, simpleMessage); setActivePage(DESIGN_VIEW_PAGE_INDEX); ErrorDialog.openError(getActiveEditor().getSite().getShell(), "Error", "Cannot update source view. The following error(s) have been detected. Please see the error log for more details ", editorStatus); } break; } } }</code><technical_language>catching a general Exception here</technical_language>

Target:
protected void pageChange(int pageIndex) { super.pageChange(pageIndex); setContextClassLoader(); switch (pageIndex) { case DESIGN_VIEW_PAGE_INDEX: { MediatorFactoryUtils.registerFactories(); handleDesignViewActivatedEvent(); final EsbMultiPageEditor currentEditor = this; Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { EditorUtils.setLockmode(graphicalEditor, true); final boolean dirty = isDirty(); AbstractEsbNodeDeserializer.relocateStartNodes(); if(!dirty && isDirty()){ getEditor(0).doSave(new NullProgressMonitor()); firePropertyChange(PROP_DIRTY); } EditorUtils.setLockmode(graphicalEditor, false); } }); break; } case SOURCE_VIEW_PAGE_INDEX: { try { updateSequenceDetails(); handleSourceViewActivatedEvent(); } catch (Exception e) { log.error("Cannot update source view", e); String simpleMessage = ExceptionMessageMapper.getNonTechnicalMessage(e.getMessage()); IStatus editorStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, simpleMessage); setActivePage(0); ErrorDialog.openError(getActiveEditor().getSite().getShell(), "Error", "Cannot update source view. The following error(s) have been detected. Please see the error log for more details ", editorStatus); } break; } } }
Source:
<code>static public Test suite() throws IOException { MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestEmptySchema.class); VoltProjectBuilder project = getBuilderForTest(); boolean success; LocalCluster config = new LocalCluster(true, "decimal-default.jar", 2, 3, 0, BackendTarget.NATIVE_EE_JNI); success = config.compile(project); assertTrue(success); <START> <END> builder.addServerConfig(config); return builder; }</code><technical_language>@zeemanhe @vittvolt Great suggestion</technical_language>

Target:
static public Test suite() throws IOException { MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestEmptySchema.class); VoltProjectBuilder project = getBuilderForTest(); boolean success; LocalCluster config = new LocalCluster("decimal-default.jar", 2, 1, 0, BackendTarget.NATIVE_EE_JNI); success = config.compile(project); assertTrue(success); builder.addServerConfig(config); return builder; }
Source:
<code>public static void instantiateDriverObject() { <START> if (!Property.REUSE_BROWSER.isSpecified()) { <END> driver.set(new DriverSetup().instantiateDriver()); } else { driver.set(getNextAvailableDriverFromPool()); } wait.set(newDefaultWait()); }</code><technical_language>I this easier read if negated i.e. swap order</technical_language>

Target:
public static void instantiateDriverObject() { if (Property.REUSE_BROWSER.isSpecified()) { driver.set(getNextAvailableDriverFromPool()); } else { driver.set(new DriverSetup().instantiateDriver()); } wait.set(newDefaultWait()); }
Source:
<code>public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { SubMonitor subMon = SubMonitor.convert(monitor, Messages.LoadTargetOperation_mainTaskName, 40); try { if (subMon.isCanceled()) { return Status.CANCEL_STATUS; } if (!fTarget.isResolved()) { fTarget.resolve(subMon.split(20)); } subMon.setWorkRemaining(20); PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager(); ((TargetPlatformService) TargetPlatformService.getDefault()).setWorkspaceTargetDefinition(fTarget); String memento = fTarget.getHandle().getMemento(); if (fNone) { memento = ICoreConstants.NO_TARGET; } if (memento.equals(preferences.getString(ICoreConstants.WORKSPACE_TARGET_HANDLE))) { preferences.setValue(ICoreConstants.WORKSPACE_TARGET_HANDLE, ""); } preferences.setValue(ICoreConstants.WORKSPACE_TARGET_HANDLE, memento); clearDeprecatedPreferences(preferences, subMon.split(3)); loadJRE(subMon.split(3)); PDECore.getDefault().getPreferencesManager().savePluginPreferences(); resetPlatform(subMon.split(14)); } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; <START> } finally { <END> subMon.done(); if (monitor != null) { monitor.done(); } } return Status.OK_STATUS; }</code><technical_language>Calling done a SubMonitor necessary <LINK_0></technical_language>

Target:
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { SubMonitor subMon = SubMonitor.convert(monitor, Messages.LoadTargetOperation_mainTaskName, 40); try { if (subMon.isCanceled()) { return Status.CANCEL_STATUS; } if (!fTarget.isResolved()) { fTarget.resolve(subMon.split(20)); } subMon.setWorkRemaining(20); PDEPreferencesManager preferences = PDECore.getDefault().getPreferencesManager(); ((TargetPlatformService) TargetPlatformService.getDefault()).setWorkspaceTargetDefinition(fTarget); String memento = fTarget.getHandle().getMemento(); if (fNone) { memento = ICoreConstants.NO_TARGET; } if (memento.equals(preferences.getString(ICoreConstants.WORKSPACE_TARGET_HANDLE))) { preferences.setValue(ICoreConstants.WORKSPACE_TARGET_HANDLE, ""); } preferences.setValue(ICoreConstants.WORKSPACE_TARGET_HANDLE, memento); clearDeprecatedPreferences(preferences, subMon.split(3)); loadJRE(subMon.split(3)); PDECore.getDefault().getPreferencesManager().savePluginPreferences(); resetPlatform(subMon.split(14)); } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; } finally { if (monitor != null) { monitor.done(); } } return Status.OK_STATUS; }
Source:
<code>public void testExpandableItemStatusAfterOpening() { SWTBotVSMEditor odesignEditor = openViewpointSpecificationModel(VSM); SWTBotTreeItem[] treeItem = odesignEditor.bot().tree().getAllItems(); assertEquals("There should be only one group node under resource node", 1, treeItem.length); SWTBotTreeItem resourceItem = treeItem[0]; assertEquals("There should be only one viewpoint node under group <START> node", <END> resourceItem.getItems().length); SWTBotTreeItem groupItem = resourceItem.getItems()[0]; assertEquals(errorMessage(2, 6), 6, groupItem.getItems().length); SWTBotTreeItem viewpointItem = groupItem.getItems()[0]; assertEquals(errorMessage(3, 7), 7, viewpointItem.getItems().length); SWTBotTreeItem viewpointItem2 = groupItem.getItems()[2]; assertEquals(errorMessage(3, 4), 4, viewpointItem2.getItems().length); SWTBotTreeItem entitiesDiagramItem2 = viewpointItem2.getItems()[0]; assertEquals("The level 4 node should not be expanded. It should contains only the empty node.", 1, entitiesDiagramItem2.getItems().length); SWTBotTreeItem entitiesDiagramItem = viewpointItem.getItems()[0]; assertEquals("The level 4 node should not be expanded. It should contains only the empty node.", 1, entitiesDiagramItem.getItems().length); SWTBotTreeItem expandedEntitiesDiagramItem2 = entitiesDiagramItem2.expand(); assertEquals(errorMessage(4, 2), 2, expandedEntitiesDiagramItem2.getItems().length); SWTBotTreeItem expandedEntitiesDiagramItem = entitiesDiagramItem.expand(); assertEquals(errorMessage(4, 9), 9, expandedEntitiesDiagramItem.getItems().length); }</code><technical_language>missing "1,"</technical_language>

Target:
public void testExpandableItemStatusAfterOpening() { SWTBotVSMEditor odesignEditor = openViewpointSpecificationModel(VSM); SWTBotTreeItem[] treeItem = odesignEditor.bot().tree().getAllItems(); assertEquals("There should be only one group node under resource node", 1, treeItem.length); SWTBotTreeItem resourceItem = treeItem[0]; assertEquals("There should be only one viewpoint node under group node", 1, resourceItem.getItems().length); SWTBotTreeItem groupItem = resourceItem.getItems()[0]; assertEquals(errorMessage(2, 6), 6, groupItem.getItems().length); SWTBotTreeItem viewpointItem = groupItem.getItems()[0]; assertEquals(errorMessage(3, 7), 7, viewpointItem.getItems().length); SWTBotTreeItem viewpointItem2 = groupItem.getItems()[2]; assertEquals(errorMessage(3, 4), 4, viewpointItem2.getItems().length); SWTBotTreeItem entitiesDiagramItem2 = viewpointItem2.getItems()[0]; assertEquals("The level 4 node should not be expanded. It should contains only the empty node.", 1, entitiesDiagramItem2.getItems().length); SWTBotTreeItem entitiesDiagramItem = viewpointItem.getItems()[0]; assertEquals("The level 4 node should not be expanded. It should contains only the empty node.", 1, entitiesDiagramItem.getItems().length); SWTBotTreeItem expandedEntitiesDiagramItem2 = entitiesDiagramItem2.expand(); assertEquals(errorMessage(4, 2), 2, expandedEntitiesDiagramItem2.getItems().length); SWTBotTreeItem expandedEntitiesDiagramItem = entitiesDiagramItem.expand(); assertEquals(errorMessage(4, 9), 9, expandedEntitiesDiagramItem.getItems().length); }
Source:
<code>public IStatus downloadAndUnzip(String unzipDirectoryPath, String downloadDirectoryPath, String urlString, boolean deleteOnExit, String user, String pass, TaskModel tm, IProgressMonitor monitor) { monitor.beginTask("Configuring runtime from url " + urlString, 500); try { validateInputs(downloadDirectoryPath, unzipDirectoryPath); File downloadedFile = downloadRemoteRuntime(unzipDirectoryPath, downloadDirectoryPath, urlString, deleteOnExit, user, pass, new SubProgressMonitor(monitor, 450)); ExtractUtility extractUtil = new ExtractUtility(downloadedFile); IOverwrite ow = (IOverwrite)tm.getObject(IDownloadRuntimeWorkflowConstants.OVERWRITE); if( ow == null ) { ow = createOverwriteFileQuery(); } unzip(extractUtil, downloadedFile, unzipDirectoryPath, ow, new SubProgressMonitor(monitor, 30)); String updatedRuntimeRoot = getUpdatedUnzipPath(extractUtil, unzipDirectoryPath, new SubProgressMonitor(monitor, 10)); tm.putObject(IDownloadRuntimeWorkflowConstants.UNZIPPED_SERVER_HOME_DIRECTORY, updatedRuntimeRoot); } catch(CoreException ce) { <START> return new Status(ce.getStatus().getSeverity(), RuntimeCoreActivator.PLUGIN_ID, "Error while retrieving runtime from "+ urlString, ce); <END> } finally { monitor.done(); } return Status.OK_STATUS; }</code><technical_language>NLS.bind</technical_language>

Target:
public IStatus downloadAndUnzip(String unzipDirectoryPath, String downloadDirectoryPath, String urlString, boolean deleteOnExit, String user, String pass, TaskModel tm, IProgressMonitor monitor) { monitor.beginTask("Configuring runtime from url " + urlString, 500); try { validateInputs(downloadDirectoryPath, unzipDirectoryPath); File downloadedFile = downloadRemoteRuntime(unzipDirectoryPath, downloadDirectoryPath, urlString, deleteOnExit, user, pass, new SubProgressMonitor(monitor, 450)); ExtractUtility extractUtil = new ExtractUtility(downloadedFile); IOverwrite ow = (IOverwrite)tm.getObject(IDownloadRuntimeWorkflowConstants.OVERWRITE); if( ow == null ) { ow = createOverwriteFileQuery(); } unzip(extractUtil, downloadedFile, unzipDirectoryPath, ow, new SubProgressMonitor(monitor, 30)); String updatedRuntimeRoot = getUpdatedUnzipPath(extractUtil, unzipDirectoryPath, new SubProgressMonitor(monitor, 10)); tm.putObject(IDownloadRuntimeWorkflowConstants.UNZIPPED_SERVER_HOME_DIRECTORY, updatedRuntimeRoot); } catch(CoreException ce) { return new Status(ce.getStatus().getSeverity(), RuntimeCoreActivator.PLUGIN_ID, NLS.bind("Error while retrieving runtime from {0}", urlString), ce); } finally { monitor.done(); } return Status.OK_STATUS; }