auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private File createTempReactorProject(Server server) throws MojoFailureException, MojoExecutionException { File tempFolder = new File(server.getServerDirectory(), "temp-project"); if (!tempFolder.exists()) { tempFolder.mkdir(); } Model tempModel = createModel(); Set<Project> watchedModules = server.getWatchedProjects(); for(Project module: watchedModules){ File srcDir = new File(module.getPath()); File moduleFile = new File(tempFolder, module.getArtifactId()); try { FileUtils.copyDirectory(srcDir, moduleFile); Model model = Project.loadProject(moduleFile).getModel(); Parent parent = new Parent(); parent.setArtifactId("temp-project"); parent.setGroupId("org.temp"); parent.setVersion("1.0"); model.setParent(parent); Writer writer = new FileWriter(new File(moduleFile, "pom.xml")); new MavenXpp3Writer().write(writer, model); tempModel.addModule(module.getArtifactId()); } catch (IOException e) { e.printStackTrace(); } } try { Writer writer = new FileWriter(new File(tempFolder, "pom.xml")); new MavenXpp3Writer().write(writer, tempModel); } catch (IOException e) { <START> e.printStackTrace(); <END> } return tempFolder; }</code><technical_language>Do eat exception</technical_language>

Target:
private File createTempReactorProject(Server server) throws MojoFailureException, MojoExecutionException { File tempFolder = new File(server.getServerDirectory(), "temp-project"); if (!tempFolder.exists()) { tempFolder.mkdir(); } Model tempModel = createModel(); Set<Project> watchedModules = server.getWatchedProjects(); for(Project module: watchedModules){ Path newLink = Paths.get(new File(tempFolder, module.getArtifactId()).getAbsolutePath()); Path existingfile = Paths.get(module.getPath()); try { Files.createSymbolicLink(newLink, existingfile); tempModel.addModule(module.getArtifactId()); } catch (IOException e) { throw new RuntimeException("Couldn't create link", e); } catch (UnsupportedOperationException e) { throw new RuntimeException("Couldn't create link due to unsupported file system", e); } } try { Writer writer = new FileWriter(new File(tempFolder, "pom.xml")); new MavenXpp3Writer().write(writer, tempModel); } catch (IOException e) { throw new RuntimeException("Failed to write pom.xml", e); } return tempFolder; }
Source:
<code><START> private SettableFuture<Boolean> logFenceEntryInJournal(Journal journal) throws InterruptedException { <END> SettableFuture<Boolean> result; synchronized (this) { result = logFenceResult = SettableFuture.create(); } ByteBuf entry = createLedgerFenceEntry(ledgerId); journal.logAddEntry(entry, false , (rc, ledgerId, entryId, addr, ctx) -> { if (LOG.isDebugEnabled()) { LOG.debug("Record fenced state for ledger in journal with rc {}", ledgerId, BKException.codeLogger(rc)); } if (rc == 0) { fenceEntryPersisted.compareAndSet(false, true); result.set(true); } else { result.set(false); } }, null); return result; }</code><technical_language>This method returns a Future, I if is throw Interrupted Exception return a failed Future</technical_language>

Target:
private SettableFuture<Boolean> logFenceEntryInJournal(Journal journal) { SettableFuture<Boolean> result; synchronized (this) { result = logFenceResult = SettableFuture.create(); } ByteBuf entry = createLedgerFenceEntry(ledgerId); try { journal.logAddEntry(entry, false , (rc, ledgerId, entryId, addr, ctx) -> { if (LOG.isDebugEnabled()) { LOG.debug("Record fenced state for ledger in journal with rc {}", ledgerId, BKException.codeLogger(rc)); } if (rc == 0) { fenceEntryPersisted.compareAndSet(false, true); result.set(true); } else { result.set(false); } }, null); } catch (InterruptedException e) { Thread.currentThread().interrupt(); result.setException(e); } return result; }
Source:
<code>public static ArrayList<String> toHtmlList(Context context) { ArrayList<String> items = new ArrayList<String>(); <START> PackageManager packageManager = context.getPackageManager(); <END> PackageInfo pkInfo = PackageUtils.getPackageInfo(context); ApplicationInfo applicationInfo = pkInfo != null ? pkInfo.applicationInfo : null; String appName; if (applicationInfo != null && packageManager.getApplicationLabel(applicationInfo) != null) { appName = packageManager.getApplicationLabel(applicationInfo).toString(); } else { appName = "Unknown"; } items.add("<strong>" + appName + " - " + PackageUtils.getVersionName(context) + " - Version code: " + PackageUtils.getVersionCode(context) + "</strong>"); items.add("<strong>Android device name: " + DeviceUtils.getInstance().getDeviceName(context) + "</strong>"); Iterator<LogEntry> it = mLogEntries.iterator(); while (it.hasNext()) { items.add(it.next().toHtml()); } return items; }</code><technical_language>duplicate this code in toPlainText(), making a simple routine instead? private static String getAppName(Context context) { PackageManager packageManager = context.getPackageManager(); PackageInfo pkInfo = PackageUtils.getPackageInfo(context); ApplicationInfo applicationInfo = pkInfo != null ? pkInfo.applicationInfo : null; if (applicationInfo != null && packageManager.getApplicationLabel(applicationInfo) != null) { return packageManager.getApplicationLabel(applicationInfo).toString(); } else { return "Unknown"; } }</technical_language>

Target:
public static ArrayList<String> toHtmlList(Context context) { ArrayList<String> items = new ArrayList<String>(); items.add("<strong>" + getAppInfoHeaderText(context) + "</strong>"); items.add("<strong>" + getDeviceInfoHeaderText(context) + "</strong>"); Iterator<LogEntry> it = mLogEntries.iterator(); while (it.hasNext()) { items.add(it.next().toHtml()); } return items; }
Source:
<code>private DataSource createDataSource(String driverClass, String url, String account, String password) { ComboPooledDataSource dataSource = new ComboPooledDataSource(); try { dataSource.setDriverClass(driverClass); dataSource.setJdbcUrl(url); dataSource.setUser(account); dataSource.setPassword(password); dataSource.setMinPoolSize(10); dataSource.setMaxPoolSize(35); dataSource.setAcquireIncrement(0); dataSource.setMaxStatements(0); dataSource.setMaxIdleTime(300); dataSource.setIdleConnectionTestPeriod(30); <START> dataSource.setTestConnectionOnCheckin(false); <END> dataSource.setTestConnectionOnCheckout(true); dataSource.setPreferredTestQuery("SELECT 1;"); dataSource.setMaxConnectionAge(8 * 24 * 60 * 60); dataSource.setCheckoutTimeout(8 * 24 * 60 * 60); } catch (PropertyVetoException e) { e.printStackTrace(); } mPoolMap.put(url, dataSource); return dataSource; }</code><technical_language>connot understand</technical_language>

Target:
private DataSource createDataSource(String driverClass, String url, String account, String password) { ComboPooledDataSource dataSource = new ComboPooledDataSource(); try { dataSource.setDriverClass(driverClass); dataSource.setJdbcUrl(url); dataSource.setUser(account); dataSource.setPassword(password); dataSource.setMinPoolSize(10); dataSource.setMaxPoolSize(35); dataSource.setAcquireIncrement(0); dataSource.setMaxStatements(0); dataSource.setMaxIdleTime(300); dataSource.setIdleConnectionTestPeriod(30); dataSource.setTestConnectionOnCheckin(false); dataSource.setTestConnectionOnCheckout(true); dataSource.setPreferredTestQuery("SELECT 1;"); dataSource.setMaxConnectionAge(480); dataSource.setCheckoutTimeout(480); } catch (PropertyVetoException e) { e.printStackTrace(); } mPoolMap.put(url, dataSource); return dataSource; }
Source:
<code>public void assignUserToPullRequest(User user, PullRequest pull) { JsonObject json = Json.createObjectBuilder().add(FIELD_KEY_ASSIGNEE, user.username).build(); final String uri = buildIssueUri(pull.repo.name, pull.number); logger.debug(String.format("assign user [%s] to pr [%s]", user.username, pull.title)); try { Request req = client.entry() .method(Request.PATCH).body().set(json) .back().uri().path(uri) .back(); req.fetch(); } catch (IOException e) { <START> logger.error(String.format("assigning user [%s] to pr [%s] FAILED - what a fukking a shaaame.", <END> user.username, pull.title)); throw new UnexpectedException(e); } }</code><technical_language>string format nicht ntig</technical_language>

Target:
public void assignUserToPullRequest(User user, PullRequest pull) { JsonObject json = Json.createObjectBuilder().add(FIELD_KEY_ASSIGNEE, user.username).build(); final String uri = buildIssueUri(pull.repo.name, pull.number); logger.debug("assign user to pr {}", user.username, pull.title); try { Request req = client.entry() .method(Request.PATCH).body().set(json) .back().uri().path(uri) .back(); req.fetch(); } catch (IOException e) { logger.error("assigning user to pr FAILED - what a shame!", user.username, pull.title); throw new UnexpectedException(e); } }
Source:
<code>public void dispose() { deregisterClient(); if (null != client) { client.destroy(false); } if (null != server) { server.destroy(); <START> } <END> currentEndpointIdentifier = null; }</code><technical_language>call stop() in tests. replace destroy() remove stop()call destroy in dispose. Personally, I prefer solution this more sense create in @before destroy in @after</technical_language>

Target:
public void dispose() { deregisterClient(); currentEndpointIdentifier = null; }
Source:
<code><START> public WebSocketClientHandshaker00(URI webSocketURL, WebSocketVersion version, String subprotocol, <END> HttpHeaders customHeaders, int maxFramePayloadLength, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); }</code><technical_language>this package-private for</technical_language>

Target:
WebSocketClientHandshaker00(URI webSocketURL, WebSocketVersion version, String subprotocol, HttpHeaders customHeaders, int maxFramePayloadLength, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); }
Source:
<code>public void testLocation() { JavaPackageInfoSource packageInfo = Roaster.create(JavaPackageInfoSource.class); packageInfo.setPackage("abc"); Assert.assertThat(packageInfo.getStartPosition(), is(0)); <START> System.out.println(packageInfo); <END> Assert.assertThat(packageInfo.getEndPosition(), is(20)); Assert.assertThat(packageInfo.getColumnNumber(), is(0)); Assert.assertThat(packageInfo.getLineNumber(), is(1)); }</code><technical_language>Mind removing this System.out</technical_language>

Target:
public void testLocation() { JavaPackageInfoSource packageInfo = Roaster.create(JavaPackageInfoSource.class); packageInfo.setPackage("abc"); Assert.assertThat(packageInfo.getStartPosition(), is(0)); Assert.assertThat(packageInfo.getEndPosition(), is(20)); Assert.assertThat(packageInfo.getColumnNumber(), is(0)); Assert.assertThat(packageInfo.getLineNumber(), is(1)); }
Source:
<code>public void setup(Context.OperatorContext context) { AggregatorRegistry.DEFAULT_AGGREGATOR_REGISTRY.setup(); schema = new DimensionalSchema(new DimensionalConfigurationSchema(eventSchemaJSON, AggregatorRegistry.DEFAULT_AGGREGATOR_REGISTRY)); <START> maxProductId = 7; <END> maxCustomerId = 30; maxChannelId = schema.getDimensionalConfigurationSchema().getKeysToEnumValuesList().get(KEY_CHANNEL).size(); maxRegionId = schema.getDimensionalConfigurationSchema().getKeysToEnumValuesList().get(KEY_REGION).size(); tuplesPerCurrentWindow = maxTuplesPerWindow; generateDiscounts(); generateRegionalTax(); initializeDataGenerators(); }</code><technical_language>Increate based contents of products.json</technical_language>

Target:
public void setup(Context.OperatorContext context) { AggregatorRegistry.DEFAULT_AGGREGATOR_REGISTRY.setup(); schema = new DimensionalSchema(new DimensionalConfigurationSchema(eventSchemaJSON, AggregatorRegistry.DEFAULT_AGGREGATOR_REGISTRY)); maxProductId = 100; maxCustomerId = 30; maxChannelId = schema.getDimensionalConfigurationSchema().getKeysToEnumValuesList().get(KEY_CHANNEL).size(); maxRegionId = schema.getDimensionalConfigurationSchema().getKeysToEnumValuesList().get(KEY_REGION).size(); tuplesPerCurrentWindow = maxTuplesPerWindow; generateDiscounts(); generateRegionalTax(); initializeDataGenerators(); }
Source:
<code>private static <T> void validateEntry(ReferenceDataId<?> id, Object value) { if (!id.getReferenceDataType().isInstance(value)) { if (value == null) { throw new IllegalArgumentException(Messages.format( "Reference data must not be null for identifier '{}'", id)); } throw new ClassCastException(Messages.format( <START> "Value '{}' does not implement parameterized type '{}' for identifier '{}'", <END> value, id.getReferenceDataType().getSimpleName(), id)); } }</code><technical_language>"parameterized" in this sentence</technical_language>

Target:
private static void validateEntry(ReferenceDataId<?> id, Object value) { if (!id.getReferenceDataType().isInstance(value)) { if (value == null) { throw new IllegalArgumentException(Messages.format( "Value for identifier '{}' must not be null", id)); } throw new ClassCastException(Messages.format( "Value for identifier '{}' does not implement expected type '{}': '{}'", id, id.getReferenceDataType().getSimpleName(), value)); } }
Source:
<code>public List<String> buildLinesFromFile(File file) throws IOException, NoDataException, EmptyFileException { List<String> lines; InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "UTF-8"); <START> BufferedReader bufferedReader = new BufferedReader(inputStreamReader); <END> try { lines = bufferedReader.lines().collect(Collectors.toList()); if (lines.size() == 0) { throw new EmptyFileException("File [" + file.getName() + "] is empty"); } else if (lines.size() == 1) { throw new NoDataException("Header was found, but no data is present in file [" + file.getName() + "]"); } } finally { inputStreamReader.close(); } return lines; }</code><technical_language>try-with-resources here: java try(BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")) { ... }</technical_language>

Target:
public List<String> buildLinesFromFile(File file) throws IOException, NoDataException, EmptyFileException { List<String> lines; try (BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(new FileInputStream(file), "UTF-8"))) { lines = bufferedReader.lines().collect(Collectors.toList()); if (lines.size() == 0) { throw new EmptyFileException("File [" + file.getName() + "] is empty"); } else if (lines.size() == 1) { throw new NoDataException("Header was found, but no data is present in file [" + file.getName() + "]"); } } return lines; }
Source:
<code>public static HashMap<String, Map<String, Boolean>> listWhitelisted(int uid) { Util.log(null, Log.WARN, "Getting whitelists for " + uid); HashMap<String, Map<String, Boolean>> mapWhitelisted = new HashMap<String, Map<String, Boolean>>(); for (PSetting setting : getSettingList(uid)) { <START> String[] components = setting.name.split("\\."); <END> if (components.length < 2) continue; String type = components[0]; String name = setting.name.replace(components[0] + ".", ""); if (type.equals(Meta.cWhitelistAccount) || type.equals(Meta.cWhitelistContact) || type.equals(Meta.cWhitelistApplication)) continue; if (setting.value.equals("")) continue; if (!mapWhitelisted.containsKey(type)) mapWhitelisted.put(type, new HashMap<String, Boolean>()); mapWhitelisted.get(type).put(name, Boolean.parseBoolean(setting.value)); Util.log(null, Log.WARN, String.format("Whitelist for %d (%s) %s = %s", uid, type, name, setting.value)); } return mapWhitelisted; }</code><technical_language>I feel safer a prefix here, _Whitelist.<type>.<name>_</technical_language>

Target:
public static HashMap<String, Map<String, Boolean>> listWhitelisted(int uid) { Util.log(null, Log.WARN, "Getting whitelists for " + uid); HashMap<String, Map<String, Boolean>> mapWhitelisted = new HashMap<String, Map<String, Boolean>>(); for (PSetting setting : getSettingList(uid)) { if (setting.name.startsWith("Whitelist")) { String[] components = setting.name.split("\\."); if (components.length < 3) continue; String type = components[1]; String name = setting.name.replace(components[0] + "." + components[1] + ".", ""); if (setting.value.equals("")) continue; if (!mapWhitelisted.containsKey(type)) mapWhitelisted.put(type, new HashMap<String, Boolean>()); mapWhitelisted.get(type).put(name, Boolean.parseBoolean(setting.value)); Util.log(null, Log.WARN, String.format("Whitelist for %d (%s) %s = %s", uid, type, name, setting.value)); } } return mapWhitelisted; }
Source:
<code><START> private void processRequests() { <END> AsyncRequestInfo requestInfo = null; String uri = null; while (true) { try { requestInfo = requests.poll(POLL_TIMEOUT_MS, TimeUnit.MILLISECONDS); if (requestInfo != null) { uri = requestInfo.getRestRequest().getUri(); trackMetricsOnDequeue(requestInfo); processRequest(requestInfo); logger.trace("Request was handled successfully", uri); } else { break; } } catch (Exception e) { logger.error("Handling of request failed", uri, e); restServerMetrics.dequeuedRequestHandlerRequestHandlingError.inc(); if (requestInfo != null) { onResponseComplete(requestInfo.getRestResponseChannel(), e, false); releaseResources(requestInfo.getRestRequest(), null); } } } }</code><technical_language>move this of processResponses</technical_language>

Target:
private void processRequests() { AsyncRequestInfo requestInfo = null; String uri = null; int processedThisTime = 0; while (processedThisTime < SINGLE_ITERATION_REQUEST_PROCESS_LIMIT) { try { requestInfo = requests.poll(POLL_TIMEOUT_MS, TimeUnit.MILLISECONDS); if (requestInfo != null) { queuedRequestCount.decrementAndGet(); uri = requestInfo.getRestRequest().getUri(); trackMetricsOnDequeue(requestInfo); processRequest(requestInfo); logger.trace("Request was handled successfully", uri); } else { break; } } catch (Exception e) { logger.error("Handling of request failed", uri, e); restServerMetrics.dequeuedRequestHandlerRequestHandlingError.inc(); if (requestInfo != null) { onResponseComplete(requestInfo.getRestResponseChannel(), e, false); releaseResources(requestInfo.getRestRequest(), null); } } finally { processedThisTime++; } } }
Source:
<code>protected void scanFile(XmlFile file) { Charset charset = file.getInputFile().charset(); for (Node comment : getComments(file)) { if (reportedNodes.contains(comment)) { continue; } List<Node> siblingComments = getNextCommentSiblings(comment); checkCommentBlock(siblingComments, charset); <START> reportedNodes.addAll(siblingComments); <END> } reportedNodes.clear(); }</code><technical_language>Is reportedNodes check if a node parsed instead of continuing loop sibling node</technical_language>

Target:
protected void scanFile(XmlFile file) { Charset charset = file.getInputFile().charset(); for (Node comment : getComments(file)) { if (visitedNodes.contains(comment)) { continue; } List<Node> siblingComments = getNextCommentSiblings(comment); checkCommentBlock(siblingComments, charset); visitedNodes.addAll(siblingComments); } visitedNodes.clear(); }
Source:
<code>private Message<?> decodeNativeFormat(byte[] bytes) throws Exception { ByteBuffer buffer = ByteBuffer.wrap(bytes); if (buffer.remaining() > 4) { int headersLen = buffer.getInt(); if (headersLen >= 0 && headersLen < buffer.remaining() - 4) { buffer.position(headersLen + 4); int payloadLen = buffer.getInt(); if (payloadLen != buffer.remaining()) { buffer.position(0); return null; } else { buffer.position(4); @SuppressWarnings("unchecked") Map<String, Object> headers = this.objectMapper.readValue(bytes, buffer.position(), headersLen, HashMap.class); buffer.position(buffer.position() + headersLen); buffer.getInt(); Object payload; byte[] payloadBytes = new byte[payloadLen]; buffer.get(payloadBytes); <START> payload = payloadBytes; <END> return new GenericMessage<Object>(payload, new MutableMessageHeaders(headers)); } } } buffer.position(0); return null; }</code><technical_language>is native format</technical_language>

Target:
private Message<?> decodeNativeFormat(byte[] bytes) throws Exception { ByteBuffer buffer = ByteBuffer.wrap(bytes); if (buffer.remaining() > 4) { int headersLen = buffer.getInt(); if (headersLen >= 0 && headersLen < buffer.remaining() - 4) { buffer.position(headersLen + 4); int payloadLen = buffer.getInt(); if (payloadLen != buffer.remaining()) { return null; } else { buffer.position(4); @SuppressWarnings("unchecked") Map<String, Object> headers = this.objectMapper.readValue(bytes, buffer.position(), headersLen, HashMap.class); buffer.position(buffer.position() + headersLen); buffer.getInt(); Object payload; byte[] payloadBytes = new byte[payloadLen]; buffer.get(payloadBytes); payload = payloadBytes; return new GenericMessage<Object>(payload, new MutableMessageHeaders(headers)); } } } return null; }
Source:
<code>public void expressionMapVerifyResultTest() { String expressionCollectionJsonString = new TextNode("JsonText").toString(); <START> expressionEvaluator.verifyResult(expressionCollectionJsonString, new HashMap<>(), null); <END> }</code><technical_language>please Collections.emptyMap()</technical_language>

Target:
public void expressionMapVerifyResultTest() { String expressionCollectionJsonString = new TextNode("{key_a : 1}").toString(); Map<String, BigDecimal> contextValue = Collections.singletonMap("key_a", BigDecimal.valueOf(1)); assertTrue(expressionEvaluator.verifyResult(expressionCollectionJsonString, contextValue, Map.class)); }
Source:
<code>private StateMachine initStateMachine() { return StateMachine.newBuilder() .addState(RUNNING, "Running normally, with no outstanding pauses") .addState(WAITING_PAUSE_RESULT, "Waiting for pause confirmation from Controller Task") .addState(PAUSED, "Controller Task has paused") .addState(CANCELLING, "Pause is being cancelled") .setInitialState(RUNNING) <START> .addTransition(RUNNING, RUNNING, <END> "Running normally") .addTransition(RUNNING, WAITING_PAUSE_RESULT, "The pause request has been sent") .addTransition(WAITING_PAUSE_RESULT, PAUSED, "The Controller Task has confirmed pause") .addTransition(PAUSED, RUNNING, "The resume request has been sent") .addTransition(WAITING_PAUSE_RESULT, CANCELLING, "The pause request cannot be satisfied") .addTransition(CANCELLING, RUNNING, "The pause has been cancelled") .build(); }</code><technical_language>In cases this transition occur</technical_language>

Target:
private StateMachine initStateMachine() { return StateMachine.newBuilder() .addState(RUNNING, "Running normally, with no outstanding pauses") .addState(WAITING_PAUSE_RESULT, "Waiting for pause confirmation from Controller Task") .addState(PAUSED, "Controller Task has paused") .addState(CANCELLING, "Pause is being cancelled") .setInitialState(RUNNING) .addTransition(RUNNING, WAITING_PAUSE_RESULT, "The pause request has been sent") .addTransition(WAITING_PAUSE_RESULT, PAUSED, "The Controller Task has confirmed pause") .addTransition(PAUSED, RUNNING, "The resume request has been sent") .addTransition(WAITING_PAUSE_RESULT, CANCELLING, "The pause request cannot be satisfied") .addTransition(CANCELLING, RUNNING, "The pause has been cancelled") .build(); }
Source:
<code>public void testFilterPrivate() { filter.inClazz = DummyPrivatePOJO.class; <START> filter.setCondition("({$}.getVal() == 100)"); <END> filter.activate(null); logger.debug("start round 0"); filter.beginWindow(0); data.setVal(100); filter.input.process(data); Assert.assertEquals("true tuples", 1, filter.trueTuples); Assert.assertEquals("false tuples", 0, filter.falseTuples); filter.endWindow(); logger.debug("end round 0"); logger.debug("start round 1"); filter.beginWindow(1); data.setVal(1000); filter.input.process(data); Assert.assertEquals("true tuples", 0, filter.trueTuples); Assert.assertEquals("false tuples", 1, filter.falseTuples); filter.endWindow(); logger.debug("end round 1"); filter.deactivate(); }</code><technical_language>$.val work</technical_language>

Target:
public void testFilterPrivate() { prepareFilterOperator(DummyPrivatePOJO.class, "({$}.getVal() == 100)"); filter.beginWindow(0); data.setVal(100); filter.input.put(data); Assert.assertEquals("true condition true tuples", 1, trueSink.getCount()); Assert.assertEquals("true condition false tuples", 0, falseSink.getCount()); Assert.assertEquals("true condition error tuples", 0, errorSink.getCount()); filter.endWindow(); clearSinks(); filter.beginWindow(1); data.setVal(1000); filter.input.put(data); Assert.assertEquals("false condition true tuples", 0, trueSink.getCount()); Assert.assertEquals("false condition false tuples", 1, falseSink.getCount()); Assert.assertEquals("false condition error tuples", 0, errorSink.getCount()); filter.endWindow(); clearFilterOperator(); }
Source:
<code>public <T> T retryOnRateLimit(Supplier<T> func) throws AmazonServiceException { <START> final int baseIncrementalSecs = 10; <END> for (int i = 0; i < rateLimitMaxRetry; i++) { try { return func.get(); } catch (AmazonServiceException ex) { if (RetryUtils.isThrottlingException(ex)) { logger.debug("Rate exceed: {}. Will be retried.", ex.toString()); final long baseWaitSecs = baseIncrementalSecs * i > rateLimitMaxBaseWaitSecs ? rateLimitMaxBaseWaitSecs: baseIncrementalSecs * i; waitWithRandomJitter(baseWaitSecs, rateLimitMaxJitterSecs); } else { throw ex; } } } logger.error("Failed to call EcsClient method after Retried times", rateLimitMaxRetry); throw new RuntimeException("Failed to call EcsClient method"); }</code><technical_language>I a strong opinion this, I this instance variable</technical_language>

Target:
public <T> T retryOnRateLimit(Supplier<T> func) throws AmazonServiceException { for (int i = 0; i < rateLimitMaxRetry; i++) { try { return func.get(); } catch (AmazonServiceException ex) { if (RetryUtils.isThrottlingException(ex)) { logger.debug("Rate exceed: {}. Will be retried.", ex.toString()); final long baseWaitSecs = Math.min(rateLimitBaseIncrementalSecs * i, rateLimitMaxBaseWaitSecs); waitWithRandomJitter(baseWaitSecs, rateLimitMaxJitterSecs); } else { throw ex; } } } logger.error("Failed to call EcsClient method after Retried times", rateLimitMaxRetry); throw new RuntimeException("Failed to call EcsClient method"); }
Source:
<code>public IFolder prepareTraceSupplementaryFolder(String supplFolderPath, boolean createFolder) { IFolder folder = getTraceSupplementaryFolder(supplFolderPath); try { ICoreRunnable runnable = monitor -> { if (createFolder) { IFolder propertiesFolder = folder.getFolder(TmfCommonConstants.TRACE_PROPERTIES_FOLDER); TraceUtils.createFolder(propertiesFolder, <START> new NullProgressMonitor()); propertiesFolder.setHidden(true); } else { TraceUtils.createFolder((IFolder) folder.getParent(), new NullProgressMonitor()); <END> } }; ResourcesPlugin.getWorkspace().run(runnable, folder.getProject(), IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError("Error creating supplementary folder " + folder.getFullPath(), e); } return folder; }</code><technical_language>monitor argument instead of new NullProgressMonitor()</technical_language>

Target:
public IFolder prepareTraceSupplementaryFolder(String supplFolderPath, boolean createFolder) { IFolder folder = getTraceSupplementaryFolder(supplFolderPath); try { ICoreRunnable runnable = monitor -> { if (createFolder) { IFolder propertiesFolder = folder.getFolder(TmfCommonConstants.TRACE_PROPERTIES_FOLDER); TraceUtils.createFolder(propertiesFolder, monitor); propertiesFolder.setHidden(true); } else { TraceUtils.createFolder((IFolder) folder.getParent(), monitor); } }; ResourcesPlugin.getWorkspace().run(runnable, folder.getProject(), IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError("Error creating supplementary folder " + folder.getFullPath(), e); } return folder; }
Source:
<code>public void test_getShowFocusedControl() { boolean defaultFlag = scrolledComposite.getShowFocusedControl(); boolean setFlag = !defaultFlag; scrolledComposite.setShowFocusedControl(setFlag); <START> if (setFlag) <END> assertTrue(scrolledComposite.getShowFocusedControl()); else assertFalse(scrolledComposite.getShowFocusedControl()); setFlag = !setFlag; scrolledComposite.setShowFocusedControl(setFlag); if (setFlag) assertTrue(scrolledComposite.getShowFocusedControl()); else assertFalse(scrolledComposite.getShowFocusedControl()); scrolledComposite.setShowFocusedControl(defaultFlag); }</code><technical_language>{} for blocks</technical_language>

Target:
public void test_getShowFocusedControl() { boolean defaultFlag = scrolledComposite.getShowFocusedControl(); boolean setFlag = !defaultFlag; scrolledComposite.setShowFocusedControl(setFlag); if (setFlag){ assertTrue(scrolledComposite.getShowFocusedControl()); } else{ assertFalse(scrolledComposite.getShowFocusedControl()); } setFlag = !setFlag; scrolledComposite.setShowFocusedControl(setFlag); if (setFlag){ assertTrue(scrolledComposite.getShowFocusedControl()); } else{ assertFalse(scrolledComposite.getShowFocusedControl()); } scrolledComposite.setShowFocusedControl(defaultFlag); }
Source:
<code>public void initialize() { JavaFxUtil.fixScrollSpeed(tiledScrollPane); <START> sortingListener = (observable, oldValue, newValue) -> { <END> if (newValue == null) { return; } preferencesService.getPreferences().setGameTileSortingOrder(newValue); preferencesService.storeInBackground(); appliedComparator = newValue.getComparator(); sortNodes(); }; }</code><technical_language>this sortingListener changes, final initialized in constructor</technical_language>

Target:
public void initialize() { JavaFxUtil.fixScrollSpeed(tiledScrollPane); }
Source:
<code>public <B> Shrink<B> map(final F<A, B> f, final F<B, A> g) { <START> return new Shrink<B>(b -> Shrink.this.f.f(g.f(b)).map(f)); <END> }</code><technical_language>static constructor Shrink.shrink(F<A, Stream<A>>)</technical_language>

Target:
public <B> Shrink<B> map(final F<A, B> f, final F<B, A> g) { return shrink(b -> Shrink.this.f.f(g.f(b)).map(f)); }
Source:
<code>private void postConstruct() throws IOException { <START> LOGGER.debug("Fedora staging: {}", fedoraOcflStaging); <END> LOGGER.debug("Fedora OCFL root: {}", ocflRepoRoot); LOGGER.debug("Fedora OCFL temp: {}", ocflTemp); Files.createDirectories(fedoraOcflStaging); Files.createDirectories(ocflRepoRoot); Files.createDirectories(ocflTemp); }</code><technical_language>I do logs chatty... messages important startup. change LOGGER.info()</technical_language>

Target:
private void postConstruct() throws IOException { LOGGER.info("Fedora staging: {}", fedoraOcflStaging); LOGGER.info("Fedora OCFL root: {}", ocflRepoRoot); LOGGER.info("Fedora OCFL temp: {}", ocflTemp); Files.createDirectories(fedoraOcflStaging); Files.createDirectories(ocflRepoRoot); Files.createDirectories(ocflTemp); }
Source:
<code>public FeedbackSessionAttributes getFeedbackSession(String courseId, String feedbackSessionName) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, feedbackSessionName); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); FeedbackSessionAttributes feedbackSession = makeAttributesOrNull(getFeedbackSessionEntity(feedbackSessionName, courseId)); if (feedbackSession != null && feedbackSession.isSessionDeleted()) { log.info("Trying to access soft-deleted session: " + feedbackSessionName + "/" + courseId); } if (feedbackSession == null || feedbackSession.isSessionDeleted()) { String errorMessage = ""; if (feedbackSession == null) { errorMessage = "Session not found."; } else { errorMessage = "Session is deleted."; } <START> throw new EntityNotFoundException(new EntityDoesNotExistException(errorMessage)); <END> } return feedbackSession; }</code><technical_language>This violates policy DB layer <LINK_0></technical_language>

Target:
public FeedbackSessionAttributes getFeedbackSession(String courseId, String feedbackSessionName) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, feedbackSessionName); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); FeedbackSessionAttributes feedbackSession = makeAttributesOrNull(getFeedbackSessionEntity(feedbackSessionName, courseId)); if (feedbackSession != null && feedbackSession.isSessionDeleted()) { log.info("Trying to access soft-deleted session: " + feedbackSessionName + "/" + courseId); return null; } return feedbackSession; }
Source:
<code>public Date read(JsonReader in) throws IOException { String dateString = in.nextString(); for (SimpleDateFormat dateFormat : dateFormatters) { <START> synchronized(dateFormat) { <END> try { return dateFormat.parse(dateString); } catch (ParseException ignored) { } } } throw new JsonSyntaxException("Couldn't parse date: '" + dateString + "'"); }</code><technical_language>dateFormat.clone() instead of introducing this contention. is fine though</technical_language>

Target:
public Date read(JsonReader in) throws IOException { String dateString = in.nextString(); synchronized(dateFormatter) { try { return dateFormatter.parse(dateString); } catch (ParseException ignored) { String withoutMicroseconds = dateString.replaceFirst("\\..*Z", "Z"); try { return dateFormatter.parse(withoutMicroseconds); } catch (ParseException e) { } } } throw new JsonSyntaxException("Couldn't parse date: '" + dateString + "'"); }
Source:
<code>public void shouldFailToCommitWhenRunFailureIsConsumed() { Transaction tx = await( session.beginTransactionAsync() ); StatementResultCursor cursor = await( tx.runAsync( "RETURN Wrong" ) ); try { await( cursor.consumeAsync() ); fail( "Exception expected" ); } catch ( ClientException e ) { assertThat( e.code(), containsString( "SyntaxError" ) ); } try { await( tx.commitAsync() ); fail( "Exception expected" ); } catch ( ClientException e ) { <START> assertThat( e.getMessage(), startsWith( "No current transaction to commit." ) ); <END> } }</code><technical_language>This message change is weird. exposes implementation detail driver resets a connection error. Do is okay</technical_language>

Target:
void shouldFailToCommitWhenRunFailureIsConsumed() { Transaction tx = await( session.beginTransactionAsync() ); StatementResultCursor cursor = await( tx.runAsync( "RETURN Wrong" ) ); ClientException e1 = assertThrows( ClientException.class, () -> await( cursor.consumeAsync() ) ); assertThat( e1.code(), containsString( "SyntaxError" ) ); ClientException e2 = assertThrows( ClientException.class, () -> await( tx.commitAsync() ) ); assertThat( e2.getMessage(), startsWith( "Transaction can't be committed" ) ); }
Source:
<code>public <T> Page<T> query(Query query, Pager pager, Function<Element, T> conversion, Function<T, Boolean> filter) { HawkularPipeline<?, ? extends Element> q; if (query.getFragments()[0].getFilter() instanceof RelationFilter) { q = new HawkularPipeline<>(context.getGraph()).E(); } else { q = new HawkularPipeline<>(context.getGraph()).V(); } FilterApplicator.applyAll(query, q); HawkularPipeline<?, T> q2; if (filter == null) { q2 = q.counter("total").page(pager).transform(conversion::apply); } else { q2 = q.transform(conversion::apply).filter(filter::apply).counter("total") .page(pager, (e, p) -> { if (!(e instanceof AbstractElement)) { return null; } AbstractElement<?, ?> el = (AbstractElement<?, ?>) e; if (AbstractElement.ID_PROPERTY.equals(p)) { return el.getId(); } else { return (Comparable) el.getProperties().get(p); } }); } <START> return new Page<>(q2, pager, q.getCount("total")); <END> }</code><technical_language>here. toList() q.getCount() reports correct number, IMHO</technical_language>

Target:
public <T> Page<T> query(Query query, Pager pager, Function<Element, T> conversion, Function<T, Boolean> filter) { HawkularPipeline<?, ? extends Element> q; if (query.getFragments()[0].getFilter() instanceof RelationFilter) { q = new HawkularPipeline<>(context.getGraph()).E(); } else { q = new HawkularPipeline<>(context.getGraph()).V(); } FilterApplicator.applyAll(query, q); HawkularPipeline<?, T> q2; if (filter == null) { q2 = q.counter("total").page(pager).transform(conversion::apply); } else { q2 = q.transform(conversion::apply).filter(filter::apply).counter("total") .page(pager, (e, p) -> { if (!(e instanceof AbstractElement)) { return null; } AbstractElement<?, ?> el = (AbstractElement<?, ?>) e; if (AbstractElement.ID_PROPERTY.equals(p)) { return el.getId(); } else { return (Comparable) el.getProperties().get(p); } }); } return new SizeAwarePage<>(q2, pager, () -> q.getCount("total")); }
Source:
<code>public int append(Slice entry) throws IOException { if (outputStream == null) { outputStream = getOutputStream(currentPointer); } int entryLength = entry.length + 4; if (shouldRotate(entryLength)) { rotate(true); } outputStream.writeInt(entry.length); <START> outputStream.write(entry.toByteArray()); <END> currentPointer.offset += entryLength; if (currentPointer.offset == fileSystemWAL.maxLength) { rotate(false); } return entryLength; }</code><technical_language>write(byte b[], int off, int len) instead</technical_language>

Target:
public int append(Slice entry) throws IOException { if (outputStream == null) { outputStream = getOutputStream(currentPointer); } int entryLength = entry.length + 4; if (shouldRotate(entryLength)) { rotate(true); } outputStream.writeInt(entry.length); outputStream.write(entry.buffer, entry.offset, entry.length); currentPointer.offset += entryLength; if (currentPointer.offset == fileSystemWAL.maxLength) { rotate(false); } return entryLength; }
Source:
<code>protected boolean canDoAction() { boolean retValue=true; OVirtNodeInfo[] info = OVirtNodeInfo.get(); if (getVdsId() == null || getVdsId().equals(Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); retValue = false; } else if (getVds() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); retValue = false; } else if (isOvirtReInstallOrUpgrade()) { String isoFile = getParameters().getoVirtIsoFile(); if (getVds().getStatus() == VDSStatus.NonOperational) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL); retValue = false; } <START> if (!isIsoFileValid(isoFile, info)) { <END> addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_MISSING_IMAGE_FILE); retValue = false; } else { RpmVersion ovirtHostOsVersion = VdsHandler.getOvirtHostOsVersion(getVds()); if (ovirtHostOsVersion != null && !isIsoVersionCompatible(ovirtHostOsVersion, isoFile, info)) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_UPGRADE_BETWEEN_MAJOR_VERSION); addCanDoActionMessage(String.format("$IsoVersion %1$s", ovirtHostOsVersion.getMajor())); retValue = false; } } } return retValue; }</code><technical_language>loop info</technical_language>

Target:
protected boolean canDoAction() { boolean retValue=true; OVirtNodeInfo[] info = OVirtNodeInfo.get(); if (getVdsId() == null || getVdsId().equals(Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); retValue = false; } else if (getVds() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); retValue = false; } else if (isOvirtReInstallOrUpgrade()) { String isoFile = getParameters().getoVirtIsoFile(); if (getVds().getStatus() == VDSStatus.NonOperational) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL); retValue = false; } RpmVersion ovirtHostOsVersion = VdsHandler.getOvirtHostOsVersion(getVds()); retValue = isIsoFileValid(isoFile, info, ovirtHostOsVersion); } return retValue; }
Source:
<code>private String request(String json, String endpoint) throws IOException { Request request = new Request.Builder() .url(url(endpoint)) .post(RequestBody.create(MediaType.get("application/json"), json)) .build(); try (Response response = client.newCall(request).execute()) { return response.body().string(); } catch (InterruptedIOException e) { if ("timeout".equals(e.getMessage())) { String msg = "eslint-bridge Node.js process is unresponsive. This is most likely caused by process running out of memory." + " Consider setting sonar.javascript.node.maxspace to higher value (e.g. 4096)."; <START> LOG.error(msg); <END> } throw new IllegalStateException(e); } }</code><technical_language>test this log</technical_language>

Target:
private String request(String json, String endpoint) throws IOException { Request request = new Request.Builder() .url(url(endpoint)) .post(RequestBody.create(MediaType.get("application/json"), json)) .build(); try (Response response = client.newCall(request).execute()) { return response.body().string(); } catch (InterruptedIOException e) { String msg = "eslint-bridge Node.js process is unresponsive. This is most likely caused by process running out of memory." + " Consider setting sonar.javascript.node.maxspace to higher value (e.g. 4096)."; LOG.error(msg); throw new IllegalStateException("eslint-bridge is unresponsive", e); } }
Source:
<code><START> public CompletableFuture<TableDescriptor> getTableDescriptor(TableName tableName) { <END> return listTables(Optional.of(Pattern.compile(tableName.getNameAsString())), false) .thenApply(r -> r.stream().findFirst().get()); }</code><technical_language>Please implementation AbstractBigtableAdmin.getTableDescriptor(). there, listTables() getTableDescriptor instead</technical_language>

Target:
public CompletableFuture<TableDescriptor> getTableDescriptor(TableName tableName) { if (tableName == null) { return CompletableFuture.completedFuture(null); } String bigtableTableName = bigtableInstanceName.toTableNameStr(tableName.getNameAsString()); GetTableRequest request = GetTableRequest.newBuilder().setName(bigtableTableName).build(); return FutureUtils.toCompletableFuture(bigtableTableAdminClient.getTableAsync(request)) .handle((resp, ex) -> { if (ex != null) { if (Status.fromThrowable(ex).getCode() == Status.Code.NOT_FOUND) { throw new CompletionException(new TableNotFoundException(tableName)); } } return tableAdapter2x.adapt(resp); }); }
Source:
<code>public void removeEndpoint(InetAddressAndPort endpoint) { <START> replicaList.removeIf(r -> r.getEndpoint().equals(endpoint)); <END> }</code><technical_language>This allocates a lambda. iterate remove index. removeIf allocates iterator. need handle a null endpoint correctly. ReplicaList Replicas allow null entries</technical_language>

Target:
public void removeEndpoint(InetAddressAndPort endpoint) { for (int i=replicaList.size()-1; i>=0; i--) { if (replicaList.get(i).getEndpoint().equals(endpoint)) { replicaList.remove(i); } } }
Source:
<code><START> protected Object convertParsedObjectToVO(Object parsedContent) { <END> try { return StaleCheckExtractCsvBuilder.buildStaleCheckExtract((List<Map<String,String>>) parsedContent); } catch (Exception e) { LOG.error(e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); } }</code><technical_language>I return type of this function changed return type of StaleCheckExtractCsvBuilder.buildStaleCheckExtract(). Also, this function renamed, spell out VD is short for/</technical_language>

Target:
protected List<StaleCheckBatchRow> convertParsedObjectToVO(Object parsedContent) { try { return StaleCheckExtractCsvBuilder.buildStaleCheckExtractList((List<Map<String,String>>) parsedContent); } catch (Exception e) { LOG.error("convertParsedObjectToVO: " + e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); } }
Source:
<code>public void updated(Dictionary config) throws ConfigurationException { if (config != null) { boolean properlyConfigured = true; long refreshInterval = DEFAULT_REFRESH_INTERVAL; int port = DEFAULT_PORT; String ip = null; try { String refreshIntervalString = (String) config.get("refresh"); <START> refreshInterval = StringUtils.isNotBlank(refreshIntervalString) ? <END> Long.parseLong(refreshIntervalString) : DEFAULT_REFRESH_INTERVAL; ip = (String) config.get("ip"); properlyConfigured = properlyConfigured && StringUtils.isNotBlank(ip); String portString = (String) config.get("port"); port = StringUtils.isNumeric(portString) ? Integer.parseInt(portString) : DEFAULT_PORT; } catch (NumberFormatException ex) { properlyConfigured = false; } if (properlyConfigured) { this.refreshInterval = refreshInterval; HeatPumpBinding.ip = ip; HeatPumpBinding.port = port; } setProperlyConfigured(properlyConfigured); } }</code><technical_language>for sake of readability statically import isNotBlank()</technical_language>

Target:
public void updated(Dictionary config) throws ConfigurationException { if (config != null) { boolean properlyConfigured = true; long refreshInterval = DEFAULT_REFRESH_INTERVAL; int port = DEFAULT_PORT; String ip = null; try { String refreshIntervalString = (String) config.get("refresh"); refreshInterval = isNotBlank(refreshIntervalString) ? Long.parseLong(refreshIntervalString) : DEFAULT_REFRESH_INTERVAL; ip = (String) config.get("ip"); properlyConfigured = properlyConfigured && isNotBlank(ip); String portString = (String) config.get("port"); port = isNumeric(portString) ? Integer.parseInt(portString) : DEFAULT_PORT; } catch (NumberFormatException ex) { properlyConfigured = false; } if (properlyConfigured) { this.refreshInterval = refreshInterval; HeatPumpBinding.ip = ip; HeatPumpBinding.port = port; } setProperlyConfigured(properlyConfigured); } }
Source:
<code>public void exec(final MainRemote.Script script) throws Exception { final File file = File.createTempFile("takes-", ".txt"); if (!file.delete()) { <START> file.deleteOnExit(); <END> } final Method method = this.app.getDeclaredMethod( "main", String[].class ); final String[] passed = new String[1 + this.args.length]; passed[0] = String.format("--port=%s", file.getAbsoluteFile()); for (int idx = 0; idx < this.args.length; ++idx) { passed[idx + 1] = this.args[idx]; } final Thread thread = new Thread(new MainMethod(method, passed)); thread.start(); try { script.exec( URI.create( String.format( "http://localhost:%d", MainRemote.port(file) ) ) ); } finally { if (!file.delete()) { file.deleteOnExit(); } thread.interrupt(); } }</code><technical_language>@essobedo this strange... throwing exception</technical_language>

Target:
public void exec(final MainRemote.Script script) throws Exception { final File file = File.createTempFile("takes-", ".txt"); if (!file.delete()) { throw new IOException( String.format( "The temporary file '%s' could not be deleted before calling the exec method", file.getAbsolutePath() ) ); } final Method method = this.app.getDeclaredMethod( "main", String[].class ); final String[] passed = new String[1 + this.args.length]; passed[0] = String.format("--port=%s", file.getAbsoluteFile()); for (int idx = 0; idx < this.args.length; ++idx) { passed[idx + 1] = this.args[idx]; } final Thread thread = new Thread(new MainMethod(method, passed)); thread.start(); try { script.exec( URI.create( String.format( "http://localhost:%d", MainRemote.port(file) ) ) ); } catch (final IOException ex) { if (!file.delete()) { ex.addSuppressed( new IOException( String.format( "The temporary file '%s' could not be deleted while catching the error", file.getAbsolutePath() ) ) ); } throw ex; } finally { thread.interrupt(); } if (!file.delete()) { throw new IOException( String.format( "The temporary file '%s' could not be deleted after calling the exec method", file.getAbsolutePath() ) ); } }