auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void visit(NodeTraversal t, Node n, Node parent) { if (n.isName()) { String name = n.getString(); <START> if ("".equals(name)) { <END> return; } Scope s = t.getScope(); Var v = s.getVar(name); if (v == null || !v.isGlobal()) { return; } CompilerInput input = v.getInput(); if (input == null) { return; } JSModule definingChunk = input.getModule(); JSModule referencingChunk = t.getModule(); if (definingChunk != referencingChunk) { if (NodeUtil.isLhsOfAssign(n)) { t.report( n, ASSIGNMENT_TO_IMPORT, n.getString(), GetChunkName(referencingChunk)); } Set<String> namesToExport = crossChunkExports.get(definingChunk); if (namesToExport == null) { namesToExport = new HashSet<>(); crossChunkExports.put(definingChunk, namesToExport); } namesToExport.add(name); Map<JSModule, Set<String>> namesToImportByModule = crossChunkImports.get(referencingChunk); if (namesToImportByModule == null) { namesToImportByModule = new HashMap<>(); crossChunkImports.put(referencingChunk, namesToImportByModule); } Set<String> importsForModule = namesToImportByModule.get(definingChunk); if (importsForModule == null) { importsForModule = new HashSet<>(); namesToImportByModule.put(definingChunk, importsForModule); } importsForModule.add(name); } } }</code><technical_language>java // Function expressions names a NAME node empty string</technical_language>

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isName()) { String name = n.getString(); if ("".equals(name)) { return; } Scope s = t.getScope(); Var v = s.getVar(name); if (v == null || !v.isGlobal()) { return; } CompilerInput input = v.getInput(); JSModule definingChunk = input.getModule(); JSModule referencingChunk = t.getModule(); if (definingChunk != referencingChunk) { if (NodeUtil.isLValue(n)) { t.report( n, ASSIGNMENT_TO_IMPORT, n.getString(), getChunkFileName(referencingChunk)); } Set<String> namesToExport = crossChunkExports.get(definingChunk); if (namesToExport == null) { namesToExport = new HashSet<>(); crossChunkExports.put(definingChunk, namesToExport); } namesToExport.add(name); Map<JSModule, Set<String>> namesToImportByModule = crossChunkImports.get(referencingChunk); if (namesToImportByModule == null) { namesToImportByModule = new HashMap<>(); crossChunkImports.put(referencingChunk, namesToImportByModule); } Set<String> importsForModule = namesToImportByModule.get(definingChunk); if (importsForModule == null) { importsForModule = new HashSet<>(); namesToImportByModule.put(definingChunk, importsForModule); } importsForModule.add(name); } } }
Source:
<code><START> public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, <END> ServletException { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); if (engineSession != null) { try { VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); InitialContext ctx = new InitialContext(); httpSession.setAttribute( FiltersHelper.Constants.AUTHENTICATED_KEY, FiltersHelper.getBackend(ctx).runPublicQuery(VdcQueryType.ValidateSession, parameters).getSucceeded() ); FiltersHelper.closeContext(ctx); } catch (Exception ex) { log.error(String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage())); if (log.isDebugEnabled()) { log.debug("", ex); } } } } chain.doFilter(request, response); }</code><technical_language>put this logic other filter</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); InitialContext ctx = null; if (engineSession != null) { ctx = new InitialContext(); try { VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); httpSession.setAttribute( FiltersHelper.Constants.AUTHENTICATED_KEY, FiltersHelper.getBackend(ctx) .runPublicQuery(VdcQueryType.ValidateSession, parameters) .getSucceeded() ); } finally { FiltersHelper.closeContext(ctx); } } } chain.doFilter(request, response); } catch (Exception ex) { String msg = String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage()); log.error(msg); if (log.isDebugEnabled()) { log.debug("", ex); } ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
Source:
<code>private void post(Work work) { try { logger.trace("putting work on queue."); workQueue.put(work); <START> queueWork(work); <END> checkQueueSize(); } catch (InterruptedException ex) { logger.warn("Interrupted while putting work on queue!", ex); } }</code><technical_language>double storage of events? removed of workQueue usage already</technical_language>

Target:
private void post(Work work) { logger.trace("putting work on queue."); queueWork(work); checkQueueSize(); }
Source:
<code>public void evaluateUnaryExpression() { assertTrue(evaluator.evaluateUnaryExpression("# java.util.Objects.equals(" + ACTUAL_VALUE_IDENTIFIER + ", \"Test\"" + ")", "Test", String.class)); assertFalse(evaluator.evaluateUnaryExpression("# java.util.Objects.equals(" + ACTUAL_VALUE_IDENTIFIER + ", \"Test\"" + ")", "Test1", String.class)); assertTrue(evaluator.evaluateUnaryExpression("# 1", 1, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression("# 2", 1, Integer.class)); assertTrue(evaluator.evaluateUnaryExpression("# " + ACTUAL_VALUE_IDENTIFIER + " == 123", 123, Integer.class)); <START> assertTrue(evaluator.evaluateUnaryExpression("# " + ACTUAL_VALUE_IDENTIFIER + " != 123", 321, Integer.class)); <END> assertFalse(evaluator.evaluateUnaryExpression("# " + ACTUAL_VALUE_IDENTIFIER + " == 123", 321, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression("# " + ACTUAL_VALUE_IDENTIFIER + " != 123", 123, Integer.class)); assertThatThrownBy(() -> evaluator.evaluateUnaryExpression(new Object(), "", String.class)) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw value should be a String"); assertThatThrownBy(() -> evaluator.evaluateUnaryExpression(null, "", String.class)) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw value should be a String"); }</code><technical_language>@jomarko Hi. I @danielezonca is creating a specific class hold string constants code, # replaced. Beside that, I "expression" identifier, for creation (the in this tests, I think) for method invocation. This case covered- if I test it. @danielezonca</technical_language>

Target:
public void evaluateUnaryExpression() { assertTrue(evaluator.evaluateUnaryExpression(mvelExpression("java.util.Objects.equals(" + ACTUAL_VALUE_IDENTIFIER + ", \"Test\")"), "Test", String.class)); assertFalse(evaluator.evaluateUnaryExpression(mvelExpression("java.util.Objects.equals(" + ACTUAL_VALUE_IDENTIFIER + ", " + "\"Test\")"), "Test1", String.class)); assertTrue(evaluator.evaluateUnaryExpression(mvelExpression("1"), 1, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression(mvelExpression("2"), 1, Integer.class)); assertTrue(evaluator.evaluateUnaryExpression(mvelExpression(ACTUAL_VALUE_IDENTIFIER + " == 123"), 123, Integer.class)); assertTrue(evaluator.evaluateUnaryExpression(mvelExpression(ACTUAL_VALUE_IDENTIFIER + " != 123"), 321, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression(mvelExpression(ACTUAL_VALUE_IDENTIFIER + " == 123"), 321, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression(mvelExpression(ACTUAL_VALUE_IDENTIFIER + " != 123"), 123, Integer.class)); assertThatThrownBy(() -> evaluator.evaluateUnaryExpression(new Object(), "", String.class)) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw expression should be a String"); assertThatThrownBy(() -> evaluator.evaluateUnaryExpression(null, "", String.class)) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw expression should be a String"); }
Source:
<code>public Integer executeQuery(Map<String, Object> queryParameters) { Cache cache = cacheManager.getCache(getCacheName()); SearchManager searchManager = Search.getSearchManager(cache); QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(QueryableData.class).get(); TermTermination termTermination; Boolean isWildcardQuery = (Boolean) queryParameters.get(IS_WILDCARD); String onField = (String) queryParameters.get(QUERYABLE_FIELD); String matching = (String) queryParameters.get(MATCH_STRING); if (isWildcardQuery) { termTermination = queryBuilder.keyword().wildcard().onField(onField).matching(matching); } else { termTermination = queryBuilder.keyword().onField(onField).matching(matching); } CacheQuery cacheQuery = searchManager.getQuery(termTermination.createQuery()); <START> return cacheQuery.getResultSize(); <END> }</code><technical_language>I understand need full result, this operation limiting? If want instantiate result some list, define interface Queryable feature size() list() methods wrap CacheQuery inside</technical_language>

Target:
public QueryResultImpl executeQuery(Map<String, Object> queryParameters) { Cache cache = cacheManager.getCache(getCacheName()); SearchManager searchManager = Search.getSearchManager(cache); QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(QueryableData.class).get(); TermTermination termTermination; Boolean isWildcardQuery = (Boolean) queryParameters.get(IS_WILDCARD); String onField = (String) queryParameters.get(QUERYABLE_FIELD); String matching = (String) queryParameters.get(MATCH_STRING); if (isWildcardQuery) { termTermination = queryBuilder.keyword().wildcard().onField(onField).matching(matching); } else { termTermination = queryBuilder.keyword().onField(onField).matching(matching); } CacheQuery cacheQuery = searchManager.getQuery(termTermination.createQuery()); return new QueryResultImpl(cacheQuery); }
Source:
<code>public NetworkStats readNetworkStatsDetail() throws IOException { return readNetworkStatsDetail(UID_ALL, <START> null, TAG_ALL); <END> }</code><technical_language>nit: this IFACES_ALL</technical_language>

Target:
public NetworkStats readNetworkStatsDetail() throws IOException { return readNetworkStatsDetail(UID_ALL, INTERFACES_ALL, TAG_ALL); }
Source:
<code>private void list() throws IOException, ConfigInvalidException { final FS fs = getRepository().getFS(); if (configFile != null) { list(new FileBasedConfig(configFile, fs)); return; } if (system || (isListAll() && StringUtils.isEmptyOrNull(SystemReader .getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY)))) { list(SystemReader.getInstance().getSystemConfig()); } if (global || isListAll()) { <START> list(SystemReader.getInstance().getUserConfig()); <END> } if (local || isListAll()) { list(new FileBasedConfig(fs.resolve(getRepository().getDirectory(), Constants.CONFIG), fs)); } }</code><technical_language>This list contents of system config. deprecate open variants? note list() loads config</technical_language>

Target:
private void list() throws IOException, ConfigInvalidException { final FS fs = getRepository().getFS(); if (configFile != null) { list(new FileBasedConfig(configFile, fs)); return; } if (system || (isListAll() && StringUtils.isEmptyOrNull(SystemReader .getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY)))) list(SystemReader.getInstance().openSystemConfig(null, fs)); if (global || isListAll()) list(SystemReader.getInstance().openUserConfig(null, fs)); if (local || isListAll()) list(new FileBasedConfig(fs.resolve(getRepository().getDirectory(), Constants.CONFIG), fs)); }
Source:
<code>CachedFileInfo getFileInfo(final Long ledger, final byte masterKey[]) throws IOException { try { CachedFileInfo fi; pendingGetFileInfoCounter.inc(); Callable<CachedFileInfo> loader = () -> { CachedFileInfo fileInfo = fileInfoBackingCache.loadFileInfo(ledger, masterKey); activeLedgers.put(ledger, true); return fileInfo; }; do { if (null != masterKey) { fi = writeFileInfoCache.get(ledger, loader); } else { fi = readFileInfoCache.get(ledger, loader); } if (!fi.tryRetain()) { if (writeFileInfoCache.asMap().remove(ledger, fi) <START> || readFileInfoCache.asMap().remove(ledger, fi)) { <END> LOG.error("Dead fileinfo({}) forced out of cache. Must have been double-released somewhere.", fi); } fi = null; } } while (fi == null); return fi; } catch (ExecutionException | UncheckedExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) ee.getCause(); } else { throw new IOException("Failed to load file info for ledger " + ledger, ee); } } finally { pendingGetFileInfoCounter.dec(); } }</code><technical_language>if writeFileInfoCache#remove returns true miss check readFileInfoCache#remove (the 'or' evaluate operand)</technical_language>

Target:
CachedFileInfo getFileInfo(final Long ledger, final byte masterKey[]) throws IOException { try { CachedFileInfo fi; pendingGetFileInfoCounter.inc(); Callable<CachedFileInfo> loader = () -> { CachedFileInfo fileInfo = fileInfoBackingCache.loadFileInfo(ledger, masterKey); activeLedgers.put(ledger, true); return fileInfo; }; do { if (null != masterKey) { fi = writeFileInfoCache.get(ledger, loader); } else { fi = readFileInfoCache.get(ledger, loader); } if (!fi.tryRetain()) { boolean inWriteMap = writeFileInfoCache.asMap().remove(ledger, fi); boolean inReadMap = readFileInfoCache.asMap().remove(ledger, fi); if (inWriteMap || inReadMap) { LOG.error("Dead fileinfo({}) forced out of cache (write:{}, read:{}). " + "It must have been double-released somewhere.", fi, inWriteMap, inReadMap); } fi = null; } } while (fi == null); return fi; } catch (ExecutionException | UncheckedExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) ee.getCause(); } else { throw new IOException("Failed to load file info for ledger " + ledger, ee); } } finally { pendingGetFileInfoCounter.dec(); } }
Source:
<code>public void setConf(Configuration conf) { config = conf; String host = conf.get(ElasticRestConstants.HOST); if (StringUtils.isBlank(host)) { String message = "Missing elastic.host. It should be set in nutch-site.xml "; message += "\n" + describe(); <START> LOG.error(message); <END> throw new RuntimeException(message); } }</code><technical_language>Please sort this out</technical_language>

Target:
public void setConf(Configuration conf) { config = conf; String host = conf.get(ElasticRestConstants.HOST); String port = conf.get(ElasticRestConstants.PORT); if (StringUtils.isBlank(host) && StringUtils.isBlank(port)) { String message = "Missing elastic.rest.host and elastic.rest.port. At least one of them should be set in nutch-site.xml "; message += "\n" + describe(); LOG.error(message); throw new RuntimeException(message); } }
Source:
<code>public TestToolUtils() throws IOException { <START> super(); <END> }</code><technical_language>this need a super()</technical_language>

Target:
public TestToolUtils() throws IOException
Source:
<code>public UniqueConstraintDetails(Label label, String property) { <START> super(); <END> this.label = label; this.property = property; }</code><technical_language>remove useless super()</technical_language>

Target:
public UniqueConstraintDetails(Label label, String property) { this.label = label; this.property = property; }
Source:
<code>protected void disconnect() { <START> connectionAttemptState.websocket.disconnect(1000, "Websocket closed normally"); <END> }</code><technical_language>I find strange websocket is a member of connectionAttemptState, simply a member of XmppWebsocketTransportModule instead</technical_language>

Target:
protected void disconnect() { websocket.disconnect(1000, "Websocket closed normally"); }
Source:
<code>public void findAll() throws Exception { getClient().perform(get("/api/config/submissionforms")) <START> .andExpect(status().isForbidden()); <END> String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissionforms")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.totalElements", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.totalPages", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.number", is(0))) .andExpect( jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL + "config/submissionforms"))) .andExpect(jsonPath("$._embedded.submissionforms", hasSize(greaterThanOrEqualTo(1)))) ; }</code><technical_language>isUnauthorized 403</technical_language>

Target:
public void findAll() throws Exception { getClient().perform(get("/api/config/submissionforms")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissionforms")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.totalElements", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.totalPages", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.number", is(0))) .andExpect( jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL + "config/submissionforms"))) .andExpect(jsonPath("$._embedded.submissionforms", hasSize(greaterThanOrEqualTo(1)))) ; }
Source:
<code>public synchronized int abortRunning(int number) throws IllegalAccessException { int aborted = 0; Computer[] computers = getJenkinsInstance().getComputers(); for (Computer computer : computers) { if (isNull(computer)) { continue; } List<Executor> executors = computer.getExecutors(); executors.addAll(computer.getOneOffExecutors()); <START> for (Executor executor : executors) { <END> if (isNull(executor) || !executor.isBusy() || nonNull(executor.getCauseOfDeath()) || !getInterruptCauses(executor).isEmpty() || getInterruptStatus(executor) == Result.ABORTED) { continue; } Queue.Executable executable = executor.getCurrentExecutable(); final SubTask parent = executable.getParent(); if (executable instanceof Run && parent instanceof Job && ( (Job) parent).getFullName().equals(job.getFullName()) ) { final Run executableRun = (Run) executable; if (executableRun.getResult() == Result.ABORTED) { continue; } final GitHubPRCause causeAction = (GitHubPRCause) executableRun.getCause(GitHubPRCause.class); if (nonNull(causeAction) && causeAction.getNumber() == number) { LOGGER.info("Aborting {}", executableRun); executor.interrupt(Result.ABORTED, new CauseOfInterruption() { @Override public String getShortDescription() { return "Newer PR will be scheduled."; } }); aborted++; } } } } return aborted; }</code><technical_language>![MAJOR](<LINK_1> Reduce total number of break continue statements in this loop one. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public synchronized int abortRunning(int number) throws IllegalAccessException { int aborted = 0; Computer[] computers = getJenkinsInstance().getComputers(); for (Computer computer : computers) { if (isNull(computer)) { continue; } List<Executor> executors = computer.getExecutors(); executors.addAll(computer.getOneOffExecutors()); for (Executor executor : executors) { if (isNull(executor) || !executor.isBusy() || nonNull(executor.getCauseOfDeath()) || !getInterruptCauses(executor).isEmpty() || getInterruptStatus(executor) == Result.ABORTED) { continue; } Queue.Executable executable = executor.getCurrentExecutable(); final SubTask parent = executable.getParent(); if (!(executable instanceof Run)) { continue; } final Run executableRun = (Run) executable; if (!(parent instanceof Job)) { continue; } final Job parentJob = (Job) parent; if (!parentJob.getFullName().equals(job.getFullName())) { continue; } if (executableRun.getResult() == Result.ABORTED) { continue; } if (executableRun instanceof MatrixRun) { continue; } final GitHubPRCause causeAction = (GitHubPRCause) executableRun.getCause(GitHubPRCause.class); if (nonNull(causeAction) && causeAction.getNumber() == number) { LOGGER.info("Aborting '{}', by interrupting '{}'", executableRun, executor); executor.interrupt(Result.ABORTED, new NewPRInterruptCause()); aborted++; } } } return aborted; }
Source:
<code>private void saveStateAsLast(URL url) { File lastBundlesTxt = getLastBundleInfo(); try (OutputStream destinationStream = new FileOutputStream(lastBundlesTxt)) { ArrayList<File> sourcesLocation = SimpleConfiguratorUtils.getInfoFiles(); List<InputStream> sourceStreams = new ArrayList<>(sourcesLocation.size() + 1); sourceStreams.add(url.openStream()); if (Activator.EXTENDED) { for (File <START> element : <END> sourcesLocation) { sourceStreams.add(new FileInputStream(element)); } } SimpleConfiguratorUtils.transferStreams(sourceStreams, destinationStream); } catch (URISyntaxException e) { } catch (IOException e) { } }</code><technical_language>rename source</technical_language>

Target:
private void saveStateAsLast(URL url) { File lastBundlesTxt = getLastBundleInfo(); try (OutputStream destinationStream = new FileOutputStream(lastBundlesTxt)) { ArrayList<File> sourcesLocation = SimpleConfiguratorUtils.getInfoFiles(); List<InputStream> sourceStreams = new ArrayList<>(sourcesLocation.size() + 1); sourceStreams.add(url.openStream()); if (Activator.EXTENDED) { for (File source : sourcesLocation) { sourceStreams.add(new FileInputStream(source)); } } SimpleConfiguratorUtils.transferStreams(sourceStreams, destinationStream); } catch (URISyntaxException e) { } catch (IOException e) { } }
Source:
<code>public String toString() { return "[ProductContent, product = " + ((getProduct() == null) ? "null" : getProduct().getName()) + <START> ", content = " + ((content == null) ? "null" : content.getLabel()) + <END> ", enabled = " + enabled + "]"; }</code><technical_language>for product, content a toString method, this sense. I write a toString for content if like, can</technical_language>

Target:
public String toString() { return "ProductContent [product = " + getProduct() + ", content = " + content + ", enabled = " + enabled + "]"; }
Source:
<code>public void testEntrySetValueFromEntryCollections() { final String key1 = "1", value1 = "one", key2 = "2", value2 = "two", key3 = "3", value3 = "three"; Map<String, String> m = new HashMap<>(); m.put(key1, value1); m.put(key2, value2); m.put(key3, value3); cache(0, "replSync").putAll(m); <START> Cache<Object, Object> replSync = cache(0, "replSync"); <END> Set<Map.Entry<Object, Object>> entries = replSync.entrySet(); String newString = "new-value"; for (Map.Entry<Object, Object> entry : entries) { entry.setValue(newString); } assertEquals(3, cache(0, "replSync").size()); assertEquals(newString, cache(0, "replSync").get(key1)); assertEquals(newString, cache(0, "replSync").get(key2)); assertEquals(newString, cache(0, "replSync").get(key3)); }</code><technical_language>add extra variable</technical_language>

Target:
public void testEntrySetValueFromEntryCollections() { final String key1 = "1", value1 = "one", key2 = "2", value2 = "two", key3 = "3", value3 = "three"; Map<String, String> m = new HashMap<>(); m.put(key1, value1); m.put(key2, value2); m.put(key3, value3); cache(0, "replSync").putAll(m); Set<Map.Entry<Object, Object>> entries = cache(0, "replSync").entrySet(); String newString = "new-value"; for (Map.Entry<Object, Object> entry : entries) { entry.setValue(newString); } assertEquals(3, cache(0, "replSync").size()); assertEquals(newString, cache(0, "replSync").get(key1)); assertEquals(newString, cache(0, "replSync").get(key2)); assertEquals(newString, cache(0, "replSync").get(key3)); }
Source:
<code>public List<KijiRegion> getRegions() throws IOException { final HBaseAdmin hbaseAdmin = ((HBaseKiji) getKiji()).getHBaseAdmin(); final HTableInterface hbaseTable = HBaseKijiTable.downcast(this).getHTable(); final List<HRegionInfo> regions = hbaseAdmin.getTableRegions(hbaseTable.getTableName()); final HTable concreteHBaseTable = hbaseTable instanceof HTable ? (HTable) hbaseTable : null; final List<KijiRegion> result = Lists.newArrayList(); for (HRegionInfo region: regions) { if (concreteHBaseTable != null) { List<HRegionLocation> hLocations = concreteHBaseTable.getRegionsInRange(region.getStartKey(), region.getEndKey()); result.add(new HBaseKijiRegion(region, hLocations)); } else { result.add(new HBaseKijiRegion(region)); } } <START> IOUtils.closeQuietly(concreteHBaseTable); <END> return result; }</code><technical_language>ResourceUtils.closeOrLog() instead</technical_language>

Target:
public List<KijiRegion> getRegions() throws IOException { final HBaseAdmin hbaseAdmin = ((HBaseKiji) getKiji()).getHBaseAdmin(); final HTableInterface hbaseTable = getHTable(); final List<HRegionInfo> regions = hbaseAdmin.getTableRegions(hbaseTable.getTableName()); final List<KijiRegion> result = Lists.newArrayList(); if (hbaseTable instanceof HTable) { LOG.debug("Casting HTableInterface to an HTable."); final HTable concreteHBaseTable = (HTable) hbaseTable; try { for (HRegionInfo region: regions) { List<HRegionLocation> hLocations = concreteHBaseTable.getRegionsInRange(region.getStartKey(), region.getEndKey()); result.add(new HBaseKijiRegion(region, hLocations)); } } finally { ResourceUtils.closeOrLog(concreteHBaseTable); } } else { LOG.warn("Unable to cast HTableInterface to an HTable. " + "Creating Kiji regions without location info.", getURI()); for (HRegionInfo region: regions) { result.add(new HBaseKijiRegion(region)); } } return result; }
Source:
<code>public boolean matchesCodeVerifier(String codeVerifier, String code) { MessageDigest digester = null; try { digester = MessageDigest.getInstance("SHA-256"); } catch (Exception e) { <START> e.printStackTrace(); <END> } digester.update(codeVerifier.getBytes(StandardCharsets.UTF_8)); String codeChallenge = Base64.getEncoder().encodeToString(digester.digest()); String userId = OAuthUtils.getUserIdFromCode(code, getCodeSecret()); User user = User.findByUsername(userId); Optional<ApplicationUserAuthorization> authOptional = user.getApplicationUserAuthorizationSet().stream().filter(s -> s.getApplication().getOid().equals(getOid())).findFirst(); if(authOptional.isPresent()) { ApplicationUserAuthorization auth = authOptional.get(); Optional<ApplicationUserSession> session = auth.getSessionSet().stream().filter(s -> s.getUserPKCEInfoAuthorizationSession() != null && s.getUserPKCEInfoAuthorizationSession().getCodeChanllenge().equals(codeChallenge)).findFirst(); return !Strings.isNullOrEmpty(codeVerifier) && session.isPresent(); } else { return false; } }</code><technical_language>throw Error(e) in this case..</technical_language>

Target:
public boolean matchesCodeVerifier(String codeVerifier, String code) { MessageDigest digester = null; try { digester = MessageDigest.getInstance("SHA-256"); } catch (Exception e) { throw new RuntimeException("Not possible to get instance of SHA-256"); } digester.update(codeVerifier.getBytes(StandardCharsets.US_ASCII)); String codeChallenge = Base64.getEncoder().encodeToString(digester.digest()); String userId = OAuthUtils.getUserIdFromCode(code, getCodeSecret()); User user = User.findByUsername(userId); Optional<ApplicationUserAuthorization> authOptional = user.getApplicationUserAuthorizationSet().stream().filter(s -> s.getApplication().getOid().equals(getOid())).findFirst(); if(authOptional.isPresent()) { ApplicationUserAuthorization auth = authOptional.get(); Optional<ApplicationUserSession> session = auth.getSessionSet().stream().filter(s -> s.getUserPKCEInfoAuthorizationSession() != null && s.getUserPKCEInfoAuthorizationSession().getCodeChallenge().equals(codeChallenge)).findFirst(); return !Strings.isNullOrEmpty(codeVerifier) && session.isPresent(); } else { return false; } }
Source:
<code>protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().permitAll() <START> .accessDecisionManager(new AffirmativeBased(Collections.singletonList(new WebExpressionVoter()))) <END> .withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() { @Override public <O extends FilterSecurityInterceptor> O postProcess( O fsi) { fsi.setPublishAuthorizationSuccess(true); return fsi; } }); }</code><technical_language>This a odd. I need register AccessDecisionManager in order for AuthorizedEvent fired? a breaking change if applications upgraded events stopped firing</technical_language>

Target:
protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().permitAll() .withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() { @Override public <O extends FilterSecurityInterceptor> O postProcess( O fsi) { fsi.setPublishAuthorizationSuccess(true); return fsi; } }); }
Source:
<code>public void renameTo(String tagOld, String tagNew, int index, Bucket<Note> notesBucket) throws BucketObjectNameInvalid { if (!getSimperiumKey().equals(TagUtils.hashTag(tagNew))) { TagUtils.createTag((Bucket<Tag>) getBucket(), tagNew, index); ObjectCursor<Note> notesCursor = findNotes(notesBucket, tagOld); while (notesCursor.moveToNext()) { Note note = notesCursor.getObject(); List<String> tags = new ArrayList<>(note.getTags()); List<String> newTags = new ArrayList<>(tags.size()); for (String tag : tags) { <START> if (getSimperiumKey().equals(TagUtils.hashTag(tag)) && !tags.contains(tagNew)) { <END> newTags.add(tagNew); } else if (!tag.equals(tagOld)) { newTags.add(tag); } } note.setTags(newTags); note.save(); } notesCursor.close(); delete(); } else if (!getName().equals(tagNew)) { setName(tagNew); save(); } }</code><technical_language>need hash-compare tags we? rename cat dog a note Dog a tag I get a duplicate java String thisHash = getSimperiumKey(); List<String> tags = new ArrayList<String>(note.getTags()); List<String> tagHashes = new ArrayList<String>(); Set<String> tagSet = new HashSet<String>(); for (String tag : tags) { String hash = TagUtils.hashTag(tag); tagHashes.add(hash); tagSet.add(hash); } List<String> newTags = new ArrayList<String>(); for (int i = 0; i < tags.size(); i++) { if (thisHash.equals(tagHashes[i]) && !tagSet.contains(tagHashes[i])) { newTags.add(newTag); } else { newTags.add(tags[i]); } }</technical_language>

Target:
public void renameTo(String tagOld, String tagNew, int index, Bucket<Note> notesBucket) throws BucketObjectNameInvalid { boolean isOldIdEqualToNewHash = getSimperiumKey().equals(TagUtils.hashTag(tagNew)); Bucket<Tag> tagsBucket = (Bucket<Tag>) getBucket(); ObjectCursor<Note> notes = findNotes(notesBucket, tagOld); while (notes.moveToNext()) { Note note = notes.getObject(); List<String> tagsNew = new ArrayList<>(); List<String> tagsHash = new ArrayList<>(); for (String tag : note.getTags()) { if (!tag.equals(tagOld)) { tagsNew.add(tag); tagsHash.add(TagUtils.hashTag(tag)); } } if (isOldIdEqualToNewHash) { tagsNew.add(tagNew); if (!getName().equals(tagNew)) { setName(tagNew); save(); } } else { if (!tagsHash.contains(TagUtils.hashTag(tagNew))) { tagsNew.add(TagUtils.getCanonicalFromLexical(tagsBucket, tagNew)); } if (!TagUtils.hasCanonicalOfLexical(tagsBucket, tagNew)) { TagUtils.createTag(tagsBucket, tagNew, index); } delete(); } note.setTags(tagsNew); note.save(); } notes.close(); }
Source:
<code>public UpdateVmTemplateCommand(T parameters) { super(parameters); setVmTemplate(parameters.getVmTemplateData()); setVmTemplateId(getVmTemplate().getId()); setVdsGroupId(getVmTemplate().getVdsGroupId()); oldTemplate = DbFacade.getInstance().getVmTemplateDao().get(getVmTemplate().getId()); if (getVdsGroup() != null) { setStoragePoolId(getVdsGroup().getStoragePoolId() != null ? getVdsGroup().getStoragePoolId() : Guid.Empty); } Version compatibilityVersion = isBlankTemplate() || isInstanceType() <START> ? Version.getLast() : getVmTemplate().getCompatibilityVersion(); <END> if (getVdsGroup() != null || isBlankTemplate()) { getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, parameters.getVmTemplateData()); if (oldTemplate != null) { getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, oldTemplate); } } VmHandler.autoSelectUsbPolicy(getParameters().getVmTemplateData(), getVdsGroup()); VmHandler.updateDefaultTimeZone(parameters.getVmTemplateData()); VmHandler.autoSelectDefaultDisplayType(getVmTemplateId(), getParameters().getVmTemplateData(), getVdsGroup(), getParameters().getGraphicsDevices()); }</code><technical_language>I compatibility-version in template, if template custom compatibility-version cluster is changed</technical_language>

Target:
public UpdateVmTemplateCommand(T parameters) { super(parameters); setVmTemplate(parameters.getVmTemplateData()); setVmTemplateId(getVmTemplate().getId()); setVdsGroupId(getVmTemplate().getVdsGroupId()); oldTemplate = DbFacade.getInstance().getVmTemplateDao().get(getVmTemplate().getId()); if (getVdsGroup() != null) { setStoragePoolId(getVdsGroup().getStoragePoolId() != null ? getVdsGroup().getStoragePoolId() : Guid.Empty); } Version compatibilityVersion = isBlankTemplate() || isInstanceType() ? Version.getLast() : CompatibilityVersionUtils.getEffective(getVmTemplate(), this::getVdsGroup); if (getVdsGroup() != null || isBlankTemplate()) { getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, parameters.getVmTemplateData()); if (oldTemplate != null) { getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, oldTemplate); } } VmHandler.autoSelectUsbPolicy(getParameters().getVmTemplateData(), getVdsGroup()); VmHandler.updateDefaultTimeZone(parameters.getVmTemplateData()); VmHandler.autoSelectDefaultDisplayType(getVmTemplateId(), getParameters().getVmTemplateData(), getVdsGroup(), getParameters().getGraphicsDevices()); }
Source:
<code>protected void writeSpecificHeader(ByteBuffer buffer) { int size = getConfig().getMaxChildren(); buffer.putInt(extension); buffer.putInt(nbChildren); for (int i = 0; i < nbChildren; i++) { buffer.putInt(children[i]); } for (int i = nbChildren; i < size; i++) { buffer.putInt(0); } for (int i = 0; i < nbChildren; i++) { buffer.putLong(childStart[i]); } for (int i = 0; i < nbChildren; i++) { buffer.putLong(childEnd[i]); } <START> for (int i = nbChildren; i < size; i++) { <END> buffer.putLong(0); } }</code><technical_language>I this loop start time array puts. else a smaller header is calculated in getSpecificHeaderSize()</technical_language>

Target:
protected void writeSpecificHeader(ByteBuffer buffer) { int size = getConfig().getMaxChildren(); buffer.putInt(extension); buffer.putInt(nbChildren); for (int i = 0; i < nbChildren; i++) { buffer.putInt(children[i]); } for (int i = nbChildren; i < size; i++) { buffer.putInt(0); } for (int i = 0; i < nbChildren; i++) { buffer.putLong(childStart[i]); } for (int i = nbChildren; i < size; i++) { buffer.putLong(0); } for (int i = 0; i < nbChildren; i++) { buffer.putLong(childEnd[i]); } for (int i = nbChildren; i < size; i++) { buffer.putLong(Long.MAX_VALUE); } }
Source:
<code>public Map.Entry<K, Collection<V>> next() { final Map.Entry<K, Collection<V>> entry = super.next(); final K key = entry.getKey(); final Collection<V> value = entry.getValue(); <START> return new UnmodifiableMapEntry<>(key, value); <END> }</code><technical_language>inline key IMO</technical_language>

Target:
public Map.Entry<K, Collection<V>> next() { final Map.Entry<K, Collection<V>> entry = super.next(); return new UnmodifiableMapEntry<>(entry.getKey(), entry.getValue()); }
Source:
<code>private String getRtmpUrlParameters(String rtmpUrl) { <START> final String OldPattern= "rtmp:\\/\\/.+\\.kaltura\\.com:1935\\/kLive\\/\\?(p=[0-9]+)&(e=[01]_[\\d\\w]{8})&(i=0)&(t=[\\d\\w]+)"; <END> final String NewPattern= "rtmp:\\/\\/([01]_[\\d\\w]{8}).([pb])\\.kpublish\\.kaltura\\.com:\\d*\\/kLive\\/\\?(p=[0-9]+)&(t=[\\d\\w]+)"; Matcher matcher; matcher = getMatches(rtmpUrl, OldPattern); if (matcher != null && matcher.groupCount() ==4) { return matcher.group(1)+'&'+matcher.group(2)+'&'+matcher.group(3)+'&'+matcher.group(4); } else{ matcher = getMatches(rtmpUrl, NewPattern); if (matcher != null && matcher.groupCount() ==4) { String i= matcher.group(2).equals("p") ? "i=1" : "i=0" ; return "e="+matcher.group(1)+'&'+i+'&'+matcher.group(3)+'&'+matcher.group(4); } } return null; }</code><technical_language>kaltura.com:1935 in pattern, this break hostname (like QA developers). search /kLive/...</technical_language>

Target:
private String getRtmpUrlParameters(String rtmpUrl) { final String OldPattern= "\\/kLive\\/\\?(p=[0-9]+)&(e=[01]_[\\d\\w]{8})&(i=[01])&(t=[\\d\\w]+)"; final String NewPattern= "rtmp:\\/\\/([01]_[\\d\\w]{8}).([pb])\\.kpublish\\.kaltura\\.com:\\d*\\/kLive\\/\\?(p=[0-9]+)&(t=[\\d\\w]+)"; Matcher matcher; matcher = getMatches(rtmpUrl, OldPattern); if (matcher != null && matcher.groupCount() ==4) { return matcher.group(1)+'&'+matcher.group(2)+'&'+matcher.group(3)+'&'+matcher.group(4); } else{ matcher = getMatches(rtmpUrl, NewPattern); if (matcher != null && matcher.groupCount() ==4) { String i= matcher.group(2).equals("p") ? "i=0" : "i=1" ; return "e="+matcher.group(1)+'&'+i+'&'+matcher.group(3)+'&'+matcher.group(4); } } return null; }
Source:
<code>public static void main(String[] args) throws Exception { System.out.println(); System.out.println(">>> Model training over cached dataset with binary objects usage example started."); try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Ignite grid started."); IgniteCache<Integer, BinaryObject> dataCache = populateCache(ignite); CacheBasedDatasetBuilder<Integer, BinaryObject> datasetBuilder = new CacheBasedDatasetBuilder<>(ignite, dataCache).withKeepBinary(true); Vectorizer<Integer, BinaryObject, String, Double> vectorizer = new BinaryObjectVectorizer<Integer>("feature1").labeled("label"); KMeansTrainer trainer = new KMeansTrainer(); KMeansModel kmdl = trainer.fit(datasetBuilder, vectorizer); System.out.println(">>> Model trained over binary objects. Model " + kmdl); <START> dataCache.destroy(); <END> } }</code><technical_language>Try-finally, please</technical_language>

Target:
public static void main(String[] args) throws Exception { System.out.println(); System.out.println(">>> Model training over cached dataset with binary objects usage example started."); try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Ignite grid started."); IgniteCache<Integer, BinaryObject> dataCache = null; try { dataCache = populateCache(ignite); CacheBasedDatasetBuilder<Integer, BinaryObject> datasetBuilder = new CacheBasedDatasetBuilder<>(ignite, dataCache).withKeepBinary(true); Vectorizer<Integer, BinaryObject, String, Double> vectorizer = new BinaryObjectVectorizer<Integer>("feature1").labeled("label"); KMeansTrainer trainer = new KMeansTrainer(); KMeansModel kmdl = trainer.fit(datasetBuilder, vectorizer); System.out.println(">>> Model trained over binary objects. Model " + kmdl); } finally { dataCache.destroy(); } } }
Source:
<code>private static Manifest readManifestFile(final File manifestFile) { Manifest manifest = null; <START> FileInputStream fis = null; <END> try { if (manifestFile.exists()) { fis = new FileInputStream(manifestFile); manifest = new Manifest(fis); } } catch (IOException e) { } finally { StreamUtil.safeClose(fis); } return manifest; }</code><technical_language>Instead try-with-resources</technical_language>

Target:
private static Manifest readManifestFile(final File manifestFile) { try { if (manifestFile.isFile()) { try (FileInputStream fis = new FileInputStream(manifestFile)) { return new Manifest(fis); } } } catch (IOException e) { } return null; }
Source:
<code>public String name() { <START> return null; <END> }</code><technical_language>this assigned</technical_language>

Target:
public String name() { return name; }
Source:
<code>public void addValidationResults(ValidationResults value) { if (value == null || value.isEmpty()) { return; } Map<String, ValidationResult> allValidationResults = value.getAllValidationResults(); <START> if (allValidationResults != null) { <END> for (Entry<String, ValidationResult> validationResult : allValidationResults.entrySet()) { addValidationResult(validationResult.getKey(), validationResult.getValue()); } } }</code><technical_language>is redundant check. value.getAllValidationResults() return null. I developer check for null values, is control (e.g. incoming parameters of public methods, private methods)</technical_language>

Target:
public void addValidationResults(ValidationResults value) { if (value == null || value.isEmpty()) { return; } Map<String, ValidationResult> allValidationResults = value.getAll(); for (Entry<String, ValidationResult> validationResult : allValidationResults.entrySet()) { addValidationResult(validationResult.getKey(), validationResult.getValue()); } }
Source:
<code>public LilianaWakerOfTheDead(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{B}{B}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.LILIANA); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(4)); this.addAbility(new LoyaltyAbility(new LilianaWakerOfTheDeadDiscardEffect(), 1)); Ability ability = new LoyaltyAbility(new BoostTargetEffect( xValue, xValue, Duration.EndOfTurn, true <START> ).setText("target creature gets -X/-X until end of turn, where X is the number of cards in your graveyard"), -3); <END> ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new LilianaWakerOfTheDeadEmblem()), -7)); }</code><technical_language>Add card hints inform user useful data: ![shot_200608_040615](<LINK_0></technical_language>

Target:
public LilianaWakerOfTheDead(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{B}{B}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.LILIANA); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(4)); this.addAbility(new LoyaltyAbility(new LilianaWakerOfTheDeadDiscardEffect(), 1)); Ability ability = new LoyaltyAbility(new BoostTargetEffect( xValue, xValue, Duration.EndOfTurn, true ).setText("target creature gets -X/-X until end of turn, where X is the number of cards in your graveyard"), -3) .addHint(new ValueHint("Cards in your graveyard", xValue_hint)); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new LilianaWakerOfTheDeadEmblem()), -7)); }
Source:
<code>public static TimeValue parse( CharSequence text, Supplier<ZoneId> defaultZone, CSVHeaderInformation fieldsFromHeader ) { if ( fieldsFromHeader != null ) { if ( !(fieldsFromHeader instanceof TimeCSVHeaderInformation) ) { <START> throw new TemporalParseException( "Wrong header information type: " + fieldsFromHeader ); <END> } defaultZone = ((TimeCSVHeaderInformation) fieldsFromHeader).zoneSupplier( defaultZone ); } return parse( TimeValue.class, PATTERN, TimeValue::parse, text, defaultZone ); }</code><technical_language>concern above</technical_language>

Target:
public static TimeValue parse( CharSequence text, Supplier<ZoneId> defaultZone, CSVHeaderInformation fieldsFromHeader ) { if ( fieldsFromHeader != null ) { if ( !(fieldsFromHeader instanceof TimeCSVHeaderInformation) ) { throw new IllegalStateException( "Wrong header information type: " + fieldsFromHeader ); } defaultZone = ((TimeCSVHeaderInformation) fieldsFromHeader).zoneSupplier( defaultZone ); } return parse( TimeValue.class, PATTERN, TimeValue::parse, text, defaultZone ); }
Source:
<code>public static void main(String[] args) { <START> System.setProperty("hazelcast.jcache.provider.type", "client"); <END> ApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class); calculateInvocationTime(applicationContext); HazelcastClient.shutdownAll(); Hazelcast.shutdownAll(); }</code><technical_language>I set for XML configuration. @mustafaiman</technical_language>

Target:
public static void main(String[] args) { System.setProperty("hazelcast.jcache.provider.type", "client"); ApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class); doInvocation(applicationContext); HazelcastClient.shutdownAll(); Hazelcast.shutdownAll(); }
Source:
<code>public void upgradeOutcomeTableRevision2To3(SQLiteDatabase db) { String commonColumns = OutcomeEventsTable._ID + "," + OutcomeEventsTable.COLUMN_NAME_NAME + "," + OutcomeEventsTable.COLUMN_NAME_TIMESTAMP + "," + OutcomeEventsTable.COLUMN_NAME_NOTIFICATION_IDS + "," + OutcomeEventsTable.COLUMN_NAME_WEIGHT; String commonColumnsWithSessionColumn = commonColumns + "," + OutcomeEventsTable.COLUMN_NAME_SESSION; String commonColumnsWithNewSessionColumn = commonColumns + "," + OutcomeEventsTable.COLUMN_NAME_NOTIFICATION_INFLUENCE_TYPE; String auxOutcomeTableName = OutcomeEventsTable.TABLE_NAME + "_aux"; try { db.execSQL("BEGIN TRANSACTION;"); db.execSQL("ALTER TABLE " + OutcomeEventsTable.TABLE_NAME + " RENAME TO " + auxOutcomeTableName + ";"); db.execSQL(getSqlCreateOutcomeEntries()); db.execSQL("INSERT INTO " + OutcomeEventsTable.TABLE_NAME + "(" + commonColumnsWithNewSessionColumn + ")" + " SELECT " + commonColumnsWithSessionColumn + " FROM " + auxOutcomeTableName + ";"); db.execSQL("DROP TABLE " + auxOutcomeTableName + ";"); <START> db.execSQL("COMMIT;"); <END> } catch (SQLiteException e) { e.printStackTrace(); } finally { db.execSQL("COMMIT;"); } }</code><technical_language>Remove this COMMIT is in finally</technical_language>

Target:
public void upgradeOutcomeTableRevision2To3(SQLiteDatabase db) { String commonColumns = OutcomeEventsTable._ID + "," + OutcomeEventsTable.COLUMN_NAME_NAME + "," + OutcomeEventsTable.COLUMN_NAME_TIMESTAMP + "," + OutcomeEventsTable.COLUMN_NAME_NOTIFICATION_IDS + "," + OutcomeEventsTable.COLUMN_NAME_WEIGHT; String commonColumnsWithSessionColumn = commonColumns + "," + OutcomeEventsTable.COLUMN_NAME_SESSION; String commonColumnsWithNewSessionColumn = commonColumns + "," + OutcomeEventsTable.COLUMN_NAME_NOTIFICATION_INFLUENCE_TYPE; String auxOutcomeTableName = OutcomeEventsTable.TABLE_NAME + "_aux"; try { db.execSQL("BEGIN TRANSACTION;"); db.execSQL("ALTER TABLE " + OutcomeEventsTable.TABLE_NAME + " RENAME TO " + auxOutcomeTableName + ";"); db.execSQL(getSqlCreateOutcomeEntries()); db.execSQL("INSERT INTO " + OutcomeEventsTable.TABLE_NAME + "(" + commonColumnsWithNewSessionColumn + ")" + " SELECT " + commonColumnsWithSessionColumn + " FROM " + auxOutcomeTableName + ";"); db.execSQL("DROP TABLE " + auxOutcomeTableName + ";"); } catch (SQLiteException e) { e.printStackTrace(); } finally { db.execSQL("COMMIT;"); } }
Source:
<code>public static List<Integer> getThreadIds(int pid) { File threadDir = new File(String.format(ProcPath.TASK_PATH, pid)); File[] threads = threadDir <START> .listFiles(file -> DIGITS.matcher(file.getName()).matches() && Integer.valueOf(file.getName()) != pid); <END> List<Integer> threadIDs = new ArrayList<>(); for (File thread : threads) { int tid = ParseUtil.parseIntOrDefault(thread.getName(), 0); threadIDs.add(tid); } return threadIDs; }</code><technical_language>listFiles() return null if threadDir exist (e.g., process terminated called this function) need do a null check iterating below</technical_language>

Target:
public static List<Integer> getThreadIds(int pid) { File threadDir = new File(String.format(ProcPath.TASK_PATH, pid)); File[] threads = threadDir .listFiles(file -> DIGITS.matcher(file.getName()).matches() && Integer.valueOf(file.getName()) != pid); return (threads != null) ? Arrays.stream(threads) .map(thread -> ParseUtil.parseIntOrDefault(thread.getName(), 0)).collect(Collectors.toList()) : Collections.emptyList(); }
Source:
<code>public void init() throws Exception { <START> if (processedFiles.isEmpty()) { <END> return; } processedFiles .entrySet() .stream() .forEach( entry -> entry .getValue() .forEach( routeDefinition -> { try { camelContext.addRouteDefinition(routeDefinition); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } })); }</code><technical_language>If map is empty stream do anything</technical_language>

Target:
public void init() { processedFiles.values().forEach(this::addRouteDefinitions); }