auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void testBeta() throws Exception { <END> for (final double a : Arrays.asList(10, 20, 30)) { for (final double b : Arrays.asList(10, 20, 30)) { final double theoreticalMean = a / (a + b); final double theoreticalVariance = a*b/((a+b)*(a+b)*(a+b+1)); final double standardDeviationOfMean = Math.sqrt(theoreticalVariance / NUM_SAMPLES); final GibbsSampler<DoubleState, EmptyData> sampler = betaGibbsSampler(a, b); sampler.runMCMC(); List<Double> samples = sampler.getSamples(DoubleState.PARAMETER_NAME, Double.class, NUM_BURN_IN_STEPS); final double sampleMean = samples.stream().mapToDouble(x -> x).average().getAsDouble(); Assert.assertEquals(sampleMean, theoreticalMean, 10*standardDeviationOfMean); } } }</code><technical_language>Exception is this throwing</technical_language>

Target:
public void testBeta() { for (final double a : Arrays.asList(10, 20, 30)) { for (final double b : Arrays.asList(10, 20, 30)) { final double theoreticalMean = a / (a + b); final double theoreticalVariance = a*b/((a+b)*(a+b)*(a+b+1)); final double standardDeviationOfMean = Math.sqrt(theoreticalVariance / NUM_SAMPLES); final Function<Double, Double> logPDF = x -> (a - 1) * Math.log(x) + (b - 1) * Math.log(1 - x); final AdaptiveMetropolisSampler sampler = new AdaptiveMetropolisSampler(INITIAL_BETA_GUESS, INITIAL_STEP_SIZE, 0, 1); final List<Double> samples = sampler.sample(logPDF, NUM_SAMPLES, NUM_BURN_IN_STEPS); final double sampleMean = samples.stream().mapToDouble(x -> x).average().getAsDouble(); final double sampleMeanSquare = samples.stream().mapToDouble(x -> x*x).average().getAsDouble(); final double sampleVariance = (sampleMeanSquare - sampleMean * sampleMean)*NUM_SAMPLES/(NUM_SAMPLES-1); Assert.assertEquals(sampleMean, theoreticalMean, 10 * standardDeviationOfMean); Assert.assertEquals(sampleVariance, theoreticalVariance, 10e-4); } } }
Source:
<code>protected static JSIScenarioType getScenario(Scenario source) { JSIScenarioType toReturn = new JSIScenarioType(); JSIFactMappingValuesType factMappingValuesType = new JSIFactMappingValuesType(); toReturn.setFactMappingValues(factMappingValuesType); final List<FactMappingValue> unmodifiableFactMappingValues = source.getUnmodifiableFactMappingValues(); <START> List<JSIFactMappingValueType> toSet = new ArrayList<>(); populateJSIFactMappingValuesType(toSet, unmodifiableFactMappingValues); factMappingValuesType.setFactMappingValue(toSet); <END> return toReturn; }</code><technical_language>populateJSIFactMappingValuesType private move toSet variable of populateJSIFactMappingValuesType currently do do check in populateJSIFactMappingValuesType if toSet is null</technical_language>

Target:
protected static JSIScenarioType getScenario(Scenario source) { JSIScenarioType toReturn = new JSIScenarioType(); JSIFactMappingValuesType factMappingValuesType = new JSIFactMappingValuesType(); toReturn.setFactMappingValues(factMappingValuesType); final List<FactMappingValue> unmodifiableFactMappingValues = source.getUnmodifiableFactMappingValues(); List<JSIFactMappingValueType> toSet = populateJSIFactMappingValuesType(unmodifiableFactMappingValues); factMappingValuesType.setFactMappingValue(toSet); return toReturn; }
Source:
<code>public Attribute<?> getSourceAttribute(boolean allowDeleted) throws OseeCoreException { Attribute<?> sourceAttribute = null; <START> Collection<Attribute<?>> localAttributes; <END> if (allowDeleted) { localAttributes = getSourceArtifact().getAttributes(true); } else { localAttributes = getSourceArtifact().getAttributes(); } for (Attribute<?> localAttribute : localAttributes) { if (localAttribute.getId() == attrId) { sourceAttribute = localAttribute; } } if (sourceAttribute == null) { if (sourceBranch != null) { throw new AttributeDoesNotExist("Attribute %d could not be found on artifact %d on branch %s", attrId, getArtId(), sourceBranch.getUuid()); } else { throw new AttributeDoesNotExist("Attribute %d could not be found on artifact %d", attrId, getArtId()); } } return sourceAttribute; }</code><technical_language>artifact.getAttributeById(attrUuid, includeDeleted)</technical_language>

Target:
public Attribute<?> getSourceAttribute(boolean allowDeleted) throws OseeCoreException { Attribute<?> sourceAttribute = getSourceArtifact().getAttributeById(attrId, allowDeleted); if (sourceAttribute == null) { if (sourceBranch != null) { throw new AttributeDoesNotExist("Attribute %d could not be found on artifact %d on branch %s", attrId, getArtId(), sourceBranch.getUuid()); } else { throw new AttributeDoesNotExist("Attribute %d could not be found on artifact %d", attrId, getArtId()); } } return sourceAttribute; }
Source:
<code>public Set<String> getFreeVariables() { <START> return new HashSet<>(); <END> }</code><technical_language>underlying objectExpr free variables</technical_language>

Target:
public Set<String> getFreeVariables() { return objectExpr.getFreeVariables(); }
Source:
<code>public static void validateConfig(Config config) { Validate.notEmpty(config.getName(), String.format(FIELD_CANNOT_BE_EMPTY, "Name")); Validate.notEmpty(config.getOpenMrsUrl(), String.format(FIELD_CANNOT_BE_EMPTY, "OpenMRS URL")); Validate.notEmpty(config.getUsername(), String.format(FIELD_CANNOT_BE_EMPTY, "Username")); Validate.notEmpty(config.getPassword(), String.format(FIELD_CANNOT_BE_EMPTY, "Password")); Validate.notEmpty(config.getMotechPatientIdentifierTypeName(), String.format(FIELD_CANNOT_BE_EMPTY, "Motech patient identifier type name")); <START> Validate.notNull(config.getPatientIdentifierTypeNames(), String.format(FIELD_CANNOT_BE_EMPTY, "Patient identifier type names")); <END> }</code><technical_language>add this ? default this field is empty</technical_language>

Target:
public static void validateConfig(Config config) { Validate.notEmpty(config.getName(), String.format(FIELD_CANNOT_BE_EMPTY, "Name")); Validate.notEmpty(config.getOpenMrsUrl(), String.format(FIELD_CANNOT_BE_EMPTY, "OpenMRS URL")); Validate.notEmpty(config.getUsername(), String.format(FIELD_CANNOT_BE_EMPTY, "Username")); Validate.notEmpty(config.getPassword(), String.format(FIELD_CANNOT_BE_EMPTY, "Password")); Validate.notEmpty(config.getMotechPatientIdentifierTypeName(), String.format(FIELD_CANNOT_BE_EMPTY, "Motech patient identifier type name")); }
Source:
<code>protected void applyDataRowStyle(final int row) { super.applyDataRowStyle(row); final CellFormatter fmt = table.getCellFormatter(); fmt.addStyleName(row, C_STAR, S_ICON_CELL); for (int i = C_ID; i < columns; i++) { fmt.addStyleName(row, i, S_DATA_CELL); } fmt.addStyleName(row, C_ID, S_C_ID); fmt.addStyleName(row, C_SUBJECT, S_C_SUBJECT); fmt.addStyleName(row, C_PROJECT, S_C_PROJECT); fmt.addStyleName(row, C_BRANCH, S_C_PROJECT); fmt.addStyleName(row, C_LAST_UPDATE, S_C_LAST_UPDATE); for (int i = BASE_COLUMNS; i < columns; i++) { <START> fmt.addStyleName(row, i, "approvalscore"); <END> } }</code><technical_language>This style name is unused, miss some CSS this added for future definitions</technical_language>

Target:
protected void applyDataRowStyle(final int row) { super.applyDataRowStyle(row); final CellFormatter fmt = table.getCellFormatter(); fmt.addStyleName(row, C_STAR, S_ICON_CELL); for (int i = C_ID; i < columns; i++) { fmt.addStyleName(row, i, S_DATA_CELL); } fmt.addStyleName(row, C_ID, S_C_ID); fmt.addStyleName(row, C_SUBJECT, S_C_SUBJECT); fmt.addStyleName(row, C_PROJECT, S_C_PROJECT); fmt.addStyleName(row, C_BRANCH, S_C_PROJECT); fmt.addStyleName(row, C_LAST_UPDATE, S_C_LAST_UPDATE); }
Source:
<code>public void requestRoll() { <START> this.rollRequestCounter.incrementAndGet(); <END> }</code><technical_language>this of count based correct. 2 times req roll happened actual rolling thread picks this work. Effectively need do roll right. if 2 more times asked. this change try do roll again. a boolean based is enough do is requestRoll synchronized rollWal a synchronized block reset ad actual roll call. need AtomicBoolean only</technical_language>

Target:
public void requestRoll() { this.rollRequest.set(true); }
Source:
<code>public void optionsChanged(DebugOptions options) { fgDebugTrace = options.newDebugTrace(DsfPlugin.PLUGIN_ID); DEBUG = options.getBooleanOption(DEBUG_FLAG, false); <START> DEBUG_EXECUTOR = options.getBooleanOption(DEBUG_EXECUTOR_FLAG, false); <END> DEBUG_EXECUTOR_NAME = options.getOption(DEBUG_EXECUTOR_NAME_FLAG, ""); DEBUG_MONITORS = options.getBooleanOption(DEBUG_MONITORS_FLAG, false); DEBUG_CACHE = options.getBooleanOption(DEBUG_CACHE_FLAG, false); DEBUG_SESSION = options.getBooleanOption(DEBUG_SESSION_FLAG, false); DEBUG_SESSION_LISTENERS = options.getBooleanOption(DEBUG_SESSION_LISTENERS_FLAG, false); DEBUG_SESSION_DISPATCHES = options.getBooleanOption(DEBUG_SESSION_DISPATCHES_FLAG, false); DEBUG_SESSION_MODEL_ADAPTERS = options.getBooleanOption(DEBUG_SESSION_MODEL_ADAPTERS_FLAG, false); }</code><technical_language>add DEBUG && check</technical_language>

Target:
public void optionsChanged(DebugOptions options) { fgDebugTrace = options.newDebugTrace(DsfPlugin.PLUGIN_ID); DEBUG = options.getBooleanOption(DEBUG_FLAG, false); DEBUG_EXECUTOR = DEBUG && options.getBooleanOption(DEBUG_EXECUTOR_FLAG, false); DEBUG_EXECUTOR_NAME = DEBUG ? options.getOption(DEBUG_EXECUTOR_NAME_FLAG, "") : ""; DEBUG_MONITORS = DEBUG && options.getBooleanOption(DEBUG_MONITORS_FLAG, false); DEBUG_CACHE = DEBUG && options.getBooleanOption(DEBUG_CACHE_FLAG, false); DEBUG_SESSION = DEBUG && options.getBooleanOption(DEBUG_SESSION_FLAG, false); DEBUG_SESSION_LISTENERS = DEBUG_SESSION && options.getBooleanOption(DEBUG_SESSION_LISTENERS_FLAG, false); DEBUG_SESSION_DISPATCHES = DEBUG_SESSION && options.getBooleanOption(DEBUG_SESSION_DISPATCHES_FLAG, false); DEBUG_SESSION_MODEL_ADAPTERS = DEBUG_SESSION && options.getBooleanOption(DEBUG_SESSION_MODEL_ADAPTERS_FLAG, false); }
Source:
<code>public void accept(ReadResultSet<ReliableTopicMessage> result, Throwable throwable) { if (cancelled) { return; } if (throwable == null) { for (int i = 0; i < result.size(); i++) { ReliableTopicMessage message = result.get(i); long actualSequence = result.getSequence(i); if (actualSequence != sequence) { if (handleSilentSequenceJump(actualSequence)) { sequence = actualSequence; } else { <START> cancel(); <END> return; } } try { listener.storeSequence(sequence); process(message); } catch (Throwable t) { if (terminate(t)) { cancel(); return; } } sequence++; } next(); } else { throwable = adjustThrowable(throwable); if (handleInternalException(throwable)) { next(); } else { cancel(); } } }</code><technical_language>if cancel throw StaleSequenceException user if listener is loss tolerant? Now, cancel I guess stops listener silently notifying user</technical_language>

Target:
public void accept(ReadResultSet<ReliableTopicMessage> result, Throwable throwable) { if (cancelled) { return; } if (throwable == null) { long lostCount = result.getNextSequenceToReadFrom() - result.readCount() - sequence; if (lostCount != 0 && !isLossTolerable(lostCount)) { cancel(); return; } for (int i = 0; i < result.size(); i++) { ReliableTopicMessage message = result.get(i); try { listener.storeSequence(result.getSequence(i)); process(message); } catch (Throwable t) { if (terminate(t)) { cancel(); return; } } } sequence = result.getNextSequenceToReadFrom(); next(); } else { throwable = adjustThrowable(throwable); if (handleInternalException(throwable)) { next(); } else { cancel(); } } }
Source:
<code>public static LocalCacheManager create(AlluxioConfiguration conf) throws IOException { MetaStore metaStore = MetaStore.create(); CacheEvictor evictor = CacheEvictor.create(conf); PageStoreOptions options = PageStoreOptions.create(conf); PageStore pageStore = PageStore.create(options); boolean restored = false; try { restored = pageStore.restore(pageInfo -> { if (pageInfo == null) { return false; } metaStore.addPage(pageInfo.getPageId(), pageInfo); evictor.updateOnPut(pageInfo.getPageId()); return metaStore.bytes() <= pageStore.getCacheSize(); }); } catch (Exception e) { LOG.error("Failed to restore PageStore", e); } if (!restored) { metaStore.reset(); evictor.reset(); <START> pageStore.initialize(options); <END> } return new LocalCacheManager(conf, metaStore, pageStore, evictor); }</code><technical_language>RocksPageStore in a bad state restore initialize</technical_language>

Target:
public static LocalCacheManager create(AlluxioConfiguration conf) throws IOException { MetaStore metaStore = MetaStore.create(); CacheEvictor evictor = CacheEvictor.create(conf); PageStoreOptions options = PageStoreOptions.create(conf); PageStore pageStore = null; boolean restored = false; try { pageStore = PageStore.create(options, false); restored = restore(pageStore, options, metaStore, evictor); } catch (Exception e) { LOG.error("Failed to restore PageStore", e); } if (!restored) { if (pageStore != null) { try { pageStore.close(); } catch (Exception e) { LOG.error("Failed to close PageStore", e); } } metaStore.reset(); evictor.reset(); pageStore = PageStore.create(options, true); } return new LocalCacheManager(conf, metaStore, pageStore, evictor); }
Source:
<code>public void deliver_updates() { AggregateRepository<ProjectId, Given.StandTestAggregate> repository = Given.aggregateRepo(); ProjectId entityId = ProjectId .newBuilder() .setId("PRJ-001") .build(); Given.StandTestAggregate entity = repository.create(entityId); StringValue state = entity.getState(); Version version = entity.getVersion(); Stand innerStand = Stand.newBuilder() .build(); Stand stand = spy(innerStand); stand.post(requestFactory.createCommandContext() .getActorContext() .getTenantId(), entity); ArgumentMatcher<EntityStateEnvelope<?, ?>> argumentMatcher = argument -> { boolean entityIdMatches = argument.getEntityId() .equals(entityId); boolean versionMatches = version.equals(argument.getEntityVersion() .orNull()); boolean stateMatches = argument.getMessage() .equals(state); return entityIdMatches && versionMatches && stateMatches; }; <START> verify(stand).update(ArgumentMatchers.argThat(argumentMatcher)); <END> }</code><technical_language>Please add static import for argThat</technical_language>

Target:
public void deliver_updates() { AggregateRepository<ProjectId, StandTestAggregate> repository = Given.aggregateRepo(); ProjectId entityId = ProjectId .newBuilder() .setId("PRJ-001") .build(); StandTestAggregate entity = repository.create(entityId); StringValue state = entity.getState(); Version version = entity.getVersion(); Stand innerStand = Stand.newBuilder() .build(); Stand stand = spy(innerStand); stand.post(requestFactory.createCommandContext() .getActorContext() .getTenantId(), entity); ArgumentMatcher<EntityStateEnvelope<?, ?>> argumentMatcher = argument -> { boolean entityIdMatches = argument.getEntityId() .equals(entityId); boolean versionMatches = version.equals(argument.getEntityVersion() .orNull()); boolean stateMatches = argument.getMessage() .equals(state); return entityIdMatches && versionMatches && stateMatches; }; verify(stand).update(argThat(argumentMatcher)); }
Source:
<code>CoordinationUtils createCoordinationUtils() throws Exception { ApplicationConfig appConfig = new ApplicationConfig(config); String clazz = appConfig.getCoordinationServiceFactoryClass(); if (StringUtils.isNotEmpty(clazz)) { <START> CoordinationServiceFactory factory = ClassLoaderHelper.fromClassName(clazz); <END> String groupId = String.format("app-%s-%s", appConfig.getAppName(), appConfig.getAppId()); return factory.getCoordinationService(groupId, uid, config); } else { return null; } }</code><technical_language>this needs a shared/pluggable CoordinatorService. this is some utils for working ZK</technical_language>

Target:
CoordinationUtils createCoordinationUtils() { String jobCoordinatorFactoryClassName = config.get(JobCoordinatorConfig.JOB_COORDINATOR_FACTORY, ""); if (ZkJobCoordinatorFactory.class.getName().equals(jobCoordinatorFactoryClassName)) { ApplicationConfig appConfig = new ApplicationConfig(config); return new ZkCoordinationServiceFactory().getCoordinationService(appConfig.getGlobalAppId(), uid, config); } else { return null; } }
Source:
<code>private static TraceMarker createTraceMarker(ITmfTrace trace, @Nullable String label, @Nullable String category, long startTime, long endTime, @Nullable String color) { long tStartTime = startTime; long tEndTime = endTime; String tLabel = label; String tCategory = category; String tColor = color; if (tEndTime <START> == Long.valueOf(DEFAULT_ENDTIME)) <END> { tEndTime = tStartTime; } if (tStartTime > tEndTime || tEndTime > trace.getEndTime().toNanos()) { throw new IllegalArgumentException(INVALID_END_TIMESTAMP); } if (tStartTime < trace.getStartTime().toNanos()) { throw new IllegalArgumentException(INVALID_START_TIMESTAMP); } if (tLabel == null) { tLabel = DEFAULT_LABEL; } if (tCategory == null) { tCategory = DEFAULT_CATEGORY; } if (tColor == null) { tColor = DEFAULT_COLOR; } return new TraceMarker(tLabel, tCategory, tStartTime, tEndTime, tColor); }</code><technical_language>need this, tEndTime is a case long</technical_language>

Target:
private static TraceMarker createTraceMarker(ITmfTrace trace, @Nullable String label, @Nullable String category, long startTime, long endTime, @Nullable String color) { long tStartTime = startTime; long tEndTime = endTime; String tLabel = label; String tCategory = category; String tColor = color; if (tEndTime == Long.parseLong(DEFAULT_ENDTIME)) { tEndTime = tStartTime; } if (tStartTime > tEndTime) { throw new IllegalArgumentException(String.format(INVALID_END_TIMESTAMP, tStartTime, tEndTime)); } if (tEndTime > trace.getEndTime().toNanos()) { throw new IllegalArgumentException(String.format(INVALID_END_TIMESTAMP_2, tEndTime, trace.getEndTime().toNanos())); } if (tStartTime < trace.getStartTime().toNanos()) { throw new IllegalArgumentException(String.format(INVALID_START_TIMESTAMP, tStartTime, trace.getStartTime().toNanos())); } if (tLabel == null) { tLabel = DEFAULT_LABEL; } if (tCategory == null) { tCategory = DEFAULT_CATEGORY; } if (tColor == null) { tColor = DEFAULT_COLOR; } return new TraceMarker(tLabel, tCategory, tStartTime, tEndTime, tColor); }
Source:
<code>public void test() throws Exception { Foo foo = new Foo(); String json = SimpleJsonSerializer.toJson(foo, "fileInfo"); @SuppressWarnings("unchecked") <START> Map<String, Object> fromJson = JsonObjectMapperProvider.newInstance().fromJson(json, Map.class); <END> assertThat(fromJson.get("bool"), equalTo(Boolean.TRUE)); assertThat(fromJson.get("bar"), equalTo(42)); assertThat(fromJson.get("foo"), equalTo("bar")); assertThat(fromJson.get("dub"), equalTo(1.6)); assertNull(fromJson.get("fileInfo")); }</code><technical_language>work for Foo.class</technical_language>

Target:
public void test() throws Exception { Foo foo = new Foo("foo"); String json = SimpleJsonSerializer.toJson(foo, "fileInfo"); Foo fooOut = JsonObjectMapperProvider.newInstance().fromJson(json, Foo.class); assertThat(fooOut.bool, equalTo(Boolean.TRUE)); assertThat(fooOut.bar, equalTo(42L)); assertThat(fooOut.foo, equalTo("bar")); assertThat(fooOut.dub, equalTo(1.6)); assertNull(fooOut.fileInfo); }
Source:
<code>private static HttpScheme connectionScheme(ChannelHandlerContext ctx) { final HttpScheme scheme = connectionSchemeAttribute(ctx).get(); <START> return (scheme == null) ? HttpScheme.HTTP : scheme; <END> }</code><technical_language>nit: remove ()</technical_language>

Target:
private static HttpScheme connectionScheme(ChannelHandlerContext ctx) { final HttpScheme scheme = connectionSchemeAttribute(ctx).get(); return scheme == null ? HttpScheme.HTTP : scheme; }
Source:
<code>Mono<DecryptResult> decrypt(DecryptOptions decryptOptions, Context context) { Objects.requireNonNull(decryptOptions, "'decryptOptions' cannot be null."); Objects.requireNonNull(decryptOptions.getAlgorithm(), "Encryption algorithm cannot be null."); <START> Objects.requireNonNull(decryptOptions.getCipherText(), "Cipher text content to be decrypted cannot be null."); <END> EncryptionAlgorithm algorithm = decryptOptions.getAlgorithm(); byte[] iv = decryptOptions.getIv(); byte[] additionalAuthenticatedData = decryptOptions.getAdditionalAuthenticatedData(); byte[] authenticationTag = decryptOptions.getAuthenticationTag(); KeyOperationParameters parameters = new KeyOperationParameters() .setAlgorithm(algorithm) .setValue(decryptOptions.getCipherText()) .setIv(iv) .setAdditionalAuthenticatedData(additionalAuthenticatedData) .setAuthenticationTag(authenticationTag); context = context == null ? Context.NONE : context; return service.decrypt(vaultUrl, keyName, version, apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Decrypting content with algorithm - {}", algorithm.toString())) .doOnSuccess(response -> logger.info("Retrieved decrypted content with algorithm- {}", algorithm.toString())) .doOnError(error -> logger.warning("Failed to decrypt content with algorithm - {}", algorithm.toString(), error)) .flatMap(keyOperationResultResponse -> Mono.just( new DecryptResult(keyOperationResultResponse.getValue().getResult(), algorithm, keyId))); }</code><technical_language>getCiphertext (one word)</technical_language>

Target:
Mono<DecryptResult> decrypt(DecryptOptions decryptOptions, Context context) { Objects.requireNonNull(decryptOptions, "'decryptOptions' cannot be null."); EncryptionAlgorithm algorithm = decryptOptions.getAlgorithm(); byte[] iv = decryptOptions.getIv(); byte[] additionalAuthenticatedData = decryptOptions.getAdditionalAuthenticatedData(); byte[] authenticationTag = decryptOptions.getAuthenticationTag(); KeyOperationParameters parameters = new KeyOperationParameters() .setAlgorithm(algorithm) .setValue(decryptOptions.getCiphertext()) .setIv(iv) .setAdditionalAuthenticatedData(additionalAuthenticatedData) .setAuthenticationTag(authenticationTag); context = context == null ? Context.NONE : context; return service.decrypt(vaultUrl, keyName, version, apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Decrypting content with algorithm - {}", algorithm.toString())) .doOnSuccess(response -> logger.info("Retrieved decrypted content with algorithm- {}", algorithm.toString())) .doOnError(error -> logger.warning("Failed to decrypt content with algorithm - {}", algorithm.toString(), error)) .flatMap(keyOperationResultResponse -> Mono.just( new DecryptResult(keyOperationResultResponse.getValue().getResult(), algorithm, keyId))); }
Source:
<code>private boolean parseSystemPluginOutput(String regfilePath, AbstractFile regAbstractFile) { File regfile = new File(regfilePath); try (BufferedReader reader = new BufferedReader(new FileReader(regfile))) { String line = reader.readLine(); while (line != null) { <START> line = line.trim(); <END> if (line.matches("^bam v.*")) { parseBamKey(regAbstractFile, reader, Bundle.Registry_System_Bam()); } else if (line.matches("^bthport v..*")) { parseBlueToothDevices(regAbstractFile, reader) ; } line = reader.readLine(); } return true; } catch (FileNotFoundException ex) { logger.log(Level.WARNING, "Error finding the registry file.", ex); } catch (IOException ex) { logger.log(Level.WARNING, "Error reading the system hive: {0}", ex); } return false; }</code><technical_language>this line lowercase regexes match casing issue</technical_language>

Target:
private boolean parseSystemPluginOutput(String regfilePath, AbstractFile regAbstractFile) { File regfile = new File(regfilePath); try (BufferedReader reader = new BufferedReader(new FileReader(regfile))) { String line = reader.readLine(); while (line != null) { line = line.trim(); if (line.toLowerCase().matches("^bam v.*")) { parseBamKey(regAbstractFile, reader, Bundle.Registry_System_Bam()); } else if (line.toLowerCase().matches("^bthport v..*")) { parseBlueToothDevices(regAbstractFile, reader); } line = reader.readLine(); } return true; } catch (FileNotFoundException ex) { logger.log(Level.WARNING, "Error finding the registry file.", ex); } catch (IOException ex) { logger.log(Level.WARNING, "Error reading the system hive: {0}", ex); } return false; }
Source:
<code>private void reset() { <START> setId( next = NO_ID ); <END> }</code><technical_language>i do need save this line more readable</technical_language>

Target:
private void reset() { next = NO_ID; setId( NO_ID ); }
Source:
<code>public List<Agent> sort(List<String> agentKeys) throws AgentException { Map<String, Agent> sorted = new HashMap<>(); Set<String> pending = new HashSet<>(); if (agentKeys != null) { for (String agentKey : agentKeys) { doSort(agentKeys, parse(agentKey), sorted, pending); } } <START> return new ArrayList<>(sorted.values()); <END> }</code><technical_language>sorted</technical_language>

Target:
public List<AgentKey> sort(List<String> agentKeys) throws AgentException { List<AgentKey> sorted = new ArrayList<>(); Set<String> pending = new HashSet<>(); if (agentKeys != null) { for (String agentKey : agentKeys) { doSort(agentKeys, AgentKeyImpl.parse(agentKey), sorted, pending); } } return sorted; }
Source:
<code>public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") InputRowParser parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec ) { this.dataSource = dataSource; final Set<String> dimensionExclusions = Sets.newHashSet(); if (parser != null && parser.getParseSpec() != null && parser.getParseSpec().getTimestampSpec() != null) { dimensionExclusions.add(parser.getParseSpec().getTimestampSpec().getTimestampColumn()); <START> for (AggregatorFactory aggregator : aggregators) { <END> dimensionExclusions.add(aggregator.getName()); } } if (parser != null && parser.getParseSpec() != null && parser.getParseSpec().getDimensionsSpec() != null) { this.parser = parser.withParseSpec( parser.getParseSpec() .withDimensionsSpec( parser.getParseSpec() .getDimensionsSpec() .withDimensionExclusions(dimensionExclusions) ) ); } else { this.parser = parser; } this.aggregators = aggregators; this.granularitySpec = granularitySpec == null ? new UniformGranularitySpec(null, null, null, null) : granularitySpec; }</code><technical_language>is this loop if-statement</technical_language>

Target:
public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") InputRowParser parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec ) { this.dataSource = dataSource; final Set<String> dimensionExclusions = Sets.newHashSet(); for (AggregatorFactory aggregator : aggregators) { dimensionExclusions.add(aggregator.getName()); } if (parser != null && parser.getParseSpec() != null) { if (parser.getParseSpec().getTimestampSpec() != null) { dimensionExclusions.add(parser.getParseSpec().getTimestampSpec().getTimestampColumn()); } if (parser.getParseSpec().getDimensionsSpec() != null) { this.parser = parser.withParseSpec( parser.getParseSpec() .withDimensionsSpec( parser.getParseSpec() .getDimensionsSpec() .withDimensionExclusions(dimensionExclusions) ) ); } else { this.parser = parser; } } else { this.parser = parser; } this.aggregators = aggregators; this.granularitySpec = granularitySpec == null ? new UniformGranularitySpec(null, null, null, null) : granularitySpec; }
Source:
<code>public void removeResourceSelfServiceGroup(PerunSession sess, Resource resource, Group group) throws InternalErrorException, PrivilegeException, GroupNotAdminException { Utils.checkPerunSession(sess); Vo vo; Facility facility; try { facility = sess.getPerun().getFacilitiesManager().getFacilityById(sess, resource.getFacilityId()); } catch (FacilityNotExistsException e) { throw new InternalErrorException("Failed to find facility for given resource."); } try { vo = sess.getPerun().getVosManager().getVoById(sess, resource.getVoId()); } catch (VoNotExistsException e) { throw new InternalErrorException("Failed to find vo for given resource."); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { <START> throw new PrivilegeException(sess, "addResourceSelfServiceUser"); <END> } getResourcesManagerBl().removeResourceSelfServiceGroup(sess, resource, group); }</code><technical_language>parameter "removeResourceSelfServiceGroup"</technical_language>

Target:
public void removeResourceSelfServiceGroup(PerunSession sess, Resource resource, Group group) throws InternalErrorException, PrivilegeException, GroupNotAdminException { Utils.checkPerunSession(sess); Vo vo; Facility facility; try { facility = sess.getPerun().getFacilitiesManager().getFacilityById(sess, resource.getFacilityId()); } catch (FacilityNotExistsException e) { throw new InternalErrorException("Failed to find facility for given resource."); } try { vo = sess.getPerun().getVosManager().getVoById(sess, resource.getVoId()); } catch (VoNotExistsException e) { throw new InternalErrorException("Failed to find vo for given resource."); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "removeResourceSelfServiceGroup"); } getResourcesManagerBl().removeResourceSelfServiceGroup(sess, resource, group); }
Source:
<code>public synchronized void schedule(ScheduledJob scheduledJob) { String id = scheduledJob.getId(); String cronExpression = scheduledJob.getCronExpression(); String name = scheduledJob.getName(); if (!CronExpression.isValidExpression(cronExpression)) { throw new MolgenisValidationException( singleton( new ConstraintViolation("Invalid cronexpression '" + cronExpression + "'", null))); } try { if (quartzScheduler.checkExists(new JobKey(id, SCHEDULED_JOB_GROUP))) { unschedule(id); } <START> if (!Boolean.TRUE.equals(scheduledJob.getBoolean(ScheduledJobMetadata.ACTIVE))) { <END> return; } Trigger trigger = newTrigger() .withIdentity(id, SCHEDULED_JOB_GROUP) .withSchedule(cronSchedule(cronExpression)) .build(); schedule(scheduledJob, trigger); LOG.info("Scheduled Job '{}' with trigger '{}'", name, trigger); } catch (SchedulerException e) { LOG.error("Error schedule job", e); throw new ScheduledJobException("Error schedule job", e); } }</code><technical_language>Better: Scheduled.isActive()</technical_language>

Target:
public synchronized void schedule(ScheduledJob scheduledJob) { String id = scheduledJob.getId(); String cronExpression = scheduledJob.getCronExpression(); String name = scheduledJob.getName(); if (!CronExpression.isValidExpression(cronExpression)) { throw new MolgenisValidationException( singleton( new ConstraintViolation("Invalid cronexpression '" + cronExpression + "'", null))); } try { if (quartzScheduler.checkExists(new JobKey(id, SCHEDULED_JOB_GROUP))) { unschedule(id); } if (!scheduledJob.isActive()) { return; } Trigger trigger = newTrigger() .withIdentity(id, SCHEDULED_JOB_GROUP) .withSchedule(cronSchedule(cronExpression)) .build(); schedule(scheduledJob, trigger); LOG.info("Scheduled Job '{}' with trigger '{}'", name, trigger); } catch (SchedulerException e) { LOG.error("Error schedule job", e); throw new ScheduledJobException("Error schedule job", e); } }
Source:
<code>private boolean getCustomCheckpointing(DatastreamTask task) { boolean customCheckpointing = _connectors.get(task.getConnectorType()).isCustomCheckpointing(); Datastream datastream = task.getDatastreams().get(0); <START> if (datastream.hasMetadata() && datastream.getMetadata() != null && <END> datastream.getMetadata().containsKey(DatastreamMetadataConstants.CUSTOM_CHECKPOINT)) { customCheckpointing = Boolean.parseBoolean( datastream.getMetadata().get(DatastreamMetadataConstants.CUSTOM_CHECKPOINT)); _log.info(String.format("Custom checkpointing overridden by metadata to be: %b for datastream: %s", customCheckpointing, datastream)); } return customCheckpointing; }</code><technical_language>Objects.requireNonNull() in place of datastream.getMetadata() != null</technical_language>

Target:
private boolean getCustomCheckpointing(DatastreamTask task) { boolean customCheckpointing = _connectors.get(task.getConnectorType()).isCustomCheckpointing(); Datastream datastream = task.getDatastreams().get(0); if (datastream.hasMetadata() && Objects.requireNonNull(datastream.getMetadata()).containsKey(DatastreamMetadataConstants.CUSTOM_CHECKPOINT)) { customCheckpointing = Boolean.parseBoolean( datastream.getMetadata().get(DatastreamMetadataConstants.CUSTOM_CHECKPOINT)); _log.info(String.format("Custom checkpointing overridden by metadata to be: %b for datastream: %s", customCheckpointing, datastream)); } return customCheckpointing; }
Source:
<code><START> protected Iterable<? extends PlotDatasetDto> assemble(Collection<LatencyRawData> rawDataList) { <END> List<PlotDatasetDto> plotDatasetDtoList = new ArrayList<PlotDatasetDto>(2); String sessionId = rawDataList.iterator().next().getSessionId(); List<PointDto> pointDtoLatencyList = new ArrayList<PointDto>(rawDataList.size()); List<PointDto> pointDtoLatencyStdDevList = new ArrayList<PointDto>(rawDataList.size()); for (LatencyRawData rawData : rawDataList) { double x = DataProcessingUtil.round(rawData.getTime() / 1000.0D); double yLatency = DataProcessingUtil.round(rawData.getLatency()); double yLatencyStdDev = DataProcessingUtil.round(rawData.getLatencyStdDev()); pointDtoLatencyList.add(new PointDto(x, yLatency)); pointDtoLatencyStdDevList.add(new PointDto(x, yLatencyStdDev)); } String legend = legendProvider.generatePlotLegend(sessionId, DefaultWorkloadParameters.LATENCY.getDescription(), true); PlotDatasetDto plotDatasetDto = new PlotDatasetDto(pointDtoLatencyList, legend, ColorCodeGenerator.getHexColorCode(ColorCodeGenerator.LATENCY_COLOR_ID_1, sessionId)); plotDatasetDtoList.add(plotDatasetDto); legend = legendProvider.generatePlotLegend(sessionId, DefaultWorkloadParameters.LATENCY_STD_DEV.getDescription(), true); plotDatasetDto = new PlotDatasetDto(pointDtoLatencyStdDevList, legend, ColorCodeGenerator.getHexColorCode(ColorCodeGenerator.LATENCY_COLOR_ID_2, sessionId)); plotDatasetDtoList.add(plotDatasetDto); return plotDatasetDtoList; }</code><technical_language>propose change signature of abstract assemble method assemble(MetricNameDto metricNameDto, Collection<T> rawData) in this case need getHexColorCode(int id, String sessionId)</technical_language>

Target:
protected Iterable<? extends PlotDatasetDto> assemble(Collection<LatencyRawData> rawDataList) { List<PlotDatasetDto> plotDatasetDtoList = new ArrayList<PlotDatasetDto>(2); String sessionId = rawDataList.iterator().next().getSessionId(); List<PointDto> pointDtoLatencyList = new ArrayList<PointDto>(rawDataList.size()); List<PointDto> pointDtoLatencyStdDevList = new ArrayList<PointDto>(rawDataList.size()); for (LatencyRawData rawData : rawDataList) { double x = DataProcessingUtil.round(rawData.getTime() / 1000.0D); double yLatency = DataProcessingUtil.round(rawData.getLatency()); double yLatencyStdDev = DataProcessingUtil.round(rawData.getLatencyStdDev()); pointDtoLatencyList.add(new PointDto(x, yLatency)); pointDtoLatencyStdDevList.add(new PointDto(x, yLatencyStdDev)); } String legend = legendProvider.generatePlotLegend(sessionId, DefaultWorkloadParameters.LATENCY.getDescription(), true); PlotDatasetDto plotDatasetDto = new PlotDatasetDto(pointDtoLatencyList, legend, ColorCodeGenerator.getHexColorCode(ColorCodeGenerator.LATENCY_COLOR, sessionId)); plotDatasetDtoList.add(plotDatasetDto); legend = legendProvider.generatePlotLegend(sessionId, DefaultWorkloadParameters.LATENCY_STD_DEV.getDescription(), true); plotDatasetDto = new PlotDatasetDto(pointDtoLatencyStdDevList, legend, ColorCodeGenerator.getHexColorCode(ColorCodeGenerator.LATENCY_STD_DEV_COLOR, sessionId)); plotDatasetDtoList.add(plotDatasetDto); return plotDatasetDtoList; }
Source:
<code><START> protected SessionFactory getSessionFactory() { <END> hibernateUtil.buildSessionFactory(); return hibernateUtil.getSessionFactory(); }</code><technical_language>I understand this method calls hibernatUtil.getSessionFactory. consolidate refactoring</technical_language>

Target:
protected SessionFactory getSessionFactory() { SessionFactory fact = null; HibernateUtil util = HibernateUtilFactory.getEventHibernateUtil(); if (util != null) { fact = util.getSessionFactory(); } return fact; }
Source:
<code>private Mono<Void> run(CancellationToken cancellationToken) { PartitionLoadBalancerImpl self = this; return Flux.just(self) .flatMap(value -> self.leaseContainer.getAllLeases()) .collectList() .flatMap(allLeases -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); List<Lease> leasesToTake = self.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); if (cancellationToken.isCancellationRequested()) return Mono.empty(); return Flux.fromIterable(leasesToTake) .flatMap(lease -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); return self.partitionController.addOrUpdateLease(lease); }) .then(); }) .repeat(() -> { if (cancellationToken.isCancellationRequested()) return false; long remainingWork = this.leaseAcquireInterval.toMillis(); try { while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { <START> Thread.sleep(100); <END> remainingWork -= 100; } } catch (InterruptedException ex) { logger.warn("Partition load balancer caught an interrupted exception", ex); } if (cancellationToken.isCancellationRequested()) return false; return true; }) .then() .onErrorResume(throwable -> { logger.info("Partition load balancer task stopped."); return this.stop(); }); }</code><technical_language>this is blocking call</technical_language>

Target:
private Mono<Void> run(CancellationToken cancellationToken) { return Flux.just(this) .flatMap(value -> this.leaseContainer.getAllLeases()) .collectList() .flatMap(allLeases -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); List<Lease> leasesToTake = this.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); if (cancellationToken.isCancellationRequested()) return Mono.empty(); return Flux.fromIterable(leasesToTake) .flatMap(lease -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); return this.partitionController.addOrUpdateLease(lease); }) .then(Mono.just(this) .flatMap(value -> { if (cancellationToken.isCancellationRequested()) { return Mono.empty(); } ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseAcquireInterval); return Mono.just(value) .delayElement(Duration.ofMillis(100)) .repeat( () -> { ZonedDateTime currentTime = ZonedDateTime.now(); return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); }).last(); }) ); }) .repeat(() -> { return !cancellationToken.isCancellationRequested(); }) .then() .onErrorResume(throwable -> { logger.info("Partition load balancer task stopped."); return this.stop(); }); }
Source:
<code>public CollectionConfig(String collection, Path collectionConfigs) { File matchingConfig = collectionConfigs.resolve(Paths.get(collection, "collection.properties")).toFile(); Properties collectionProps = new Properties(); if (matchingConfig.exists()) { try { <START> collectionProps.load(new FileInputStream(matchingConfig)); <END> } catch (IOException e) { LOGGER.debug("Unable to read matching collection properties file.", e); } } if (collectionProps.size() == 0) { File defaultConfig = collectionConfigs.resolve("default/collection.properties").toFile(); if (defaultConfig.exists()) { try { collectionProps.load(new FileInputStream(defaultConfig)); } catch (IOException e) { LOGGER.debug("Unable to read default collection properties file.", e); } } } shardCount = NumberUtils.toInt( collectionProps.getProperty("numShards", System.getProperty("solr.cloud.shardCount")), 2); replicationFactor = NumberUtils.toInt( collectionProps.getProperty( "replicationFactor", System.getProperty("solr.cloud.replicationFactor")), 2); maximumShardsPerNode = NumberUtils.toInt( collectionProps.getProperty( "maxShardsPerNode", System.getProperty("solr.cloud.maxShardPerNode")), 2); }</code><technical_language>creating this FileInputStream a try-with-resources? Properties::load states > stream remains open this method returns</technical_language>

Target:
public CollectionConfig(String collection, Path collectionConfigs) { File matchingConfig = collectionConfigs.resolve(Paths.get(collection, "collection.properties")).toFile(); Properties collectionProps = new Properties(); if (matchingConfig.exists()) { try (InputStream collectionConfigStream = new FileInputStream(matchingConfig)) { collectionProps.load(collectionConfigStream); } catch (IOException e) { LOGGER.debug("Unable to read matching collection properties file.", e); } } if (collectionProps.size() == 0) { File defaultConfig = collectionConfigs.resolve("default/collection.properties").toFile(); if (defaultConfig.exists()) { try (InputStream defaultConfigStream = new FileInputStream(defaultConfig)) { collectionProps.load(defaultConfigStream); } catch (IOException e) { LOGGER.debug("Unable to read default collection properties file.", e); } } } shardCount = NumberUtils.toInt( collectionProps.getProperty("numShards", System.getProperty("solr.cloud.shardCount")), 2); replicationFactor = NumberUtils.toInt( collectionProps.getProperty( "replicationFactor", System.getProperty("solr.cloud.replicationFactor")), 2); maximumShardsPerNode = NumberUtils.toInt( collectionProps.getProperty( "maxShardsPerNode", System.getProperty("solr.cloud.maxShardPerNode")), 2); }
Source:
<code>public void <START> setSwitchScale(float <END> scale) { mSwitchScale = scale; requestLayout(); }</code><technical_language>I ok expose this a public method yet. a default scaling for switches change</technical_language>

Target:
private void setSwitchScale(float scale) { mSwitchScale = scale; requestLayout(); }
Source:
<code>public String getLinkTemplate(ResourceMappingContext rmc) { <START> return InjectLinkFieldDescriptor.getLinkTemplate(rmc, link); <END> }</code><technical_language>I know, this call is technically OK - work, feel right. entire class shares a huge amount of code InjectLinkFieldDescriptor. I sense extract common parts abstract superclass do some other refactoring reduces amount of repeating code</technical_language>

Target:
public String getLinkTemplate(ResourceMappingContext rmc) { return LinkDescriptorUtil.getLinkTemplate(rmc, link); }
Source:
<code>public void testHashCode() { BoundDimFilter boundDimFilter = new BoundDimFilter("dimension", "12", "15", null, null, true, null); BoundDimFilter boundDimFilterWithExtract = new BoundDimFilter("dimension", "12", "15", null, null, true, extractionFn); <START> int hashCode = 1917945602; <END> int hashCodeWithExtract = hashCode + extractionFn.hashCode(); Assert.assertEquals(hashCode, boundDimFilter.hashCode()); Assert.assertEquals(hashCodeWithExtract, boundDimFilterWithExtract.hashCode()); }</code><technical_language>This test is brittle</technical_language>

Target:
public void testHashCode() { BoundDimFilter boundDimFilter = new BoundDimFilter("dimension", "12", "15", null, null, true, null); BoundDimFilter boundDimFilterWithExtract = new BoundDimFilter("dimension", "12", "15", null, null, true, extractionFn); Assert.assertNotEquals(boundDimFilter.hashCode(), boundDimFilterWithExtract.hashCode()); }
Source:
<code>@Test public void testResourceToString_ExistingResourceAtRootPackage() throws Exception { final long fileSize = new File(getClass().getResource("/test-file-utf8.bin").getFile()).length(); <START> final String content = IOUtils.resourceToString("/test-file-utf8.bin", Charset.defaultCharset()); <END> assertNotNull(content); assertEquals(fileSize, content.getBytes().length); }</code><technical_language>Charset.defaultCharset in other tests wrong is locale/environment dependent. StandardCharsets.UTF_8 more appropriate</technical_language>

Target:
@Test public void testResourceToString_ExistingResourceAtRootPackage() throws Exception { final long fileSize = new File(getClass().getResource("/test-file-utf8.bin").getFile()).length(); final String content = IOUtils.resourceToString("/test-file-utf8.bin", StandardCharsets.UTF_8); assertNotNull(content); assertEquals(fileSize, content.getBytes().length); }
Source:
<code>public static void retryDeadEvents(BaseActivity activity) { synchronized (sDeadApiEvents) { if (sDeadApiEvents.isEmpty()) { return; } List<ApiEvent<?>> deadApiEvents = sDeadApiEvents; sDeadApiEvents = new LinkedList<ApiEvent<?>>(); int activityid = activity.getActivityid(); if (activityid == -1) { <START> Log.w("Api", "Invalid activityid!"); <END> } for (ApiEvent<?> apiEvent : deadApiEvents) { if (activityid == apiEvent.mApiCall.mActivityid) { if (BuildConfig.DEBUG) { Log.i("Api", "Retrying dead event: " + apiEvent.getClass().getName()); } MainApplication.getBus().post(apiEvent); } else { if (BuildConfig.DEBUG) { Log.i("Api", "Adding dead event: " + apiEvent.getClass().toString()); } sDeadApiEvents.add(apiEvent); } } if (BuildConfig.DEBUG && sDeadApiEvents.size() > 0) { Log.i("Api", "Skipped " + sDeadApiEvents.size() + " dead events"); } } }</code><technical_language>Is intended ignore this going</technical_language>

Target:
public static void retryDeadEvents(BaseActivity activity) { synchronized (sDeadApiEvents) { if (sDeadApiEvents.isEmpty()) { return; } List<ApiEvent<?>> deadApiEvents = sDeadApiEvents; sDeadApiEvents = new LinkedList<ApiEvent<?>>(); int activityid = activity.getActivityid(); for (ApiEvent<?> apiEvent : deadApiEvents) { if (activityid == apiEvent.mApiCall.mActivityid) { if (BuildConfig.DEBUG) { Log.i("Api", "Retrying dead event: " + apiEvent.getClass().getName()); } MainApplication.getBus().post(apiEvent); } else { if (BuildConfig.DEBUG) { Log.i("Api", "Adding dead event: " + apiEvent.getClass().toString()); } sDeadApiEvents.add(apiEvent); } } if (BuildConfig.DEBUG && sDeadApiEvents.size() > 0) { Log.i("Api", "Skipped " + sDeadApiEvents.size() + " dead events"); } } }
Source:
<code>private API addSummary(API api) { HashMap<String, Integer> stats = getSystemStatistics(); ApiSummary summary = new ApiSummary(); <START> if (appMode != ApplicationMode.GlusterOnly) { <END> summary.setVMs(new VMs()); summary.getVMs().setTotal(get(stats, "total_vms")); summary.getVMs().setActive(get(stats, "active_vms")); } summary.setHosts(new Hosts()); summary.getHosts().setTotal(get(stats, "total_vds")); summary.getHosts().setActive(get(stats, "active_vds")); summary.setUsers(new Users()); summary.getUsers().setTotal(get(stats, "total_users")); summary.getUsers().setActive(get(stats, "active_users")); summary.setStorageDomains(new StorageDomains()); summary.getStorageDomains().setTotal(get(stats, "total_storage_domains")); summary.getStorageDomains().setActive(get(stats, "active_storage_domains")); api.setSummary(summary); return api; }</code><technical_language>needed dedicated addGlusterSummary()</technical_language>

Target:
private API addSummary(API api) { HashMap<String, Integer> stats = getSystemStatistics(); ApiSummary summary = new ApiSummary(); summary.setVMs(new VMs()); summary.getVMs().setTotal(get(stats, "total_vms")); summary.getVMs().setActive(get(stats, "active_vms")); summary.setHosts(new Hosts()); summary.getHosts().setTotal(get(stats, "total_vds")); summary.getHosts().setActive(get(stats, "active_vds")); summary.setUsers(new Users()); summary.getUsers().setTotal(get(stats, "total_users")); summary.getUsers().setActive(get(stats, "active_users")); summary.setStorageDomains(new StorageDomains()); summary.getStorageDomains().setTotal(get(stats, "total_storage_domains")); summary.getStorageDomains().setActive(get(stats, "active_storage_domains")); api.setSummary(summary); return api; }