auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Test public void testJsonType() { tester.setFor(SqlStdOperatorTable.JSON_TYPE); tester.checkString("json_type('1')", "INTEGER", "VARCHAR(20) NOT NULL"); <START> tester.checkString("json_type('11.45')", <END> "DOUBLE", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('true')", "BOOLEAN", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('\"hello\"')", "STRING", "VARCHAR(20) NOT NULL"); tester.checkString("json_type(null)", "NULL", "VARCHAR(20) NOT NULL"); tester.checkString("json_type(cast(null as varchar(1)))", "NULL", "VARCHAR(20) NOT NULL"); tester.checkString("json_type(timestamp '2016-02-24 12:42:25')", "LONG", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('[\"foo\",null]')", "ARRAY", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('{\"foo\":100}')", "OBJECT", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('{}')", "OBJECT", "VARCHAR(20) NOT NULL"); tester.checkString("json_type(cast(2 as float))", "DOUBLE", "VARCHAR(20) NOT NULL"); }</code><technical_language>I guess right case java tester.checkString("json_type('1')", "INTEGER", "VARCHAR(20) NULL");</technical_language>

Target:
@Test public void testJsonType() { tester.setFor(SqlStdOperatorTable.JSON_TYPE); tester.checkString("json_type('\"1\"')", "STRING", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('1')", "INTEGER", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('11.45')", "DOUBLE", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('true')", "BOOLEAN", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('null')", "NULL", "VARCHAR(20) NOT NULL"); tester.checkString("json_type(cast(null as varchar(1)))", "NULL", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('{\"a\": [10, true]}')", "OBJECT", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('{}')", "OBJECT", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('[10, true]')", "ARRAY", "VARCHAR(20) NOT NULL"); tester.checkString("json_type('\"2019-01-27 21:24:00\"')", "STRING", "VARCHAR(20) NOT NULL"); }
Source:
<code>void shutdown() throws InterruptedException { compactionManager.disable(); for (Map.Entry<PartitionId, BlobStore> partitionAndStore : stores.entrySet()) { try { partitionAndStore.getValue().shutdown(); } catch (Exception e) { logger.error( "Exception while shutting down store for partition " + partitionAndStore.getKey() + " on disk " + disk); } } longLivedTaskScheduler.shutdown(); if (!longLivedTaskScheduler.awaitTermination(30, TimeUnit.SECONDS)) { <START> logger.error("Could not terminate long live tasks after DiskManager shutdown"); <END> } compactionManager.awaitTermination(); diskIOScheduler.close(); }</code><technical_language>terminate long lived task "scheduler" ..</technical_language>

Target:
void shutdown() throws InterruptedException { long startTimeMs = time.milliseconds(); try { compactionManager.disable(); diskIOScheduler.disable(); final AtomicInteger numFailures = new AtomicInteger(0); List<Thread> shutdownThreads = new ArrayList<>(); for (final Map.Entry<PartitionId, BlobStore> partitionAndStore : stores.entrySet()) { Thread thread = Utils.newThread("store-shutdown-" + partitionAndStore.getKey(), new Runnable() { @Override public void run() { try { partitionAndStore.getValue().shutdown(); } catch (Exception e) { numFailures.incrementAndGet(); metrics.totalStoreShutdownFailures.inc(); logger.error("Exception while shutting down store on disk {}", partitionAndStore.getKey(), disk, e); } } }, false); thread.start(); shutdownThreads.add(thread); } for (Thread shutdownThread : shutdownThreads) { shutdownThread.join(); } if (numFailures.get() > 0) { logger.error( "Could not shutdown " + numFailures.get() + " out of " + stores.size() + " stores on the disk " + disk); } compactionManager.awaitTermination(); longLivedTaskScheduler.shutdown(); if (!longLivedTaskScheduler.awaitTermination(30, TimeUnit.SECONDS)) { logger.error("Could not terminate long live tasks after DiskManager shutdown"); } } finally { metrics.diskShutdownTimeMs.update(time.milliseconds() - startTimeMs); } }
Source:
<code>protected byte[] applyMessage(RuntimeEnvironment env) throws Exception { String ret = null; String msgtext = getText(); switch (msgtext) { case "get-repo-type": <START> List<String> types = new ArrayList<>(); <END> for (String tag: getTags()) { boolean found = false; for (RepositoryInfo ri : env.getRepositories()) { if (ri.getDirectoryNameRelative().equals(tag)) { types.add(ri.getType()); found = true; break; } } if (!found) { types.add("N/A"); } } ret = types.stream().collect(Collectors.joining("\n")).toString(); break; } return ret.getBytes(); }</code><technical_language>a linked list? array list capacity? reduce unnecessary overhead</technical_language>

Target:
protected byte[] applyMessage(RuntimeEnvironment env) throws Exception { String ret = null; String msgtext = getText(); switch (msgtext) { case "get-repo-type": List<String> types = new ArrayList<>(16); for (String tag: getTags()) { boolean found = false; for (RepositoryInfo ri : env.getRepositories()) { if (ri.getDirectoryNameRelative().equals(tag)) { types.add(tag + ":" + ri.getType()); found = true; break; } } if (!found) { types.add(tag + ":N/A"); } } ret = types.stream().collect(Collectors.joining("\n")); break; } return ret.getBytes(); }
Source:
<code>public static void restoreDefaults() throws Exception { registryManager.removeAllRegistryEntries(); LogManager.resetConfiguration(); try { String logFile = CarbonUtils.getCarbonConfigDirPath() + RegistryConstants.PATH_SEPARATOR + "log4j.properties"; Log4jConfigurer.initLogging(logFile); } catch (FileNotFoundException e) { String msg = "Cannot restore default logging configuration." + " log4j.properties file not found in the classpath"; <START> throw new LogViewerException(msg, e); <END> } }</code><technical_language>Is specific reason for creating a variable for exception message</technical_language>

Target:
public static void restoreDefaults() throws Exception { registryManager.removeAllRegistryEntries(); LogManager.resetConfiguration(); try { String logFile = CarbonUtils.getCarbonConfigDirPath() + RegistryConstants.PATH_SEPARATOR + "log4j.properties"; Log4jConfigurer.initLogging(logFile); } catch (FileNotFoundException e) { String msg = "Cannot restore default logging configuration." + " log4j.properties file is not found in the classpath"; throw new LogViewerException(msg, e); } }
Source:
<code>public static String bytesToBigDecimal(byte[] bytes) { int scale = 0; for (int i = 0; i < 4; i++) { scale += (((int) bytes[i]) << (8 * (3 - i))); } <START> byte[] vals = new byte[bytes.length - 4]; <END> System.arraycopy(bytes, 4, vals, 0, vals.length); BigInteger unscaled = new BigInteger(vals); BigDecimal number = new BigDecimal(unscaled, scale); return number.toString(); }</code><technical_language>This in BIG ENDIAN byte order</technical_language>

Target:
public static String bytesToBigDecimal(byte[] bytes) { BigDecimal number = bytesToBigDecimalObject(bytes); return number.toString(); }
Source:
<code><START> public TimeGraphEntry(@NonNull TimeGraphEntryModel model) { <END> setModel(model); }</code><technical_language>heretic thought experimenting with. TimeGraphEntry require a TimeGraphEntryModel, tree model? Technically, reason require TimeGraphEntryModel get start end time. create new models is a change in end time/name anyway. I ITmfTreeDataModel base of everything: simple tables/tree viewers, xy charts, time graph views. If more specialized classes for some cases, good all, required, else limiting, data provider is linked view displays it. objection? try propose API-disruptive</technical_language>

Target:
public TimeGraphEntry(@NonNull TimeGraphEntryModel model) { fModel = model; fStartTime = model.getStartTime(); fEndTime = model.getEndTime(); }
Source:
<code><START> public JWE verifyAndDecodeJwe(String jweStr, JWEAlgorithmProvider algorithmProvider, JWEEncryptionProvider encryptionProvider) throws JWEException { <END> try { String[] parts = jweStr.split("\\."); if (parts.length != 5) { throw new IllegalStateException("Not a JWE String"); } this.base64Header = parts[0]; this.base64Cek = parts[1]; this.initializationVector = Base64Url.decode(parts[2]); this.encryptedContent = Base64Url.decode(parts[3]); this.authenticationTag = Base64Url.decode(parts[4]); this.header = getHeader(); if (algorithmProvider == null) { throw new IllegalArgumentException("No provider for alg "); } if (encryptionProvider == null) { throw new IllegalArgumentException("No provider for enc "); } keyStorage.setEncryptionProvider(encryptionProvider); byte[] decodedCek = algorithmProvider.decodeCek(Base64Url.decode(base64Cek), keyStorage.getDecryptionKey()); keyStorage.setCEKBytes(decodedCek); encryptionProvider.verifyAndDecodeJwe(this); return this; } catch (Exception e) { throw new JWEException(e); } }</code><technical_language>Similarly above, nice if existing "verifyAndDecodeJwe((String jweStr)" delegates new "verifyAndDecodeJwe(String jweStr, JWEAlgorithmProvider algorithmProvider, JWEEncryptionProvider encryptionProvider)" avoid duplicated code possible</technical_language>

Target:
public JWE verifyAndDecodeJwe(String jweStr, JWEAlgorithmProvider algorithmProvider, JWEEncryptionProvider encryptionProvider) throws JWEException { try { setupJWEHeader(jweStr); return getProcessedJWE(algorithmProvider, encryptionProvider); } catch (Exception e) { throw new JWEException(e); } }
Source:
<code>private static String generateAuthenticateHead( final String user, final String pass ) { final String auth = String.format("%s:%s", user, pass); <START> final String encoded = DatatypeConverter.printBase64Binary( <END> auth.getBytes() ); return String.format("Authorization: Basic %s", encoded); }</code><technical_language>@dmzaytsev inline this</technical_language>

Target:
private static String generateAuthenticateHead( final String user, final String pass ) { return String.format( "Authorization: Basic %s", DatatypeConverter.printBase64Binary( String.format("%s:%s", user, pass).getBytes() ) ); }
Source:
<code>private static boolean canMatchPacket(final ITmfEvent event) { ITmfEventField content = event.getContent(); return <START> ((content.getFieldValue(Long.class, TcpEventStrings.SEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.ACKSEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.FLAGS) == null)); <END> }</code><technical_language>expression negated</technical_language>

Target:
private static boolean canMatchPacket(final ITmfEvent event) { ITmfEventField content = event.getContent(); return !((content.getFieldValue(Long.class, TcpEventStrings.SEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.ACKSEQ) == null) || (content.getFieldValue(Long.class, TcpEventStrings.FLAGS) == null)); }
Source:
<code>private int[][] sanitizeInput(int[][] input) { int teamSize = input.length; int[][] output = new int[teamSize][teamSize]; for (int i = 0; i < teamSize; i++) { for (int j = 0; j < teamSize; j++) { int points = input[i][j]; if (points == Const.POINTS_NOT_SUBMITTED) { output[i][j] = NA; <START> } else if (points == Const.POINTS_NOT_SURE) { <END> output[i][j] = NSU; } else { output[i][j] = points; } } } return output; }</code><technical_language>This condition is needed; NSU Const.POINTS_NOT_SURE else clause suffices. In fact previous code simply change points == Const.POINTS_NOT_SUBMITTED || points == Const.POINTS_NOT_SURE points == Const.POINTS_NOT_SUBMITTED worked expected</technical_language>

Target:
private int[][] sanitizeInput(int[][] input) { int teamSize = input.length; int[][] output = new int[teamSize][teamSize]; for (int i = 0; i < teamSize; i++) { for (int j = 0; j < teamSize; j++) { int points = input[i][j]; boolean pointsNotGiven = points == Const.POINTS_NOT_SUBMITTED; output[i][j] = pointsNotGiven ? NA : points; } } return output; }
Source:
<code>public void exportValues(StringBuilder result) { Formatter formatter = new Formatter(result); final Student student = getStudent(); formatter.format("%s: %s\n", BundleUtil.getString(Bundle.ACADEMIC, "label.ingression"), <START> getIngressionType() == null ? " - " : getIngressionType().getFullDescription().getContent(Locale.getDefault())); <END> formatter.format("%s: %d\n", BundleUtil.getString(Bundle.ACADEMIC, "label.studentNumber"), student.getNumber()); formatter.format("%s: %s\n", BundleUtil.getString(Bundle.ACADEMIC, "label.Student.Person.name"), student.getPerson() .getName()); formatter.format("%s: %s\n", BundleUtil.getString(Bundle.ACADEMIC, "label.degree"), getDegree().getPresentationName()); formatter.close(); }</code><technical_language>getContent()</technical_language>

Target:
public void exportValues(StringBuilder result) { Formatter formatter = new Formatter(result); final Student student = getStudent(); formatter.format("%s: %s\n", BundleUtil.getString(Bundle.ACADEMIC, "label.ingression"), getIngressionType() == null ? " - " : getIngressionType().getDescription().getContent()); formatter.format("%s: %d\n", BundleUtil.getString(Bundle.ACADEMIC, "label.studentNumber"), student.getNumber()); formatter.format("%s: %s\n", BundleUtil.getString(Bundle.ACADEMIC, "label.Student.Person.name"), student.getPerson() .getName()); formatter.format("%s: %s\n", BundleUtil.getString(Bundle.ACADEMIC, "label.degree"), getDegree().getPresentationName()); formatter.close(); }
Source:
<code>public void testConstructor() { int leaderEpoch = 5; long endOffset = 10L; EpochEndOffset epochEndOffset = new EpochEndOffset(Errors.FENCED_LEADER_EPOCH, leaderEpoch, endOffset); <START> verify(leaderEpoch, endOffset, true, Errors.FENCED_LEADER_EPOCH, false, epochEndOffset); <END> }</code><technical_language>nit: a matter of taste I guess, I find tests easier follow assertions inline</technical_language>

Target:
public void testConstructor() { int leaderEpoch = 5; long endOffset = 10L; EpochEndOffset epochEndOffset = new EpochEndOffset(Errors.FENCED_LEADER_EPOCH, leaderEpoch, endOffset); assertEquals(leaderEpoch, epochEndOffset.leaderEpoch()); assertEquals(endOffset, epochEndOffset.endOffset()); assertTrue(epochEndOffset.hasError()); assertEquals(Errors.FENCED_LEADER_EPOCH, epochEndOffset.error()); assertFalse(epochEndOffset.hasUndefinedEpochOrOffset()); }
Source:
<code><START> protected String getProcessVariables() { <END> Diagram diagram = canvasSessionManager.getCurrentSession().getCanvasHandler().getDiagram(); Node selectedElement = getSelectedElement(); String variables = VariableUtils.encodeProcessVariables(diagram, selectedElement); StringBuilder sb = new StringBuilder(); if (!variables.isEmpty()) { sb.append(variables); } String dataObjects = findDataObjects().stream() .map(this::dataObjectToProcessVariableFormat) .collect(Collectors.joining(",")); if (!dataObjects.isEmpty()) { sb.append(dataObjects); } return sb.toString(); }</code><technical_language>moved some helper class for BPMN, receives diagram here</technical_language>

Target:
protected String getProcessVariables() { Diagram diagram = canvasSessionManager.getCurrentSession().getCanvasHandler().getDiagram(); Node selectedElement = getSelectedElement(); String variables = VariableUtils.encodeProcessVariables(diagram, selectedElement); StringBuilder sb = new StringBuilder(); if (!variables.isEmpty()) { sb.append(variables); } String dataObjects = findDataObjects().stream() .map(AssignmentsEditorWidget::dataObjectToProcessVariableFormat) .collect(Collectors.joining(",")); if (!dataObjects.isEmpty()) { sb.append(dataObjects); } return sb.toString(); }
Source:
<code>private Pair<Double, Double> totalCost(final int numWorker, final int numTotalDataInstances, final double numPullsPerMiniBatch, final int availableEvaluators, final List<EvaluatorSummary> workers, final List<EvaluatorSummary> servers) { final double avgNumMiniBatchesPerWorker = Math.ceil((double) numTotalDataInstances / numWorker / miniBatchSize); final double workerThroughputSum = workers.subList(0, numWorker).stream() .mapToDouble(worker -> worker.throughput) .sum(); final double compCost = numTotalDataInstances / workerThroughputSum; final int numServer = availableEvaluators - numWorker; final double serverThroughputSum = servers.subList(0, numServer).stream() .mapToDouble(server -> server.throughput) .sum(); <START> final double commCost = numPullsPerMiniBatch / serverThroughputSum / numServerThreads <END> * numWorker * avgNumMiniBatchesPerWorker; final double totalCost = compCost + commCost; final String costInfo = String.format("{\"numServer\": %d, \"numWorker\": %d, \"totalCost\": %f, " + "\"compCost\": %f, \"commCost\": %f}", numServer, numWorker, totalCost, compCost, commCost); LOG.log(Level.INFO, "CostInfo {0} {1}", new Object[]{System.currentTimeMillis(), costInfo}); return new Pair<>(compCost, commCost); }</code><technical_language>refactoring this preceding statement following? java final double serverThroughputSum = servers.subList(0, numServer).stream() .mapToDouble(server -> server.throughput) .sum() * numServerThreads; final double commCost = numPullsPerMiniBatch / serverThroughputSum * numWorker * avgNumMiniBatchesPerWorker;</technical_language>

Target:
private Pair<Double, Double> totalCost(final int numWorker, final int numTotalDataInstances, final double numPullsPerMiniBatch, final int availableEvaluators, final List<EvaluatorSummary> workers, final List<EvaluatorSummary> servers) { final double avgNumMiniBatchesPerWorker = Math.ceil((double) numTotalDataInstances / numWorker / miniBatchSize); final double workerThroughputSum = workers.subList(0, numWorker).stream() .mapToDouble(worker -> worker.throughput) .sum(); final double compCost = numTotalDataInstances / workerThroughputSum; final int numServer = availableEvaluators - numWorker; final double serverThroughputSum = servers.subList(0, numServer).stream() .mapToDouble(server -> server.throughput) .sum() * serverNumThreads; final double commCost = numPullsPerMiniBatch / serverThroughputSum * numWorker * avgNumMiniBatchesPerWorker; final double totalCost = compCost + commCost; final String costInfo = String.format("{\"numServer\": %d, \"numWorker\": %d, \"totalCost\": %f, " + "\"compCost\": %f, \"commCost\": %f}", numServer, numWorker, totalCost, compCost, commCost); LOG.log(Level.INFO, "CostInfo {0} {1}", new Object[]{System.currentTimeMillis(), costInfo}); return new Pair<>(compCost, commCost); }
Source:
<code><START> public void testInvalidApikeyValidate() throws BugzillaRestException { <END> RepositoryLocation location = new RepositoryLocation(); location.setUrl(actualFixture.getRepositoryUrl()); location.setProxy(null); location.setCredentialsStore(new InMemoryCredentialsStore()); location.setCredentials(AuthenticationType.REPOSITORY, new UserCredentials("tests@mylyn.eclipse.org", "")); location.setProperty(IBugzillaRestConstants.REPOSITORY_USE_API_KEY, Boolean.toString(true)); location.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, "wvkz2SoBMBQEKv6ishp1j7NY1R9l711g5w2afXc8"); BugzillaRestClient client; thrown.expect(BugzillaRestException.class); thrown.expectMessage("The API key you specified is invalid"); client = new BugzillaRestClient(location, connector); assertNotNull(client.getClient()); client.validate(new NullOperationMonitor()); }</code><technical_language>this test sense api keys enabled for a fixture</technical_language>

Target:
public void testInvalidApikeyValidate() throws BugzillaRestException { RepositoryLocation location = new RepositoryLocation(); location.setUrl(actualFixture.getRepositoryUrl()); location.setProxy(null); location.setCredentialsStore(new InMemoryCredentialsStore()); location.setCredentials(AuthenticationType.REPOSITORY, new UserCredentials("tests@mylyn.eclipse.org", "")); location.setProperty(IBugzillaRestConstants.REPOSITORY_USE_API_KEY, Boolean.toString(true)); location.setProperty(IBugzillaRestConstants.REPOSITORY_API_KEY, "wvkz2SoBMBQEKv6ishp1j7NY1R9l711g5w2afXc8"); BugzillaRestClient client; client = new BugzillaRestClient(location, connector); assertNotNull(client.getClient()); thrown.expect(BugzillaRestException.class); thrown.expectMessage("The API key you specified is invalid"); client.validate(new NullOperationMonitor()); }
Source:
<code>private boolean canScheduleVm(VM vm) { return SchedulingManager.getInstance().canSchedule( getVdsGroup(), vm, <START> new ArrayList<Guid>(), END> new ArrayList<Guid>(), vm.getDedicatedVmForVds(), new ArrayList<String>() ); }</code><technical_language>if lists intended empty list (and modified client) return Collections.emptyList()</technical_language>

Target:
private boolean canScheduleVm(VM vm) { List<Guid> blacklist = new ArrayList<Guid>(); if (getVdsId() != null) { blacklist.add(getVdsId()); } return SchedulingManager.getInstance().canSchedule( getVdsGroup(), vm, blacklist, Collections.<Guid> emptyList(), vm.getDedicatedVmForVds(), new ArrayList<String>() ); }
Source:
<code>public Health health() { final int usedMemory = this.jobMetricsService.getUsedMemory(); final JobsMemoryProperties memoryProperties = this.jobsProperties.getMemory(); final int availableMemory = memoryProperties.getMaxSystemMemory() - usedMemory; final int maxJobMemory = memoryProperties.getMaxJobMemory(); final int defaultJobMemory = memoryProperties.getDefaultJobMemory(); final Health.Builder builder; if (availableMemory >= maxJobMemory) { builder = Health.up(); } else { builder = Health.outOfService(); } return builder .withDetail(NUMBER_RUNNING_JOBS_KEY, this.jobMetricsService.getNumActiveJobs()) .withDetail(USED_MEMORY_KEY, usedMemory) .withDetail(AVAILABLE_MEMORY, availableMemory) <START> .withDetail(AVAILABLE_DEFAULT_JOB_CAPACITY, availableMemory / defaultJobMemory) <END> .withDetail(AVAILABLE_MAX_JOB_CAPACITY, availableMemory / maxJobMemory) .build(); }</code><technical_language>Decided check divide zero here</technical_language>

Target:
public Health health() { final int usedMemory = this.jobMetricsService.getUsedMemory(); final JobsMemoryProperties memoryProperties = this.jobsProperties.getMemory(); final int availableMemory = memoryProperties.getMaxSystemMemory() - usedMemory; final int maxJobMemory = memoryProperties.getMaxJobMemory(); final int defaultJobMemory = memoryProperties.getDefaultJobMemory(); final Health.Builder builder; if (availableMemory >= maxJobMemory) { builder = Health.up(); } else { builder = Health.outOfService(); } return builder .withDetail(NUMBER_RUNNING_JOBS_KEY, this.jobMetricsService.getNumActiveJobs()) .withDetail(USED_MEMORY_KEY, usedMemory) .withDetail(AVAILABLE_MEMORY, availableMemory) .withDetail( AVAILABLE_DEFAULT_JOB_CAPACITY, (availableMemory >= 0 && defaultJobMemory > 0) ? (availableMemory / defaultJobMemory) : 0) .withDetail( AVAILABLE_MAX_JOB_CAPACITY, (availableMemory >= 0 && maxJobMemory > 0) ? (availableMemory / maxJobMemory) : 0) .build(); }
Source:
<code>public IsWidget getProcessDiagramView() { <START> processDefinitionDiagramView.setDiagram(processDiagramPresenter.getView()); <END> return processDefinitionDiagramView; }</code><technical_language>@nmirasch do this view moved presenter, this a bit strange me. refactor a bit common bits definition instance diagrams if needed</technical_language>

Target:
public IsWidget getProcessDiagramView() { processDiagramPresenter.expandDiagramContainer(); return processDiagramPresenter.getView(); }
Source:
<code>public void testSetLookByIndex() { ScreenValues.SCREEN_HEIGHT = 200; ScreenValues.SCREEN_WIDTH = 200; Sprite sprite = new SingleSprite("new sprite"); project.getDefaultScene().addSprite(sprite); <START> LookData firstLookData = new LookData(); <END> LookData secondLookData = new LookData(); firstLookData.setLookFilename(testImage.getName()); secondLookData.setLookFilename(testImage.getName()); firstLookData.setLookName("firstTestLook"); secondLookData.setLookName("secondTestLook"); sprite.getLookDataList().add(firstLookData); sprite.getLookDataList().add(secondLookData); Formula formula = new Formula(1); ActionFactory factory = sprite.getActionFactory(); Action action = factory.createSetLookByIndexAction(sprite, formula); action.act(1.0f); assertEquals("Action didn't set the first LookData", firstLookData, sprite.look.getLookData()); formula = new Formula(2); action = factory.createSetLookByIndexAction(sprite, formula); action.act(1.0f); assertEquals("Action didn't set the second LookData", secondLookData, sprite.look.getLookData()); }</code><technical_language>want test formula values range</technical_language>

Target:
public void testSetLookByIndex() { Formula formula = new Formula(1); ActionFactory factory = sprite.getActionFactory(); Action action = factory.createSetLookByIndexAction(sprite, formula); action.act(1.0f); assertEquals("Action didn't set the first LookData", firstLookData, sprite.look.getLookData()); formula = new Formula(2); action = factory.createSetLookByIndexAction(sprite, formula); action.act(1.0f); assertEquals("Action didn't set the second LookData", secondLookData, sprite.look.getLookData()); }
Source:
<code>public void testJoinToFilter() throws Exception { Query query = Query.builder() .table(playerStatsTable) .metric(invoke(playerStatsTable.getMetric("highScore"))) .groupByDimension(toProjection(playerStatsTable.getDimension("overallRating"))) .whereFilter(filterParser.parseFilterExpression("subCountryIsoCode==USA", PlayerStats.class, false)) .build(); FutureTask<QueryResult> queryResult = engine.executeQuery(query); <START> queryResult.run(); <END> QueryResult result = queryResult.get(); List<Object> results = StreamSupport.stream(result.getData().spliterator(), false) .collect(Collectors.toList()); PlayerStats stats1 = new PlayerStats(); stats1.setId("0"); stats1.setOverallRating("Good"); stats1.setHighScore(1234); PlayerStats stats2 = new PlayerStats(); stats2.setId("1"); stats2.setOverallRating("Great"); stats2.setHighScore(2412); assertEquals(2, results.size()); assertEquals(stats1, results.get(0)); assertEquals(stats2, results.get(1)); }</code><technical_language>Remove references queryResult.run() in this PR</technical_language>

Target:
public void testJoinToFilter() throws Exception { Query query = Query.builder() .table(playerStatsTable) .metric(invoke(playerStatsTable.getMetric("highScore"))) .groupByDimension(toProjection(playerStatsTable.getDimension("overallRating"))) .whereFilter(filterParser.parseFilterExpression("subCountryIsoCode==USA", PlayerStats.class, false)) .build(); List<Object> results = toList(engine.executeQuery(query, transaction).getData()); PlayerStats stats1 = new PlayerStats(); stats1.setId("0"); stats1.setOverallRating("Good"); stats1.setHighScore(1234); PlayerStats stats2 = new PlayerStats(); stats2.setId("1"); stats2.setOverallRating("Great"); stats2.setHighScore(2412); assertEquals(2, results.size()); assertEquals(stats1, results.get(0)); assertEquals(stats2, results.get(1)); }
Source:
<code>private void setParamsTableColumnSizes() { paramsTable.getColumnModel().getColumn(0).setMinWidth(60); paramsTable.getColumnModel().getColumn(0).setPreferredWidth(60); paramsTable.getColumnModel().getColumn(1).setMinWidth(100); paramsTable.getColumnModel().getColumn(1).setPreferredWidth(100); paramsTable.getColumnModel().getColumn(2).setMinWidth(40); paramsTable.getColumnModel().getColumn(2).setPreferredWidth(40); paramsTable.getColumnModel().getColumn(3).setMinWidth(40); <START> paramsTable.getColumnModel().getColumn(3).setPreferredWidth(40); END> paramsTable.getColumnModel().getColumn(4).setMinWidth(40); paramsTable.getColumnModel().getColumn(4).setPreferredWidth(40); paramsTable.getColumnModel().getColumn(5).setMinWidth(50); paramsTable.getColumnModel().getColumn(5).setPreferredWidth(100); paramsTable.getColumnModel().getColumn(6).setMinWidth(100); paramsTable.getColumnModel().getColumn(6).setPreferredWidth(999); }</code><technical_language>This hides part of column name if space, purpose? (First time users resize column values column has.)</technical_language>

Target:
private void setParamsTableColumnSizes() { for (int i = 0; i < paramsTable.getColumnCount(); i++) { DefaultTableColumnModel colModel = (DefaultTableColumnModel) paramsTable.getColumnModel(); TableColumn col = colModel.getColumn(i); int width = 0; TableCellRenderer renderer = col.getHeaderRenderer(); if (renderer == null) { renderer = paramsTable.getTableHeader().getDefaultRenderer(); } Component comp = renderer.getTableCellRendererComponent(paramsTable, col.getHeaderValue(), false, false, 0, 0); width = comp.getPreferredSize().width; col.setPreferredWidth(width + 2); } paramsTable.getColumnModel().getColumn(6).setPreferredWidth(999); }
Source:
<code>public static SSLSocketFactory createSocketFactory(KeyStore keystore, String keystorePassword, Collection<KeyStore> extraStores) throws KeyStoreException, KeyManagementException { final Collection<X509TrustManager> managers = new ArrayList<>(); for (KeyStore ks : extraStores) { addX509Managers(managers, ks); } addX509Managers(managers, null); final TrustManager tm = new CompositeTrustManager(managers); try { final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init(keystore, keystorePassword.toCharArray()); <START> final SSLContext ctx = SSLContext.getInstance("TLSv1.2"); <END> ctx.init(kmf.getKeyManagers(), new TrustManager[] {tm}, new SecureRandom()); return new SSLSocketFactory(ctx); } catch (NoSuchAlgorithmException e) { throw new Error("No SSL protocols supported :(", e); } catch (UnrecoverableKeyException e) { throw new Error("Could not load RSA Key!", e); } }</code><technical_language>this algorithm specifically</technical_language>

Target:
public static SSLSocketFactory createSocketFactory(KeyStore keystore, String keystorePassword, Collection<KeyStore> extraStores) throws KeyStoreException, KeyManagementException { final Collection<X509TrustManager> managers = new ArrayList<>(); for (KeyStore ks : extraStores) { addX509Managers(managers, ks); } addX509Managers(managers, null); final TrustManager tm = new CompositeTrustManager(managers); try { final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init(keystore, keystorePassword.toCharArray()); final SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(kmf.getKeyManagers(), new TrustManager[] {tm}, new SecureRandom()); return new SSLSocketFactory(ctx); } catch (NoSuchAlgorithmException e) { throw new Error("No SSL protocols supported :(", e); } catch (UnrecoverableKeyException e) { throw new Error("Could not load RSA Key!", e); } }
Source:
<code>public void goToLastEvent() throws CTFException { long endTime = Long.MIN_VALUE; for (CTFStreamInputReader sir : fPrio) { sir.goToLastEvent(); IEventDefinition currentEvent = sir.getCurrentEvent(); if (currentEvent != null) { endTime = Math.max(currentEvent.getTimestamp(), endTime); } } setEndTime(fTrace.timestampCyclesToNanos(endTime)); <START> seek(fTrace.timestampNanoToCycles(getEndTime())); <END> }</code><technical_language>avoid unnecessary conversion (and possibly rounding error?), 'endTime' directly</technical_language>

Target:
public void goToLastEvent() throws CTFException { long endTime = Long.MIN_VALUE; for (CTFStreamInputReader sir : fPrio) { sir.goToLastEvent(); IEventDefinition currentEvent = sir.getCurrentEvent(); if (currentEvent != null) { endTime = Math.max(currentEvent.getTimestamp(), endTime); } } setEndTime(fTrace.timestampCyclesToNanos(endTime)); seek(endTime); }
Source:
<code>private Terminal createWindowsTerminal() throws IOException { try { Class<?> nativeImplementation = Class.forName("com.googlecode.lanterna.terminal.WindowsTerminal"); Constructor<?> constructor = nativeImplementation.getConstructor(InputStream.class, OutputStream.class, Charset.class, UnixLikeTTYTerminal.CtrlCBehaviour.class); return (Terminal)constructor.newInstance(inputStream, outputStream, charset, UnixLikeTTYTerminal.CtrlCBehaviour.CTRL_C_KILLS_APPLICATION); } catch(Exception ignore) { try { return createCygwinTerminal(outputStream, inputStream, charset); } catch(IOException e) { throw new IOException("To start java on Windows, use javaw!\n" <START> + "(see <LINK_0> )", e); <END> } } }</code><technical_language>System.lineSeparator() instead of \n for Windows support (since Windows \r\n)</technical_language>

Target:
private Terminal createWindowsTerminal() throws IOException { try { Class<?> nativeImplementation = Class.forName("com.googlecode.lanterna.terminal.WindowsTerminal"); Constructor<?> constructor = nativeImplementation.getConstructor(InputStream.class, OutputStream.class, Charset.class, UnixLikeTTYTerminal.CtrlCBehaviour.class); return (Terminal)constructor.newInstance(inputStream, outputStream, charset, UnixLikeTTYTerminal.CtrlCBehaviour.CTRL_C_KILLS_APPLICATION); } catch(Exception ignore) { try { return createCygwinTerminal(outputStream, inputStream, charset); } catch(IOException e) { throw new IOException("To start java on Windows, use javaw!" + System.lineSeparator() + "(see <LINK_0> )", e); } } }
Source:
<code>public void recycle(MemorySegment segment) { int numAddedBuffers = 0; synchronized (bufferQueue) { try { if (inputChannel.isReleased()) { globalPool.recycleMemorySegments(Collections.singletonList(segment)); } else { numAddedBuffers = bufferQueue.addExclusiveBuffer(new NetworkBuffer(segment, this), numRequiredBuffers); } } catch (Throwable t) { <START> ExceptionUtils.rethrow(t); <END> } } inputChannel.notifyBufferAvailable(numAddedBuffers); }</code><technical_language>This injected in constructor</technical_language>

Target:
public void recycle(MemorySegment segment) { int numAddedBuffers = 0; synchronized (bufferQueue) { try { if (inputChannel.isReleased()) { globalPool.recycleMemorySegments(Collections.singletonList(segment)); } else { numAddedBuffers = bufferQueue.addExclusiveBuffer(new NetworkBuffer(segment, this), numRequiredBuffers); } } catch (Throwable t) { ExceptionUtils.rethrow(t); } finally { bufferQueue.notifyAll(); } } inputChannel.notifyBufferAvailable(numAddedBuffers); }
Source:
<code><START> public CodeCoverageMetrics convertCobertura(CoverageResult result) { <END> if (result == null) { return null; } float packagesCoverage = getCoveragePercentage(result, CoverageMetric.PACKAGES); float filesCoverage = getCoveragePercentage(result, CoverageMetric.FILES); float classesCoverage = getCoveragePercentage(result, CoverageMetric.CLASSES); float methodCoverage = getCoveragePercentage(result, CoverageMetric.METHOD); float lineCoverage = getCoveragePercentage(result, CoverageMetric.LINE); float conditionalCoverage = getCoveragePercentage(result, CoverageMetric.CONDITIONAL); return new CodeCoverageMetrics( packagesCoverage, filesCoverage, classesCoverage, methodCoverage, lineCoverage, conditionalCoverage ); }</code><technical_language>This static,</technical_language>

Target:
public static CodeCoverageMetrics convertCobertura(CoverageResult result) { if (result == null) { return null; } float packagesCoverage = getCoveragePercentage(result, CoverageMetric.PACKAGES); float filesCoverage = getCoveragePercentage(result, CoverageMetric.FILES); float classesCoverage = getCoveragePercentage(result, CoverageMetric.CLASSES); float methodCoverage = getCoveragePercentage(result, CoverageMetric.METHOD); float lineCoverage = getCoveragePercentage(result, CoverageMetric.LINE); float conditionalCoverage = getCoveragePercentage(result, CoverageMetric.CONDITIONAL); return new CodeCoverageMetrics( packagesCoverage, filesCoverage, classesCoverage, methodCoverage, lineCoverage, conditionalCoverage ); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_sensor_location); button = (Button)findViewById(R.id.saveSensorLocation); buttonCancel = (Button)findViewById(R.id.saveSensorLocationCancel); sensor_location_other = (EditText) findViewById(R.id.edit_sensor_location); sensor_location_other.setEnabled(false); DontAskAgain = (CheckBox)findViewById(R.id.sensorLocationDontAskAgain); radioGroup = (RadioGroup) findViewById(R.id.myRadioGroup); addListenerOnButton(); locations = new LinkedList<Location>(); <START> locations.add(new Location("I dont wish to share", PRIVATE_ID)); <END> locations.add(new Location("Upper arm", 1)); locations.add(new Location("Thigh", 2)); locations.add(new Location("Belly (abdomen)", 3)); locations.add(new Location("Lower back", 4)); locations.add(new Location("buttocks", 5)); locations.add(new Location("other", OTHER_ID)); for(Location location : locations) { AddButton(location.location, location.location_id); } radioGroup.check(PRIVATE_ID); }</code><technical_language>change this I do wish share I wish share</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_sensor_location); button = (Button)findViewById(R.id.saveSensorLocation); buttonCancel = (Button)findViewById(R.id.saveSensorLocationCancel); sensor_location_other = (EditText) findViewById(R.id.edit_sensor_location); sensor_location_other.setEnabled(false); DontAskAgain = (CheckBox)findViewById(R.id.sensorLocationDontAskAgain); radioGroup = (RadioGroup) findViewById(R.id.myRadioGroup); addListenerOnButton(); locations = new LinkedList<Location>(); locations.add(new Location("I don't wish to share", PRIVATE_ID)); locations.add(new Location("Upper arm", 1)); locations.add(new Location("Thigh", 2)); locations.add(new Location("Belly (abdomen)", 3)); locations.add(new Location("Lower back", 4)); locations.add(new Location("Buttocks", 5)); locations.add(new Location("Other", OTHER_ID)); for(Location location : locations) { AddButton(location.location, location.location_id); } radioGroup.check(PRIVATE_ID); }
Source:
<code>public void testApplication() throws Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); Thread.sleep(5000); String[] extensions = {"dat.0", "tmp"}; Collection<File> list = FileUtils.listFiles(new File(FILE_NAME), extensions, false); for (File file : list) { for (String line : FileUtils.readLines(file)) { <START> Assert.assertEquals("Delimiter in record", true, line.contains("|")); <END> } } } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }</code><technical_language>Instead of testing for delimiter, need test if data is in incoming POJO. For that, generate specific data instead of random ( in json generator )</technical_language>

Target:
public void testApplication() throws Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); Thread.sleep(5000); String[] extensions = {"dat.0", "tmp"}; Collection<File> list = FileUtils.listFiles(new File(FILE_NAME), extensions, false); for (File file : list) { for (String line : FileUtils.readLines(file)) { Assert.assertEquals("Delimiter in record", true, (line.equals("1234|SimpleCsvFormatterExample|10000.0|false|APEX"))); } } } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }
Source:
<code>public TraceStatusDMData() { <START> this(false, false, false, 0, 0, 0, "", "", ""); END> fTracingSupported = false; }</code><technical_language>null instead of ""</technical_language>

Target:
public TraceStatusDMData() { fTracingSupported = false; }
Source:
<code>public void testWrongTypeOfArguments() throws URISyntaxException, HiveException { ObjectInspector value1 = PrimitiveObjectInspectorFactory.javaIntObjectInspector; ObjectInspector[] initArguments = new ObjectInspector[]{value1}; GeocodedCountryUDF geocodedCountryUDF = new GeocodedCountryUDF( TestGeocodedCountryUDF.class.getResource(defaultDatabaseFile).getFile()); try { geocodedCountryUDF.initialize(initArguments); <START> fail("UDFArgumentTypeException was not thrown for invalid argument type"); <END> } catch (UDFArgumentTypeException typeEx) { } }</code><technical_language>exceptions bubble get a nice stack trace aids debugging</technical_language>

Target:
public void testWrongTypeOfArguments() throws HiveException { ObjectInspector value1 = PrimitiveObjectInspectorFactory.javaIntObjectInspector; ObjectInspector[] initArguments = new ObjectInspector[]{value1}; GeocodedCountryUDF geocodedCountryUDF = new GeocodedCountryUDF(); geocodedCountryUDF.initialize(initArguments); }
Source:
<code>ExecutionPlan getExecutionPlan(String runId) { Map<String, String> generatedConfig = getGeneratedConfig(runId); Map<String, String> allowedUserConfig = new HashMap<>(userConfig); if (!LegacyTaskApplication.class.isAssignableFrom(appDesc.getAppClass())) { <START> allowedUserConfig.remove(TaskConfig.INPUT_STREAMS()); END> } Config mergedConfig = JobNodeConfigurationGenerator.mergeConfig(allowedUserConfig, generatedConfig); StreamManager streamManager = buildAndStartStreamManager(mergedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(mergedConfig, streamManager); return planner.plan(appDesc); } finally { streamManager.stop(); } }</code><technical_language>previous code this a log override. good put too</technical_language>

Target:
ExecutionPlan getExecutionPlan(String runId) { Map<String, String> generatedConfig = getGeneratedConfig(runId); Map<String, String> allowedUserConfig = new HashMap<>(userConfig); if (!LegacyTaskApplication.class.isAssignableFrom(appDesc.getAppClass())) { LOG.warn("SamzaApplications should not specify task.inputs in configuration. " + "Ignoring configured value of " + userConfig.get(TaskConfig.INPUT_STREAMS())); allowedUserConfig.remove(TaskConfig.INPUT_STREAMS()); } Config mergedConfig = JobNodeConfigurationGenerator.mergeConfig(allowedUserConfig, generatedConfig); StreamManager streamManager = buildAndStartStreamManager(mergedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(mergedConfig, streamManager); return planner.plan(appDesc); } finally { streamManager.stop(); } }
Source:
<code>private Duration getCurrentDelay() { <START> final PollResponse<T> current = pollResponse.get(); <END> return (current != null && current.getRetryAfter() != null && current.getRetryAfter().toNanos() > 0) ? current.getRetryAfter() : pollInterval; }</code><technical_language>this.</technical_language>

Target:
private Duration getCurrentDelay() { final PollResponse<T> current = pollResponse; return (current != null && current.getRetryAfter() != null && current.getRetryAfter().compareTo(Duration.ZERO) > 0) ? current.getRetryAfter() : pollInterval; }
Source:
<code>public ListenableFuture<LabelId> renameLabel(final String newName, final LabelId id, final LabelType type) { final ListenableFuture<List<Row>> oldNameFuture = getLabelRows(id, type); return transform(oldNameFuture, new Function<List<Row>, LabelId>() { @Override public LabelId apply(final List<Row> rows) { Date oldestDate = rows.get(0).getDate("timestamp"); String oldName = rows.get(0).getString("name"); <START> for (Row row : rows) { <END> Date date = row.getDate("timestamp"); if (date.before(oldestDate)) { oldestDate = date; oldName = row.getString("name"); } } session.executeAsync(updateUidNameStatement.bind(newName, toLong(id), type.toValue())); session.executeAsync( updateNameUidStatement.bind(oldName, type.toValue(), newName, type.toValue(), toLong(id))); return id; } }); }</code><technical_language>checks in this for loop redundant. labels explicitly ordered a in table returned in order. This means name date get rows.get(0) oldest one. CLUSTERING ORDER clause in tables.cql for reference</technical_language>

Target:
public ListenableFuture<Boolean> renameLabel(final String newName, final LabelId id, final LabelType type) { final ListenableFuture<List<Row>> oldNameFuture = getNameRows(id, type); return transform(oldNameFuture, new AsyncFunction<List<Row>, Boolean>() { @Override public ListenableFuture<Boolean> apply(final List<Row> rows) { Row row = rows.get(0); String oldName = row.getString("name"); Date creationTime = row.getDate("creation_time"); final ResultSetFuture nameIdFuture = session.executeAsync( updateNameUidStatement.bind(newName, toLong(id), type.toValue(), creationTime, oldName, type.toValue(), creationTime, newName, type.toValue(), creationTime, toLong(id))); return transform(nameIdFuture, new Function<ResultSet, Boolean>() { @Nullable @Override public Boolean apply(final ResultSet input) { if (!input.wasApplied()) { LOG.warn("A rename of a label was requested but could not be completed."); return false; } return true; } }); } }); }
Source:
<code>protected InternalCacheEntry<WrappedBytes, WrappedBytes> performGet(long address, Object k, boolean peek) { WrappedBytes wrappedKey = toWrapper(k); while (address != 0) { long nextAddress = offHeapEntryFactory.getNext(address); InternalCacheEntry<WrappedBytes, WrappedBytes> ice = offHeapEntryFactory.fromMemory(address); <START> if (wrappedKey.equalsWrappedBytes(ice.getKey()) && !ice.isExpired(timeService.wallClockTime())) { <END> if (!peek) { entryRetrieved(address); } return ice; } else { address = nextAddress; } } return null; }</code><technical_language>a other places this is need. I advise renaming entryStream entryStreamIncludingExpired a new entryStream invokes entryStreamIncludingExpired filters out expired entries. call proper method. Currently iteratorIncludingExpired visibility expired entries. add isExpired check in executeTask, containsKey remove methods currently operate expired entries. For containsKey add a method OffHeapEntryFactory class returns if key is expired not. needs read type figure out expiration variables read instead of entire object. If want I handle this, I figure enjoy this :)</technical_language>

Target:
protected InternalCacheEntry<WrappedBytes, WrappedBytes> performGet(long address, Object k, boolean peek) { WrappedBytes wrappedKey = toWrapper(k); long now = timeService.wallClockTime(); while (address != 0) { long nextAddress = offHeapEntryFactory.getNext(address); InternalCacheEntry<WrappedBytes, WrappedBytes> ice = offHeapEntryFactory.fromMemory(address); if (wrappedKey.equalsWrappedBytes(ice.getKey()) && !ice.isExpired(now)) { if (!peek) { entryRetrieved(address); } return ice; } else { address = nextAddress; } } return null; }
Source:
<code>public int draw() { while (true) { final int n = (int) (N * Math.random()); count++; if (Math.random() < probabilities.get(n)) { count = 0; return n; } <START> else if(count>=600){ <END> count = 0; return 0; } } }</code><technical_language>Magic constant</technical_language>

Target:
public int draw() { while (true) { final int n = (int) (N * Math.random()); count++; if (Math.random() < probabilities.get(n)) { count = 0; return n; } else if(count>=SAMPLING_MAX){ count = 0; return 0; } } }
Source:
<code>private void dispose(boolean releaseState) { synchronized (lock) { try { numAcknowledgedTasks = -1; if (!discarded && releaseState) { <START> checkpointsCleaner.asyncDiscardPrivateStatesAndCountCheckpoints(operatorStates, <END> targetLocation, checkpointId, jobId); } } finally { discarded = true; notYetAcknowledgedTasks.clear(); acknowledgedTasks.clear(); cancelCanceller(); } } }</code><technical_language>I synchronization lock is lost (checkpointsCleaner other thread). fix it, checkpointsCleaner accept pendingCheckpoint, call some method it, internally synchronizes lock. WDYT</technical_language>

Target:
private void dispose(boolean releaseState) { synchronized (lock) { try { numAcknowledgedTasks = -1; if (!discarded && releaseState) { Runnable cleanAction = () -> { try { StateUtil.bestEffortDiscardAllStateObjects(operatorStates.values()); targetLocation.disposeOnFailure(); } catch (Throwable t) { LOG.warn( "Could not properly dispose the private states in the pending checkpoint of job {}.", checkpointId, jobId, t); } finally { operatorStates.clear(); } }; checkpointsCleaner.cleanCheckpoint(cleanAction, cleanupFinishedCallback, executor); } } finally { discarded = true; notYetAcknowledgedTasks.clear(); acknowledgedTasks.clear(); cancelCanceller(); } } }