auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public PingCommand getCurrentStatus(long id) { if ((_relativePath == null) || (_relativePath.isEmpty()) || (_cmsUserInfo == null) || (_cmsUserInfo.length == 0)) { s_logger.error("Failed to ping to Nuage VSD"); _shouldAudit = true; return null; } try { login(); } catch (Exception e) { <START> s_logger.error("Failed to ping to Nuage VSD on " + _name + " as user " + _cmsUserInfo[1] + " Exception " + e.getMessage()); <END> _shouldAudit = true; return null; } PingNuageVspCommand pingNuageVspCommand = new PingNuageVspCommand(Host.Type.L2Networking, id, _shouldAudit); _shouldAudit = false; return pingNuageVspCommand; }</code><technical_language>Pass exception instance error call provide stack trace in log for debugging. Also, if cmsUserInfo is null a length 1? Checks need added for conditions avoid NPE ArrayIndexOutOfBounds thrown this catch block</technical_language>

Target:
public PingCommand getCurrentStatus(long id) { if (_relativePath == null || _relativePath.isEmpty()) { s_logger.error("Refusing to ping Nuage VSD because the resource configuration is missing the relative path information"); _shouldAudit = true; return null; } if (_cmsUserInfo == null || _cmsUserInfo.length < 2) { s_logger.error("Refusing to ping Nuage VSD because the resource configuration is missing the CMS user information"); _shouldAudit = true; return null; } try { login(); } catch (ExecutionException | ConfigurationException e) { s_logger.error("Failed to ping to Nuage VSD on " + _name + " as user " + _cmsUserInfo[1], e); _shouldAudit = true; return null; } PingNuageVspCommand pingNuageVspCommand = new PingNuageVspCommand(Host.Type.L2Networking, id, _shouldAudit); _shouldAudit = false; return pingNuageVspCommand; }
Source:
<code>public DataRadioStation getNextById(String id) { <START> if (listStations.size() == 0) <END> return null; for (int i = 0; i < listStations.size() - 1; i++) { if (listStations.get(i).ID.equals(id)) { return listStations.get(i + 1); } } return listStations.get(0); }</code><technical_language>if (listStations.isEmpty())</technical_language>

Target:
public DataRadioStation getNextById(String id) { if (listStations.isEmpty()) return null; for (int i = 0; i < listStations.size() - 1; i++) { if (listStations.get(i).ID.equals(id)) { return listStations.get(i + 1); } } return listStations.get(0); }
Source:
<code>public void should_format_failed_future() { CompletableFuture<Object> future = new CompletableFuture<>(); future.completeExceptionally(new RuntimeException("some random error")); <START> assertThat(STANDARD_REPRESENTATION.toStringOf(future)).matches("CompletableFuture\\[Failed: java.lang.RuntimeException: some random error\\]\n" <END> + StackTraceUtils.getStackTraceRegex()); }</code><technical_language>avoid \n, I remember windows contributors tests failing of usage</technical_language>

Target:
public void should_format_failed_future() { CompletableFuture<Object> future = new CompletableFuture<>(); future.completeExceptionally(new RuntimeException("some random error")); assertThat(STANDARD_REPRESENTATION.toStringOf(future)).startsWith(String.format("CompletableFuture[Failed: java.lang.RuntimeException: some random error]%n")) .contains("Caused by: java.lang.RuntimeException: some random error"); }
Source:
<code>public List<ComponentConfiguration> getSnapshot(long sid) throws KuraException { List<ComponentConfiguration> returnConfigs = new ArrayList<ComponentConfiguration>(); XmlComponentConfigurations xmlConfigs = loadEncryptedSnapshotFileContent(sid); <START> if (xmlConfigs == null) { <END> return returnConfigs; } List<ComponentConfigurationImpl> configs = xmlConfigs.getConfigurations(); for (ComponentConfigurationImpl config : configs) { if (config != null) { try { Map<String, Object> decryptedProperties = decryptPasswords(config); config.setProperties(decryptedProperties); } catch (Throwable t) { s_logger.warn("Error during snapshot password decryption"); } } } returnConfigs.addAll(xmlConfigs.getConfigurations()); return returnConfigs; }</code><technical_language>I avoid return in middle of method intention of refactor favoring like: if (xmlConfigs != null) { List<ComponentConfigurationImpl> configs = xmlConfigs.getConfigurations(); for (ComponentConfigurationImpl config : configs) { ... } }</technical_language>

Target:
public List<ComponentConfiguration> getSnapshot(long sid) throws KuraException { List<ComponentConfiguration> returnConfigs = new ArrayList<ComponentConfiguration>(); XmlComponentConfigurations xmlConfigs = loadEncryptedSnapshotFileContent(sid); if (xmlConfigs != null) { List<ComponentConfigurationImpl> configs = xmlConfigs.getConfigurations(); for (ComponentConfigurationImpl config : configs) { if (config != null) { try { Map<String, Object> decryptedProperties = decryptPasswords(config); config.setProperties(decryptedProperties); } catch (Throwable t) { logger.warn("Error during snapshot password decryption"); } } } returnConfigs.addAll(xmlConfigs.getConfigurations()); } return returnConfigs; }
Source:
<code>public void stopWithoutFailureLogging() throws LifeCycleStopException { final class CollectForSuppressedExceptionsHandler implements LifeCycleStopFailureHandler { private final List<Exception> failures = new ArrayList<>(); @Override public void handlePreDestroyException(Class<?> klass, Method method, Exception exception) { log.debug(exception, "Exception in PreDestroy method %s::%s()", klass.getName(), method.getName()); failures.add(exception); } } <START> CollectForSuppressedExceptionsHandler handler = stop(new CollectForSuppressedExceptionsHandler()); <END> if (!handler.failures.isEmpty()) { LifeCycleStopException stopException = new LifeCycleStopException(); for (Exception e : handler.failures) { stopException.addSuppressed(e); } throw stopException; } }</code><technical_language>simplify this a lambda java List<Exception> failures = new ArrayList<>(); stop((klass, method, exception) -> failures.add(exception));</technical_language>

Target:
public void stopWithoutFailureLogging() throws LifeCycleStopException { List<Exception> failures = new ArrayList<>(); stop((klass, method, exception) -> failures.add(exception)); if (!failures.isEmpty()) { LifeCycleStopException stopException = new LifeCycleStopException(); for (Exception e : failures) { stopException.addSuppressed(e); } throw stopException; } }
Source:
<code>private void moveGap(int newGapStart, int minGapLength) { char[] target; int newGapLength; if (gapLength >= minGapLength) { <START> target = content; <END> newGapLength = gapLength; } else { int textLength = content.length - gapLength; target = new char[Math.max(textLength*2, textLength + minGapLength)]; newGapLength = target.length - textLength; } int gapEnd = gapStart + gapLength; int newGapEnd = newGapStart + newGapLength; if (newGapStart < gapStart) { System.arraycopy(content, 0, target, 0, newGapStart); System.arraycopy(content, newGapStart, target, newGapEnd, gapStart - newGapStart); System.arraycopy(content, gapEnd, target, newGapEnd + (gapStart - newGapStart), content.length-gapEnd); } else { System.arraycopy(content, 0, target, 0, gapStart); System.arraycopy(content, gapEnd, target, gapStart, newGapStart - gapStart); System.arraycopy(content, gapEnd + (newGapStart - gapStart), target, newGapEnd, target.length-newGapEnd); } content = target; gapStart = newGapStart; gapLength = newGapLength; }</code><technical_language>Add a check a move is needed return (if position is set correctly gap is long enough)</technical_language>

Target:
private void moveGap(int newGapStart, int minGapLength) { char[] target; int newGapLength; if (newGapStart == gapStart && minGapLength <= gapLength) { return; } if (gapLength >= minGapLength) { target = content; newGapLength = gapLength; } else { int textLength = content.length - gapLength; target = new char[Math.max(textLength*2, textLength + minGapLength)]; newGapLength = target.length - textLength; } int gapEnd = gapStart + gapLength; int newGapEnd = newGapStart + newGapLength; if (newGapStart < gapStart) { System.arraycopy(content, 0, target, 0, newGapStart); System.arraycopy(content, newGapStart, target, newGapEnd, gapStart - newGapStart); System.arraycopy(content, gapEnd, target, newGapEnd + (gapStart - newGapStart), content.length-gapEnd); } else { System.arraycopy(content, 0, target, 0, gapStart); System.arraycopy(content, gapEnd, target, gapStart, newGapStart - gapStart); System.arraycopy(content, gapEnd + (newGapStart - gapStart), target, newGapEnd, target.length-newGapEnd); } content = target; gapStart = newGapStart; gapLength = newGapLength; }
Source:
<code>public InetAddress getInterface() { <START> throw new UnsupportedOperationException("Retrieval of network interface address not supported"); <END> }</code><technical_language>code this is a "breaking" change</technical_language>

Target:
public InetAddress getInterface() { return null; }
Source:
<code>private void processNewPut(ScanResults results, IndexValue putValue) { if (!isExpired(putValue.getExpiresAtMs(), results.containerForecastStartTimeMs)) { results.updateContainerBaseBucket(String.valueOf(putValue.getServiceId()), String.valueOf(putValue.getContainerId()), putValue.getSize()); <START> handleContainerBucketUpdate(results, putValue, putValue.getExpiresAtMs(), SUBTRACT); <END> } if (!isExpired(putValue.getExpiresAtMs(), results.logSegmentForecastStartTimeMs)) { results.updateLogSegmentBaseBucket(putValue.getOffset().getName(), putValue.getSize()); handleLogSegmentBucketUpdate(results, putValue, putValue.getExpiresAtMs(), SUBTRACT); } }</code><technical_language>this applies if expiry is set right</technical_language>

Target:
private void processNewPut(ScanResults results, IndexValue putValue) { long expiresAtMs = putValue.getExpiresAtMs(); if (!isExpired(expiresAtMs, results.containerForecastStartTimeMs)) { results.updateContainerBaseBucket(String.valueOf(putValue.getServiceId()), String.valueOf(putValue.getContainerId()), putValue.getSize()); if (expiresAtMs != Utils.Infinite_Time) { handleContainerBucketUpdate(results, putValue, expiresAtMs, SUBTRACT); } } if (!isExpired(expiresAtMs, results.logSegmentForecastStartTimeMs)) { results.updateLogSegmentBaseBucket(putValue.getOffset().getName(), putValue.getSize()); if (expiresAtMs != Utils.Infinite_Time) { handleLogSegmentBucketUpdate(results, putValue, expiresAtMs, SUBTRACT); } } }
Source:
<code><START> public static String abbreviateName(Class<?> cls, int pkgNameDepth) { <END> if (pkgNameDepth == 0) return cls.getSimpleName(); if (pkgNameDepth < 0 || pkgNameDepth > 2) return cls.getName(); String[] pkgNameParts = cls.getName().split("\\."); if (pkgNameParts.length == 1) return pkgNameParts[0]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < pkgNameParts.length - 1; ++i) { sb.append(pkgNameParts[i].charAt(0)); if (pkgNameDepth > 1 && pkgNameParts[i].length() > 1) sb.append(pkgNameParts[i].charAt(pkgNameParts[i].length() - 1)); sb.append("."); } sb.append(pkgNameParts[pkgNameParts.length - 1]); return sb.toString(); }</code><technical_language>Suppose interfaces: public interface NamingServiceV2 extends Service { default void testMethod(org.apache.ignite.internal.processors.service.inner.implV2.Param param) } public interface NamingService extends Service { default void testMethod(org.apache.ignite.internal.processors.service.inner.impl.Param param) } public class NamingServiceImpl implements NamingService, NamingServiceV2 { } so, metric names be: void_testMethod(Param) void_testMethod(o.a.i.i.p.s.i.i.Param) I understand method metric refers to? Also, names collision JVM's. solution - mtd.toGenericString() metric name. However, this poor readability</technical_language>

Target:
public static String abbreviateName(Class<?> cls, int pkgNameDepth) { if (pkgNameDepth < 1) return cls.getSimpleName(); if (pkgNameDepth >= MAX_ABBREVIATE_NAME_LVL) return cls.getName(); String[] pkgNameParts = cls.getName().split("\\."); if (pkgNameParts.length == 1) return pkgNameParts[0]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < pkgNameParts.length - 1; ++i) { if( pkgNameParts[i].length() == 3 ) sb.append(pkgNameParts[i]); else { sb.append(pkgNameParts[i].charAt(0)); if (pkgNameParts[i].length() > 3) sb.append(pkgNameParts[i].charAt(pkgNameParts[i].length() / 2)); if (pkgNameParts[i].length() > 1) sb.append(pkgNameParts[i].charAt(pkgNameParts[i].length() - 1)); } sb.append("."); } sb.append(pkgNameParts[pkgNameParts.length - 1]); return sb.toString(); }
Source:
<code>public ResponseEntity<?> create(@Valid @RequestBody final EventTypeBase eventType, final Errors errors, final NativeWebRequest request) throws TopicCreationException, InternalNakadiException, NoSuchPartitionStrategyException, DuplicatedEventTypeNameException, InvalidEventTypeException, ValidationException { if (featureToggleService.isFeatureEnabled(DISABLE_EVENT_TYPE_CREATION)) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } if (errors.hasErrors()) { <START> throw new ValidationException(errors); <END> } eventTypeService.create(eventType); return ResponseEntity.status(HttpStatus.CREATED).headers(generateWarningHeaders(eventType)).build(); }</code><technical_language>I suggest follow common approach (no matter choose), a couple of lines I return response entity in exceptional situation, throw exception</technical_language>

Target:
public ResponseEntity<?> create(@Valid @RequestBody final EventTypeBase eventType, final Errors errors, final NativeWebRequest request) throws TopicCreationException, InternalNakadiException, NoSuchPartitionStrategyException, DuplicatedEventTypeNameException, InvalidEventTypeException, ValidationException, FeatureNotAvailableException { if (featureToggleService.isFeatureEnabled(DISABLE_EVENT_TYPE_CREATION)) { throw new FeatureNotAvailableException("Event Type creation is disabled", DISABLE_EVENT_TYPE_CREATION); } if (errors.hasErrors()) { throw new ValidationException(errors); } eventTypeService.create(eventType); return ResponseEntity.status(HttpStatus.CREATED).headers(generateWarningHeaders(eventType)).build(); }
Source:
<code>public T parseFile(String absoluteFilename, Map<String, Object> additionalParams) throws FileParsingException { try { this.workbook = this.fileService.retrieveWorkbook(absoluteFilename); return this.parseWorkbook(this.workbook, additionalParams); <START> } catch (InvalidFormatException | IOException e) { <END> AbstractExcelFileParser.LOG.debug(e.getMessage(), e); throw new FileParsingException(this.messageSource.getMessage("common.error.invalid.file", null, Locale.ENGLISH)); } }</code><technical_language>Hey @abatac while of Exception types thrown single service, Exceptions, type of Exception user a clue wrong. This is Exceptions typed in Java, provide User more specific information problem. Please handle Exceptions separately provide extra information users understand wrong</technical_language>

Target:
public T parseFile(String absoluteFilename, Map<String, Object> additionalParams) throws FileParsingException { try { this.workbook = this.fileService.retrieveWorkbook(absoluteFilename); return this.parseWorkbook(this.workbook, additionalParams); } catch (InvalidFormatException e) { AbstractExcelFileParser.LOG.debug(e.getMessage(), e); throw new FileParsingException(this.messageSource.getMessage(FILE_INVALID, null, Locale.ENGLISH)); } catch (IOException e) { AbstractExcelFileParser.LOG.debug(e.getMessage(), e); throw new FileParsingException(this.messageSource.getMessage(FILE_READ_ERROR, null, Locale.ENGLISH)); } }
Source:
<code>private static Optional<Duration> measureFsTimestampResolution( FileStore s, Path dir) { Duration configured = readFileTimeResolution(s); if (!UNDEFINED_RESOLUTION.equals(configured)) { return Optional.of(configured); } Path probe = dir.resolve(".probe-" + UUID.randomUUID()); try { Files.createFile(probe); Instant now = Instant.now(); Files.setLastModifiedTime(probe, FileTime.from(now)); FileTime t1 = Files.getLastModifiedTime(probe); FileTime t2 = t1; Instant t1i = t1.toInstant(); for (long i = 1; t2.compareTo(t1) <= 0; i += 1 + i / 200) { Files.setLastModifiedTime(probe, <START> FileTime.from(t1i.plusNanos(i * 1000))); <END> t2 = Files.getLastModifiedTime(probe); } Duration fsResolution = Duration.between(t1.toInstant(), t2.toInstant()); Duration clockResolution = measureClockResolution(); fsResolution = fsResolution.plus(clockResolution); saveFileTimeResolution(s, fsResolution); return Optional.of(fsResolution); } catch (AccessDeniedException e) { LOG.warn(e.getLocalizedMessage(), e); } catch (IOException e) { LOG.error(e.getLocalizedMessage(), e); } finally { deleteProbe(probe); } return Optional.empty(); }</code><technical_language>this takes ~600 iterations. If previously, assumed 2.5 seconds, important precise</technical_language>

Target:
private static Optional<Duration> measureFsTimestampResolution( FileStore s, Path dir) { Duration configured = readFileTimeResolution(s); if (!UNDEFINED_RESOLUTION.equals(configured)) { return Optional.of(configured); } Path probe = dir.resolve(".probe-" + UUID.randomUUID()); try { Files.createFile(probe); FileTime t1 = Files.getLastModifiedTime(probe); FileTime t2 = t1; Instant t1i = t1.toInstant(); for (long i = 1; t2.compareTo(t1) <= 0; i += 1 + i / 200) { Files.setLastModifiedTime(probe, FileTime.from(t1i.plusNanos(i * 1000))); t2 = Files.getLastModifiedTime(probe); } Duration fsResolution = Duration.between(t1.toInstant(), t2.toInstant()); Duration clockResolution = measureClockResolution(); fsResolution = fsResolution.plus(clockResolution); saveFileTimeResolution(s, fsResolution); return Optional.of(fsResolution); } catch (AccessDeniedException e) { LOG.warn(e.getLocalizedMessage(), e); } catch (IOException e) { LOG.error(e.getLocalizedMessage(), e); } finally { deleteProbe(probe); } return Optional.empty(); }
Source:
<code>public void testCreatePatch() { SourcesFileCreateHyperlink patchTest = new SourcesFileCreateHyperlink(testFile, specfile.getPatch(0).getFileName(), null); assertNotNull(patchTest); <START> patchTest.open(); <END> assertNotNull(testFile.getProject().findMember("test.patch")); }</code><technical_language>This causing tests hang run in Tycho file is closed</technical_language>

Target:
public void testCreatePatch() { SourcesFileCreateHyperlink patchTest = new SourcesFileCreateHyperlink(testFile, specfile.getPatch(0).getFileName(), null); assertNotNull(patchTest); patchTest.open(); assertNotNull(testFile.getProject().findMember("test")); }
Source:
<code>public synchronized FinalT next() { <START> return createNext.apply(currentIterator.next()); <END> }</code><technical_language>Lack of synchronization hasNext() next() is synchronized suspicious for me</technical_language>

Target:
public FinalT next() { if (hasNext()) { return createNext.apply(currentIterator.next()); } throw new NoSuchElementException(); }
Source:
<code>public long getWrittenRows() { <START> return logicalWrittenRows; <END> }</code><technical_language>if rename getter, rename field? or, other around, rename getter too</technical_language>

Target:
public long getWrittenRows() { return writtenRows; }
Source:
<code>protected PartialList<String> doQuery(String query, String queryType, QueryFilter queryFilter, int countUpTo) { final Timer.Context timerContext = queryTimer.time(); <START> int match = 0; <END> try { Mutable<String> idKeyHolder = new MutableObject<>(); PartialList<Map<String, Serializable>> pl = doQueryAndFetch(query, queryType, queryFilter, false, countUpTo, idKeyHolder); String idKey = idKeyHolder.getValue(); List<String> ids = new ArrayList<>(pl.size()); for (Map<String, Serializable> map : pl) { String id = (String) map.get(idKey); ids.add(id); } match = ids.size(); return new PartialList<>(ids, pl.totalSize()); } finally { long duration = timerContext.stop(); if (LOG_MIN_DURATION_NS >= 0 && duration > LOG_MIN_DURATION_NS) { String msg = String.format("duration_ms:\t%.2f\t%s %s\tquery\t%s", duration / 1000000.0, queryFilter, countUpToAsString(countUpTo), query); if (log.isTraceEnabled()) { log.info(msg, new Throwable("Slow query stack trace")); } else { log.info(msg); } } } }</code><technical_language>Unused code</technical_language>

Target:
protected PartialList<String> doQuery(String query, String queryType, QueryFilter queryFilter, int countUpTo) { final Timer.Context timerContext = queryTimer.time(); try { Mutable<String> idKeyHolder = new MutableObject<>(); PartialList<Map<String, Serializable>> pl = doQueryAndFetch(query, queryType, queryFilter, false, countUpTo, idKeyHolder); String idKey = idKeyHolder.getValue(); List<String> ids = new ArrayList<>(pl.size()); for (Map<String, Serializable> map : pl) { String id = (String) map.get(idKey); ids.add(id); } return new PartialList<>(ids, pl.totalSize()); } finally { long duration = timerContext.stop(); if (LOG_MIN_DURATION_NS >= 0 && duration > LOG_MIN_DURATION_NS) { String msg = String.format("duration_ms:\t%.2f\t%s %s\tquery\t%s", duration / 1000000.0, queryFilter, countUpToAsString(countUpTo), query); if (log.isTraceEnabled()) { log.info(msg, new Throwable("Slow query stack trace")); } else { log.info(msg); } } } }
Source:
<code>public void switchChunk(String chunkType) { if (chunk_ != null) { DocDisplay docDisplay = target_.getDocDisplay(); Position start = chunk_.getPreamble(); Position end = chunk_.getEnd(); String chunkText = docDisplay.getTextForRange(Range.fromPoints(start, end)); JsArrayString chunkLines = StringUtil.split(chunkText, "\n"); if (chunkLines.length() > 0) { String firstLine = chunkLines.get(0); Position linedEnd = Position.create(start.getRow(),firstLine.length()); <START> String newFirstLine = firstLine.replaceFirst("{[a-zA-Z]+", "{" + chunkType); <END> docDisplay.replaceRange(Range.fromPoints(start, linedEnd), newFirstLine); target_.getNotebook().clearChunkOutput(chunk_); } } }</code><technical_language>Does/should this support engine explicit chunk option? e.g. {r, engine='python'}</technical_language>

Target:
public void switchChunk(String chunkType) { if (chunk_ != null) { DocDisplay docDisplay = target_.getDocDisplay(); Position start = chunk_.getPreamble(); Position end = chunk_.getEnd(); String chunkText = docDisplay.getTextForRange(Range.fromPoints(start, end)); JsArrayString chunkLines = StringUtil.split(chunkText, "\n"); if (chunkLines.length() > 0) { String firstLine = chunkLines.get(0); Position linedEnd = Position.create(start.getRow(),firstLine.length()); String newFirstLine = firstLine.replaceFirst("[, ]*engine='[a-zA-Z]+'", ""); newFirstLine = newFirstLine.replaceFirst("{[a-zA-Z]+", "{" + chunkType); docDisplay.replaceRange(Range.fromPoints(start, linedEnd), newFirstLine); target_.getNotebook().clearChunkOutput(chunk_); } } }
Source:
<code>public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { final TaskStatusPlus taskStatusPlus = indexingServiceClient.getLastCompleteTask(); if (taskStatusPlus != null) { for (ImmutableDruidDataSource dataSource : params.getDataSources()) { if (!params.getCoordinatorDynamicConfig().getKillPendingSegmentsSkipList().contains(dataSource.getName())) { log.info( <START> "Kill pendingSegments created until [%s] for dataSource[%s]", <END> dataSource, taskStatusPlus.getCreatedTime() ); indexingServiceClient.killPendingSegments(dataSource.getName(), taskStatusPlus.getCreatedTime()); } } } return params; }</code><technical_language>string format arguments in reverse order</technical_language>

Target:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { final List<DateTime> createdTimes = new ArrayList<>(); createdTimes.add( indexingServiceClient .getRunningTasks() .stream() .map(TaskStatusPlus::getCreatedTime) .min(Comparators.naturalNullsFirst()) .orElse(DateTimes.nowUtc()) ); createdTimes.add( indexingServiceClient .getPendingTasks() .stream() .map(TaskStatusPlus::getCreatedTime) .min(Comparators.naturalNullsFirst()) .orElse(DateTimes.nowUtc()) ); createdTimes.add( indexingServiceClient .getWaitingTasks() .stream() .map(TaskStatusPlus::getCreatedTime) .min(Comparators.naturalNullsFirst()) .orElse(DateTimes.nowUtc()) ); final TaskStatusPlus completeTaskStatus = indexingServiceClient.getLastCompleteTask(); if (completeTaskStatus != null) { createdTimes.add(completeTaskStatus.getCreatedTime()); } createdTimes.sort(Comparators.naturalNullsFirst()); Preconditions.checkState(!createdTimes.isEmpty(), "Failed to gather createdTimes of tasks"); ENDING_SEGMENTS_OFFSET). final DateTime pendingSegmentsCleanupEndTime = createdTimes.get(0).minus(KEEP_PENDING_SEGMENTS_OFFSET); for (ImmutableDruidDataSource dataSource : params.getDataSources()) { if (!params.getCoordinatorDynamicConfig().getKillPendingSegmentsSkipList().contains(dataSource.getName())) { log.info( "Killed [%d] pendingSegments created until [%s] for dataSource[%s]", indexingServiceClient.killPendingSegments(dataSource.getName(), pendingSegmentsCleanupEndTime), pendingSegmentsCleanupEndTime, dataSource ); } } return params; }
Source:
<code>public void scanNow(final ContainerSpecKey containerSpecKey) { ServerTemplate serverTemplate = templateStorage.load(containerSpecKey.getServerTemplateKey().getId()); if (serverTemplate == null) { <START> throw new KieServerControllerNotFoundException("No server template found for id " + containerSpecKey.getServerTemplateKey().getId()); <END> } ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerSpecKey.getId()); if (containerSpec == null) { throw new KieServerControllerNotFoundException("No container spec found for id " + containerSpecKey.getId()); } List<Container> containers = kieServerInstanceManager.scanNow(serverTemplate, containerSpec); notificationService.notify(serverTemplate, containerSpec, containers); }</code><technical_language>exception class name sounds bit weird - kie server controller found... rename a bit more meaningful</technical_language>

Target:
public void scanNow(final ContainerSpecKey containerSpecKey) { ServerTemplate serverTemplate = templateStorage.load(containerSpecKey.getServerTemplateKey().getId()); if (serverTemplate == null) { throw new KieServerControllerIllegalArgumentException("No server template found for id " + containerSpecKey.getServerTemplateKey().getId()); } ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerSpecKey.getId()); if (containerSpec == null) { throw new KieServerControllerIllegalArgumentException("No container spec found for id " + containerSpecKey.getId()); } List<Container> containers = kieServerInstanceManager.scanNow(serverTemplate, containerSpec); notificationService.notify(serverTemplate, containerSpec, containers); }
Source:
<code>public Object[][] dataBiasCorrection() { LoggingUtils.setLoggingLevel(Log.LogLevel.INFO); final AllelicCountCollection sampleNormal = new AllelicCountCollection(SAMPLE_NORMAL_FILE); final AllelicCountCollection sampleWithBadSNPs = new AllelicCountCollection(SAMPLE_WITH_BAD_SNPS_FILE); final AllelicCountCollection sampleWithEvent = new AllelicCountCollection(SAMPLE_WITH_EVENT_FILE); <START> final AllelicPanelOfNormals allelicPoNNormal = new AllelicPanelOfNormals(new AllelicCountCollection(ALLELIC_PON_NORMAL_COUNTS_FILE)); <END> final AllelicPanelOfNormals allelicPoNWithBadSNPs = new AllelicPanelOfNormals(new AllelicCountCollection(ALLELIC_PON_WITH_BAD_SNPS_COUNTS_FILE)); final double minorFractionExpectedInMiddleSegmentNormal = 0.5; final double minorFractionExpectedInMiddleSegmentWithBadSNPsAndNormalPON = 0.4; final double minorFractionExpectedInMiddleSegmentWithEvent = 0.33; return new Object[][]{ {sampleNormal, allelicPoNNormal, minorFractionExpectedInMiddleSegmentNormal}, {sampleWithBadSNPs, allelicPoNNormal, minorFractionExpectedInMiddleSegmentWithBadSNPsAndNormalPON}, {sampleWithEvent, allelicPoNNormal, minorFractionExpectedInMiddleSegmentWithEvent}, {sampleWithBadSNPs, allelicPoNWithBadSNPs, minorFractionExpectedInMiddleSegmentNormal} }; }</code><technical_language>this allelicPonNormalaccording Google conventions doc</technical_language>

Target:
public Object[][] dataBiasCorrection() { LoggingUtils.setLoggingLevel(Log.LogLevel.INFO); final AllelicCountCollection sampleNormal = new AllelicCountCollection(SAMPLE_NORMAL_FILE); final AllelicCountCollection sampleWithBadSNPs = new AllelicCountCollection(SAMPLE_WITH_BAD_SNPS_FILE); final AllelicCountCollection sampleWithEvent = new AllelicCountCollection(SAMPLE_WITH_EVENT_FILE); final AllelicPanelOfNormals allelicPoNNormal = new AllelicPanelOfNormals(new AllelicCountCollection(ALLELIC_PON_NORMAL_COUNTS_FILE)); final AllelicPanelOfNormals allelicPoNWithBadSNPs = new AllelicPanelOfNormals(new AllelicCountCollection(ALLELIC_PON_WITH_BAD_SNPS_COUNTS_FILE)); final double minorFractionExpectedInMiddleSegmentNormal = 0.5; final double minorFractionExpectedInMiddleSegmentWithBadSNPsAndNormalPoN = 0.4; final double minorFractionExpectedInMiddleSegmentWithEvent = 0.33; return new Object[][]{ {sampleNormal, allelicPoNNormal, minorFractionExpectedInMiddleSegmentNormal}, {sampleWithBadSNPs, allelicPoNNormal, minorFractionExpectedInMiddleSegmentWithBadSNPsAndNormalPoN}, {sampleWithEvent, allelicPoNNormal, minorFractionExpectedInMiddleSegmentWithEvent}, {sampleWithBadSNPs, allelicPoNWithBadSNPs, minorFractionExpectedInMiddleSegmentNormal} }; }
Source:
<code><START> public String getStashRootUrl() { <END> if ((stashRootUrl == null) || (stashRootUrl.trim().isEmpty())) { return null; } else { return stashRootUrl; } }</code><technical_language>trimToNull() is in setStashRootUrl() this simply return stashRootUrl (like other getters)</technical_language>

Target:
public String getStashRootUrl() { return stashRootUrl; }
Source:
<code>public URI getProcessBaseUriForExistingProcess(Process process) { <START> if ( Objects.nonNull(process.getId())) { <END> process.setProcessBaseUri(fileManagementModule.createUriForExistingProcess(process.getId().toString())); } return process.getProcessBaseUri(); }</code><technical_language>dear, sorry, a change in I for testing. please undo it</technical_language>

Target:
public URI getProcessBaseUriForExistingProcess(Process process) { URI processBaseUri = process.getProcessBaseUri(); if (Objects.isNull(processBaseUri) && Objects.nonNull(process.getId())) { process.setProcessBaseUri(fileManagementModule.createUriForExistingProcess(process.getId().toString())); } return process.getProcessBaseUri(); }
Source:
<code>protected void addSLAComplianceFilter() { Map<String, String> aliasMap = new HashMap<String, String>(); aliasMap.put("0", constants.SlaNA()); aliasMap.put("1", constants.SlaPending()); <START> aliasMap.put("2", constants.SlaMet()); <END> aliasMap.put("3", constants.SlaAborted()); aliasMap.put("4", constants.SlaViolated()); view.addSelectFilter(constants.SlaCompliance(), aliasMap, f -> addSearchFilter(f, equalsTo(COLUMN_SLA_COMPLIANCE, f.getValue()))); }</code><technical_language>static references have: suggestion aliasMap.put(String.valueOf(ProcessInstance.SLA_MET), constants.SlaMet());</technical_language>

Target:
protected void addSLAComplianceFilter() { Map<String, String> aliasMap = new HashMap<String, String>(); aliasMap.put(String.valueOf(ProcessInstance.SLA_ABORTED), constants.SlaAborted()); aliasMap.put(String.valueOf(ProcessInstance.SLA_MET), constants.SlaMet()); aliasMap.put(String.valueOf(ProcessInstance.SLA_NA), constants.SlaNA()); aliasMap.put(String.valueOf(ProcessInstance.SLA_PENDING), constants.SlaPending()); aliasMap.put(String.valueOf(ProcessInstance.SLA_VIOLATED), constants.SlaViolated()); view.addSelectFilter(constants.SlaCompliance(), aliasMap, f -> addSearchFilter(f, equalsTo(COLUMN_SLA_COMPLIANCE, f.getValue()))); }
Source:
<code>protected void setupKeyEvents() { setOnKeyPressed(e -> { if (e.isControlDown()) { return; } if (e.getCode() == KeyCode.ENTER) { e.consume(); if (selectedIndex.isPresent()) { logger.info("Enter key selection on item " + selectedIndex.get()); onItemSelected.accept(selectedIndex.get()); } } if (e.getCode() == KeyCode.UP || e.getCode() == KeyCode.DOWN || KeyboardShortcuts.upIssue.match(e) || KeyboardShortcuts.downIssue.match(e)) { e.consume(); handleUpDownKeys(e.getCode() == KeyCode.DOWN || KeyboardShortcuts.downIssue.match(e)); assert selectedIndex.isPresent() : "handleUpDownKeys doesn't set selectedIndex!"; if (!e.isShiftDown()) { logger.info("Enter key selection on item index " + selectedIndex.get()); onItemSelected.accept(selectedIndex.get()); } } if (FIRST_ISSUE.match(e)) { e.consume(); <START> selectnthItem(1); <END> } if (LAST_ISSUE.match(e)) { e.consume(); selectnthItem(getItems().size() - 1); } }); }</code><technical_language>I this named 'selectNthItem', more consistent capitalise in names. for other occurrences</technical_language>

Target:
protected void setupKeyEvents() { setOnKeyPressed(e -> { if (e.isControlDown()) { return; } if (e.getCode() == KeyCode.ENTER) { e.consume(); if (selectedIndex.isPresent()) { logger.info("Enter key selection on item " + selectedIndex.get()); onItemSelected.accept(selectedIndex.get()); } } if (e.getCode() == KeyCode.UP || e.getCode() == KeyCode.DOWN || KeyboardShortcuts.upIssue.match(e) || KeyboardShortcuts.downIssue.match(e)) { e.consume(); handleUpDownKeys(e.getCode() == KeyCode.DOWN || KeyboardShortcuts.downIssue.match(e)); assert selectedIndex.isPresent() : "handleUpDownKeys doesn't set selectedIndex!"; if (!e.isShiftDown()) { logger.info("Enter key selection on item index " + selectedIndex.get()); onItemSelected.accept(selectedIndex.get()); } } if (FIRST_ISSUE.match(e)) { e.consume(); selectNthItem(1); } if (LAST_ISSUE.match(e)) { e.consume(); selectNthItem(getItems().size()); } }); }
Source:
<code>@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); DataStorageConfiguration dsCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() <START> .setMaxSize(100 * 1024 * 1024) <END> .setPersistenceEnabled(true)) .setWalMode(NONE); cfg.setDataStorageConfiguration(dsCfg) .setAuthenticationEnabled(true) .setPluginProviders(new TestSecurityPluginProvider("server", "server", ALLOW_ALL, false, new TestSecurityData("client", "client", SecurityPermissionSetBuilder.create() .defaultAllowAll(false) .appendTaskPermissions("org.apache.ignite.internal.visor.query.VisorQueryTask", TASK_EXECUTE) .appendTaskPermissions("org.apache.ignite.internal.visor.compute.VisorGatewayTask", TASK_EXECUTE) .build() ))); return cfg; }</code><technical_language>do need this line</technical_language>

Target:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); DataStorageConfiguration dsCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)); SecurityPermissionSet sysTaskAllow = SecurityPermissionSetBuilder.create() .defaultAllowAll(false) .appendCachePermissions("*", CACHE_READ) .appendTaskPermissions("org.apache.ignite.internal.visor.query.VisorQueryTask", TASK_EXECUTE) .appendTaskPermissions("org.apache.ignite.internal.visor.compute.VisorGatewayTask", TASK_EXECUTE) .build(); cfg.setDataStorageConfiguration(dsCfg) .setAuthenticationEnabled(true) .setPluginProviders(new TestSecurityPluginProvider("server", "server", ALLOW_ALL, false, new TestSecurityData("client", "client", sysTaskAllow))); return cfg; }
Source:
<code>public JComponent getPreferredFocusedComponent() { String name = myNameField.getText(); <START> if (name.length() == 0 || name.equals(ResourceHelper.prependResourcePrefix(myModule, null))) { <END> return myNameField; } else if (myValueField.isVisible()) { return myValueField; } else if (myModuleCombo.isVisible()) { return myModuleCombo; } else { return myFileNameCombo; } }</code><technical_language>name.isEmpty</technical_language>

Target:
public JComponent getPreferredFocusedComponent() { String name = myNameField.getText(); if (name.isEmpty() || name.equals(ResourceHelper.prependResourcePrefix(myModule, null))) { return myNameField; } else if (myValueField.isVisible()) { return myValueField; } else if (myModuleCombo.isVisible()) { return myModuleCombo; } else { return myFileNameCombo; } }
Source:
<code>private void logErrorsWithOriginalAccountingDetails(ConcurStandardAccountingExtractDetailLine line) { ConcurAccountInfo accountingInformation = buildConcurAccountingInformation( <START> line, line.getJournalAccountCode(), line.getSubObjectCode()); <END> buildValidationResult(accountingInformation, false); }</code><technical_language>This line updated call new one-arg buildConcurAccountingInformation() method logs errors for correct sub-object code</technical_language>

Target:
private void logErrorsWithOriginalAccountingDetails(ConcurStandardAccountingExtractDetailLine line) { ConcurAccountInfo accountingInformation = buildConcurAccountingInformation(line); buildValidationResult(accountingInformation, false); }
Source:
<code>public String getProperty(String key) { if (properties != null) { <START> if (properties.containsKey(key)) { <END> return properties.get(key); } } return null; }</code><technical_language>return properties.get(), containsKey() call is redundant</technical_language>

Target:
public String getProperty(String key) { if (properties != null) { return properties.get(key); } return null; }
Source:
<code>public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length == 0) { throw new NotEnoughArgumentsException(); } <START> if (!sender.isAuthorized("essentials.warpinfo")) { throw new Exception(tl("noPerm", "essentials.warpinfo")); } <END> final String name = args[0]; final Location loc = ess.getWarps().getWarp(args[0]); sender.sendMessage(tl("warpInfo", name)); sender.sendMessage(tl("whoisLocation", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); }</code><technical_language>suggestion</technical_language>

Target:
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (args.length == 0) { throw new NotEnoughArgumentsException(); } final String name = args[0]; final Location loc = ess.getWarps().getWarp(name); sender.sendMessage(tl("warpInfo", name)); sender.sendMessage(tl("whoisLocation", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); }
Source:
<code>static String requestPayloadIfStringOrFormIfNotReturnEmptyString(HttpRequest request) { if (request.getPayload() != null && ("application/x-www-form-urlencoded".equals(request.getPayload().getContentMetadata().getContentType()) || request .getPayload() instanceof StringPayload) && request.getPayload().getContentMetadata().getContentLength() != null && request.getPayload().getContentMetadata().getContentLength() < 1024) { try { String logStatement; if (request.getPayload() instanceof StringPayload) { <START> logStatement = request.getPayload().isSensitive() ? "---- SENSITIVE INFORMATION ----" : request.getPayload().getRawContent().toString(); <END> } else { logStatement = Strings2.toStringAndClose(request.getPayload().openStream()); } return String.format(" [%s] ", logStatement); } catch (IOException e) { } } return ""; }</code><technical_language>sensitive flag apply payload types, string ones</technical_language>

Target:
static String requestPayloadIfStringOrFormIfNotReturnEmptyString(HttpRequest request) { return requestPayloadIfStringOrFormIfNotReturnEmptyString(request, false); }
Source:
<code>private void loadSystemLogLevel() { if (rootLogLevel != null) { return; } final StaticLoggerBinder binder = StaticLoggerBinder.getSingleton(); if (binder.getLoggerFactory() != null) { if (logger.isDebugEnabled()) { rootLogLevel = LogLevel.VERBOSE; } if (logger.isInfoEnabled()) { rootLogLevel = LogLevel.INFORMATIONAL; } if (logger.isWarnEnabled()) { rootLogLevel = LogLevel.WARNING; } if (logger.isErrorEnabled()) { rootLogLevel = LogLevel.ERROR; } } <START> rootLogLevel = getEnvironmentLoggingLevel(); <END> }</code><technical_language>This needs in else block, this code is called</technical_language>

Target:
private LogLevel loadSystemLogLevel() { if (isLogFromEnv()) { return getEnvironmentLoggingLevel(); } if (logger.isDebugEnabled()) { return LogLevel.VERBOSE; } if (logger.isInfoEnabled()) { return LogLevel.INFORMATIONAL; } if (logger.isWarnEnabled()) { return LogLevel.WARNING; } if (logger.isErrorEnabled()) { return LogLevel.ERROR; } return LogLevel.NOT_SET; }
Source:
<code>public void sleeping_if_timeout() throws InterruptedException { queueModeHelper.assertClientNotRegisterered(); queueModeHelper.client.start(); queueModeHelper.waitForRegistration(1); queueModeHelper.assertClientRegisterered(); queueModeHelper.ensureClientAwake(); ReadResponse response = queueModeHelper.server.send(queueModeHelper.getCurrentRegistration(), <START> new ReadRequest(3, 0, 1), 1); <END> queueModeHelper.ensureTimeoutException(response); queueModeHelper.ensureClientSleeping(); }</code><technical_language>computer 1 ms is enough. test fail sometime</technical_language>

Target:
public void sleeping_if_timeout() throws InterruptedException { queueModeHelper.assertClientNotRegisterered(); queueModeHelper.client.start(); queueModeHelper.waitForRegistration(1); queueModeHelper.assertClientRegisterered(); queueModeHelper.ensureClientAwake(); queueModeHelper.client.stop(false); ReadResponse response = queueModeHelper.server.send(queueModeHelper.getCurrentRegistration(), new ReadRequest(3, 0, 1), 1); queueModeHelper.ensureTimeoutException(response); queueModeHelper.ensureClientSleeping(); }
Source:
<code>public ImageLicense processPage(int pageId, PageTitle pageTitle, JSONObject result) { try { JSONObject imageInfo = (JSONObject) result.optJSONArray("imageinfo").get(0); ImageLicense license = imageInfo != null ? parseImageLicenseMetadata(imageInfo.getJSONObject("extmetadata")) : null; return license; <START> } catch (Exception e) { <END> Log.d(TAG, "Caught exception: " + e.getMessage()); return null; } }</code><technical_language>avoid catch-all exception blocks (here below). reasoning debugging difficult happen inside. If specific exceptions wish handle, list them. Java 7 multi-catch verbosity down</technical_language>

Target:
public ImageLicense processPage(int pageId, PageTitle pageTitle, JSONObject result) { try { if (result.optJSONArray("imageinfo") != null) { JSONObject imageInfo = (JSONObject) result.optJSONArray("imageinfo").get(0); ImageLicense license = parseImageLicenseMetadata(imageInfo.getJSONObject("extmetadata")); return license; } return null; } catch (JSONException e) { Log.d(TAG, "Caught exception: " + e.getMessage(), e); return null; } }
Source:
<code>public void test_descriptor() throws Exception { init(false); <START> SensorDescriptor sensorDescriptor = mock(SensorDescriptor.class); <END> when(sensorDescriptor.onlyOnLanguage(any(String.class))).thenReturn(sensorDescriptor); sensor.describe(sensorDescriptor); verify(sensorDescriptor).name("XML Sensor"); verify(sensorDescriptor).onlyOnLanguage("xml"); }</code><technical_language>is need mock it, DefaultSensorDescriptor</technical_language>

Target:
public void test_descriptor() throws Exception { init(false); DefaultSensorDescriptor sensorDescriptor = new DefaultSensorDescriptor(); sensor.describe(sensorDescriptor); assertThat(sensorDescriptor.name()).isEqualTo("XML Sensor"); assertThat(sensorDescriptor.languages()).containsOnly(Xml.KEY); }
Source:
<code>public void recover(ResultSubpartitionInfo subpartitionInfo, Tuple2<BufferBuilder, BufferConsumer> bufferBuilderAndConsumer) { bufferBuilderAndConsumer.f0.finish(); if (bufferBuilderAndConsumer.f1.isDataAvailable()) { boolean added = getSubpartition(subpartitionInfo).add(bufferBuilderAndConsumer.f1); if (!added) { <START> throw new RuntimeException("Buffer consumer couldn't be added to ResultSubpartition"); <END> } } else { bufferBuilderAndConsumer.f1.close(); } }</code><technical_language>IOException? (org.apache.flink.runtime.checkpoint.channel.ChannelStateChunkReader#readChunk handle IOException)</technical_language>

Target:
public void recover(ResultSubpartitionInfo subpartitionInfo, Tuple2<BufferBuilder, BufferConsumer> bufferBuilderAndConsumer) throws IOException { bufferBuilderAndConsumer.f0.finish(); if (bufferBuilderAndConsumer.f1.isDataAvailable()) { boolean added = getSubpartition(subpartitionInfo).add(bufferBuilderAndConsumer.f1); if (!added) { throw new IOException("Buffer consumer couldn't be added to ResultSubpartition"); } } else { bufferBuilderAndConsumer.f1.close(); } }
Source:
<code>public static void validate(Transaction delayedPayoutTx, DaoFacade daoFacade, BtcWalletService btcWalletService) throws DonationAddressException { checkNotNull(delayedPayoutTx, "delayedPayoutTx must not be null"); String recentDonationAddressString = daoFacade.getParamValue(Param.RECIPIENT_BTC_ADDRESS); String defaultDonationAddressString = Param.RECIPIENT_BTC_ADDRESS.getDefaultValue(); TransactionOutput output = delayedPayoutTx.getOutput(0); NetworkParameters params = btcWalletService.getParams(); Address address = output.getAddressFromP2PKHScript(params); if (address == null) { address = output.getAddressFromP2SH(params); <START> checkNotNull(address, "address must not be null"); <END> } String addressAsString = address.toString(); boolean isValid = recentDonationAddressString.equals(addressAsString) || defaultDonationAddressString.equals(addressAsString); if (!isValid) { log.warn("Donation address is invalid." + "\nAddress used by BTC seller: " + addressAsString + "\nRecent donation address:" + recentDonationAddressString + "\nDefault donation address: " + defaultDonationAddressString); throw new DonationAddressException(addressAsString, recentDonationAddressString, defaultDonationAddressString); } }</code><technical_language>This trouble for TradeManager startup</technical_language>

Target:
public static void validate(Transaction delayedPayoutTx, DaoFacade daoFacade, BtcWalletService btcWalletService) throws DonationAddressException, MissingDelayedPayoutTxException { if (delayedPayoutTx == null) { throw new MissingDelayedPayoutTxException("DelayedPayoutTx must not be null"); } String recentDonationAddressString = daoFacade.getParamValue(Param.RECIPIENT_BTC_ADDRESS); String defaultDonationAddressString = Param.RECIPIENT_BTC_ADDRESS.getDefaultValue(); TransactionOutput output = delayedPayoutTx.getOutput(0); NetworkParameters params = btcWalletService.getParams(); Address address = output.getAddressFromP2PKHScript(params); if (address == null) { address = output.getAddressFromP2SH(params); checkNotNull(address, "address must not be null"); } String addressAsString = address.toString(); boolean isValid = recentDonationAddressString.equals(addressAsString) || defaultDonationAddressString.equals(addressAsString); if (!isValid) { log.warn("Donation address is invalid." + "\nAddress used by BTC seller: " + addressAsString + "\nRecent donation address:" + recentDonationAddressString + "\nDefault donation address: " + defaultDonationAddressString); throw new DonationAddressException(addressAsString, recentDonationAddressString, defaultDonationAddressString); } }
Source:
<code>public Lock obtain(Object lockKey) { Assert.isInstanceOf(String.class, lockKey); String path = this.keyToPath.pathFor((String) lockKey); ZkLock lock = this.locks.get(path); synchronized (this.locks) { <START> lock = this.locks.get(path); <END> if (lock == null) { lock = new ZkLock(this.client, path); this.locks.put(path, lock); } if (this.trackingTime) { lock.setLastUsed(System.currentTimeMillis()); } } return lock; }</code><technical_language>is this.locks.get(path) ? in algorithm, I feel this.locks done synchronized</technical_language>

Target:
public Lock obtain(Object lockKey) { Assert.isInstanceOf(String.class, lockKey); String path = this.keyToPath.pathFor((String) lockKey); ZkLock lock = this.locks.get(path); if (lock == null) { synchronized (this.locks) { lock = this.locks.get(path); if (lock == null) { lock = new ZkLock(this.client, path); this.locks.put(path, lock); } if (this.trackingTime) { lock.setLastUsed(System.currentTimeMillis()); } } } return lock; }