auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void failover_newTimestampRequested() throws Exception { while (!oserver.isConnected()) Thread.sleep(100); int port2 = PortUtils.getRandomFreePort(); int port3 = PortUtils.getRandomFreePort(); OracleServer oserver2 = createExtraOracle(port2); OracleServer oserver3 = createExtraOracle(port3); oserver2.start(); while (!oserver2.isConnected()) Thread.sleep(100); oserver3.start(); while (!oserver3.isConnected()) Thread.sleep(100); OracleClient client = OracleClient.getInstance(config); long timestamp; for (long i = 2; i <= 7; i++) { timestamp = client.getTimestamp(); assertEquals(i, timestamp); } assertTrue(client.getOracle().endsWith(Integer.toString(config.getOraclePort()))); Thread.sleep(1000); oserver.stop(); Thread.sleep(1000); assertEquals(1002, client.getTimestamp()); assertTrue(client.getOracle().endsWith(Integer.toString(port2))); oserver2.stop(); Thread.sleep(1000); assertEquals(2002, client.getTimestamp()); assertTrue(client.getOracle().endsWith(Integer.toString(port3))); oserver3.stop(); }

Target:
public void failover_newTimestampRequested() throws Exception { while (!oserver.isConnected()) Thread.sleep(100); int port2 = PortUtils.getRandomFreePort(); int port3 = PortUtils.getRandomFreePort(); OracleServer oserver2 = createExtraOracle(port2); OracleServer oserver3 = createExtraOracle(port3); oserver2.start(); while (!oserver2.isConnected()) Thread.sleep(100); oserver3.start(); while (!oserver3.isConnected()) Thread.sleep(100); OracleClient client = OracleClient.getInstance(config); long timestamp; for (long i = 2; i <= 7; i++) { timestamp = client.getTimestamp(); assertEquals(i, timestamp); } assertTrue(client.getOracle().endsWith(Integer.toString(config.getOraclePort()))); oserver.stop(); Thread.sleep(1000); assertEquals(1002, client.getTimestamp()); assertTrue(client.getOracle().endsWith(Integer.toString(port2))); oserver2.stop(); Thread.sleep(1000); assertEquals(2002, client.getTimestamp()); assertTrue(client.getOracle().endsWith(Integer.toString(port3))); oserver3.stop(); }
Source:
private <T extends Identifiable<?>> boolean isComplete(T prototype, UID targetUID, Function<T, URI> configDescriptionURIFunction, Configuration configuration) { if (prototype == null) { logger.debug("Prototype for '{}' is not known, assuming it is initializable", targetUID); return true; } ConfigDescription description = resolve(configDescriptionURIFunction.apply(prototype), null); if (description == null) { logger.debug("Config description for '{}' is not resolvable, assuming '{}' is initializable", prototype.getUID(), targetUID); return true; } List<String> requiredParameters = getRequiredParameters(description); Map<String, Object> properties = configuration.getProperties(); if (logger.isDebugEnabled()) { logger.debug("Configuration of '{}' needs {}, has {}.", targetUID, requiredParameters, configuration.getProperties().keySet()); } return properties.keySet().containsAll(requiredParameters); }

Target:
private <T extends Identifiable<?>> boolean isComplete(T prototype, UID targetUID, Function<T, URI> configDescriptionURIFunction, Configuration configuration) { if (prototype == null) { logger.debug("Prototype for '{}' is not known, assuming it is initializable", targetUID); return true; } ConfigDescription description = resolve(configDescriptionURIFunction.apply(prototype), null); if (description == null) { logger.debug("Config description for '{}' is not resolvable, assuming '{}' is initializable", prototype.getUID(), targetUID); return true; } List<String> requiredParameters = getRequiredParameters(description); Set<String> propertyKeys = configuration.getProperties().keySet(); if (logger.isDebugEnabled()) { logger.debug("Configuration of '{}' needs {}, has {}.", targetUID, requiredParameters, propertyKeys); } return propertyKeys.containsAll(requiredParameters); }
Source:
public void added(Provider<E> provider, E element) { Collection<E> elements = elementMap.get(provider); if (elements != null) { try { K uid = element.getUID(); if (uid != null && get(uid) != null) { logger.warn(String.format( "%s with Key \"%s\" already exists! Failed to add a second with the same UID!", element.getClass().getName(), uid)); return; } onAddElement(element); elements.add(element); notifyListenersAboutAddedElement(element); } catch (Exception ex) { logger.warn("Could not add element: " + ex.getMessage(), ex); } } }

Target:
public void added(Provider<E> provider, E element) { Collection<E> elements = elementMap.get(provider); if (elements != null) { try { K uid = element.getUID(); if (uid != null && get(uid) != null) { logger.warn("{} with key '{}' already exists! Failed to add a second with the same UID!", element.getClass().getName(), uid); return; } onAddElement(element); elements.add(element); notifyListenersAboutAddedElement(element); } catch (Exception ex) { logger.warn("Could not add element: {}", ex.getMessage(), ex); } } }
Source:
private List<String> buildFileNameList(String... fileNames) { List<String> fileNameList = new ArrayList<String>(); for (String fileName : fileNames) { fileNameList.add(fileName); } return fileNameList; }

Target:
private List<String> buildFileNameList(String... fileNames) { List<String> fileNameList = Arrays.asList(fileNames); return fileNameList; }
Source:
public List<ElementRecord> getModelChildren() { List<ElementRecord> filtered = new ArrayList<ElementRecord>(); for (ElementRecord el : getElementRecord().getVisibleChildElements()) { String tag = el.getName(); if (tag.equals(SVGConstants.SVG_RECT_TAG) || tag.equals(SVGConstants.SVG_POLYLINE_TAG) || tag.equals(SVGConstants.SVG_ELLIPSE_TAG) || tag.equals(SVGConstants.SVG_TEXT_TAG) || tag.equals(SVGConstants.SVG_SVG_TAG)) { filtered.add(el); } } return filtered; }

Target:
public List<ElementRecord> getModelChildren() { List<ElementRecord> filtered = new ArrayList<ElementRecord>(); for (ElementRecord r : getElementRecord().getVisibleChildElements()) { String tag = r.getName(); if (tag.equals(SVGConstants.SVG_RECT_TAG) || tag.equals(SVGConstants.SVG_POLYLINE_TAG) || tag.equals(SVGConstants.SVG_ELLIPSE_TAG) || tag.equals(SVGConstants.SVG_TEXT_TAG) || tag.equals(SVGConstants.SVG_SVG_TAG)) { filtered.add(r); } } return filtered; }
Source:
private ProjectState newProjectState() { final Map<Project.NameKey, ProjectState> all = new HashMap<Project.NameKey, ProjectState>(); final ProjectCache projectCache = new ProjectCache() { @Override public ProjectState get(Project.NameKey projectName) { return all.get(projectName); } @Override public void evict(Project p) { } @Override public Iterable<Project.NameKey> all() { return null; } @Override public Iterable<Project.NameKey> byName(String prefix) { return Collections.emptySet(); } @Override public void onCreateProject(Project.NameKey newProjectName) { } }; GitRepositoryManager mgr = null; ProjectControl.AssistedFactory projectControlFactory = null; all.put(local.getProject().getNameKey(), new ProjectState(anonymousUser, projectCache, wildProject, projectControlFactory, mgr, local)); all.put(parent.getProject().getNameKey(), new ProjectState(anonymousUser, projectCache, wildProject, projectControlFactory, mgr, parent)); all.put(wild.getProject().getNameKey(), new ProjectState(anonymousUser, projectCache, wildProject, projectControlFactory, mgr, wild)); return all.get(local.getProject().getNameKey()); }

Target:
private ProjectState newProjectState() { final Map<Project.NameKey, ProjectState> all = new HashMap<Project.NameKey, ProjectState>(); final ProjectCache projectCache = new ProjectCache() { @Override public ProjectState get(Project.NameKey projectName) { return all.get(projectName); } @Override public void evict(Project p) { } @Override public Iterable<Project.NameKey> all() { return Collections.emptySet(); } @Override public Iterable<Project.NameKey> byName(String prefix) { return Collections.emptySet(); } @Override public void onCreateProject(Project.NameKey newProjectName) { } }; GitRepositoryManager mgr = null; ProjectControl.AssistedFactory projectControlFactory = null; all.put(local.getProject().getNameKey(), new ProjectState(anonymousUser, projectCache, wildProject, projectControlFactory, mgr, local)); all.put(parent.getProject().getNameKey(), new ProjectState(anonymousUser, projectCache, wildProject, projectControlFactory, mgr, parent)); all.put(wild.getProject().getNameKey(), new ProjectState(anonymousUser, projectCache, wildProject, projectControlFactory, mgr, wild)); return all.get(local.getProject().getNameKey()); }
Source:
void initialize() { fgKeys= new HashMap<String, Integer>(); Integer k= new Integer(KEY); for (String word : fgKeywords) fgKeys.put(word, k); }

Target:
void initialize() { fgKeys= new HashMap<>(); Integer k= new Integer(KEY); for (String word : fgKeywords) fgKeys.put(word, k); }
Source:
private GoPluginApiResponse handleGetPluginSettingsConfiguration() { Map<String, Object> response = new HashMap<String, Object>(); response.put(PLUGIN_SETTINGS_SERVER_BASE_URL, createField("Server Base URL", null, true, false, "0")); response.put(PLUGIN_SETTINGS_END_POINT, createField("End Point", null, true, false, "1")); response.put(PLUGIN_SETTINGS_USERNAME, createField("Username", null, true, false, "2")); response.put(PLUGIN_SETTINGS_PASSWORD, createField("Password", null, true, true, "3")); response.put(PLUGIN_SETTINGS_OAUTH_TOKEN, createField("OAuth Token", null, true, true, "4")); if (provider.pluginId().equals(GerritProvider.PLUGIN_ID)) { response.put(PLUGIN_SETTINGS_REVIEW_LABEL, createField("Gerrit Review Label", "Verified", true, false, "5")); } return renderJSON(SUCCESS_RESPONSE_CODE, response); }

Target:
private GoPluginApiResponse handleGetPluginSettingsConfiguration() { return renderJSON(SUCCESS_RESPONSE_CODE, provider.configurationView().fields()); }
Source:
private String replaceHonoringProtectedGroups(final String input) { Matcher matcher = PATTERN_ENCLOSED_IN_CURLY_BRACES.matcher(input); List<String> replaced = new ArrayList<>(); while (matcher.find()) { replaced.add(matcher.group(1)); } String workingString = matcher.replaceAll(PLACEHOLDER_FOR_PROTECTED_GROUP); try { workingString = workingString.replaceAll(regex, replacement); } catch (PatternSyntaxException e) { LOGGER.warn("There is a syntax error in the regular expression, " + regex + ", used by the regex modifier", e); return input; } for (String r : replaced) { workingString = workingString.replaceFirst(PLACEHOLDER_FOR_PROTECTED_GROUP, r); } return workingString; }

Target:
private String replaceHonoringProtectedGroups(final String input) { Matcher matcher = ENCLOSED_IN_CURLY_BRACES.matcher(input); List<String> replaced = new ArrayList<>(); while (matcher.find()) { replaced.add(matcher.group()); } String workingString = matcher.replaceAll(PLACEHOLDER_FOR_PROTECTED_GROUP); try { workingString = workingString.replaceAll(regex, replacement); } catch (PatternSyntaxException e) { LOGGER.warn("There is a syntax error in the regular expression \"{}\" used by the regex modifier", regex, e); return input; } for (String r : replaced) { workingString = workingString.replaceFirst(PLACEHOLDER_FOR_PROTECTED_GROUP, r); } return workingString; }
Source:
public static ValidationResult setAndValidateCpuProfileForUser(VmBase vmBase, Version version, Guid userId) { if (!FeatureSupported.cpuQoS(version)) { return ValidationResult.VALID; } if (vmBase.getCpuProfileId() == null) { Optional<CpuProfile> cpuProfileWithPermissions = getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId()).stream() .findAny(); if (!cpuProfileWithPermissions.isPresent()) { return new ValidationResult(EngineMessage.ACTION_TYPE_NO_PERMISSION_TO_ASSIGN_CPU_PROFILE, "$cpuProfileId <CPU Profile empty>", "$cpuProfileName <CPU Profile empty>"); } else { vmBase.setCpuProfileId(cpuProfileWithPermissions.get().getId()); return ValidationResult.VALID; } } else { Optional<CpuProfile> choseCpuProfile = getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId(), userId, true).stream() .filter( cp -> cp.getId().equals(vmBase.getCpuProfileId()) ).findAny(); if (choseCpuProfile.isPresent()) { vmBase.setCpuProfileId(choseCpuProfile.get().getId()); return ValidationResult.VALID; } } Optional<CpuProfile> choseCpuProfile = getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId()).stream() .filter( cp -> cp.getId().equals(vmBase.getCpuProfileId()) ).findAny(); Guid chosenCpuProfileId = vmBase.getCpuProfileId(); String chosenCpuProfileName = "<N/A>"; if (choseCpuProfile.isPresent()) { chosenCpuProfileName = choseCpuProfile.get().getName(); } return new ValidationResult(EngineMessage.ACTION_TYPE_NO_PERMISSION_TO_ASSIGN_CPU_PROFILE, String.format("$cpuProfileId %s", chosenCpuProfileId), String.format("$cpuProfileName %s", chosenCpuProfileName)); }

Target:
public static ValidationResult setAndValidateCpuProfileForUser(VmBase vmBase, Version version, Guid userId) { if (!FeatureSupported.cpuQoS(version)) { return ValidationResult.VALID; } if (vmBase.getCpuProfileId() == null) { return assignAnyCpuProfile(vmBase); } Optional<CpuProfile> chosenCpuProfileWithPermissions = getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId(), userId, true).stream() .filter( cp -> cp.getId().equals(vmBase.getCpuProfileId()) ).findFirst(); if (chosenCpuProfileWithPermissions.isPresent()) { vmBase.setCpuProfileId(chosenCpuProfileWithPermissions.get().getId()); return ValidationResult.VALID; } CpuProfile chosenCpuProfile = getCpuProfileDao().get(vmBase.getCpuProfileId()); if(chosenCpuProfile == null) { return new ValidationResult(EngineMessage.ACTION_TYPE_NO_CPU_PROFILE_WITH_THAT_ID, String.format("$cpuProfileId %s", vmBase.getCpuProfileId())); } return new ValidationResult(EngineMessage.ACTION_TYPE_NO_PERMISSION_TO_ASSIGN_CPU_PROFILE, String.format("$cpuProfileId %s", vmBase.getCpuProfileId()), String.format("$cpuProfileName %s", chosenCpuProfile.getName())); }
Source:
private List<MacraMeasureEntity> getAllMeasuresWhereValueIsNotNull() { Query query = entityManager .createQuery("FROM MacraMeasureEntity mme " + "WHERE mme.value IS NOT NULL", MacraMeasureEntity.class); return query.getResultList(); }

Target:
private List<MacraMeasureEntity> getAllMeasuresWhereValueIsNotNull() { Query query = entityManager .createQuery("FROM MacraMeasureEntity mme " + "WHERE mme.value IS NOT NULL " + "AND mme.deleted = FALSE", MacraMeasureEntity.class); return query.getResultList(); }
Source:
public MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure) throws InvalidEndpointException, InvalidPortException { if (endpoint == null) { throw new InvalidEndpointException(NULL, "null endpoint"); } HttpUrl url = HttpUrl.parse(endpoint); if (url != null) { if (!"/".equals(url.encodedPath())) { throw new InvalidEndpointException(endpoint, "no path allowed in endpoint"); } String amzHost = url.host(); if (amzHost.endsWith(".amazonaws.com") && !amzHost.equals(S3_AMAZONAWS_COM)) { throw new InvalidEndpointException(endpoint, "for Amazon S3, host should be 's3.amazonaws.com' in endpoint"); } this.baseUrl = url; this.accessKey = accessKey; this.secretKey = secretKey; return; } if (!this.isValidEndpoint(endpoint)) { throw new InvalidEndpointException(endpoint, "invalid host"); } if (endpoint.endsWith(".amazonaws.com") && !endpoint.equals(S3_AMAZONAWS_COM)) { throw new InvalidEndpointException(endpoint, "for amazon S3, host should be 's3.amazonaws.com'"); } if (port < 0 || port > 65535) { throw new InvalidPortException(port, "port must be in range of 1 to 65535"); } Scheme scheme = Scheme.HTTP; if (secure) { scheme = Scheme.HTTPS; } if (port == 0) { this.baseUrl = new HttpUrl.Builder() .scheme(scheme.toString()) .host(endpoint) .build(); } else { this.baseUrl = new HttpUrl.Builder() .scheme(scheme.toString()) .host(endpoint) .port(port) .build(); } this.accessKey = accessKey; this.secretKey = secretKey; }

Target:
public MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure) throws InvalidEndpointException, InvalidPortException { if (endpoint == null) { throw new InvalidEndpointException(NULL_STRING, "null endpoint"); } if (port < 0 || port > 65535) { throw new InvalidPortException(port, "port must be in range of 1 to 65535"); } HttpUrl url = HttpUrl.parse(endpoint); if (url != null) { if (!"/".equals(url.encodedPath())) { throw new InvalidEndpointException(endpoint, "no path allowed in endpoint"); } String amzHost = url.host(); if (amzHost.endsWith(AMAZONAWS_COM) && !amzHost.equals(S3_AMAZONAWS_COM)) { throw new InvalidEndpointException(endpoint, "for Amazon S3, host should be 's3.amazonaws.com' in endpoint"); } HttpUrl.Builder urlBuilder = url.newBuilder(); Scheme scheme = Scheme.HTTP; if (secure) { scheme = Scheme.HTTPS; } urlBuilder.scheme(scheme.toString()); if (port > 0) { urlBuilder.port(port); } this.baseUrl = urlBuilder.build(); this.accessKey = accessKey; this.secretKey = secretKey; return; } if (!this.isValidEndpoint(endpoint)) { throw new InvalidEndpointException(endpoint, "invalid host"); } if (endpoint.endsWith(AMAZONAWS_COM) && !endpoint.equals(S3_AMAZONAWS_COM)) { throw new InvalidEndpointException(endpoint, "for amazon S3, host should be 's3.amazonaws.com'"); } Scheme scheme = Scheme.HTTP; if (secure) { scheme = Scheme.HTTPS; } if (port == 0) { this.baseUrl = new HttpUrl.Builder() .scheme(scheme.toString()) .host(endpoint) .build(); } else { this.baseUrl = new HttpUrl.Builder() .scheme(scheme.toString()) .host(endpoint) .port(port) .build(); } this.accessKey = accessKey; this.secretKey = secretKey; }
Source:
public Object execute() throws Exception { AccessController.doPrivileged( (PrivilegedExceptionAction<Void>) () -> { if (increaseLogLevel) { logService.setLevel("org.codice.ddf.sync.installer.impl", "TRACE"); } syncInstaller.waitForBootFinish(); return null; }); return null; }

Target:
public Object execute() throws Exception { try { AccessController.doPrivileged( (PrivilegedExceptionAction<Void>) () -> { if (increaseLogLevel) { logService.setLevel("org.codice.ddf.sync.installer.impl", "TRACE"); } syncInstaller.waitForBootFinish(); return null; }); } catch (PrivilegedActionException e) { throw e.getException(); } return null; }
Source:
public MeterFrame(UUID uuid) { super(Bundle.getMessage("TrackVoltageMeterTitle")); this.uuid = uuid; MeterManager mm = InstanceManager.getNullableDefault(MeterManager.class); if (mm == null) throw new RuntimeException("No meter manager exists"); for (Meter m : mm.getNamedBeanSet()) { if ((m != null) && (m instanceof VoltageMeter)) voltageMeters.add(m); if ((m != null) && (m instanceof CurrentMeter)) currentMeters.add(m); } if (!voltageMeters.isEmpty()) { setMeter(voltageMeters.get(0)); } else if (!currentMeters.isEmpty()) { setMeter(currentMeters.get(0)); } else { setTitle(Bundle.getMessage("TrackVoltageMeterTitle")); } MeterFrameManager.getInstance().register(this); }

Target:
public MeterFrame(UUID uuid) { super(Bundle.getMessage("VoltageMeterTitle")); this.uuid = uuid; MeterManager mm = InstanceManager.getNullableDefault(MeterManager.class); if (mm == null) throw new RuntimeException("No meter manager exists"); for (Meter m : mm.getNamedBeanSet()) { if ((m != null) && (m instanceof VoltageMeter)) voltageMeters.add(m); if ((m != null) && (m instanceof CurrentMeter)) currentMeters.add(m); } if (!voltageMeters.isEmpty()) { setMeter(voltageMeters.get(0)); } else if (!currentMeters.isEmpty()) { setMeter(currentMeters.get(0)); } else { setTitle(Bundle.getMessage("VoltageMeterTitle")); } MeterFrameManager.getInstance().register(this); }
Source:
public static void setOtherSchemes(List<String> otherSchemes) { OAS2Parser.otherSchemes = otherSchemes; }

Target:
private void setOtherSchemes(List<String> otherSchemes) { this.otherSchemes = otherSchemes; }
Source:
public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = super.execute(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> candidate = getCandidate(); if (candidate.getContent() instanceof View) { final DMNModelInstrumentedBase dmnModel = (DMNModelInstrumentedBase) ((View) candidate.getContent()).getDefinition(); if (dmnModel instanceof BusinessKnowledgeModel) { final FunctionDefinition function = ((BusinessKnowledgeModel) dmnModel).getEncapsulatedLogic(); KindUtilities.setKind(function, FunctionDefinition.Kind.FEEL); final LiteralExpression le = new LiteralExpression(); function.setExpression(le); le.setParent(function); } } } return results; }

Target:
public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = super.execute(context); if (!CommandUtils.isError(results)) { final Node<?, Edge> candidate = getCandidate(); if (candidate.getContent() instanceof View) { final DMNModelInstrumentedBase dmnModel = (DMNModelInstrumentedBase) ((View) candidate.getContent()).getDefinition(); if (dmnModel instanceof BusinessKnowledgeModel) { final FunctionDefinition function = ((BusinessKnowledgeModel) dmnModel).getEncapsulatedLogic(); KindUtilities.setKind(function, FunctionDefinition.Kind.FEEL); final LiteralExpression le = new LiteralExpression(); function.setExpression(le); le.setParent(function); } } } return results; }
Source:
public void create() { super.create(); Job job = new Job(UIText.CreateTagDialog_GetTagJobName) { @Override protected IStatus run(IProgressMonitor monitor) { final RevTag[] tags = getRevTags(); Display.getDefault().syncExec(new Runnable() { public void run() { if (!tagViewer.getTable().isDisposed()) { tagViewer.setInput(tags); tagViewer.getTable().setEnabled(true); } } }); return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); }

Target:
public void create() { super.create(); Job job = new Job(UIText.CreateTagDialog_GetTagJobName) { @Override protected IStatus run(IProgressMonitor monitor) { final List<RevTag> tags = getRevTags(); getShell().getDisplay().asyncExec(new Runnable() { public void run() { if (!tagViewer.getTable().isDisposed()) { tagViewer.setInput(tags); tagViewer.getTable().setEnabled(true); } } }); return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); }
Source:
public void accept(final MetricsQuery query) { if (RANDOM.nextDouble() > _checkFraction) { return; } if (!query.getStartTime().isPresent()) { LOGGER.trace() .setMessage("not consistency-checking because no start time present") .addData("query", query) .log(); return; } if (!query.getEndTime().isPresent()) { LOGGER.trace() .setMessage("not consistency-checking because no end time present") .addData("query", query) .log(); return; } LOGGER.trace() .setMessage("maybe sending for consistency check?") .addData("query", query) .log(); final Instant startTime = query.getStartTime().get(); final Instant endTime = query.getEndTime().get(); query.getMetrics().stream() .map(Metric::getName) .map(RollupMetric::fromRollupMetricName) .forEach(rollupMetricMaybe -> rollupMetricMaybe.ifPresent(rollupMetric -> { checkerTasks(startTime, endTime, rollupMetric) .forEach(task -> { LOGGER.trace() .setMessage("sending for consistency check") .addData("task", task) .addData("query", query) .log(); try { Patterns.ask(_consistencyChecker, task, Duration.ofSeconds(1)).toCompletableFuture().get(); } catch (final InterruptedException | ExecutionException e) { if (!(e.getCause() instanceof ConsistencyChecker.BufferFull)) { LOGGER.error() .setMessage("unexpected exception sending task to consistency checker") .setThrowable(e) .addData("task", task) .addData("query", query) .log(); } } }); }) ); }

Target:
public void accept(final MetricsQuery query) { _periodicMetrics.recordCounter(QUERY_RECEIVED, 1); if (RANDOM.nextDouble() > _checkFraction) { _periodicMetrics.recordCounter(DROPPED_QUERY_NOT_SAMPLED, 1); return; } if (!query.getStartTime().isPresent()) { _periodicMetrics.recordCounter(DROPPED_QUERY_NO_TIME_BOUNDARY, 1); LOGGER.trace() .setMessage("not consistency-checking because no start time present") .addData("query", query) .log(); return; } _periodicMetrics.recordCounter(QUERY_SELECTED_FOR_CHECK, 1); LOGGER.trace() .setMessage("maybe sending for consistency check?") .addData("query", query) .log(); final Instant startTime = query.getStartTime().get(); final Instant endTime = query.getEndTime().orElse(Instant.now()); query.getMetrics().stream() .map(Metric::getName) .map(RollupMetric::fromRollupMetricName) .forEach(rollupMetricMaybe -> { rollupMetricMaybe.ifPresent(rollupMetric -> { checkerTasks(startTime, endTime, rollupMetric) .forEach(task -> { LOGGER.trace() .setMessage("sending for consistency check") .addData("task", task) .addData("query", query) .log(); try { Patterns.ask(_consistencyChecker, task, Duration.ofSeconds(1)).toCompletableFuture().get(); _periodicMetrics.recordCounter(TASK_SENT_FOR_CHECK, 1); } catch (final InterruptedException | ExecutionException e) { _periodicMetrics.recordCounter(DROPPED_TASK_ENQUEUE_FAILED, 1); if (!(e.getCause() instanceof ConsistencyChecker.BufferFull)) { LOGGER.error() .setMessage("unexpected exception sending task to consistency checker") .setThrowable(e) .addData("task", task) .addData("query", query) .log(); } } }); }); if (!rollupMetricMaybe.isPresent()) { _periodicMetrics.recordCounter(DROPPED_METRIC_NOT_ROLLUP, 1); } } ); }
Source:
public void putAll(List<Entry<K, V>> entries) { List<Entry<K, V>> toPut = new LinkedList<>(); List<K> toDelete = new LinkedList<>(); entries.forEach(e -> { if (e.getValue() != null) { toPut.add(e); } else { toDelete.add(e.getKey()); } }); instrument(writeMetrics.numPutAlls, writeMetrics.putAllNs, () -> kvStore.putAll(toPut)); if (!toDelete.isEmpty()) { deleteAll(toDelete); } }

Target:
public void putAll(List<Entry<K, V>> entries) { List<Entry<K, V>> toPut = new LinkedList<>(); List<K> toDelete = new LinkedList<>(); entries.forEach(e -> { if (e.getValue() != null) { toPut.add(e); } else { toDelete.add(e.getKey()); } }); if (!toPut.isEmpty()) { instrument(writeMetrics.numPutAlls, writeMetrics.putAllNs, () -> kvStore.putAll(toPut)); } if (!toDelete.isEmpty()) { deleteAll(toDelete); } }
Source:
public static int getIndexForValue(int bucketCount, double min, double max, double value) { checkArgument( value >= min && value <= max, "value must be within range [%s, %s]", min, max); return Math.min( (int) (bucketCount * (value - min) / (max - min)), bucketCount - 1); }

Target:
public static int getIndexForValue(int bucketCount, double min, double max, double value) { checkArgument( value >= min && value < max, "value must be within range [%s, %s]", min, max); return Math.min( (int) (bucketCount * (value - min) / (max - min)), bucketCount - 1); }
Source:
public int hashCode() { return (int) (time / 1000L) + event.getValue(); }

Target:
public int hashCode() { return Objects.hashCode(time, event.getValue()); }
Source:
public WinRmToolResponse executeCommand(String command) { WinRmClient.Builder builder = WinRmClient.builder(address, authenticationScheme); if (username != null && password != null) { builder.credentials(username, password); } if (disableCertificatesChecks) { LOG.info("Disabled check for https connections " + this); builder.setDisableCertificatesChecks(disableCertificatesChecks); } WinRmClient client = builder.build(); StringWriter out = new StringWriter(); StringWriter err = new StringWriter(); try { int code = client.command(command, out, err); return new WinRmToolResponse(out.toString(), err.toString(), code); } finally { client.disconnect(); } }

Target:
public WinRmToolResponse executeCommand(String command) { WinRmClient.Builder builder = WinRmClient.builder(address, authenticationScheme); if (username != null && password != null) { builder.credentials(username, password); } if (disableCertificateChecks) { LOG.info("Disabled check for https connections " + this); builder.disableCertificateChecks(disableCertificateChecks); } WinRmClient client = builder.build(); StringWriter out = new StringWriter(); StringWriter err = new StringWriter(); try { int code = client.command(command, out, err); return new WinRmToolResponse(out.toString(), err.toString(), code); } finally { client.disconnect(); } }
Source:
public AzureStorageCompactor(AzureBlobDataAccessor azureBlobDataAccessor, CosmosDataAccessor cosmosDataAccessor, CloudConfig cloudConfig, VcrMetrics vcrMetrics, AzureMetrics azureMetrics) { this.azureBlobDataAccessor = azureBlobDataAccessor; this.cosmosDataAccessor = cosmosDataAccessor; this.vcrMetrics = vcrMetrics; this.azureMetrics = azureMetrics; this.retentionPeriodMs = TimeUnit.DAYS.toMillis(cloudConfig.cloudDeletedBlobRetentionDays); this.queryLimit = cloudConfig.cloudBlobCompactionQueryLimit; this.purgeLimit = cloudConfig.cloudCompactionPurgeLimit; this.queryBucketDays = cloudConfig.cloudCompactionQueryBucketDays; this.lookbackDays = cloudConfig.cloudCompactionLookbackDays; requestAgent = new CloudRequestAgent(cloudConfig, vcrMetrics); emptyCheckpoints = new HashMap<>(); emptyCheckpoints.put(CloudBlobMetadata.FIELD_DELETION_TIME, DEFAULT_TIME); emptyCheckpoints.put(CloudBlobMetadata.FIELD_EXPIRATION_TIME, DEFAULT_TIME); }

Target:
public AzureStorageCompactor(AzureBlobDataAccessor azureBlobDataAccessor, CosmosDataAccessor cosmosDataAccessor, CloudConfig cloudConfig, VcrMetrics vcrMetrics, AzureMetrics azureMetrics) { this.azureBlobDataAccessor = azureBlobDataAccessor; this.cosmosDataAccessor = cosmosDataAccessor; this.vcrMetrics = vcrMetrics; this.azureMetrics = azureMetrics; this.retentionPeriodMs = TimeUnit.DAYS.toMillis(cloudConfig.cloudDeletedBlobRetentionDays); this.queryLimit = cloudConfig.cloudBlobCompactionQueryLimit; this.purgeLimit = cloudConfig.cloudCompactionPurgeLimit; this.queryBucketDays = cloudConfig.cloudCompactionQueryBucketDays; this.lookbackDays = cloudConfig.cloudCompactionLookbackDays; requestAgent = new CloudRequestAgent(cloudConfig, vcrMetrics); }
Source:
public void asUpdateUser() { NameCommand command = new NameCommand(); String familyname = "Silamina"; String formatted = "tarentius Silamina"; String givenname = "tarentius"; String honorificprefix = "Prof."; String honorificsuffix = "Prof. Dr."; String middlename = "osiamone"; command.setFamilyname(familyname); command.setFormatted(formatted); command.setGivenname(givenname); command.setHonorificprefix(honorificprefix); command.setHonorificsuffix(honorificsuffix); command.setMiddlename(middlename); assertEquals(familyname, command.getFamilyname()); assertEquals(formatted, command.getFormatted()); assertEquals(givenname, command.getGivenname()); assertEquals(honorificprefix, command.getHonorificprefix()); assertEquals(honorificsuffix, command.getHonorificsuffix()); assertEquals(middlename, command.getMiddlename()); }

Target:
public void asUpdateUser() { NameCommand command = new NameCommand(); String familyName = "Silamina"; String formatted = "tarentius Silamina"; String givenname = "tarentius"; String honorificprefix = "Prof."; String honorificsuffix = "Prof. Dr."; String middlename = "osiamone"; command.setFamilyname(familyName); command.setFormatted(formatted); command.setGivenname(givenname); command.setHonorificprefix(honorificprefix); command.setHonorificsuffix(honorificsuffix); command.setMiddlename(middlename); assertEquals(familyName, command.getFamilyname()); assertEquals(formatted, command.getFormatted()); assertEquals(givenname, command.getGivenname()); assertEquals(honorificprefix, command.getHonorificprefix()); assertEquals(honorificsuffix, command.getHonorificsuffix()); assertEquals(middlename, command.getMiddlename()); }
Source:
private static HiveSortOrder decodeSortingColumn(String name) { checkState(name != null && name.length() > 0 && (name.charAt(0) == '+' || name.charAt(0) == '-'), "Sort columns must be prefixed with +/- to specify ASC/DESC"); return new HiveSortOrder( name.substring(1).toLowerCase(ENGLISH), name.charAt(0) == '+' ? ASCENDING : DESCENDING); }

Target:
private static HiveSortOrder decodeSortingColumn(String name) { checkState(!Strings.isNullOrEmpty(name) && (name.charAt(0) == '+' || name.charAt(0) == '-'), "Sort columns must be prefixed with +/- to specify ASC/DESC"); return new HiveSortOrder( name.substring(1).toLowerCase(ENGLISH), name.charAt(0) == '+' ? ASCENDING : DESCENDING); }
Source:
public void releaseMacsOnCommit(List<String> macs) { log.debug("Non-tx, non-compensation state, immediately releasing macs {}.", Arrays.toString(macs.toArray())); macs.forEach(macPool::freeMac); }

Target:
public void releaseMacsOnCommit(List<String> macs) { log.debug("Non-tx, non-compensation state, immediately releasing macs {}.", macs); macs.forEach(macPool::freeMac); }
Source:
void translate(final LogicalAggregate aggregate, final TranslatorContext context) { MessageStream<SamzaSqlRelMessage> inputStream = context.getMessageStream(aggregate.getInput().getId()); Supplier<Long> initialValue = () -> (long) 0; FoldLeftFunction<SamzaSqlRelMessage, Long> foldLeftFn = (m, c) -> c + 1; MessageStream<SamzaSqlRelMessage> outputStream = inputStream .window(Windows.keyedTumblingWindow(m -> m, Duration.ofMillis(context.getExecutionContext().getSamzaSqlApplicationConfig().getWindowDurationMs()), initialValue, foldLeftFn, new SamzaSqlRelMessageSerdeFactory.SamzaSqlRelMessageSerde(), new LongSerde()) .setAccumulationMode(AccumulationMode.DISCARDING), "tumblingWindow_" + windowId) .map(windowPane -> { List<String> fieldNames = windowPane.getKey().getKey().getSamzaSqlRelRecord().getFieldNames(); List<Object> fieldValues = windowPane.getKey().getKey().getSamzaSqlRelRecord().getFieldValues(); fieldNames.add(aggregate.getAggCallList().get(0).getName()); fieldValues.add(windowPane.getMessage()); return new SamzaSqlRelMessage(fieldNames, fieldValues); }); context.registerMessageStream(aggregate.getId(), outputStream); }

Target:
void translate(final LogicalAggregate aggregate, final TranslatorContext context) { validateAggregateFunctions(aggregate); MessageStream<SamzaSqlRelMessage> inputStream = context.getMessageStream(aggregate.getInput().getId()); Supplier<Long> initialValue = () -> (long) 0; FoldLeftFunction<SamzaSqlRelMessage, Long> foldCountFn = (m, c) -> c + 1; MessageStream<SamzaSqlRelMessage> outputStream = inputStream .window(Windows.keyedTumblingWindow(m -> m, Duration.ofMillis(context.getExecutionContext().getSamzaSqlApplicationConfig().getWindowDurationMs()), initialValue, foldCountFn, new SamzaSqlRelMessageSerdeFactory.SamzaSqlRelMessageSerde(), new LongSerde()) .setAccumulationMode(AccumulationMode.DISCARDING), "tumblingWindow_" + windowId) .map(windowPane -> { List<String> fieldNames = windowPane.getKey().getKey().getSamzaSqlRelRecord().getFieldNames(); List<Object> fieldValues = windowPane.getKey().getKey().getSamzaSqlRelRecord().getFieldValues(); fieldNames.add(aggregate.getAggCallList().get(0).getName()); fieldValues.add(windowPane.getMessage()); return new SamzaSqlRelMessage(fieldNames, fieldValues); }); context.registerMessageStream(aggregate.getId(), outputStream); }
Source:
public DefaultResult call() throws Exception { final Ds3ClientHelpers.ObjectChannelBuilder getter; if (this.pipe) { getter = new PipedFileObjectGetter(this.outputPath, FileUtils.normalizedObjectNames(this.pipedFileNames)); } else if (this.discard) { getter = new MemoryObjectChannelBuilder(); } else { getter = new FileObjectGetter(this.outputPath); } LOG.info(getLogDescription()); return new DefaultResult(this.restore(getter)); }

Target:
public DefaultResult call() throws Exception { final Ds3ClientHelpers.ObjectChannelBuilder getter; if (this.pipe) { getter = new PipedFileObjectGetter(this.outputPath, FileUtils.normalizedObjectNames(this.pipedFileNames)); } else if (this.discard) { getter = new MemoryObjectChannelBuilder(); } else { getter = new FileObjectGetter(this.outputPath); } LOG.info(buildLogDescription()); return new DefaultResult(this.restore(getter)); }
Source:
public Response replaceWithBaselineTxVersion(String userId, long branchId, int txId, int artId, String comment) { boolean introduced = false; ArtifactReadable userReadable = newQueryFactory().fromBranch(CoreBranches.COMMON).andGuid(userId).getResults().getOneOrNull(); ArtifactReadable baselineArtifact = newQueryFactory().fromBranch(branchId).fromTransaction(txId).andLocalId(artId).getResults().getOneOrNull(); if (userReadable != null && baselineArtifact != null) { TransactionBuilder tx = newTxFactory().createTransaction(branchId, userReadable, comment); ArtifactReadable destination = newQueryFactory().fromBranch(branchId).includeDeletedArtifacts().andLocalId(artId).getResults().getOneOrNull(); tx.replaceWithVersion(baselineArtifact, destination); tx.commit(); introduced = true; } return asResponse(introduced); }

Target:
public Response replaceWithBaselineTxVersion(String userId, long branchId, int txId, int artId, String comment) { boolean introduced = false; ArtifactReadable userReadable = newQueryFactory().fromBranch(CoreBranches.COMMON).andGuid(userId).getResults().getOneOrNull(); ArtifactReadable baselineArtifact = newQueryFactory().fromBranch(branchId).fromTransaction(txId).andLocalId(artId).getResults().getOneOrNull(); if (userReadable != null && baselineArtifact != null) { TransactionBuilder tx = newTxFactory().createTransaction(branchId, userReadable, comment); ArtifactReadable destination = newQueryFactory().fromBranch(branchId).includeDeletedArtifacts().andLocalId(artId).getResults().getOneOrNull(); tx.replaceWithVersion(baselineArtifact, destination); tx.commit(); introduced = true; } else { throw new OseeWebApplicationException(Status.BAD_REQUEST, "%s Error - The user and baseline artifact were not found.", comment); } return asResponse(introduced); }
Source:
public void test() throws Exception { sink.input().send(MessageBuilder.withPayload("foo".getBytes()).build()); File file = new File("/tmp/dataflow-tests/file-sink"); file.deleteOnExit(); assertTrue("file does not exist", file.exists()); byte[] results = FileCopyUtils.copyToByteArray(file); assertEquals(3, results.length); assertEquals((byte)'f', results[0]); assertEquals((byte)'o', results[1]); assertEquals((byte)'o', results[2]); }

Target:
public void test() throws Exception { sink.input().send(MessageBuilder.withPayload("foo".getBytes()).build()); File file = new File(ROOT_DIR, "file-sink"); file.deleteOnExit(); assertTrue("file does not exist", file.exists()); byte[] results = FileCopyUtils.copyToByteArray(file); assertEquals(3, results.length); assertArrayEquals("foo".getBytes(), results); }
Source:
public void testMultiBranchWithClassic() throws Exception { String credential = auth.getId(); String format = "jenkins-${NODE_NAME}-${JOB_NAME}"; String includes = " SCMSource source = new BranchesScmSource("classic", credential, includes, null, format, null); WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "multi-classic"); multi.getSourcesList().add(new BranchSource(source)); multi.scheduleBuild2(0); jenkins.waitUntilNoActivity(); assertThat("We now have branches", multi.getItems(), not(is((Collection<WorkflowJob>) Collections.<WorkflowJob>emptyList()))); WorkflowJob job = multi.getItem("Ace-main"); assertThat("We now have a branch", job, notNullValue()); WorkflowRun build = job.getLastBuild(); assertThat("The branch was built", build, notNullValue()); assertThat("The branch was built", build.getNumber(), is(1)); }

Target:
public void testMultiBranchWithClassic() throws Exception { String credential = auth.getId(); String format = "jenkins-${NODE_NAME}-${JOB_NAME}"; String includes = " SCMSource source = new BranchesScmSource("classic", credential, includes, null, format, null); WorkflowMultiBranchProject multi = jenkins.jenkins.createProject(WorkflowMultiBranchProject.class, "multi-classic"); multi.getSourcesList().add(new BranchSource(source)); multi.scheduleBuild2(0); jenkins.waitUntilNoActivity(); assertThat("We now have branches", multi.getItems(), not(containsInAnyOrder())); WorkflowJob job = multi.getItem("Ace-main"); assertThat("We now have a branch", job, notNullValue()); WorkflowRun build = job.getLastBuild(); assertThat("The branch was built", build, notNullValue()); assertThat("The branch was built", build.getNumber(), is(1)); }
Source:
public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); setupLogger(argMap); List<String> others = (List<String>) argMap.get("__other__"); Map<String, ModuleService> moduleServices = loadModules(ModuleService.class); if (argMap.containsKey(ARG_HELP)) { List<String> modules = new ArrayList<>(moduleServices.keySet()); Collections.sort(modules); throw new ArgumentException("Modules: " + StringUtils.join(modules, ", ")); } if (others.isEmpty()) { throw new IllegalArgumentException("Module must be provided"); } String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists.", module) ); } moduleService.parseArguments(others); if (moduleService.doHelp()) { throw new ArgumentException(module + " help"); } loadExtensions(moduleService, argMap); moduleService.run(); } catch(ArgumentException e) { System.out.println(e.getMessage()); System.exit(0); } catch (Throwable t) { String message = t.getMessage() != null ? t.getMessage() : t.getClass().getName(); logger.error(message); logger.debug(message, t); System.exit(1); } }

Target:
public static void main(String[] args) { int exitStatus = 1; try { Map<String, Object> argMap = parseArgs(args); setupLogger(argMap); List<String> others = (List<String>) argMap.get("__other__"); Map<String, ModuleService> moduleServices = loadModules(ModuleService.class); if (argMap.containsKey(ARG_HELP)) { List<String> modules = new ArrayList<>(moduleServices.keySet()); Collections.sort(modules); throw new ExitException("Modules: " + StringUtils.join(modules, ", "), 0); } if (others.isEmpty()) { throw new IllegalArgumentException("Module must be provided"); } String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists.", module) ); } moduleService.parseArguments(others); if (moduleService.doHelp()) { throw new ExitException(module + " help", 0); } loadExtensions(moduleService, argMap); moduleService.run(); } catch(ExitException e) { System.out.println(e.getMessage()); exitStatus = e.getExitCode(); } catch (Throwable t) { String message = t.getMessage() != null ? t.getMessage() : t.getClass().getName(); logger.error(message); logger.debug(message, t); } System.exit(exitStatus); }
Source:
public void execute() { int flag = 0; Ode.getInstance().getTopToolbar().updateMoveToTrash(flag); Ode.getInstance().switchToProjectsView(); Ode.getInstance().getTopToolbar().updateFileMenuButtons(0); }

Target:
public void execute() { Ode.getInstance().getTopToolbar().updateMoveToTrash("Move To Trash"); Ode.getInstance().switchToProjectsView(); Ode.getInstance().getTopToolbar().updateFileMenuButtons(0); }
Source:
public void enqueueLog(Path wal) { if (!this.filterInWALs.test(wal)) { LOG.trace("NOT replicating {}", wal); return; } String walGroupId = AbstractFSWALProvider.getWALPrefixFromWALName(wal.getName()); PriorityBlockingQueue<Path> queue = queues.get(walGroupId); if (queue == null) { queue = new PriorityBlockingQueue<>(queueSizePerGroup, new AbstractFSWALProvider.WALsStartTimeComparator()); queues.put(walGroupId, queue); if (this.isSourceActive() && this.walEntryFilter != null) { tryStartNewShipper(walGroupId, queue); } } queue.put(wal); if (LOG.isTraceEnabled()) { LOG.trace("{} Added wal to queue of source {}.", this, walGroupId, this.replicationQueueInfo.getQueueId()); } this.metrics.incrSizeOfLogQueue(); int queueSize = queue.size(); if (queueSize > this.logQueueWarnThreshold) { LOG.warn("{} WAL group queue size={} exceeds 'replication.source.log.queue.warn'={}", this, walGroupId, queueSize, logQueueWarnThreshold); } }

Target:
public void enqueueLog(Path wal) { if (!this.filterInWALs.test(wal)) { LOG.trace("NOT replicating {}", wal); return; } String walGroupId = AbstractFSWALProvider.getWALPrefixFromWALName(wal.getName()); PriorityBlockingQueue<Path> queue = queues.get(walGroupId); if (queue == null) { queue = new PriorityBlockingQueue<>(queueSizePerGroup, new LogsComparator()); queues.put(walGroupId, queue); if (this.isSourceActive() && this.walEntryFilter != null) { tryStartNewShipper(walGroupId, queue); } } queue.put(wal); if (LOG.isTraceEnabled()) { LOG.trace("{} Added wal to queue of source {}.", logPeerId(), walGroupId, this.replicationQueueInfo.getQueueId()); } this.metrics.incrSizeOfLogQueue(); int queueSize = queue.size(); if (queueSize > this.logQueueWarnThreshold) { LOG.warn("{} WAL group queue size: exceeds value of " + "replication.source.log.queue.warn: {}", logPeerId(), walGroupId, queueSize, logQueueWarnThreshold); } }
Source:
private void resize(int size) { if (nResizes < maxResizes) { nResizes++; long kCapacity = (kLimit - kStart) << 1; long target = key.appendAddress + size - kStart; if (kCapacity < target) { kCapacity = Numbers.ceilPow2(target); } long kAddress = Unsafe.realloc(this.kStart, this.capacity, kCapacity); this.capacity = kCapacity; long d = kAddress - this.kStart; kPos += d; long colOffsetDelta = key.nextColOffset - key.startAddress; key.startAddress += d; key.appendAddress += d; key.nextColOffset = key.startAddress + colOffsetDelta; assert kPos > 0; assert key.startAddress > 0; assert key.appendAddress > 0; assert key.nextColOffset > 0; this.kStart = kAddress; this.kLimit = kAddress + kCapacity; } else { throw LimitOverflowException.instance().put("limit of ").put(maxResizes).put(" resizes exceeded"); } }

Target:
private void resize(int size) { if (nResizes < maxResizes) { nResizes++; long kCapacity = (kLimit - kStart) << 1; long target = key.appendAddress + size - kStart; if (kCapacity < target) { kCapacity = Numbers.ceilPow2(target); } long kAddress = Unsafe.realloc(this.kStart, this.capacity, kCapacity); this.capacity = kCapacity; long d = kAddress - this.kStart; kPos += d; long colOffsetDelta = key.nextColOffset - key.startAddress; key.startAddress += d; key.appendAddress += d; key.nextColOffset = key.startAddress + colOffsetDelta; assert kPos > 0; assert key.startAddress > 0; assert key.appendAddress > 0; assert key.nextColOffset > 0; this.kStart = kAddress; this.kLimit = kAddress + kCapacity; } else { throw LimitOverflowException.instance().put("limit of ").put(maxResizes).put(" resizes exceeded in FastMap"); } }
Source:
public static boolean isPublicKeyValid(String publicKey) { String[] words = publicKey.split("\\s+", 3); if (words.length != 3) { return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!Base64.isArrayByteBase64(words[1].getBytes())) { return false; } return true; }

Target:
public static boolean isPublicKeyValid(String publicKey) { String[] words = publicKey.split("\\s+", 3); if (words.length < 2 || words.length > 3) { return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!Base64.isArrayByteBase64(words[1].getBytes())) { return false; } return true; }