auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void byStatusPrefix() throws Exception { TestRepository<InMemoryRepository> repo = createProject("repo"); ChangeInserter ins1 = newChange(repo, null, null, null, null); Change change1 = ins1.getChange(); change1.setStatus(Change.Status.NEW); ins1.insert(); ChangeInserter ins2 = newChange(repo, null, null, null, null); Change change2 = ins2.getChange(); change2.setStatus(Change.Status.MERGED); ins2.insert(); assertResultEquals(change1, queryOne("status:n")); assertResultEquals(change1, queryOne("status:ne")); assertResultEquals(change1, queryOne("status:new")); assertResultEquals(change1, queryOne("status:N")); assertResultEquals(change1, queryOne("status:nE")); assertResultEquals(change1, queryOne("status:neW")); try { <START> query("status:newx"); <END> } catch (BadRequestException e) { } }</code><technical_language>Add Assert.fail("bad query throw BadRequestException"); check exception is thrown</technical_language>

Target:
public void byStatusPrefix() throws Exception { TestRepository<InMemoryRepository> repo = createProject("repo"); ChangeInserter ins1 = newChange(repo, null, null, null, null); Change change1 = ins1.getChange(); change1.setStatus(Change.Status.NEW); ins1.insert(); ChangeInserter ins2 = newChange(repo, null, null, null, null); Change change2 = ins2.getChange(); change2.setStatus(Change.Status.MERGED); ins2.insert(); assertResultEquals(change1, queryOne("status:n")); assertResultEquals(change1, queryOne("status:ne")); assertResultEquals(change1, queryOne("status:new")); assertResultEquals(change1, queryOne("status:N")); assertResultEquals(change1, queryOne("status:nE")); assertResultEquals(change1, queryOne("status:neW")); assertBadQuery("status:nx"); assertBadQuery("status:newx"); }
Source:
<code>public Content readme(final String branch) { <START> return new MkContent(); <END> }</code><technical_language>throw new UnsupportedOperationException() here, MkContents support mocking readme content for branch</technical_language>

Target:
public Content readme(final String branch) { throw new UnsupportedOperationException("Readme not yet implemented."); }
Source:
<code><START> private synchronized void loadInfo(MBeanServerConnection mbsc) { <END> Root root = getRoot(parent); IConnectionWrapper connectionWrapper = root.getConnection(); final MBeanInfoWrapper[] array = new MBeanInfoWrapper[1]; final ObjectName on2 = on; try { if( mbsc != null ) { MBeanInfo mbi = null; try { mbi = mbsc.getMBeanInfo(on2); } catch(IOException ioe) { } if( mbi != null ) { array[0] = new MBeanInfoWrapper(on2, mbi, mbsc, ObjectNameNode.this); } } else { connectionWrapper.run(new IJMXRunnable() { public void run(MBeanServerConnection mbsc) throws Exception { MBeanInfo mbi = null; try { mbi = mbsc.getMBeanInfo(on2); } catch(IOException ioe) { } if( mbi != null ) { array[0] = new MBeanInfoWrapper(on2, mbi, mbsc, ObjectNameNode.this); } } }); } } catch( Exception e ) { JMXActivator.getDefault().getLog().log(new Status(IStatus.ERROR, JMXActivator.PLUGIN_ID, "Error loading object name details", e)); loadError = e; } wrapper = array[0]; }</code><technical_language>reinitialize "loadError" attribute null if another attempt of loading info is performed</technical_language>

Target:
private synchronized void loadInfo(MBeanServerConnection mbsc) { Root root = getRoot(parent); IConnectionWrapper connectionWrapper = root.getConnection(); final MBeanInfoWrapper[] array = new MBeanInfoWrapper[1]; final ObjectName on2 = on; try { if( mbsc != null ) { MBeanInfo mbi = null; try { mbi = mbsc.getMBeanInfo(on2); } catch(IOException ioe) { } if( mbi != null ) { array[0] = new MBeanInfoWrapper(on2, mbi, mbsc, ObjectNameNode.this); } } else { connectionWrapper.run(new IJMXRunnable() { public void run(MBeanServerConnection mbsc) throws Exception { MBeanInfo mbi = null; try { mbi = mbsc.getMBeanInfo(on2); } catch(IOException ioe) { } if( mbi != null ) { array[0] = new MBeanInfoWrapper(on2, mbi, mbsc, ObjectNameNode.this); } } }); } } catch( Exception e ) { JMXActivator.getDefault().getLog().log(new Status(IStatus.ERROR, JMXActivator.PLUGIN_ID, "Error loading object name details for JMX object: " + on.toString(), e)); loadError = e; } wrapper = array[0]; }
Source:
<code>public void test() { Resource vgql = getResource(PROJECT_NAME, fileName); VqlCodeGenerator vqlGenerator = new VqlCodeGenerator(); EObject root = vgql.getContents().get(0); String vql = vqlGenerator.generate((PatternPackage) root); <START> printVQL(vql); <END> vql = removeWhitespace(vql); String cleanExpectedOutput = removeWhitespace(expectedOutput); assertEquals(cleanExpectedOutput, vql); }</code><technical_language>Remove printVQL call method</technical_language>

Target:
public void test() { Resource vgql = getResource(PROJECT_NAME, fileName); VqlCodeGenerator vqlGenerator = new VqlCodeGenerator(); EObject root = vgql.getContents().get(0); String vql = vqlGenerator.generate((PatternPackage) root); vql = removeWhitespace(vql); String cleanExpectedOutput = removeWhitespace(expectedOutput); assertEquals(cleanExpectedOutput, vql); }
Source:
<code>public Set<CapabilityDTO> getCapabilities() { <START> return this.capabilities; <END> }</code><technical_language>Encapsulation</technical_language>

Target:
public Set<CapabilityDTO> getCapabilities() { return this.capabilities != null ? new SetView<CapabilityDTO>(capabilities) : null; }
Source:
<code>public String shortify(final String shortStr) { try { return UtilMethods.isSet(shortStr)? <START> shortStr.trim().replaceAll("-", "").substring(0, MINIMUM_SHORTY_ID_LENGTH): shortStr; <END> } catch (Exception se) { throw new ShortyException("shorty " + shortStr + " is not a short id. Short Ids should be " + MINIMUM_SHORTY_ID_LENGTH + " alphanumeric chars in length", se); } }</code><technical_language>This throw IndexOutOfBounds if pass in a 5 char shorty (for example). trim return lesser of length of shortStr vs. MINIMUM_SHORTY_ID_LENGTH</technical_language>

Target:
public String shortify(final String shortStr) { try { if (UtilMethods.isSet(shortStr)) { final String trimmedShortStr = shortStr.trim().replaceAll("-", ""); final int min = Math.min(trimmedShortStr.length(), MINIMUM_SHORTY_ID_LENGTH); return trimmedShortStr.substring(0, min); } return shortStr; } catch (Exception se) { throw new ShortyException("shorty " + shortStr + " is not a short id. Short Ids should be " + MINIMUM_SHORTY_ID_LENGTH + " alphanumeric chars in length", se); } }
Source:
<code>public void shutdown() { if (!isShutdownRequested.compareAndSet(false, true)) { return; } boolean shutdownPerformed = performShutdownIfPossible(); if (!shutdownPerformed) { <START> ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { <END> @Override public Thread newThread(Runnable r) { return new Thread(r, "rx-netty-shutdown-"); } }); executorService.scheduleWithFixedDelay(new ShutdownTask(executorService), 100, 100, TimeUnit.MILLISECONDS); } }</code><technical_language>I Observable.timer() instead of creating Schedulor (looks for shutdown?)</technical_language>

Target:
public void shutdown() { if (!isShutdownRequested.compareAndSet(false, true)) { return; } Observable.just(1L).subscribe(createShutdownAction()); }
Source:
<code>public String toString() { <START> return "TmfCheckpoint [fLocation=" + fLocation + ", fTimestamp=" + fTimestamp + "]"; <END> }</code><technical_language>While it, change getClass().getSimpleName()</technical_language>

Target:
public String toString() { return getClass().getSimpleName() + " [fLocation=" + fLocation + ", fTimestamp=" + fTimestamp + "]"; }
Source:
<code>public void waitForEmptyLeaderInformation(long timeout) throws Exception { <START> final LeaderInformation leader = leaderQueue.poll(timeout, TimeUnit.MILLISECONDS); <END> if (exception != null) { throw exception; } else if (leader == null || !leader.equals(LeaderInformation.empty())) { throw new TimeoutException("Listener was not notified about an empty leader within " + timeout + "ms"); } }</code><technical_language>polling, check exception throw if is null</technical_language>

Target:
public void waitForEmptyLeaderInformation(long timeout) throws Exception { throwExceptionIfNotNull(); final String errorMsg = "Listener was not notified about an empty leader within " + timeout + "ms"; CommonTestUtils.waitUntilCondition( () -> { leader = leaderEventQueue.poll(timeout, TimeUnit.MILLISECONDS); return leader != null && leader.isEmpty(); }, Deadline.fromNow(Duration.ofMillis(timeout)), errorMsg); oldAddress = null; }
Source:
<code>protected void handleWidgetSelected(TypeNameMatch[] selection) { IStatus status= null; if (selection.length == 0) { status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.ERROR, "",null); } else { if (fValidator != null) { List jElements= new ArrayList(); for (TypeNameMatch <START> s : <END> selection) { IType type= s.getType(); if (type != null) { jElements.add(type); } else { status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.ERROR, Messages.format(JavaUIMessages.TypeSelectionDialog_error_type_doesnot_exist, s.getFullyQualifiedName()), null); break; } } if (status == null) { status= fValidator.validate(jElements.toArray()); } } else { status= new Status(IStatus.OK, JavaPlugin.getPluginId(), IStatus.OK, "",null); } } updateStatus(status); }</code><technical_language>rename typeInfo</technical_language>

Target:
protected void handleWidgetSelected(TypeNameMatch[] selection) { IStatus status= null; if (selection.length == 0) { status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.ERROR, "",null); } else { if (fValidator != null) { List jElements= new ArrayList(); for (TypeNameMatch typeInfo : selection) { IType type= typeInfo.getType(); if (type != null) { jElements.add(type); } else { status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.ERROR, Messages.format(JavaUIMessages.TypeSelectionDialog_error_type_doesnot_exist, typeInfo.getFullyQualifiedName()), null); break; } } if (status == null) { status= fValidator.validate(jElements.toArray()); } } else { status= new Status(IStatus.OK, JavaPlugin.getPluginId(), IStatus.OK, "",null); } } updateStatus(status); }
Source:
<code>private boolean isEmptyUserTune() { <START> if (this.artist == null && this.length == null && this.rating == null && this.source == null && this.title == null <END> && this.track == null && this.uri == null) { return true; } return false; }</code><technical_language>Ok, this, is uncommon for inexperienced programmer. want write is return this.artist == null && this.length == null && this.rating == null && this.source == null && this.title == null && this.track == null && this.uri == null; Or, UserTuneElement hashCode() equals(), simply this.equals(EMPTY_USER_TUNE)? A lot more readable, no</technical_language>

Target:
private boolean isEmptyUserTune() { return this.equals(EMPTY_USER_TUNE); }
Source:
<code>public String getBaseTypeName() throws SQLException { <START> return baseType.name(); <END> }</code><technical_language>baseType.getSqlTypeName()</technical_language>

Target:
public String getBaseTypeName() throws SQLException { return baseType.getSqlTypeName(); }
Source:
<code>public void test() { sandbox = SqlSandboxUtils.getStaticStorage(username); Case readCase = sandbox.getCaseStorage().read(1); Ledger readLedger = sandbox.getLedgerStorage().read(1); FormInstance readFixture = sandbox.getUserFixtureStorage().read(1); <START> User readUser = sandbox.getUserStorage().read(1); <END> }</code><technical_language>Worth expanding tests in this file</technical_language>

Target:
public void test() { sandbox = SqlSandboxUtils.getStaticStorage(username); assertEquals(sandbox.getCaseStorage().getNumRecords(), 6); assertEquals(sandbox.getLedgerStorage().getNumRecords(), 3); assertEquals(sandbox.getUserFixtureStorage().getNumRecords(), 4); User loggedInUser = sandbox.getLoggedInUser(); assertEquals(loggedInUser.getUsername(), "test"); }
Source:
<code>public void theRetrieveAdministrativeStatusRequestIsReceived(final Map<String, String> requestData) throws Throwable { <START> final Map<String, String> settings = new HashMap<>(); <END> settings.put(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION, requestData.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION)); final GetAdministrativeStatusRequest getAdministrativeStatusRequest = GetAdministrativeStatusRequestFactory .fromParameterMap(settings); final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient .getAdministrativeStatus(getAdministrativeStatusRequest); LOGGER.info("Get administrative status asyncResponse is received {}", getAdministrativeStatusAsyncResponse); assertNotNull("Get administrative status asyncResponse should not be null", getAdministrativeStatusAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, getAdministrativeStatusAsyncResponse.getCorrelationUid()); }</code><technical_language>need Map settings, please delete it</technical_language>

Target:
public void theRetrieveAdministrativeStatusRequestIsReceived(final Map<String, String> requestData) throws Throwable { final GetAdministrativeStatusRequest getAdministrativeStatusRequest = GetAdministrativeStatusRequestFactory .fromParameterMap(requestData); final GetAdministrativeStatusAsyncResponse getAdministrativeStatusAsyncResponse = this.smartMeteringConfigurationClient .getAdministrativeStatus(getAdministrativeStatusRequest); LOGGER.info("Get administrative status asyncResponse is received {}", getAdministrativeStatusAsyncResponse); assertNotNull("Get administrative status asyncResponse should not be null", getAdministrativeStatusAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, getAdministrativeStatusAsyncResponse.getCorrelationUid()); }
Source:
<code><START> public boolean resultSet(Player p, Environment env) { <END> PreparedStatement statement = null; ResultSet rs = null; String query = "SELECT * FROM " + prefix + "traveled_to WHERE uuid = ?"; try { service.testConnection(connection); statement = connection.prepareStatement(query); statement.setString(1, p.getUniqueId().toString()); rs = statement.executeQuery(); if (rs.isBeforeFirst()) { rs.next(); return rs.getInt(env.toString().toLowerCase()) == 1; } else { return false; } } catch (SQLException e) { plugin.debug("ResultSet error for traveled_to table! " + e.getMessage()); return false; } finally { try { if (rs != null) { rs.close(); } if (statement != null) { statement.close(); } } catch (SQLException e) { plugin.debug("Error closing traveled_to table! " + e.getMessage()); } } }</code><technical_language>I change SQL do checking for (and pass in strings): public boolean resultSet(String uuid, String env) { ... String query = SELECT * " + prefix + "traveled_to uuid = ? " + env + " = 1"; ... statement.setString(1, uuid); ... return rs.isBeforeFirst(); // true if been, false if</technical_language>

Target:
public boolean resultSet(Player p, Environment env) { PreparedStatement statement = null; ResultSet rs = null; String query = "SELECT * FROM " + prefix + "traveled_to WHERE uuid = ? AND environment = ?"; try { service.testConnection(connection); statement = connection.prepareStatement(query); statement.setString(1, p.getUniqueId().toString()); statement.setString(2, env.toString()); rs = statement.executeQuery(); return rs.isBeforeFirst(); } catch (SQLException e) { plugin.debug("ResultSet error for traveled_to table! " + e.getMessage()); return false; } finally { try { if (rs != null) { rs.close(); } if (statement != null) { statement.close(); } } catch (SQLException e) { plugin.debug("Error closing traveled_to table! " + e.getMessage()); } } }
Source:
<code>public void testThrowOnNullQueue() { assertThrows(IllegalArgumentException.class, () -> { try (NatsTestServer ts = new NatsTestServer(false); Connection nc = Nats.connect(ts.getURI())) { <START> nc.subscribe("subject", (String)null); <END> assertFalse(true); } }); }</code><technical_language>I this cast is needed</technical_language>

Target:
public void testThrowOnNullQueue() { assertThrows(IllegalArgumentException.class, () -> { try (NatsTestServer ts = new NatsTestServer(false); Connection nc = Nats.connect(ts.getURI())) { nc.subscribe("subject", null); assertFalse(true); } }); }
Source:
<code>public CompactionPlan getCompactionPlan(MajorCompactionRequest request) { CompactionPlan plan = super.getCompactionPlan(request); plan.writeParameters = new WriteParameters(); Map<String,String> tableProperties = request.getTableProperties(); verifyRequiredProperties(tableProperties); String largeFileCompressionType = tableProperties.get(TABLE_LARGE_FILE_COMPRESSION_TYPE); String threshold = tableProperties.get(TABLE_LARGE_FILE_COMPRESSION_THRESHOLD); verifyRequiredProperties(largeFileCompressionType, threshold); <START> Long largeFileCompressionThreshold = AccumuloConfiguration.getMemoryInBytes(threshold); <END> long totalSize = 0; for (Entry<FileRef,DataFileValue> entry : request.getFiles().entrySet()) { totalSize += entry.getValue().getSize(); } if (totalSize > largeFileCompressionThreshold) { plan.writeParameters.setCompressType(largeFileCompressionType); } return plan; }</code><technical_language>Nice. I checking if this function was</technical_language>

Target:
public CompactionPlan getCompactionPlan(MajorCompactionRequest request) { CompactionPlan plan = super.getCompactionPlan(request); plan.writeParameters = new WriteParameters(); Long totalSize = calculateTotalSize(request, plan); if (totalSize > largeFileCompressionThreshold) { if (log.isDebugEnabled()) { log.debug("Changed compressType to " + largeFileCompressionType + ": totalSize(" + totalSize + ") was greater than threshold " + largeFileCompressionThreshold); } plan.writeParameters.setCompressType(largeFileCompressionType); } return plan; }
Source:
<code>public void getInterpreterBindings(NotebookSocket conn, Message fromMessage) throws IOException { String noteID = (String) fromMessage.data.get("noteID"); List<InterpreterSettingsList> settingList = InterpreterBindingUtils.getInterpreterBindings(notebook(), noteID); <START> broadcastInterpreterBindings(noteID, settingList); <END> }</code><technical_language>Instead of broadcast conn.send(serializeMessage)</technical_language>

Target:
public void getInterpreterBindings(NotebookSocket conn, Message fromMessage) throws IOException { String noteID = (String) fromMessage.data.get("noteID"); List<InterpreterSettingsList> settingList = InterpreterBindingUtils.getInterpreterBindings(notebook(), noteID); conn.send(serializeMessage(new Message(OP.INTERPRETER_BINDINGS) .put("interpreterBindings", settingList))); }
Source:
<code>public void onReplayCompletion() { if (!m_hasRestored && !m_replayAgent.hasReplayedSegments() && m_action.doesRecover()) { VoltDB.crashGlobalVoltDB("Nothing to recover from", false, null); } else if (!m_clEnabled && !m_replayAgent.hasReplayedTxns()) { m_state = State.TRUNCATE; } changeState(); if (m_isLeader && m_action.doesRecover()) { VoltDBInterface instance = VoltDB.instance(); if (!instance.getCatalogContext().database.getIsactiveactivedred() && instance.getReplicationRole() == ReplicationRole.NONE) { ByteBuffer params = ByteBuffer.allocate(4); params.putInt(ExecutionEngine.TaskType.RESET_DR_APPLIED_TRACKER.ordinal()); try { instance.getClientInterface().callExecuteTask(30000, params.array()); } catch (IOException | InterruptedException e) { <START> e.printStackTrace(); <END> } } } if (m_clEnabled || m_replayAgent.hasReplayedTxns()) { if (m_isLeader) { try { try { m_zk.create(VoltZK.truncation_snapshot_path, m_clSnapshotPath.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException e) m_zk.create(VoltZK.request_truncation_snapshot_node, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); } catch (Exception e) { VoltDB.crashGlobalVoltDB("Requesting a truncation snapshot " + "via ZK should always succeed", false, e); } } } }</code><technical_language>Worth put a warning reset DR applied tracker timeout</technical_language>

Target:
public void onReplayCompletion() { if (!m_hasRestored && !m_replayAgent.hasReplayedSegments() && m_action.doesRecover()) { VoltDB.crashGlobalVoltDB("Nothing to recover from", false, null); } else if (!m_clEnabled && !m_replayAgent.hasReplayedTxns()) { m_state = State.TRUNCATE; } changeState(); if (m_isLeader && m_action.doesRecover()) { VoltDBInterface instance = VoltDB.instance(); if (!instance.getCatalogContext().database.getIsactiveactivedred() && instance.getReplicationRole() == ReplicationRole.NONE) { ByteBuffer params = ByteBuffer.allocate(4); params.putInt(ExecutionEngine.TaskType.RESET_DR_APPLIED_TRACKER.ordinal()); try { instance.getClientInterface().callExecuteTask(MAX_RESET_DR_APPLIED_TRACKER_TIMEOUT_MILLIS, params.array()); } catch (IOException e) { LOG.warn("Failed to reset DR applied tracker due to an IOException", e); } catch (InterruptedException e) { LOG.warn("Failed to reset DR applied tracker due to an InterruptedException", e); } } } if (m_clEnabled || m_replayAgent.hasReplayedTxns()) { if (m_isLeader) { try { try { m_zk.create(VoltZK.truncation_snapshot_path, m_clSnapshotPath.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException e) m_zk.create(VoltZK.request_truncation_snapshot_node, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); } catch (Exception e) { VoltDB.crashGlobalVoltDB("Requesting a truncation snapshot " + "via ZK should always succeed", false, e); } } } }
Source:
<code>public int run(final Namespace options, final List<Target> targets, final PrintStream out, final PrintStream err, final String username, final boolean json) throws IOException, InterruptedException { boolean successful = true; boolean isFirst = true; Iterator<Target> targetIterator = targets.iterator(); while (targetIterator.hasNext()) { Target target = targetIterator.next(); if (targets.size() > 1) { if (!json) { final List<URI> endpoints = target.getEndpointSupplier().get(); final String header = format("%s (%s)", target.getName(), endpoints); out.println(header); out.println(repeat("-", header.length())); out.flush(); } else { if (isFirst) { out.println("{"); isFirst = false; } <START> out.println("\"" + target.toString() + "\": "); <END> } } successful &= run(options, target, out, err, username, json); if (targets.size() > 1) { if (!json) { out.println(); } else { if (targetIterator.hasNext()) { out.println(",\n"); } else { out.println("}"); } } } } return successful ? 0 : 1; }</code><technical_language>serialize Json.asString possibly? means key is a json string, is a bit weird, machine readable.... Another idea: structure this: { "shared.cloud": { "endpoints": [ list of endpoints ] "srv": "helios" ...other details?... "jobs" : { "ad-event-tracker:0.0.8-SNAPSHOT-637574b:91b946c81bbb4aeafe7f243e39b6d63e4110d124":{ "command":[ "server", "ad-event-tracker.yaml" ], "env":{ ... } } }</technical_language>

Target:
public int run(final Namespace options, final List<Target> targets, final PrintStream out, final PrintStream err, final String username, final boolean json) throws IOException, InterruptedException { boolean successful = true; boolean isFirst = true; Iterator<Target> targetIterator = targets.iterator(); while (targetIterator.hasNext()) { Target target = targetIterator.next(); if (targets.size() > 1) { if (!json) { final List<URI> endpoints = target.getEndpointSupplier().get(); final String header = format("%s (%s)", target.getName(), endpoints); out.println(header); out.println(repeat("-", header.length())); out.flush(); } else { if (isFirst) { out.println("{"); isFirst = false; } out.println("\"" + target.getName() + "\": "); } } successful &= run(options, target, out, err, username, json); if (targets.size() > 1) { if (!json) { out.println(); } else { if (targetIterator.hasNext()) { out.println(",\n"); } else { out.println("}"); } } } } return successful ? 0 : 1; }
Source:
<code>public void after() { fViewBot.toolbarButton(SHOW_LEGEND).click(); <START> SWTWorkbenchBot bot = fBot; <END> SWTBotShell legendShell = bot.shell(LEGEND_NAME); SWTBot legendBot = legendShell.bot(); for (int i = 0; i < StubPresentationProvider.STATES.length; i++) { legendBot.button(i).click(); } legendBot.button(OK_BUTTON).click(); TmfTraceStub trace = fTrace; assertNotNull(trace); TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace)); bot.waitUntil(Conditions.shellCloses(legendShell)); fViewBot.close(); bot.waitUntil(ConditionHelpers.ViewIsClosed(fViewBot)); fTrace.dispose(); }</code><technical_language>fBot</technical_language>

Target:
public void after() { fViewBot.toolbarButton(SHOW_LEGEND).click(); SWTBotShell legendShell = fBot.shell(LEGEND_NAME); SWTBot legendBot = legendShell.bot(); for (int i = 0; i < StubPresentationProvider.STATES.length; i++) { legendBot.button(i).click(); } legendBot.button(OK_BUTTON).click(); TmfTraceStub trace = fTrace; assertNotNull(trace); TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace)); fBot.waitUntil(Conditions.shellCloses(legendShell)); fViewBot.close(); fBot.waitUntil(ConditionHelpers.ViewIsClosed(fViewBot)); fTrace.dispose(); }
Source:
<code>public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) { if (SnapshotOperation.REVERT.equals(op)) { return StrategyPriority.CANT_HANDLE; } long volumeId = snapshot.getVolumeId(); VolumeVO volumeVO = _volumeDao.findByIdIncludingRemoved(volumeId); long storagePoolId = volumeVO.getPoolId(); DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary); if (dataStore != null) { Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities != null) { String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()); <START> Boolean supportsStorageSystemSnapshots = new Boolean(value); <END> if (supportsStorageSystemSnapshots) { return StrategyPriority.HIGHEST; } } } return StrategyPriority.CANT_HANDLE; }</code><technical_language>new Boolean skips constant pool -- placing unnecessary pressure garbage collector. Please Boolean.valueOf instead</technical_language>

Target:
public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) { if (SnapshotOperation.REVERT.equals(op)) { return StrategyPriority.CANT_HANDLE; } long volumeId = snapshot.getVolumeId(); VolumeVO volumeVO = volumeDao.findByIdIncludingRemoved(volumeId); long storagePoolId = volumeVO.getPoolId(); DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary); if (dataStore != null) { Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities != null) { String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()); Boolean supportsStorageSystemSnapshots = Boolean.valueOf(value); if (supportsStorageSystemSnapshots) { return StrategyPriority.HIGHEST; } } } return StrategyPriority.CANT_HANDLE; }
Source:
<code>public final SafeHtml getLineReplaceHTML() <START> { <END> SafeHtmlBuilder out = new SafeHtmlBuilder(); if (!StringUtil.isNullOrEmpty(getErrors())) { out.appendHtmlConstant("<mark>"); out.appendEscaped(getErrors()); out.appendHtmlConstant("</mark>"); } else { ArrayList<Integer> onReplace = getReplaceMatchOns(); ArrayList<Integer> offReplace = getReplaceMatchOffs(); ArrayList<Pair<Boolean, Integer>> parts = new ArrayList<Pair<Boolean, Integer>>(); while (onReplace.size() + offReplace.size() > 0) { int onReplaceVal = onReplace.size() == 0 ? Integer.MAX_VALUE : onReplace.get(0); int offReplaceVal = offReplace.size() == 0 ? Integer.MAX_VALUE : offReplace.get(0); if (onReplaceVal <= offReplaceVal) parts.add(new Pair<Boolean, Integer>(true, onReplace.remove(0))); else parts.add(new Pair<Boolean, Integer>(false, offReplace.remove(0))); } String line = getLineValue(); int openEmTags = 0; int openMarkTags = 0; for (int i = 0; i < line.length(); i++) { while (parts.size() > 0 && parts.get(0).second == i) { if (parts.remove(0).first) { out.appendHtmlConstant("<em>"); openEmTags++; } else if (openEmTags > 0) { out.appendHtmlConstant("</em>"); openEmTags--; } } out.append(line.charAt(i)); } while (openEmTags > 0) { openEmTags--; out.appendHtmlConstant("</em>"); } } return out.toSafeHtml(); }</code><technical_language>Is part of this function previous extracted a shared helper function</technical_language>

Target:
public final SafeHtml getLineReplaceHTML() { SafeHtmlBuilder out = new SafeHtmlBuilder(); if (!StringUtil.isNullOrEmpty(getErrors())) out = appendHtmlTaggedString(out, "mark", getErrors()); else { ArrayList<Integer> onReplace = getReplaceMatchOns(); ArrayList<Integer> offReplace = getReplaceMatchOffs(); ArrayList<Pair<Boolean, Integer>> parts = new ArrayList<Pair<Boolean, Integer>>(); while (onReplace.size() + offReplace.size() > 0) { int onIndex = onReplace.size() - 1; int offIndex = offReplace.size() - 1; int onReplaceVal = onReplace.size() == 0 ? Integer.MAX_VALUE : onReplace.get(onIndex); int offReplaceVal = offReplace.size() == 0 ? Integer.MAX_VALUE : offReplace.get(offIndex); if (onReplaceVal < offReplaceVal) parts.add(new Pair<Boolean, Integer>(true, onReplace.remove(onIndex))); else parts.add(new Pair<Boolean, Integer>(false, offReplace.remove(offIndex))); } String line = getLineValue(); int openInsTags = 0; int openMarkTags = 0; for (int i = 0; i < line.length(); i++) { while (parts.size() > 0 && parts.get(0).second == i) { if (parts.remove(0).first) { out.appendHtmlConstant("<ins>"); openInsTags++; } else if (openInsTags > 0) { out.appendHtmlConstant("</ins>"); openInsTags--; } } out.append(line.charAt(i)); } while (openInsTags > 0) { openInsTags--; out.appendHtmlConstant("</ins>"); } } return out.toSafeHtml(); }
Source:
<code>private static void extractTarFileToFolder(File file, File outputDir, boolean isGZipped) { FileInputStream fileInputStream = null; TarInputStream tarArchiveInputStream = null; try { <START> fileInputStream = new FileInputStream(file); <END> tarArchiveInputStream = (isGZipped) ? new TarInputStream(new GZIPInputStream(fileInputStream, BUFFER_SIZE)) : new TarInputStream(new BufferedInputStream(fileInputStream, BUFFER_SIZE)); unTar(tarArchiveInputStream, outputDir); } catch (IOException e) { logger.error(e.getMessage()); } finally { if (tarArchiveInputStream != null) { try { tarArchiveInputStream.close(); } catch (IOException e) { logger.error(e.getMessage()); } } else if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e) { logger.error(e.getMessage()); } } } }</code><technical_language>for fileInputStream tarArchiveInputStream: [try-with-resources-statement](<LINK_0></technical_language>

Target:
private static void extractTarFileToFolder(File file, File outputDir, boolean isGZipped) { try (FileInputStream fileInputStream = new FileInputStream(file); TarInputStream tarArchiveInputStream = (isGZipped) ? new TarInputStream(new GZIPInputStream(fileInputStream, BUFFER_SIZE)) : new TarInputStream(new BufferedInputStream(fileInputStream, BUFFER_SIZE))){ unTar(tarArchiveInputStream, outputDir); } catch (IOException e) { logger.error(e.getMessage()); } }
Source:
<code>public static RSDL loadRsdl(ApplicationMode applicationMode) throws IOException { String fileName = applicationMode == ApplicationMode.AllModes ? RsdlIOManager.RSDL_RESOURCE_NAME : RsdlIOManager.GLUSTER_RSDL_RESOURCE_NAME; InputStream rsdlAsStrem = null; try { rsdlAsStrem = RsdlIOManager.loadAsStream(fileName); return JAXB.unmarshal(rsdlAsStrem, RSDL.class); } finally { <START> rsdlAsStrem.close(); <END> } }</code><technical_language>rsdlAsStream null, add a check for that, code audit tools complain in future</technical_language>

Target:
public static RSDL loadRsdl(ApplicationMode applicationMode) throws IOException { String fileName = applicationMode == ApplicationMode.AllModes ? ("/" + RsdlIOManager.RSDL_RESOURCE_NAME) : ("/" + RsdlIOManager.GLUSTER_RSDL_RESOURCE_NAME); InputStream rsdlAsStrem = null; try { rsdlAsStrem = RsdlIOManager.loadAsStream(fileName); return JAXB.unmarshal(rsdlAsStrem, RSDL.class); } finally { if (rsdlAsStrem != null) { rsdlAsStrem.close(); } } }
Source:
<code>public void clickCollapseExpandButtonAndWaitForPanelsToCollapse() { clickCollapseExpandButton(); <START> waitForPanelsToCollapse(); <END> }</code><technical_language>This waits for panels collapse waiting for panels expand</technical_language>

Target:
public void clickCollapseExpandButtonAndWaitForPanelsToCollapse() { click(collapseExpandButton); waitForPanelsToCollapse(); }
Source:
<code>public void testEnoughSpaceToMergeSnapshotsWithMultipleDisk() { <START> ArrayList<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, 4); <END> doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(22, STORAGE_DOMAIN_ID); assertTrue("Validation should succeed. Free space minus threshold should be bigger then summarize all disks size", cmd.isEnoughSpaceToMergeSnapshots()); }</code><technical_language>this defined a List<DiskImage></technical_language>

Target:
public void testEnoughSpaceToMergeSnapshotsWithMultipleDisk() { List<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, IMAGE_ACTUAL_SIZE_GB); doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(22, STORAGE_DOMAIN_ID); assertTrue("Validation should succeed. Free space minus threshold should be bigger then summarize all disks size", cmd.isEnoughSpaceToMergeSnapshots()); }
Source:
<code>public void process(WatchedEvent event) { <START> System.out.println(event); <END> try { switch ( event.getType() ) { case NodeCreated: assert parent == null; wasCreated(); break; case NodeChildrenChanged: refreshChildren(); break; case NodeDataChanged: refreshData(); break; case NodeDeleted: wasDeleted(); break; } } catch ( Exception e ) { handleException(e); } }</code><technical_language>Remove</technical_language>

Target:
public void process(WatchedEvent event) { try { switch ( event.getType() ) { case NodeCreated: Preconditions.checkState(parent == null, "unexpected NodeCreated on non-root node"); wasCreated(); break; case NodeChildrenChanged: refreshChildren(); break; case NodeDataChanged: refreshData(); break; case NodeDeleted: wasDeleted(); break; } } catch ( Exception e ) { handleException(e); } }
Source:
<code>public Points getDataToRollup(final Locator locator, RollupType rollupType, Range range, String columnFamilyName) throws IOException, CacheException { if( columnFamilyName.equals ( CassandraModel.CF_METRICS_STRING_NAME ) ) { <START> String msg = String.format( String.format( "DBasicMetricsRW.getDataToRollup: %s Attempting to write String/Boolean metric for a method which should not get them.", <END> columnFamilyName ) ); LOG.error( msg ); throw new IOException( msg ); } return super.getDataToRollup( locator, rollupType, range, columnFamilyName ); }</code><technical_language>Isnt "Attempting read"</technical_language>

Target:
public Points getDataToRollup(final Locator locator, RollupType rollupType, Range range, String columnFamilyName) throws IOException { if( columnFamilyName.equals ( CassandraModel.CF_METRICS_STRING_NAME ) ) { String msg = String.format( String.format( "DBasicMetricsRW.getDataToRollup: %s Attempting to read String/Boolean metric for a method which should not get them.", columnFamilyName ) ); LOG.error( msg ); throw new IOException( msg ); } return super.getDataToRollup( locator, rollupType, range, columnFamilyName ); }
Source:
<code>public Command.Parameterized createPaginationCommand() { Parameter.Value<ActivePagination> paginationIdParameter = Parameter.builder(ActivePagination.class) .parser(new ActivePaginationParser()) .setSuggestions(new ActivePaginationCompleter()) .setKey("pagination-id") .build(); Command.Parameterized next = Command.builder() .setShortDescription(TextComponent.of("Go to the next page")) .setExecutor((context) -> { context.requireOne(paginationIdParameter).nextPage(); return CommandResult.success(); }).build(); Command.Parameterized prev = Command.builder() .setShortDescription(TextComponent.of("Go to the previous page")) .setExecutor((context) -> { context.requireOne(paginationIdParameter).previousPage(); return CommandResult.success(); }).build(); Parameter.Value<Integer> pageParameter = integerNumber().setKey("page").build(); CommandExecutor pageExecutor = (context) -> { context.requireOne(paginationIdParameter).specificPage(context.requireOne(pageParameter)); return CommandResult.success(); }; Command.Parameterized page = Command.builder() .setShortDescription(TextComponent.of("Go to a specific page")) .parameter(pageParameter) .setExecutor(pageExecutor) .build(); return Command.builder() <START> .parameters(paginationIdParameter, firstOf(pageParameter, <END> subcommand(next, "next", "n"), subcommand(prev, "prev", "p", "previous"), subcommand(page, "page"))) .child(page, "page") .setExecutor(page) .setShortDescription(TextComponent.of("Helper command for paginations occurring")) .build(); }</code><technical_language>static calls qualified - static imports for this</technical_language>

Target:
public Command.Parameterized createPaginationCommand() { final Parameter.Value<ActivePagination> paginationIdParameter = Parameter.builder(ActivePagination.class) .parser(new ActivePaginationParameter()) .setKey("pagination-id") .build(); final Command.Parameterized next = Command.builder() .setShortDescription(TextComponent.of("Go to the next page")) .setExecutor((context) -> { context.requireOne(paginationIdParameter).nextPage(); return CommandResult.success(); }).build(); final Command.Parameterized prev = Command.builder() .setShortDescription(TextComponent.of("Go to the previous page")) .setExecutor((context) -> { context.requireOne(paginationIdParameter).previousPage(); return CommandResult.success(); }).build(); final Parameter.Value<Integer> pageParameter = Parameter.integerNumber().setKey("page").build(); final CommandExecutor pageExecutor = (context) -> { context.requireOne(paginationIdParameter).specificPage(context.requireOne(pageParameter)); return CommandResult.success(); }; final Command.Parameterized page = Command.builder() .setShortDescription(TextComponent.of("Go to a specific page")) .parameter(pageParameter) .setExecutor(pageExecutor) .build(); return Command.builder() .parameters(paginationIdParameter, Parameter.firstOf(pageParameter, Parameter.subcommand(next, "next", "n"), Parameter.subcommand(prev, "prev", "p", "previous"), Parameter.subcommand(page, "page"))) .child(page, "page") .setExecutor(page) .setShortDescription(TextComponent.of("Helper command for paginations occurring")) .build(); }
Source:
<code>protected void applyProfile(ModelSet modelSet) { String profilePath = selectDiagramKindPage.getProfileURI(); ResourceSet resourceSet = new ResourceSetImpl(); Resource resource = resourceSet.getResource(URI.createURI(profilePath), true); Profile profile = (Profile) resource.getContents().get(0); Resource myModelUMLResource = UmlUtils.getUmlResource(modelSet); org.eclipse.uml2.uml.Package manipulatedModel = (org.eclipse.uml2.uml.Package) myModelUMLResource.getContents().get(0); <START> Iterator<Profile> iterProfiles = manipulatedModel.getAllAppliedProfiles().iterator(); <END> while (iterProfiles.hasNext()) { Profile modelProfile = iterProfiles.next(); if (modelProfile.getURI().equals(profile.getURI())) { return; } } getCommandStack(modelSet).execute(new ApplyProfileCommand(manipulatedModel, profile, modelSet.getTransactionalEditingDomain())); }</code><technical_language>Iterator is explicitly required (e.g. iterator.remove()), for: loops more concise easier read</technical_language>

Target:
protected void applyProfile(ModelSet modelSet) { String profilePath = selectDiagramKindPage.getProfileURI(); Resource resource = modelSet.getResource(URI.createURI(profilePath), true); Profile profileToApply = (Profile) resource.getContents().get(0); Resource myModelUMLResource = UmlUtils.getUmlResource(modelSet); org.eclipse.uml2.uml.Package manipulatedModel = (org.eclipse.uml2.uml.Package) myModelUMLResource.getContents().get(0); RecordingCommand applyProfileCommand = new ApplyProfileCommand(manipulatedModel, profileToApply, modelSet.getTransactionalEditingDomain()); getCommandStack(modelSet).execute(applyProfileCommand); }
Source:
<code>public Map<String, ValueResolver<? extends Object>> getParameters() { <START> return new HashMap<>(); <END> }</code><technical_language>this consistent getParameterValue(String method present. Return a map of object's fields values. StaticValueResolver for values</technical_language>

Target:
public Map<String, ValueResolver<? extends Object>> getParameters() throws ValueResolvingException { HashMap<String, ValueResolver<? extends Object>> parameters = new HashMap<>(); try { addFields(getFields(object.getClass()), parameters); for (ParameterGroupModel parameterGroupModel : parameterizedModel.getParameterGroupModels()) { Optional<ParameterGroupModelProperty> modelProperty = parameterGroupModel.getModelProperty(ParameterGroupModelProperty.class); if (modelProperty.isPresent()) { ParameterGroupModelProperty property = modelProperty.get(); Field container = (Field) property.getDescriptor().getContainer(); Object parameterGroup = getFieldValue(object, container.getName(), reflectionCache); addFields(getFields(parameterGroup.getClass()), parameters); } } } catch (Exception e) { throw new ValueResolvingException("An error occurred trying to obtain the parameters."); } return unmodifiableMap(parameters); }
Source:
<code>public String readXhtmlData(String xhtmlOutput) { InputStream is = new ByteArrayInputStream(xhtmlOutput.getBytes()); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; StringBuffer lines = new StringBuffer(); try { while ((line = br.readLine()) != null) { lines.append(line); lines.append("\n"); } <START> return lines.toString(); <END> } catch (IOException e) { e.printStackTrace(); } return null; }</code><technical_language>@AravindRam Streams readers closed! a huge difference Tika deals millions/billions/trillions of streams runtime. Suggestion: utils read string streams. Checkout [IOUtils#toString](<LINK_0> Reusing existing utils is writing own, reasons: work (assuming) tested</technical_language>

Target:
public String readXhtmlData(String xhtmlOutput) { try{ InputStream is = new ByteArrayInputStream(xhtmlOutput.getBytes()); return IOUtils.toString(is); } catch (IOException e) { e.printStackTrace(); } return null; }
Source:
<code>public HandlebarsTemplateRenderer(Handlebars handlebars) { this.handlebars = handlebars; <START> this.templateCache = CacheBuilder.newBuilder() <END> .expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader<String, com.github.jknack.handlebars.Template>() { @Override public com.github.jknack.handlebars.Template load(String key) throws Exception { return HandlebarsTemplateRenderer.this.handlebars.compile(key); } }); }</code><technical_language>this redundant anyway</technical_language>

Target:
public HandlebarsTemplateRenderer(Handlebars handlebars) { this.handlebars = handlebars; }
Source:
<code>public Sequence<T> run(final Query<T> query, Map<String, Object> responseContext) { if (BaseQuery.getContextBySegment(query, false)) { final Sequence<T> baseSequence = base.run(query, responseContext); final List<T> results = Sequences.toList(baseSequence, Lists.<T>newArrayList()); return Sequences.simple( Arrays.asList( (T) new Result<BySegmentResultValueClass<T>>( timestamp, new BySegmentResultValueClass<T>( results, segmentIdentifier, Iterables.getOnlyElement( <START> Iterables.getOnlyElement(query.getDataSources()) <END> .getQuerySegmentSpec() .getIntervals() ) ) ) ) ); } return base.run(query, responseContext); }</code><technical_language>Query a method getDataSource(), fails if multiple data sources</technical_language>

Target:
public Sequence<T> run(final Query<T> query, Map<String, Object> responseContext) { if (QueryContexts.isBySegment(query)) { final Sequence<T> baseSequence = base.run(query, responseContext); final List<T> results = Sequences.toList(baseSequence, Lists.<T>newArrayList()); return Sequences.simple( Arrays.asList( (T) new Result<BySegmentResultValueClass<T>>( timestamp, new BySegmentResultValueClass<T>( results, segmentIdentifier, Iterables.getOnlyElement( Iterables.getOnlyElement(query.getDataSources()) .getQuerySegmentSpec() .getIntervals() ) ) ) ) ); } return base.run(query, responseContext); }
Source:
<code>public void testHarness() { <START> containsOrganizationTest(nameSpace); <END> siteUrlBaseTest(nameSpace, EXPECTED_SIZE); }</code><technical_language>need "sorted", check data is ok</technical_language>

Target:
public void testHarness() { containsOrganizationTest(nameSpace); siteUrlBaseTest(nameSpace, EXPECTED_SIZE); allYearsSummaryTest(nameSpace); fiveYearsSummaryTest(nameSpace); oneYearSummaryTest(nameSpace); }
Source:
<code>public void setUp() throws Exception { brickPosition = 1; <START> valToChange = 30.5f; <END> BrickTestUtils.createProjectAndGetStartScript("changeTransparencyByNBricktest1") .addBrick(new ChangeTransparencyByNBrick()); baseActivityTestRule.launchActivity(null); }</code><technical_language>above, please this a local variable instead of a member</technical_language>

Target:
public void setUp() throws Exception { brickPosition = 1; BrickTestUtils.createProjectAndGetStartScript("changeTransparencyByNBricktest1") .addBrick(new ChangeTransparencyByNBrick()); baseActivityTestRule.launchActivity(null); }
Source:
<code>public void whenCreateSuccessfullyThen201() throws Exception { Mockito .doNothing() .when(eventTypeRepository) .saveEventType(any(EventType.class)); Mockito .doNothing() .when(topicRepository) <START> .createTopic("team.event-name"); <END> postEventType(buildEventType()) .andExpect(status().isCreated()) .andExpect(content().string("")); verify(eventTypeRepository, times(1)).saveEventType(any(EventType.class)); verify(topicRepository, times(1)).createTopic("team.event-name"); }</code><technical_language>createTopic(EVENT_TYPE_NAME)</technical_language>

Target:
public void whenCreateSuccessfullyThen201() throws Exception { final EventType et = buildDefaultEventType(); Mockito.doNothing().when(eventTypeRepository).saveEventType(any(EventType.class)); Mockito.doNothing().when(topicRepository).createTopic(et.getName()); postEventType(et).andExpect(status().isCreated()).andExpect(content().string("")); verify(eventTypeRepository, times(1)).saveEventType(any(EventType.class)); verify(topicRepository, times(1)).createTopic(et.getName()); }
Source:
<code>public void setup() { <START> System.getProperties().put("CREDENTIALS_DIR", "k8s"); <END> }</code><technical_language>"k8s", "kube" "kubernetes" in code ;-)</technical_language>

Target:
public void setup() { System.getProperties().put("CREDENTIALS_DIR", "fs"); }
Source:
<code>public void stop() throws InterruptedException { helper.client.stop(true); helper.server.stop(); <START> helper.deregisterClient(); <END> helper.dispose(); }</code><technical_language>done in helper.dispose()</technical_language>

Target:
public void stop() throws InterruptedException { helper.client.stop(true); helper.server.stop(); helper.dispose(); }
Source:
<code>public SerialPortRxTx(String port, int baudRate) { <START> super(port, baudRate, DEFAULT_PORT_TIMEOUT); <END> this.logger = LoggerFactory.getLogger(SerialPortRxTx.class); }</code><technical_language>do before, call this(port, baudRate, DEFAULT_PORT_TIMEOUT); create logger in constructor</technical_language>

Target:
public SerialPortRxTx(String port, int baudRate) { this(port, baudRate, DEFAULT_PORT_TIMEOUT); }