auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public IStatus transferSettings(IPath newWorkspaceRoot) { File srcFolder = new File(getOldPath().toOSString()); File destFolder = new File(getNewPath(newWorkspaceRoot).toOSString()); if (!destFolder.exists()) { destFolder.mkdirs(); } if (srcFolder.isDirectory()) { String[] files = srcFolder.list(); if <START> (files == null) { <END> files = new String[0]; } for (String file : files) { File srcFile = new File(srcFolder.getPath().toString(), file); File destFile = new File(destFolder.getPath().toString(), file); try { copyFiles(srcFile, destFile); } catch (IOException e) { return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage()); } } } return Status.OK_STATUS; }</code><technical_language>check if throw IOException here, source directory list content</technical_language>

Target:
public IStatus transferSettings(IPath newWorkspaceRoot) { File srcFolder = new File(getOldPath().toOSString()); File destFolder = new File(getNewPath(newWorkspaceRoot).toOSString()); if (!destFolder.exists()) { destFolder.mkdirs(); } if (srcFolder.isDirectory()) { String[] files = srcFolder.list(); if (files == null) { return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, "Content from directory '" + srcFolder.getAbsolutePath() + "' can not be listed."); } for (String file : files) { File srcFile = new File(srcFolder.getPath().toString(), file); File destFile = new File(destFolder.getPath().toString(), file); try { copyFiles(srcFile, destFile); } catch (IOException e) { return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage()); } } } return Status.OK_STATUS; }
Source:
<code>public Response execute() throws IOException { SettableFuture<Response> future = SettableFuture.create(); enqueue(new Callback() { @Override public void onFailure(Call _call, IOException exception) { future.setException(exception); } @Override public void onResponse(Call _call, Response response) { if (!future.set(response) && response.body() != null) { response.body().close(); } } }); try { return future.get(); } catch (InterruptedException e) { getDelegate().cancel(); if (!future.setException(e)) { closeResponseBody(future); } Thread.currentThread().interrupt(); throw new InterruptedIOException("Call was interrupted during execution"); <START> } catch (ExecutionException e) { <END> getDelegate().cancel(); if (e.getCause() instanceof IoRemoteException) { RemoteException wrappedException = ((IoRemoteException) e.getCause()).getWrappedException(); RemoteException correctStackTrace = new RemoteException( wrappedException.getError(), wrappedException.getStatus()); correctStackTrace.initCause(e); throw correctStackTrace; } else if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new SafeIoException("Failed to execute call", e); } } }</code><technical_language>I get a leak here, this set response fails callback. *do* set exception of future interruption handling, a catch point stopped blocking get</technical_language>

Target:
public Response execute() throws IOException { SettableFuture<Response> future = SettableFuture.create(); enqueue(new Callback() { @Override public void onFailure(Call _call, IOException exception) { future.setException(exception); } @Override public void onResponse(Call _call, Response response) { future.set(response); } }); try { return future.get(); } catch (InterruptedException e) { getDelegate().cancel(); Futures.addCallback(future, ResponseClosingCallback.INSTANCE, MoreExecutors.directExecutor()); Thread.currentThread().interrupt(); throw new InterruptedIOException("Call cancelled via interruption"); } catch (ExecutionException e) { getDelegate().cancel(); if (e.getCause() instanceof IoRemoteException) { RemoteException wrappedException = ((IoRemoteException) e.getCause()).getWrappedException(); RemoteException correctStackTrace = new RemoteException( wrappedException.getError(), wrappedException.getStatus()); correctStackTrace.initCause(e); throw correctStackTrace; } else if (e.getCause() instanceof IoUnknownRemoteException) { UnknownRemoteException wrappedException = ((IoUnknownRemoteException) e.getCause()) .getUnknownRemoteException(); UnknownRemoteException correctStackTrace = new UnknownRemoteException( wrappedException.getStatus(), wrappedException.getBody()); correctStackTrace.initCause(e); throw correctStackTrace; } else if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new SafeIoException("Failed to execute call", e); } } }
Source:
<code>public Optional<MatchmakerQueue> getMatchmakerQueue(String technicalName) { <START> List<MatchmakerQueue> queue = getAll("/data/matchmakerQueue", ImmutableMap.of( <END> "filter", rsql(qBuilder().string("technicalName").eq(technicalName)))); if (queue.isEmpty()) { return Optional.empty(); } return Optional.ofNullable(queue.get(0)); }</code><technical_language>Map.of()</technical_language>

Target:
public Optional<MatchmakerQueue> getMatchmakerQueue(String technicalName) { List<MatchmakerQueue> queue = getAll("/data/matchmakerQueue", java.util.Map.of( INCLUDE, "leaderboard", FILTER, rsql(qBuilder().string("technicalName").eq(technicalName)))); if (queue.isEmpty()) { return Optional.empty(); } return Optional.ofNullable(queue.get(0)); }
Source:
<code>public RequestMatcher value(String parameter, Matcher<Iterable<? extends String>> matchers) { return new AbstractFormDataRequestMatcher() { @Override protected void matchInternal(MultiValueMap<String, String> requestParams) { assertValueCount(parameter, requestParams, 1); List<String> values = requestParams.get(parameter); assertThat("Request parameter [" + parameter + "]", values, matchers); <START> } <END> }; }</code><technical_language>I a lambda + a static method convert body params</technical_language>

Target:
public RequestMatcher value(String parameter, Matcher<Iterable<? extends String>> matchers) { return request -> { MultiValueMap<String, String> requestParams = FormDataRequestParser.requestParams(request); assertValueCount(parameter, requestParams, 1); List<String> values = requestParams.get(parameter); assertThat("Request parameter [" + parameter + "]", values, matchers); }; }
Source:
<code>public Predicate<IResourceType> get() { <START> if (this.currentPredicate == null) END> { return ReloadRequirements.all(); } return this.currentPredicate; }</code><technical_language>Default config is</technical_language>

Target:
public Predicate<IResourceType> get() { if (this.currentPredicate == null && false) { return ReloadRequirements.all(); } return this.currentPredicate; }
Source:
<code><START> public String validate(String parameterValue) throws ValidationException { <END> String uppercaseModel = model.toUpperCase(); try { if (uppercaseModel.startsWith(IntegerParserValidator.INTEGER_TYPE)) { new IntegerParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(LongParserValidator.LONG_TYPE)) { new LongParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(DoubleParserValidator.DOUBLE_TYPE)) { new DoubleParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(FloatParserValidator.FLOAT_TYPE)) { new FloatParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(ShortParserValidator.SHORT_TYPE)) { new ShortParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(BooleanParserValidator.BOOLEAN_TYPE)) { new BooleanParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(URLParserValidator.URL_TYPE)) { new URLParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(URIParserValidator.URI_TYPE)) { new URIParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(DateTimeParserValidator.DATETIME_TYPE)) { new DateTimeParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(ListParserValidator.LIST_TYPE)) { new ListParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(RegexpParserValidator.REGEXP_TYPE)) { new RegexpParserValidator(model).parseAndValidate(parameterValue); } else if (uppercaseModel.startsWith(ModelFromURLParserValidator.MODEL_FROM_URL_TYPE)) { new ModelFromURLParserValidator(model).parseAndValidate(parameterValue); } } catch (Exception e) { throw new ValidationException(e.getMessage(), e); } return parameterValue; }</code><technical_language>returning input parameter? altered</technical_language>

Target:
public String validate(String parameterValue) throws ValidationException { try { ParserValidator validator = createParserValidator(); if (validator != null) { validator.parseAndValidate(parameterValue); } return parameterValue; } catch (Exception e) { throw new ValidationException(e.getMessage(), e); } }
Source:
<code>private DashboardResource typeOf(ProjectControl ctl, Project.DashboardType type) throws ResourceNotFoundException, IOException, ConfigInvalidException { String id = ctl.getProject().getLocalDashboard(type); if (Strings.isNullOrEmpty(id)) { id = ctl.getProject().getDashboard(type); } type = Project.DashboardType.fromId(id); if (type != null) { throw new ResourceNotFoundException(); } else if (!Strings.isNullOrEmpty(id)) { return dashboards.parse(new ProjectResource(ctl), id); } else if (!inherited) { throw new ResourceNotFoundException(); } Set<Project.NameKey> seen = Sets.newHashSet(); seen.add(ctl.getProject().getNameKey()); ProjectState ps = ctl.getProjectState().getParentState(); while (ps != null && seen.add(ps.getProject().getNameKey())) { id = ps.getProject().getDashboard(type); type = Project.DashboardType.fromId(id); <START> if (type != null) { <END> throw new ResourceNotFoundException(); } else if (!Strings.isNullOrEmpty(id)) { ctl = ps.controlFor(ctl.getCurrentUser()); return dashboards.parse(new ProjectResource(ctl), id); } ps = ps.getParentState(); } throw new ResourceNotFoundException(); }</code><technical_language>I this easier understand if combine line a single line: if (Project.DashboardType.fromId(id) != null) { I confused need re-set type</technical_language>

Target:
private DashboardResource typeOf(ProjectControl ctl, Project.DashboardType type) throws ResourceNotFoundException, IOException, ConfigInvalidException { String id = ctl.getProject().getLocalDashboard(type); if (Strings.isNullOrEmpty(id)) { id = ctl.getProject().getDashboard(type); } if (Project.DashboardType.fromId(id) != null) { throw new ResourceNotFoundException(); } else if (!Strings.isNullOrEmpty(id)) { return dashboards.parse(new ProjectResource(ctl), id); } else if (!inherited) { throw new ResourceNotFoundException(); } Set<Project.NameKey> seen = Sets.newHashSet(); seen.add(ctl.getProject().getNameKey()); ProjectState ps = ctl.getProjectState().getParentState(); while (ps != null && seen.add(ps.getProject().getNameKey())) { id = ps.getProject().getDashboard(type); if (Project.DashboardType.fromId(id) != null) { throw new ResourceNotFoundException(); } else if (!Strings.isNullOrEmpty(id)) { ctl = ps.controlFor(ctl.getCurrentUser()); return dashboards.parse(new ProjectResource(ctl), id); } ps = ps.getParentState(); } throw new ResourceNotFoundException(); }
Source:
<code>public MerlinBuilder withLogging(boolean withLogging) { <START> Logger.detachAll(); <END> Logger.attach(new MerlinBackwardsCompatibleLog(withLogging)); return this; }</code><technical_language>I detach/attach honest, means a side effect while building merlin, means if building in 2 places in attaching logger detached knowing why</technical_language>

Target:
public MerlinBuilder withLogging(boolean withLogging) { Logger.detach(MerlinBackwardsCompatibleLog.getInstance()); if (withLogging) { Logger.attach(MerlinBackwardsCompatibleLog.getInstance()); } return this; }
Source:
<code>private ValidationResult validateSnapshotsLegality() { List<DiskImage> diskImages = getDiskImageDao().getAllSnapshotsForVmSnapshot(getParameters().getSnapshotId()); if <START> (diskImages.stream().filter(img -> img.getImageStatus() == ImageStatus.ILLEGAL).findAny().isPresent()) { <END> return ValidationResult.VALID; } List<Guid> otherSnapshotsId = getSnapshotDao().getAll(getVmId()). stream(). map(Snapshot::getId). filter(id -> !id.equals(getParameters().getSnapshotId())). collect(Collectors.toList()); for (Guid snapshotId : otherSnapshotsId) { diskImages = getDiskImageDao().getAllSnapshotsForVmSnapshot(snapshotId); if (diskImages.stream().filter(img -> img.getImageStatus() == ImageStatus.ILLEGAL).findAny().isPresent()) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_SNAPSHOT_WITH_ILLEGAL_VOLUME_EXISTS, String.format("$snapshot %s", getSnapshotDao().get(getParameters().getSnapshotId()).getDescription())); } } return ValidationResult.VALID; }</code><technical_language>diskImages.stream().anyMatch(img -> img.getImageStatus() == ImageStatus.ILLEGAL)</technical_language>

Target:
private ValidationResult validateSnapshotsLegality() { List<Snapshot> otherSnapshots = getSnapshotDao().getAll(getVmId()). stream(). filter(snapshot -> !snapshot.getId().equals(getParameters().getSnapshotId())). collect(Collectors.toList()); for (Snapshot snapshot : otherSnapshots) { List<DiskImage> diskImages = getDiskImageDao().getAllSnapshotsForVmSnapshot(snapshot.getId()); if (diskImages.stream().filter(img -> img.getImageStatus() == ImageStatus.ILLEGAL).findAny().isPresent()) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_SNAPSHOT_WITH_ILLEGAL_VOLUME_EXISTS, String.format("$snapshot %s", snapshot.getDescription())); } } return ValidationResult.VALID; }
Source:
<code>protected String getVdsSearchString(final MoveHost moveHost) { StringBuilder buf = new StringBuilder("Host: "); int i = 0; for (MoveHostData hostData : moveHost.getSelectedHosts()) { <START> if (i > 0) { <END> buf.append(" or "); } buf.append("name = "); buf.append(hostData.getEntity().getName()); i++; } return buf.toString(); }</code><technical_language>Instead of extra variable (i) check length of buffer, if (buf.length > 6) { Saves add a new variable</technical_language>

Target:
protected String getVdsSearchString(final MoveHost moveHost) { StringBuilder buf = new StringBuilder("Host: "); for (MoveHostData hostData : moveHost.getSelectedHosts()) { if ((buf.length()) > 6) { buf.append(" or "); } buf.append("name = "); buf.append(hostData.getEntity().getName()); } return buf.toString(); }
Source:
<code>public void numericKeysTest() { <START> onBrickAtPosition(0).checkShowsText(R.string.brick_when_started); <END> onBrickAtPosition(1).checkShowsText(R.string.brick_change_size_by); onBrickAtPosition(1).perform(click()); onView(withId(R.id.formula_editor_keyboard_1)).perform(click()); onView(withId(R.id.formula_editor_keyboard_2)).perform(click()); onView(withId(R.id.formula_editor_keyboard_3)).perform(click()); onView(withId(R.id.formula_editor_keyboard_4)).perform(click()); onView(withId(R.id.formula_editor_keyboard_5)).perform(click()); onView(withId(R.id.formula_editor_keyboard_6)).perform(click()); onView(withId(R.id.formula_editor_keyboard_7)).perform(click()); onView(withId(R.id.formula_editor_keyboard_8)).perform(click()); onView(withId(R.id.formula_editor_keyboard_9)).perform(click()); onView(withId(R.id.formula_editor_keyboard_0)).perform(click()); onView(withId(R.id.formula_editor_keyboard_decimal_mark)).perform(click()); onView(withId(R.id.formula_editor_keyboard_1)).perform(click()); onView(withId(R.id.formula_editor_keyboard_ok)).perform(click()); onView(withId(R.id.formula_editor_edit_field)) .check(matches(withText("1234567890" + UiTestUtils.getResourcesString(R.string.formula_editor_decimal_mark) + "1 "))); }</code><technical_language>check this beginning of test</technical_language>

Target:
public void numericKeysTest() { onBrickAtPosition(0) .checkShowsText(R.string.brick_when_started); onBrickAtPosition(1) .checkShowsText(R.string.brick_change_size_by); onBrickAtPosition(1) .onChildView(withId(R.id.brick_change_size_by_edit_text)).perform(click()); onView(withId(R.id.formula_editor_keyboard_1)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_2)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_3)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_4)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_5)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_6)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_7)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_8)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_9)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_0)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_decimal_mark)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_1)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_ok)) .perform(click()); onView(withId(R.id.formula_editor_edit_field)) .check(matches(withText("1234567890" + UiTestUtils.getResourcesString(R.string.formula_editor_decimal_mark) + "1 "))); }
Source:
<code>public SimpleString getAddressSimpleString() { if (address == null) { address = createExtraProperties().getSimpleStringProperty(ADDRESS_PROPERTY); if (address != null) { return address; } Properties properties = getProperties(); if (properties != null && properties.getTo() != null) { address = cachedAddressSimpleString(properties.getTo()); <START> return address; <END> } } return address; }</code><technical_language>is this needed statement in method returns address</technical_language>

Target:
public SimpleString getAddressSimpleString() { if (address == null) { TypedProperties extraProperties = getExtraProperties(); if (extraProperties != null) { address = extraProperties.getSimpleStringProperty(ADDRESS_PROPERTY); } if (address == null) { Properties properties = getProperties(); if (properties != null && properties.getTo() != null) { address = cachedAddressSimpleString(properties.getTo()); } } } return address; }
Source:
<code>public boolean shouldBeRecursive() { <START> return shouldBeRecursive; <END> }</code><technical_language>drop this boolean !prefixes.isEmpty(). If prefixes, need deeper root</technical_language>

Target:
public boolean shouldBeRecursive() { return !prefixes.isEmpty(); }
Source:
<code>private <R> R accessInner(ICorfuSMRAccess<R, T> accessMethod, Object[] conflictObject) { if (TransactionalContext.isInTransaction()) { try { return TransactionalContext.getCurrentContext() .access(this, accessMethod, conflictObject); } catch (Exception e) { log.error("Access[{}]", this, e); this.abortTransaction(e); } } AtomicLong timestamp = new AtomicLong(rt.getSequencerView().query(getStreamID())); log.debug("Access[{}] conflictObj={} version={}", this, conflictObject, timestamp); return underlyingObject.access(o -> o.getVersionUnsafe() >= timestamp.get() && !o.isOptimisticallyModifiedUnsafe(), o -> { for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { try { <START> timestamp.set(rt.getSequencerView() <END> .query(getStreamID())); o.syncObjectUnsafe(timestamp.get()); } catch (TrimmedException te) { log.info("accessInner: Encountered trimmed address space " + "while accessing version of stream on attempt {}", timestamp.get(), getStreamID(), x); o.resetUnsafe(); if (x == rt.getParameters().getTrimRetry()) { throw te; } } } }, o -> accessMethod.access(o)); }</code><technical_language>need a break run 2 times access</technical_language>

Target:
private <R> R accessInner(ICorfuSMRAccess<R, T> accessMethod, Object[] conflictObject) { if (TransactionalContext.isInTransaction()) { try { return TransactionalContext.getCurrentContext() .access(this, accessMethod, conflictObject); } catch (Exception e) { log.error("Access[{}]", this, e); this.abortTransaction(e); } } AtomicLong timestamp = new AtomicLong(rt.getSequencerView().query(getStreamID())); log.debug("Access[{}] conflictObj={} version={}", this, conflictObject, timestamp); return underlyingObject.access(o -> o.getVersionUnsafe() >= timestamp.get() && !o.isOptimisticallyModifiedUnsafe(), o -> { for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { try { o.syncObjectUnsafe(timestamp.get()); break; } catch (TrimmedException te) { log.info("accessInner: Encountered trimmed address space " + "while accessing version of stream on attempt {}", timestamp.get(), getStreamID(), x); o.resetUnsafe(); if (x == (rt.getParameters().getTrimRetry() - 1)) { throw te; } timestamp.set(rt.getSequencerView().query(getStreamID())); } } }, o -> accessMethod.access(o)); }
Source:
<code>public static void cleanupMiniDFS() throws Exception { dfsCluster.shutdown(); <START> TEMP_FOLDER.delete(); <END> if (sshServer != null) { sshServer.stop(); } }</code><technical_language>need this</technical_language>

Target:
public static void cleanupMiniDFS() throws Exception { dfsCluster.shutdown(); if (sshServer != null) { sshServer.stop(); } }
Source:
<code>public ImportResult<Transaction> findOrImportTransaction(final Xid xid, final int timeout, final boolean doNotImport) throws XAException { try { final SimpleXid simpleXid = SimpleXid.of(xid); final SimpleXid gtid = simpleXid.withoutBranch(); final ConcurrentMap<SimpleXid, Entry> known = JBossLocalTransactionProvider.this.known; Entry entry = known.get(gtid); if (entry != null) { return new ImportResult<Transaction>(entry.getTransaction(), entry, false); } boolean imported; Transaction transaction; if (doNotImport) { imported = false; transaction = ext.getTransaction(xid); if(transaction == null) { ext.doRecover(null, null); <START> final TransactionImportResult result = ext.importTransaction(xid, timeout); <END> transaction = result.getTransaction(); imported = result.isNewImportedTransaction(); } if (transaction == null) { return null; } } else { final TransactionImportResult result = ext.importTransaction(xid, timeout); transaction = result.getTransaction(); imported = result.isNewImportedTransaction(); } entry = getEntryFor(transaction, gtid); final Entry appearing = known.putIfAbsent(gtid, entry); if (appearing != null) { return new ImportResult<Transaction>(transaction, appearing, imported); } else { return new ImportResult<Transaction>(transaction, entry, imported); } } catch (XAException e) { throw e; } catch (Throwable t) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMFAIL, t); } }</code><technical_language>In this case explicitly do want import transaction. this change, transaction imported</technical_language>

Target:
public ImportResult<Transaction> findOrImportTransaction(final Xid xid, final int timeout, final boolean doNotImport) throws XAException { try { final SimpleXid simpleXid = SimpleXid.of(xid); final SimpleXid gtid = simpleXid.withoutBranch(); final ConcurrentMap<SimpleXid, Entry> known = JBossLocalTransactionProvider.this.known; Entry entry = known.get(gtid); if (entry != null) { return new ImportResult<Transaction>(entry.getTransaction(), entry, false); } final boolean imported; Transaction transaction; if (doNotImport) { imported = false; transaction = ext.getTransaction(xid); if(transaction == null) { ext.doRecover(null, null); transaction = ext.getTransaction(xid); } if (transaction == null) { return null; } } else { final TransactionImportResult result = ext.importTransaction(xid, timeout); transaction = result.getTransaction(); imported = result.isNewImportedTransaction(); } entry = getEntryFor(transaction, gtid); final Entry appearing = known.putIfAbsent(gtid, entry); if (appearing != null) { return new ImportResult<Transaction>(transaction, appearing, imported); } else { return new ImportResult<Transaction>(transaction, entry, imported); } } catch (XAException e) { throw e; } catch (Throwable t) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMFAIL, t); } }
Source:
<code>private static void computeVersion(ServletContext context) { Properties props = new Properties(); InputStream is = null; try { is = Jenkins.class.getResourceAsStream("jenkins-version.properties"); if(is!=null) props.load(is); } catch (IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(is); } String ver = props.getProperty("version"); if(ver==null) ver = UNCOMPUTED_VERSION; <START> if(Main.isDevelopmentMode && "${build.version}".equals(ver)) { <END> try { File dir = new File(".").getAbsoluteFile(); while(dir != null) { File pom = new File(dir, "pom.xml"); if (pom.exists() && "pom".equals(XMLUtils.getValue("/project/artifactId", pom))) { pom = pom.getCanonicalFile(); LOGGER.info("Reading version from: " + pom.getAbsolutePath()); ver = XMLUtils.getValue("/project/version", pom); break; } dir = dir.getParentFile(); } LOGGER.info("Jenkins is in dev mode, using version: " + ver); } catch (Exception e) { LOGGER.log(Level.WARNING, "Unable to read Jenkins version: " + e.getMessage(), e); } } VERSION = ver; context.setAttribute("version",ver); VERSION_HASH = Util.getDigestOf(ver).substring(0, 8); SESSION_HASH = Util.getDigestOf(ver+System.currentTimeMillis()).substring(0, 8); if(ver.equals(UNCOMPUTED_VERSION) || Boolean.getBoolean("hudson.script.noCache")) RESOURCE_PATH = ""; else RESOURCE_PATH = "/static/"+SESSION_HASH; VIEW_RESOURCE_PATH = "/resources/"+ SESSION_HASH; }</code><technical_language>condition? Is isDevelopmentMode enough</technical_language>

Target:
private static void computeVersion(ServletContext context) { Properties props = new Properties(); InputStream is = null; try { is = Jenkins.class.getResourceAsStream("jenkins-version.properties"); if(is!=null) props.load(is); } catch (IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(is); } String ver = props.getProperty("version"); if(ver==null) ver = UNCOMPUTED_VERSION; if(Main.isDevelopmentMode && "${build.version}".equals(ver)) { try { File dir = new File(".").getAbsoluteFile(); while(dir != null) { File pom = new File(dir, "pom.xml"); if (pom.exists() && "pom".equals(XMLUtils.getValue("/project/artifactId", pom))) { pom = pom.getCanonicalFile(); LOGGER.info("Reading version from: " + pom.getAbsolutePath()); ver = XMLUtils.getValue("/project/version", pom); break; } dir = dir.getParentFile(); } LOGGER.info("Jenkins is in dev mode, using version: " + ver); } catch (Exception e) { LOGGER.log(Level.WARNING, "Unable to read Jenkins version: " + e.getMessage(), e); } } VERSION = ver; context.setAttribute("version",ver); VERSION_HASH = Util.getDigestOf(ver).substring(0, 8); SESSION_HASH = Util.getDigestOf(ver+System.currentTimeMillis()).substring(0, 8); if(ver.equals(UNCOMPUTED_VERSION) || SystemProperties.getBoolean("hudson.script.noCache")) RESOURCE_PATH = ""; else RESOURCE_PATH = "/static/"+SESSION_HASH; VIEW_RESOURCE_PATH = "/resources/"+ SESSION_HASH; }
Source:
<code>public void testTimeBasedCancellation() { DataStoreTransaction dtx = elide.getDataStore().beginTransaction(); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf828d"), dtx); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf827d"), dtx); AsyncQuery asyncQuery1 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf828d", System.currentTimeMillis(), QueryStatus.QUEUED); AsyncQuery asyncQuery2 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf827d", 1577883600000L, QueryStatus.QUEUED); AsyncQuery asyncQuery3 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf826d", 1577883600000L, QueryStatus.QUEUED); Collection<AsyncQuery> asyncCollection = new ArrayList<AsyncQuery>(); asyncCollection.add(asyncQuery1); asyncCollection.add(asyncQuery2); asyncCollection.add(asyncQuery3); when(cancelThread.getAsyncQueryDao().loadAsyncQueryCollection(any())).thenReturn(asyncCollection); cancelThread.cancelAsyncQuery(); ArgumentCaptor<FilterExpression> filterCaptor = ArgumentCaptor.forClass(FilterExpression.class); <START> verify(asyncQueryDao, times(1)).updateStatusAsyncQueryCollection(filterCaptor.capture(), any()); <END> assertEquals("asyncQuery.id IN [[edc4a871-dff2-4054-804e-d80075cf827d]]", filterCaptor.getValue().toString()); }</code><technical_language>Verify status</technical_language>

Target:
public void testTimeBasedCancellation() { DataStoreTransaction dtx = elide.getDataStore().beginTransaction(); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf828d"), dtx); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf827d"), dtx); AsyncQuery asyncQuery1 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf828d", System.currentTimeMillis(), QueryStatus.QUEUED); AsyncQuery asyncQuery2 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf827d", 1577883600000L, QueryStatus.QUEUED); AsyncQuery asyncQuery3 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf826d", 1577883600000L, QueryStatus.QUEUED); Collection<AsyncQuery> asyncCollection = new ArrayList<AsyncQuery>(); asyncCollection.add(asyncQuery1); asyncCollection.add(asyncQuery2); asyncCollection.add(asyncQuery3); when(cancelThread.getAsyncQueryDao().loadAsyncQueryCollection(any())).thenReturn(asyncCollection); cancelThread.cancelAsyncQuery(); ArgumentCaptor<FilterExpression> filterCaptor = ArgumentCaptor.forClass(FilterExpression.class); ArgumentCaptor<QueryStatus> statusCaptor = ArgumentCaptor.forClass(QueryStatus.class); verify(asyncQueryDao, times(1)).updateStatusAsyncQueryCollection(filterCaptor.capture(), statusCaptor.capture()); assertEquals("asyncQuery.id IN [[edc4a871-dff2-4054-804e-d80075cf827d]]", filterCaptor.getValue().toString()); assertEquals("CANCEL_COMPLETE", statusCaptor.getValue().toString()); }
Source:
<code>public void testParsedNamedWindowDefinitionWithRange() { CriteriaBuilder<Tuple> criteria = cbf.create(em, Tuple.class) .from(Person.class, "per") .window("x").orderByAsc("per.age").rows().betweenUnboundedPreceding().andCurrentRow().end() .select("per.age") .select("SUM(per.age) OVER x") .orderByAsc("per.age") ; String queryString = criteria.getQueryString(); <START> assertEquals("SELECT per.age, window_sum(per.age,'ORDER BY',per.age,'ASC NULLS LAST', " + <END> "'ROWS','BETWEEN','UNBOUNDED PRECEDING','AND','CURRENT ROW') " + "FROM Person per WINDOW x AS (ORDER BY per.age ASC NULLS " + "LAST ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) ORDER BY per.age ASC", queryString); List<Tuple> resultList = criteria.getResultList(); assertNotNull(resultList); }</code><technical_language>purpose. internal, need for assertions here</technical_language>

Target:
public void testParsedNamedWindowDefinitionWithRange() { CriteriaBuilder<Tuple> criteria = cbf.create(em, Tuple.class) .from(Person.class, "per") .window("x").orderByAsc("per.age").rows().betweenUnboundedPreceding().andCurrentRow().end() .select("per.age") .select("SUM(per.age) OVER x") .orderByAsc("per.age") ; String queryString = criteria.getQueryString(); assertTrue(queryString.contains(function("window_sum", "per.age", "'ORDER BY'", "per.age", "'ASC NULLS LAST'", "'ROWS'", "'BETWEEN'", "'UNBOUNDED PRECEDING'", "'AND'", "'CURRENT ROW'"))); List<Tuple> resultList = criteria.getResultList(); assertNotNull(resultList); }
Source:
<code>public long getRetainedSizeInBytes() { int size = INSTANCE_SIZE; if (decodedBlock instanceof Block) { size += ((Block) decodedBlock).getRetainedSizeInBytes(); } <START> <END> for (DecodedBlockNode child : children) { size += child.getRetainedSizeInBytes(); } return size; }</code><technical_language>Ideally decodedBlock filed of type Block. a real reason want ColumnarArray/Map/Row. For example trivial operation toColumarArray is a region of unrelaying block: <LINK_0> This done inline</technical_language>

Target:
public long getRetainedSizeInBytes() { int size = INSTANCE_SIZE; if (decodedBlock instanceof Block) { size += ((Block) decodedBlock).getRetainedSizeInBytes(); } else if (decodedBlock instanceof ColumnarArray) { size += ((ColumnarArray) decodedBlock).getRetainedSizeInBytes(); } else if (decodedBlock instanceof ColumnarMap) { size += ((ColumnarMap) decodedBlock).getRetainedSizeInBytes(); } else if (decodedBlock instanceof ColumnarRow) { size += ((ColumnarRow) decodedBlock).getRetainedSizeInBytes(); } for (DecodedBlockNode child : children) { size += child.getRetainedSizeInBytes(); } return size; }
Source:
<code>public Get createGet(Object rowKey) { checkArgument(keyEncoder != null, "row key is not set."); <START> GenericRowData rowData = new GenericRowData(1); <END> rowData.setField(0, rowKey); byte[] rowkey = keyEncoder.encode(rowData, 0); if (rowkey.length == 0) { return null; } Get get = new Get(rowkey); for (int f = 0; f < families.length; f++) { byte[] family = families[f]; for (byte[] qualifier : qualifiers[f]) { get.addColumn(family, qualifier); } } return get; }</code><technical_language>reuse GenericRowData</technical_language>

Target:
public Get createGet(Object rowKey) { checkArgument(keyEncoder != null, "row key is not set."); rowWithRowKey.setField(0, rowKey); byte[] rowkey = keyEncoder.encode(rowWithRowKey, 0); if (rowkey.length == 0) { return null; } Get get = new Get(rowkey); for (int f = 0; f < families.length; f++) { byte[] family = families[f]; for (byte[] qualifier : qualifiers[f]) { get.addColumn(family, qualifier); } } return get; }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { CustomSiriusEditor editor = getCurrentEditor(); if (editor != null) { Object root = null; <START> try { root = editor.getEditingDomain().getResourceSet().getResources().get(0).getContents().get(0); } catch (NullPointerException npe) { } <END> if (root != null) { SiriusInformationPresenter presenter = SiriusInformationPresenterFactory.createInformationPresenter(editor.getControl(), createDescriptor(editor), root); presenter.showInformation(); } } return null; }</code><technical_language>Do catch NPEs, mask errors get* methods</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { CustomSiriusEditor editor = getCurrentEditor(); Object root = getRoot(editor); if (root != null) { SiriusInformationPresenter presenter = SiriusInformationPresenterFactory.createInformationPresenter(editor.getControl(), createDescriptor(editor), root); presenter.showInformation(); } return null; }
Source:
<code>public int issueRequest(long ts, Request request) { Object issuedFromValue = null; int fromQuark = removeWaitingRequest(ts, request.getSector()); if (fromQuark != ITmfStateSystem.INVALID_ATTRIBUTE) { <START> issuedFromValue = fSs.getAttributeName(fromQuark); <END> } ITmfStateValue statusState = request.getType() == IoOperationType.READ ? StateValues.READING_REQUEST_VALUE : StateValues.WRITING_REQUEST_VALUE; int slotQuark = fDriverQueueAttrib.getAvailable(); try { fSs.modifyAttribute(ts, statusState.unboxValue(), slotQuark); int currentRequestQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.CURRENT_REQUEST); fSs.modifyAttribute(ts, request.getSector(), currentRequestQuark); int requestSizeQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.REQUEST_SIZE); fSs.modifyAttribute(ts, request.getNrSector(), requestSizeQuark); int issuedFromQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.ISSUED_FROM); fSs.modifyAttribute(ts, issuedFromValue, issuedFromQuark); } catch (StateValueTypeException e) { Activator.getDefault().logError("Error issuing request", e); } fDriverQueue.put(request.getSector(), new Pair<>(request, slotQuark)); updateQueuesLength(ts); return slotQuark; }</code><technical_language>THIS!!! THIS IS PROBLEM!!!! Look, needs Integer.parseInt</technical_language>

Target:
public int issueRequest(long ts, Request request) { Object issuedFromValue = null; int fromQuark = removeWaitingRequest(ts, request.getSector()); if (fromQuark != ITmfStateSystem.INVALID_ATTRIBUTE) { issuedFromValue = Integer.parseInt(fSs.getAttributeName(fromQuark)); } ITmfStateValue statusState = request.getType() == IoOperationType.READ ? StateValues.READING_REQUEST_VALUE : StateValues.WRITING_REQUEST_VALUE; int slotQuark = fDriverQueueAttrib.getAvailable(); try { fSs.modifyAttribute(ts, statusState.unboxValue(), slotQuark); int currentRequestQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.CURRENT_REQUEST); fSs.modifyAttribute(ts, request.getSector(), currentRequestQuark); int requestSizeQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.REQUEST_SIZE); fSs.modifyAttribute(ts, request.getNrSector(), requestSizeQuark); int issuedFromQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.ISSUED_FROM); fSs.modifyAttribute(ts, issuedFromValue, issuedFromQuark); } catch (StateValueTypeException e) { Activator.getDefault().logError("Error issuing request", e); } fDriverQueue.put(request.getSector(), new Pair<>(request, slotQuark)); updateQueuesLength(ts); return slotQuark; }
Source:
<code>CompletableFuture<Boolean> getMainOp(CommitData cd) { <START> return env.getSharedResources().getBatchWriter() <END> .writeMutationsAsyncFuture(createMutations(cd)).thenApply(v -> { cd.commitObserver.committed(); return true; }); }</code><technical_language>refactor this following, this reuse code in super class. java @Override CompletableFuture<Boolean> getMainOp(CommitData cd) { return super.getMainOp(cd).thenApply(b-> { Preconditions.checkArgument(b); //expect this true.. adding this decided good assumptions super method cd.commitObserver.committed(); return true; }); } I this shorter thenRun() void return type threw off</technical_language>

Target:
CompletableFuture<Boolean> getMainOp(CommitData cd) { return super.getMainOp(cd).thenApply(b -> { Preconditions.checkArgument(b); cd.commitObserver.committed(); return true; }); }
Source:
<code>public void testGetTimeZoneWhenTimeZoneIsHST() { <START> System.setProperty("user.timezone", "HST"); <END> assertEquals("-36000000", getLoaderOffset()); }</code><technical_language>I need add @After @AfterClass method restore "user.timezone" system property original value</technical_language>

Target:
public void testGetTimeZoneWhenTimeZoneIsHST() { doReturn("HST").when(loader).getSystemPropertyTimeZone(); assertEquals("-36000000", getLoaderOffset()); }
Source:
<code>public void initializeDatastream(Datastream stream, List<Datastream> allDatastreams) throws DatastreamValidationException { LOG.info("validating datastream " + stream.toString()); try { MysqlSource source = MysqlSource.createFromUri(stream.getSource().getConnectionString()); if (source.getSourceType() != _sourceType) { String msg = String.format("Connector can only support datastreams of source type: %s", _sourceType); LOG.error(msg); throw new DatastreamValidationException(msg); } if (_sourceType == SourceType.MYSQLSERVER) { if (MysqlQueryUtils.checkTableExists(source, getUserNameFromDatastream(stream), getPasswordFromDatastream(stream))) { throw new DatastreamValidationException( <START> String.format("Invalid datastream: Can't find table %s in db %s.", source.getDatabaseName(), <END> source.getTableName())); } } else { File binlogFolder = new File(source.getBinlogFolderName()); if (!binlogFolder.exists()) { String msg = String.format("BinlogFolder %s doesn't exist", binlogFolder.getAbsolutePath()); LOG.error(msg); throw new DatastreamValidationException(msg); } } if (stream.getSource().hasPartitions() && stream.getSource().getPartitions() != 1) { String msg = "Mysql connector can only support single partition sources"; LOG.error(msg); throw new DatastreamValidationException(msg); } } catch (SourceNotValidException | SQLException e) { throw new DatastreamValidationException(e); } }</code><technical_language>If this fail due incorrect username/password, change message note possibility, too</technical_language>

Target:
public void initializeDatastream(Datastream stream, List<Datastream> allDatastreams) throws DatastreamValidationException { LOG.info("validating datastream " + stream.toString()); try { MysqlSource source = MysqlSource.createFromUri(stream.getSource().getConnectionString()); if (source.getSourceType() != _sourceType) { String msg = String.format("Connector can only support datastreams of source type: %s", _sourceType); LOG.error(msg); throw new DatastreamValidationException(msg); } if (_sourceType == SourceType.MYSQLSERVER) { if (!MysqlQueryUtils.checkTableExists(source, getUserNameFromDatastream(stream), getPasswordFromDatastream(stream))) { throw new DatastreamValidationException( String.format("Invalid datastream: Can't find table %s in db %s.", source.getTableName(), source.getDatabaseName())); } } else { File binlogFolder = new File(source.getBinlogFolderName()); if (!binlogFolder.exists()) { String msg = String.format("BinlogFolder %s doesn't exist", binlogFolder.getAbsolutePath()); LOG.error(msg); throw new DatastreamValidationException(msg); } } if (stream.getSource().hasPartitions() && stream.getSource().getPartitions() != 1) { String msg = "Mysql connector can only support single partition sources"; LOG.error(msg); throw new DatastreamValidationException(msg); } } catch (SourceNotValidException | SQLException e) { String msg = String.format("InitializeDatastream threw exception for datastream %s", stream); LOG.error(msg, e); throw new DatastreamValidationException(msg, e); } }
Source:
<code>public void testRandomContent() throws Exception { MultipartContent content = new MultipartContent(); String boundaryString = content.getBoundary(); assertNotNull(boundaryString); assertTrue(boundaryString.startsWith(BOUNDARY)); assertTrue(boundaryString.endsWith("__")); assertEquals("multipart/related; boundary=" + boundaryString, content.getType()); final String[][] VALUES = new String[][] { {"Hello world", "text/plain"}, {"<xml>Hi</xml>", "application/xml"}, {"{x:1,y:2}", "application/json"} }; <START> StringBuilder expectedContentSB = new StringBuilder(); <END> for (String[] valueTypePair: VALUES) { String contentValue = valueTypePair[0]; String contentType = valueTypePair[1]; content.addPart(new MultipartContent.Part(ByteArrayContent.fromString(contentType, contentValue))); expectedContentSB.append("--").append(boundaryString).append(CRLF) .append(headers(contentType, contentValue)).append(CRLF) .append(contentValue).append(CRLF); } expectedContentSB.append("--").append(boundaryString).append("--").append(CRLF); ByteArrayOutputStream out = new ByteArrayOutputStream(); content.writeTo(out); String expectedContent = expectedContentSB.toString(); assertEquals(expectedContent, out.toString()); assertEquals(StringUtils.getBytesUtf8(expectedContent).length, content.getLength()); }</code><technical_language>abbreviations google style, simply "expectedContent" expected is fine</technical_language>

Target:
public void testRandomContent() throws Exception { MultipartContent content = new MultipartContent(); String boundaryString = content.getBoundary(); assertNotNull(boundaryString); assertTrue(boundaryString.startsWith(BOUNDARY)); assertTrue(boundaryString.endsWith("__")); assertEquals("multipart/related; boundary=" + boundaryString, content.getType()); final String[][] VALUES = new String[][] { {"Hello world", "text/plain"}, {"<xml>Hi</xml>", "application/xml"}, {"{x:1,y:2}", "application/json"} }; StringBuilder expectedStringBuilder = new StringBuilder(); for (String[] valueTypePair: VALUES) { String contentValue = valueTypePair[0]; String contentType = valueTypePair[1]; content.addPart(new MultipartContent.Part(ByteArrayContent.fromString(contentType, contentValue))); expectedStringBuilder.append("--").append(boundaryString).append(CRLF) .append(headers(contentType, contentValue)).append(CRLF) .append(contentValue).append(CRLF); } expectedStringBuilder.append("--").append(boundaryString).append("--").append(CRLF); ByteArrayOutputStream out = new ByteArrayOutputStream(); content.writeTo(out); String expectedContent = expectedStringBuilder.toString(); assertEquals(expectedContent, out.toString(Charsets.UTF_8.name())); assertEquals(StringUtils.getBytesUtf8(expectedContent).length, content.getLength()); }
Source:
<code>public void start(BundleContext context) throws Exception { Package thisPkg = getClass().getPackage(); assertNotNull("thisPkg", thisPkg); checkPackage(thisPkg, "main", "1.0", "equinox.main", "MAIN", "10.0", "equinox.main"); Package aPkg = A.class.getPackage(); assertNotNull("aPkg", aPkg); checkPackage(aPkg, "a", "1.1", "equinox.a", "A", "11.0", "equinox.a"); Package bPkg = B.class.getPackage(); assertNotNull("bPkg", bPkg); checkPackage(bPkg, "b", "1.2", "equinox.b", "B", "12.0", "equinox.b"); Package cPkg = C.class.getPackage(); assertNotNull("cPkg", cPkg); checkPackage(cPkg, "c", "1.3", "equinox.c", "C", "13.0", "equinox.c"); Package dPkg = D.class.getPackage(); assertNotNull("dPkg", dPkg); checkPackage(dPkg, "d", "1.0", "equinox.main", "D", "10.0", "equinox.main"); Package ePkg = E.class.getPackage(); assertNotNull("ePkg", ePkg); checkPackage(ePkg, "main", "1.5", "equinox.main", "MAIN", "15.0", "equinox.main"); Package fPkg = F.class.getPackage(); <START> assertNotNull("ePkg", fPkg); <END> checkPackage(fPkg, "main", "1.0", "equinox.f", "MAIN", "10.0", "equinox.f"); }</code><technical_language>This fPkg, I suspect</technical_language>

Target:
public void start(BundleContext context) throws Exception { Package thisPkg = getClass().getPackage(); assertNotNull("thisPkg", thisPkg); checkPackage(thisPkg, "main", "1.0", "equinox.main", "MAIN", "10.0", "equinox.main"); Package aPkg = A.class.getPackage(); assertNotNull("aPkg", aPkg); checkPackage(aPkg, "a", "1.1", "equinox.a", "A", "11.0", "equinox.a"); Package bPkg = B.class.getPackage(); assertNotNull("bPkg", bPkg); checkPackage(bPkg, "b", "1.2", "equinox.b", "B", "12.0", "equinox.b"); Package cPkg = C.class.getPackage(); assertNotNull("cPkg", cPkg); checkPackage(cPkg, "c", "1.3", "equinox.c", "C", "13.0", "equinox.c"); Package dPkg = D.class.getPackage(); assertNotNull("dPkg", dPkg); checkPackage(dPkg, "d", "1.0", "equinox.main", "D", "10.0", "equinox.main"); Package ePkg = E.class.getPackage(); assertNotNull("ePkg", ePkg); checkPackage(ePkg, "main", "1.5", "equinox.main", "MAIN", "15.0", "equinox.main"); Package fPkg = F.class.getPackage(); assertNotNull("fPkg", fPkg); checkPackage(fPkg, "main", "1.0", "equinox.f", "MAIN", "10.0", "equinox.f"); }
Source:
<code>public JettyServletScoreBoardController(ScoreBoard sb, JSONStateManager jsm, String host, int port) { scoreBoard = sb; this.jsm = jsm; init(host, port); Logger.printMessage(""); Logger.printMessage("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"); Logger.printMessage("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"); if (port == 8000) { Logger.printMessage("Double-click/open the 'start.html' file, or"); } Logger.printMessage("Open a web browser (either Google Chrome or Mozilla Firefox recommended) to:"); Logger.printMessage(" http://localhost:"+port); try { Set<String> urls = urlsServlet.getUrls(); if (!urls.isEmpty()) { Logger.printMessage("or try one of these URLs:"); } for (String u : urls) { <START> Logger.printMessage(" "+u.toString()); <END> } } catch ( MalformedURLException muE ) { Logger.printMessage("Internal error: malformed URL from Server Connector: "+muE.getMessage()); } catch ( SocketException sE ) { Logger.printMessage("Internal error: socket exception from Server Connector: "+sE.getMessage()); } Logger.printMessage("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); Logger.printMessage("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); Logger.printMessage(""); }</code><technical_language>toString() is redundant</technical_language>

Target:
public JettyServletScoreBoardController(ScoreBoard sb, JSONStateManager jsm, String host, int port) { scoreBoard = sb; this.jsm = jsm; init(host, port); Logger.printMessage(""); Logger.printMessage("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"); Logger.printMessage("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"); if (port == 8000) { Logger.printMessage("Double-click/open the 'start.html' file, or"); } Logger.printMessage("Open a web browser (either Google Chrome or Mozilla Firefox recommended) to:"); Logger.printMessage(" http://localhost:"+port); try { Set<String> urls = urlsServlet.getUrls(); if (!urls.isEmpty()) { Logger.printMessage("or try one of these URLs:"); } for (String u : urls) { Logger.printMessage(" "+u); } } catch ( MalformedURLException muE ) { Logger.printMessage("Internal error: malformed URL from Server Connector: "+muE.getMessage()); } catch ( SocketException sE ) { Logger.printMessage("Internal error: socket exception from Server Connector: "+sE.getMessage()); } Logger.printMessage("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); Logger.printMessage("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); Logger.printMessage(""); }