auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public BytecodeNode generateExpression(BytecodeGeneratorContext context, Type returnType, List<RowExpression> arguments, Optional<Variable> outputBlockVariable) { Preconditions.checkArgument(arguments.size() == 3); Variable wasNull = context.wasNull(); LabelNode falseLabel = new LabelNode("false"); LabelNode endLabel = new LabelNode("end"); BytecodeBlock block = new BytecodeBlock() .append(context.generate(arguments.get(0), Optional.empty())); IfStatement ifStatement = new IfStatement("... and condition value was not null") .condition(wasNull); ifStatement.ifTrue() .putVariable(wasNull, false) .pop(boolean.class) .gotoLabel(falseLabel); ifStatement.ifFalse() .ifFalseGoto(falseLabel) .append(context.generate(arguments.get(1), Optional.empty())) .gotoLabel(endLabel); <START> block.append(ifStatement); <END> block.visitLabel(falseLabel) .append(context.generate(arguments.get(2), Optional.empty())); block.visitLabel(endLabel); outputBlockVariable.ifPresent(output -> block.append(generateWrite(context, returnType, output))); return block; }</code><technical_language>merge a single statement block.append(ifStatement) .visitLabel(...) .append(...) .visitLabel(...);</technical_language>

Target:
public BytecodeNode generateExpression(BytecodeGeneratorContext context, Type returnType, List<RowExpression> arguments, Optional<Variable> outputBlockVariable) { Preconditions.checkArgument(arguments.size() == 3); Variable wasNull = context.wasNull(); LabelNode falseLabel = new LabelNode("false"); LabelNode endLabel = new LabelNode("end"); BytecodeBlock block = new BytecodeBlock() .append(context.generate(arguments.get(0), Optional.empty())); IfStatement ifStatement = new IfStatement("... and condition value was not null") .condition(wasNull); ifStatement.ifTrue() .putVariable(wasNull, false) .pop(boolean.class) .gotoLabel(falseLabel); ifStatement.ifFalse() .ifFalseGoto(falseLabel) .append(context.generate(arguments.get(1), Optional.empty())) .gotoLabel(endLabel); block.append(ifStatement) .visitLabel(falseLabel) .append(context.generate(arguments.get(2), Optional.empty())); block.visitLabel(endLabel); outputBlockVariable.ifPresent(output -> block.append(generateWrite(context, returnType, output))); return block; }
Source:
<code>public void updateNextRunChangedFields(final VM currentVM, DbUser user, boolean isFiltered) { if (currentVM.isNextRunConfigurationExists()) { VM nextVM = getNextRunVmConfiguration(currentVM.getId(), user.getId(), isFiltered); if (nextVM == null) { return; } VmPropertiesUtils vmPropertiesUtils = <START> SimpleDependencyInjector.getInstance().get(VmPropertiesUtils.class); <END> vmPropertiesUtils.separateCustomPropertiesToUserAndPredefined( currentVM.getCompatibilityVersion(), currentVM.getStaticData()); vmPropertiesUtils.separateCustomPropertiesToUserAndPredefined( nextVM.getCompatibilityVersion(), nextVM.getStaticData()); currentVM.setNextRunChangedFields(getChangedFieldsForStatus(currentVM.getStaticData(), nextVM.getStaticData(), VMStatus.Up)); } }</code><technical_language>@Inject VmPropertiesUtils dependency VmHandler object</technical_language>

Target:
public void updateNextRunChangedFields(final VM currentVM, DbUser user, boolean isFiltered) { if (currentVM.isNextRunConfigurationExists()) { VM nextVM = getNextRunVmConfiguration(currentVM.getId(), user.getId(), isFiltered, true); if (nextVM == null) { return; } VmPropertiesUtils.getInstance().separateCustomPropertiesToUserAndPredefined( currentVM.getCompatibilityVersion(), currentVM.getStaticData()); VmPropertiesUtils.getInstance().separateCustomPropertiesToUserAndPredefined( nextVM.getCompatibilityVersion(), nextVM.getStaticData()); currentVM.setNextRunChangedFields(getChangedFieldsForStatus(currentVM.getStaticData(), nextVM.getStaticData(), VMStatus.Up)); } }
Source:
<code>public void deleteStoreFiles() throws StoreException, IOException { if (started) { throw new IllegalStateException("Store is still started. Deleting store files is not allowed."); } String[] swapSegmentsInUse = compactor.getSwapSegmentsInUse(); for (String fileName : swapSegmentsInUse) { logger.info("Returning swap segment to reserve pool", fileName); File swapSegmentTempFile = new File(dataDir, fileName); diskSpaceAllocator.free(swapSegmentTempFile, config.storeSegmentSizeInBytes, storeId, true); } if (log.isLogSegmented()) { Map<String, Map<Long, Long>> storeSegmentRequirement = new HashMap<>(); Map<Long, Long> segmentSizeAndNum = new HashMap<>(); segmentSizeAndNum.put(log.getSegmentCapacity(), log.getRemainingUnallocatedSegments()); storeSegmentRequirement.put(storeId, segmentSizeAndNum); <START> diskSpaceAllocator.deleteExtraSegments(storeSegmentRequirement, false); <END> } logger.info("Deleting store directory", storeId); File storeDir = new File(dataDir); try { Utils.deleteFileOrDirectory(storeDir); } catch (Exception e) { throw new IOException("Couldn't delete store directory " + dataDir, e); } logger.info("All files of store deleted", storeId); }</code><technical_language>I recommend removing isInitialize flag (and deleteExtraSegments private) adding a new method deleteAllSegmentsForStoreIds(List<String> storeIds) for non-init case</technical_language>

Target:
public void deleteStoreFiles() throws StoreException, IOException { if (started) { throw new IllegalStateException("Store is still started. Deleting store files is not allowed."); } String[] swapSegmentsInUse = compactor.getSwapSegmentsInUse(); for (String fileName : swapSegmentsInUse) { logger.info("Returning swap segment to reserve pool", fileName); File swapSegmentTempFile = new File(dataDir, fileName); diskSpaceAllocator.free(swapSegmentTempFile, config.storeSegmentSizeInBytes, storeId, true); } if (log.isLogSegmented()) { diskSpaceAllocator.deleteAllSegmentsForStoreIds(Collections.singletonList(storeId)); } logger.info("Deleting store directory", storeId); File storeDir = new File(dataDir); try { Utils.deleteFileOrDirectory(storeDir); } catch (Exception e) { throw new IOException("Couldn't delete store directory " + dataDir, e); } logger.info("All files of store deleted", storeId); }
Source:
<code><START> private DirContext getDirContext() { <END> Hashtable<String, String> env = new Hashtable<String, String>(); env.put(JAVA_NAMING_FACTORY_INITIAL, DNS_NAMING_FACTORY); env.put(JAVA_NAMING_PROVIDER_URL, DNS_PROVIDER_URL); try { return new InitialDirContext(env); } catch (Throwable e) { throw new RuntimeException("Cannot get dir context for some reason", e); } }</code><technical_language>this method throw new RuntimeException. throw this application starts: this is a critical problem rights prevent application startup. check consequences of this happening some point in time application is operating wants refresh list of Eureka nodes</technical_language>

Target:
public static DirContext getDirContext() { Hashtable<String, String> env = new Hashtable<String, String>(); env.put(JAVA_NAMING_FACTORY_INITIAL, DNS_NAMING_FACTORY); env.put(JAVA_NAMING_PROVIDER_URL, DNS_PROVIDER_URL); try { return new InitialDirContext(env); } catch (Throwable e) { throw new RuntimeException("Cannot get dir context for some reason", e); } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } <START> if ((obj == null) || (getClass() != obj.getClass())) { <END> return false; } ErrorMatcher o = (ErrorMatcher) obj; return Objects.equals(errorCode, o.errorCode) && Objects.equals(queryStage, o.queryStage) && Objects.equals(errorMessagePattern, o.errorMessagePattern); }</code><technical_language>nit: parentheses in (obj == null) (getClass() != obj.getClass()) needed</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ErrorMatcher o = (ErrorMatcher) obj; return Objects.equals(errorCode, o.errorCode) && Objects.equals(queryStage, o.queryStage) && Objects.equals(errorMessagePattern, o.errorMessagePattern); }
Source:
<code>public Dataverse findRootDataverse() { return (Dataverse) em.createQuery("select object(o) from Dataverse as o where o.owner.id = null").getSingleResult(); <START> } <END></code><technical_language>change createQuery call include return type</technical_language>

Target:
public Dataverse findRootDataverse() { return em.createQuery("select object(o) from Dataverse as o where o.owner.id = null", Dataverse.class).getSingleResult(); }
Source:
<code>public boolean openDocument(Brief doc){ if (actBrief != null) { actBrief.save(txt.getPlugin().storeToByteArray(), txt.getPlugin().getMimeType()); } if (doc == null) { return false; } if (txt.open(doc) == true) { log.debug("TextView.openDocument: "); actBrief = doc; setName(); return true; } else { actBrief = null; if (CoreHub.localCfg.get(Preferences.P_TEXT_MULTIPLE, false) == true) { setName(); String ext = MimeTool.getExtension(doc.getMimeType()); if (ext.length() == 0) { ext = "odt"; } try { File tmp = File.createTempFile("elexis", "brief." + ext); log.debug("TextView.openDocument createTempFile: " + tmp.getAbsolutePath() + " mime " + doc.getMimeType()); <START> System.out.println(tmp.getAbsolutePath()); <END> tmp.deleteOnExit(); byte[] buffer = doc.loadBinary(); if (buffer == null) { return false; } ByteArrayInputStream bais = new ByteArrayInputStream(buffer); FileOutputStream fos = new FileOutputStream(tmp); FileTool.copyStreams(bais, fos); File file = new File(tmp.getAbsolutePath()); file.setReadable(true); file.setExecutable(false); file.setWritable(false); return Program.launch(tmp.getAbsolutePath()); } catch (IOException e) { ExHandler.handle(e); } return false; } else { log.debug("TextView.openDocument: Not allowed to open multiple documents"); return false; } } }</code><technical_language>log remove</technical_language>

Target:
public boolean openDocument(Brief doc){ if (actBrief != null) { actBrief.save(txt.getPlugin().storeToByteArray(), txt.getPlugin().getMimeType()); } if (doc == null) { return false; } if (txt.open(doc) == true) { log.debug("TextView.openDocument: "); actBrief = doc; setName(); return true; } else { actBrief = null; if (CoreHub.localCfg.get(Preferences.P_TEXT_SUPPORT_LEGACY, false) == true) { setName(); String ext = MimeTool.getExtension(doc.getMimeType()); if (ext.length() == 0) { log.warn("TextView.openDocument no extension found for mime type: " + doc.getMimeType()); ext = "odt"; } try { File tmp = File.createTempFile("elexis", "brief." + ext); log.debug("TextView.openDocument createTempFile: " + tmp.getAbsolutePath() + " mime " + doc.getMimeType()); tmp.deleteOnExit(); byte[] buffer = doc.loadBinary(); if (buffer == null) { return false; } ByteArrayInputStream bais = new ByteArrayInputStream(buffer); FileOutputStream fos = new FileOutputStream(tmp); FileTool.copyStreams(bais, fos); File file = new File(tmp.getAbsolutePath()); file.setReadable(true); file.setExecutable(false); file.setWritable(false); return Program.launch(tmp.getAbsolutePath()); } catch (IOException e) { ExHandler.handle(e); } return false; } else { log.warn("TextView.openDocument: Preferences do not allow alternative method of documents created with legacy text-plugins"); return false; } } }
Source:
<code>public void launch() { Map<String,Integer> ports = new HashMap<String, Integer>(); ports.put("httpPort",getHttpPort()); ports.put("jmxPort",getJmxPort()); NetworkUtils.checkPortsValid(ports); String clusterArg = isEmpty(getClusterName()) ? "":"-g "+getClusterName(); Map<String,Object> flags = new HashMap<String, Object>(); flags.put("usePidFile",false); newScript(flags, LAUNCHING). body.append( format("export JBOSS_CLASSPATH=%s/lib/jboss-logmanager.jar",getExpandedInstallDir()), format("%s/bin/run.sh -Djboss.service.binding.set=%s -Djboss.server.base.dir=$RUN_DIR/server ",getExpandedInstallDir(),PORT_GROUP_NAME) + format("-Djboss.server.base.url=file://$RUN_DIR/server -Djboss.messaging.ServerPeerID=%s ",entity.getId())+ format("-Djboss.boot.server.log.dir=%s/server/%s/log ",getRunDir(),SERVER_TYPE) + <START> format("-b 0.0.0.0 %s -c %s ",clusterArg,SERVER_TYPE) + <END> ">>$RUN_DIR/console 2>&1 </dev/null &", "for i in {1..10}\n" + "do\n" + " grep -i 'starting' "+getRunDir()+"/console && exit\n" + " sleep 1\n" + "done\n" + "echo \"Couldn't determine if process is running (console output does not contain 'starting'); continuing but may subsequently fail\"" ).execute(); }</code><technical_language>noticed -- bind address is a config key i think, it</technical_language>

Target:
public void launch() { Map<String,Integer> ports = new HashMap<String, Integer>(); ports.put("httpPort",getHttpPort()); ports.put("jmxPort",getJmxPort()); NetworkUtils.checkPortsValid(ports); String clusterArg = isEmpty(getClusterName()) ? "":"-g "+getClusterName(); Map<String,Object> flags = new HashMap<String, Object>(); flags.put("usePidFile",false); newScript(flags, LAUNCHING). body.append( format("export JBOSS_CLASSPATH=%s/lib/jboss-logmanager.jar",getExpandedInstallDir()), format("%s/bin/run.sh -Djboss.service.binding.set=%s -Djboss.server.base.dir=$RUN_DIR/server ",getExpandedInstallDir(),PORT_GROUP_NAME) + format("-Djboss.server.base.url=file://$RUN_DIR/server -Djboss.messaging.ServerPeerID=%s ",entity.getId())+ format("-Djboss.boot.server.log.dir=%s/server/%s/log ",getRunDir(),SERVER_TYPE) + format("-b %s %s -c %s ", getBindAddress(), clusterArg,SERVER_TYPE) + ">>$RUN_DIR/console 2>&1 </dev/null &", "for i in {1..10}\n" + "do\n" + " grep -i 'starting' "+getRunDir()+"/console && exit\n" + " sleep 1\n" + "done\n" + "echo \"Couldn't determine if process is running (console output does not contain 'starting'); continuing but may subsequently fail\"" ).execute(); }
Source:
<code>private static Properties loadProperties(String propName) { Properties prop = new Properties(); InputStream in = MavenBannedVars.class.getClassLoader().getResourceAsStream(propName); if (in == null) { logger.info("{} not available with the classloader no Banned EnvVars Found . \n", propName); } else { try { prop.load(in); <START> in.close(); <END> } catch (IOException e) { logger.error(e.getMessage()); } } return prop; }</code><technical_language>Please close stream in finally block</technical_language>

Target:
private static Properties loadProperties(String propName) { Properties prop = new Properties(); InputStream in = MavenBannedVars.class.getClassLoader().getResourceAsStream(propName); if (in == null) { logger.info("{} not available with the classloader no Banned EnvVars Found . \n", propName); } else { try { prop.load(in); } catch (IOException e) { logger.error(e.getMessage()); } finally { try{ in.close(); }catch (Exception e){ logger.error(e.getMessage()); } } } return prop; }
Source:
<code><START> public void closeFile() { <END> try { raf.close(); open = false; } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>Hm, java doc next method, here</technical_language>

Target:
public void closeFile() { try { raf.close(); open = false; } catch (IOException e) { PathPrims.signalIOException(e.getMessage()); } }
Source:
<code>private void setupRemoteDriver(String device, String xmlTestName) throws MalformedURLException { loadProperties(device); DesiredCapabilities capabilities = new DesiredCapabilities(); <START> capabilities.setCapability("bitbar_apiKey", "iW1e08HZp9KBhhw3hKYvtJg53eaJBetD"); <END> capabilities.setCapability("bitbar_testrun", this.getClass().getSimpleName()); capabilities.setCapability("bitbar_project", xmlTestName); capabilities.setCapability("bitbar_device", bitbarDevice); capabilities.setCapability("browserName", browserName); capabilities.setCapability("platformName", platformName); capabilities.setCapability("deviceName", deviceName); if (automationName != null) capabilities.setCapability("automationName", automationName); driver.set(new RemoteWebDriver(new URL("<LINK_0>"), capabilities)); }</code><technical_language>key invalidated, in code</technical_language>

Target:
private void setupRemoteDriver(String device, String xmlTestName) throws MalformedURLException { loadProperties(device); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("bitbar_apiKey", "<YOUR_BITBAR_API_KEY>"); capabilities.setCapability("bitbar_testrun", this.getClass().getSimpleName()); capabilities.setCapability("bitbar_project", xmlTestName); capabilities.setCapability("bitbar_device", bitbarDevice); capabilities.setCapability("browserName", browserName); capabilities.setCapability("platformName", platformName); capabilities.setCapability("deviceName", deviceName); if (automationName != null) capabilities.setCapability("automationName", automationName); driver.set(new RemoteWebDriver(new URL("<LINK_0>"), capabilities)); }
Source:
<code>public void generate(File reportDirectory) { final File reportDataDirectory = createDirectory(reportDirectory, DATA_SUFFIX); long attachmentsSize = copyAttachments(inputDirectories, reportDataDirectory); final AtomicLong reportSize = new AtomicLong(attachmentsSize); final String testRun = testRunGenerator.generate(); ExecutorService service = Executors.newFixedThreadPool(dataProviders.size()); for (final DataProvider provider : dataProviders) { service.execute(new Runnable() { @Override public void run() { reportSize.addAndGet(provider.provide(testRun, reportDataDirectory)); } }); } try { <START> service.awaitTermination(10, TimeUnit.HOURS); <END> writeReportSize(reportSize.get(), reportDataDirectory); } catch (InterruptedException e) { throw new ReportGenerationException(e); } }</code><technical_language>Holy shit timeout</technical_language>

Target:
public void generate(File reportDirectory) { final File reportDataDirectory = createDirectory(reportDirectory, DATA_SUFFIX); long attachmentsSize = copyAttachments(inputDirectories, reportDataDirectory); final AtomicLong reportSize = new AtomicLong(attachmentsSize); final String testRun = testRunGenerator.generate(); ExecutorService service = Executors.newFixedThreadPool(dataProviders.size()); for (final DataProvider provider : dataProviders) { service.execute(new Runnable() { @Override public void run() { reportSize.addAndGet(provider.provide(testRun, reportDataDirectory)); } }); } try { service.shutdown(); service.awaitTermination(1, TimeUnit.HOURS); writeReportSize(reportSize.get(), reportDataDirectory); } catch (InterruptedException e) { throw new ReportGenerationException(e); } }
Source:
<code>public void shouldSetCreationDate() { DocumentModel doc = session.createDocumentModel("/", "file", "File"); Calendar currentDate = Calendar.getInstance(); Map<String, Object> originalProperties = new HashMap<>(doc.getProperties("dublincore")); <START> Set<String> expectedChangedProperties = new HashSet<>(); <END> expectedChangedProperties.add("dc:created"); storageService.setCreationDate(doc, currentDate); assertDocumentPropertiesChanges(doc, originalProperties, expectedChangedProperties); assertEquals(currentDate, doc.getPropertyValue("dc:created")); }</code><technical_language>Collections.singleton</technical_language>

Target:
public void shouldSetCreationDate() { DocumentModel doc = session.createDocumentModel("/", "file", "File"); Calendar currentDate = Calendar.getInstance(); Map<String, Object> originalProperties = new HashMap<>(doc.getProperties("dublincore")); Set<String> expectedChangedProperties = Collections.singleton("dc:created"); storageService.setCreationDate(doc, currentDate); assertDocumentPropertiesChanges(doc, originalProperties, expectedChangedProperties); assertEquals(currentDate, doc.getPropertyValue("dc:created")); }
Source:
<code>public static RangeMap<Integer, Set<Integer>> getPartitionGroupsFromTopology(AbstractTopology topo) { Set<Integer> visited = new HashSet<>(); RangeMap<Integer, Set<Integer>> protectionGroups = TreeRangeMap.create(); for (AbstractTopology.Host host : topo.hostsById.values()) { if (visited.contains(host.id) || host.partitions.isEmpty()) { continue; } Set<Integer> hosts = new HashSet<>(); @SuppressWarnings("unchecked") Range<Integer>[] partitionRange = new Range[1]; buildProtectionGroup(topo, visited, host, partitionRange, hosts); <START> assertEquals(hosts.size() * topo.getSitesPerHost() / (topo.getReplicationFactor() + 1), <END> partitionRange[0].upperEndpoint() - partitionRange[0].lowerEndpoint() + 1); protectionGroups.put(partitionRange[0], hosts); } return protectionGroups; }</code><technical_language>I guess change this assert hosts.size() * topo.getSitesPerHost() / (topo.getReplicationFactor() + 1) == partitionRange[0].upperEndpoint() - partitionRange[0].lowerEndpoint() + 1;</technical_language>

Target:
public static RangeMap<Integer, Set<Integer>> getPartitionGroupsFromTopology(AbstractTopology topo) { Set<Integer> visited = new HashSet<>(); RangeMap<Integer, Set<Integer>> protectionGroups = TreeRangeMap.create(); for (AbstractTopology.Host host : topo.hostsById.values()) { if (visited.contains(host.id) || host.partitions.isEmpty()) { continue; } Set<Integer> hosts = new HashSet<>(); @SuppressWarnings("unchecked") Range<Integer>[] partitionRange = new Range[1]; buildProtectionGroup(topo, visited, host, partitionRange, hosts); assert hosts.size() * topo.getSitesPerHost() / (topo.getReplicationFactor() + 1) == partitionRange[0].upperEndpoint() - partitionRange[0].lowerEndpoint() + 1; protectionGroups.put(partitionRange[0], hosts); } return protectionGroups; }
Source:
<code>private static X509Certificate buildCertificateFromPEM(String pem) throws IOException, CertificateException { InputStream stream = new ByteArrayInputStream(pem.getBytes("UTF-8")); X509Certificate x509Certificate = (X509Certificate) CERTIFICATE_FACTORY.generateCertificate(stream); <START> stream.close(); <END> return x509Certificate; }</code><technical_language>This closed if CertificateException is thrown</technical_language>

Target:
private static X509Certificate buildCertificateFromPEM(String pem) throws IOException, CertificateException { InputStream stream = null; try { stream = new ByteArrayInputStream(pem.getBytes("UTF-8")); return (X509Certificate) CERTIFICATE_FACTORY.generateCertificate(stream); } finally { if (stream != null) { stream.close(); } } }
Source:
<code>private Status runJob() { Status finalStatus = node.getStatus(); try { job.run(); } catch (Throwable e) { if (props.getBoolean("job.succeed.on.failure", false)) { finalStatus = changeStatus(Status.FAILED_SUCCEEDED); logError("Job run failed, but will treat it like success."); logError(e.getMessage() + " cause: " + e.getCause(), e); } else { <START> finalStatus = (e instanceof OutOfMemoryException) ? changeToFailureStatusWithCause(ExecutableNode.FailureCause.OOM) : changeStatus(Status.FAILED); <END> logError("Job run failed!", e); logError(e.getMessage() + " cause: " + e.getCause()); } } if (job != null) { node.setOutputProps(job.getJobGeneratedProperties()); } if (!Status.isStatusFinished(finalStatus)) { finalStatus = changeStatus(Status.SUCCEEDED); } return finalStatus; }</code><technical_language>simpler detect memory situation in azkaban.execapp.JobRunner#run retry sleeping for some time</technical_language>

Target:
private Status runJob() { Status finalStatus = node.getStatus(); try { job.run(); } catch (Throwable e) { if (props.getBoolean("job.succeed.on.failure", false)) { finalStatus = changeStatus(Status.FAILED_SUCCEEDED); logError("Job run failed, but will treat it like success."); logError(e.getMessage() + " cause: " + e.getCause(), e); } else { finalStatus = changeStatus(Status.FAILED); logError("Job run failed!", e); logError(e.getMessage() + " cause: " + e.getCause()); } } if (job != null) { node.setOutputProps(job.getJobGeneratedProperties()); } if (!Status.isStatusFinished(finalStatus)) { finalStatus = changeStatus(Status.SUCCEEDED); } return finalStatus; }
Source:
<code>private Map<String, String> getColumnMap(ProviderContext context){ Class entityClass = getEntityClass(context); Field[] fields = entityClass.getDeclaredFields(); Map<String, String> columnMap = new LinkedHashMap<String, String>(); for (Field field : fields) { BaseMapper.Column column = field.getAnnotation(BaseMapper.Column.class); <START> if(column != null){ <END> String columnName = column.value(); if(columnName == null || columnName.length() == 0){ columnName = field.getName(); } columnMap.put(columnName, field.getName()); } } if(columnMap.size() == 0){ throw new RuntimeException("There is no field in the class [" + entityClass.getCanonicalName() + "] that specifies the @BaseMapper.Column annotation."); } return columnMap; }</code><technical_language>apply formatter, please? Eclipse formatter config is [here](<LINK_0> IntelliJ import it, I think</technical_language>

Target:
private Map<String, String> getColumnMap(ProviderContext context) { Class<?> entityClass = getEntityClass(context); Field[] fields = entityClass.getDeclaredFields(); Map<String, String> columnMap = new LinkedHashMap<String, String>(); for (Field field : fields) { BaseMapper.Column column = field.getAnnotation(BaseMapper.Column.class); if (column != null) { String columnName = column.value(); if (columnName == null || columnName.length() == 0) { columnName = field.getName(); } columnMap.put(columnName, field.getName()); } } if (columnMap.size() == 0) { throw new RuntimeException("There is no field in the class [" + entityClass.getCanonicalName() + "] that specifies the @BaseMapper.Column annotation."); } return columnMap; }
Source:
<code>public String[] getSupportedEncodingMethods() { <START> return new String[]{"Base32", "Base64"}; <END> }</code><technical_language>defined Constants</technical_language>

Target:
public String[] getSupportedEncodingMethods() { return new String[]{Constants.BASE32, Constants.BASE64}; }
Source:
<code>private void addHitsFromQuery(List<BibEntry> entryList, String queryURL) throws IOException, FetcherException { String content = new URLDownload(queryURL).asString(); if (needsCaptcha(content)) { <START> LOGGER.info("Captcha hit at {}", queryURL); <END> throw new FetcherException("Fetching from Google Scholar failed.", Localization.lang("This might be caused by reaching the traffic limitation of Google Scholar (see 'Help' for details)."), null); } Matcher matcher = LINK_TO_BIB_PATTERN.matcher(content); while (matcher.find()) { String citationsPageURL = matcher.group().replace("&amp;", "&"); BibEntry newEntry = downloadEntry(citationsPageURL); entryList.add(newEntry); } }</code><technical_language>removed in opinion</technical_language>

Target:
private void addHitsFromQuery(List<BibEntry> entryList, String queryURL) throws IOException, FetcherException { String content = new URLDownload(queryURL).asString(); if (needsCaptcha(content)) { throw new FetcherException("Fetching from Google Scholar failed: Captacha hit at " + queryURL + ".", Localization.lang("This might be caused by reaching the traffic limitation of Google Scholar (see 'Help' for details)."), null); } Matcher matcher = LINK_TO_BIB_PATTERN.matcher(content); while (matcher.find()) { String citationsPageURL = matcher.group().replace("&amp;", "&"); BibEntry newEntry = downloadEntry(citationsPageURL); entryList.add(newEntry); } }
Source:
<code>public void before_shouldNotifyListenersAboutCheckedPrivileges() { listener1.hasPrivileges.clear(); listener1.lacksPrivileges.clear(); listener2.hasPrivileges.clear(); listener2.lacksPrivileges.clear(); Concept concept = Context.getConceptService().getConcept(3); assertThat("listener1", listener1.hasPrivileges, containsInAnyOrder("Get Concepts")); assertThat("listener2", listener2.hasPrivileges, containsInAnyOrder("Get Concepts")); assertThat(listener1.lacksPrivileges, empty()); assertThat(listener2.lacksPrivileges, empty()); listener1.hasPrivileges.clear(); listener2.hasPrivileges.clear(); Context.getConceptService().saveConcept(concept); <START> assertThat("listener1", listener1.hasPrivileges, containsInAnyOrder("Manage Concepts", "Get Observations", "Get Concept Attribute Types", "Get Concept Map Types")); <END> assertThat("listener2", listener2.hasPrivileges, containsInAnyOrder("Manage Concepts", "Get Observations", "Get Concept Attribute Types", "Get Concept Map Types")); assertThat(listener1.lacksPrivileges, empty()); assertThat(listener2.lacksPrivileges, empty()); }</code><technical_language>@mavrk is change needed</technical_language>

Target:
public void before_shouldNotifyListenersAboutCheckedPrivileges() { listener1.hasPrivileges.clear(); listener1.lacksPrivileges.clear(); listener2.hasPrivileges.clear(); listener2.lacksPrivileges.clear(); Concept concept = Context.getConceptService().getConcept(3); assertThat("listener1", listener1.hasPrivileges, containsInAnyOrder("Get Concepts")); assertThat("listener2", listener2.hasPrivileges, containsInAnyOrder("Get Concepts")); assertThat(listener1.lacksPrivileges, empty()); assertThat(listener2.lacksPrivileges, empty()); listener1.hasPrivileges.clear(); listener2.hasPrivileges.clear(); Context.getConceptService().saveConcept(concept); assertThat("listener1", listener1.hasPrivileges, containsInAnyOrder("Manage Concepts", "Get Observations", "Get Concept Attribute Types")); assertThat("listener2", listener2.hasPrivileges, containsInAnyOrder("Manage Concepts", "Get Observations", "Get Concept Attribute Types")); assertThat(listener1.lacksPrivileges, empty()); assertThat(listener2.lacksPrivileges, empty()); }
Source:
<code>public void run() { try { <START> Thread.sleep(300); <END> } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while sleeping to simulate computation"); } parameterWorker.push(KEY, parameter); final Integer value = parameterWorker.pull(KEY); LOG.log(Level.INFO, "Current value associated with key {0} is {1}", new Object[]{KEY, value}); }</code><technical_language>Please move this magic number a static variable</technical_language>

Target:
public void run() { try { Thread.sleep(DELAY_MS); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while sleeping to simulate computation", e); } parameterWorker.push(KEY, parameter); final Integer value = parameterWorker.pull(KEY); LOG.log(Level.INFO, "Current value associated with key {0} is {1}", new Object[]{KEY, value}); }
Source:
<code>protected void onResumeFragments() { <START> showPendingAlertDialog(); <END> }</code><technical_language>Missing call super implementation of onResumeFragments()</technical_language>

Target:
protected void onResumeFragments() { super.onResumeFragments(); showPendingAlertDialog(); }
Source:
<code>private void describeChildren(final Resource resource, final ImmutableManagementResourceRegistration registration, final PathAddress address, OperationContext context, final AtomicReference<ModelNode> failureRef, final ModelNode results, ModelNode operation, Boolean nest) { resource.getChildTypes().forEach((childType) -> { resource.getChildren(childType).stream() .filter(entry -> { final ImmutableManagementResourceRegistration childRegistration = registration.getSubModel(PathAddress.EMPTY_ADDRESS.append(entry.getPathElement())); if(childRegistration == null) { <START> ControllerLogger.ROOT_LOGGER.warnf("Couldn't find a registration for %s at %s for resource %s at %s", entry.getPathElement().toString(), registration.getPathAddress().toCLIStyleString(), resource, address.toCLIStyleString()); <END> return false; } return !childRegistration.isRuntimeOnly() && !childRegistration.isRemote() && !childRegistration.isAlias(); }) .filter(entry -> addressFilter == null || addressFilter.accepts(address.append(entry.getPathElement()))) .forEach((entry) -> describeChildResource(entry, registration, address, context, failureRef, results, operation, nest)); }); }</code><technical_language>WARN this requires a method in ControllerLogger for i18n. this is I debug is fine. If this happen child runtime relevant anyway. A resource actual feature work a registration</technical_language>

Target:
private void describeChildren(final Resource resource, final ImmutableManagementResourceRegistration registration, final PathAddress address, OperationContext context, final AtomicReference<ModelNode> failureRef, final ModelNode results, ModelNode operation, Boolean nest) { for(String childType : resource.getChildTypes()) { for(Resource.ResourceEntry entry : resource.getChildren(childType)) { if(addressFilter != null && !addressFilter.accepts(address.append(entry.getPathElement()))) { continue; } final ImmutableManagementResourceRegistration childRegistration = registration.getSubModel(PathAddress.EMPTY_ADDRESS.append(entry.getPathElement())); if(childRegistration == null) { ControllerLogger.ROOT_LOGGER.debugf("Couldn't find a registration for %s at %s for resource %s at %s", entry.getPathElement().toString(), registration.getPathAddress().toCLIStyleString(), resource, address.toCLIStyleString()); continue; } if(childRegistration.isRuntimeOnly() || childRegistration.isRemote() || childRegistration.isAlias()) { continue; } describeChildResource(entry, registration, address, context, failureRef, results, operation, nest); } } }
Source:
<code><START> public EquivGraphController(LookupEntryStore lookupStore) { <END> this.lookupStore = checkNotNull(lookupStore); this.codec = SubstitutionTableNumberCodec.lowerCaseOnly(); }</code><technical_language>convert private constructor a static create method</technical_language>

Target:
private EquivGraphController(LookupEntryStore lookupStore) { this.lookupStore = checkNotNull(lookupStore); this.codec = SubstitutionTableNumberCodec.lowerCaseOnly(); }
Source:
<code>public static ParameterizedType makeClassName(String baseName, Optional<String> suffix) { String className = baseName + "_" <START> + suffix.orElse(Instant.now().atZone(UTC).format(TIMESTAMP_FORMAT)) <END> + "_" + CLASS_ID.incrementAndGet(); String javaClassName = toJavaIdentifierString(className); return ParameterizedType.typeFromJavaClassName("com.facebook.presto.$gen." + javaClassName); }</code><technical_language>Note this eagerly materialize parameter Instant.now().atZone(UTC).format(TIMESTAMP_FORMAT) suffix is presented. I a major performance issue suffix presented in places. @haozhun thoughts handle this</technical_language>

Target:
public static ParameterizedType makeClassName(String baseName, Optional<String> suffix) { String className = baseName + "_" + suffix.orElseGet(() -> Instant.now().atZone(UTC).format(TIMESTAMP_FORMAT)) + "_" + CLASS_ID.incrementAndGet(); String javaClassName = toJavaIdentifierString(className); return ParameterizedType.typeFromJavaClassName("com.facebook.presto.$gen." + javaClassName); }
Source:
<code>private static List<Range<Long>> parseCpuRangesText(final String string) { if (!validateCpuRange(string)) { <START> return null; <END> } string.split(RANGES_DELIMITER); List<Range<Long>> results = new ArrayList<>(); for (String range : Arrays.asList(string.split(RANGES_DELIMITER))) { if (range.contains(INTERNAL_RANGE_SEPARATOR)) { String[] split = range.split(INTERNAL_RANGE_SEPARATOR); if (split.length != 2) { continue; } long[] sorted = Arrays.asList(split).stream().map(Long::parseLong).sorted().mapToLong(Long::longValue).toArray(); results.add(Range.closed(sorted[0], sorted[1])); } else { Long value = Long.parseLong(range); results.add(Range.closed(value, value)); } } return results; }</code><technical_language>return empty list handle empty list</technical_language>

Target:
private static List<Range<Long>> parseCpuRangesText(final String string) { List<Range<Long>> results = new ArrayList<>(); if (validateCpuRange(string)) { string.split(RANGES_DELIMITER); for (String range : Arrays.asList(string.split(RANGES_DELIMITER))) { if (range.contains(INTERNAL_RANGE_SEPARATOR)) { String[] split = range.split(INTERNAL_RANGE_SEPARATOR); if (split.length != 2) { continue; } long[] sorted = Arrays.asList(split).stream().map(Long::parseLong).sorted().mapToLong(Long::longValue).toArray(); results.add(Range.closed(sorted[0], sorted[1])); } else { Long value = Long.parseLong(range); results.add(Range.closed(value, value)); } } } return results; }
Source:
<code>public static int getOrientation(InputStream stream) throws IOException { if (stream == null) { return 0 ; } MarkableInputStream markStream = new MarkableInputStream(stream); long mark = markStream.savePosition(65536); <START> byte[] header = new byte[65536]; <END> markStream.read(header); markStream.reset(mark); return getOrientation(header); }</code><technical_language>do this kind of allocation. I a solution in mind time implement it. I a flight Sunday. try do then</technical_language>

Target:
public static int getOrientation(InputStream stream) throws IOException { if (stream == null) { return 0; } MarkableInputStream markStream = new MarkableInputStream(stream); long mark = markStream.savePosition(65536); int orientation = getOrientation(markStream, 65536); markStream.reset(mark); return orientation; }
Source:
<code>public final String lastModified(final String dir) { try { return Files.getLastModifiedTime(Paths.get(dir), new LinkOption[0]).toString(); } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>This a good solution. nicer if throw a proper Smalltalk exception here. NotAValue, index out of bounds examples, I</technical_language>

Target:
public final Object lastModified(final String dir) { try { return Files.getLastModifiedTime(Paths.get(dir), new LinkOption[0]).toString(); } catch (FileNotFoundException e) { signalFileNotFoundException(dir, e.getMessage()); return Nil.nilObject; } catch (IOException e) { signalIOException(e.getMessage()); return Nil.nilObject; } }
Source:
<code>List<Bulkhead> acquireLanes(Query<?> query) { final String lane = QueryContexts.getLane(query); final Optional<BulkheadConfig> laneConfig = lane == null ? Optional.empty() : laneRegistry.getConfiguration(lane); List<Bulkhead> hallPasses = new ArrayList<>(2); final Optional<BulkheadConfig> totalConfig = laneRegistry.getConfiguration(TOTAL); laneConfig.ifPresent(config -> { Bulkhead laneLimiter = laneRegistry.bulkhead(lane, config); if (!laneLimiter.tryAcquirePermission()) { throw new QueryCapacityExceededException(lane); } hallPasses.add(laneLimiter); }); totalConfig.ifPresent(config -> { Bulkhead totalLimiter = laneRegistry.bulkhead(TOTAL, config); if (!totalLimiter.tryAcquirePermission()) { <START> releaseLanes(hallPasses); <END> throw new QueryCapacityExceededException(); } hallPasses.add(totalLimiter); }); return hallPasses; }</code><technical_language>do this in a exception handler in case unexpected error acquisitions. I a test for this scenario</technical_language>

Target:
List<Bulkhead> acquireLanes(Query<?> query) { final String lane = QueryContexts.getLane(query); final Optional<BulkheadConfig> laneConfig = lane == null ? Optional.empty() : laneRegistry.getConfiguration(lane); final Optional<BulkheadConfig> totalConfig = laneRegistry.getConfiguration(TOTAL); List<Bulkhead> hallPasses = new ArrayList<>(2); try { laneConfig.ifPresent(config -> { Bulkhead laneLimiter = laneRegistry.bulkhead(lane, config); if (!laneLimiter.tryAcquirePermission()) { throw new QueryCapacityExceededException(lane); } hallPasses.add(laneLimiter); }); totalConfig.ifPresent(config -> { Bulkhead totalLimiter = laneRegistry.bulkhead(TOTAL, config); if (!totalLimiter.tryAcquirePermission()) { throw new QueryCapacityExceededException(); } hallPasses.add(totalLimiter); }); return hallPasses; } catch (Exception ex) { releaseLanes(hallPasses); throw ex; } }
Source:
<code>protected static UUID determineActivityCategoryID(String activityCategoryUrl) { <START> return UUID.fromString(activityCategoryUrl.substring(activityCategoryUrl.lastIndexOf('/') + 1)); <END> }</code><technical_language>Officially, ask this controller... controller substitute URL ID in goal DTO executing POST</technical_language>

Target:
private static UUID determineActivityCategoryID(String activityCategoryUrl) { return UUID.fromString(activityCategoryUrl.substring(activityCategoryUrl.lastIndexOf('/') + 1)); }
Source:
<code>public Datacenter(HardwareLayout hardwareLayout, JSONObject jsonObject) throws JSONException { <START> logger.trace("Datacenter " + jsonObject.toString()); <END> this.hardwareLayout = hardwareLayout; this.name = jsonObject.getString("name"); this.dataNodes = new ArrayList<DataNode>(jsonObject.getJSONArray("dataNodes").length()); for (int i = 0; i < jsonObject.getJSONArray("dataNodes").length(); ++i) { this.dataNodes.add(new DataNode(this, jsonObject.getJSONArray("dataNodes").getJSONObject(i))); } validate(); }</code><technical_language>this is expensive. jsonObject.toString happen time</technical_language>

Target:
public Datacenter(HardwareLayout hardwareLayout, JSONObject jsonObject) throws JSONException { if (logger.isTraceEnabled()) logger.trace("Datacenter " + jsonObject.toString()); this.hardwareLayout = hardwareLayout; this.name = jsonObject.getString("name"); this.dataNodes = new ArrayList<DataNode>(jsonObject.getJSONArray("dataNodes").length()); for (int i = 0; i < jsonObject.getJSONArray("dataNodes").length(); ++i) { this.dataNodes.add(new DataNode(this, jsonObject.getJSONArray("dataNodes").getJSONObject(i))); } this.rawCapacityInBytes = calculateRawCapacityInBytes(); validate(); }
Source:
<code>public void sortJudges_simple() { Judge judgeOne = new Judge("Kamil Graczyk", Judge.JudgeRole.REPORTING_JUDGE); Judge judgeTwo = new Judge("Marzena Kisiela", Judge.JudgeRole.PRESIDING_JUDGE); CommonCourtJudgment unsortedJudgment = new CommonCourtJudgment(); unsortedJudgment.addJudge(judgeOne); unsortedJudgment.addJudge(judgeTwo); <START> CommonCourtJudgment sortedJudgment = (CommonCourtJudgment)judgmentDetailsSortService.sortJudges(unsortedJudgment); <END> assertEquals(2, sortedJudgment.getJudges().size()); assertEquals(judgeTwo, sortedJudgment.getJudges().get(0)); assertEquals(judgeOne, sortedJudgment.getJudges().get(1)); }</code><technical_language>is irrelevant in this case kind of judgment is returned. remove casting assign variable Judgment type</technical_language>

Target:
public void sortJudges_simple() { Judge judgeOne = new Judge("Kamil Graczyk", Judge.JudgeRole.REPORTING_JUDGE); Judge judgeTwo = new Judge("Marzena Kisiela", Judge.JudgeRole.PRESIDING_JUDGE); Judgment unsortedJudgment = new CommonCourtJudgment(); unsortedJudgment.addJudge(judgeOne); unsortedJudgment.addJudge(judgeTwo); Judgment sortedJudgment = judgmentDetailsSortService.sortJudges(unsortedJudgment); assertEquals(2, sortedJudgment.getJudges().size()); assertEquals(judgeTwo, sortedJudgment.getJudges().get(0)); assertEquals(judgeOne, sortedJudgment.getJudges().get(1)); }
Source:
<code>public void validateEnums(Host host) { <START> if (host.isSetPowerManagement()) { <END> for (PmProxy proxy : host.getPowerManagement().getPmProxies().getPmProxy()) { validateEnum(PmProxyType.class, proxy.getPropietary(), true); } } }</code><technical_language>please check isSetPmProxies() get NPE</technical_language>

Target:
public void validateEnums(Host host) { if (host.isSetPowerManagement()) { if (host.getPowerManagement().isSetPmProxies()) { for (PmProxy proxy : host.getPowerManagement().getPmProxies().getPmProxy()) { validateEnum(PmProxyType.class, proxy.getPropietary(), true); } } } }
Source:
<code>private OperationResponse getOperationResponse(final ModelNode simpleResponse, final int batchId) throws IOException { <START> final ModelNode streamHeader = simpleResponse.hasDefined("response-headers") && simpleResponse.get("response-headers").hasDefined("attached-streams") <END> ? simpleResponse.get("response-headers", "attached-streams") : null; if (streamHeader != null && streamHeader.asInt() > 0) { return OperationResponseProxy.create(simpleResponse, getChannelAssociation(), batchId, streamHeader); } else { return OperationResponse.Factory.createSimple(simpleResponse); } }</code><technical_language>a big deal, ModelDescriptionConstants.RESPONSE_HEADERS</technical_language>

Target:
private OperationResponse getOperationResponse(final ModelNode simpleResponse, final int batchId) throws IOException { final ModelNode streamHeader = simpleResponse.hasDefined(RESPONSE_HEADERS) && simpleResponse.get(RESPONSE_HEADERS).hasDefined(ATTACHED_STREAMS) ? simpleResponse.get(RESPONSE_HEADERS, ATTACHED_STREAMS) : null; if (streamHeader != null && streamHeader.asInt() > 0) { return OperationResponseProxy.create(simpleResponse, getChannelAssociation(), batchId, streamHeader); } else { return OperationResponse.Factory.createSimple(simpleResponse); } }
Source:
<code>public static Properties defaultProperties() { Properties properties = BaseHttpApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_REGIONS, "DEFAULT"); properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "X-Object-Meta-"); <START> properties.setProperty(Constants.PROPERTY_IDEMPOTENT_METHODS, "DELETE,GET,HEAD,OPTIONS,POST,PUT"); <END> return properties; }</code><technical_language>[nit] a static import in other properties (consider this int other classes)</technical_language>

Target:
public static Properties defaultProperties() { Properties properties = BaseHttpApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_REGIONS, "DEFAULT"); properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "X-Object-Meta-"); properties.setProperty(PROPERTY_IDEMPOTENT_METHODS, "DELETE,GET,HEAD,OPTIONS,POST,PUT"); return properties; }
Source:
<code>private void handleError(RuleContext ctx, Report errorReport, RuntimeException pmde) { pmde.printStackTrace(); project.log(pmde.toString(), Project.MSG_VERBOSE); Throwable cause = pmde.getCause(); if (cause != null) { try (StringWriter strWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(strWriter)) { cause.printStackTrace(printWriter); project.log(strWriter.toString(), Project.MSG_VERBOSE); <START> } catch (IOException e) { <END> e.printStackTrace(); } if (StringUtils.isNotBlank(cause.getMessage())) { project.log(cause.getMessage(), Project.MSG_VERBOSE); } } if (failOnError) { throw new BuildException(pmde); } errorReport.addError(new Report.ProcessingError(pmde, ctx.getSourceCodeFilename())); }</code><technical_language>Is this catch needed here? I before... problem is, hide a severe error, continue anyway... (Ok, in this exact case manually convert a stacktrace a string...)</technical_language>

Target:
private void handleError(RuleContext ctx, Report errorReport, RuntimeException pmde) { pmde.printStackTrace(); project.log(pmde.toString(), Project.MSG_VERBOSE); Throwable cause = pmde.getCause(); if (cause != null) { try (StringWriter strWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(strWriter)) { cause.printStackTrace(printWriter); project.log(strWriter.toString(), Project.MSG_VERBOSE); } catch (IOException e) { project.log("Error while closing stream", e, Project.MSG_ERR); } if (StringUtils.isNotBlank(cause.getMessage())) { project.log(cause.getMessage(), Project.MSG_VERBOSE); } } if (failOnError) { throw new BuildException(pmde); } errorReport.addError(new Report.ProcessingError(pmde, ctx.getSourceCodeFilename())); }
Source:
<code>@Before public void setUp() throws Exception { file = folder.newFile(); <START> file.delete(); <END> }</code><technical_language>This needed anymore</technical_language>

Target:
@Before public void setUp() throws Exception { File parent = folder.getRoot(); file = new File(parent, "queue-file"); }
Source:
<code>protected void serviceStop() throws Exception { try { tokenRenewer.shutdown(); <START> if (!tokenRenewer.awaitTermination(100L, TimeUnit.MILLISECONDS)) { <END> tokenRenewer.shutdownNow(); } } catch (InterruptedException ex) { tokenRenewer.shutdownNow(); } waiter.await(); Path lockFile = getLockFilePath(); if (lockFile.toFile().exists()) { FileChannel fc = FileChannel.open(lockFile, StandardOpenOption.WRITE); FileLock fl = null; try { fl = fc.tryLock(); if (fl != null) { FileUtils.deleteQuietly(lockFile.toFile()); } } catch (Exception ex) { } finally { if (fl != null) { fl.release(); } } } super.serviceStop(); }</code><technical_language>call Thread.interupt swallow interupt</technical_language>

Target:
protected void serviceStop() throws Exception { try { tokenRenewer.shutdown(); if (!tokenRenewer.awaitTermination(100L, TimeUnit.MILLISECONDS)) { tokenRenewer.shutdownNow(); } } catch (InterruptedException ex) { tokenRenewer.shutdownNow(); Thread.currentThread().interrupt(); } waiter.await(); Path lockFile = getLockFilePath(); if (lockFile.toFile().exists()) { FileChannel fc = FileChannel.open(lockFile, StandardOpenOption.WRITE); try (FileLock fl = fc.tryLock()) { if (fl != null) { FileUtils.deleteQuietly(lockFile.toFile()); } } catch (Exception ex) { Thread.currentThread().interrupt(); } } super.serviceStop(); }