auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>Bitmap decodeAsset(String filePath) throws IOException { BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; InputStream is = null; try { is = assetManager.open(filePath); BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } <START> calculateInSampleSize(data.targetWidth, data.targetHeight, options, config); <END> } InputStream is = assetManager.open(filePath); try { return BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } }</code><technical_language>this data.config instead</technical_language>

Target:
Bitmap decodeAsset(String filePath) throws IOException { BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; InputStream is = null; try { is = assetManager.open(filePath); BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } calculateInSampleSize(data.targetWidth, data.targetHeight, options, data.config); } InputStream is = assetManager.open(filePath); try { return BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } }
Source:
<code>public void testClone() { executableMap.add(DEPENDENCY_NAME1, DEPENDENCY_VALUE11, JOB_TYPE_SPARK); Assert.assertEquals(1, executableMap.size()); ExecutableRampDependencyMap clonedExecutableMap = executableMap.clone(); <START> Assert.assertEquals(clonedExecutableMap, executableMap); <END> Assert.assertEquals(DEPENDENCY_VALUE11, executableMap.getDefaultValue(DEPENDENCY_NAME1)); Assert.assertEquals(DEPENDENCY_VALUE11, clonedExecutableMap.getDefaultValue(DEPENDENCY_NAME1)); ExecutableRampDependencyMap novaExecutableMap = ExecutableRampDependencyMap.createInstance(); novaExecutableMap.add(DEPENDENCY_NAME1, DEPENDENCY_VALUE12, JOB_TYPE_SPARK_PIG); executableMap.refresh(novaExecutableMap); Assert.assertEquals(1, executableMap.size()); Assert.assertEquals(DEPENDENCY_VALUE12, executableMap.getDefaultValue(DEPENDENCY_NAME1)); Assert.assertEquals(1, clonedExecutableMap.size()); Assert.assertEquals(DEPENDENCY_VALUE12, clonedExecutableMap.getDefaultValue(DEPENDENCY_NAME1)); }</code><technical_language>Please swap params, assertEquals takes (expected, actual). executableMap is expected. clonedExecutableMap is actual</technical_language>

Target:
public void testClone() { executableMap.add(DEPENDENCY_NAME1, DEPENDENCY_VALUE11, JOB_TYPE_SPARK); Assert.assertEquals(1, executableMap.size()); ExecutableRampDependencyMap clonedExecutableMap = executableMap.clone(); Assert.assertEquals(executableMap, clonedExecutableMap); Assert.assertEquals(DEPENDENCY_VALUE11, executableMap.getDefaultValue(DEPENDENCY_NAME1)); Assert.assertEquals(DEPENDENCY_VALUE11, clonedExecutableMap.getDefaultValue(DEPENDENCY_NAME1)); ExecutableRampDependencyMap novaExecutableMap = ExecutableRampDependencyMap.createInstance(); novaExecutableMap.add(DEPENDENCY_NAME1, DEPENDENCY_VALUE12, JOB_TYPE_SPARK_PIG); executableMap.refresh(novaExecutableMap); Assert.assertEquals(1, executableMap.size()); Assert.assertEquals(DEPENDENCY_VALUE12, executableMap.getDefaultValue(DEPENDENCY_NAME1)); Assert.assertEquals(1, clonedExecutableMap.size()); Assert.assertEquals(DEPENDENCY_VALUE12, clonedExecutableMap.getDefaultValue(DEPENDENCY_NAME1)); }
Source:
<code>public String getBuilds(@QueryParam("repository") String repo, @QueryParam("userId") long userId) { List<Token> tokens = tokenDAO.findByUserId(userId); StringBuilder builder = new StringBuilder(); for (Token token : tokens) { if (token.getTokenSource().equals(TokenType.QUAY_IO.toString())) { Optional<String> asString = ResourceUtilities.asString(TARGET_URL + "repository/" + repo + "/build/", token.getContent(), client); if (asString.isPresent()) { String json = asString.get(); <START> Gson gson = new Gson(); <END> Map<String, ArrayList> map = new HashMap<>(); map = (Map<String, ArrayList>) gson.fromJson(json, map.getClass()); Map<String, Map<String, String>> map2 = new HashMap<>(); map2 = (Map<String, Map<String, String>>) map.get("builds").get(0); String gitURL = map2.get("trigger_metadata").get("git_url"); System.out.println(gitURL); builder.append(asString.get()); } builder.append("\n"); } } return builder.toString(); }</code><technical_language>Add a to-do, a Java API for this raw API calls, this is sufficient for now</technical_language>

Target:
public String getBuilds(@QueryParam("repository") String repo, @QueryParam("userId") long userId) { List<Token> tokens = tokenDAO.findByUserId(userId); StringBuilder builder = new StringBuilder(); for (Token token : tokens) { if (token.getTokenSource().equals(TokenType.QUAY_IO.toString())) { Optional<String> asString = ResourceUtilities.asString(TARGET_URL + "repository/" + repo + "/build/", token.getContent(), client); if (asString.isPresent()) { String json = asString.get(); Gson gson = new Gson(); Map<String, ArrayList> map = new HashMap<>(); map = (Map<String, ArrayList>) gson.fromJson(json, map.getClass()); Map<String, Map<String, String>> map2 = new HashMap<>(); if (!map.get("builds").isEmpty()) { map2 = (Map<String, Map<String, String>>) map.get("builds").get(0); String gitURL = map2.get("trigger_metadata").get("git_url"); LOG.info(gitURL); ArrayList<String> tags = (ArrayList<String>) map2.get("tags"); for (String tag : tags) { LOG.info(tag); } } builder.append(asString.get()); } builder.append("\n"); } } return builder.toString(); }
Source:
<code>private boolean isEmpty(String value) { <START> return (value == null || value.trim().equals("")); <END> }</code><technical_language>java value.trim().isEmpty() more clean IMO java value.trim().equals("") WDYT</technical_language>

Target:
private boolean isEmpty(String value) { return (value == null || value.trim().isEmpty()); }
Source:
<code>public void createDirectory(Path path, FileAttribute<?>... fileAttributes) throws IOException { if (!(path instanceof AzurePath)) { throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of " + "Path other than AzurePath")); } fileAttributes = fileAttributes == null ? new FileAttribute<?>[0] : fileAttributes; BlobClient client = ((AzurePath) path).toBlobClient(); Path root = path.getRoot(); if (root != null && root.equals(path)) { throw Utility.logError(logger, new IOException("Creating a root directory is not supported.")); } if (checkParentDirectoryExists(path)) { try { List<FileAttribute<?>> attributeList = new ArrayList<>(Arrays.asList(fileAttributes)); BlobHttpHeaders headers = Utility.extractHttpHeaders(attributeList, logger); Map<String, String> metadata = Utility.convertAttributesToMetadata(attributeList); putDirectoryBlob(client, headers, metadata, new BlobRequestConditions().setIfNoneMatch("*")); } catch (BlobStorageException e) { <START> if (e.getStatusCode() == HttpURLConnection.HTTP_CONFLICT) { <END> throw Utility.logError(logger, new FileAlreadyExistsException(path.toString())); } else { throw Utility.logError(logger, new IOException("An error occured when creating the directory", e)); } } } else { throw Utility.logError(logger, new IOException("Parent directory does not exist for path: " + path.toString())); } }</code><technical_language>I this isnt part of this PR do useful catch specific Error Code here</technical_language>

Target:
public void createDirectory(Path path, FileAttribute<?>... fileAttributes) throws IOException { if (!(path instanceof AzurePath)) { throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of " + "Path other than AzurePath")); } fileAttributes = fileAttributes == null ? new FileAttribute<?>[0] : fileAttributes; BlobClient client = ((AzurePath) path).toBlobClient(); Path root = path.getRoot(); if (root != null && root.equals(path)) { throw Utility.logError(logger, new IOException("Creating a root directory is not supported.")); } if (checkParentDirectoryExists(path)) { try { List<FileAttribute<?>> attributeList = new ArrayList<>(Arrays.asList(fileAttributes)); BlobHttpHeaders headers = Utility.extractHttpHeaders(attributeList, logger); Map<String, String> metadata = Utility.convertAttributesToMetadata(attributeList); putDirectoryBlob(client, headers, metadata, new BlobRequestConditions().setIfNoneMatch("*")); } catch (BlobStorageException e) { if (e.getStatusCode() == HttpURLConnection.HTTP_CONFLICT && e.getErrorCode().equals(BlobErrorCode.BLOB_ALREADY_EXISTS)) { throw Utility.logError(logger, new FileAlreadyExistsException(path.toString())); } else { throw Utility.logError(logger, new IOException("An error occured when creating the directory", e)); } } } else { throw Utility.logError(logger, new IOException("Parent directory does not exist for path: " + path.toString())); } }
Source:
<code>public Connection(final SessionTicket sessionTicket, SessionId sessionId) { if (sessionTicket == null) { throw new NullPointerException("session ticket must not be null"); } if (sessionId == null) { throw new NullPointerException("session identity must not be null"); } this.ticket = sessionTicket; this.sessionId =sessionId; this.peerAddress = null; this.autoResumptionTimeout = null; this.sessionListener = null; this.maxDeferredProcessedApplicationDataMessages = 0; <START> this.deferredApplicationData = EMPTY; <END> }</code><technical_language>setting maxDeferredProcessedApplicationDataMessages 0 deferredApplicationData empty</technical_language>

Target:
public Connection(final SessionTicket sessionTicket, SessionId sessionId) { if (sessionTicket == null) { throw new NullPointerException("session ticket must not be null"); } if (sessionId == null) { throw new NullPointerException("session identity must not be null"); } this.ticket = sessionTicket; this.sessionId =sessionId; this.peerAddress = null; this.autoResumptionTimeout = null; this.sessionListener = null; }
Source:
<code>public ReadRowsRequest get() { if (cachedRequest == null) { Scan scan = new Scan(); if (start.get() != null && !start.get().isEmpty()) { scan.setStartRow(start.get().getBytes()); } if (stop.get() != null && !stop.get().isEmpty()) { scan.setStopRow(stop.get().getBytes()); } if (maxVersion.get() != null) { scan.setMaxVersions(maxVersion.get()); } if (filter.get() != null && !filter.get().isEmpty()) { try { scan.setFilter(new ParseFilter().parseFilterString(filter.get())); } catch (CharacterCodingException e) { throw new RuntimeException(e); } } ReadHooks readHooks = new DefaultReadHooks(); Query query = Query.create(options.getBigtableTableId().get()); Adapters.SCAN_ADAPTER.adapt(scan, readHooks, query); <START> cachedRequest = ((Query)readHooks.applyPreSendHook(query)).toProto(requestContext); <END> } return cachedRequest; }</code><technical_language>do need cast readHooks .applyPreSendHook a Query</technical_language>

Target:
public ReadRowsRequest get() { if (cachedRequest == null) { Scan scan = new Scan(); if (start.get() != null && !start.get().isEmpty()) { scan.setStartRow(start.get().getBytes()); } if (stop.get() != null && !stop.get().isEmpty()) { scan.setStopRow(stop.get().getBytes()); } if (maxVersion.get() != null) { scan.setMaxVersions(maxVersion.get()); } if (filter.get() != null && !filter.get().isEmpty()) { try { scan.setFilter(new ParseFilter().parseFilterString(filter.get())); } catch (CharacterCodingException e) { throw new RuntimeException(e); } } ReadHooks readHooks = new DefaultReadHooks(); Query query = Query.create(PLACEHOLDER_TABLE_ID); Adapters.SCAN_ADAPTER.adapt(scan, readHooks, query); readHooks.applyPreSendHook(query); RequestContext requestContext = RequestContext.create(PLACEHOLDER_PROJECT_ID, PLACEHOLDER_INSTANCE_ID, PLACEHOLDER_APP_PROFILE_ID); cachedRequest = query.toProto(requestContext).toBuilder().setTableName("").setAppProfileId("").build(); } return cachedRequest; }
Source:
<code>public void testHealthCheck(String host, String opHost) { String resp = Tester.newClient(host).healthCheck(); assertNotNull(resp); <START> assertEquals(new String("{\"status\":\"running\"}").trim(), resp); <END> }</code><technical_language>hit heath check manually put exact string, assert match exact string, new String trim redundant</technical_language>

Target:
public void testHealthCheck(String host, String opHost) { String resp = Tester.newClient(host).healthCheck(); assertNotNull(resp); assertEquals("{\"status\":\"running\"}", resp); }
Source:
<code>public void loadKeyDSA() throws IOException, GeneralSecurityException { File file = new File(this.getClass().getResource("dsa").getFile()); <START> assertkeyPair(file, null); <END> }</code><technical_language>suggestion assertkeyPair(file, null); suggestion assertkeyPair(file, null); suggestion assertKeyPair(file, null);</technical_language>

Target:
public void loadKeyDSA() throws IOException, GeneralSecurityException { File file = new File(this.getClass().getResource("dsa").getFile()); assertKeyPairNotNull(file, null); }
Source:
<code>private void move(Player player, int dx, int dy){ Point point = grid.find(player); <START> point.translate(dx, dy); <END> if (grid.isValidPoint(point) && grid.isPassable(point)){ grid.set(player, point); } }</code><technical_language>this arbitrary movements possible? restrict movement adjacent moves: grid.getPossibleMoves()</technical_language>

Target:
private void move(Player player, int dx, int dy){ Point origin = grid.find(player); Point dest = new Point(origin); dest.translate(dx, dy); if (grid.getPossibleMoves(origin).contains(dest)){ grid.set(player, dest); } }
Source:
<code>public void initMetrics(SystemStreamPartition systemStreamPartition) { <START> this.noMoreMessageGaugeMap.putIfAbsent(systemStreamPartition, metricsRegistry.<Integer>newGauge(group, "no-more-messages-" + systemStreamPartition, 0)); <END> this.blockingPollCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-count-" + systemStreamPartition)); this.blockingPollTimeoutCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-timeout-count-" + systemStreamPartition)); metricsRegistry.<Integer>newGauge(group, new BufferGauge(systemStreamPartition, "buffered-message-count-" + systemStreamPartition)); metricsRegistry.<Long>newGauge(group, new BufferSizeGauge(systemStreamPartition, "buffered-message-size-" + systemStreamPartition)); }</code><technical_language>Nitpick: remove <Integer></technical_language>

Target:
public void initMetrics(SystemStreamPartition systemStreamPartition) { this.noMoreMessageGaugeMap.putIfAbsent(systemStreamPartition, metricsRegistry.newGauge(group, "no-more-messages-" + systemStreamPartition, 0)); this.blockingPollCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-count-" + systemStreamPartition)); this.blockingPollTimeoutCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-timeout-count-" + systemStreamPartition)); metricsRegistry.<Integer>newGauge(group, new BufferGauge(systemStreamPartition, "buffered-message-count-" + systemStreamPartition)); metricsRegistry.<Long>newGauge(group, new BufferSizeGauge(systemStreamPartition, "buffered-message-size-" + systemStreamPartition)); }
Source:
<code>public int compareTo(final Repo repo) { <START> int returnValue; <END> if (repo instanceof RtRepo) { final RtRepo rtRepo = (RtRepo) repo; returnValue = this.entry.uri().get().compareTo( rtRepo.entry.uri().get() ); if (returnValue == 0) { returnValue = this.coords.compareTo(rtRepo.coords); } } else { returnValue = -1; } return returnValue; }</code><technical_language>This is complicated. I a good rank Repo instances is coords, so: java return this.coords.compareTo(repo.coordinates())</technical_language>

Target:
public int compareTo(final Repo repo) { return this.coords.compareTo(repo.coordinates()); }
Source:
<code><START> public void refreshIndexDelta() { <END> if(repository.isBare()) { refresh(); return; } try { DirCache currentIndex = repository.readDirCache(); DirCache oldIndex = lastIndex; lastIndex = currentIndex; if(oldIndex == null) { refresh(); return; } Set<String> paths = new TreeSet<String>(); TreeWalk walk = new TreeWalk(repository); walk.addTree(new DirCacheIterator(oldIndex)); walk.addTree(new DirCacheIterator(currentIndex)); walk.setFilter(TreeFilter.ANY_DIFF); while(walk.next()) { if(walk.isSubtree()) walk.enterSubtree(); else paths.add(walk.getPathString()); } if(!paths.isEmpty()) { refreshFiles(paths); } } catch (Exception ex) { Activator.error(String.format(CoreText.IndexDiffCacheEntry_failed_index_load, repository), ex); scheduleReloadJob("failed to calculate index delta!"); } }</code><technical_language>this public</technical_language>

Target:
private void refreshIndexDelta() { if (repository.isBare()) return; try { DirCache currentIndex = repository.readDirCache(); DirCache oldIndex = lastIndex; lastIndex = currentIndex; if (oldIndex == null) { refresh(); return; } Set<String> paths = new TreeSet<String>(); TreeWalk walk = new TreeWalk(repository); try { walk.addTree(new DirCacheIterator(oldIndex)); walk.addTree(new DirCacheIterator(currentIndex)); walk.setFilter(TreeFilter.ANY_DIFF); while (walk.next()) { if(walk.isSubtree()) walk.enterSubtree(); else paths.add(walk.getPathString()); } } finally { walk.release(); } if (!paths.isEmpty()) refreshFiles(paths); } catch (IOException ex) { Activator.error(String.format(CoreText.IndexDiffCacheEntry_errorCalculatingIndexDelta, repository), ex); scheduleReloadJob("Exception while calculating index delta, doing full reload instead"); } }
Source:
<code>MultiUserCase(Path caseDirectoryPath) throws CaseMetadata.CaseMetadataException { CaseMetadata caseMetadata = null; try { caseMetadata = getCaseMetadataFromCaseDirectoryPath(caseDirectoryPath); } catch (CaseMetadata.CaseMetadataException ex) { logger.log(Level.SEVERE, String.format("Error reading the case metadata for %s.", caseDirectoryPath), ex); throw ex; } this.caseDirectoryPath = caseDirectoryPath; caseName = caseMetadata.getCaseDisplayName(); <START> metadataFilePath = caseDirectoryPath.resolve(caseMetadata.getCaseName() + CaseMetadata.getFileExtension()); <END> BasicFileAttributes fileAttrs = null; try { fileAttrs = Files.readAttributes(metadataFilePath, BasicFileAttributes.class); } catch (IOException ex) { logger.log(Level.SEVERE, String.format("Error reading file attributes of case metadata file in %s, will use current time for case createDate/lastModfiedDate", caseDirectoryPath), ex); } if (null != fileAttrs) { createDate = new Date(fileAttrs.creationTime().toMillis()); lastAccessedDate = new Date(fileAttrs.lastAccessTime().toMillis()); } else { createDate = new Date(); lastAccessedDate = new Date(); } }</code><technical_language>CaseMetadata a getFilePath method, here</technical_language>

Target:
MultiUserCase(Path caseDirectoryPath) throws CaseMetadata.CaseMetadataException, MultiUserCaseException { CaseMetadata caseMetadata = null; try { caseMetadata = getCaseMetadataFromCaseDirectoryPath(caseDirectoryPath); } catch (CaseMetadata.CaseMetadataException ex) { logger.log(Level.SEVERE, String.format("Error reading the case metadata for %s.", caseDirectoryPath), ex); throw ex; } this.caseDirectoryPath = caseDirectoryPath; caseName = caseMetadata.getCaseDisplayName(); metadataFilePath = caseMetadata.getFilePath(); BasicFileAttributes fileAttrs = null; try { fileAttrs = Files.readAttributes(metadataFilePath, BasicFileAttributes.class); } catch (IOException ex) { logger.log(Level.SEVERE, String.format("Error reading file attributes of case metadata file in %s, will use current time for case createDate/lastModfiedDate", caseDirectoryPath), ex); } if (null != fileAttrs) { createDate = new Date(fileAttrs.creationTime().toMillis()); lastAccessedDate = new Date(fileAttrs.lastAccessTime().toMillis()); } else { createDate = new Date(); lastAccessedDate = new Date(); } }
Source:
<code>public static String toBase64(String string) { if (string == null) { return null; } <START> String base64 = new String(Base64.getEncoder().encode(string.getBytes(UTF_8)), UTF_8); <END> String temp = base64; StringBuilder str = new StringBuilder(); while ((temp.length() / 76) > 0) { str.append(temp.substring(0, 76)); str.append("\n"); temp = temp.substring(76, temp.length()); } base64 = str.append(temp).toString(); return base64; }</code><technical_language>[Encoder.encodeToString()](<LINK_0> function</technical_language>

Target:
public static String toBase64(String string) { return toBase64_(string.getBytes(UTF_8)); }
Source:
<code>public void createEnvironment(final BasicEnvironmentConfig config, final Username user, final LocalizedOperationResult result) { Localizable noPermission = LocalizedMessage.string("NO_PERMISSION_TO_ADD_ENVIRONMENT", user.getDisplayName()); Localizable.CurryableLocalizable actionFailed = LocalizedMessage.string("ENV_ADD_FAILED"); editEnvironments(new EditEnvironments() { public void performEdit() { if (goConfigService.hasEnvironmentNamed(config.name())) { result.conflict(LocalizedMessage.string("CANNOT_ADD_ENV_ALREADY_EXISTS", config.name())); return; } <START> goConfigService.addEnvironment(config, user); <END> } }, user, result, noPermission, actionFailed); }</code><technical_language>Consider AddEnvironmentCommand for consistency UpdateEnvironmentCommand DeleteEnvrironmentCommand in respective functions</technical_language>

Target:
public void createEnvironment(final BasicEnvironmentConfig config, final Username user, final LocalizedOperationResult result) { Localizable noPermission = LocalizedMessage.string("NO_PERMISSION_TO_ADD_ENVIRONMENT", user.getDisplayName()); Localizable.CurryableLocalizable actionFailed = LocalizedMessage.string("ENV_ADD_FAILED"); editEnvironments(new EditEnvironments() { public void performEdit() { if (goConfigService.hasEnvironmentNamed(config.name())) { result.conflict(LocalizedMessage.string("CANNOT_ADD_ENV_ALREADY_EXISTS", config.name())); return; } goConfigService.updateConfig(new AddEnvironmentCommand(config, user)); } }, user, result, noPermission, actionFailed); }
Source:
<code>public Set<PartitionLoad> getPartitionLoads(){ Map<byte[], RegionLoad> regionsLoad=load.getRegionsLoad(); Set<PartitionLoad> loads = new HashSet<>(regionsLoad.size(),0.9f); for(Map.Entry<byte[],RegionLoad> regionLoad:regionsLoad.entrySet()){ String name = Bytes.toString(regionLoad.getKey()); RegionLoad rl = regionLoad.getValue(); <START> PartitionLoad pl = new HPartitionLoad(name,rl.getStorefileSizeMB()*1024,rl.getMemStoreSizeMB()*1024); <END> loads.add(pl); } return loads; }</code><technical_language>multiple 1024*1024 get number in bytes</technical_language>

Target:
public Set<PartitionLoad> getPartitionLoads(){ Map<byte[], RegionMetrics> regionsLoad=load.getRegionMetrics(); Set<PartitionLoad> loads = new HashSet<>(regionsLoad.size(),0.9f); for(Map.Entry<byte[], RegionMetrics> regionLoad:regionsLoad.entrySet()){ String name = Bytes.toString(regionLoad.getKey()); RegionMetrics rm = regionLoad.getValue(); PartitionLoad pl = new HPartitionLoad(name, (long) rm.getStoreFileSize().get(Size.Unit.BYTE), (long) rm.getMemStoreSize().get(Size.Unit.BYTE)); loads.add(pl); } return loads; }
Source:
<code>public Pair<Long, Long> find(byte bucket, byte[] begin, boolean reverse) throws IOException { if(begin == null) { SortedMap<Long, Long> m = txnTimeline.get(bucket); if(reverse) { if(m.size() == 0) { <START> return null; <END> } return new Pair<>(m.lastKey(), m.get(m.lastKey())); } else { if(m.size() == 0) { return null; } return new Pair<>(m.firstKey(), m.get(m.firstKey())); } } else { long txnId = Bytes.toLong(Bytes.slice(begin, 1, begin.length-1)); SortedMap<Long, Long> m = txnTimeline.get(bucket); if(reverse) { if(m.size() == 0) { return null; } else { long prev = -1; for(long k : m.keySet()) { if(k <= txnId) { prev = k; } else { return new Pair<>(prev, m.get(prev)); } } } } else { if(m.size() == 0) { return null; } else { for(long k : m.keySet()) { if (k > txnId) { return new Pair<>(k, m.get(k)); } } } } } return null; }</code><technical_language>SortedMap<Long, Long> m = txnTimeline.get(bucket); if(m.size() == 0) { return null done independent of if(begin == null) if(reverse). I add beginning of this function SortedMap<Long, Long> m = txnTimeline.get(bucket); if(m.size() == 0) { return null; } remove in other lines</technical_language>

Target:
public Pair<Long, Long> find(byte bucket, byte[] begin, boolean reverse) throws IOException { SortedMap<Long, Long> m = txnTimeline.get(bucket); if(m.size() == 0) { return null; } if(begin == null) { if(reverse) { return new Pair<>(m.lastKey(), m.get(m.lastKey())); } else { return new Pair<>(m.firstKey(), m.get(m.firstKey())); } } else { long txnId = Bytes.toLong(Bytes.slice(begin, 1, begin.length-1)); if(reverse) { long prev = -1; for(long k : m.keySet()) { if(k <= txnId) { prev = k; } else { return new Pair<>(prev, m.get(prev)); } } } else { for(long k : m.keySet()) { if (k > txnId) { return new Pair<>(k, m.get(k)); } } } } return null; }
Source:
<code>public void controller(PageModel model, @RequestParam(value = "returnUrl", required = false) String returnUrl) { model.addAttribute("returnUrl", returnUrl); String criterion = Context.getAdministrationService().getGlobalProperty(CoreAppsConstants.CONDITIONS_TO_BE_DISPLAYED); <START> String criterion_array[] = criterion.split(","); <END> String conditionListClasses= ""; for(String i : criterion_array) { if(i.equalsIgnoreCase("Diagnosis")) conditionListClasses += "8d4918b0-c2cc-11de-8d13-0010c6dffd0f,"; else if(i.equalsIgnoreCase("Symptom")) conditionListClasses += "8d492954-c2cc-11de-8d13-0010c6dffd0f,"; else if(i.equalsIgnoreCase("Symptom/Finding")) conditionListClasses += "8d492b2a-c2cc-11de-8d13-0010c6dffd0f,"; else conditionListClasses += "8d491a9a-c2cc-11de-8d13-0010c6dffd0f,"; } conditionListClasses = conditionListClasses.substring(0,conditionListClasses.length()-1); model.addAttribute("conditionListClasses",conditionListClasses); }</code><technical_language>get a chance naming convention? <LINK_0></technical_language>

Target:
public void controller(PageModel model, @RequestParam(value = "returnUrl", required = false) String returnUrl) { model.addAttribute("returnUrl", returnUrl); String conditionListClasses = Context.getAdministrationService().getGlobalProperty(CoreAppsConstants.GLOBAL_PROPERTY_CONDITIONS_CRITERIA); model.addAttribute("conditionListClasses",conditionListClasses); }
Source:
<code>void setupPattern() { view.setupPatternList(); <START> setUpPatternList(); <END> view.selectPattern(currentPatternValue()); view.hidePatternListWhenItIsEmpty(); }</code><technical_language>minor thing. setupPatternList methods do a slightly thing. I rename view.clearPatternList();</technical_language>

Target:
void setupPattern() { view.clearPatternList(); setUpPatternList(); view.selectPattern(currentPatternValue()); view.hidePatternListWhenItIsEmpty(); }
Source:
<code>public Deferred<Object> prefetchMeta(final byte[] table, final byte[] start, final byte[] stop) { if (Bytes.equals(table, META) || Bytes.equals(table, ROOT)) { return Deferred.fromResult(null); } byte[] meta_start = createRegionSearchKey(table, start); meta_start[meta_start.length - 1] = 0; byte[] meta_stop; if (stop.length == 0) { byte[] nulled_table = new byte[table.length + 1]; System.arraycopy(table, 0, nulled_table, 0, table.length); <START> meta_stop = createRegionSearchKey(nulled_table, stop); <END> } else { meta_stop = createRegionSearchKey(table, stop); } final Scanner meta_scanner = newScanner(META); meta_scanner.setStartKey(meta_start); meta_scanner.setStopKey(meta_stop); Callback<Object, ArrayList<ArrayList<KeyValue>>> callback = new Callback<Object, ArrayList<ArrayList<KeyValue>>>() { public Object call(final ArrayList<ArrayList<KeyValue>> results) { if (results != null && !results.isEmpty()) { for (ArrayList<KeyValue> row : results) { discoverRegion(row); } meta_scanner.nextRows().addCallback(this); } return results; } public String toString() { return "prefetchMeta nextRows"; } }; Deferred<Object> deferred = meta_scanner.nextRows().addCallback(callback); return deferred; }</code><technical_language>Another idea: Instead of pretending want table\0, do this: java meta_stop = createRegionSearchKey(table, stop); // return "table,,:" meta_stop[table.length] = 0; // "table\0,:" meta_stop[meta_stop.length - 1] = ','; // "table\0,," Scanning table\0,, is a bit table\0,,:, off-chance named a table table\0 (remember [Little Bobby Table](<LINK_0></technical_language>

Target:
public Deferred<Object> prefetchMeta(final byte[] table, final byte[] start, final byte[] stop) { if (Bytes.equals(table, META) || Bytes.equals(table, ROOT)) { return Deferred.fromResult(null); } byte[] meta_start = createRegionSearchKey(table, start); meta_start[meta_start.length - 1] = 0; byte[] meta_stop; if (stop.length == 0) { meta_stop = createRegionSearchKey(table, stop); meta_stop[table.length] = 0; meta_stop[meta_stop.length - 1] = ','; } else { meta_stop = createRegionSearchKey(table, stop); } final Scanner meta_scanner = newScanner(META); meta_scanner.setStartKey(meta_start); meta_scanner.setStopKey(meta_stop); Callback<Object, ArrayList<ArrayList<KeyValue>>> callback = new Callback<Object, ArrayList<ArrayList<KeyValue>>>() { public Object call(final ArrayList<ArrayList<KeyValue>> results) { if (results != null && !results.isEmpty()) { for (ArrayList<KeyValue> row : results) { discoverRegion(row); } meta_scanner.nextRows().addCallback(this); } return results; } public String toString() { return "prefetchMeta nextRows"; } }; Deferred<Object> deferred = meta_scanner.nextRows().addCallback(callback); return deferred; }
Source:
<code><START> public static Response<RecipientCreateResponse> createRecipientWithIban(PlaidClient client) throws Exception { <END> Address address = new Address(Arrays.asList("Street Name 999"), "City", "99999", "GB"); RecipientCreateRequest recipientCreateRequest = new RecipientCreateRequest("John Doe", "GB33BUKB20201555555555", address); Response<RecipientCreateResponse> response = client.service().recipientCreate(recipientCreateRequest).execute(); return response; }</code><technical_language>Curious want IBAN implementation detail in name if longer createRecipient method</technical_language>

Target:
public static Response<RecipientCreateResponse> createRecipientWithIban(PlaidClient client) throws Exception { Address address = new Address(Arrays.asList("Street Name 999"), "City", "99999", "GB"); RecipientCreateRequest recipientCreateRequest = new RecipientCreateRequest("John Doe").withIban("GB33BUKB20201555555555").withAddress(address); Response<RecipientCreateResponse> response = client.service().recipientCreate(recipientCreateRequest).execute(); return response; }
Source:
<code>private static List<String> mapValuesToListIgnoreCase(String keyName, Map<String, List<String>> m) { List<String> fields = new LinkedList<>(); m.entrySet().stream().filter(e -> keyName.equalsIgnoreCase(e.getKey())) <START> .forEach(e -> fields.addAll(e.getValue())); <END> return fields; }</code><technical_language>e.getValue() == null</technical_language>

Target:
private static List<String> mapValuesToListIgnoreCase(String keyName, Map<String, List<String>> m) { List<String> fields = new LinkedList<>(); m.entrySet().stream().filter(e -> keyName.equalsIgnoreCase(e.getKey())) .filter(e -> e.getValue() != null) .forEach(e -> fields.addAll(e.getValue())); return fields; }
Source:
<code>OperationController() throws IOException { networkClient = networkClientFactory.getNetworkClient(); <START> putManager = new PutManager(NonBlockingRouter.this); <END> getManager = new GetManager(NonBlockingRouter.this); deleteManager = new DeleteManager(NonBlockingRouter.this); requestResponseHandlerThread = Utils.newThread("RequestResponseHandlerThread", this, true); requestResponseHandlerThread.start(); }</code><technical_language>fact I Router passed, this this I think</technical_language>

Target:
OperationController() throws IOException { networkClient = networkClientFactory.getNetworkClient(); putManager = new PutManager(clusterMap, responseHandler, notificationSystem, routerConfig, routerMetrics, time); getManager = new GetManager(clusterMap, responseHandler, routerConfig, routerMetrics, time); deleteManager = new DeleteManager(clusterMap, responseHandler, notificationSystem, routerConfig, routerMetrics, time); requestResponseHandlerThread = Utils.newThread("RequestResponseHandlerThread", this, true); requestResponseHandlerThread.start(); }
Source:
<code>public void executeInBackground(final Runnable task) { executor.execute(new Runnable() { public void run() { <START> System.out.println("STARTING TASK"); <END> task.run(); System.out.println("ENDING TASK"); } }); }</code><technical_language>remove debug printf submitting patches</technical_language>

Target:
public void executeInBackground(final Runnable task) { executor.execute(new Runnable() { public void run() { task.run(); } }); }
Source:
<code><START> public Response intercept(Chain chain) throws IOException { <END> Request input = chain.request(); Request signed = appendBasicAuthHeaderParameters(input); Response response = chain.proceed(signed); if (response.code() == 403) { try (ResponseBody body = response.body()) { JsonReader message = enterPath(JsonReader.of(body.source()), "message"); if (message != null) throw new IllegalStateException(message.nextString()); } throw new IllegalStateException(response.toString()); } return response; }</code><technical_language>this needs a unit test, especially special-casing 403. mockwebserver do that</technical_language>

Target:
public Response intercept(Chain chain) throws IOException { Request input = chain.request(); Request requestWithCredentials = appendBasicAuthHeaderParameters(input); Response response = chain.proceed(requestWithCredentials); if (response.code() == 403) { try (ResponseBody body = response.body()) { JsonReader message = enterPath(JsonReader.of(body.source()), "message"); if (message != null) throw new IllegalStateException(message.nextString()); } throw new IllegalStateException(response.toString()); } return response; }
Source:
<code>public void testCreateDynamicGraphAllIndependent() { DynamicGraph<ITestNGMethod> graph = newGraph(IndependentTestClassSample.class); assertThat(graph.getFreeNodes()).hasSize(2); <START> for (Map.Entry<ITestNGMethod, List<DynamicGraph.Edge<ITestNGMethod>>> edge : graph.getEdges().entrySet()) { <END> assertThat(edge.getValue()).isEmpty(); } }</code><technical_language>values() instead of entrySet</technical_language>

Target:
public void testCreateDynamicGraphAllIndependent() { DynamicGraph<ITestNGMethod> graph = newGraph(IndependentTestClassSample.class); assertThat(graph.getFreeNodes()).hasSize(2); for (List<DynamicGraph.Edge<ITestNGMethod>> edge : graph.getEdges().values()) { assertThat(edge).isEmpty(); } }
Source:
<code><START> public AuthMePlayer getPlayerInfo(String playerName) { <END> PlayerAuth auth = playerCache.getAuth(playerName); if (auth == null) { auth = dataSource.getAuth(playerName); } return AuthMePlayerImpl.fromPlayerAuth(auth); }</code><technical_language>Optional</technical_language>

Target:
public Optional<AuthMePlayer> getPlayerInfo(String playerName) { PlayerAuth auth = playerCache.getAuth(playerName); if (auth == null) { auth = dataSource.getAuth(playerName); } return AuthMePlayerImpl.fromPlayerAuth(auth); }
Source:
<code>public SystemAccessControl create(Map<String, String> config) { requireNonNull(config, "config is null"); String configFileName = config.get(CONFIG_FILE_NAME); checkState( configFileName != null, "Security configuration must contain the '%s' property", CONFIG_FILE_NAME); if (config.containsKey(PERIOD)) { return refreshingSystemAccessControl( () -> { log.info("Refreshing access control, because '%s' was modified", configFileName); return create(configFileName); }, wasFileModified(toPath(configFileName)), <START> Duration.valueOf(config.get(PERIOD))); <END> } return create(configFileName); }</code><technical_language>If this fails, good include "security.refresh-period" in exc msg</technical_language>

Target:
public SystemAccessControl create(Map<String, String> config) { requireNonNull(config, "config is null"); String configFileName = config.get(SECURITY_CONFIG_FILE); checkState(configFileName != null, "Security configuration must contain the '%s' property", SECURITY_CONFIG_FILE); if (config.containsKey(SECURITY_REFRESH_PERIOD)) { Duration refreshPeriod; try { refreshPeriod = Duration.valueOf(config.get(SECURITY_REFRESH_PERIOD)); } catch (IllegalArgumentException e) { throw invalidRefreshPeriodException(config, configFileName); } if (refreshPeriod.toMillis() == 0) { throw invalidRefreshPeriodException(config, configFileName); } return ForwardingSystemAccessControl.of(memoizeWithExpiration( () -> { log.info("Refreshing system access control from %s", configFileName); return create(configFileName); }, refreshPeriod.toMillis(), MILLISECONDS)); } return create(configFileName); }
Source:
<code>private String prepareQuery(MultiSyncStep step, Collection<String> entityTopIds, Collection<String> entityIdsWithLexemes, List<Statement> insertStatements, ClassifiedStatements classifiedStatements, Set<String> refSet, Set<String> valueSet, Instant timestamp) { switch (step) { case CLEAR_OOD_SITE_LINKS: return MultiSyncStep.createClearOodLinksQuery(entityTopIds, classifiedStatements, uris); case CLEAR_OOD_ST_ABOUT_ST: return MultiSyncStep.createClearOodStatementsAboutStatementsQuery(entityIdsWithLexemes, classifiedStatements, uris); case CLEAR_OOD_ST_ABOUT_ENT: return MultiSyncStep.createClearOodStatementsAboutEntitiesQuery(entityIdsWithLexemes, classifiedStatements, uris); case INSERT_NEW_DATA: return MultiSyncStep.createInsertNewDataQuery(insertStatements); case ADD_TIMESTAMPS: return MultiSyncStep.createAddTimestampsQuery(entityTopIds, timestamp, uris); <START> case CLEANUP_REFERENCES: <END> return !refSet.isEmpty() ? MultiSyncStep.createCleanupReferencesQuery(refSet) : ""; case CLEANUP_VALUES: return !valueSet.isEmpty() ? MultiSyncStep.createCleanupValuesQuery(valueSet) : ""; default: throw new IllegalArgumentException("Step " + step.getStepName() + " is unknown!"); } }</code><technical_language>nit: filter stream instead? returning "" feels a bit odd</technical_language>

Target:
private String prepareQuery(MultiSyncStep step, Collection<String> entityTopIds, Collection<String> entityIdsWithLexemes, List<Statement> insertStatements, ClassifiedStatements classifiedStatements, Set<String> refSet, Set<String> valueSet, Instant timestamp) { switch (step) { case CLEAR_OOD_SITE_LINKS: return MultiSyncStep.createClearOodLinksQuery(entityTopIds, classifiedStatements, uris); case CLEAR_OOD_ST_ABOUT_ST: return MultiSyncStep.createClearOodStatementsAboutStatementsQuery(entityIdsWithLexemes, classifiedStatements, uris); case CLEAR_OOD_ST_ABOUT_ENT: return MultiSyncStep.createClearOodStatementsAboutEntitiesQuery(entityIdsWithLexemes, classifiedStatements, uris); case INSERT_NEW_DATA: return MultiSyncStep.createInsertNewDataQuery(insertStatements); case ADD_TIMESTAMPS: return MultiSyncStep.createAddTimestampsQuery(entityTopIds, timestamp, uris); case CLEANUP_REFERENCES: return MultiSyncStep.createCleanupReferencesQuery(refSet); case CLEANUP_VALUES: return MultiSyncStep.createCleanupValuesQuery(valueSet); default: throw new IllegalArgumentException("Step " + step.getStepName() + " is unknown!"); } }
Source:
<code>public void testMessageCountWithPaging() throws Exception { final String data = "Simple Text " + UUID.randomUUID().toString(); final String queueName = "simpleQueue"; final String addressName = "simpleAddress"; server.getAddressSettingsRepository().getMatch(addressName).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setMaxSizeBytes(1024 * 10).setPageSizeBytes(1024 * 5); session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(addressName); ClientMessage message = session.createMessage(true); message.getBodyBuffer().writeString(data); int messageCount = 0; while (!server.getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) { producer.send(message); messageCount++; } assertEquals(messageCount, server.locateQueue(queueName).getMessageCount()); checkMetric(getMetrics(), "artemis.message.count", "queue", queueName, Double.valueOf(messageCount)); for (int i = 0; i < messageCount; i++) { producer.send(message); } producer.close(); <START> assertEquals(messageCount * 2, server.locateQueue(queueName).getMessageCount()); <END> checkMetric(getMetrics(), "artemis.message.count", "queue", queueName, Double.valueOf(messageCount * 2)); }</code><technical_language>This test fails... run in loop. Wait.assertEquals please</technical_language>

Target:
public void testMessageCountWithPaging() throws Exception { final String data = "Simple Text " + UUID.randomUUID().toString(); final String queueName = "simpleQueue"; final String addressName = "simpleAddress"; server.getAddressSettingsRepository().getMatch(addressName).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setMaxSizeBytes(1024 * 10).setPageSizeBytes(1024 * 5); session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(addressName); ClientMessage message = session.createMessage(true); message.getBodyBuffer().writeString(data); long messageCount = 0; while (!server.getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) { producer.send(message); messageCount++; } Wait.assertEquals(messageCount, server.locateQueue(queueName)::getMessageCount, 2000, 100); checkMetric(getMetrics(), "artemis.message.count", "queue", queueName, Double.valueOf(messageCount)); for (int i = 0; i < messageCount; i++) { producer.send(message); } producer.close(); Wait.assertEquals(messageCount * 2, server.locateQueue(queueName)::getMessageCount, 2000, 100); checkMetric(getMetrics(), "artemis.message.count", "queue", queueName, Double.valueOf(messageCount * 2)); }
Source:
<code>public static boolean isSame( @Nullable Metacard cachedMetacard, @Nullable Metacard updatedMetacard) { if (cachedMetacard == null && updatedMetacard == null) { return true; } if (cachedMetacard == null || updatedMetacard == null) { return false; } if (!Objects.equals(cachedMetacard.getId(), updatedMetacard.getId())) { return false; } if (!Objects.equals( cachedMetacard.getAttribute(Metacard.CHECKSUM), updatedMetacard.getAttribute(Metacard.CHECKSUM))) { return false; } return allMetacardMethodsReturnMatchingAttributes(cachedMetacard, updatedMetacard); <START> } <END></code><technical_language>improve do checksum comparison return true right checksums equal null? <LINK_0></technical_language>

Target:
public static boolean isSame( @Nullable Metacard cachedMetacard, @Nullable Metacard updatedMetacard) { if (cachedMetacard == null && updatedMetacard == null) { return true; } if (cachedMetacard == null || updatedMetacard == null) { return false; } if (!Objects.equals(cachedMetacard.getId(), updatedMetacard.getId())) { return false; } if (!Objects.equals( cachedMetacard.getAttribute(Core.CHECKSUM), updatedMetacard.getAttribute(Core.CHECKSUM))) { return false; } return allMetacardMethodsReturnMatchingAttributes(cachedMetacard, updatedMetacard); }
Source:
<code>public void destroy() { <START> connectionFactoryList.forEach((ldap, connectionFactory) -> { connectionFactory.close(); }); <END> }</code><technical_language>suggestion connectionFactoryList.forEach((ldap, connectionFactory) -> connectionFactory.close(); );</technical_language>

Target:
public void destroy() { connectionFactoryList.forEach((ldap, connectionFactory) -> connectionFactory.close() ); }
Source:
<code>public void onUploadError(MediaModel media, MediaStore.MediaError error) { String localMediaId = String.valueOf(media.getId()); <START> MediaFile mf = FluxCUtils.fromMediaModel(media); <END> Map<String, Object> properties = AnalyticsUtils.getMediaProperties(this, mf.isVideo(), null, mf.getFilePath()); properties.put("error_type", error.type.name()); AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_FAILED, properties); String errorMessage; switch (error.type) { case AUTHORIZATION_REQUIRED: errorMessage = getString(R.string.media_error_no_permission_upload); break; case GENERIC_ERROR: default: errorMessage = TextUtils.isEmpty(error.message) ? getString(R.string.tap_to_try_again) : error.message; } mEditorMediaUploadListener.onMediaUploadFailed(localMediaId, errorMessage); removeMediaFromPendingList(media); }</code><technical_language>is chance media a null object? add a safety guard in case</technical_language>

Target:
public void onUploadError(MediaModel media, MediaStore.MediaError error) { String localMediaId = String.valueOf(media.getId()); Map<String, Object> properties = null; MediaFile mf = FluxCUtils.fromMediaModel(media); if (mf != null) { properties = AnalyticsUtils.getMediaProperties(this, mf.isVideo(), null, mf.getFilePath()); properties.put("error_type", error.type.name()); } AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_FAILED, properties); String errorMessage; switch (error.type) { case AUTHORIZATION_REQUIRED: errorMessage = getString(R.string.media_error_no_permission_upload); break; case GENERIC_ERROR: default: errorMessage = TextUtils.isEmpty(error.message) ? getString(R.string.tap_to_try_again) : error.message; } mEditorMediaUploadListener.onMediaUploadFailed(localMediaId, errorMessage); removeMediaFromPendingList(media); }
Source:
<code>public AttributeValue get(final String str) throws IOException { <START> AttributeValue value = null; <END> if (this.updatemap.containsKey(str)) { value = this.updatemap.get(str).getValue(); } return value; }</code><technical_language>if find attribute throw IllegalArgumentException, return nulls</technical_language>

Target:
public AttributeValue get(final String str) throws IOException { if (!this.updatemap.containsKey(str)) { throw new IllegalArgumentException(); } return this.updatemap.get(str).getValue(); }
Source:
<code>private Account executeAccount(IProgressMonitor monitor) throws GerritException { if (isVersion29OrLater(monitor)) { <START> String query = "/accounts/self"; END> org.eclipse.mylyn.internal.gerrit.core.client.rest.AccountInfo accountInfo = executeGetRestRequest(query, org.eclipse.mylyn.internal.gerrit.core.client.rest.AccountInfo.class, monitor); Account account = new Account(new Account.Id(accountInfo.getId())); account.setFullName(accountInfo.getName()); account.setUserName(accountInfo.getUsername()); account.setPreferredEmail(accountInfo.getEmail()); return account; } else { return execute(monitor, new Operation<Account>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { getAccountService(monitor).myAccount(this); } }); } }</code><technical_language>in a getAccount29 method something, worry now</technical_language>

Target:
private Account executeAccount(IProgressMonitor monitor) throws GerritException { if (isVersion29OrLater(monitor)) { return getAccount29(monitor); } else { return execute(monitor, new Operation<Account>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { getAccountService(monitor).myAccount(this); } }); } }
Source:
<code>protected void doStart() throws Exception { for (int i = 0; i < schedulers.length; i++) { ScheduledThreadPoolExecutor scheduledExecutorService = new ScheduledThreadPoolExecutor( threadsPerScheduler, <START> Threads.daemonThreadsNamed(threadBaseName + "-timeout-%s" + i)); <END> scheduledExecutorService.setRemoveOnCancelPolicy(true); schedulers[i] = scheduledExecutorService; } }</code><technical_language>Static import</technical_language>

Target:
protected void doStart() throws Exception { for (int i = 0; i < schedulers.length; i++) { ScheduledThreadPoolExecutor scheduledExecutorService = new ScheduledThreadPoolExecutor(threadsPerScheduler, threadFactory); scheduledExecutorService.setRemoveOnCancelPolicy(true); schedulers[i] = scheduledExecutorService; } }