auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Map<String, String> getRecordFilterOptions() { Map<String, String> ret = new HashMap<>(); ConfigurationService configuration = Framework.getService(ConfigurationService.class); <START> String value = configuration.getString(COMPUTATION_FILTER_STORE_KEY).orElse(null); <END> if (value != null) { ret.put(STORE_NAME_OPTION, value); } value = configuration.getString(COMPUTATION_FILTER_PREFIX_KEY).orElse(null); if (value != null) { ret.put(PREFIX_OPTION, value); } Integer intValue = configuration.getInteger(COMPUTATION_FILTER_THRESHOLD_SIZE_KEY).orElse(null); if (intValue != null) { ret.put(THRESHOLD_SIZE_OPTION, intValue.toString()); } Duration duration = configuration.getDuration(COMPUTATION_FILTER_STORE_TTL_KEY).orElse(null); if (duration != null) { ret.put(STORE_TTL_OPTION, Long.toString(duration.toSeconds())); } return ret; }</code><technical_language>do this: java configuration.getString(COMPUTATION_FILTER_STORE_KEY).ifPresent(value -> ret.put(STORE_NAME_OPTION, value));</technical_language>

Target:
protected Map<String, String> getRecordFilterOptions() { Map<String, String> ret = new HashMap<>(); ConfigurationService configuration = Framework.getService(ConfigurationService.class); configuration.getString(COMPUTATION_FILTER_STORE_KEY).ifPresent(value -> ret.put(STORE_NAME_OPTION, value)); configuration.getString(COMPUTATION_FILTER_PREFIX_KEY).ifPresent(value -> ret.put(PREFIX_OPTION, value)); configuration.getInteger(COMPUTATION_FILTER_THRESHOLD_SIZE_KEY) .ifPresent(value -> ret.put(THRESHOLD_SIZE_OPTION, value.toString())); configuration.getString(COMPUTATION_FILTER_STORE_TTL_KEY).ifPresent(value -> ret.put(STORE_TTL_OPTION, value)); return ret; }
Source:
<code>public void disconnect() throws NotConnectedException, PermissionException { try { restApi().disconnect(sid); <START> } catch (Exception e2) { <END> throwNCEOrPE(e2); } initialized = false; }</code><technical_language>variables e renamed e2</technical_language>

Target:
public void disconnect() throws NotConnectedException, PermissionException { try { restApi().disconnect(sid); } catch (Exception e) { throwNCEOrPE(e); } initialized = false; }
Source:
<code>private void removeImages() { for (final DiskImage source : getSourceImages()) { <START> if (source.getDiskStorageType() <END> == DiskStorageType.CINDER) { ImagesContainterParametersBase params = buildChildCommandParameters(source); Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveCinderSnapshotDisk, params, cloneContextAndDetachFromParent()); try { VdcReturnValueBase vdcReturnValueBase = future.get(); if (!vdcReturnValueBase.getSucceeded()) { log.error("Error removing snapshot for Cinder disk '{}'", source.getDiskAlias()); } } catch (InterruptedException | ExecutionException e) { log.error("Error removing snapshot for Cinder disk '{}': {}", source.getDiskAlias(), e.getMessage()); } continue; } List<DiskImage> images = getDiskImageDao().getAllSnapshotsForParent(source.getImageId()); DiskImage dest = null; if (!images.isEmpty()) { dest = images.get(0); } if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDisk) { VdcReturnValueBase vdcReturnValue = runInternalActionWithTasksContext( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest)); if (vdcReturnValue != null && vdcReturnValue.getInternalVdsmTaskIdList() != null) { getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); } } else { CommandCoordinatorUtil.executeAsyncCommand( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest), cloneContextAndDetachFromParent()); } List<Guid> quotasToRemoveFromCache = new ArrayList<>(); quotasToRemoveFromCache.add(source.getQuotaId()); if (dest != null) { quotasToRemoveFromCache.add(dest.getQuotaId()); } getQuotaManager().removeQuotaFromCache(getStoragePoolId(), quotasToRemoveFromCache); } }</code><technical_language>please extract this logic a separate method</technical_language>

Target:
private void removeImages() { for (final DiskImage source : getSourceImages()) { if (source.getDiskStorageType() == DiskStorageType.CINDER) { handleCinderSnapshotDisk(source); continue; } List<DiskImage> images = getDiskImageDao().getAllSnapshotsForParent(source.getImageId()); DiskImage dest = null; if (!images.isEmpty()) { dest = images.get(0); } if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDisk) { VdcReturnValueBase vdcReturnValue = runInternalActionWithTasksContext( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest)); if (vdcReturnValue != null && vdcReturnValue.getInternalVdsmTaskIdList() != null) { getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); } } else { CommandCoordinatorUtil.executeAsyncCommand( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest), cloneContextAndDetachFromParent()); } List<Guid> quotasToRemoveFromCache = new ArrayList<>(); quotasToRemoveFromCache.add(source.getQuotaId()); if (dest != null) { quotasToRemoveFromCache.add(dest.getQuotaId()); } getQuotaManager().removeQuotaFromCache(getStoragePoolId(), quotasToRemoveFromCache); } }
Source:
<code>public void serialize(TypeToken<?> type, TextTemplate obj, ConfigurationNode value) throws ObjectMappingException { value.getNode(NODE_OPTIONS, NODE_OPEN_ARG).setValue(obj.getOpenArgString()); value.getNode(NODE_OPTIONS, NODE_CLOSE_ARG).setValue(obj.getCloseArgString()); <START> value.getNode(NODE_ARGS).setValue(new TypeToken<Map<String, TextTemplate.Arg>>() {}, obj.getArguments()); <END> value.getNode(NODE_CONTENT).setValue(TypeToken.of(Text.class), obj.toText()); }</code><technical_language>IMO store type tokens in a constant somewhere</technical_language>

Target:
public void serialize(TypeToken<?> type, TextTemplate obj, ConfigurationNode value) throws ObjectMappingException { value.getNode(NODE_OPTIONS, NODE_OPEN_ARG).setValue(obj.getOpenArgString()); value.getNode(NODE_OPTIONS, NODE_CLOSE_ARG).setValue(obj.getCloseArgString()); value.getNode(NODE_ARGS).setValue(TOKEN_ARGS, obj.getArguments()); value.getNode(NODE_CONTENT).setValue(TOKEN_TEXT, obj.toText()); }
Source:
<code>private Collection<File> getPluginFiles() throws IOException { if (pluginsDir == null || !pluginsDir.exists()) { return Collections.emptyList(); } <START> return FileUtils.listFiles(pluginsDir, new String[] {"jar"}, false); <END> }</code><technical_language>I idea of depending commons-io for this trivial of a function, I guess I losing argument. :-)</technical_language>

Target:
private List<File> getPluginFiles() throws IOException { if (pluginsDir == null || !pluginsDir.exists()) { return Collections.emptyList(); } return Arrays.asList(pluginsDir.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".jar"); } })); }
Source:
<code>public void afterRefreshTreatment() { try { <START> prometheusClient.close(); <END> } catch (IOException e) { } }</code><technical_language>pls verify prometheusClient is null</technical_language>

Target:
public void afterRefreshTreatment() { try { if (prometheusClient != null) { prometheusClient.close(); } } catch (IOException e) { } }
Source:
<code>public List<T> getFreeNodes() { List<T> result = Lists.newArrayList(); <START> result.addAll(difference(m_nodesReady, m_outgoingEdges.keySet())); <END> if (result.isEmpty() && m_nodesRunning.isEmpty()) { int lowestPriority = getLowestEdgeWeight(m_nodesReady); for (T node : m_nodesReady) { if (hasAllEdgesWithWeight(m_outgoingEdges, node, lowestPriority)) { result.add(node); } } } List<T> finalResult = Lists.newArrayList(); for (T node : result) { Map<T, Integer> edges = m_outgoingEdges.get(node); if (edges == null || Collections.disjoint(edges.keySet(), result)) { finalResult.add(node); } } return finalResult; }</code><technical_language>Maybe: java List<T> result = Lists.newArrayList(difference(m_nodesReady, m_outgoingEdges.keySet()));</technical_language>

Target:
public List<T> getFreeNodes() { Set<T> free = Sets.newLinkedHashSet(m_nodesReady); free.removeAll(m_edges.fromNodes()); if (free.isEmpty() && m_nodesRunning.isEmpty()) { int lowestWeight = m_edges.getLowestEdgeWeight(m_nodesReady); for (T node : m_nodesReady) { if (m_edges.hasAllEdgesWithWeight(node, lowestWeight)) { free.add(node); } } } List<T> finalResult = Lists.newArrayList(); for (T node : free) { Map<T, Integer> edges = m_edges.from(node); if (edges == null || Collections.disjoint(edges.keySet(), free)) { finalResult.add(node); } } return finalResult; }
Source:
<code>Mono<Response<Document>> getDocumentWithResponse( String key, List<String> selectedFields, RequestOptions requestOptions, Context context) { return restClient .documents() .getWithRestResponseAsync(key, selectedFields, requestOptions, context) .map(res -> { Document doc = res.getValue(); DocumentResponseConversions.cleanupDocument(doc); return new SimpleResponse<>(res, doc); }) .onErrorMap(DocumentResponseConversions::exceptionMapper) <START> .map(Function.identity()); <END> }</code><technical_language>question this map</technical_language>

Target:
Mono<Response<Document>> getDocumentWithResponse( String key, List<String> selectedFields, RequestOptions requestOptions, Context context) { try { return restClient .documents() .getWithRestResponseAsync(key, selectedFields, requestOptions, context) .map(res -> { Document doc = res.getValue(); DocumentResponseConversions.cleanupDocument(doc); return new SimpleResponse<>(res, doc); }) .onErrorMap(DocumentResponseConversions::exceptionMapper) .map(Function.identity()); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>private void loadMachineUUID() { if <START> (System.getProperty(PROP_UUID) != <END> null) return; String uuid = loadExistingUUID(); if (uuid == null) { uuid = UUID.randomUUID().toString(); saveUUID(uuid); } EnvironmentInfo environment = environmentTracker.getService(); if (environment != null) { environment.setProperty(PROP_UUID, uuid); } else { System.setProperty(PROP_UUID, uuid); } }</code><technical_language>BundleContext.getProperty here, EnvonmentInfo service</technical_language>

Target:
private void loadMachineUUID() { EnvironmentInfo environment = environmentTracker.getService(); if (environment != null) { if (environment.getProperty(PROP_UUID) != null) return; } String uuid = loadExistingUUID(); if (uuid == null) { uuid = UUID.randomUUID().toString(); saveUUID(uuid); } if (environment != null) { environment.setProperty(PROP_UUID, uuid); } else { System.setProperty(PROP_UUID, uuid); } }
Source:
<code>public TypedValueSelector makeSelectorForType(final String type) { <START> if (BuiltInType.DATE.getName().equals(type)) { <END> return dateSelector; } return genericSelector; }</code><technical_language>please Objects.equals(BuiltInType.DATE.getName(), type)? I propose return NPE passed type is null</technical_language>

Target:
public TypedValueSelector makeSelectorForType(final String type) { if (Objects.equals(BuiltInType.DATE.getName(), type)) { return dateSelector; } return genericSelector; }
Source:
<code>protected HttpAction redirectToIdentityProvider(final C context, final List<Client> currentClients) { final IndirectClient currentClient = (IndirectClient) currentClients.get(0); <START> return (HttpAction) currentClient.redirect(context).get(); <END> }</code><technical_language>get()</technical_language>

Target:
protected HttpAction redirectToIdentityProvider(final C context, final List<Client> currentClients) { final IndirectClient currentClient = (IndirectClient) currentClients.get(0); return currentClient.redirect(context); }
Source:
<code>private String randomTwoChoices() { int randomPosition = ThreadLocalRandom.current().nextInt(activeNodes.size()); int randomOffset = ThreadLocalRandom.current().nextInt(1, activeNodes.size()); String candidate1 = activeNodes.get(randomPosition); String candidate2 = activeNodes.get((randomPosition + randomOffset) % activeNodes.size()); <START> if (nodeBucketCounts.get(candidate2) < nodeBucketCounts.get(candidate1)) { <END> candidate1 = candidate2; } return candidate1; }</code><technical_language>I this a bit easier read java return (nodeBucketCounts.get(candidate1) <= nodeBucketCounts.get(candidate2)) ? candidate1 : candidate2; assignment strange</technical_language>

Target:
private String randomTwoChoices() { int randomPosition = ThreadLocalRandom.current().nextInt(activeNodes.size()); int randomOffset = ThreadLocalRandom.current().nextInt(1, activeNodes.size()); String candidate1 = activeNodes.get(randomPosition); String candidate2 = activeNodes.get((randomPosition + randomOffset) % activeNodes.size()); return (nodeBucketCounts.get(candidate1) <= nodeBucketCounts.get(candidate2)) ? candidate1 : candidate2; }
Source:
<code>public void testOSVersion() { SystemInfo si = new SystemInfo(); OperatingSystem os = si.getOperatingSystem(); assertNotNull(os.getFamily()); assertNotNull(os.getManufacturer()); OperatingSystemVersion version = os.getVersion(); assertNotNull(version); assertNotNull(version.getVersion()); assertNotNull(version.getCodeName()); assertNotNull(version.getBuildNumber()); <START> assertTrue(os.getOpenDescriptors() >= -1L); <END> assertTrue(os.getMaxDescriptors() >= -1L); }</code><technical_language>This is worthy of testing >=0 a platform check for mac linux. test for getSystemLoadAverage() for example</technical_language>

Target:
public void testOSVersion() { SystemInfo si = new SystemInfo(); OperatingSystem os = si.getOperatingSystem(); assertNotNull(os.getFamily()); assertNotNull(os.getManufacturer()); OperatingSystemVersion version = os.getVersion(); assertNotNull(version); assertNotNull(version.getVersion()); assertNotNull(version.getCodeName()); assertNotNull(version.getBuildNumber()); }
Source:
<code>public List<EmailWrapper> generateFeedbackSessionReminderEmails( FeedbackSessionAttributes session, List<StudentAttributes> students, List<InstructorAttributes> instructorsToRemind, List<InstructorAttributes> instructorsToNotify) { CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); String template = EmailTemplates.USER_FEEDBACK_SESSION <START> .replace("${status}", FEEDBACK_STATUS_SESSION_OPEN); <END> StringBuffer additionalContactInformation = new StringBuffer(getAdditionalContactInformationFragment(course)); additionalContactInformation.insert(0, HTML_NO_ACTION_REQUIRED); List<EmailWrapper> emails = generateFeedbackSessionEmailBasesForInstructorReminders(course, session, instructorsToRemind, template, EmailType.FEEDBACK_SESSION_REMINDER.getSubject()); emails.addAll(generateFeedbackSessionEmailBases(course, session, students, instructorsToNotify, template, EmailType.FEEDBACK_SESSION_REMINDER.getSubject(), FEEDBACK_ACTION_SUBMIT, additionalContactInformation.toString())); return emails; }</code><technical_language>This previous line, leaving line unchanged</technical_language>

Target:
public List<EmailWrapper> generateFeedbackSessionReminderEmails( FeedbackSessionAttributes session, List<StudentAttributes> students, List<InstructorAttributes> instructorsToRemind, List<InstructorAttributes> instructorsToNotify) { CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); String template = EmailTemplates.USER_FEEDBACK_SESSION.replace("${status}", FEEDBACK_STATUS_SESSION_OPEN); String additionalContactInformation = HTML_NO_ACTION_REQUIRED + getAdditionalContactInformationFragment(course); List<EmailWrapper> emails = generateFeedbackSessionEmailBasesForInstructorReminders(course, session, instructorsToRemind, template, EmailType.FEEDBACK_SESSION_REMINDER.getSubject()); emails.addAll(generateFeedbackSessionEmailBases(course, session, students, instructorsToNotify, template, EmailType.FEEDBACK_SESSION_REMINDER.getSubject(), FEEDBACK_ACTION_SUBMIT, additionalContactInformation)); return emails; }
Source:
<code>public List<StudyEntryDto> getStudyEntries(final int studyId, final StudyEntrySearchDto.Filter filter, final Pageable pageable) { final Integer plotDatasetId = datasetService.getDatasets(studyId, new HashSet<>(Arrays.asList(DatasetTypeEnum.PLOT_DATA.getId()))).get(0).getDatasetId(); final List<MeasurementVariable> entryDescriptors = this.datasetService.getObservationSetVariables(plotDatasetId, Lists .newArrayList(VariableType.GERMPLASM_DESCRIPTOR.getId())); final List<Integer> termsToRemove = Lists .newArrayList(TermId.ENTRY_CODE.getId(), TermId.DESIG.getId(), TermId.ENTRY_NO.getId(), TermId.GID.getId(), <START> TermId.OBS_UNIT_ID.getId(), TermId.STOCKID.getId()); <END> for (Iterator<MeasurementVariable> i = entryDescriptors.iterator(); i.hasNext(); ) { final MeasurementVariable measurementVariable = i.next(); if (termsToRemove.contains(measurementVariable.getTermId())) { i.remove(); } } final List<StudyEntryDto> studyEntryDtos = this.daoFactory.getStockDao().getStudyEntries(new StudyEntrySearchDto(studyId, entryDescriptors, filter), pageable); return studyEntryDtos; }</code><technical_language>Extract list of standard germplasm descriptor IDs class constant</technical_language>

Target:
public List<StudyEntryDto> getStudyEntries(final int studyId, final StudyEntrySearchDto.Filter filter, final Pageable pageable) { final Integer plotDatasetId = datasetService.getDatasets(studyId, new HashSet<>(Collections.singletonList(DatasetTypeEnum.PLOT_DATA.getId()))).get(0).getDatasetId(); final List<MeasurementVariable> entryDescriptors = this.datasetService.getObservationSetVariables(plotDatasetId, Lists .newArrayList(VariableType.GERMPLASM_DESCRIPTOR.getId())); final List<MeasurementVariable> fixedEntryDescriptors = entryDescriptors.stream().filter(d -> FIXED_GERMPLASM_DESCRIPTOR_IDS.contains(d.getTermId())).collect( Collectors.toList()); final List<MeasurementVariable> variableEntryDescriptors = entryDescriptors.stream().filter(d -> !REMOVABLE_GERMPLASM_DESCRIPTOR_IDS.contains(d.getTermId())).collect( Collectors.toList()); return this.daoFactory.getStockDao() .getStudyEntries(new StudyEntrySearchDto(studyId, fixedEntryDescriptors, variableEntryDescriptors, filter), pageable); }
Source:
<code>private static <C extends JdbiConfig<C>> C create(Class<C> configClass) { try { <START> return configClass.newInstance(); <END> } catch (ReflectiveOperationException e) { throw new IllegalStateException("Unable to instantiate config class " + configClass + ". Is there a public no-arg constructor?"); } }</code><technical_language>understanding is Class.newInstance() is deprecated in Java 9 in preference of Class.getDeclaredConstructors()[0].newInstance() (due exception transparency). a huge issue, pre-emptively do "new way"</technical_language>

Target:
private static <C extends JdbiConfig<C>> C create(Class<C> configClass) { try { return configClass.getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new IllegalStateException("Unable to instantiate config class " + configClass + ". Is there a public no-arg constructor?"); } }
Source:
<code>public List<Location> getLocationsByType(final Integer type) throws MiddlewareQueryException { <START> return this.getAllByMethod(this.getLocationDao(), GET_BY_TYPE, new Object[] { type }, <END> new Class[] { Integer.class }); }</code><technical_language>replace LocationDataManagerImpl.GET_BY_TYPE</technical_language>

Target:
public List<Location> getLocationsByType(final Integer type) throws MiddlewareQueryException { return this.getAllByMethod(this.getLocationDao(), LocationDataManagerImpl.GET_BY_TYPE, new Object[] { type }, new Class[] { Integer.class }); }
Source:
<code>private MetricsQuery buildCountComparisonQuery(final Task task) { final Consumer<Metric.Builder> setCommonFields = builder -> builder .setAggregators(ImmutableList.of( <START> new Aggregator.Builder() <END> .setName("count") .setSampling(new Sampling.Builder().setUnit(task.getPeriod().getSamplingUnit()).setValue(1).build()) .setAlignSampling(true) .setAlignStartTime(true) .build()) ); return new MetricsQuery.Builder() .setStartTime(task.getStartTime()) .setEndTime(task.getStartTime().plus(task.getPeriod().periodCountToDuration(1)).minusMillis(1)) .setMetrics(ImmutableList.of( ThreadLocalBuilder.build(Metric.Builder.class, b -> { setCommonFields.accept(b); b.setName(task.getSourceMetricName()); }), ThreadLocalBuilder.build(Metric.Builder.class, b -> { setCommonFields.accept(b); b.setName(task.getRollupMetricName()); }) )).build(); }</code><technical_language>Is Aggregator TLB</technical_language>

Target:
private MetricsQuery buildCountComparisonQuery(final Task task) { final Consumer<Metric.Builder> setCommonFields = builder -> builder .setAggregators(ImmutableList.of( ThreadLocalBuilder.build(Aggregator.Builder.class, aggb -> aggb .setName("count") .setSampling(ThreadLocalBuilder.build(Sampling.Builder.class, sb -> sb .setUnit(task.getPeriod().getSamplingUnit()).setValue(1).build() )) .setAlignSampling(true) .setAlignStartTime(true) )) ); return ThreadLocalBuilder.build(MetricsQuery.Builder.class, mqb -> mqb .setStartTime(task.getStartTime()) .setEndTime(task.getStartTime().plus(task.getPeriod().periodCountToDuration(1)).minusMillis(1)) .setMetrics(ImmutableList.of( ThreadLocalBuilder.build(Metric.Builder.class, mb -> { setCommonFields.accept(mb); mb.setName(task.getSourceMetricName()); }), ThreadLocalBuilder.build(Metric.Builder.class, mb -> { setCommonFields.accept(mb); mb.setName(task.getRollupMetricName()); }) )) ); }
Source:
<code>public void testBadSegmentSubResourceNumber() throws UnsupportedEncodingException, URISyntaxException { String requestPath = "/mediaexpectedOpOrId/Segment/notAnInteger"; List<String> prefixesToRemove = new ArrayList<>(); RestRequest restRequest = RestUtilsTest.createRestRequest(RestMethod.GET, requestPath, null); try { RequestPath.parse(restRequest, prefixesToRemove, CLUSTER_NAME); } catch (RestServiceException e) { assertTrue(e.getErrorCode().equals(RestServiceErrorCode.BadRequest)); return; } <START> fail(); <END> }</code><technical_language>minor: move fail() line 144 remove return line 147</technical_language>

Target:
public void testBadSegmentSubResourceNumber() throws UnsupportedEncodingException, URISyntaxException { String requestPath = "/mediaexpectedOpOrId/Segment/notAnInteger"; List<String> prefixesToRemove = new ArrayList<>(); RestRequest restRequest = RestUtilsTest.createRestRequest(RestMethod.GET, requestPath, null); try { RequestPath.parse(restRequest, prefixesToRemove, CLUSTER_NAME); fail(); } catch (RestServiceException e) { assertTrue(e.getErrorCode().equals(RestServiceErrorCode.BadRequest)); } }
Source:
<code>public synchronized void activate(Cluster maybeUpdatedCluster, String licenseContent) { if (isActivated()) { throw new IllegalStateException("Node is already activated"); } LOGGER.info("Preparing activation of cluster: {}", maybeUpdatedCluster.toShapeString()); if (findMe(maybeUpdatedCluster) == null) { throw new IllegalArgumentException(String.format( "No match found for node: %s in cluster topology: %s", upcomingNodeContext.getNodeUID(), maybeUpdatedCluster )); } this.setUpcomingCluster(maybeUpdatedCluster); this.installLicense(licenseContent); LOGGER.info("Preparing activation of Node with validated topology: {}", upcomingNodeContext.getCluster().toShapeString()); nomadServerManager.upgradeForWrite(); LOGGER.debug("Setting nomad writable successful"); clusterActivated = true; LOGGER.info("Node activation successful"); <START> warnIfProblematicConsistency(runtimeNodeContext); <END> }</code><technical_language>This is safer more true upcomingNodeContext here</technical_language>

Target:
public synchronized void activate(Cluster maybeUpdatedCluster, String licenseContent) { if (isActivated()) { throw new IllegalStateException("Node is already activated"); } LOGGER.info("Preparing activation of cluster: {}", maybeUpdatedCluster.toShapeString()); if (findMe(maybeUpdatedCluster) == null) { throw new IllegalArgumentException(String.format( "No match found for node: %s in cluster topology: %s", upcomingNodeContext.getNodeUID(), maybeUpdatedCluster )); } this.setUpcomingCluster(maybeUpdatedCluster); this.installLicense(licenseContent); LOGGER.info("Preparing activation of Node with validated topology: {}", upcomingNodeContext.getCluster().toShapeString()); nomadServerManager.upgradeForWrite(); LOGGER.debug("Setting nomad writable successful"); clusterActivated = true; LOGGER.info("Node activation successful"); warnIfProblematicConsistency(upcomingNodeContext); }
Source:
<code>public Collection<IDataProviderDescriptor> getDescriptors(ITmfTrace trace) { Iterable<ISegmentStoreProvider> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, ISegmentStoreProvider.class); List<IDataProviderDescriptor> descriptors = new ArrayList<>(); Set<String> existingModules = new HashSet<>(); for (ISegmentStoreProvider module : modules) { IAnalysisModule analysis = (IAnalysisModule) module; if (!existingModules.contains(analysis.getId())) { DataProviderDescriptor.Builder builder = new DataProviderDescriptor.Builder(); builder.setId(SegmentStoreScatterDataProvider.ID + <START> ':' + <END> analysis.getId()) .setName(Objects.requireNonNull(NLS.bind(Messages.SegmentStoreScatterGraphDataProvider_title, analysis.getName()))) .setDescription(Objects.requireNonNull(NLS.bind(Messages.SegmentStoreScatterGraphDataProvider_description, analysis.getName()))) .setProviderType(ProviderType.TREE_TIME_XY); descriptors.add(builder.build()); } } return descriptors; }</code><technical_language>work, need client server encoding/decoding correctly</technical_language>

Target:
public Collection<IDataProviderDescriptor> getDescriptors(ITmfTrace trace) { Iterable<ISegmentStoreProvider> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, ISegmentStoreProvider.class); List<IDataProviderDescriptor> descriptors = new ArrayList<>(); Set<String> existingModules = new HashSet<>(); for (ISegmentStoreProvider module : modules) { IAnalysisModule analysis = (IAnalysisModule) module; if (!existingModules.contains(analysis.getId())) { DataProviderDescriptor.Builder builder = new DataProviderDescriptor.Builder(); builder.setId(SegmentStoreScatterDataProvider.ID + DataProviderConstants.ID_SEPARATOR + analysis.getId()) .setName(Objects.requireNonNull(NLS.bind(Messages.SegmentStoreScatterGraphDataProvider_title, analysis.getName()))) .setDescription(Objects.requireNonNull(NLS.bind(Messages.SegmentStoreScatterGraphDataProvider_description, analysis.getHelpText()))) .setProviderType(ProviderType.TREE_TIME_XY); descriptors.add(builder.build()); } } return descriptors; }
Source:
<code>public void start() { if (started) { <START> return; <END> } synchronized (startStopLock) { if (started) { return; } regionNormalizerTracker.start(); if (worker != null) { pool.submit(worker); } started = true; } }</code><technical_language>Good. Remove this check of started is sync block. anyways, lock is narrow... check of started synchronized right</technical_language>

Target:
public void start() { synchronized (startStopLock) { if (started) { return; } regionNormalizerTracker.start(); if (worker != null) { pool.submit(worker); } started = true; } }
Source:
<code>public static Object getValue(Type type, Object value) { if (type.equals(BIGINT)) { return (long) value; } else if (type.equals(INTEGER)) { return ((Number) value).intValue(); } else if (type.equals(DOUBLE)) { return (double) value; } else if (type.equals(VARCHAR)) { return ((Slice) value).toStringUtf8(); } else if (type.equals(BOOLEAN)) { return (boolean) value; } <START> else { <END> throw new UnsupportedOperationException("Query Builder can't handle type: " + type); } }</code><technical_language>need else</technical_language>

Target:
private static Object getValue(Type type, Object value) { if (type.equals(BIGINT)) { return value; } else if (type.equals(INTEGER)) { return ((Number) value).intValue(); } else if (type.equals(DOUBLE)) { return value; } else if (type.equals(VARCHAR)) { return ((Slice) value).toStringUtf8(); } else if (type.equals(BOOLEAN)) { return value; } throw new UnsupportedOperationException("Query Builder can't handle type: " + type); }
Source:
<code>private List<Path> getFileDirectoriesAsPaths() { List<Path> fileDirs = new ArrayList<>(); MetaData metaData = basePanel.getBibDatabaseContext().getMetaData(); metaData.getLaTexFileDirectory(prefs.getFilePreferences().getUser()) <START> .ifPresent(LaTexFileDirectory -> fileDirs.add(Paths.get(LaTexFileDirectory).toAbsolutePath().normalize())); <END> return fileDirs; }</code><technical_language>metadata return directory a path object. strings leads duplicate code (as happened too, this exact line too) try special objects possible. In spirit, I prefer if setter in metadata accepts a path</technical_language>

Target:
private List<Path> getFileDirectoriesAsPaths() { List<Path> fileDirs = new ArrayList<>(); MetaData metaData = basePanel.getBibDatabaseContext().getMetaData(); metaData.getLaTexFileDirectory(prefs.getFilePreferences().getUser()) .ifPresent(laTexFileDirectory -> fileDirs.add(laTexFileDirectory)); return fileDirs; }
Source:
<code>public UpdateWorker(@NonNull Context appContext, @NonNull WorkerParameters workerParams) { super(appContext, workerParams); restApi = RestServiceBuilder.createService(RestApi.class); logger = new OpenMRSLogger(); mHandler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { String responseMessage; switch (msg.what) { case ON_SUCCESS: <START> String UpdateSuccessPatientName = (String) msg.obj; <END> ToastUtil.success("Patient " + UpdateSuccessPatientName + " updated"); break; case ON_FAILURE: String UpdateFailedPatientName = (String) msg.obj; ToastUtil.error("Patient " + UpdateFailedPatientName + " cannot be updated due to server error will retry sync "); break; case ON_SUCCESS_PHOTO_UPDATE: responseMessage = (String) msg.obj; ToastUtil.error("Patient photo cannot be synced due to server error: " + responseMessage); break; case ON_FAILURE_PHOTO_UPDATE: responseMessage = (String) msg.obj; ToastUtil.notify("Patient photo cannot be synced due to error: " + responseMessage); } super.handleMessage(msg); } }; }</code><technical_language>Please follow java conventions. suggestion String updateSuccessPatientName = (String) msg.obj;</technical_language>

Target:
public UpdateWorker(@NonNull Context appContext, @NonNull WorkerParameters workerParams) { super(appContext, workerParams); restApi = RestServiceBuilder.createService(RestApi.class); logger = new OpenMRSLogger(); mHandler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { String responseMessage; switch (msg.what) { case ON_SUCCESS: String updateSuccessPatientName = (String) msg.obj; ToastUtil.success(Resources.getSystem().getString(R.string.patient_update_successful, updateSuccessPatientName)); break; case ON_FAILURE: String updateFailedPatientName = (String) msg.obj; ToastUtil.error(Resources.getSystem().getString(R.string.patient_update_unsuccessful, updateFailedPatientName)); break; case ON_UNSUCCESSFUL_RESPONSE_PHOTO_UPDATE: responseMessage = (String) msg.obj; ToastUtil.error(Resources.getSystem().getString(R.string.patient_photo_update_unsuccessful, responseMessage)); case ON_FAILURE_RESPONSE_PHOTO_UPDATE: responseMessage = (String) msg.obj; ToastUtil.notify(Resources.getSystem().getString(R.string.patient_photo_update_unsuccessful, responseMessage)); } super.handleMessage(msg); } }; }
Source:
<code>public void loadDataWithBaseURL(@Nullable String baseUrl, String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl) { if (!AbstractFlashcardViewer.this.wasDestroyed()) { super.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl); } else { <START> Timber.w("Now loading card - Activity is in the process of being destroyed."); <END> } }</code><technical_language>suggestion Timber.w("Not loading card - Activity is in process of destroyed.");</technical_language>

Target:
public void loadDataWithBaseURL(@Nullable String baseUrl, String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl) { if (!AbstractFlashcardViewer.this.wasDestroyed()) { super.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl); } else { Timber.w("Not loading card - Activity is in the process of being destroyed."); } }
Source:
<code>public void setNameAndPresetDefaults(String presetSubtypeName) { String faction = entity.getFaction(); String nameTag = "entity.ancientwarfarenpc." + faction + "." + presetSubtypeName + "." + "name"; entity.setCustomNameTag(I18n.translateToLocal(nameTag)); String[] spells = (NpcDefaultsRegistry.getFactionNpcDefault(entity.getFaction(), presetSubtypeName).getSpells()).split(","); for (String spell : spells) { try { Spell spellObj = Spell.get(spell); addSpell(spellObj); } <START> catch (NullPointerException n) { <END> AncientWarfareNPC.LOG.warn("Couldn't assign spell " + spell + " in preset of " + nameTag); } } int basehealth = (int) NpcDefaultsRegistry.getFactionNpcDefault(entity.getFaction(), presetSubtypeName).getBaseHealth(); System.out.println("basehealth: " + basehealth); maxHealth = (int) (basehealth); skinSettings.setSkinType(NpcSkinSettings.SkinType.NPC_TYPE); skinSettings.setRandom(true); skinSettings.setNpcTypeName(faction + "." + presetSubtypeName); }</code><technical_language>This catch absolutely necessary. I a of figuring out if is null need catch exception (my guess is this is Spell.get return null in case addSpell call wrapped in a condition spell null)</technical_language>

Target:
public void setNameAndPresetDefaults(String presetSubtypeName) { String faction = entity.getFaction(); String nameTag = "entity.ancientwarfarenpc." + faction + "." + presetSubtypeName + "." + "name"; entity.setCustomNameTag(I18n.translateToLocal(nameTag)); String[] spells = (NpcDefaultsRegistry.getFactionNpcDefault(entity.getFaction(), presetSubtypeName).getSpells()).split(","); for (String spell : spells) { Spell spellObj = Spell.get(spell); addSpell(spellObj); } int basehealth = (int) NpcDefaultsRegistry.getFactionNpcDefault(entity.getFaction(), presetSubtypeName).getBaseHealth(); maxHealth = (int) (basehealth); skinSettings.setSkinType(NpcSkinSettings.SkinType.NPC_TYPE); skinSettings.setRandom(true); skinSettings.setNpcTypeName(faction + "." + presetSubtypeName); }
Source:
<code>public void validate(Element element, ElementValidation validation) { injectHelper.validate(FragmentArg.class, element, validation); validatorHelper.isNotPrivate(element, validation); <START> Element param = element; <END> if (element instanceof ExecutableElement) { param = ((ExecutableElement) element).getParameters().get(0); } validatorHelper.canBePutInABundle(param, validation); }</code><technical_language>I this construct multiple times, moved a helper method</technical_language>

Target:
public void validate(Element element, ElementValidation validation) { injectHelper.validate(FragmentArg.class, element, validation); validatorHelper.isNotPrivate(element, validation); Element param = injectHelper.getParam(element); validatorHelper.canBePutInABundle(param, validation); }
Source:
<code>public int run() throws IOException { mMetricsMap = mMetricsMasterClient.getMetrics(); SortedSet<String> names = new TreeSet<>(mMetricsMap.keySet()); for (String name : names) { if (!isAlluxioMetric(name)) { continue; } MetricValue metricValue = mMetricsMap.get(name); String strValue; if (metricValue.hasStringValue()) { strValue = metricValue.getStringValue(); } else { double doubleValue = metricValue.getDoubleValue(); if (name.contains(BYTES_METRIC_IDENTIFIER)) { strValue = FormatUtils.getSizeFromBytes((long) doubleValue); if (name.contains(THROUGHPUT_METRIC_IDENTIFIER)) { <START> strValue = strValue + "/SEC"; <END> } } else if (DoubleMath.isMathematicalInteger(doubleValue)) { strValue = DECIMAL_FORMAT.format((long) doubleValue); } else { strValue = String.valueOf(doubleValue); } } mPrintStream.printf(INFO_FORMAT, name, metricValue.getMetricType(), strValue); } return 0; }</code><technical_language>nit: is a reason this caps</technical_language>

Target:
public int run() throws IOException { mMetricsMap = mMetricsMasterClient.getMetrics(); SortedSet<String> names = new TreeSet<>(mMetricsMap.keySet()); for (String name : names) { if (!isAlluxioMetric(name)) { continue; } MetricValue metricValue = mMetricsMap.get(name); String strValue; if (metricValue.hasStringValue()) { strValue = metricValue.getStringValue(); } else { double doubleValue = metricValue.getDoubleValue(); if (name.contains(BYTES_METRIC_IDENTIFIER)) { strValue = FormatUtils.getSizeFromBytes((long) doubleValue); if (name.contains(THROUGHPUT_METRIC_IDENTIFIER)) { strValue = strValue + "/MIN"; } } else if (DoubleMath.isMathematicalInteger(doubleValue)) { strValue = DECIMAL_FORMAT.format((long) doubleValue); } else { strValue = String.valueOf(doubleValue); } } mPrintStream.printf(INFO_FORMAT, name, metricValue.getMetricType(), strValue); } return 0; }
Source:
<code>public static File[] getExtensionFilesToLoad(ExtensionsConfig config) { File[] extensionsToLoad; final File rootExtensionsDir = new File(config.getExtensionsDir()); final List<String> toLoad = config.getToLoad(); if (toLoad == null) { extensionsToLoad = rootExtensionsDir.exists() ? rootExtensionsDir.listFiles() : new File[]{}; } else { int i = 0; extensionsToLoad = new File[toLoad.size()]; for (final String extensionName : toLoad) { final File extensionDir = new File(rootExtensionsDir, extensionName); if (!extensionDir.exists()) { <START> throw new RuntimeException( <END> String.format( "Extension [%s] specified in \"druid.extensions.toLoad\" didn't exist!?", extensionDir.getAbsolutePath() ) ); } extensionsToLoad[i++] = extensionDir; } } return extensionsToLoad; }</code><technical_language>ISE is here</technical_language>

Target:
public static File[] getExtensionFilesToLoad(ExtensionsConfig config) { final File rootExtensionsDir = new File(config.getDirectory()); if (rootExtensionsDir.exists() && !rootExtensionsDir.isDirectory()) { throw new ISE("Root extensions directory [%s] is not a directory!?", rootExtensionsDir); } File[] extensionsToLoad; final List<String> toLoad = config.getLoadList(); if (toLoad == null) { extensionsToLoad = rootExtensionsDir.listFiles(); } else { int i = 0; extensionsToLoad = new File[toLoad.size()]; for (final String extensionName : toLoad) { final File extensionDir = new File(rootExtensionsDir, extensionName); if (!extensionDir.isDirectory()) { throw new ISE( String.format( "Extension [%s] specified in \"druid.extensions.loadList\" didn't exist!?", extensionDir.getAbsolutePath() ) ); } extensionsToLoad[i++] = extensionDir; } } return extensionsToLoad == null ? new File[]{} : extensionsToLoad; }
Source:
<code>public void payloadLimitingClientThrowsOnRequestThatIsTooLarge() { TestResource client = AtlasDbHttpClients.createProxy(new MetricRegistry(), NO_SSL, getUriForPort(availablePort), TestResource.class, true); assertThat(client.postRequest(new byte[AtlasDbInterceptors.MAX_PAYLOAD_SIZE / 2])).isTrue(); assertThatThrownBy(() -> client.postRequest(new byte[AtlasDbInterceptors.MAX_PAYLOAD_SIZE])) <START> .isInstanceOf(IllegalArgumentException.class); <END> }</code><technical_language>throw a more specific exception, assert message (does exact)</technical_language>

Target:
public void payloadLimitingClientThrowsOnRequestThatIsTooLarge() { TestResource client = AtlasDbHttpClients.createProxy(new MetricRegistry(), NO_SSL, getUriForPort(availablePort), TestResource.class, true); assertThat(client.postRequest(new byte[AtlasDbInterceptors.MAX_PAYLOAD_SIZE / 2])) .as("Request with payload size below limit succeeds") .isTrue(); assertThatThrownBy(() -> client.postRequest(new byte[AtlasDbInterceptors.MAX_PAYLOAD_SIZE])) .as("Request with payload size exceeding limit throws") .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Request too large"); }
Source:
<code>protected int run(List<String> nonFlagArgs) throws Exception { mKiji = Kiji.Factory.open(mURI); try { <START> mTable = mKiji.getSchemaTable(); <END> if (mCreateFlag != null && !mCreateFlag.isEmpty()) { File file = new File(mCreateFlag); Schema schema = new Schema.Parser().parse(file); long id = mTable.getOrCreateSchemaId(schema); if (isInteractive()) { getPrintStream().println("Schema table schema ID for the given schema is: \n"); } getPrintStream().println(id); return SUCCESS; } else { Schema schema = mTable.getSchema(mGetFlag); Preconditions.checkArgument(schema != null, "No schema definition with ID: %s", mGetFlag); try { File file = new File(mOutputFlag); boolean fileCreated = file.createNewFile(); if (fileCreated) { FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); try { bw.write(schema.toString()); } finally { bw.close(); } } else { if (mayProceed("File: %s already exists, do you wish to overwrite the file?", mOutputFlag)) { FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); try { bw.write(schema.toString()); } finally { bw.close(); } } else { return ABORTED; } } if (isInteractive()) { getPrintStream().println( String.format("Schema definition written to: %s", mOutputFlag)); } return SUCCESS; } catch (IOException ioe) { LOG.error(String.format("Error writing to file: %s", mOutputFlag)); throw ioe; } } } finally { mKiji.release(); } }</code><technical_language>is this a field</technical_language>

Target:
protected int run(List<String> nonFlagArgs) throws Exception { mKiji = Kiji.Factory.open(mURI); try { final KijiSchemaTable table = mKiji.getSchemaTable(); if (mRegisterFlag != null && !mRegisterFlag.isEmpty()) { final File file = new File(mRegisterFlag); final Schema schema = new Schema.Parser().parse(file); final long id = table.getOrCreateSchemaId(schema); if (isInteractive()) { getPrintStream().println("Schema table schema ID for the given schema is: \n"); } getPrintStream().println(id); return SUCCESS; } else { final Schema schema = table.getSchema(mGetFlag); Preconditions.checkArgument(schema != null, "No schema definition with ID: %s", mGetFlag); try { final File file = new File(mOutputFlag); final boolean fileCreated = file.createNewFile(); if (fileCreated) { final FileOutputStream fop = new FileOutputStream(file.getAbsoluteFile()); try { fop.write(schema.toString().getBytes("utf-8")); fop.flush(); } finally { fop.close(); } } else { if (mayProceed("File: %s already exists, do you wish to overwrite the file?", mOutputFlag)) { final FileOutputStream fop = new FileOutputStream(file.getAbsoluteFile()); try { fop.write(schema.toString().getBytes("utf-8")); } finally { fop.flush(); fop.close(); } } else { return FAILURE; } } if (isInteractive()) { getPrintStream().printf("Schema definition written to: %s", mOutputFlag); } return SUCCESS; } catch (IOException ioe) { LOG.error("Error writing to file: {}", mOutputFlag); throw ioe; } } } finally { mKiji.release(); } }
Source:
<code>private int getDnsProbeTimeout() { return <START> getIntSetting(mContext, R.integer.config_captive_portal_dns_probe_timeout, <END> CONFIG_CAPTIVE_PORTAL_DNS_PROBE_TIMEOUT, R.integer.default_captive_portal_dns_probe_timeout); }</code><technical_language>this getContextByMccIfNoSimCardOrDefault() too</technical_language>

Target:
private int getDnsProbeTimeout() { final Context targetContext = getContextByMccIfNoSimCardOrDefault(); return getIntSetting(targetContext, R.integer.config_captive_portal_dns_probe_timeout, CONFIG_CAPTIVE_PORTAL_DNS_PROBE_TIMEOUT, R.integer.default_captive_portal_dns_probe_timeout); }
Source:
<code>protected void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.network_setting); mPhone = PhoneFactory.getDefaultPhone(); mHandler = new MyHandler(); PreferenceScreen prefSet = getPreferenceScreen(); mButtonDataRoam = (CheckBoxPreference) prefSet.findPreference(BUTTON_ROAMING_KEY); mButtonPreferredNetworkMode = (ListPreference) prefSet.findPreference( BUTTON_PREFERED_NETWORK_MODE); if (getResources().getBoolean(R.bool.world_phone) == true) { mButtonPreferredNetworkMode.setOnPreferenceChangeListener(this); int settingsNetworkMode = android.provider.Settings.Secure.getInt(mPhone.getContext(). getContentResolver(),android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, preferredNetworkMode); mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode)); mCdmaOptions = new CdmaOptions(this, prefSet); mGsmUmtsOptions = new GsmUmtsOptions(this, prefSet); } else { prefSet.removePreference(mButtonPreferredNetworkMode); <START> prefSet.removePreference(prefSet.findPreference(BUTTON_GSM_UMTS_OPTIONS)); <END> prefSet.removePreference(prefSet.findPreference(BUTTON_CDMA_OPTIONS)); int phoneType = mPhone.getPhoneType(); if (phoneType == Phone.PHONE_TYPE_CDMA) { mButtonCdmaSystemSelect = (CdmaSystemSelectListPreference) prefSet .findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY); mCdmaOptions = new CdmaOptions(this, prefSet); } else if (phoneType == Phone.PHONE_TYPE_GSM) { mGsmUmtsOptions = new GsmUmtsOptions(this, prefSet); } else { throw new IllegalStateException("Unexpected phone type: " + phoneType); } } }</code><technical_language>Removed, BUTTON_GSM_UMTS_OPTIONS longer defined</technical_language>

Target:
protected void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.network_setting); mPhone = PhoneFactory.getDefaultPhone(); mHandler = new MyHandler(); PreferenceScreen prefSet = getPreferenceScreen(); mButtonDataRoam = (CheckBoxPreference) prefSet.findPreference(BUTTON_ROAMING_KEY); mButtonPreferredNetworkMode = (ListPreference) prefSet.findPreference( BUTTON_PREFERED_NETWORK_MODE); if (getResources().getBoolean(R.bool.world_phone) == true) { mButtonPreferredNetworkMode.setOnPreferenceChangeListener(this); int settingsNetworkMode = android.provider.Settings.Secure.getInt(mPhone.getContext(). getContentResolver(),android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, preferredNetworkMode); mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode)); mCdmaOptions = new CdmaOptions(this, prefSet); mGsmUmtsOptions = new GsmUmtsOptions(this, prefSet); } else { prefSet.removePreference(mButtonPreferredNetworkMode); int phoneType = mPhone.getPhoneType(); if (phoneType == Phone.PHONE_TYPE_CDMA) { mButtonCdmaSystemSelect = (CdmaSystemSelectListPreference) prefSet .findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY); mCdmaOptions = new CdmaOptions(this, prefSet); } else if (phoneType == Phone.PHONE_TYPE_GSM) { mGsmUmtsOptions = new GsmUmtsOptions(this, prefSet); } else { throw new IllegalStateException("Unexpected phone type: " + phoneType); } } }
Source:
<code>public void onError(Throwable e) { if (!done) { done = true; <START> actual.onError(e); <END> } }</code><technical_language>RxJavaHooks.onError missing</technical_language>

Target:
public void onError(Throwable e) { if (!done) { done = true; actual.onError(e); } else { RxJavaHooks.onError(e); } }
Source:
<code>public long getEstimatedKeyCount() throws IOException { try { return db.getLongProperty(handle, "rocksdb.estimate-num-keys"); } catch (RocksDBException e) { throw new IOException( <START> "Failed to get estimated key count of table."); <END> } }</code><technical_language>If throw exception here, Ratis get a failure future returned notifyInstallSnapshotFromLeader. I impact of is. Ratis terminate process? cc @hanishakoneru for this is okay. I filed <LINK_0> investigate further</technical_language>

Target:
public long getEstimatedKeyCount() throws IOException { try { return db.getLongProperty(handle, "rocksdb.estimate-num-keys"); } catch (RocksDBException e) { throw toIOException( "Failed to get estimated key count of table " + getName(), e); } }
Source:
<code><START> public CompletableFuture<?> getAllBarriersReceivedFuture(long checkpointId) { <END> if (checkpointId < currentCheckpointId) { return CompletableFuture.completedFuture(null); } if (checkpointId > currentCheckpointId) { throw new IllegalStateException("Checkpoint " + checkpointId + " has not been started at all"); } return allBarriersReceivedFuture; }</code><technical_language>1. assign variables network thread, read task thread? 2. Besides of visibility, is a race condition? N writes currentCheckpointId updated T reads currentCheckpointId (new value) T reads allBarriersReceivedFuture (null value) N writes allBarriersReceivedFuture 3. nit: } else if () more readable</technical_language>

Target:
public CompletableFuture<Void> getAllBarriersReceivedFuture(long checkpointId) { return threadSafeUnaligner.getAllBarriersReceivedFuture(checkpointId); }