auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void handleAjaxFetchFile( FileSystem fs, HttpServletRequest req, HttpServletResponse resp, Session session, Path path) throws IOException, ServletException { int startLine = getIntParam(req, "startLine", DEFAULT_START_LINE); int endLine = getIntParam(req, "endLine", DEFAULT_END_LINE); OutputStream output = resp.getOutputStream(); if (endLine < startLine) { output.write(("Invalid range: endLine < startLine.").getBytes("UTF-8")); return; } <START> if (endLine - startLine > FILE_MAX_LINES) { <END> output.write(("Invalid range: range exceeds max number of lines.") .getBytes("UTF-8")); return; } HdfsFileViewer fileViewer = null; if (hasParam(req, "viewerId")) { fileViewer = viewers.get(getIntParam(req, "viewerId")); if (!fileViewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = null; } } else { for (HdfsFileViewer viewer : viewers) { if (viewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = viewer; break; } } } if (fileViewer == null) { if (defaultViewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = defaultViewer; } else { output.write(("No viewer available for file.").getBytes("UTF-8")); return; } } fileViewer.displayFile(fs, path, output, startLine, endLine); }</code><technical_language>get FILE_MAX_LINES configurable a default value</technical_language>

Target:
private void handleAjaxFetchFile( FileSystem fs, HttpServletRequest req, HttpServletResponse resp, Session session, Path path) throws IOException, ServletException { int startLine = getIntParam(req, "startLine", defaultStartLine); int endLine = getIntParam(req, "endLine", defaultEndLine); OutputStream output = resp.getOutputStream(); if (endLine < startLine) { output.write(("Invalid range: endLine < startLine.").getBytes("UTF-8")); return; } if (endLine - startLine > fileMaxLines) { output.write(("Invalid range: range exceeds max number of lines.") .getBytes("UTF-8")); return; } HdfsFileViewer fileViewer = null; if (hasParam(req, "viewerId")) { fileViewer = viewers.get(getIntParam(req, "viewerId")); if (!fileViewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = null; } } else { for (HdfsFileViewer viewer : viewers) { if (viewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = viewer; break; } } } if (fileViewer == null) { if (defaultViewer.getCapabilities(fs, path).contains(Capability.READ)) { fileViewer = defaultViewer; } else { output.write(("No viewer available for file.").getBytes("UTF-8")); return; } } fileViewer.displayFile(fs, path, output, startLine, endLine); }
Source:
<code>public static void main(final String[] args) throws Exception { loadPropertiesFiles(args); try (EmbeddedReplayThroughput test = new EmbeddedReplayThroughput()) { System.out.println("Making a recording for playback..."); final long recordingLength = test.makeRecording(); Thread.sleep(10); System.out.println("Finding the recording..."); final long recordingId = test.findRecordingId(ChannelUri.addSessionId(CHANNEL, test.publicationSessionId)); final ContinueBarrier barrier = new ContinueBarrier("Execute again?"); do { System.out.printf("Replaying %,d messages%n", NUMBER_OF_MESSAGES); <START> final long start = System.nanoTime(); <END> test.replayRecording(recordingLength, recordingId); final long durationMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); final double dataRate = (recordingLength * 1000.0d / durationMs) / MEGABYTE; final double recordingMb = recordingLength / MEGABYTE; final long msgRate = (NUMBER_OF_MESSAGES / durationMs) * 1000L; System.out.println("Performance inclusive of replay request and connection setup:"); System.out.printf( "Replayed %.02f MB @ %.02f MB/s - %,d msg/sec - %d byte payload + 32 byte header%n", recordingMb, dataRate, msgRate, MESSAGE_LENGTH); } while (barrier.await()); } }</code><technical_language>time unit in name</technical_language>

Target:
public static void main(final String[] args) throws Exception { loadPropertiesFiles(args); try (EmbeddedReplayThroughput test = new EmbeddedReplayThroughput()) { System.out.println("Making a recording for playback..."); final long recordingLength = test.makeRecording(); Thread.sleep(10); System.out.println("Finding the recording..."); final long recordingId = test.findRecordingId(ChannelUri.addSessionId(CHANNEL, test.publicationSessionId)); final ContinueBarrier barrier = new ContinueBarrier("Execute again?"); do { System.out.printf("Replaying %,d messages%n", NUMBER_OF_MESSAGES); final long startNs = System.nanoTime(); test.replayRecording(recordingLength, recordingId); final long durationMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs); final double dataRate = (recordingLength * 1000.0d / durationMs) / MEGABYTE; final double recordingMb = recordingLength / MEGABYTE; final long msgRate = (NUMBER_OF_MESSAGES / durationMs) * 1000L; System.out.println("Performance inclusive of replay request and connection setup:"); System.out.printf( "Replayed %.02f MB @ %.02f MB/s - %,d msg/sec - %d byte payload + 32 byte header%n", recordingMb, dataRate, msgRate, MESSAGE_LENGTH); } while (barrier.await()); } }
Source:
<code>public void testBasePathValidation() throws Exception { ArtifactArchiver.DescriptorImpl desc = (ArtifactArchiver.DescriptorImpl)j.jenkins.getDescriptorOrDie(ArtifactArchiver.class); FreeStyleProject p = j.createFreeStyleProject(); <START> Assert.assertEquals("no workspace", FormValidation.Kind.OK, desc.doCheckBasePath(p, "foo").kind); <END> Assert.assertEquals("relative path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "..").kind); Assert.assertEquals("absolute path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "/").kind); Assert.assertEquals("absolute path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "../workfoo").kind); p.getBuildersList().replaceBy(Collections.singleton(new CreateFilesForBasePathTest())); build(p); Assert.assertEquals("workspace exists but path does not", FormValidation.Kind.WARNING, desc.doCheckBasePath(p, "foo").kind); Assert.assertEquals("workspace exists and path does", FormValidation.Kind.OK, desc.doCheckBasePath(p, "module").kind); Assert.assertEquals("file specified as base path", FormValidation.Kind.WARNING, desc.doCheckBasePath(p, "module/dist/target/file").kind); Assert.assertEquals("relative path breakout", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "..").kind); Assert.assertEquals("absolute path breakout", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "/").kind); }</code><technical_language>this is statically imported ise assertEquals - is hamcrest matchers</technical_language>

Target:
public void testBasePathValidation() throws Exception { ArtifactArchiver.DescriptorImpl desc = (ArtifactArchiver.DescriptorImpl)j.jenkins.getDescriptorOrDie(ArtifactArchiver.class); FreeStyleProject p = j.createFreeStyleProject(); assertEquals("no workspace", FormValidation.Kind.OK, desc.doCheckBasePath(p, "foo").kind); assertEquals("explicit same directory", FormValidation.Kind.OK, desc.doCheckBasePath(p, ".").kind); assertEquals("relative path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "..").kind); assertEquals("absolute path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "/").kind); assertEquals("absolute path breakout without workspace", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "../workfoo").kind); p.getBuildersList().replaceBy(Collections.singleton(new CreateFilesForBasePathTest())); build(p); assertEquals("workspace exists but path does not", FormValidation.Kind.WARNING, desc.doCheckBasePath(p, "foo").kind); assertEquals("workspace exists and path does", FormValidation.Kind.OK, desc.doCheckBasePath(p, "module").kind); assertEquals("file specified as base path", FormValidation.Kind.WARNING, desc.doCheckBasePath(p, "module/dist/target/file").kind); assertEquals("relative path breakout", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "..").kind); assertEquals("absolute path breakout", FormValidation.Kind.ERROR, desc.doCheckBasePath(p, "/").kind); }
Source:
<code><START> public void commit(String localityGroup) throws IOException { <END> Preconditions.checkArgument(mLGNames.size() == 1, "All writes must be to the same locality " + " group."); Preconditions.checkArgument(mLGNames.contains(localityGroup), "All writes must be in the " + "given locality group: " + localityGroup); for (KeyValue kv : mHopper) { mPut.add(kv); } mHTable.put(mPut); if (!mHTable.isAutoFlush()) { mHTable.flushCommits(); } mPut = null; mEntityId = null; mHopper = null; mId = null; mLGNames = new HashSet<String>(); }</code><technical_language>checkState(mPut != null)</technical_language>

Target:
public void commit(String localityGroup) throws IOException { Preconditions.checkState(mPut != null, "commit must be paired with a call to begin()"); Preconditions.checkState(mLGNames.size() == 1, "All writes must be to the same locality group. Locality groups of specified puts: " + mLGNames); Preconditions.checkArgument(mLGNames.contains(localityGroup), "All writes must be in the " + "given locality group: " + localityGroup); for (KeyValue kv : mHopper) { mPut.add(kv); } mHTable.put(mPut); if (!mHTable.isAutoFlush()) { mHTable.flushCommits(); } reset(); }
Source:
<code>private void importButtonClicked() { File file = selectImportFile(); if (file != null) { List<String> regexes = new ArrayList<String>(getRegexes()); try (BufferedReader br = new BufferedReader(new FileReader(file))) { String line = null; while ((line = br.readLine()) != null) { String trimmedLine = line.trim(); if (MultipleRegexesOptionsPanel.validateRegexAndCheckForDuplicates( trimmedLine, regexes)) regexes.add(trimmedLine); } <START> } catch (IOException | PatternSyntaxException e) { <END> View.getSingleton() .showWarningDialog( Constant.messages.getString( "context.include.import.error", e.getLocalizedMessage())); return; } setRegexes(regexes); } }</code><technical_language>call need qualified class name. - add braces if statement, for consistency</technical_language>

Target:
private void importButtonClicked() { File file = selectImportFile(); if (file != null) { List<String> regexes = new ArrayList<String>(getRegexes()); try (BufferedReader br = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) { String line = null; while ((line = br.readLine()) != null) { String trimmedLine = line.trim(); if (validateRegexAndCheckForDuplicates(trimmedLine, regexes)) { regexes.add(trimmedLine); } } } catch (IOException | PatternSyntaxException e) { View.getSingleton() .showWarningDialog( Constant.messages.getString( "context.include.import.error", e.getLocalizedMessage())); return; } setRegexes(regexes); } }
Source:
<code>public void applyUpdater(INDArray gradient, int iteration) { if (m == null || v == null) throw new IllegalStateException("Updater has not been initialized with view state"); double beta1 = config.getBeta1(); double beta2 = config.getBeta2(); double learningRate = config.getLearningRate(); double epsilon = config.getEpsilon(); INDArray oneMinusBeta1Grad = gradient.mul(1.0 - beta1); m.muli(beta1).addi(oneMinusBeta1Grad); INDArray oneMinusBeta2GradSquared = gradient.mul(gradient).muli(1.0 - beta2); v.muli(beta2).addi(oneMinusBeta2GradSquared); double beta1t = FastMath.pow(beta1, iteration + 1); <START> INDArray biasCorrectedEstimateOfMomentum = m.muli(beta1).divi(1.0 - beta1t); <END> INDArray secondTerm = oneMinusBeta1Grad.divi(1 - beta1t); INDArray alphat = biasCorrectedEstimateOfMomentum.add(secondTerm).muli(learningRate); INDArray sqrtV = Transforms.sqrt(v.dup(gradientReshapeOrder), false).addi(epsilon); gradient.assign(alphat).divi(sqrtV); }</code><technical_language>I this is correct. This line is following: m_t = m_(t-1) * beta1 / (1-beta_1^t) calling 'biasCorrectedEstimateOfMomentum'. Mathematically, correct, incorrectly overwriting m_t in process. I m.mul(beta1).divi(1.0 - beta1t); (i.e., mul, muli - big difference here)</technical_language>

Target:
public void applyUpdater(INDArray gradient, int iteration) { if (m == null || v == null) throw new IllegalStateException("Updater has not been initialized with view state"); double beta1 = config.getBeta1(); double beta2 = config.getBeta2(); double learningRate = config.getLearningRate(); double epsilon = config.getEpsilon(); INDArray oneMinusBeta1Grad = gradient.mul(1.0 - beta1); m.muli(beta1).addi(oneMinusBeta1Grad); INDArray oneMinusBeta2GradSquared = gradient.mul(gradient).muli(1.0 - beta2); v.muli(beta2).addi(oneMinusBeta2GradSquared); double beta1t = FastMath.pow(beta1, iteration + 1); INDArray biasCorrectedEstimateOfMomentum = m.mul(beta1).divi(1.0 - beta1t); INDArray secondTerm = oneMinusBeta1Grad.divi(1 - beta1t); INDArray alphat = biasCorrectedEstimateOfMomentum.add(secondTerm).muli(learningRate); INDArray sqrtV = Transforms.sqrt(v.dup(gradientReshapeOrder), false).addi(epsilon); gradient.assign(alphat).divi(sqrtV); }
Source:
<code>public boolean hasTableDefined() { if (aliasToTabs.size() == 0) { return true; } <START> for (String alias : aliasToTabs.keySet()) { <END> if (!SemanticAnalyzer.DUMMY_TABLE.equals(alias)) { return true; } } return false; }</code><technical_language>iterate tableAliases do call hasTableDefined</technical_language>

Target:
public boolean hasTableDefined() { return !(aliases.size() == 1 && aliases.get(0).equals(SemanticAnalyzer.DUMMY_TABLE)); }
Source:
<code>private static String getHexEncodedSha256Hash(byte[] bytes) { try { MessageDigest digest = MessageDigest.getInstance("SHA-256"); return BaseEncoding.base16().lowerCase().encode(digest.digest(bytes)); } catch (NoSuchAlgorithmException e) { <START> throw new IllegalStateException("Failed to compute SHA-256 hash.", e); <END> } }</code><technical_language>This is illegal state, this is wrong exception type for this problem. do SHA-256 is supported? JDK promise this</technical_language>

Target:
private static String getHexEncodedSha256Hash(byte[] bytes) { try { MessageDigest digest = MessageDigest.getInstance("SHA-256"); return BaseEncoding.base16().lowerCase().encode(digest.digest(bytes)); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Failed to compute SHA-256 hash.", e); } }
Source:
<code>public static void main(String args[]) throws Exception { b17411468(); b2296099Test(); b2302318Test(); b2487514Test(); b5884080Test(); b13679511Test(); b16177324TestWrapper(); b16230771TestWrapper(); <START> b17689750Test(); <END> largeFrameTest(); largeFrameTestFloat(); mulBy1Test(); constantPropagationTest(); getterSetterTest(); identityTest(); wideGetterSetterTest(); wideIdentityTest(); returnConstantTest(); setterTestWithReturnArgIgnoreReturn(); setterTestWithReturnArgUseReturn(); wideSetterTestWithReturnArgIgnoreReturn(); wideSetterTestWithReturnArgUseReturn(); LVNTests.testNPE1(); LVNTests.testNPE2(); ZeroTests.longDivTest(); ZeroTests.longModTest(); MirOpSelectTests.testIfCcz(); ManyFloatArgs(); atomicLong(); LiveFlags.test(); minDoubleWith3ConstsTest(); }</code><technical_language>mind writing test in a self-contained run-test? bigger this test grows, more difficult diagnose (plus if test fails, loose coverage following)</technical_language>

Target:
public static void main(String args[]) throws Exception { b17411468(); b2296099Test(); b2302318Test(); b2487514Test(); b5884080Test(); b13679511Test(); b16177324TestWrapper(); b16230771TestWrapper(); largeFrameTest(); largeFrameTestFloat(); mulBy1Test(); constantPropagationTest(); getterSetterTest(); identityTest(); wideGetterSetterTest(); wideIdentityTest(); returnConstantTest(); setterTestWithReturnArgIgnoreReturn(); setterTestWithReturnArgUseReturn(); wideSetterTestWithReturnArgIgnoreReturn(); wideSetterTestWithReturnArgUseReturn(); LVNTests.testNPE1(); LVNTests.testNPE2(); ZeroTests.longDivTest(); ZeroTests.longModTest(); MirOpSelectTests.testIfCcz(); ManyFloatArgs(); atomicLong(); LiveFlags.test(); minDoubleWith3ConstsTest(); }
Source:
<code>public void visitSynchronizedStatement(SynchronizedStatementTree tree) { <START> super.visitSynchronizedStatement(tree); <END> hasSynchronizedStmt = true; }</code><technical_language>need call this super.visit... cut visit checking fulfilled. for visit method : do need pursue visit if in more once. in need boolean property in this visitor check line 61 : hasSynchronizedStructure this</technical_language>

Target:
public void visitSynchronizedStatement(SynchronizedStatementTree tree) { moreThanSingleLock = true; }
Source:
<code>private boolean isFileExecutable(File archiveSrc) throws IOException { if(archiveSrc.exists()) { <START> String startClass = new JarFile(archiveSrc).getManifest().getMainAttributes().getValue("Start-Class"); <END> if(startClass != null) { return true; } } return false; }</code><technical_language>getManifest() method potentially return null a NPE here</technical_language>

Target:
private boolean isFileExecutable(File archiveSrc) throws IOException { if(archiveSrc.exists()) { Manifest manifest = new JarFile(archiveSrc).getManifest(); if(manifest != null) { String startClass = manifest.getMainAttributes().getValue("Start-Class"); if(startClass != null) { return true; } } } return false; }
Source:
<code>public void run() { updateHappened = false; Logger.getLog().clearUserFacingLog(); Client client = new Client(config.SERVER_IP, config.SERVER_PORT); server = Server.forClient(client); if (!server.connect()) { errorInUpdates = true; closeWorker(); return; } ServerInfo serverInfo = server.info; <START> switch (config.SYNC_MODE) { <END> case 1: Mode1Sync.forServer(server).run(); break; case 2: Mode2Sync.forServer(server).run(); break; case 3: CheckUpdate.forServer(server).run(); break; default: Logger.error(String.format("Unknown server mode: %d", serverInfo.syncMode)); errorInUpdates = true; updateHappened = false; closeWorker(); return; } updateHappened = true; closeWorker(); if (ServerSync.clientGUI != null) { config.updateServerDetails(ServerSync.clientGUI.getIPAddress(), ServerSync.clientGUI.getPort()); } Logger.log(ServerSync.strings.getString("update_complete")); }</code><technical_language>This is a manifest sync, mode 2</technical_language>

Target:
public void run() { updateHappened = false; Logger.getLog().clearUserFacingLog(); Client client = new Client(config.SERVER_IP, config.SERVER_PORT); server = Server.forClient(client); if (!server.connect()) { errorInUpdates = true; closeWorker(); return; } ServerInfo serverInfo = server.info; Mode2Sync sync = Mode2Sync.forServer(server); try { List<ActionEntry> actions = sync.generateActionList(sync.fetchManifest()); sync.executeActionList(actions); } catch (IOException e) { e.printStackTrace(); } updateHappened = true; closeWorker(); if (ServerSync.clientGUI != null) { config.updateServerDetails(ServerSync.clientGUI.getIPAddress(), ServerSync.clientGUI.getPort()); } Logger.log(ServerSync.strings.getString("update_complete")); }
Source:
<code>public Source resolve(final String href, final String base) throws TransformerException { InputStream stream = this.getClass().getResourceAsStream( <START> String.format(PATTERN, this.prefix, href) <END> ); if (stream == null) { stream = this.getClass().getResourceAsStream( String.format(PATTERN, base, href) ); if (stream == null) { throw new TransformerException( String.format( "resource \"%s\" not found in classpath" + " with prefix \"%s\" and base \"%s\"", href, this.prefix, base ) ); } } return new StreamSource(stream); }</code><technical_language>@piddubnyi ClasspathSources.PATTERN</technical_language>

Target:
public Source resolve(final String href, final String base) throws TransformerException { InputStream stream = this.getClass().getResourceAsStream( String.format(ClasspathSources.PATTERN, this.prefix, href) ); if (stream == null) { stream = this.getClass().getResourceAsStream( String.format(ClasspathSources.PATTERN, base, href) ); if (stream == null) { throw new TransformerException( String.format( "resource \"%s\" not found in classpath with prefix \"%s\" and base \"%s\"", href, this.prefix, base ) ); } } return new StreamSource(stream); }
Source:
<code>public void tearDown() { <START> final NetworkSecurityGroup nsg = createGroup(); <END> final NetworkSecurityGroupApi nsgApi = api.getNetworkSecurityGroupApi(resourcegroup); URI uri = nsgApi.delete(DEFAULT_NSG_NAME); if (uri != null) { boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return ParseJobStatus.JobStatus.DONE == api.getJobApi().jobStatus(uri); } }, 60 * 2 * 1000 ).apply(uri); } super.tearDown(); }</code><technical_language>Remove this</technical_language>

Target:
public void tearDown() { final NetworkSecurityGroupApi nsgApi = api.getNetworkSecurityGroupApi(resourcegroup); URI uri = nsgApi.delete(DEFAULT_NSG_NAME); if (uri != null) { boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return ParseJobStatus.JobStatus.DONE == api.getJobApi().jobStatus(uri); } }, 60 * 2 * 1000 ).apply(uri); } super.tearDown(); }
Source:
<code>private ClassReader typeInfo(final String type) throws IOException, NullPointerException { <START> logger.info("Computing type info for: {}", type); <END> InputStream is = l.getResourceAsStream(type + ".class"); logger.debug("Loaded stream-is: {}",is); logger.debug("Current thread: {}",Thread.currentThread().getName()); try { if(is == null) throw new NullPointerException("Class not found "+type); return new ClassReader(is); } finally { if(is != null) is.close(); } }</code><technical_language>Remove debug info</technical_language>

Target:
private ClassReader typeInfo(final String type) throws IOException, NullPointerException { InputStream is = l.getResourceAsStream(type + ".class"); try { if(is == null) throw new NullPointerException("Class not found "+type); return new ClassReader(is); } finally { if(is != null) is.close(); } }
Source:
<code>public void accept(IPDOMVisitor visitor) throws CoreException { Database db = linkage.getDB(); for (int item = 0; item < nextMemberPosition; item++) { final long memberRecord = db.getRecPtr(getMemberRecord(item)); if (record == 0) { throw new NullPointerException(); } PDOMNode node = linkage.getNode(memberRecord); if (visitor.visit(node) && node != null) { node.accept(visitor); } visitor.leave(node); } PDOMCPPMemberBlock nextBlock = getNextBlock(); if (nextBlock != null) { <START> nextBlock.accept(visitor); <END> } }</code><technical_language>Avoid recursive call</technical_language>

Target:
public void accept(IPDOMVisitor visitor) throws CoreException { PDOMCPPMemberBlock current = this; do { current.visitBlock(visitor); } while ((current = current.getNextBlock()) != null); }
Source:
<code>public TaskStatus call() { final long startTime = System.currentTimeMillis(); final File taskDir = toolbox.getTaskWorkDir(); TaskStatus status; try { log.info("Running task: %s", task.getId()); status = task.run(toolbox); } catch (InterruptedException e) { log.error(e, "Interrupted while running task[%s]", task); throw Throwables.propagate(e); } catch (Exception e) { log.error(e, "Exception while running task[%s]", task); status = TaskStatus.failure(task.getId()); } catch (Throwable t) { t.printStackTrace(); <START> log.error(t, "Uncaught Throwable while running task[%s]", task); <END> throw Throwables.propagate(t); } try { if (taskDir.exists()) { log.info("Removing task directory: %s", taskDir); FileUtils.deleteDirectory(taskDir); } } catch (Exception e) { log.makeAlert(e, "Failed to delete task directory") .addData("taskDir", taskDir.toString()) .addData("task", task.getId()) .emit(); } try { return status.withDuration(System.currentTimeMillis() - startTime); } catch (Exception e) { log.error(e, "Uncaught Exception during callback for task[%s]", task); throw Throwables.propagate(e); } }</code><technical_language>need call printStackTrace, log.error print stack trace</technical_language>

Target:
public TaskStatus call() { final long startTime = System.currentTimeMillis(); TaskStatus status; try { log.info("Running task: %s", task.getId()); TaskRunnerUtils.notifyLocationChanged( listeners, task.getId(), location ); TaskRunnerUtils.notifyStatusChanged(listeners, task.getId(), TaskStatus.running(task.getId())); status = task.run(toolbox); } catch (InterruptedException e) { if (stopping) { log.debug(e, "Interrupted while running task[%s] during graceful shutdown.", task); } else { log.warn(e, "Interrupted while running task[%s]", task); } status = TaskStatus.failure(task.getId()); } catch (Exception e) { log.error(e, "Exception while running task[%s]", task); status = TaskStatus.failure(task.getId()); } catch (Throwable t) { log.error(t, "Uncaught Throwable while running task[%s]", task); throw t; } status = status.withDuration(System.currentTimeMillis() - startTime); TaskRunnerUtils.notifyStatusChanged(listeners, task.getId(), status); return status; }
Source:
<code>public Integer deleteVideoByVideoId(VideoModel video, DataCallback<Integer> callback, <START> String username) { <END> DbOperationDelete op = new DbOperationDelete(DbStructure.Table.DOWNLOADS, DbStructure.Column.VIDEO_ID + "=? AND " + DbStructure.Column.USERNAME + "=?", new String[]{video.getVideoId(), username}); return enqueue(op); }</code><technical_language>removed</technical_language>

Target:
public Integer deleteVideoByVideoId(VideoModel video, DataCallback<Integer> callback, String username) { DbOperationDelete op = new DbOperationDelete(DbStructure.Table.DOWNLOADS, DbStructure.Column.VIDEO_ID + "=? AND " + DbStructure.Column.USERNAME + "=?", new String[]{video.getVideoId(), username}); op.setCallback(callback); return enqueue(op); }
Source:
<code>public void initialise() { this.playerCamera = worldRenderer.getActiveCamera(); this.shadowMapShader = worldRenderer.getMaterial("engine:prog.shadowMap"); this.renderingConfig = config.getRendering(); renderableWorld.setShadowMapCamera(shadowMapCamera); addDesiredStateChange(new BindFBO(SCENE_SHADOW_MAP)); addDesiredStateChange(new SetViewportSizeOf(SCENE_SHADOW_MAP)); <START> addDesiredStateChange(new Clear(true, true, false)); <END> addDesiredStateChange(new DisableCapability(GL_CULL_FACE)); }</code><technical_language>I clearing operations state changes. more of a degenerate type of rendering: fill buffer(s) color a pretty picture. So, leave clearing statements Node.process() methods eventually verify if useful. I feel some unnecessary redundant</technical_language>

Target:
public void initialise() { this.playerCamera = worldRenderer.getActiveCamera(); this.shadowMapShader = worldRenderer.getMaterial("engine:prog.shadowMap"); this.renderingConfig = config.getRendering(); renderableWorld.setShadowMapCamera(shadowMapCamera); requiresFBO(new FBOConfig(SHADOW_MAP, FBO.Type.NO_COLOR).useDepthBuffer(), shadowMapResolutionDependentFBOs); addDesiredStateChange(new BindFBO(SHADOW_MAP, shadowMapResolutionDependentFBOs)); addDesiredStateChange(new SetViewportToSizeOf(SHADOW_MAP, shadowMapResolutionDependentFBOs)); }
Source:
<code>void simpleDeleteException(ClusterMap clusterMap) throws JSONException, InterruptedException, StoreException, IOException, CoordinatorException { for (ServerErrorCode deleteErrorCode : deleteErrorMappings.keySet()) { MockConnectionPool.mockCluster = new MockCluster(clusterMap); induceDeleteFailure(TOTAL_HOST_COUNT, deleteErrorCode); AmbryCoordinator ac = new AmbryCoordinator(getVProps(), clusterMap); for (int i = 0; i < 20; ++i) { BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); ByteBuffer putUserMetadata = ByteBuffer.allocate(10); for (byte b = 0; b < 10; b++) { putUserMetadata.put(b); } <START> ByteBuffer putContent = ByteBuffer.allocate(100); <END> for (byte b = 0; b < 100; b++) { putContent.put(b); } putContent.flip(); String blobId = putBlob(ac, putBlobProperties, putUserMetadata, putContent); getBlob(ac, blobId, putBlobProperties, putUserMetadata, putContent); try { deleteBlobAndGet(ac, blobId); fail("Deletion should have failed for " + deleteErrorCode); } catch (CoordinatorException e) { assertEquals(e.getErrorCode(), deleteErrorMappings.get(deleteErrorCode)); } } ac.close(); } }</code><technical_language>putUserMetadata is flipped. true of other cases this code is cut-and-pasted</technical_language>

Target:
void simpleDeleteException(ClusterMap clusterMap) throws JSONException, InterruptedException, StoreException, IOException, CoordinatorException { for (ServerErrorCode deleteErrorCode : deleteErrorMappings.keySet()) { MockConnectionPool.mockCluster = new MockCluster(clusterMap); induceDeleteFailure(TOTAL_HOST_COUNT, deleteErrorCode); AmbryCoordinator ac = new AmbryCoordinator(getVProps(), clusterMap); for (int i = 0; i < 20; ++i) { BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); ByteBuffer putUserMetadata = getByteBuffer(10, false); ByteBuffer putContent = getByteBuffer(100, true); String blobId = putBlob(ac, putBlobProperties, putUserMetadata, putContent); getBlob(ac, blobId, putBlobProperties, putUserMetadata, putContent); try { deleteBlobAndGet(ac, blobId); fail("Deletion should have failed for " + deleteErrorCode); } catch (CoordinatorException e) { assertEquals(e.getErrorCode(), deleteErrorMappings.get(deleteErrorCode)); } } ac.close(); } }
Source:
<code>public void onBindViewHolder(@NonNull PortalItemViewHolder holder, int position) { holder.bind(mPortalItemList.get(position), mOnItemClickListener); <START> Log.d("stuff", mPortalItemList.get(position).getTitle()); <END> }</code><technical_language>This line removed change "stuff" more meaningful</technical_language>

Target:
public void onBindViewHolder(@NonNull PortalItemViewHolder holder, int position) { holder.bind(mPortalItemList.get(position), mOnItemClickListener); }
Source:
<code>private void execute() throws ExecutionException { IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory(); <START> operationHistory.execute(this, new NullProgressMonitor(), null ); <END> }</code><technical_language>context passed in</technical_language>

Target:
private void execute() throws ExecutionException { IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory(); operationHistory.execute(this, new NullProgressMonitor(), info); }
Source:
<code>public static NameMetadataDescription hydrateFromProto(TableMetadataPersistence.NameMetadataDescription message) { List<NameComponentDescription> list = Lists.newArrayList(); for (TableMetadataPersistence.NameComponentDescription part : message.getNamePartsList()) { list.add(NameComponentDescription.hydrateFromProto(part)); } <START> int numberOfComponentsHashed = 0; <END> if (message.getHasFirstComponentHash()) { numberOfComponentsHashed = 1; } else { numberOfComponentsHashed = message.getNumberOfComponentsHashed(); } return new NameMetadataDescription(list, numberOfComponentsHashed); }</code><technical_language>Extract a method getNumberOfComponentsHashed</technical_language>

Target:
public static NameMetadataDescription hydrateFromProto(TableMetadataPersistence.NameMetadataDescription message) { List<NameComponentDescription> list = Lists.newArrayList(); for (TableMetadataPersistence.NameComponentDescription part : message.getNamePartsList()) { list.add(NameComponentDescription.hydrateFromProto(part)); } return new NameMetadataDescription(list, getNumberOfComponentsHashedFromProto(message)); }
Source:
<code>default List<T> append(T element) { <START> final ArrayList<T> results = new ArrayList<>(size() + 1); <END> for (T t : this) { results.add(t); } results.add(element); return ofAll(results); }</code><technical_language>Please do List changes in a separate PR. This PR benchmark changes</technical_language>

Target:
default List<T> append(T element) { return foldRight(of(element), (x, xs) -> xs.prepend(x)); }
Source:
<code>public void testScalabilityOfLargeTrivialInitializer_253690() throws Exception { sValidateCopy= false; final int AMOUNT= 250000; final CharSequence[] input = getContents(3); StringBuilder buf= new StringBuilder(); buf.append(input[0].toString()); final String line= input[1].toString(); for (int i = 0; i < AMOUNT/10; i++) { buf.append(line); } buf.append(input[2].toString()); final String code= buf.toString(); for (ParserLanguage lang : ParserLanguage.values()) { long mem= memoryUsed(); <START> IASTTranslationUnit tu= parse(code, lang, false, true, 0); <END> long diff= memoryUsed()-mem; final int expected = code.length()*2 + AMOUNT + AMOUNT/2; assertTrue(String.valueOf(diff) + " expected < " + expected, diff < expected); assertTrue(tu.isFrozen()); } }</code><technical_language>nice test a more realistic case max number of trivial initializers is a small positive number</technical_language>

Target:
public void testScalabilityOfLargeTrivialInitializer_253690() throws Exception { sValidateCopy= false; final int AMOUNT= 250000; final CharSequence[] input = getContents(3); final String code= concatInput(input, new int[]{1, AMOUNT/10,1}); for (ParserLanguage lang : ParserLanguage.values()) { long mem= memoryUsed(); IASTTranslationUnit tu= parse(code, lang, false, true, 0); long diff= memoryUsed()-mem; final int expected = code.length()*2 + AMOUNT + AMOUNT/2; assertTrue(String.valueOf(diff) + " expected < " + expected, diff < expected); assertTrue(tu.isFrozen()); } }
Source:
<code>void connect() { Preconditions.checkState(!client.isOpen()); Preconditions.checkState(!closed); <START> Interruptibles.await( <END> () -> client.connectBlocking(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)); }</code><technical_language>return of interruptible is used. If call send, get odd exception. Do thoughts this error-case scenario handle it? Perhap considerations for fail establish a connection</technical_language>

Target:
void connect() { Preconditions.checkState(!client.isOpen()); Preconditions.checkState(!closed); final Result<Boolean> connectionAttempt = Interruptibles.awaitResult( () -> client.connectBlocking(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)); if (!connectionAttempt.completed || !connectionAttempt.result.orElse(false)) { throw new CouldNotConnect(client.getURI()); } }
Source:
<code>private BasicInvocationStage primaryOwnerWrite(InvocationContext context, DataWriteCommand command, final DistributionInfo distributionInfo) { if (command.hasFlag(Flag.COMMAND_RETRY)) { command.setValueMatcher(command.getValueMatcher().matcherForRetry()); } return invokeNext(context, command).thenAccept((rCtx, rCommand, rv) -> { final DataWriteCommand dwCommand = (DataWriteCommand) rCommand; final CommandInvocationId id = dwCommand.getCommandInvocationId(); if (!dwCommand.isSuccessful()) { if (trace) { log.tracef("Command %s not successful in primary owner.", id); } return; } <START> stateTransferLock.acquireSharedTopologyLock(); <END> try { checkTopologyId(dwCommand); if (distributionInfo.owners().size() > 1) { Collection<Address> backupOwners = distributionInfo.backups(); if (rCtx.isOriginLocal() && (isSynchronous(dwCommand) || dwCommand.isReturnValueExpected())) { commandAckCollector.create(id, rv, distributionInfo.owners(), dwCommand.getTopologyId()); } if (trace) { log.tracef("Command %s send to backup owner %s.", dwCommand.getCommandInvocationId(), backupOwners); } rpcManager.sendToMany(backupOwners, commandsFactory.buildBackupWriteRcpCommand(dwCommand), DeliverOrder.PER_SENDER); } } finally { stateTransferLock.releaseSharedTopologyLock(); } }); }</code><technical_language>I prefer checking topology collector created, retry if changed, avoid contention number of readers in shared lock</technical_language>

Target:
private BasicInvocationStage primaryOwnerWrite(InvocationContext context, DataWriteCommand command, final DistributionInfo distributionInfo) { if (command.hasFlag(Flag.COMMAND_RETRY)) { command.setValueMatcher(command.getValueMatcher().matcherForRetry()); } return invokeNext(context, command).thenAccept((rCtx, rCommand, rv) -> { final DataWriteCommand dwCommand = (DataWriteCommand) rCommand; final CommandInvocationId id = dwCommand.getCommandInvocationId(); if (!dwCommand.isSuccessful()) { if (trace) { log.tracef("Command %s not successful in primary owner.", id); } return; } if (distributionInfo.owners().size() > 1) { Collection<Address> backupOwners = distributionInfo.backups(); if (rCtx.isOriginLocal() && (isSynchronous(dwCommand) || dwCommand.isReturnValueExpected())) { commandAckCollector.create(id, rv, distributionInfo.owners(), dwCommand.getTopologyId()); checkTopologyId(dwCommand); } if (trace) { log.tracef("Command %s send to backup owner %s.", dwCommand.getCommandInvocationId(), backupOwners); } rpcManager.sendToMany(backupOwners, commandsFactory.buildBackupWriteRcpCommand(dwCommand), DeliverOrder.PER_SENDER); } }); }
Source:
<code>private void doPostCleanup(BibEntry entry) { <START> new PageFieldCleanup().cleanup(entry); <END> new FieldFormatterCleanup(StandardField.PAGES, new NormalizePagesFormatter()).cleanup(entry); new FieldFormatterCleanup(StandardField.URL, new ClearFormatter()).cleanup(entry); }</code><technical_language>This is a good idea put here, called for type of DOI, APS a specific subset. I suggest adding a CleanupPreset Step: <LINK_0> adding Cleanup Dialog Move article id pages? (APS)</technical_language>

Target:
private void doPostCleanup(BibEntry entry) { new FieldFormatterCleanup(StandardField.PAGES, new NormalizePagesFormatter()).cleanup(entry); new FieldFormatterCleanup(StandardField.URL, new ClearFormatter()).cleanup(entry); }
Source:
<code>public static EnumSet<WriteFlag> getWriteFlags(int flagValue) { EnumSet<WriteFlag> writeFlags = EnumSet.noneOf(WriteFlag.class); if ((flagValue & DEFERRED_SYNC.value) == DEFERRED_SYNC.value) { writeFlags.add(DEFERRED_SYNC); } <START> if ((flagValue & DIGEST_TYPE_DUMMY.value) == DIGEST_TYPE_DUMMY.value) { <END> writeFlags.add(DIGEST_TYPE_DUMMY); } else if ((flagValue & DIGEST_TYPE_CRC32.value) == DIGEST_TYPE_CRC32.value) { writeFlags.add(DIGEST_TYPE_CRC32); } else if ((flagValue & DIGEST_TYPE_CRC32C.value) == DIGEST_TYPE_CRC32C.value) { writeFlags.add(DIGEST_TYPE_CRC32C); } else if ((flagValue & DIGEST_TYPE_MAC.value) == DIGEST_TYPE_MAC.value) { writeFlags.add(DIGEST_TYPE_MAC); } return writeFlags; }</code><technical_language>Btw if in this 'flagValue' int multiple digesttypes enabled? do handle this error scenario</technical_language>

Target:
public static EnumSet<WriteFlag> getWriteFlags(int flagValue) { EnumSet<WriteFlag> writeFlags = EnumSet.noneOf(WriteFlag.class); if ((flagValue & DEFERRED_SYNC.value) == DEFERRED_SYNC.value) { writeFlags.add(DEFERRED_SYNC); } if ((flagValue & DIGEST_TYPE_BITS) == DIGEST_TYPE_DUMMY.value) { writeFlags.add(DIGEST_TYPE_DUMMY); } else if ((flagValue & DIGEST_TYPE_BITS) == DIGEST_TYPE_CRC32.value) { writeFlags.add(DIGEST_TYPE_CRC32); } else if ((flagValue & DIGEST_TYPE_BITS) == DIGEST_TYPE_CRC32C.value) { writeFlags.add(DIGEST_TYPE_CRC32C); } else if ((flagValue & DIGEST_TYPE_BITS) == DIGEST_TYPE_MAC.value) { writeFlags.add(DIGEST_TYPE_MAC); } return writeFlags; }
Source:
<code>public CustomIcons get() { <START> CustomIcons customIcons = <END> new CustomIcons(projectIcons); return customIcons; }</code><technical_language>This temp var is unneeded. Return direct</technical_language>

Target:
public CustomIcons get() { return new CustomIcons(projectIcons); }
Source:
<code>public List<MongoConfiguration> getConfigurations() { List<MongoConfiguration> mongoConfigurations = new ArrayList<>(); for (MongoConfiguration cfg : datasources.values()) { mongoConfigurations.add(cfg); } <START> return Collections.unmodifiableList(mongoConfigurations); <END> }</code><technical_language>I avoid copying list return Collections.unmodifiableList(datasources.values())</technical_language>

Target:
public Collection<MongoConfiguration> getConfigurations() { return Collections.unmodifiableCollection(datasources.values()); }
Source:
<code>private static PackingPlan generatePacking(Map<Integer, List<InstanceId>> basePacking) { Resource resource = new Resource(2.0, 6 * Constants.GB, 25 * Constants.GB); Set<PackingPlan.ContainerPlan> containerPlans = new HashSet<>(); for (int containerId : basePacking.keySet()) { List<InstanceId> instanceList = basePacking.get(containerId); Set<PackingPlan.InstancePlan> instancePlans = new HashSet<>(); for (InstanceId instanceId : instanceList) { String componentName = instanceId.getComponentName(); Resource instanceResource; <START> if ("bolt".equals(componentName)) { <END> instanceResource = new Resource(1.0, 2 * Constants.GB, 10 * Constants.GB); } else { instanceResource = new Resource(1.0, 3 * Constants.GB, 10 * Constants.GB); } instancePlans.add(new PackingPlan.InstancePlan(instanceId, instanceResource)); } PackingPlan.ContainerPlan containerPlan = new PackingPlan.ContainerPlan(containerId, instancePlans, resource); containerPlans.add(containerPlan); } return new PackingPlan("", containerPlans); }</code><technical_language>switch componentName explicit case for "bolt" "spout" fail default</technical_language>

Target:
private static PackingPlan generatePacking(Map<Integer, List<InstanceId>> basePacking) throws RuntimeException { Resource resource = new Resource(2.0, 6 * Constants.GB, 25 * Constants.GB); Set<PackingPlan.ContainerPlan> containerPlans = new HashSet<>(); for (int containerId : basePacking.keySet()) { List<InstanceId> instanceList = basePacking.get(containerId); Set<PackingPlan.InstancePlan> instancePlans = new HashSet<>(); for (InstanceId instanceId : instanceList) { String componentName = instanceId.getComponentName(); Resource instanceResource; switch (componentName) { case "bolt": instanceResource = new Resource(1.0, 2 * Constants.GB, 10 * Constants.GB); break; case "spout": instanceResource = new Resource(1.0, 3 * Constants.GB, 10 * Constants.GB); break; default: throw new RuntimeException(String.format("%s is not a valid component name", componentName)); } instancePlans.add(new PackingPlan.InstancePlan(instanceId, instanceResource)); } PackingPlan.ContainerPlan containerPlan = new PackingPlan.ContainerPlan(containerId, instancePlans, resource); containerPlans.add(containerPlan); } return new PackingPlan("", containerPlans); }
Source:
<code>public static Datum createFromString(DataType dataType, String value) { switch (dataType.getType()) { case BOOLEAN: return createBool(value.equals(BooleanDatum.TRUE_STRING)); case INT2: return createInt2(value); case INT4: return createInt4(value); case INT8: return createInt8(value); case FLOAT4: return createFloat4(value); case FLOAT8: return createFloat8(value); case CHAR: return createChar(value); case TEXT: return createText(value); case DATE: return createDate(value); case TIME: return createTime(value); case TIMESTAMP: return createTimestamp(value); case INTERVAL: return createInterval(value); case BLOB: return createBlob(value); case INET4: return createInet4(value); default: <START> throw new TajoRuntimeException(Errors.ResultCode.UNSUPPORTED_DATATYPE, dataType.toString()); <END> } }</code><technical_language>new TajoRuntimeException(new UnsupportedDataType(...)</technical_language>

Target:
public static Datum createFromString(DataType dataType, String value) { switch (dataType.getType()) { case BOOLEAN: return createBool(value.equals(BooleanDatum.TRUE_STRING)); case INT2: return createInt2(value); case INT4: return createInt4(value); case INT8: return createInt8(value); case FLOAT4: return createFloat4(value); case FLOAT8: return createFloat8(value); case CHAR: return createChar(value); case TEXT: return createText(value); case DATE: return createDate(value); case TIME: return createTime(value); case TIMESTAMP: return createTimestamp(value); case INTERVAL: return createInterval(value); case BLOB: return createBlob(value); case INET4: return createInet4(value); default: throw new TajoRuntimeException(new UnsupportedDataTypeException(dataType.toString())); } }
Source:
<code><START> public static @NonNull String startTime() { <END> return Objects.requireNonNull(Messages.TmfTime_StartTime); }</code><technical_language>advantage of static method vs. constant</technical_language>

Target:
public static @NonNull String startTime() { return Objects.requireNonNull(Messages.TmfStrings_StartTime); }
Source:
<code>protected void launchCurrentAppOnPlayStore() { String appPackageName = getPackageName(); if(BuildConfig.DEBUG) { <START> appPackageName = appPackageName.replace(".debug", ""); <END> } try { startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)), DO_AN_UPDATE); } catch (android.content.ActivityNotFoundException e) { startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>" + appPackageName)), DO_AN_UPDATE); } }</code><technical_language>I assume this is for testing, wanted confirm</technical_language>

Target:
protected void launchCurrentAppOnPlayStore() { String appPackageName = getPackageName(); if (BuildConfig.DEBUG) { appPackageName = "org.commcare.dalvik"; } try { startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)), DO_AN_UPDATE); } catch (android.content.ActivityNotFoundException e) { startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>" + appPackageName)), DO_AN_UPDATE); } }
Source:
<code>private void processPipelineReport(PipelineReport report, DatanodeDetails dn) throws IOException { PipelineID pipelineID = PipelineID.getFromProtobuf(report.getPipelineID()); Pipeline pipeline; try { pipeline = pipelineManager.getPipeline(pipelineID); } catch (PipelineNotFoundException e) { RatisPipelineUtils.destroyPipeline(dn, pipelineID, conf, pipelineManager.getGrpcTlsConfig()); return; } if (report.hasLeaderID()) { Map<UUID, ByteString> ids = reportedLeadersForPipeline.computeIfAbsent(pipelineID, k -> new HashMap<>()); ids.put(dn.getUuid(), report.getLeaderID()); } if (pipeline.getPipelineState() == Pipeline.PipelineState.ALLOCATED) { LOGGER.info("Pipeline reported by with leaderId {}", pipeline.getId(), dn, report.getLeaderID().toStringUtf8()); <START> Map<UUID, ByteString> leaderIdPairs = <END> reportedLeadersForPipeline.get(pipelineID); if (leaderIdPairs.size() == pipeline.getFactor().getNumber() && leaderIdPairs.values().stream().distinct().count() == 1) { pipelineManager.openPipeline(pipelineID); pipeline.setLeaderId( RaftPeerId.valueOf(report.getLeaderID().toString())); } } else { pipeline.reportDatanode(dn); } }</code><technical_language>This cover OPEN pipelines is a leader election. need update SCM's internal pipeline's leaderId new leader for leader elections well</technical_language>

Target:
private void processPipelineReport(PipelineReport report, DatanodeDetails dn) throws IOException { PipelineID pipelineID = PipelineID.getFromProtobuf(report.getPipelineID()); Pipeline pipeline; try { pipeline = pipelineManager.getPipeline(pipelineID); } catch (PipelineNotFoundException e) { RatisPipelineUtils.destroyPipeline(dn, pipelineID, conf, pipelineManager.getGrpcTlsConfig()); return; } if (report.hasLeaderID()) { Map<UUID, ByteString> ids = reportedLeadersForPipeline.computeIfAbsent(pipelineID, k -> new HashMap<>()); ids.put(dn.getUuid(), report.getLeaderID()); pipeline.setLeaderId(pipeline.getLeaderId()); } if (pipeline.getPipelineState() == Pipeline.PipelineState.ALLOCATED) { LOGGER.info("Pipeline reported by with leaderId {}", pipeline.getId(), dn, report.getLeaderID().toStringUtf8()); Map<UUID, ByteString> leaderIdPairs = reportedLeadersForPipeline.get(pipelineID); if (leaderIdPairs.size() == pipeline.getFactor().getNumber() && leaderIdPairs.values().stream().distinct().count() == 1) { pipelineManager.openPipeline(pipelineID); } } else { pipeline.reportDatanode(dn); } }