auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void storeSettings() { if (preferences.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE) != fontOverrideProperty.getValue()) { restartWarnings.add(Localization.lang("Override font settings")); preferences.putBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE, fontOverrideProperty.getValue()); } int newFontSize = Integer.parseInt(fontSizeProperty.getValue()); if (preferences.getInt(JabRefPreferences.MAIN_FONT_SIZE) != newFontSize) { restartWarnings.add(Localization.lang("Override font size")); preferences.putInt(JabRefPreferences.MAIN_FONT_SIZE, newFontSize); } if (themeLightProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.MAIN_CSS)) { restartWarnings.add(Localization.lang("Theme changed to light theme.")); preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.MAIN_CSS); } else if (themeDarkProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.DARK_CSS)) { restartWarnings.add(Localization.lang("Theme changed to dark theme.")); preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.DARK_CSS); } else if (themeCustomProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.getCustomCss())) { <START> restartWarnings.add(Localization.lang("Theme change to a custom theme.")); <END> preferences.put(JabRefPreferences.FX_THEME, preferences.getPathToCustomTheme()); } }</code><technical_language>Please changed instead of change (also change in localization)</technical_language>

Target:
public void storeSettings() { if (preferences.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE) != fontOverrideProperty.getValue()) { restartWarnings.add(Localization.lang("Override font settings")); preferences.putBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONT_SIZE, fontOverrideProperty.getValue()); } int newFontSize = Integer.parseInt(fontSizeProperty.getValue()); if (preferences.getInt(JabRefPreferences.MAIN_FONT_SIZE) != newFontSize) { restartWarnings.add(Localization.lang("Override font size")); preferences.putInt(JabRefPreferences.MAIN_FONT_SIZE, newFontSize); } if (themeLightProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.MAIN_CSS)) { restartWarnings.add(Localization.lang("Theme changed to light theme.")); preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.MAIN_CSS); } else if (themeDarkProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.DARK_CSS)) { restartWarnings.add(Localization.lang("Theme changed to dark theme.")); preferences.put(JabRefPreferences.FX_THEME, ThemeLoader.DARK_CSS); } else if (themeCustomProperty.getValue() && !preferences.get(JabRefPreferences.FX_THEME).equals(ThemeLoader.getCustomCss())) { restartWarnings.add(Localization.lang("Theme changed to a custom theme.")); preferences.put(JabRefPreferences.FX_THEME, preferences.getPathToCustomTheme()); } }
Source:
<code>public void process(Exchange exchange) throws Exception { log.debug("Processing solr update"); final Message in = exchange.getIn(); Document msgBody = MessageUtil.getDocumentBody(in); Element body = msgBody.getRootElement(); String pidValue = body.getChild("pid", ATOM_NS).getTextTrim(); String action = body.getChild("actionType", ATOM_NS).getTextTrim(); IndexingActionType actionType = IndexingActionType.getAction(action); <START> PID pid = PIDs.get(pidValue); <END> in.setHeader(FCREPO_URI, pid.getRepositoryPath()); in.setHeader(CdrUpdateAction, actionType.getName()); }</code><technical_language>a small thing, consider moving this line line 52. organization strikes more logical, lines get pid, while lines 53-54 get actionType</technical_language>

Target:
public void process(Exchange exchange) throws Exception { log.debug("Processing solr update"); final Message in = exchange.getIn(); Document msgBody = MessageUtil.getDocumentBody(in); Element body = msgBody.getRootElement(); String pidValue = body.getChild("pid", ATOM_NS).getTextTrim(); PID pid = PIDs.get(pidValue); String action = body.getChild("actionType", ATOM_NS).getTextTrim(); IndexingActionType actionType = IndexingActionType.getAction(action); in.setHeader(FCREPO_URI, pid.getRepositoryPath()); in.setHeader(CdrUpdateAction, actionType.getName()); }
Source:
<code><START> public List<VariantSourceMongo> findAllVariantSourcesForBeacon() { <END> return repository.findAllForBeacon(); }</code><technical_language>is true, returning fields need some is inefficient. I wrapped a call convert in findAll :smiley:</technical_language>

Target:
public List<VariantSource> findAllVariantSourcesForBeacon() { return convert(repository.findAllForBeacon()); }
Source:
<code>protected static Set<Object> setupSingletons() { Set<Object> result = new HashSet<>(); AutomationServer as = Framework.getService(AutomationServer.class); for (Class<? extends MessageBodyReader<?>> readerKlass : as.getReaders()) { try { result.add(readerKlass.getDeclaredConstructor().newInstance()); } catch (ReflectiveOperationException e) { <START> log.error("Unable to instantiate MessageBodyReader : " + readerKlass, e); <END> } } for (Class<? extends MessageBodyWriter<?>> writerKlass : as.getWriters()) { try { result.add(writerKlass.getDeclaredConstructor().newInstance()); } catch (ReflectiveOperationException e) { log.error("Unable to instantiate MessageBodyWriter : " + writerKlass, e); } } result.add(new AutomationServiceProvider()); result.add(new AutomationServerProvider()); result.add(new JsonFactoryProvider()); result.add(new CoreSessionProvider()); result.add(new CoreIODelegate()); return result; }</code><technical_language>suggestion log.error("Unable instantiate MessageBodyReader: {}", readerKlass, e);</technical_language>

Target:
protected static Set<Object> setupSingletons() { Set<Object> result = new HashSet<>(); AutomationServer as = Framework.getService(AutomationServer.class); for (Class<? extends MessageBodyReader<?>> readerKlass : as.getReaders()) { try { result.add(readerKlass.getDeclaredConstructor().newInstance()); } catch (ReflectiveOperationException e) { log.error("Unable to instantiate MessageBodyReader: {}", readerKlass, e); } } for (Class<? extends MessageBodyWriter<?>> writerKlass : as.getWriters()) { try { result.add(writerKlass.getDeclaredConstructor().newInstance()); } catch (ReflectiveOperationException e) { log.error("Unable to instantiate MessageBodyWriter: {}", writerKlass, e); } } result.add(new AutomationServiceProvider()); result.add(new AutomationServerProvider()); result.add(new JsonFactoryProvider()); result.add(new CoreSessionProvider()); result.add(new CoreIODelegate()); return result; }
Source:
<code>static public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); <START> if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; <END> }</code><technical_language>Nitpick, Long.compare(v1, v2);</technical_language>

Target:
static public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); return Long.compare(v1, v2); }
Source:
<code>private DocumentStore(File location, KeyProvider keyProvider) throws DatastoreException, IOException, SQLException { try { this.location = location; this.databaseName = location.toString(); this.database = new DatabaseImpl(location, keyProvider); this.query = new IndexManagerImpl(database); <START> } catch (DatastoreException e) { <END> closeQuietlyOnException(); throw e; } catch (IOException e) { closeQuietlyOnException(); throw e; } catch (SQLException e) { closeQuietlyOnException(); throw e; } }</code><technical_language>catch Exception repeat code? (I wish multicatch for this)</technical_language>

Target:
private DocumentStore(File location, KeyProvider keyProvider) throws DatastoreException, IOException, SQLException { try { this.location = location; this.extensionsLocation = new File(location, EXTENSIONS_LOCATION_NAME); this.databaseName = location.toString(); this.database = new DatabaseImpl(location, extensionsLocation, keyProvider); this.query = new IndexManagerImpl(database, extensionsLocation, keyProvider); } catch (DatastoreException e) { closeQuietlyOnException(); throw e; } catch (IOException e) { closeQuietlyOnException(); throw e; } catch (SQLException e) { closeQuietlyOnException(); throw e; } }
Source:
<code>private void writeGarbageToLogUnit(RuntimeLayout runtimeLayout, String logUnitServer, @NonNull IToken token, @NonNull LogData garbageEntry) { LogUnitClient client = runtimeLayout.getLogUnitClient(logUnitServer); garbageEntry.setId(runtime.getParameters().getClientId()); final int numRetries = 3; for (int x = 0; x < numRetries; x++) { try { CFUtils.getUninterruptibly(client.writeGarbageEntries(Collections.singletonList(garbageEntry)), NetworkException.class, TimeoutException.class, WrongEpochException.class); } catch (NetworkException | TimeoutException e) { <START> log.warn("writeGarbageToLogUnit: accessing LogUnit encounters a network error on try {}", <END> logUnitServer, x, e); Duration retryRate = runtime.getParameters().getConnectionRetryRate(); Sleep.sleepUninterruptibly(retryRate); } catch (WrongEpochException wee) { long serverEpoch = wee.getCorrectEpoch(); long runtimeEpoch = runtime.getLayoutView().getLayout().getEpoch(); log.warn("writeGarbageToLogUnit[{}]: wrongEpochException, runtime is in epoch {}, " + "while server is in epoch {}. Invalidate layout for this client and retry, attempt: " + "{}/{}", token.getSequence(), runtimeEpoch, serverEpoch, x + 1, numRetries); runtime.invalidateLayout(); } } }</code><technical_language>attempt: {}/{} handling for WrongEpochException</technical_language>

Target:
private void writeGarbageToLogUnit(RuntimeLayout runtimeLayout, String logUnitServer, @NonNull IToken token, @NonNull LogData garbageEntry) { LogUnitClient client = runtimeLayout.getLogUnitClient(logUnitServer); garbageEntry.setId(runtime.getParameters().getClientId()); final int numRetries = 3; for (int x = 0; x < numRetries; x++) { try { CFUtils.getUninterruptibly(client.writeGarbageEntries(Collections.singletonList(garbageEntry)), NetworkException.class, TimeoutException.class, WrongEpochException.class); return; } catch (NetworkException | TimeoutException e) { log.warn("writeGarbageToLogUnit: accessing LogUnit encounters a network error. " + "Invalidate layout for this client and retry, attempt: {}/{}", logUnitServer, x + 1, numRetries, e); Duration retryRate = runtime.getParameters().getConnectionRetryRate(); Sleep.sleepUninterruptibly(retryRate); } catch (WrongEpochException wee) { long serverEpoch = wee.getCorrectEpoch(); long runtimeEpoch = runtime.getLayoutView().getLayout().getEpoch(); log.warn("writeGarbageToLogUnit[{}]: wrongEpochException, runtime is in epoch {}, " + "while server is in epoch {}. Invalidate layout for this client and retry, attempt: " + "{}/{}", token.getSequence(), runtimeEpoch, serverEpoch, x + 1, numRetries); runtime.invalidateLayout(); } } String errorMsg = String.format("Writing garbage to %s fails after %d attempts", logUnitServer, numRetries); log.warn(errorMsg); throw new RetryExhaustedException(errorMsg); }
Source:
<code>private void authorizeResourceView(final Resource resource) throws AccessDeniedException { try { if (!adminService.isAdmin(AuthorizationService.Operation.ADMIN)) { <START> if (!authorizationService.isAuthorized(AuthorizationService.Operation.VIEW, resource)) { <END> throw new AccessDeniedException(AuthorizationService.Operation.VIEW, resource); } } } catch (final PluginException e) { throw new ServiceTemporarilyUnavailableException("Error calling authorization plugin", e); } }</code><technical_language>do single if</technical_language>

Target:
private void authorizeResourceView(final Resource resource) throws AccessDeniedException { try { if (!(adminService.isAdmin(AuthorizationService.Operation.ADMIN) || authorizationService.isAuthorized(AuthorizationService.Operation.VIEW, resource))) { throw new AccessDeniedException(AuthorizationService.Operation.VIEW, resource); } } catch (final PluginException e) { throw new ServiceTemporarilyUnavailableException("Error calling authorization plugin", e); } }
Source:
<code>public void put(String url, String response) throws IOException { final File transcriptDir = getTranscriptDir(); <START> if (transcriptDir == null) throw new IOException("Transcript directory doesn't exist"); <END> String hash = Sha1Util.SHA1(url); File file = new File(transcriptDir, hash); FileOutputStream out = new FileOutputStream(file); out.write(response.getBytes()); out.close(); }</code><technical_language>I suggest changing "doesn't exist" "not found" "nor available" in methods</technical_language>

Target:
public void put(String url, String response) throws IOException { final File transcriptDir = getTranscriptDir(); if (transcriptDir == null) throw new IOException("Transcript directory not found"); String hash = Sha1Util.SHA1(url); File file = new File(transcriptDir, hash); FileOutputStream out = new FileOutputStream(file); out.write(response.getBytes()); out.close(); }
Source:
<code>private void treeExpandingCollapsingAction(final TreeItem treeItem, final DTreeItem dTreeItem, final boolean expand, final String errorMessage) { if ((expand && !dTreeItem.isExpanded()) || (!expand && dTreeItem.isExpanded())) { final Shell activeShell <START> = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); <END> activeShell.getDisplay().asyncExec(new Runnable() { @Override public void run() { IWorkbench wb = PlatformUI.getWorkbench(); IProgressService ps = wb.getProgressService(); try { ps.busyCursorWhile(new ExpandDTreeItemRunnableWithProgress(session, dTreeItem, expand)); } catch (InvocationTargetException e) { TreeUIPlugin.INSTANCE.log(new Status(IStatus.ERROR, TreeUIPlugin.ID, "Error while " + errorMessage, e)); } catch (InterruptedException e) { Display.getDefault().asyncExec(new ChangeExpandeStateRunnable(treeItem, !expand)); } } }); } }</code><technical_language>treeItem.getParent().getShell()</technical_language>

Target:
private void treeExpandingCollapsingAction(final TreeItem treeItem, final DTreeItem dTreeItem, final boolean expand, final String errorMessage) { if ((expand && !dTreeItem.isExpanded()) || (!expand && dTreeItem.isExpanded())) { final Shell activeShell = tree.getShell(); activeShell.getDisplay().asyncExec(new Runnable() { @Override public void run() { IWorkbench wb = PlatformUI.getWorkbench(); IProgressService ps = wb.getProgressService(); try { ps.busyCursorWhile(new ExpandDTreeItemRunnableWithProgress(session, dTreeItem, expand)); } catch (InvocationTargetException e) { TreeUIPlugin.INSTANCE.log(new Status(IStatus.ERROR, TreeUIPlugin.ID, "Error while " + errorMessage, e)); } catch (InterruptedException e) { Display.getDefault().asyncExec(new ChangeExpandeStateRunnable(treeItem, !expand)); } } }); } }
Source:
<code>public void testSendSerialData802Timeout() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new TimeoutException()).when(xbeeDevice, "sendXBeePacket", tx16Packet); PowerMockito.doThrow(new TimeoutException()).when(xbeeDevice, "sendXBeePacket", tx64Packet); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx16 frame shouldn't have been sent successfully."); <START> } catch (InvalidOperatingModeException e) { <END> fail("This exception shouldn't be thrown now."); } catch (TimeoutException e) { } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (TimeoutException e) { } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (TimeoutException e) { } }</code><technical_language>I want check for a specific Exception (like in this case) I catch Exception I check is instance I expecting: try { do stuff; } catch (Exception e) { assertEquals(TimeoutException.class, e.getClass()); } EDIT: I some more cases this below</technical_language>

Target:
public void testSendSerialData802Timeout() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new TimeoutException()).when(xbeeDevice, "sendXBeePacket", tx16Packet); PowerMockito.doThrow(new TimeoutException()).when(xbeeDevice, "sendXBeePacket", tx64Packet); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx16 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(TimeoutException.class, e.getClass()); } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(TimeoutException.class, e.getClass()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(TimeoutException.class, e.getClass()); } }
Source:
<code>public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getRestoreSnapshotCommand())) { restoreSnapshot(); } else if (command.equals(getDeleteSnapshotCommand())) { deleteSnapshot(); } else if (command.equals(getDeleteAllSnapshotsCommand())) { deleteAllSnapshots(); } else if (command.equals(getActivateSnapshotCommand())) { activateSnapshot(); } else if (command.equals(getDeactivateSnapshotCommand())) { deactivateSnapshot(); } else if (command.getName().equals("onRestoreSnapshot")) { onRestoreSnapshot(); } else if (command.getName().equals("onDeleteSnapshot")) { onDeleteSnapshot(); } else if (command.getName().equals("onDeleteAllSnapshots")) { onDeleteAllSnapshots(); } else if (command.getName().equals("onActivateSnapshot")) { onActivateSnapshot(); } else if (command.getName().equals("onDeactivateSnapshot")) { onDeactivateSnapshot(); } else if (command.getName().equals("cancelConfirmation")) { setConfirmWindow(null); } else if (command.equals(getCreateSnapshotCommand())) { createSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { onCreateSnapshot(); } else if (command.getName().equalsIgnoreCase("cancel")) { setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if <START> (command.getName().equalsIgnoreCase("onEditSnapshotScheduleWithoutConfirmation")) <END> { onEditSnapshotScheduleWithoutConfirmation(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } }</code><technical_language>onEditSnapshotSchedule</technical_language>

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getRestoreSnapshotCommand())) { restoreSnapshot(); } else if (command.equals(getDeleteSnapshotCommand())) { deleteSnapshot(); } else if (command.equals(getDeleteAllSnapshotsCommand())) { deleteAllSnapshots(); } else if (command.equals(getActivateSnapshotCommand())) { activateSnapshot(); } else if (command.equals(getDeactivateSnapshotCommand())) { deactivateSnapshot(); } else if (command.getName().equals("onRestoreSnapshot")) { onRestoreSnapshot(); } else if (command.getName().equals("onDeleteSnapshot")) { onDeleteSnapshot(); } else if (command.getName().equals("onDeleteAllSnapshots")) { onDeleteAllSnapshots(); } else if (command.getName().equals("onActivateSnapshot")) { onActivateSnapshot(); } else if (command.getName().equals("onDeactivateSnapshot")) { onDeactivateSnapshot(); } else if (command.getName().equals("cancelConfirmation")) { setConfirmWindow(null); } else if (command.equals(getCreateSnapshotCommand())) { createSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { onCreateSnapshot(); } else if (command.getName().equalsIgnoreCase("cancel")) { setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotScheduleInternal")) { onEditSnapshotScheduleInternal(); } }
Source:
<code>private String executeBashScript(final String script) { <START> final Script command = new Script("/bin/bash", _timeout.getMillis(), s_logger); <END> command.add("-c"); command.add(script); return command.execute(); }</code><technical_language>Please consider adding overridden version of Script(String, int, Logger) constructor accepts Duration encapsulate this type conversion</technical_language>

Target:
private String executeBashScript(final String script) { final Script command = new Script("/bin/bash", _timeout, s_logger); command.add("-c"); command.add(script); return command.execute(); }
Source:
<code>public DataSet<V> distinct(String name, boolean isLast, OperationContext context, boolean pushScope, String scopeDetail) { pushScopeIfNeeded(context, pushScope, scopeDetail); try { <START> int numPartitions = SparkUtils.getPartitions(rdd, defaultPartitions); <END> Dataset<Row> result = toSparkRow(this,context) .distinct(); return toSpliceLocatedRow(result,context); } catch (Exception se){ throw new RuntimeException(se); } finally { if (pushScope) context.popScope(); } }</code><technical_language>variable numPartitions is used, introduced here</technical_language>

Target:
public DataSet<V> distinct(String name, boolean isLast, OperationContext context, boolean pushScope, String scopeDetail) { pushScopeIfNeeded(context, pushScope, scopeDetail); try { Dataset<Row> result = toSparkRow(this,context) .distinct(); return toSpliceLocatedRow(result,context); } catch (Exception se){ throw new RuntimeException(se); } finally { if (pushScope) context.popScope(); } }
Source:
<code>protected String buildItemKey(ConcurStandardAccountingExtractDetailLine saeLine) { String objectCodeForKey = saeLine.getJournalAccountCode(); if (Boolean.TRUE.equals(saeLine.getJournalAccountCodeOverridden())) { objectCodeForKey = buildFakeObjectCodeToLeaveDetailLineUnmerged(); } return new StringBuilder(INITIAL_BUILDER_SIZE) <START> .append(makeEmptyIfBlank(saeLine.getReportId())) <END> .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getChartOfAccountsCode())) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getAccountNumber())) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getSubAccountNumber(), getDashSubAccountNumber())) .append(PIPE_CHAR).append(makeEmptyIfBlank(objectCodeForKey)) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getSubObjectCode(), getDashSubObjectCode())) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getProjectCode(), getDashProjectCode())) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getOrgRefId())) .toString(); }</code><technical_language>If report ID is blank, is a line item error rejected. is for PDP processing, collector</technical_language>

Target:
protected String buildItemKey(ConcurStandardAccountingExtractDetailLine saeLine) { String objectCodeForKey = saeLine.getJournalAccountCode(); if (Boolean.TRUE.equals(saeLine.getJournalAccountCodeOverridden())) { objectCodeForKey = buildFakeObjectCodeToLeaveDetailLineUnmerged(); } return new StringBuilder(INITIAL_BUILDER_SIZE) .append(saeLine.getReportId()) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getChartOfAccountsCode())) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getAccountNumber())) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getSubAccountNumber(), getDashSubAccountNumber())) .append(PIPE_CHAR).append(makeEmptyIfBlank(objectCodeForKey)) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getSubObjectCode(), getDashSubObjectCode())) .append(PIPE_CHAR).append(StringUtils.defaultIfBlank(saeLine.getProjectCode(), getDashProjectCode())) .append(PIPE_CHAR).append(makeEmptyIfBlank(saeLine.getOrgRefId())) .toString(); }
Source:
<code>protected String generateHelpMessage() { StringBuilder sb = new StringBuilder(); sb.append( "News Categories (example: !news toronto):" ); for ( String category : newsFeedsByCategory.keySet() ) { if ( category.equals( "top" ) ) { sb.append( "\n" ); <START> sb.append( " General:" ); <END> } else if ( category.equals( "redhat" ) ) { sb.append( "\n" ); sb.append( " Open Source:" ); } else if ( category.equals( "politics" ) ) { sb.append( "\n" ); sb.append( " Topics:" ); } else if ( category.equals( "sports" ) ) { sb.append( "\n" ); sb.append( " Sports:" ); } else if ( category.equals( "bc" ) ) { sb.append( "\n" ); sb.append( " Regional:" ); } sb.append( " { " + category + " }" ); } return sb.toString(); }</code><technical_language>For is easier maintain in future/see group a category belongs to: instead of manually adding newline for groupings, create a mapping of categories grouping a double for loop</technical_language>

Target:
protected String generateHelpMessage() { StringBuilder sb = new StringBuilder(); sb.append( "News Categories (example: !news toronto):" ); String prevGenre = null; for ( String category : newsFeedsByCategory.keySet() ) { String currentGenre = newsFeedsByCategory.get( category ).getLeft(); if ( !currentGenre.equals( prevGenre ) ) { sb.append( "\n" ); sb.append( " " + currentGenre + ":" ); prevGenre = currentGenre; } sb.append( " { " + category + " }" ); } return sb.toString(); }
Source:
<code>public void sendTerminationNotification(InstanceGroup group, String instance) { String propEmailGlobalReceiver = "simianarmy.chaos.notification.global.receiverEmail"; String propEmailGroupEnabled = String.format("%s%s.%s.notification.enabled", NS, group.type(), group.name()); <START> if (cfg.getStr(propEmailGlobalReceiver) == null) { <END> LOGGER.debug(String.format("No global notification termination turned on, set %s", propEmailGlobalReceiver)); if (!cfg.getBoolOrElse(propEmailGroupEnabled, false)) { LOGGER.debug(String.format("Group %s [type %s] does not turn on termination notification, " + "set %s=true to enable it.", group.name(), group.type(), propEmailGroupEnabled)); return; } } ChaosEmailNotifier notifier = context().chaosEmailNotifier(); if (notifier == null) { String msg = "Chaos email notifier is not set."; LOGGER.error(msg); throw new RuntimeException(msg); } notifier.sendTerminationNotification(group, instance); }</code><technical_language>I this is a correct logic. If a global email is set then, termination email is matter is enabled not. I check termination email is enabled try call getOwnerEmail send notification</technical_language>

Target:
public void sendTerminationNotification(InstanceGroup group, String instance) { String propEmailGlobalEnabled = "simianarmy.chaos.notification.global.enabled"; String propEmailGroupEnabled = String.format("%s%s.%s.notification.enabled", NS, group.type(), group.name()); ChaosEmailNotifier notifier = context().chaosEmailNotifier(); if (notifier == null) { String msg = "Chaos email notifier is not set."; LOGGER.error(msg); throw new RuntimeException(msg); } if (cfg.getBoolOrElse(propEmailGroupEnabled, false)) { notifier.sendTerminationNotification(group, instance); } if (cfg.getBoolOrElse(propEmailGlobalEnabled, false)) { notifier.sendTerminationGlobalNotification(group, instance); } }
Source:
<code><START> public void setLicenses(LicenseConfiguration[] licenses) { } <END></code><technical_language>I thought I implemented this for MavenArtifactGenerator...</technical_language>

Target:
public void setLicenses(LicenseConfiguration[] licenses) { this.licenses = (MavenLicenseConfiguration[]) licenses; }
Source:
<code>protected void updateElementsInSessionThread(final IChildrenUpdate update) { IProcesses procService = getServicesTracker().getService(IProcesses.class); final IContainerDMContext contDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IContainerDMContext.class); if (procService == null || contDmc == null) { handleFailedUpdate(update); return; } procService.getProcessesBeingDebugged( contDmc, new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update){ @Override public void handleCompleted() { if (!isSuccess() || !(getData() instanceof IExecutionDMContext[])) { handleFailedUpdate(update); return; } IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData(); if (fHideRunningThreadsProperty) { IRunControl runControl = getServicesTracker().getService(IRunControl.class); if (runControl == null) { handleFailedUpdate(update); return; } <START> Vector<IExecutionDMContext> execDmcsNotRunning = new Vector<IExecutionDMContext>(); <END> for (IExecutionDMContext execDmc : execDmcs) { if (runControl.isSuspended(execDmc) || runControl.isStepping(execDmc)) { execDmcsNotRunning.add(execDmc); } } execDmcs = execDmcsNotRunning.toArray(new IExecutionDMContext[execDmcsNotRunning.size()]); } fillUpdateWithVMCs(update, execDmcs); update.done(); } }); }</code><technical_language>Vector instead of ArrayList? Vector is synchronized, ArrayList is not</technical_language>

Target:
protected void updateElementsInSessionThread(final IChildrenUpdate update) { IProcesses procService = getServicesTracker().getService(IProcesses.class); final IContainerDMContext contDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IContainerDMContext.class); if (procService == null || contDmc == null) { handleFailedUpdate(update); return; } procService.getProcessesBeingDebugged( contDmc, new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update){ @Override public void handleCompleted() { if (!isSuccess() || !(getData() instanceof IExecutionDMContext[])) { handleFailedUpdate(update); return; } IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData(); if (fHideRunningThreadsProperty) { IRunControl runControl = getServicesTracker().getService(IRunControl.class); if (runControl == null) { handleFailedUpdate(update); return; } List<IExecutionDMContext> execDmcsNotRunning = new ArrayList<IExecutionDMContext>(); for (IExecutionDMContext execDmc : execDmcs) { if (runControl.isSuspended(execDmc) || runControl.isStepping(execDmc)) { execDmcsNotRunning.add(execDmc); } } execDmcs = execDmcsNotRunning.toArray(new IExecutionDMContext[execDmcsNotRunning.size()]); } fillUpdateWithVMCs(update, execDmcs); update.done(); } }); }
Source:
<code>private static List<ExceptionInfo> getThrows(DetailAST ast) { final List<ExceptionInfo> returnValue = new ArrayList<>(); final DetailAST throwsAST = ast .findFirstToken(TokenTypes.LITERAL_THROWS); if (throwsAST != null) { DetailAST exception = throwsAST.getFirstChild(); while (exception != null) { if (exception.getType() == TokenTypes.IDENT || exception.getType() == TokenTypes.DOT) { DetailAST child = exception; final FullIdent ident = FullIdent.createFullIdent(child); <START> while (child.getType() == TokenTypes.DOT) { child = child.getFirstChild(); } <END> final ExceptionInfo exceptionInfo = new ExceptionInfo(child, new ClassInfo(new Token(ident))); returnValue.add(exceptionInfo); } exception = exception.getNextSibling(); } } return returnValue; }</code><technical_language>Please explain do need this logic</technical_language>

Target:
private static List<ExceptionInfo> getThrows(DetailAST ast) { final List<ExceptionInfo> returnValue = new ArrayList<>(); final DetailAST throwsAST = ast .findFirstToken(TokenTypes.LITERAL_THROWS); if (throwsAST != null) { DetailAST child = throwsAST.getFirstChild(); while (child != null) { if (child.getType() == TokenTypes.IDENT || child.getType() == TokenTypes.DOT) { returnValue.add(getExceptionInfo(child)); } child = child.getNextSibling(); } } return returnValue; }
Source:
<code>private void confirmVerify() { try { StringBuffer message = new StringBuffer(); message.append(getString(R.string.fingerprint_for_you)).append("\n").append(prettyPrintFingerprint(mOtrSession.getLocalFingerprint())).append("\n\n"); message.append(getString(R.string.fingerprint_for_)).append(remoteAddress).append("\n").append(prettyPrintFingerprint(mOtrSession.getRemoteFingerprint())).append("\n\n"); message.append(getString(R.string.are_you_sure_you_want_to_confirm_this_key_)); new AlertDialog.Builder(this).setTitle(R.string.verify_key_).setMessage(message.toString()) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { verifyRemoteFingerprint(); } }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).show(); } catch (Exception e) { <START> LogCleaner.error(ImApp.LOG_TAG, "unable to perform manual key verification", e); <END> } }</code><technical_language>kind of exceptions catch here</technical_language>

Target:
private void confirmVerify() { try { StringBuffer message = new StringBuffer(); message.append(getString(R.string.fingerprint_for_you)).append("\n").append(prettyPrintFingerprint(mOtrSession.getLocalFingerprint())).append("\n\n"); message.append(getString(R.string.fingerprint_for_)).append(remoteAddress).append("\n").append(prettyPrintFingerprint(mOtrSession.getRemoteFingerprint())).append("\n\n"); message.append(getString(R.string.are_you_sure_you_want_to_confirm_this_key_)); new AlertDialog.Builder(this).setTitle(R.string.verify_key_).setMessage(message.toString()) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { verifyRemoteFingerprint(); } }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).show(); } catch (RemoteException e) { LogCleaner.error(ImApp.LOG_TAG, "unable to perform manual key verification", e); } }
Source:
<code>private static byte getByteFromType(ITmfStateValue.Type type) { switch (type) { case NULL: return TYPE_NULL; case INTEGER: return TYPE_INTEGER; case STRING: return TYPE_STRING; case LONG: return TYPE_LONG; case DOUBLE: default: <START> throw new IllegalStateException("Data type not supported"); END> } }</code><technical_language>add type</technical_language>

Target:
private static byte getByteFromType(ITmfStateValue.Type type) { switch (type) { case NULL: return TYPE_NULL; case INTEGER: return TYPE_INTEGER; case STRING: return TYPE_STRING; case LONG: return TYPE_LONG; case DOUBLE: default: throw new IllegalStateException("Data type " + type + " not supported"); } }
Source:
<code>public static void <START> setNetworkVdsmName(Network <END> network) { if (network == null) { return; } String networkName = network.getName(); Guid networkId = network.getId(); if (networkId == null ) { networkId = Guid.newGuid(); } if (networkName.length() > BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH || !networkName.matches("^[0-9a-zA-Z_-]+$")) { network.setVdsmName("on" + networkId.toString() .replaceAll("[^a-zA-Z0-9]+", "") .substring(0, BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH - 2)); } else { network.setVdsmName(networkName); } }</code><technical_language>that: public static void setNetworkVdsmName(Network network) { String networkName = Objects.requireNonNull(network).getName(); if (VALID_VDS_NAME_PATTERN.matcher(networkName).matches()) { network.setVdsmName(networkName); } else { network.setVdsmName("on" + Objects.requireNonNull(network.getId()).toString() .replaceAll("[^a-zA-Z0-9]+", "") .substring(0, BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH - 2)); } }</technical_language>

Target:
public static void setNetworkVdsmName(Network network) { if (network == null) { return; } String networkName = network.getName(); Guid networkId = network.getId(); if (networkId == null ) { networkId = Guid.newGuid(); } Matcher vdsmNameMatcher = VALID_VDS_NAME_PATTERN.matcher(networkName); if (networkName.length() > BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH || !vdsmNameMatcher.matches()) { network.setVdsmName("on" + networkId.toString() .replaceAll("[^a-zA-Z0-9]+", "") .substring(0, BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH - 2)); } else { network.setVdsmName(networkName); } }
Source:
<code>public void open() { new Thread(new Runnable() { @Override public void run() { open.set(true); try { startProcess(); } catch (IOException e) { e.printStackTrace(); } } <START> }).start(); <END> }</code><technical_language>worker threads daemonic. Daemonic thread die non-daemonic threads done. In this case startProcess() is blocked some reason application hang able exit JVM :( kind of worker threads creating daemonic 100% done block e.g. reading stream. java Thread t = new Thread(..) t.setDaemon(true); t.start(); <LINK_0></technical_language>

Target:
public void open() { if (!open.compareAndSet(false, true)) { return; } try { startProcess(); } catch (IOException e) { e.printStackTrace(); } }
Source:
<code>protected void writeRecord(AggregateStateId id, EntityRecord record) { final TypeUrl recordType = TypeUrl.parse(record.getState() .getTypeUrl()); final TypeUrl recordTypeFromId = id.getStateType(); <START> if (!recordTypeFromId.equals(recordType)) { <END> throw newIllegalStateException(TYPE_URL_MISMATCH_MESSAGE_PATTERN, recordType, recordTypeFromId); } recordStorage.write(id, record); }</code><technical_language>is wrong checkState</technical_language>

Target:
protected void writeRecord(AggregateStateId id, EntityRecord record) { final TypeUrl recordType = TypeUrl.parse(record.getState() .getTypeUrl()); final TypeUrl recordTypeFromId = id.getStateType(); checkState(recordTypeFromId.equals(recordType), TYPE_URL_MISMATCH_MESSAGE_PATTERN, recordType, recordTypeFromId); recordStorage.write(id, record); }
Source:
<code>public Page<CommunityRest> findAllTop(Pageable pageable) { List<Community> topCommunities = new ArrayList<Community>(); int total = 0; try { List<Community> it = cs.findAllTop(obtainContext()); total = it.size(); for (Community c : it) { <START> topCommunities.add(c); <END> } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } Page<CommunityRest> page = utils.getPage(topCommunities, pageable).map(converter); return page; }</code><technical_language>topCommunities.addAll(it) here</technical_language>

Target:
public Page<CommunityRest> findAllTop(Pageable pageable) { List<Community> topCommunities = null; try { topCommunities = cs.findAllTop(obtainContext()); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } Page<CommunityRest> page = utils.getPage(topCommunities, pageable).map(converter); return page; }
Source:
<code>public Map getData(){ <START> if (data == null && buffer != null){ <END> try (ByteBufInputStream byteBufInputStream = new ByteBufInputStream(buffer)){ data = MAPPER.readValue((InputStream)byteBufInputStream, Map.class); } catch (IOException e){ throw new RuntimeException("Unable to parse beats payload ", e); } } return data; }</code><technical_language>@robbavey release this ByteBuf deserialized contents</technical_language>

Target:
public Map getData(){ if (data == null && buffer != null){ try (ByteBufInputStream byteBufInputStream = new ByteBufInputStream(buffer)){ data = MAPPER.readValue((InputStream)byteBufInputStream, Map.class); buffer = null; } catch (IOException e){ throw new RuntimeException("Unable to parse beats payload ", e); } } return data; }
Source:
<code>public static <T> boolean equalLists(List<T> one, List<T> two){ if (one == null && two == null){ return true; } if((one == null && two != null) || one != null && two == null || one.size() != two.size()){ return false; } one = new ArrayList<>(one); <START> two = new ArrayList<>(two); <END> return one.containsAll(two) && two.containsAll(one); }</code><technical_language>idea of copy sort arrays walk one, calling one.get(i).equals(two.get(i)) catch multiple entries of object in other. Try adding some UTs for this please</technical_language>

Target:
public static <T> boolean equalLists(List<T> one, List<T> two){ if (one == null && two == null){ return true; } if((one == null && two != null) || one != null && two == null || one.size() != two.size()){ return false; } one = new ArrayList<>(one); two = new ArrayList<>(two); for (T element: one) { boolean exists = false; for (int i = 0; i < two.size(); i++) { if (two.get(i).equals(element)) { exists = true; two.remove(i); break; } } if (!exists) return false; } return true; }
Source:
<code>private static IStatus setAdvancedInfo(AutLaunch launch, ExecutionStatus resultStatus) { AdvancedInformation info = null; try { info = execute(launch); } catch (Exception e) { <START> return RcpttPlugin.createStatus(e); <END> } if (info != null) { resultStatus.setAdvancedInfo(info); } return resultStatus; }</code><technical_language>Consider returning a MultiStatus, includes status new error</technical_language>

Target:
private static IStatus setAdvancedInfo(AutLaunch launch, ExecutionStatus resultStatus) { AdvancedInformation info = null; try { info = execute(launch); } catch (Exception e) { MultiStatus status = new MultiStatus(Q7LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e); status.add(resultStatus); return status; } if (info != null) { resultStatus.setAdvancedInfo(info); } return resultStatus; }
Source:
<code>public void removeNetworkFromParameters(SetupNetworksParameters params, VdsNetworkInterface nic, Network net) { if (NetworkUtils.isVlan(net)) { VdsNetworkInterface vlan = getVlanDevice(params.getInterfaces(), nic, net); if (vlan == null) { throw new VdcBLLException(VdcBllErrors.NETWORK_LABEL_CONFLICT); } else { params.getInterfaces().remove(vlan); } <START> } <END> }</code><technical_language>if a vlan set NIC, unset it</technical_language>

Target:
public void removeNetworkFromParameters(SetupNetworksParameters params, VdsNetworkInterface nic, Network net) { if (NetworkUtils.isVlan(net)) { VdsNetworkInterface vlan = getVlanDevice(params.getInterfaces(), nic, net); if (vlan == null) { throw new VdcBLLException(VdcBllErrors.NETWORK_LABEL_CONFLICT); } else { params.getInterfaces().remove(vlan); } } else { if (StringUtils.equals(net.getName(), nic.getNetworkName())) { nic.setNetworkName(null); } } }
Source:
<code>public void shouldBuildReviewInput() { Configuration config = ConfigurationBuilder.initFromResource("test.properties"); Review review = ReviewBuilder.buildReview(config); <START> ReviewInput reviewInput = new ReviewInputBuilder(CommentFilter.EMPTY_FILTER).toReviewInput(review); <END> assertThat(reviewInput.message).isEqualTo("Total 8 violations found"); assertThat(reviewInput.comments).hasSize(4); assertThat(reviewInput.comments.get("filename1")).hasSize(2); assertThat(reviewInput.comments.get("filename1").get(0).message).isEqualTo("test1"); assertThat(reviewInput.labels.get("Code-Review")).isEqualTo((short) 1); }</code><technical_language>a mock too. stick default</technical_language>

Target:
public void shouldBuildReviewInput() { Configuration config = ConfigurationBuilder.initFromResource("test.properties"); Review review = ReviewBuilder.buildReview(config); ReviewInput reviewInput = new ReviewInputBuilder(commentFilter).toReviewInput(review); assertThat(reviewInput.message).isEqualTo("Total 8 violations found"); assertThat(reviewInput.comments).hasSize(4); assertThat(reviewInput.comments.get("filename1")).hasSize(2); assertThat(reviewInput.comments.get("filename1").get(0).message).isEqualTo("test1"); assertThat(reviewInput.labels.get("Code-Review")).isEqualTo((short) 1); }
Source:
<code>public static Iterable<Object[]> paramFeeder() { final Map<String, Object> map1 = new HashMap<>(); map1.put(DIMS.get(0), ImmutableList.<String>of("dim00", "dim01")); <START> map1.put(DIMS.get(1), "dim10"); <END> final List<String> nullList = new ArrayList<>(); nullList.add(null); final Map<String, Object> map2 = new HashMap<>(); map2.put(DIMS.get(0), nullList); map2.put(DIMS.get(1), "dim10"); final Map<String, Object> map3 = new HashMap<>(); map3.put(DIMS.get(0), ImmutableList.<String>of("dim00", "dim01")); final Map<String, Object> map4 = new HashMap<>(); final Map<String, Object> map5 = new HashMap<>(); map5.put(DIMS.get(1), "dim10"); final Map<String, Object> map6 = new HashMap<>(); map6.put(DIMS.get(1), null); return Iterables.<Object[]>concat( permute(map1) ,permute(map1, map4) ,permute(map1, map5) ,permute(map5, map6) ,permute(map4, map5) ,Iterables.transform(ImmutableList.of(Arrays.asList(map1, map2, map3, map4, map5, map6)), OBJECT_MAKER) ); }</code><technical_language>ImmutableMap.of(k1, v1, k2, v2) kinds of constructs more readable</technical_language>

Target:
public static Iterable<Object[]> paramFeeder() { final Map<String, Object> map1 = ImmutableMap.<String, Object>of( DIMS.get(0), ImmutableList.<String>of("dim00", "dim01"), DIMS.get(1), "dim10" ); final List<String> nullList = Collections.singletonList(null); final Map<String, Object> map2 = ImmutableMap.<String, Object>of( DIMS.get(0), nullList, DIMS.get(1), "dim10" ); final Map<String, Object> map3 = ImmutableMap.<String, Object>of( DIMS.get(0), ImmutableList.<String>of("dim00", "dim01") ); final Map<String, Object> map4 = ImmutableMap.<String, Object>of(); final Map<String, Object> map5 = ImmutableMap.<String, Object>of(DIMS.get(1), "dim10"); final Map<String, Object> map6 = new HashMap<>(); map6.put(DIMS.get(1), null); return Iterables.<Object[]>concat( permute(map1) , permute(map1, map4) , permute(map1, map5) , permute(map5, map6) , permute(map4, map5) , Iterables.transform(ImmutableList.of(Arrays.asList(map1, map2, map3, map4, map5, map6)), OBJECT_MAKER) ); }
Source:
<code>public IStatus validate(final Object value) { final String content = inputExpression.getContent(); final WebPageRepositoryStore repositoryStore = repositoryAccessor.getRepositoryStore(WebPageRepositoryStore.class); final String errorMessage = ProcessPackage.Literals.RECAP_FLOW__OVERVIEW_FORM_MAPPING.equals(feature) ? Messages.bind(Messages.pageDoesntExists, <START> String.format("%s (%s)", inputExpression.getName(), content)) : Messages.bind(Messages.formDoesntExists, <END> String.format("%s (%s)", inputExpression.getName(), content)); return repositoryStore.getChild(content) == null ? ValidationStatus.error(errorMessage) : ValidationStatus.ok(); }</code><technical_language>I if else easier read is more complicated</technical_language>

Target:
public IStatus validate(final Object value) { final String content = inputExpression.getContent(); final WebPageRepositoryStore repositoryStore = repositoryAccessor.getRepositoryStore(WebPageRepositoryStore.class); String errorMessage = null; if (ProcessPackage.Literals.RECAP_FLOW__OVERVIEW_FORM_MAPPING.equals(feature)) { errorMessage = Messages.bind(Messages.pageDoesntExist, content); } else { errorMessage = Messages.bind(Messages.formDoesntExist, content); } return repositoryStore.getChild(content) == null ? ValidationStatus.error(errorMessage) : ValidationStatus.ok(); }
Source:
<code>private List<LdapUserResponse> applyUserFilter(List<LdapUserResponse> ldapResponses) { if(s_logger.isTraceEnabled()) { s_logger.trace(String.format("applying filter: %s or %s.", this.getListTypeString(), this.getUserFilter())); } Method filterMethod = getFilterMethod(); List<LdapUserResponse> responseList = ldapResponses; if (filterMethod != null) { if(s_logger.isTraceEnabled()) { s_logger.trace("applying filter: " + filterMethod.getName()); } try { <START> responseList = (List<LdapUserResponse>)filterMethod.invoke(this, ldapResponses); <END> } catch (IllegalAccessException | InvocationTargetException e) { throw new CloudRuntimeException("we're damned, the earth is screwed. we will now return to our maker",e); } } return responseList; }</code><technical_language>Good of reflection. However, do refactor invoke filter* methods depending user filter value? I simplify code reuse 4 values</technical_language>

Target:
private List<LdapUserResponse> applyUserFilter(List<LdapUserResponse> ldapResponses) { if(s_logger.isTraceEnabled()) { s_logger.trace(String.format("applying filter: %s or %s.", this.getListTypeString(), this.getUserFilter())); } List<LdapUserResponse> responseList = getUserFilter().filter(this,ldapResponses); return responseList; }
Source:
<code><START> public ChassisTurnAbsolute(Chassis chassis, double finalAngle, IMU imu, CommandBase fallbackCommand, <END> MotionController motionController) { super(chassis, finalAngle, imu, fallbackCommand, motionController); }</code><technical_language>a Command wpilibj2.command. Imports need change</technical_language>

Target:
public ChassisTurnAbsolute(Chassis chassis, double finalAngle, IMU imu, CommandBase fallbackCommand, MotionController motionController) { super("Chassis Turn Absolute", chassis, finalAngle, imu, fallbackCommand, motionController); }