auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CacheTopology join(String cacheName, CacheJoinInfo joinInfo, CacheTopologyHandler stm, PartitionHandlingManager phm) throws Exception { log.debugf("Node %s joining cache %s", transport.getAddress(), cacheName); LocalCacheStatus cacheStatus = new LocalCacheStatus(joinInfo, stm, phm, stateTransferExecutor); runningCaches.put(cacheName, cacheStatus); long timeout = joinInfo.getTimeout(); long endTime = timeService.expectedEndTime(timeout, TimeUnit.MILLISECONDS); cacheStatus.getTopologyUpdatesCompletionService().continueTaskInBackground(); try { while (true) { int viewId = transport.getViewId(); try { ReplicableCommand command = new CacheTopologyControlCommand(cacheName, CacheTopologyControlCommand.Type.JOIN, transport.getAddress(), joinInfo, viewId); CacheStatusResponse initialStatus = (CacheStatusResponse) executeOnCoordinator(command, timeout); if (initialStatus != null) { doHandleTopologyUpdate(cacheName, initialStatus.getCacheTopology(), initialStatus.getAvailabilityMode(), viewId, transport.getCoordinator(), cacheStatus); doHandleStableTopologyUpdate(cacheName, initialStatus.getStableTopology(), viewId, cacheStatus); return initialStatus.getCacheTopology(); } } catch (Exception e) { log.debugf(e, "Error sending join request for cache %s to coordinator", cacheName); if (timeService.isTimeExpired(endTime)) { throw e; } Thread.sleep(100); } } } finally { cacheStatus.getTopologyUpdatesCompletionService().backgroundTaskFinished(null); } }

Target:
public CacheTopology join(String cacheName, CacheJoinInfo joinInfo, CacheTopologyHandler stm, PartitionHandlingManager phm) throws Exception { log.debugf("Node %s joining cache %s", transport.getAddress(), cacheName); ExecutorService topologyUpdatesExecutor = joinInfo.isTotalOrder() ? withinThreadExecutor : asyncTransportExecutor; LocalCacheStatus cacheStatus = new LocalCacheStatus(joinInfo, stm, phm, topologyUpdatesExecutor); runningCaches.put(cacheName, cacheStatus); long timeout = joinInfo.getTimeout(); long endTime = timeService.expectedEndTime(timeout, TimeUnit.MILLISECONDS); cacheStatus.getTopologyUpdatesCompletionService().continueTaskInBackground(); try { while (true) { int viewId = transport.getViewId(); try { ReplicableCommand command = new CacheTopologyControlCommand(cacheName, CacheTopologyControlCommand.Type.JOIN, transport.getAddress(), joinInfo, viewId); CacheStatusResponse initialStatus = (CacheStatusResponse) executeOnCoordinator(command, timeout); if (initialStatus != null) { doHandleTopologyUpdate(cacheName, initialStatus.getCacheTopology(), initialStatus.getAvailabilityMode(), viewId, transport.getCoordinator(), cacheStatus); doHandleStableTopologyUpdate(cacheName, initialStatus.getStableTopology(), viewId, cacheStatus); return initialStatus.getCacheTopology(); } } catch (Exception e) { log.debugf(e, "Error sending join request for cache %s to coordinator", cacheName); if (timeService.isTimeExpired(endTime)) { throw e; } Thread.sleep(100); } } } finally { cacheStatus.getTopologyUpdatesCompletionService().backgroundTaskFinished(null); } }
Source:
private JsonParser getParser(String data) throws IOException { Character firstChar = data.charAt(0); if (firstChar == '{' || firstChar == '[') { return this.jsonFactory.createParser(data); } else { return this.yamlFactory.createParser(data); } }

Target:
private JsonParser getParser(String data) throws IOException { char firstChar = data.charAt(0); if (firstChar == '{' || firstChar == '[') { return this.jsonFactory.createParser(data); } else { return this.yamlFactory.createParser(data); } }
Source:
public SerializableTransactionManager delegate() { if (!isInitialized) { if (manager.getKeyValueService().isInitialized() && manager.getTimelockService().isInitialized() && manager.getTimestampService().isInitialized() && manager.getCleaner().isInitialized() && prerequisite.isInitialized()) { isInitialized = true; } else { throw new NotInitializedException("TransactionManager"); } } return manager; }

Target:
public SerializableTransactionManager delegate() { if (!isInitialized()) { throw new NotInitializedException("TransactionManager"); } return manager; }
Source:
private List<VM> getSelectedVms() { List<VM> vms = new ArrayList<VM>(); if (getSelectedItems() == null) { return vms; } for (Object selectedItem : getSelectedItems()) { UserPortalItemModel itemModel = (UserPortalItemModel) selectedItem; VM vm = itemModel.getVM(); if (vm == null) { continue; } vms.add(vm); } return vms; }

Target:
private List<VM> getSelectedVms() { List<VM> vms = new ArrayList<VM>(); if (getSelectedItems() == null) { return vms; } for (Object selectedItem : getSelectedItems()) { UserPortalItemModel itemModel = (UserPortalItemModel) selectedItem; VM vm = itemModel.getVM(); if (vm != null) { vms.add(vm); } } return vms; }
Source:
public void preferenceChange( PreferenceChangeEvent event ) { String property = event.getKey(); if ( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT.equals( property ) ) { if ( event.getNewValue() == null || !event.getNewValue().equals( event.getOldValue() ) ) { fTimeoutEnabled = Boolean.parseBoolean( event.getNewValue().toString() ); updateWaitTimeout(); fTimerThread.setState( ( fTimerThread.getWaitTimeout() > 0 ) ? TimerThreadState.RUNNING : TimerThreadState.HALTED ); } } else if ( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE.equals( property ) ) { if ( !event.getNewValue().equals( event.getOldValue() ) ) { try { fTimeout = Integer.parseInt( event.getNewValue().toString() ); updateWaitTimeout(); fTimerThread.setState( ( fTimerThread.getWaitTimeout() > 0 ) ? TimerThreadState.RUNNING : TimerThreadState.HALTED ); } catch( NumberFormatException e ) { GdbPlugin.getDefault().getLog().log( new Status( IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invlaid timeout value" ) ); } } } else if ( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS.equals( property ) ) { if ( event.getNewValue() instanceof String ) { fCustomTimeouts.initializeFromMemento( (String)event.getNewValue() ); } else if ( event.getNewValue() == null ) { fCustomTimeouts.clear(); } updateWaitTimeout(); fTimerThread.setState( ( fTimerThread.getWaitTimeout() > 0 ) ? TimerThreadState.RUNNING : TimerThreadState.HALTED ); } }

Target:
public void preferenceChange( PreferenceChangeEvent event ) { String property = event.getKey(); if ( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT.equals( property ) ) { if ( event.getNewValue() == null || !event.getNewValue().equals( event.getOldValue() ) ) { fTimeoutEnabled = ( event.getNewValue() != null ) ? Boolean.parseBoolean( event.getNewValue().toString() ) : Boolean.FALSE; updateWaitTimeout(); fTimerThread.setTimerThreadState( ( fTimerThread.getWaitTimeout() > 0 ) ? TimerThreadState.RUNNING : TimerThreadState.HALTED ); } } else if ( IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE.equals( property ) ) { if ( event.getNewValue() == null || !event.getNewValue().equals( event.getOldValue() ) ) { try { fTimeout = ( event.getNewValue() != null ) ? Integer.parseInt( event.getNewValue().toString() ) : IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT; updateWaitTimeout(); fTimerThread.setTimerThreadState( ( fTimerThread.getWaitTimeout() > 0 ) ? TimerThreadState.RUNNING : TimerThreadState.HALTED ); } catch( NumberFormatException e ) { GdbPlugin.getDefault().getLog().log( new Status( IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Invlaid timeout value" ) ); } } } else if ( IGdbDebugPreferenceConstants.PREF_COMMAND_CUSTOM_TIMEOUTS.equals( property ) ) { if ( event.getNewValue() instanceof String ) { fCustomTimeouts.initializeFromMemento( (String)event.getNewValue() ); } else if ( event.getNewValue() == null ) { fCustomTimeouts.clear(); } updateWaitTimeout(); fTimerThread.setTimerThreadState( ( fTimerThread.getWaitTimeout() > 0 ) ? TimerThreadState.RUNNING : TimerThreadState.HALTED ); } }
Source:
public void setParticleEmitters(SolGame game, SolShip ship, Engine engine) { List<Drawable> drawables = ship.getDrawables(); if (!myParticleEmitters.isEmpty()) { List<Drawable> peDrawables = new ArrayList<>(); myParticleEmitters.forEach(pe -> peDrawables.addAll(pe.getDrawables())); drawables.removeAll(peDrawables); game.getDrawableManager().removeAll(peDrawables); myParticleEmitters.clear(); } if (engine != null) { config.getParticleEmitterList(). forEach(pes -> myParticleEmitters.add(new ParticleEmitter(game, engine, pes, ship))); List<Drawable> peDrawables = new ArrayList<>(); myParticleEmitters.forEach(pe -> peDrawables.addAll(pe.getDrawables())); drawables.addAll(peDrawables); game.getDrawableManager().addAll(peDrawables); } }

Target:
public void setParticleEmitters(SolGame game, SolShip ship, Engine engine) { List<Drawable> drawables = ship.getDrawables(); if (!particleEmitters.isEmpty()) { List<Drawable> particleEmitterDrawables = new ArrayList<>(); particleEmitters.forEach(pe -> particleEmitterDrawables.addAll(pe.getDrawables())); drawables.removeAll(particleEmitterDrawables); game.getDrawableManager().removeAll(particleEmitterDrawables); particleEmitters.clear(); } if (engine != null) { config.getParticleEmitters().forEach(pes -> particleEmitters.add(new DSParticleEmitter(game, pes, ship))); List<Drawable> particleEmitterDrawables = new ArrayList<>(); particleEmitters.forEach(pe -> particleEmitterDrawables.addAll(pe.getDrawables())); drawables.addAll(particleEmitterDrawables); game.getDrawableManager().addAll(particleEmitterDrawables); } }
Source:
private static <E> boolean deepEqualsList(List<E> l1, List<?> l2) { final Iterator<E> i1 = l1.iterator(); final Iterator<?> i2 = l2.iterator(); while (i1.hasNext() && i2.hasNext()) { final E o1 = i1.next(); final Object o2 = i2.next(); if (!deepEqualsInternal(o1, o2)) { return false; } } return !(i1.hasNext() || i2.hasNext()); }

Target:
private static <E> boolean deepEqualsList(List<E> l1, List<?> l2) { if (l1.size() != l2.size()) { return false; } final Iterator<E> i1 = l1.iterator(); final Iterator<?> i2 = l2.iterator(); while (i1.hasNext() && i2.hasNext()) { final E o1 = i1.next(); final Object o2 = i2.next(); if (!deepEqualsInternal(o1, o2)) { return false; } } return true; }
Source:
private static <T> RuleApplication applyRule(Rule<T> rule, PlanNode planNode, Rule.Context context) { PlanNodeMatcher matcher = new PlanNodeMatcher(context.getLookup()); Optional<Match<T>> match = matcher.match(rule.getPattern(), planNode).collect(toOptional()); Rule.Result result; if (!rule.isEnabled(context.getSession()) || !match.isPresent()) { result = Rule.Result.empty(); } else { result = rule.apply(match.get().value(), match.get().captures(), context); } return new RuleApplication(context.getLookup(), context.getSymbolAllocator().getTypes(), result); }

Target:
private static <T> RuleApplication applyRule(Rule<T> rule, PlanNode planNode, Rule.Context context) { Capture<T> planNodeCapture = newCapture(); Pattern<T> pattern = rule.getPattern().capturedAs(planNodeCapture); Optional<Match> match = pattern.match(planNode, context.getLookup()) .collect(toOptional()); Rule.Result result; if (!rule.isEnabled(context.getSession()) || !match.isPresent()) { result = Rule.Result.empty(); } else { result = rule.apply(match.get().capture(planNodeCapture), match.get().captures(), context); } return new RuleApplication(context.getLookup(), context.getSymbolAllocator().getTypes(), result); }
Source:
public String getValue() { return identifier; }

Target:
public String getValue() { return getIdentifier(); }
Source:
private void onCurrentGameEnded() { NotificationsPrefs notification = preferencesService.getPreferences().getNotification(); if (!notification.isAfterGameReviewEnabled() || !notification.getEventNotificationsEnabled()) { return; } synchronized (currentGame) { int id = currentGame.get().getId(); notificationService.addNotification(new PersistentNotification(i18n.get("game.ended", currentGame.get().getTitle()), Severity.INFO, singletonList(new Action(i18n.get("game.rate"), actionEvent -> replayService.findById(id) .thenAccept(replay -> Platform.runLater(() -> { if (replay.isPresent()) { eventBus.post(new ShowReplayEvent(replay.get())); } else { notificationService.addNotification(new ImmediateNotification(i18n.get("replay.notFoundTitle"), i18n.get("replay.replayNotFoundText", id), Severity.WARN)); } })))))); } }

Target:
private void onCurrentGameEnded() { NotificationsPrefs notification = preferencesService.getPreferences().getNotification(); if (!notification.isAfterGameReviewEnabled() || !notification.isTransientNotificationsEnabled()) { return; } synchronized (currentGame) { int id = currentGame.get().getId(); notificationService.addNotification(new PersistentNotification(i18n.get("game.ended", currentGame.get().getTitle()), Severity.INFO, singletonList(new Action(i18n.get("game.rate"), actionEvent -> replayService.findById(id) .thenAccept(replay -> Platform.runLater(() -> { if (replay.isPresent()) { eventBus.post(new ShowReplayEvent(replay.get())); } else { notificationService.addNotification(new ImmediateNotification(i18n.get("replay.notFoundTitle"), i18n.get("replay.replayNotFoundText", id), Severity.WARN)); } })))))); } }
Source:
public final String toString() { return String.format("%s is %s(%s) and %s(%s)", getField(), isIncludeLower() ? "gte" : "gt", lower, isIncludeUpper() ? "lte" : "lt", upper); }

Target:
public final String toString() { return String.format("%s %s %s and %s %s %s", getField(), isIncludeLower() ? GTE : GT, lower, getField(), isIncludeUpper() ? LTE : LT, upper); }
Source:
private int insertInWaitingQueue(long ts, Request request) { ITmfStateValue statusState = request.getType() == IoOperationType.READ ? StateValues.READING_REQUEST_VALUE : StateValues.WRITING_REQUEST_VALUE; int slotQuark = fWaitingQueueAttrib.getAvailable(); try { fSs.modifyAttribute(ts, statusState.unboxValue(), slotQuark); int currentRequestQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.CURRENT_REQUEST); fSs.modifyAttribute(ts, request.getSector(), currentRequestQuark); int requestSizeQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.REQUEST_SIZE); fSs.modifyAttribute(ts, request.getNrSector(), requestSizeQuark); int mergedInQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.MERGED_IN); fSs.modifyAttribute(ts, TmfStateValue.nullValue().unboxValue(), mergedInQuark); } catch (StateValueTypeException e) { Activator.getDefault().logError("Error inserting request", e); } fWaitingQueue.put(request.getSector(), new Pair<>(request, slotQuark)); return slotQuark; }

Target:
private int insertInWaitingQueue(long ts, Request request) { ITmfStateValue statusState = request.getType() == IoOperationType.READ ? StateValues.READING_REQUEST_VALUE : StateValues.WRITING_REQUEST_VALUE; int slotQuark = fWaitingQueueAttrib.getAvailable(); try { fSs.modifyAttribute(ts, statusState.unboxValue(), slotQuark); int currentRequestQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.CURRENT_REQUEST); fSs.modifyAttribute(ts, request.getSector(), currentRequestQuark); int requestSizeQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.REQUEST_SIZE); fSs.modifyAttribute(ts, request.getNrSector(), requestSizeQuark); int mergedInQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.MERGED_IN); fSs.modifyAttribute(ts, (Object) null, mergedInQuark); } catch (StateValueTypeException e) { Activator.getDefault().logError("Error inserting request", e); } fWaitingQueue.put(request.getSector(), new Pair<>(request, slotQuark)); return slotQuark; }
Source:
private static String getBaseDirectoryFallback() { String baseDirCandidate = System.getProperty("user.dir", "."); Path path = Paths.get(baseDirCandidate); if (path.toFile().isDirectory() && (path.resolve("pom.xml").toFile().exists() || path.resolve("build.gradle").toFile().exists())) { return path.toString(); } else { throw new IllegalStateException(String.format( "Failed to determine project directory for dev mode. " + "Directory '%s' does not look like a Maven or " + "Gradle project. Ensure that you have run the " + "prepare-frontend Maven goal prior to deploying " + "your application", path.toString())); } }

Target:
private static String getBaseDirectoryFallback() { String baseDirCandidate = System.getProperty("user.dir", "."); Path path = Paths.get(baseDirCandidate); if (path.toFile().isDirectory() && (path.resolve("pom.xml").toFile().exists() || path.resolve("build.gradle").toFile().exists())) { return path.toString(); } else { throw new IllegalStateException(String.format( "Failed to determine project directory for dev mode. " + "Directory '%s' does not look like a Maven or " + "Gradle project. Ensure that you have run the " + "prepare-frontend Maven goal, which generates " +"'flow-build-info.json', prior to deploying your " + "application", path.toString())); } }
Source:
public static @CheckForNull Fingerprint load(@NonNull String id) throws IOException { long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); Fingerprint loaded = FingerprintStorage.get().load(id); initFacets(loaded); if(logger.isLoggable(Level.FINE)) logger.fine("Loading fingerprint took "+(System.currentTimeMillis()-start)+"ms"); return loaded; }

Target:
public static @CheckForNull Fingerprint load(@NonNull String id) throws IOException { long start=0; if(logger.isLoggable(Level.FINE)) { start = System.currentTimeMillis(); } Fingerprint loaded = FingerprintStorage.get().load(id); initFacets(loaded); if(logger.isLoggable(Level.FINE)) { logger.fine("Loading fingerprint took " + (System.currentTimeMillis() - start) + "ms"); } return loaded; }
Source:
public void setIn(InputStream in) { this.in = in; ThreadLocalInputStream tls = (ThreadLocalInputStream) System.in; tls.init(in); }

Target:
public void setIn(InputStream in) { this.in = in; if (!(System.in instanceof ThreadLocalInputStream)) { throw new IllegalStateException("System.in should be set by nailgun."); } ThreadLocalInputStream tls = (ThreadLocalInputStream) System.in; tls.init(in); }
Source:
private void runOperation(Ignite verifierNode, BiConsumer<String, T2<String, Integer>> c) { T2<String, Integer> entry = entry(); c.accept(CACHE_NAME, entry); assertThat((Integer)(verifierNode.cache(CACHE_NAME).get(entry.getKey())), is(entry.getValue())); }

Target:
private void runOperation(Ignite verifierNode, BiConsumer<String, T2<String, Integer>> c) { T2<String, Integer> entry = entry(); c.accept(CACHE_NAME, entry); assertThat(verifierNode.<String, Integer>cache(CACHE_NAME).get(entry.getKey()), is(entry.getValue())); }
Source:
private void postProcess(Path tmpDir, GoGoDuckModule module) throws GoGoDuckException { File[] directoryListing = tmpDir.toFile().listFiles(); if (directoryListing != null) { for (File file : directoryListing) { try { if (!module.hasPackedVariables()) { return; } File tmpFile = File.createTempFile("ncpdq", ".nc"); List<String> command = new ArrayList<>(); command.add(goGoDuckConfig.getNcpdqPath()); command.add("-O"); command.add("-U"); command.add(file.getAbsolutePath()); command.add(tmpFile.getAbsolutePath()); logger.info(String.format("Unpacking file (ncpdq) '%s' to '%s'", file.toPath(), tmpFile.toPath())); GoGoDuck.execute(command); Files.delete(file.toPath()); Files.move(tmpFile.toPath(), file.toPath()); } catch (Exception e) { throw new GoGoDuckException(String.format("Could not run ncpdq on file '%s'", file.toPath())); } } } else { throw new GoGoDuckException("No files available for post processing"); } }

Target:
private void postProcess(Path tmpDir, GoGoDuckModule module) throws GoGoDuckException { File[] directoryListing = tmpDir.toFile().listFiles(); if (directoryListing != null) { for (File file : directoryListing) { try { if (!module.unpackNetcdf()) { return; } File tmpFile = File.createTempFile("ncpdq", ".nc"); List<String> command = new ArrayList<>(); command.add(goGoDuckConfig.getNcpdqPath()); command.add("-O"); command.add("-U"); command.add(file.getAbsolutePath()); command.add(tmpFile.getAbsolutePath()); logger.info(String.format("Unpacking file (ncpdq) '%s' to '%s'", file.toPath(), tmpFile.toPath())); GoGoDuck.execute(command); Files.delete(file.toPath()); Files.move(tmpFile.toPath(), file.toPath()); } catch (Exception e) { throw new GoGoDuckException(String.format("Could not run ncpdq on file '%s'", file.toPath())); } } } else { throw new GoGoDuckException("No files available for post processing"); } }
Source:
public static List<String> getStartupPagePaths() { LoginScreenConfig config = getConfig(); if (config == null) { return Collections.emptyList(); } return config.getStartupPages() .values() .stream() .map(startupPage -> startupPage.getPath()) .collect(Collectors.toList()); }

Target:
public static List<String> getStartupPagePaths() { LoginScreenConfig config = getConfig(); if (config == null) { return Collections.emptyList(); } return config.getStartupPages() .values() .stream() .sorted((p1, p2) -> p2.compareTo(p1)) .map(startupPage -> startupPage.getPath()) .collect(Collectors.toList()); }
Source:
public List<GroupModel> getGroups() { if (updated != null) return updated.getGroups(); List<GroupModel> groups = new ArrayList<>(); for (String id : cached.getGroups(modelSupplier)) { GroupModel groupModel = keycloakSession.realms().getGroupById(id, realm); if (groupModel == null) { getDelegateForUpdate(); return updated.getGroups(); } groups.add(groupModel); } groups.sort(Comparator.comparing(GroupModel::getName)); return groups; }

Target:
public Set<GroupModel> getGroups() { if (updated != null) return updated.getGroups(); Set<GroupModel> groups = new LinkedHashSet<>(); for (String id : cached.getGroups(modelSupplier)) { GroupModel groupModel = keycloakSession.realms().getGroupById(id, realm); if (groupModel == null) { getDelegateForUpdate(); return updated.getGroups(); } groups.add(groupModel); } return groups; }
Source:
public void shutdownPublisherAndReportMetrics() throws Exception { reportMetrics(); shutdownPublisher(); }

Target:
public void shutdownPublisherAndReportMetrics() throws Exception { reportMetrics(); publisher.stop(); }
Source:
public ChangeStreamIterable<TResult> showMigrationEvents(final boolean showMigrationEvents) { this.showMigrationEvents = notNull("showMigrationEvents", showMigrationEvents); return this; }

Target:
public ChangeStreamIterable<TResult> showMigrationEvents(final boolean showMigrationEvents) { this.showMigrationEvents = showMigrationEvents; return this; }
Source:
private void compare(Map<Integer, Boolean> dbexpected, List<JtsGeomEntity> list) { int cnt = 0; for ( Map.Entry<Integer, Boolean> entry : dbexpected.entrySet() ) { if ( entry.getValue() ) { cnt++; if ( !findInList( entry.getKey(), list ) ) { fail( String.format( "Expected object with id= %d, but not found in result", entry.getKey() ) ); } } } assertEquals( cnt, list.size() ); LOG.info( String.format( "Found %d objects within testsuite-suite polygon.", cnt ) ); }

Target:
private void compare(Map<Integer, Boolean> dbexpected, List<JtsGeomEntity> list) { int cnt = dbexpected.entrySet() .stream() .filter( Map.Entry::getValue ) .reduce( 0, (accumulator, entry) -> { if ( !findInList( entry.getKey(), list ) ) { fail( String.format( "Expected object with id= %d, but not found in result", entry.getKey() ) ); } return accumulator + 1; }, Integer::sum ); assertEquals( cnt, list.size() ); LOG.infof( "Found %d objects within testsuite-suite polygon.", cnt ); }
Source:
private Collection<Resource> getAssetFolders(Page page, ResourceResolver resolver) { Map<String, Resource> allAssetFolders = new TreeMap<String, Resource>(); ValueMap properties = page.getProperties(); String[] configuredAssetFolderPaths = properties.get(damAssetProperty, String[].class); if (configuredAssetFolderPaths != null) { for (String configuredAssetFolderPath : configuredAssetFolderPaths) { if (StringUtils.isNotBlank(configuredAssetFolderPath)) { Resource configuredAssetFolder = resolver.getResource(configuredAssetFolderPath); if (configuredAssetFolder != null && configuredAssetFolder.isResourceType("sling:OrderedFolder")) { for (Resource assetFolder : getAssetFolders(configuredAssetFolder)) { if (!allAssetFolders.containsKey(assetFolder.getPath())) { allAssetFolders.put(assetFolder.getPath(), assetFolder); } } } } } } return allAssetFolders.values(); }

Target:
private Collection<Resource> getAssetFolders(Page page, ResourceResolver resolver) { List<Resource> allAssetFolders = new ArrayList<Resource>(); ValueMap properties = page.getProperties(); String[] configuredAssetFolderPaths = properties.get(damAssetProperty, String[].class); if (configuredAssetFolderPaths != null) { Arrays.sort(configuredAssetFolderPaths); String prevPath = "#"; for (String configuredAssetFolderPath : configuredAssetFolderPaths) { if (StringUtils.isNotBlank(configuredAssetFolderPath)) { if (!configuredAssetFolderPath.equals(prevPath) && !StringUtils.startsWith(configuredAssetFolderPath, prevPath + "/")) { Resource assetFolder = resolver.getResource(configuredAssetFolderPath); if (assetFolder != null) { prevPath = configuredAssetFolderPath; allAssetFolders.add(assetFolder); } } } } } return allAssetFolders; }
Source:
public FeatureFlag get(String key) { FeatureFlag featureFlag; if (cache != null) { featureFlag = cache.getUnchecked(key); } else { featureFlag = getRedis(key); } if (featureFlag == null) { logger.debug("[get] Key: " + key + " not found in feature store. Returning null"); return null; } if (featureFlag.isDeleted()) { logger.debug("[get] Key: " + key + " has been deleted. Returning null"); return null; } logger.debug("[get] Key: " + key + " with version: " + featureFlag.getVersion() + " found in feature store."); return featureFlag; }

Target:
public FeatureFlag get(String key) { FeatureFlag featureFlag; if (cache != null) { featureFlag = cache.getUnchecked(key); } else { featureFlag = getRedis(key); } if (featureFlag != null) { logger.debug("[get] Key: " + key + " with version: " + featureFlag.getVersion() + " found in feature store."); } return featureFlag; }
Source:
public GroupBySubscriber( Func1<? super T, ? extends K> keySelector, Func1<? super T, ? extends R> elementSelector, Subscriber<? super GroupedObservable<K, R>> child) { super(); this.keySelector = keySelector; this.elementSelector = elementSelector; this.child = child; child.add(Subscriptions.create(new Action0() { @Override public void call() { if (wipForUnsubscribe.decrementAndGet() == 0) { self.unsubscribe(); } } })); }

Target:
public GroupBySubscriber( Func1<? super T, ? extends K> keySelector, Func1<? super T, ? extends R> elementSelector, Subscriber<? super GroupedObservable<K, R>> child) { super(); this.keySelector = keySelector; this.elementSelector = elementSelector; this.child = child; child.add(Subscriptions.create(new Action0() { @Override public void call() { if (WIP_FOR_UNSUBSCRIBE_UPDATER.decrementAndGet(self) == 0) { self.unsubscribe(); } } })); }
Source:
public boolean isPageVisited(long pageId, String userId, String owner) { if (owner != null) { Object fields = new Object[3]; fields[0] = pageId; fields[1] = pageId; fields[2] = userId; List<String> ones = sqlService.dbRead("select 1 from lesson_builder_student_pages a, lesson_builder_log b where a.pageId=? and a.itemId = b.itemId and b.studentPageId=? and b.userId=?", fields, null); if (ones != null && ones.size() > 0) return true; } List<String> ones; Object[] fields; if (userId==null){ fields = new Object[1]; fields[0] = Long.toString(pageId); ones = sqlService.dbRead("select 1 from lesson_builder_items a, lesson_builder_log b where a.sakaiId=? and a.type=2 and a.id=b.itemId and b.userId=''", fields, null); } else { fields = new Object[2]; fields[0] = Long.toString(pageId); fields[1] = userId; ones = sqlService.dbRead("select 1 from lesson_builder_items a, lesson_builder_log b where a.sakaiId=? and a.type=2 and a.id=b.itemId and b.userId=?", fields, null); } if (ones != null && ones.size() > 0) return true; else return false; }

Target:
public boolean isPageVisited(long pageId, String userId, String owner) { if (owner != null) { Object fields = new Object[3]; fields[0] = pageId; fields[1] = pageId; fields[2] = userId; List<String> ones = sqlService.dbRead("select 1 from lesson_builder_student_pages a, lesson_builder_log b where a.pageId=? and a.itemId = b.itemId and b.studentPageId=? and b.userId=?", fields, null); if (ones != null && ones.size() > 0) return true; } Object fields = new Object[2]; fields[0] = Long.toString(pageId); fields[1] = (userId == null || userId.isEmpty())? ".anon" : userId; List<String> ones = sqlService.dbRead("select 1 from lesson_builder_items a, lesson_builder_log b where a.sakaiId=? and a.type=2 and a.id=b.itemId and b.userId=?", fields, null); if (ones != null && ones.size() > 0) return true; else return false; }
Source:
public void reload() throws LoadBalancerExtensionException { log.info("Configuration reloaded"); }

Target:
public void reload() throws LoadBalancerExtensionException { }
Source:
private String calculateCommitMessage(Collection<String> paths) { if (commitMessage != null) { return commitMessage; } if (amending) return previousCommitMessage; StringBuilder calculatedCommitMessage = new StringBuilder(); Set<IResource> resources = new HashSet<>(); for (String path : paths) { IFile file = findFile(path); if (file != null) resources.add(file.getProject()); } if (resources.size() == 0 && repository != null) { resources .addAll(Arrays.asList(ProjectUtil.getProjects(repository))); } try { List<ICommitMessageProvider> messageProviders = getCommitMessageProviders(); IResource[] resourcesArray = resources .toArray(new IResource[0]); String providedMessageSeparator = "\n\n"; for (ICommitMessageProvider messageProvider : messageProviders) { String message = messageProvider.getMessage(resourcesArray); if ((message != null) && (!"".equals(message.trim()))) { calculatedCommitMessage.append(providedMessageSeparator) .append((message.trim())); } } if (calculatedCommitMessage.length() >= providedMessageSeparator .length()) { calculatedCommitMessage.delete(0, providedMessageSeparator.length()); } } catch (CoreException coreException) { Activator.logError(coreException.getLocalizedMessage(), coreException); } return calculatedCommitMessage.toString(); }

Target:
private String calculateCommitMessage(Collection<String> paths) { if (commitMessage != null) { return commitMessage; } if (amending) return previousCommitMessage; StringBuilder calculatedCommitMessage = new StringBuilder(); Set<IResource> resources = new HashSet<>(); for (String path : paths) { IFile file = findFile(path); if (file != null) resources.add(file.getProject()); } if (resources.size() == 0 && repository != null) { resources .addAll(Arrays.asList(ProjectUtil.getProjects(repository))); } try { List<ICommitMessageProvider> messageProviders = getCommitMessageProviders(); IResource[] resourcesArray = resources .toArray(new IResource[0]); String providedMessageSeparator = "\n\n"; for (ICommitMessageProvider messageProvider : messageProviders) { String message = null; try { message = messageProvider.getMessage(resourcesArray); } catch (RuntimeException e) { Activator.logError(e.getMessage(), e); } if (message != null && !"".equals(message.trim())) { if (calculatedCommitMessage.length() > 0) { calculatedCommitMessage .append(providedMessageSeparator); } calculatedCommitMessage.append(providedMessageSeparator) .append((message.trim())); } } } catch (CoreException coreException) { Activator.logError(coreException.getLocalizedMessage(), coreException); } return calculatedCommitMessage.toString(); }
Source:
public void connectToClient() throws IOException { if ( channel != null ) { throw new IllegalStateException( "already accepted TCP client connection" ); } channel = server.accept(); }

Target:
public void connectToClient() throws IOException { if ( worker != null ) { throw new IllegalStateException( "already accepted TCP client connection" ); } try { worker = server.accept().get(); } catch ( InterruptedException e ) { throw new IOException( e.getLocalizedMessage(), e ); } catch ( ExecutionException e ) { throw new IOException( e.getLocalizedMessage(), e.getCause() ); } }
Source:
public String getName() { if (title == null) { if (base == null) { title = MessageFormat.format(UIText.DiffEditorInput_Title1, tip.getObjectId().abbreviate(7).name(), GitLabels.getPlainShortLabel(tip.getRepository())); } else { title = MessageFormat.format(UIText.DiffEditorInput_Title2, base.getObjectId().abbreviate(7).name(), tip.getObjectId().abbreviate(7).name(), GitLabels.getPlainShortLabel(tip.getRepository())); } } return title; }

Target:
public String getName() { if (title == null) { if (base == null) { title = MessageFormat.format(UIText.DiffEditorInput_Title1, Utils.getShortObjectId(tip.getObjectId()), GitLabels.getPlainShortLabel(tip.getRepository())); } else { title = MessageFormat.format(UIText.DiffEditorInput_Title2, Utils.getShortObjectId(base.getObjectId()), Utils.getShortObjectId(tip.getObjectId()), GitLabels.getPlainShortLabel(tip.getRepository())); } } return title; }
Source:
public static AdvancedConfig createDefault() { return new AdvancedConfig() .setBlocksFactory(TeraSparseArray16Bit.class.getName()) .setSunlightFactory(TeraDenseArray8Bit.class.getName()) .setLightFactory(TeraDenseArray8Bit.class.getName()) .setExtraFactory(TeraDenseArray8Bit.class.getName()) .setChunkDeflationEnabled(true) .setChunkDeflationLoggingEnabled(false) .setAdvancedMonitoringEnabled(false) .setAdvancedMonitorVisibleAtStartup(false); }

Target:
public static AdvancedConfig createDefault() { return new AdvancedConfig() .setBlocksFactory(TeraDenseArray16Bit.class.getName()) .setSunlightFactory(TeraDenseArray8Bit.class.getName()) .setLightFactory(TeraDenseArray8Bit.class.getName()) .setExtraFactory(TeraDenseArray8Bit.class.getName()) .setChunkDeflationEnabled(true) .setChunkDeflationLoggingEnabled(false) .setAdvancedMonitoringEnabled(false) .setAdvancedMonitorVisibleAtStartup(false); }
Source:
public static boolean matchingColumn(final Cell left, final byte lFamLen, final int lQualLength, final Cell right, final byte rFamLen, final int rQualLength) { if (!matchingFamily(left, lFamLen, right, rFamLen)) { return false; } return matchingQualifier(left, lQualLength, right, rQualLength); }

Target:
private static boolean matchingColumn(final Cell left, final byte lFamLen, final int lQualLength, final Cell right, final byte rFamLen, final int rQualLength) { if (!matchingFamily(left, lFamLen, right, rFamLen)) { return false; } return matchingQualifier(left, lQualLength, right, rQualLength); }
Source:
public CreateWsResponse create(CreateRequest project) { PostRequest request = new PostRequest(path(ACTION_CREATE)) .setParam(PARAM_ORGANIZATION, project.getOrganization()) .setParam(PARAM_PROJECT, project.getKey()) .setParam(PARAM_NAME, project.getName()) .setParam(PARAM_BRANCH, project.getBranch()) .setParam("visibility", project.getVisibility()); return call(request, CreateWsResponse.parser()); }

Target:
public CreateWsResponse create(CreateRequest project) { PostRequest request = new PostRequest(path(ACTION_CREATE)) .setParam(PARAM_ORGANIZATION, project.getOrganization()) .setParam(PARAM_PROJECT, project.getKey()) .setParam(PARAM_NAME, project.getName()) .setParam(PARAM_BRANCH, project.getBranch()) .setParam(PARAM_VISIBILITY, project.getVisibility()); return call(request, CreateWsResponse.parser()); }
Source:
public Stream<InputSplit<List<WindowedSegmentId>>> createSplits( InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec ) { if (segmentIds == null) { return Streams.sequentialStreamFrom( createSplits( coordinatorClient, retryPolicyFactory, dataSource, interval, splitHintSpec == null ? new SegmentsSplitHintSpec(null) : splitHintSpec ) ); } else { return Stream.of(new InputSplit<>(segmentIds)); } }

Target:
public Stream<InputSplit<List<WindowedSegmentId>>> createSplits( InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec ) { if (segmentIds == null) { return Streams.sequentialStreamFrom( createSplits( coordinatorClient, retryPolicyFactory, dataSource, interval, splitHintSpec == null ? new MaxSizeSplitHintSpec(null) : splitHintSpec ) ); } else { return Stream.of(new InputSplit<>(segmentIds)); } }
Source:
int getSpacing() { return 1; }

Target:
public int getSpacing() { return 1; }
Source:
private MeasurementVariable createLocationNameVariable(final Integer locationId, final String locationAlias) { final MeasurementVariable locationNameVariable = new MeasurementVariable(); final Location location = this.locationDataManager.getLocationByID(locationId); final StandardVariable standardVariable = this.fieldbookService.getStandardVariable(TermId.TRIAL_LOCATION.getId()); locationNameVariable.setName(locationAlias); locationNameVariable.setDescription(standardVariable.getDescription()); locationNameVariable.setProperty(standardVariable.getProperty().getName()); locationNameVariable.setScale(standardVariable.getScale().getName()); locationNameVariable.setMethod(standardVariable.getMethod().getName()); locationNameVariable.setDataType(standardVariable.getDataType().getName()); locationNameVariable.setDataTypeId(standardVariable.getDataType().getId()); locationNameVariable.setValue(location.getLname()); locationNameVariable.setLabel("TRIAL"); locationNameVariable.setTermId(8180); return locationNameVariable; }

Target:
private MeasurementVariable createLocationNameVariable(final Integer locationId, final String locationAlias) { final MeasurementVariable locationNameVariable = new MeasurementVariable(); final Location location = this.locationDataManager.getLocationByID(locationId); final StandardVariable standardVariable = this.fieldbookService.getStandardVariable(TermId.TRIAL_LOCATION.getId()); locationNameVariable.setName(locationAlias); locationNameVariable.setDescription(standardVariable.getDescription()); locationNameVariable.setProperty(standardVariable.getProperty().getName()); locationNameVariable.setScale(standardVariable.getScale().getName()); locationNameVariable.setMethod(standardVariable.getMethod().getName()); locationNameVariable.setDataType(standardVariable.getDataType().getName()); locationNameVariable.setDataTypeId(standardVariable.getDataType().getId()); locationNameVariable.setValue(location.getLname()); locationNameVariable.setLabel("TRIAL"); locationNameVariable.setTermId(TermId.TRIAL_LOCATION.getId()); return locationNameVariable; }
Source:
public Guid getUserIdIfExternal() { return isInternalExecution() ? null : getUserId(); }

Target:
public Optional<Guid> getUserIdIfExternal() { return isInternalExecution() ? Optional.empty() : Optional.ofNullable(getUserId()); }
Source:
public static void SNAPSHOT_SCHEMA(String schemaName, String snapshotName) throws Exception { String sql1 = String.format( "select tablename,conglomeratenumber " + "from sys.sysschemas s, sys.systables t, sys.sysconglomerates c " + "where s.schemaid=t.schemaid and " + "c.tableid = t.tableid and " + "c.schemaid=s.schemaid and " + "s.schemaname='%s' and " + "isindex=false and " + "isconstraint=false", schemaName); String sql2 = String.format( "select conglomeratename, conglomeratenumber " + "from sys.sysschemas s, sys.systables t, sys.sysconglomerates c " + "where s.schemaid=t.schemaid and " + "c.schemaid=s.schemaid and " + "s.schemaname='%s' and " + "(isconstraint=true or isindex=true)", schemaName); ensureSnapshot(snapshotName, false); LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC(); TransactionController tc = lcc.getTransactionExecute(); DataDictionary dd = lcc.getDataDictionary(); SchemaDescriptor sd = dd.getSchemaDescriptor(schemaName, tc, true); if (sd == null) { throw StandardException.newException(SQLState.LANG_SCHEMA_DOES_NOT_EXIST, schemaName); } dd.startWriting(lcc); List<String> snapshotList = Lists.newArrayList(); try { ResultSet rs = getResultSet(sql1); snapshot(rs, snapshotName, schemaName, dd, tc, snapshotList); rs = getResultSet(sql2); snapshot(rs, snapshotName, schemaName, dd, tc, snapshotList); } catch (Exception e) { deleteSnapshots(snapshotList); throw e; } }

Target:
public static void SNAPSHOT_SCHEMA(String schemaName, String snapshotName) throws Exception { String sql1 = "select tablename,conglomeratenumber " + "from sys.sysschemas s, sys.systables t, sys.sysconglomerates c " + "where s.schemaid=t.schemaid and " + "c.tableid = t.tableid and " + "c.schemaid=s.schemaid and " + "s.schemaname=? and " + "(s.schemaname<>'SYS' or t.tablename<>'SYSSNAPSHOTS') and " + "isindex=false and " + "isconstraint=false"; String sql2 = "select conglomeratename, conglomeratenumber " + "from sys.sysschemas s, sys.systables t, sys.sysconglomerates c " + "where s.schemaid=t.schemaid and " + "c.schemaid=s.schemaid and " + "c.tableid = t.tableid and " + "s.schemaname=? and " + "(s.schemaname<>'SYS' or t.tablename<>'SYSSNAPSHOTS') and " + "(isconstraint=true or isindex=true)"; ensureSnapshot(snapshotName, false); LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC(); TransactionController tc = lcc.getTransactionExecute(); DataDictionary dd = lcc.getDataDictionary(); SchemaDescriptor sd = dd.getSchemaDescriptor(schemaName, tc, true); if (sd == null) { throw StandardException.newException(SQLState.LANG_SCHEMA_DOES_NOT_EXIST, schemaName); } dd.startWriting(lcc); List<String> snapshotList = Lists.newArrayList(); try { ResultSet rs = getResultSet(sql1, schemaName, null); snapshot(rs, snapshotName, schemaName, dd, tc, snapshotList); rs = getResultSet(sql2, schemaName, null); snapshot(rs, snapshotName, schemaName, dd, tc, snapshotList); } catch (Exception e) { deleteSnapshots(snapshotList); throw e; } }
Source:
private void initializeTypeEstimates(ConstraintVariable2[] allConstraintVariables) { for (ConstraintVariable2 cv : allConstraintVariables) { TypeEquivalenceSet set= cv.getTypeEquivalenceSet(); if (set == null) { set= new TypeEquivalenceSet(cv); set.setTypeEstimate(createInitialEstimate(cv)); cv.setTypeEquivalenceSet(set); } else { TypeSet typeEstimate= (TypeSet) cv.getTypeEstimate(); if (typeEstimate == null) { ConstraintVariable2[] cvs= set.getContributingVariables(); typeEstimate= fTypeSetEnvironment.getUniverseTypeSet(); for (ConstraintVariable2 c : cvs) { typeEstimate = typeEstimate.intersectedWith(createInitialEstimate(c)); } set.setTypeEstimate(typeEstimate); } } } }

Target:
private void initializeTypeEstimates(ConstraintVariable2[] allConstraintVariables) { for (ConstraintVariable2 cv : allConstraintVariables) { TypeEquivalenceSet set= cv.getTypeEquivalenceSet(); if (set == null) { set= new TypeEquivalenceSet(cv); set.setTypeEstimate(createInitialEstimate(cv)); cv.setTypeEquivalenceSet(set); } else { TypeSet typeEstimate= (TypeSet) cv.getTypeEstimate(); if (typeEstimate == null) { typeEstimate= fTypeSetEnvironment.getUniverseTypeSet(); for (ConstraintVariable2 c : set.getContributingVariables()) { typeEstimate= typeEstimate.intersectedWith(createInitialEstimate(c)); } set.setTypeEstimate(typeEstimate); } } } }
Source:
RuleMemberValidator build() { return new RuleMemberValidator(fAnnotation, fMethods, fValidatorStrategies); }

Target:
RuleMemberValidator build() { return new RuleMemberValidator(this); }
Source:
private void setBonusType(final String type) throws GameParseException { final String[] s = splitOnColon(type); if (s.length > 2) { throw new GameParseException("bonusType can only have value and count" + thisErrorMsg()); } if (s.length == 1) { bonusType = Tuple.of(1, s[0]); } else { bonusType = Tuple.of(getInt(s[0]), s[1]); } }

Target:
private void setBonusType(final String type) throws GameParseException { final String[] s = splitOnColon(type); if (s.length > 2) { throw new GameParseException( "bonusType can only have value and count: " + type + thisErrorMsg()); } if (s.length == 1) { bonusType = new BonusType(s[0], 1); } else { bonusType = new BonusType(s[1], getInt(s[0])); } }
Source:
protected void registerResourceTransformers(final KnownModelVersion modelVersion, final ResourceTransformationDescriptionBuilder resourceBuilder, final ResourceTransformationDescriptionBuilder loggingProfileBuilder) { switch (modelVersion) { case VERSION_1_1_0: { resourceBuilder .getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, AUTOFLUSH, TARGET) .end() .discardOperations(); break; } case VERSION_2_0_0: { resourceBuilder .getAttributeBuilder() .setValueConverter(new DefaultAttributeConverter() { @Override protected void convertAttribute(final PathAddress address, final String attributeName, final ModelNode attributeValue, final TransformationContext context) { final String currentValue = attributeValue.asString(); final String newValue = CONSOLE_PATTERN.matcher(currentValue).replaceAll(Target.SYSTEM_OUT.toString()); if (attributeValue.getType() == ModelType.EXPRESSION) { attributeValue.set(new ValueExpression(newValue)); } else if (attributeValue.getType() == ModelType.STRING) { attributeValue.set(newValue); } } }, TARGET) .end(); break; } } }

Target:
protected void registerResourceTransformers(final KnownModelVersion modelVersion, final ResourceTransformationDescriptionBuilder resourceBuilder, final ResourceTransformationDescriptionBuilder loggingProfileBuilder) { switch (modelVersion) { case VERSION_1_1_0: { resourceBuilder .getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, AUTOFLUSH, TARGET) .end() .discardOperations(); break; } case VERSION_2_0_0: { resourceBuilder .getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.SIMPLE_EXPRESSIONS, TARGET) .addRejectCheck(new SimpleRejectAttributeChecker(new ModelNode(Target.CONSOLE.toString())), TARGET) .end(); break; } } }
Source:
public boolean isInVisibleLines() { return support.isInVisibleLines(this); }

Target:
protected boolean isInVisibleLines() { return support.isInVisibleLines(this); }
Source:
@Test public void getPicassoKindMini() throws Exception { assertThat(getPicassoKind(512, 384)).isEqualTo(MINI); assertThat(getPicassoKind(100, 100)).isEqualTo(MINI); assertThat(getPicassoKind(1000, 384)).isEqualTo(MINI); }

Target:
@Test public void getPicassoKindMini() throws Exception { assertThat(getPicassoKind(512, 384)).isEqualTo(MINI); assertThat(getPicassoKind(100, 100)).isEqualTo(MINI); }
Source:
public static long parseBytes(String input, ConfigOrigin originForException, String pathForException) { String s = ConfigImplUtil.unicodeTrim(input); String unitString = getUnits(s); String numberString = ConfigImplUtil.unicodeTrim(s.substring(0, s.length() - unitString.length())); if (numberString.length() == 0) throw new ConfigException.BadValue(originForException, pathForException, "No number in size-in-bytes value '" + input + "'"); MemoryUnit units = MemoryUnit.parseUnit(unitString); if (units == null) { throw new ConfigException.BadValue(originForException, pathForException, "Could not parse size-in-bytes unit '" + unitString + "' (try k, K, kB, KiB, kilobytes, kibibytes)"); } try { BigInteger result; if (numberString.matches("[0-9]+")) { Long v = Long.parseLong(numberString); result = units.bytes.multiply(BigInteger.valueOf(v)); } else { Double v = Double.parseDouble(numberString); BigDecimal resultDecimal = (new BigDecimal(units.bytes)).multiply(BigDecimal.valueOf(v)); result = resultDecimal.toBigInteger(); } if (isValidLong(result)) return result.longValue(); else throw new ConfigException.BadValue(originForException, pathForException, "size-in-bytes value is out of range for a 64-bit long: '" + input + "'"); } catch (NumberFormatException e) { throw new ConfigException.BadValue(originForException, pathForException, "Could not parse size-in-bytes number '" + numberString + "'"); } }

Target:
public static long parseBytes(String input, ConfigOrigin originForException, String pathForException) { String s = ConfigImplUtil.unicodeTrim(input); String unitString = getUnits(s); String numberString = ConfigImplUtil.unicodeTrim(s.substring(0, s.length() - unitString.length())); if (numberString.length() == 0) throw new ConfigException.BadValue(originForException, pathForException, "No number in size-in-bytes value '" + input + "'"); MemoryUnit units = MemoryUnit.parseUnit(unitString); if (units == null) { throw new ConfigException.BadValue(originForException, pathForException, "Could not parse size-in-bytes unit '" + unitString + "' (try k, K, kB, KiB, kilobytes, kibibytes)"); } try { BigInteger result; if (numberString.matches("[0-9]+")) { result = units.bytes.multiply(new BigInteger(numberString)); } else { BigDecimal resultDecimal = (new BigDecimal(units.bytes)).multiply(new BigDecimal(numberString)); result = resultDecimal.toBigInteger(); } if (result.bitLength() < 64) return result.longValue(); else throw new ConfigException.BadValue(originForException, pathForException, "size-in-bytes value is out of range for a 64-bit long: '" + input + "'"); } catch (NumberFormatException e) { throw new ConfigException.BadValue(originForException, pathForException, "Could not parse size-in-bytes number '" + numberString + "'"); } }