auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>BaseHandler(LttngKernelExecGraphProvider provider) { fProvider = provider; fHasEventSchedTTWU = new HashMap<>(); ITmfTrace trace = getProvider().getTrace(); LttngEventLayout layout = getProvider().getEventLayout(); <START> Collection<@NonNull ITmfTrace> traceSet = TmfTraceManager.getTraceSet(trace); <END> for (ITmfTrace traceItem : traceSet) { if (traceItem instanceof ITmfTraceWithPreDefinedEvents) { Set<@NonNull ? extends ITmfEventType> content = ((ITmfTraceWithPreDefinedEvents) traceItem).getContainedEventTypes(); Set<@NonNull String> traceEvents = TmfEventTypeCollectionHelper.getEventNames(content); boolean hasEvent = traceEvents.contains(layout.eventSchedProcessTTWU()); fHasEventSchedTTWU.put(traceItem, hasEvent); } } }</code><technical_language>if in @NNBD, need repeat these, applied</technical_language>

Target:
BaseHandler(LttngKernelExecGraphProvider provider) { fProvider = provider; fHasEventSchedTTWU = new HashMap<>(); ITmfTrace trace = getProvider().getTrace(); LttngEventLayout layout = getProvider().getEventLayout(); Collection<ITmfTrace> traceSet = TmfTraceManager.getTraceSet(trace); for (ITmfTrace traceItem : traceSet) { if (traceItem instanceof ITmfTraceWithPreDefinedEvents) { Set<? extends ITmfEventType> content = ((ITmfTraceWithPreDefinedEvents) traceItem).getContainedEventTypes(); Set<String> traceEvents = TmfEventTypeCollectionHelper.getEventNames(content); boolean hasEvent = traceEvents.contains(layout.eventSchedProcessTTWU()); fHasEventSchedTTWU.put(traceItem, hasEvent); } } }
Source:
<code>public <T extends Collector> T register() { if (registered.contains(CollectorRegistry.defaultRegistry)) { return (T) this; } else { registered.add(CollectorRegistry.defaultRegistry); return super.register(); <START> } <END> }</code><technical_language>thread-safe, of a wrapped ConcurrentHashMap. registered.contains() registered.add() collectively atomic</technical_language>

Target:
public <T extends Collector> T register() { synchronized (registered) { if (registered.contains(CollectorRegistry.defaultRegistry)) { return (T) this; } else { registered.add(CollectorRegistry.defaultRegistry); return super.register(); } } }
Source:
<code>public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; this.setPmOptions(""); this.setPmSecondaryOptions(""); this.vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; this.sshPort = DEFAULT_SSH_PORT; this.sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = ""; vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; this.protocol = VdsProtocol.XML; <START> this.hostProviderId = Guid.Empty; <END> }</code><technical_language>nan</technical_language>

Target:
public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; this.setPmOptions(""); this.setPmSecondaryOptions(""); this.vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; this.sshPort = DEFAULT_SSH_PORT; this.sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = ""; vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; this.protocol = VdsProtocol.XML; this.hostProviderId = null; }
Source:
<code>private boolean alignmentsMatch(final SAMRecord s1, final SAMRecord s2) { return ((s1.getReferenceName().equals(s2.getReferenceName()) && s1.getAlignmentStart() == s2.getAlignmentStart() && s1.getReadNegativeStrandFlag() == s1.getReadNegativeStrandFlag()) || <START> (mq0Match && s1.getMappingQuality() <= 3 && s2.getMappingQuality() <= 3)); <END> }</code><technical_language>"3" defined in a constant somewhere</technical_language>

Target:
private boolean alignmentsMatch(final SAMRecord s1, final SAMRecord s2) { return ((s1.getReferenceName().equals(s2.getReferenceName()) && s1.getAlignmentStart() == s2.getAlignmentStart() && s1.getReadNegativeStrandFlag() == s1.getReadNegativeStrandFlag()) || (samComparisonArgumentCollection.LENIENT_LOW_MQ_ALIGNMENT && s1.getMappingQuality() <= samComparisonArgumentCollection.LOW_MQ_THRESHOLD && s2.getMappingQuality() <= samComparisonArgumentCollection.LOW_MQ_THRESHOLD) || (samComparisonArgumentCollection.LENIENT_UNKNOWN_MQ_ALIGNMENT && s1.getMappingQuality() == SAMRecord.UNKNOWN_MAPPING_QUALITY && s2.getMappingQuality() == SAMRecord.UNKNOWN_MAPPING_QUALITY)); }
Source:
<code>public ServiceBuilder<PersistenceConfiguration> build(ServiceTarget target) { ServiceBuilder<PersistenceConfiguration> builder = super.build(target); <START> this.remoteCacheContainer.register(builder); <END> return builder; }</code><technical_language>return this.remoteCacheContainer.register(super.build(target));</technical_language>

Target:
public ServiceBuilder<PersistenceConfiguration> build(ServiceTarget target) { return this.remoteCacheContainer.register(super.build(target)); }
Source:
<code><START> public void close() throws DataStoreException { <END> }</code><technical_language>Need implement</technical_language>

Target:
public void close() throws DataStoreException { Iterator<DataStore> iter = delegateHandler.getAllDelegatesIterator(); DataStoreException aggregateException = null; while (iter.hasNext()) { try { DataStore ds = iter.next(); if (null != ds) { ds.close(); } } catch (DataStoreException dse) { if (null == aggregateException) { aggregateException = new DataStoreException( "Aggregate data store exception created in close", dse); } aggregateException.addSuppressed(dse); } } if (null != aggregateException) { throw aggregateException; } }
Source:
<code>public ChangePasswordResponse changePassword(Token userToken, String newPassword, URL authenticationUrl) { try { String requestBody = ChangePasswordRequest.create(userToken, newPassword).toJson(); return changePassword(buildActionUrl(authenticationUrl, ACTION_CHANGE_PASSWORD), requestBody); <START> } catch (Exception e) { <END> return ChangePasswordResponse.createFailure(new ObjectServerError(ErrorCode.UNKNOWN, e)); } }</code><technical_language>Error silently suppressed executor service i think, catch Throwable instead? is override ThreadPoolExecutor.afterExecute throw uncaught throwables terminated process -- happen, recovered anymore. anther PR</technical_language>

Target:
public ChangePasswordResponse changePassword(Token userToken, String newPassword, URL authenticationUrl) { try { String requestBody = ChangePasswordRequest.create(userToken, newPassword).toJson(); return changePassword(buildActionUrl(authenticationUrl, ACTION_CHANGE_PASSWORD), requestBody); } catch (Throwable e) { return ChangePasswordResponse.createFailure(new ObjectServerError(ErrorCode.UNKNOWN, e)); } }
Source:
<code>public void init(EObject original, EditingDomain editingDomain) { List<EStructuralFeature> features = featuresProvider .getFeatures(original); initControlFactory(editingDomain, original); for (final EStructuralFeature feature : features) { <START> if(!featuresProvider.getClass().equals(FeaturesProvider.class) || isToBeRendered(feature) ){ <END> createControlForFeature(feature); } } this.layout(); }</code><technical_language>do perform this test FeaturesProvider's class? This strange I do this relates goal of this commit..</technical_language>

Target:
public void init(EObject original, EditingDomain editingDomain) { List<EStructuralFeature> features = featuresProvider .getFeatures(original); initControlFactory(editingDomain, original); for (final EStructuralFeature feature : features) { createControlForFeature(feature); } this.layout(); }
Source:
<code>public void visit(DataChartDurationDescriptor<?, ? extends Number> desc) { <START> setType(EnumSet.of(DescriptorType.NUMERICAL, DescriptorType.DURATION)); <END> }</code><technical_language>in lines: fType.add(DescriptorType.NUMERICAL); fType.add(DescriptorType.DURATION); add DURATION isNumber() differentiate</technical_language>

Target:
public void visit(DataChartDurationDescriptor<?, ? extends Number> desc) { fType.add(DescriptorType.DURATION); }
Source:
<code>private String updateKeeIfRequired(Context context, @Nullable String kee) throws SQLException { <START> if (kee == null || kee.length() <=40) { <END> return kee; } String newKee = uuidFactory.create(); context.prepareUpsert("update permission_templates set kee=? where kee=?") .setString(1, kee) .setString(2, newKee) .execute(); return newKee; }</code><technical_language>constant VarcharColumnDef#UUID_SIZE</technical_language>

Target:
private String updateKeeIfRequired(Context context, @Nullable String kee) throws SQLException { if (kee == null || kee.length() <= VarcharColumnDef.UUID_SIZE) { return kee; } String newKee = uuidFactory.create(); context.prepareUpsert("update permission_templates set kee=? where kee=?") .setString(1, newKee) .setString(2, kee) .execute(); return newKee; }
Source:
<code>private static void closeSettingsChangedShell() { new WaitUntil(new ShellIsAvailable("Validator Settings Changed"), TimePeriod.LONG); DefaultShell shell = new DefaultShell("Validator Settings Changed"); String shellText = shell.getText(); new PushButton("Yes").click(); <START> new WaitWhile(new ShellIsActive(shellText), TimePeriod.LONG); <END> }</code><technical_language>ShellIsAvailable</technical_language>

Target:
private static void closeSettingsChangedShell() { new WaitUntil(new ShellIsAvailable("Validator Settings Changed"), TimePeriod.LONG); DefaultShell shell = new DefaultShell("Validator Settings Changed"); String shellText = shell.getText(); new PushButton("Yes").click(); new WaitWhile(new ShellIsAvailable(shellText), TimePeriod.LONG); }
Source:
<code>public void addSteps(MigrationStepRegistry registry) { registry .add(1900, "Add QUALITY_GATES.IS_BUILT_IN", AddIsBuiltInToQualityGates.class) .add(1901, "Populate QUALITY_GATES.IS_BUILT_IN", PopulateQualityGatesIsBuiltIn.class) .add(1902, "Make QUALITY_GATES.IS_BUILT_IN not null", MakeQualityGatesIsBuiltInNotNullable.class) .add(1903, "Remove quality gates loaded templates", RemoveQualityGateLoadedTemplates.class) <START> .add(1904, "Drop LOADED_TEMPLATES table", DropLoadedTemplatesTable.class); <END> }</code><technical_language>Minor : I loved fact semicolon is a separate line for solving merge conflicts</technical_language>

Target:
public void addSteps(MigrationStepRegistry registry) { registry .add(1900, "Add QUALITY_GATES.IS_BUILT_IN", AddIsBuiltInToQualityGates.class) .add(1901, "Populate QUALITY_GATES.IS_BUILT_IN", PopulateQualityGatesIsBuiltIn.class) .add(1902, "Make QUALITY_GATES.IS_BUILT_IN not null", MakeQualityGatesIsBuiltInNotNullable.class) .add(1903, "Remove quality gates loaded templates", RemoveQualityGateLoadedTemplates.class) .add(1904, "Rename quality gate \"SonarQube way\" to \"Sonar way\"", RenameOldSonarQubeWayQualityGate.class) .add(1905, "Drop LOADED_TEMPLATES table", DropLoadedTemplatesTable.class); }
Source:
<code>public void run() { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "poller started"); while (running) { WatchKey watchKey = null; try { watchKey = watchService.poll(5, TimeUnit.SECONDS); } catch (ClosedWatchServiceException | InterruptedException e) { return; } if (watchKey == null || !watchKey.isValid() || !(watchKey.watchable() instanceof Path)) { continue; } final Path watchedPath = (Path) watchKey.watchable(); for (WatchEvent<?> event : watchKey.pollEvents()) { handleEvent(event, watchedPath); } if (!watchKey.reset()) { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "watch key of '" + watchedPath + "' was no longer valid at the time it was reset"); } <START> } <END> if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "poller stopped"); }</code><technical_language>Please log thrown Throwables thread die silently</technical_language>

Target:
public void run() { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "poller started"); try { while (running) { WatchKey watchKey = null; try { watchKey = watchService.poll(5, TimeUnit.SECONDS); } catch (ClosedWatchServiceException | InterruptedException e) { return; } if (watchKey == null || !watchKey.isValid() || !(watchKey.watchable() instanceof Path)) { continue; } final Path watchedPath = (Path) watchKey.watchable(); for (WatchEvent<?> event : watchKey.pollEvents()) { handleEvent(event, watchedPath); } if (!watchKey.reset()) { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "watch key of '" + watchedPath + "' was no longer valid at the time it was reset"); } } } catch (Throwable e) { Nio2RefreshProvider.log(e); } if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(DEBUG_PREFIX + "poller stopped"); }
Source:
<code>public Iterable<String> iterate() throws IOException { final RestResponse response = this.github().entry().uri() .path("/gitignore/templates").back().fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); <START> final List<JsonString> list = response.as(JsonResponse.class) <END> .json().readArray().getValuesAs(JsonString.class); final List<String> templates = new ArrayList<String>(list.size()); for (JsonString value : list) { templates.add(value.getString()); } return templates; }</code><technical_language>I RtPagination, done in other classes in methods iterate. RtIssues for example</technical_language>

Target:
public Iterable<String> iterate() throws IOException { final RestResponse response = this.request.fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); final List<JsonString> list = response.as(JsonResponse.class) .json().readArray().getValuesAs(JsonString.class); final List<String> templates = new ArrayList<String>(list.size()); for (JsonString value : list) { templates.add(value.getString()); } return templates; }
Source:
<code>if (System.getProperty( PLUGINS_PATH_PROPERTY ) == null) { Class<?> thisClass = StandaloneUMLRTCodeGenerator.class; URL url = thisClass.getResource( "StandaloneUMLRTCodeGenerator.class" ); String thisClassPathStr = url.getPath(); Path thisClassPath = Paths.get( thisClassPathStr ); <START> Path base = thisClassPath.getParent().getParent().getParent().getParent().getParent().getParent().getParent().getParent(); <END> System.setProperty( PLUGINS_PATH_PROPERTY, base.toString()); }</code><technical_language>This fragile. changed a loop calls getParent folder is "plugins"? remove this "guessing" fallback behaviour -p parameter mandatory</technical_language>

Target:
if (System.getProperty( PLUGINS_PATH_PROPERTY ) == null) { Class<?> thisClass = StandaloneUMLRTCodeGenerator.class; URL url = thisClass.getResource( "StandaloneUMLRTCodeGenerator.class" ); int foldersUp = 7; if (url.getProtocol().equals("jar")) foldersUp--; Path thisClassPath = Paths.get( url.getPath() ); Path base = thisClassPath; for (int i = 0; i < foldersUp; i++) { if (base == null || base.endsWith( "plugins" )) break; base = base.getParent(); } if (base != null) System.setProperty( PLUGINS_PATH_PROPERTY, base.toString() ); }
Source:
<code><START> public void purgeMemberships(List<CohortMembership> cohortMembershipList) { <END> List<CohortMembership> membersToPurge = getMemberships().stream() .filter(m -> cohortMembershipList.stream() .anyMatch(c -> m.getPatient().getPatientId().equals(c.getPatient().getPatientId()))) .collect(Collectors.toList()); membersToPurge.forEach(m -> getMemberships().remove(m)); }</code><technical_language>I assume this return a boolean value, i.e return true if member removed return getMemberships().remove(m)</technical_language>

Target:
public boolean purgeMemberships(List<CohortMembership> cohortMembershipList) { List<CohortMembership> membershipsToPurge = getMemberships().stream() .filter(m -> cohortMembershipList.stream() .anyMatch(c -> m.getPatientId().equals(c.getPatientId()))) .collect(Collectors.toList()); if (membershipsToPurge != null) { membershipsToPurge.forEach(m -> getMemberships().remove(m)); return true; } return false; }
Source:
<code>private Map<SAMReadGroupRecord,FastqQualityFormat> createReadGroupFormatMap(RevertSamSorter sorter, boolean restoreOriginalQualities) { final Map<SAMReadGroupRecord, FastqQualityFormat> readGroupToFormat = new HashMap<>(); List<PeekableIterator<SAMRecord>> iterators = sorter.iterators(); for (PeekableIterator<SAMRecord> iterator : iterators) { <START> SAMReadGroupRecord readGroup = iterator.peek().getReadGroup(); <END> if (readGroup == null) { continue; } readGroupToFormat.put( readGroup, QualityEncodingDetector.detect( QualityEncodingDetector.DEFAULT_MAX_RECORDS_TO_ITERATE, iterator, restoreOriginalQualities) ); } for (final SAMReadGroupRecord r : readGroupToFormat.keySet()) { log.info("Detected quality format for " + r.getReadGroupId() + ": " + readGroupToFormat.get(r)); } if (readGroupToFormat.values().contains(FastqQualityFormat.Solexa)) { throw new PicardException("No quality score encoding conversion implemented for " + FastqQualityFormat.Solexa); } return readGroupToFormat; }</code><technical_language>iterators, iterator, readGroup can/should marked final</technical_language>

Target:
private Map<SAMReadGroupRecord,FastqQualityFormat> createReadGroupFormatMap(RevertSamSorter sorter, boolean restoreOriginalQualities) { final Map<SAMReadGroupRecord, FastqQualityFormat> readGroupToFormat = new HashMap<>(); final List<PeekableIterator<SAMRecord>> iterators = sorter.iterators(); for (final PeekableIterator<SAMRecord> iterator : iterators) { final SAMReadGroupRecord readGroup = iterator.peek().getReadGroup(); if (readGroup == null) { continue; } readGroupToFormat.put( readGroup, QualityEncodingDetector.detect( QualityEncodingDetector.DEFAULT_MAX_RECORDS_TO_ITERATE, iterator, restoreOriginalQualities) ); } for (final SAMReadGroupRecord r : readGroupToFormat.keySet()) { log.info("Detected quality format for " + r.getReadGroupId() + ": " + readGroupToFormat.get(r)); } if (readGroupToFormat.values().contains(FastqQualityFormat.Solexa)) { throw new PicardException("No quality score encoding conversion implemented for " + FastqQualityFormat.Solexa); } return readGroupToFormat; }
Source:
<code>default void deleteAll(Collection<K> keys) { <START> deleteAllAsync(keys).toCompletableFuture().join(); <END> }</code><technical_language>remote exception break some apps is relying exception type</technical_language>

Target:
default void deleteAll(Collection<K> keys) { try { deleteAllAsync(keys).toCompletableFuture().join(); } catch (CompletionException e) { throw new SamzaException("DELETE failed for " + keys, e); } }
Source:
<code>private boolean renderQueryOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { StatusPrinter statusPrinter = null; @SuppressWarnings("resource") PrintStream errorChannel = interactive ? out : System.err; if (interactive) { statusPrinter = new StatusPrinter(client, out, debug); statusPrinter.printInitialStatusUpdates(); } else { waitForData(); } <START> <END> if (client.isRunning() || (client.isFinished() && client.finalStatusInfo().getError() == null)) { QueryStatusInfo results = client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo(); if (results.getUpdateType() != null) { renderUpdate(errorChannel, results); } else if (results.getColumns() == null) { errorChannel.printf("Query %s has no columns\n", results.getId()); return false; } else { renderResults(out, outputFormat, interactive, results.getColumns()); } } checkState(!client.isRunning()); if (statusPrinter != null) { statusPrinter.printFinalInfo(); } if (client.isAborted()) { errorChannel.println("Query aborted by user"); return false; } if (client.isCommunicationFailure()) { errorChannel.println("Query is gone (server restarted?)"); return false; } verify(client.isFinished()); if (client.finalStatusInfo().getError() != null) { renderFailure(errorChannel); return false; } return true; }</code><technical_language>add a method java boolean hasError() { checkState(client.isFinished()); return client.finalStatusInfo().getError() == null ; } client.isRunning() || (client.isFinished() && !client.hasError())</technical_language>

Target:
private boolean renderQueryOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { StatusPrinter statusPrinter = null; @SuppressWarnings("resource") PrintStream errorChannel = interactive ? out : System.err; if (interactive) { statusPrinter = new StatusPrinter(client, out, debug); statusPrinter.printInitialStatusUpdates(); } else { waitForData(); } if (client.isRunning() || (client.isFinished() && client.finalStatusInfo().getError() == null)) { QueryStatusInfo results = client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo(); if (results.getUpdateType() != null) { renderUpdate(errorChannel, results); } else if (results.getColumns() == null) { errorChannel.printf("Query %s has no columns\n", results.getId()); return false; } else { renderResults(out, outputFormat, interactive, results.getColumns()); } } checkState(!client.isRunning()); if (statusPrinter != null) { statusPrinter.printFinalInfo(); } if (client.isClientAborted()) { errorChannel.println("Query aborted by user"); return false; } if (client.isClientError()) { errorChannel.println("Query is gone (server restarted?)"); return false; } verify(client.isFinished()); if (client.finalStatusInfo().getError() != null) { renderFailure(errorChannel); return false; } return true; }
Source:
<code><START> private void adjustSliderWithKey(int key) { <END> int oldSliderValue = hoverOption.getIntegerValue(); if (key == Input.KEY_RIGHT) { hoverOption.setValue(hoverOption.getIntegerValue() + 1); } else if (key == Input.KEY_LEFT) { hoverOption.setValue(hoverOption.getIntegerValue() - 1); } if (hoverOption.getIntegerValue() != oldSliderValue && sliderSoundDelay == 0) { sliderSoundDelay = SLIDER_SOUND_INTERVAL; SoundController.playSound(SoundEffect.MENUCLICK); } }</code><technical_language>I instead of passing in key, pass in more symbolic, a delta value</technical_language>

Target:
private void adjustSliderWithKey(int key) { int oldSliderValue = hoverOption.getIntegerValue(); if (key == Input.KEY_RIGHT) { hoverOption.setValue(oldSliderValue + 1); } else if (key == Input.KEY_LEFT) { hoverOption.setValue(oldSliderValue - 1); } if (hoverOption.getIntegerValue() != oldSliderValue && sliderSoundDelay == 0) { sliderSoundDelay = SLIDER_SOUND_INTERVAL; SoundController.playSound(SoundEffect.MENUCLICK); } }
Source:
<code>protected void executeCommand() { VdcReturnValueBase result = runInternalActionWithTasksContext( VdcActionType.UpdateVmVersion, <START> new UpdateVmVersionParameters(getVmId())); <END> if (!result.getSucceeded() && !result.isValid()) { log.warn("Couldn't update VM '{}' ({}) version from it's template, continue with restoring stateless snapshot.", getVm().getName(), getVmId()); setSucceeded(restoreInitialState()); } else { setSucceeded(result.getSucceeded()); } }</code><technical_language>UpdateVmVersion (and commands passes lock to) fail lock vm id is acquired else? (as pass it)</technical_language>

Target:
protected void executeCommand() { VdcReturnValueBase result = runInternalActionWithTasksContext( VdcActionType.UpdateVmVersion, buildUpdateVmVersionParameters()); if (!result.getSucceeded() && !result.isValid()) { log.warn("Couldn't update VM '{}' ({}) version from it's template, continue with restoring stateless snapshot.", getVm().getName(), getVmId()); setSucceeded(restoreInitialState()); } else { setSucceeded(result.getSucceeded()); } }
Source:
<code>public ScreenshotFormat get() { switch (config.getScreenshotFormat()) { <START> case PNG: <END> return PNG; case JPEG: return JPEG; default: return PNG; } }</code><technical_language>This a bit odd.... check return format null, return default in case</technical_language>

Target:
public ScreenshotFormat get() { if(config.getScreenshotFormat() != null) { return config.getScreenshotFormat(); } else { return ScreenshotFormat.PNG; } }
Source:
<code><START> public synchronized IterableStream<ServiceBusReceivedMessageContext> receive(int maxMessages, <END> Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } else if (Objects.isNull(maxWaitTime)) { throw logger.logExceptionAsError( new NullPointerException("'maxWaitTime' cannot be null.")); } else if (maxWaitTime.isNegative() || maxWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maxWaitTime' cannot be zero or less. maxWaitTime: " + maxWaitTime)); } final Flux<ServiceBusReceivedMessageContext> messages = Flux.create(emitter -> queueWork(maxMessages, maxWaitTime, emitter)); return new IterableStream<>(messages); }</code><technical_language>This need synchronised, it</technical_language>

Target:
public IterableStream<ServiceBusReceivedMessageContext> receive(int maxMessages, Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } else if (Objects.isNull(maxWaitTime)) { throw logger.logExceptionAsError( new NullPointerException("'maxWaitTime' cannot be null.")); } else if (maxWaitTime.isNegative() || maxWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maxWaitTime' cannot be zero or less. maxWaitTime: " + maxWaitTime)); } final Flux<ServiceBusReceivedMessageContext> messages = Flux.create(emitter -> queueWork(maxMessages, maxWaitTime, emitter)); return new IterableStream<>(messages); }
Source:
<code>public void getSurveyInstancesReturnsFilteredData() { Survey form1 = createForm(); Survey form2 = createForm(); Device device = createDevice(); SurveyedLocale dataPoint = createDataPoint(); List<Long> dataPointIds = Arrays.asList(dataPoint.getKey().getId()); List<SurveyInstance> allFormInstances = createFormInstances(dataPoint, randomInt(), form1, form2); List<SurveyInstance> form1Instances = allFormInstances.stream() .filter(surveyInstance -> surveyInstance.getSurveyId().equals(form1.getKey().getId())) .collect(Collectors.toList()); <START> SurveyAssignment assignment = createAssignment(dataPoint.getSurveyGroupId(), <END> Arrays.asList(device.getKey().getId()), Arrays.asList(form1.getKey().getId())); DataPointUtil dpu = new DataPointUtil(); Map<Long, List<SurveyInstance>> foundInstances = dpu.getSurveyInstances(dataPointIds, dataPoint.getSurveyGroupId(), device); Set<Long> expectedIds = getIds(form1Instances); Set<Long> resultIds = getIds(foundInstances.get(dataPoint.getKey().getId())); assertEquals(expectedIds, resultIds); }</code><technical_language>assignment unused</technical_language>

Target:
public void getSurveyInstancesReturnsFilteredData() { Survey form1 = createForm(); Survey form2 = createForm(); Device device = createDevice(); SurveyedLocale dataPoint = createDataPoint(); List<SurveyInstance> allFormInstances = createFormInstances(dataPoint, form1, form2); List<SurveyInstance> form1Instances = new ArrayList<>(); for (SurveyInstance surveyInstance : allFormInstances) { if (surveyInstance.getSurveyId().equals(form1.getKey().getId())) { form1Instances.add(surveyInstance); } } createAssignment(dataPoint.getSurveyGroupId(), Collections.singletonList(device.getKey().getId()), Collections.singletonList(form1.getKey().getId())); DataPointUtil dpu = new DataPointUtil(); List<SurveyedLocaleDto> datapointList = dpu.getSurveyedLocaleDtosList(Collections.singletonList(dataPoint), dataPoint.getSurveyGroupId(), device); Set<String> expected = uuidsFromFormInstances(form1Instances); Set<String> actual = uuidsFromDataPoints(datapointList); assertEquals(expected, actual); }
Source:
<code>public SystemType getOS () { <START> String os = java.lang.System.getProperty("os.name").toLowerCase(); <END> if(os.indexOf("win") >= 0) return SystemType.Windows; else if(os.indexOf("mac") >= 0) return SystemType.OSX; else if(os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os.indexOf("aix") > 0) return SystemType.Linux; else return null; }</code><technical_language>missed formatting this block</technical_language>

Target:
public SystemType getOS() { return SystemType.parseDesktopOS(); }
Source:
<code><START> private String subString(final String marshal, final String from, final String to) { final StringBuilder builder = new StringBuilder(); boolean found = false; for (String row : marshal.split("\\r?\\n")) { if (found && Objects.equals(row.trim(), to)) { break; } if (found) { final String trim = row.trim(); if (!trim.isEmpty()) { builder.append(trim); builder.append("\n"); } } if (!found && Objects.equals(row.trim(), from)) { found = true; } } return builder.toString(); } <END></code><technical_language>This rewritten as: java private String subString(final String marshal, final String from, final String to) { Pattern regex = Pattern.compile("\\s*" + + "\\s*(.*)" + to, Pattern.DOTALL); Matcher regexMatcher = regex.matcher(marshal); if (regexMatcher.find()) { return regexMatcher.group(1); } else { throw new IllegalStateException(String.format("No substring '%s' '%s' found", from, to)); } }</technical_language>

Target:
private String subString(final String marshal, final String from, final String to) { final Pattern regex = Pattern.compile("\\s*" + from + "\\s*(.*)" + to, Pattern.DOTALL); final Matcher regexMatcher = regex.matcher(marshal); if (regexMatcher.find()) { return regexMatcher.group(1); } else { throw new IllegalStateException(String.format("No substring between '%s' and '%s' found", from, to)); } }
Source:
<code>public Aggregator factorize(ColumnSelectorFactory metricFactory) { return new LongFirstAggregator( name, metricFactory.makeLongColumnSelector(fieldName), <START> metricFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME) <END> ); }</code><technical_language>minor nit: change order of args, pass time column selector in LongFirstBufferAggregator. orders confusion</technical_language>

Target:
public Aggregator factorize(ColumnSelectorFactory metricFactory) { return new LongFirstAggregator( name, metricFactory.makeLongColumnSelector(Column.TIME_COLUMN_NAME), metricFactory.makeLongColumnSelector(fieldName) ); }
Source:
<code>public boolean chkAuthorizationByRole(String userName, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { <START> ArrayList<String> roles; <END> if (projectSecurityManager.ownsAtLeastOneProject(userName)) { return true; } else { if (userRoles.length > 0) { roles = getAccessRoleList(userRoles); for (String role : roles) { if (projectSecurityManager.collaboratesOnAtLeastOneProject(userName, role)) { return true; } } } } return false; }</code><technical_language>declared needed List interface</technical_language>

Target:
public boolean chkAuthorizationByRole(String userName, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { if (projectSecurityManager.ownsAtLeastOneProject(userName)) { return true; } else { if (userRoles.length > 0) { List<String> roles = Arrays.asList(userRoles); for (String role : roles) { if (projectSecurityManager.collaboratesOnAtLeastOneProject(userName, role)) { return true; } } } } return false; }
Source:
<code>public boolean isActivated() { <START> return false; <END> }</code><technical_language>This distribution is deprecated</technical_language>

Target:
public boolean isActivated() { return true; }
Source:
<code>@Override public Response execute(Command command) throws WebDriverException { if (DriverCommand.NEW_SESSION.equals(command.getName())) { <START> ofNullable(service).ifPresent(driverService -> { <END> try { driverService.start(); } catch (IOException e) { throw new WebDriverException(e.getMessage(), e); } }); } try { return super.execute(command); } catch (Throwable t) { Throwable rootCause = Throwables.getRootCause(t); if (rootCause instanceof ConnectException && rootCause.getMessage().contains("Connection refused")) { throw ofNullable(service).map((Function<DriverService, WebDriverException>) service -> { if (service.isRunning()) { return new WebDriverException("The session is closed!", rootCause); } return new WebDriverException("The appium server has accidentally died!", rootCause); }).orElse(new WebDriverException(rootCause.getMessage(), rootCause)); } throwIfUnchecked(t); throw new WebDriverException(t); } finally { if (DriverCommand.QUIT.equals(command.getName()) && service != null) { service.stop(); } } }</code><technical_language>I assume code simpler if service variable of type Optional</technical_language>

Target:
@Override public Response execute(Command command) throws WebDriverException { if (DriverCommand.NEW_SESSION.equals(command.getName())) { serviceOptional.ifPresent(driverService -> { try { driverService.start(); } catch (IOException e) { throw new WebDriverException(e.getMessage(), e); } }); } try { return super.execute(command); } catch (Throwable t) { Throwable rootCause = Throwables.getRootCause(t); if (rootCause instanceof ConnectException && rootCause.getMessage().contains("Connection refused")) { throw serviceOptional.map(service -> { if (service.isRunning()) { return new WebDriverException("The session is closed!", rootCause); } return new WebDriverException("The appium server has accidentally died!", rootCause); }).orElseGet((Supplier<WebDriverException>) () -> new WebDriverException(rootCause.getMessage(), rootCause)); } throwIfUnchecked(t); throw new WebDriverException(t); } finally { if (DriverCommand.QUIT.equals(command.getName())) { serviceOptional.ifPresent(DriverService::stop); } } }
Source:
<code>public Map<DiskImage, DiskImage> mapChainToNewIDs(Guid sourceImageGroupID, Guid newImageGroupID, Guid targetStorageDomainID) { List<DiskImage> oldChain = diskImageDao.getAllSnapshotsForImageGroup(sourceImageGroupID); Map<DiskImage, DiskImage> oldToNewChain = new HashMap<>(oldChain.size()); Guid nextParentId = Guid.Empty; sortImageList(oldChain); for (DiskImage diskImage : oldChain) { DiskImage newImage = DiskImage.copyOf(diskImage); newImage.setParentId(nextParentId); newImage.setId(newImageGroupID); newImage.setStorageIds(List.of(targetStorageDomainID)); nextParentId = Guid.newGuid(); newImage.setImageId(nextParentId); newImage.setVmSnapshotId(null); oldToNewChain.put(diskImage, newImage); } <START> log.info("New <END> image group {}", newImageGroupID); log.info("mapped old chain to new chain {}", ImagesHandler.getDiskImageIds(oldChain), oldToNewChain); return oldToNewChain; }</code><technical_language>this is a more debug log? If I more context added message</technical_language>

Target:
public Map<DiskImage, DiskImage> mapChainToNewIDs(Guid sourceImageGroupID, Guid newImageGroupID, Guid targetStorageDomainID) { List<DiskImage> oldChain = diskImageDao.getAllSnapshotsForImageGroup(sourceImageGroupID); Map<DiskImage, DiskImage> oldToNewChain = new HashMap<>(oldChain.size()); Guid nextParentId = Guid.Empty; sortImageList(oldChain); for (DiskImage diskImage : oldChain) { DiskImage newImage = DiskImage.copyOf(diskImage); newImage.setParentId(nextParentId); newImage.setId(newImageGroupID); newImage.setStorageIds(List.of(targetStorageDomainID)); nextParentId = Guid.newGuid(); newImage.setImageId(nextParentId); newImage.setVmSnapshotId(null); oldToNewChain.put(diskImage, newImage); } return oldToNewChain; }
Source:
<code>public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) { if (!(obj instanceof Number) || toAppendTo == null) { throw new IllegalArgumentException("Cannot format given Object as a Number: " + obj); } @Nullable LamiGraphRange internalRange = fInternalRange; @Nullable LamiGraphRange externalRange = fExternalRange; if (internalRange == null || externalRange == null) { StringBuffer buffer = super.format(obj, toAppendTo, pos); <START> return buffer == null ? new StringBuffer() : buffer; <END> } if (internalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } if (externalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; } BigDecimal externalValue = (new BigDecimal(obj.toString())) .subtract(internalRange.getMinimum()) .multiply(externalRange.getDelta()) .divide(internalRange.getDelta(), BIG_DECIMAL_DIVISION_SCALE, BigDecimal.ROUND_DOWN) .add(externalRange.getMinimum()); Double value = externalValue.doubleValue(); StringBuffer buffer = super.format(value, toAppendTo, pos); return buffer == null ? new StringBuffer() : buffer; }</code><technical_language>elvis-checks in return statements, I suggest add parentheses it: return (buffer == null ? new StringBuffer() : buffer); else easy parse line return buffer ... stop reading, while in some cases is returned "buffer" all</technical_language>

Target:
public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) { if (!(obj instanceof Number) || toAppendTo == null) { throw new IllegalArgumentException("Cannot format given Object as a Number: " + obj); } @Nullable LamiGraphRange internalRange = fInternalRange; @Nullable LamiGraphRange externalRange = fExternalRange; if (internalRange == null || externalRange == null) { StringBuffer buffer = super.format(obj, toAppendTo, pos); return (buffer == null ? new StringBuffer() : buffer); } if (internalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return (buffer == null ? new StringBuffer() : buffer); } if (externalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { StringBuffer buffer = super.format(externalRange.getMinimum().doubleValue(), toAppendTo, pos); return (buffer == null ? new StringBuffer() : buffer); } BigDecimal externalValue = (new BigDecimal(obj.toString())) .subtract(internalRange.getMinimum()) .multiply(externalRange.getDelta()) .divide(internalRange.getDelta(), BIG_DECIMAL_DIVISION_SCALE, BigDecimal.ROUND_DOWN) .add(externalRange.getMinimum()); Double value = externalValue.doubleValue(); StringBuffer buffer = super.format(value, toAppendTo, pos); return (buffer == null ? new StringBuffer() : buffer); }
Source:
<code>public Container readContainerHeader(final int major, final InputStream inputStream) { final byte[] peek = new byte[4]; try { int character = inputStream.read(); if (character == -1) <START> return readContainerHeader(new ByteArrayInputStream((major >= 3 ? CramIO.ZERO_F_EOF_MARKER : CramIO.ZERO_B_EOF_MARKER))); <END> peek[0] = (byte) character; for (int i = 1; i < peek.length; i++) { character = inputStream.read(); if (character == -1) throw new RuntimeException("Incomplete or broken stream."); peek[i] = (byte) character; } } catch (final IOException e) { throw new RuntimeIOException(e); } final int containerByteSize = CramInt.readInt32(peek); final ReferenceContext refContext = new ReferenceContext(ITF8.readUnsignedITF8(inputStream)); final Container container = new Container(refContext); container.containerByteSize = containerByteSize; container.alignmentStart = ITF8.readUnsignedITF8(inputStream); container.alignmentSpan = ITF8.readUnsignedITF8(inputStream); container.nofRecords = ITF8.readUnsignedITF8(inputStream); container.globalRecordCounter = LTF8.readUnsignedLTF8(inputStream); container.bases = LTF8.readUnsignedLTF8(inputStream); container.blockCount = ITF8.readUnsignedITF8(inputStream); container.landmarks = CramIntArray.array(inputStream); if (major >= 3) container.checksum = CramInt.readInt32(inputStream); return container; }</code><technical_language>Mildly crazy recursion, this change recursive instead of indirectly, allow unused method deleted: suggestion return readContainerHeader(major, new ByteArrayInputStream((major >= 3 ? CramIO.ZERO_F_EOF_MARKER : CramIO.ZERO_B_EOF_MARKER)));</technical_language>

Target:
public static Container readContainerHeader(final int major, final InputStream inputStream) { final byte[] peek = new byte[4]; try { int character = inputStream.read(); if (character == -1) { final int majorVersionForEOF = 2; final byte[] eofMarker = major >= 3 ? CramIO.ZERO_F_EOF_MARKER : CramIO.ZERO_B_EOF_MARKER; try (final ByteArrayInputStream eofBAIS = new ByteArrayInputStream(eofMarker)) { return readContainerHeader(majorVersionForEOF, eofBAIS); } } peek[0] = (byte) character; for (int i = 1; i < peek.length; i++) { character = inputStream.read(); if (character == -1) throw new RuntimeException("Incomplete or broken stream."); peek[i] = (byte) character; } } catch (final IOException e) { throw new RuntimeIOException(e); } final int containerByteSize = CramInt.readInt32(peek); final ReferenceContext refContext = new ReferenceContext(ITF8.readUnsignedITF8(inputStream)); final Container container = new Container(refContext); container.containerByteSize = containerByteSize; container.alignmentStart = ITF8.readUnsignedITF8(inputStream); container.alignmentSpan = ITF8.readUnsignedITF8(inputStream); container.nofRecords = ITF8.readUnsignedITF8(inputStream); container.globalRecordCounter = LTF8.readUnsignedLTF8(inputStream); container.bases = LTF8.readUnsignedLTF8(inputStream); container.blockCount = ITF8.readUnsignedITF8(inputStream); container.landmarks = CramIntArray.array(inputStream); if (major >= 3) container.checksum = CramInt.readInt32(inputStream); return container; }
Source:
<code>public static void createTable(Connection c, String storageKey, Persistable p) { String sqlStatement = DatabaseHelper.getTableCreateString(storageKey, p); PreparedStatement preparedStatement = null; try { preparedStatement = c.prepareStatement(sqlStatement); preparedStatement.execute(); } catch (SQLException e) { } finally { if (preparedStatement != null) { try { preparedStatement.close(); } catch (SQLException e) { <START> } <END> } } }</code><technical_language>want execute sql in a try close statement safely a lot. I recommend writing a helper function takes in a statement, safely executes closes it, repeat 10 lines of try/catch/finally code</technical_language>

Target:
public static void createTable(Connection c, String storageKey, Persistable p) { String sqlStatement = DatabaseHelper.getTableCreateString(storageKey, p); PreparedStatement preparedStatement = null; try { preparedStatement = c.prepareStatement(sqlStatement); preparedStatement.execute(); } catch (SQLException e) { throw new RuntimeException(e); } finally { if (preparedStatement != null) { try { preparedStatement.close(); } catch (SQLException e) { e.printStackTrace(); } } } }
Source:
<code>private static RedisSentinelConfiguration getSentinelConfig(final BaseRedisProperties redis) { <START> LOGGER.trace("Setting Redis with Sentinel configuration on master '{}'", redis.getSentinel().getMaster()); <END> val sentinelConfig = new RedisSentinelConfiguration().master(redis.getSentinel().getMaster()); LOGGER.trace("Sentinel nodes configured are '{}'", redis.getSentinel().getNode()); sentinelConfig.setSentinels(createRedisNodesForProperties(redis)); sentinelConfig.setDatabase(redis.getDatabase()); if (StringUtils.hasText(redis.getPassword())) { sentinelConfig.setPassword(RedisPassword.of(redis.getPassword())); } return sentinelConfig; }</code><technical_language>consistent, {}</technical_language>

Target:
private static RedisSentinelConfiguration getSentinelConfig(final BaseRedisProperties redis) { LOGGER.debug("Setting Redis with Sentinel configuration on master [{}]", redis.getSentinel().getMaster()); val sentinelConfig = new RedisSentinelConfiguration().master(redis.getSentinel().getMaster()); LOGGER.debug("Sentinel nodes configured are [{}]", redis.getSentinel().getNode()); sentinelConfig.setSentinels(createRedisNodesForProperties(redis)); sentinelConfig.setDatabase(redis.getDatabase()); if (StringUtils.hasText(redis.getPassword())) { sentinelConfig.setPassword(RedisPassword.of(redis.getPassword())); } return sentinelConfig; }
Source:
<code>public AttributionView findByEntryNumber(@PathParam("entry-number") int entryNumber) { try { Optional<Entry> entry = entryDAO.findByEntryNumber(entryNumber); return entry.map(viewFactory::getNewEntryView).orElseThrow(NotFoundException::new); } catch (Throwable e) { <START> if (e.getCause() instanceof PSQLException && ((PSQLException) e.getCause()).getSQLState().equals("42P01")) { <END> return findBySerial(Optional.of(entryNumber)); } throw e; } }</code><technical_language>"42P01" this magic number extracted a constant</technical_language>

Target:
public AttributionView findByEntryNumber(@PathParam("entry-number") int entryNumber) { try { Optional<Entry> entry = entryDAO.findByEntryNumber(entryNumber); return entry.map(viewFactory::getNewEntryView).orElseThrow(NotFoundException::new); } catch (Throwable e) { if (e.getCause() instanceof PSQLException && ((PSQLException) e.getCause()).getSQLState().equals(POSTGRES_TABLE_NOT_EXIST_ERROR_CODE)) { return findBySerial(Optional.of(entryNumber)); } throw e; } }
Source:
<code>public static String getCountryName(String countryCode) { try { Locale l = new Locale("", countryCode); String displayCountry = l.getDisplayCountry(); return displayCountry.equals(countryCode) ? "Unknown" : displayCountry; <START> } catch (NullPointerException e) { <END> return "Unknown"; } }</code><technical_language>catch exceptions if this method is accept nulls guard them</technical_language>

Target:
public static String getCountryName(String countryCode) { if (countryCode == null){ countryCode = ""; } Locale l = new Locale("", countryCode); String displayCountry = l.getDisplayCountry(); return displayCountry.equals(countryCode) ? UNKNOWN_VALUE : displayCountry; }
Source:
<code>private void setWikidataEditCount() { String userName = sessionManager.getUserName(); if (StringUtils.isBlank(userName)) { return; } compositeDisposable.add(okHttpJsonApiClient .getWikidataEdits(userName) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(edits -> { <START> numberOfEdits += edits; <END> wikidataEditsText.setText(String.valueOf(edits)); }, e -> { Timber.e("Error:" + e); })); }</code><technical_language>suggestion numberOfEdits = edits;</technical_language>

Target:
private void setWikidataEditCount() { String userName = sessionManager.getUserName(); if (StringUtils.isBlank(userName)) { return; } compositeDisposable.add(okHttpJsonApiClient .getWikidataEdits(userName) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(edits -> { numberOfEdits = edits; wikidataEditsText.setText(String.valueOf(edits)); }, e -> { Timber.e("Error:" + e); })); }
Source:
<code>public void accept(FrameworkMember member, TestRule value) { ClassRule rule = member.getAnnotation(ClassRule.class); if (rule != null) { <START> RuleContainer.recordRuleOrder(value, rule.order()); <END> } result.add(value); }</code><technical_language>obvious modifying a thread local. I prefer recordRuleOrder() a non-static method. [ThreadLocal.inititalValue()](<LINK_0> initialize thread local a no-op</technical_language>

Target:
public void accept(FrameworkMember member, TestRule value) { ClassRule rule = member.getAnnotation(ClassRule.class); entries.add(new RuleContainer.RuleEntry(value, RuleContainer.RuleEntry.TYPE_TEST_RULE, rule != null ? rule.order() : null)); }
Source:
<code>public VoltTable[] run(SystemProcedureExecutionContext ctx, String selector) throws VoltAbortException { VoltTable[] results; if (selector.toUpperCase().equals("OVERVIEW")) { results = getOverviewInfo(); } else if (selector.toUpperCase().equals("DEPLOYMENT")) { results = getDeploymentInfo(); } <START> else if (selector.toUpperCase().equals("LICENSE")) <END> { results = getLicenseInfo(); } else { throw new VoltAbortException(String.format("Invalid @SystemInformation selector %s.", selector)); } return results; }</code><technical_language>is recommended call equals method constant avoid a null pointer variable is null. equalsIgnoreCase more efficient converting string uppercase comparing. "LICENSE".equalsIgnoreCase(selector)</technical_language>

Target:
public VoltTable[] run(SystemProcedureExecutionContext ctx, String selector) throws VoltAbortException { VoltTable[] results; if ("OVERVIEW".equalsIgnoreCase(selector.toString())) { results = getOverviewInfo(); } else if ("DEPLOYMENT".equalsIgnoreCase(selector.toString())) { results = getDeploymentInfo(); } else if ("LICENSE".equalsIgnoreCase(selector.toString())) { results = getLicenseInfo(); } else { throw new VoltAbortException(String.format("Invalid @SystemInformation selector %s.", selector)); } return results; }