auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void execute(List<String> xqFiles) { if (opts.restIpAddress == null) { System.out.println("No REST Ip address given. Creating a local hyracks cluster"); try { restIpAddress = startLocalHyracks(); restPort = opts.restPort; } catch (Exception e) { System.err.println("Unable to start local hyracks cluster due to: " + e.getMessage()); return; } } else { restIpAddress = opts.restIpAddress; restPort = opts.restPort; } System.out.println("Running queries given in: " + Arrays.toString(xqFiles.toArray())); runQueries(xqFiles); if (opts.restIpAddress == null) { try { stopLocalHyracks(); } catch (Exception e) { System.err.println("Error occurred when stopping local hyracks: " + e.getMessage()); <START> } <END> } }</code><technical_language>loosing functionality timing. Thoughts</technical_language>

Target:
private void execute(List<String> xqFiles) { if (opts.restIpAddress == null) { System.out.println("No REST Ip address given. Creating a local hyracks cluster"); VXQueryConfig vxqConfig = new VXQueryConfig(); vxqConfig.setAvailableProcessors(opts.availableProcessors); vxqConfig.setFrameSize(opts.frameSize); vxqConfig.setHdfsConf(opts.hdfsConf); vxqConfig.setJoinHashSize(opts.joinHashSize); vxqConfig.setMaximumDataSize(opts.maximumDataSize); localClusterUtil = new LocalClusterUtil(); try { localClusterUtil.init(vxqConfig); restIpAddress = localClusterUtil.getIpAddress(); restPort = localClusterUtil.getRestPort(); } catch (Exception e) { System.err.println("Unable to start local hyracks cluster due to: " + e.getMessage()); e.printStackTrace(); return; } } else { restIpAddress = opts.restIpAddress; restPort = opts.restPort; } System.out.println("Running queries given in: " + Arrays.toString(xqFiles.toArray())); runQueries(xqFiles); if (localClusterUtil != null) { try { localClusterUtil.deinit(); } catch (Exception e) { System.err.println("Error occurred when stopping local hyracks: " + e.getMessage()); } } }
Source:
<code>private static IncrementalIndex makeIncrementalIndex( Bucket theBucket, AggregatorFactory[] aggs, HadoopDruidIndexerConfig config, Iterable<String> oldDimOrder ) { final HadoopTuningConfig tuningConfig = config.getSchema().getTuningConfig(); final IncrementalIndexSchema indexSchema = new IncrementalIndexSchema.Builder() .withMinTimestamp(theBucket.time.getMillis()) .withDimensionsSpec(config.getSchema().getDataSchema().getParser()) .withQueryGranularity(config.getSchema().getDataSchema().getGranularitySpec().getQueryGranularity()) .withMetrics(aggs) .build(); OnheapIncrementalIndex newIndex = new OnheapIncrementalIndex( indexSchema, tuningConfig.getRowFlushBoundary() ); if(oldDimOrder != null) { <START> if (!indexSchema.getDimensionsSpec().hasCustomDimensions()) { <END> newIndex.loadDimensionIterable(oldDimOrder); } } return newIndex; }</code><technical_language>1 if statement</technical_language>

Target:
private static IncrementalIndex makeIncrementalIndex( Bucket theBucket, AggregatorFactory[] aggs, HadoopDruidIndexerConfig config, Iterable<String> oldDimOrder ) { final HadoopTuningConfig tuningConfig = config.getSchema().getTuningConfig(); final IncrementalIndexSchema indexSchema = new IncrementalIndexSchema.Builder() .withMinTimestamp(theBucket.time.getMillis()) .withDimensionsSpec(config.getSchema().getDataSchema().getParser()) .withQueryGranularity(config.getSchema().getDataSchema().getGranularitySpec().getQueryGranularity()) .withMetrics(aggs) .build(); OnheapIncrementalIndex newIndex = new OnheapIncrementalIndex( indexSchema, tuningConfig.getRowFlushBoundary() ); if (oldDimOrder != null && !indexSchema.getDimensionsSpec().hasCustomDimensions()) { newIndex.loadDimensionIterable(oldDimOrder); } return newIndex; }
Source:
<code>void dragBegin(long widget, long context) { if (!OS.isX11() && this.control instanceof Text) { DNDEvent event = new DNDEvent(); event.widget = this; event.doit = true; notifyListeners(DND.DragStart, event); if (!event.doit || transferAgents == null || transferAgents.length == 0) return; if (targetList == 0) return; Image image = event.image; if (context != 0 && image != null) { <START> if (OS.GTK3) { <END> OS.gtk_drag_set_icon_surface(context, image.surface); } else { long pixbuf = ImageList.createPixbuf(image); OS.gtk_drag_set_icon_pixbuf(context, pixbuf, 0, 0); OS.g_object_unref(pixbuf); } } } }</code><technical_language>is need for OS.GTK3 check is if (!OS.isX11) ensures gtk3 is used</technical_language>

Target:
void dragBegin(long widget, long context) { if (!OS.isX11() && this.control instanceof Text) { DNDEvent event = new DNDEvent(); event.widget = this; event.doit = true; notifyListeners(DND.DragStart, event); if (!event.doit || transferAgents == null || transferAgents.length == 0) return; if (targetList == 0) return; Image image = event.image; if (context != 0 && image != null) { OS.gtk_drag_set_icon_surface(context, image.surface); } } }
Source:
<code>void maybeNotifyForBlobCreation() { if (isOperationComplete()) { boolean composite = !getSuccessfullyPutChunkIdsIfComposite().isEmpty(); if (composite) { metadataPutChunk.notifyForFirstChunkCreation(); } if (blobId != null) { notificationSystem.onBlobCreated(getBlobIdString(), getBlobProperties(), <START> getBlobProperties().isEncrypted() ? null : getUserMetadata(), <END> composite ? NotificationBlobType.Composite : NotificationBlobType.Simple); } } }</code><technical_language>This sense me. of all, fix this send out user metadata ever? Secondly, send out boolean for blob is put encrypted not</technical_language>

Target:
void maybeNotifyForBlobCreation() { if (isOperationComplete()) { boolean composite = !getSuccessfullyPutChunkIdsIfComposite().isEmpty(); if (composite) { metadataPutChunk.maybeNotifyForFirstChunkCreation(); } if (blobId != null) { notificationSystem.onBlobCreated(getBlobIdString(), getBlobProperties(), composite ? NotificationBlobType.Composite : NotificationBlobType.Simple); } } }
Source:
<code>public static synchronized AlarmReloadManager getInstance() { if (instance == null) { instance = new AlarmReloadManager(); } <START> UI.getDefault().addStopWaitPropertyChangeListener(instance); <END> return instance; }</code><technical_language>I this done in constructor - least, in if-clause of this method. risk adding instance a listener multiple times for getInstance call</technical_language>

Target:
public static synchronized AlarmReloadManager getInstance() { if (instance == null) { instance = new AlarmReloadManager(); } return instance; }
Source:
<code>@Test public void observeCreatePersistable() { TestObserver<BundleBundle> testObserver = new TestObserver<>(); <START> RxNavi.observe(emitter, Event.CREATE_PERSISTABLE).subscribe(testObserver); <END> testObserver.assertNoValues(); Bundle bundle = new Bundle(); PersistableBundle persistableBundle = mock(PersistableBundle.class); emitter.onCreate(bundle, persistableBundle); testObserver.dispose(); emitter.onCreate(bundle, persistableBundle); testObserver.assertValue(BundleBundle.create(bundle, persistableBundle)); testObserver.assertNotTerminated(); }</code><technical_language>RxNavi.observe(emitter, Event.CREATE_PERSISTABLE).test() instead give a TestObserver</technical_language>

Target:
@Test public void observeCreatePersistable() { TestObserver<BundleBundle> testObserver = RxNavi.observe(emitter, Event.CREATE_PERSISTABLE).test(); testObserver.assertNoValues(); Bundle bundle = new Bundle(); PersistableBundle persistableBundle = mock(PersistableBundle.class); emitter.onCreate(bundle, persistableBundle); testObserver.dispose(); emitter.onCreate(bundle, persistableBundle); testObserver.assertValue(BundleBundle.create(bundle, persistableBundle)); testObserver.assertNotTerminated(); }
Source:
<code>public void send(ReqT request, long timeoutMs) throws IOException { if (mClosed || mCanceled || mClosedFromRemote) { throw new CancelledException( <START> formatErrorMessage("Failed to send request %s: stream is already closed or canceled.", <END> LogUtils.truncateMessageLines(request))); } try (LockResource lr = new LockResource(mLock)) { while (true) { checkError(); if (mRequestObserver.isReady()) { break; } try { if (!mReadyOrFailed.await(timeoutMs, TimeUnit.MILLISECONDS)) { throw new DeadlineExceededException( formatErrorMessage("Timeout sending request %s after %dms.", LogUtils.truncateMessageLines(request), timeoutMs)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new CancelledException( formatErrorMessage("Failed to send request %s: interrupted while waiting for server.", LogUtils.truncateMessageLines(request)), e); } } } mRequestObserver.onNext(request); }</code><technical_language>suggestion formatErrorMessage("Failed send request %s: stream is closed cancelled.", editing this line</technical_language>

Target:
public void send(ReqT request, long timeoutMs) throws IOException { if (mClosed || mCanceled || mClosedFromRemote) { throw new CancelledException( formatErrorMessage("Failed to send request %s: stream is already closed or cancelled.", LogUtils.truncateMessageLineLength(request))); } try (LockResource lr = new LockResource(mLock)) { while (true) { checkError(); if (mRequestObserver.isReady()) { break; } try { if (!mReadyOrFailed.await(timeoutMs, TimeUnit.MILLISECONDS)) { throw new DeadlineExceededException( formatErrorMessage("Timeout sending request %s after %dms.", LogUtils.truncateMessageLineLength(request), timeoutMs)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new CancelledException( formatErrorMessage("Failed to send request %s: interrupted while waiting for server.", LogUtils.truncateMessageLineLength(request)), e); } } } mRequestObserver.onNext(request); }
Source:
<code>public String apply(ProjectResource rsrc, Input input) throws AuthException, ResourceNotFoundException, BadRequestException, UnprocessableEntityException, IOException { if (!rsrc.getControl().isOwner()) { throw new AuthException("restricted to project owner"); } if (input == null || Strings.isNullOrEmpty(input.ref)) { throw new BadRequestException("ref required"); } String ref = input.ref; if (!ref.startsWith(Constants.R_REFS)) { ref = Constants.R_HEADS + ref; } Repository repo = null; try { repo = repoManager.openRepository(rsrc.getNameKey()); if (repo.getRef(ref) == null) { throw new UnprocessableEntityException(String.format( <START> "Ref Not Found: %s", input.ref)); <END> } if (!repo.getRef(Constants.HEAD).getTarget().getName().equals(ref)) { final RefUpdate u = repo.updateRef(Constants.HEAD, true); u.disableRefLog(); RefUpdate.Result res = u.link(ref); switch(res) { case NO_CHANGE: case RENAMED: case FORCED: break; default: throw new IOException("Setting HEAD failed with " + res); } } return ref; } catch (RepositoryNotFoundException e) { throw new ResourceNotFoundException(rsrc.getName()); } finally { if (repo != null) { repo.close(); } } }</code><technical_language>ref in error message in case mangled input in some strange way, user server balked on</technical_language>

Target:
public String apply(ProjectResource rsrc, Input input) throws AuthException, ResourceNotFoundException, BadRequestException, UnprocessableEntityException, IOException { if (!rsrc.getControl().isOwner()) { throw new AuthException("restricted to project owner"); } if (input == null || Strings.isNullOrEmpty(input.ref)) { throw new BadRequestException("ref required"); } String ref = input.ref; if (!ref.startsWith(Constants.R_REFS)) { ref = Constants.R_HEADS + ref; } Repository repo = null; try { repo = repoManager.openRepository(rsrc.getNameKey()); if (repo.getRef(ref) == null) { throw new UnprocessableEntityException(String.format( "Ref Not Found: %s", ref)); } if (!repo.getRef(Constants.HEAD).getTarget().getName().equals(ref)) { final RefUpdate u = repo.updateRef(Constants.HEAD, true); u.setRefLogIdent(identifiedUser.newRefLogIdent()); RefUpdate.Result res = u.link(ref); switch(res) { case NO_CHANGE: case RENAMED: case FORCED: case NEW: break; default: throw new IOException("Setting HEAD failed with " + res); } } return ref; } catch (RepositoryNotFoundException e) { throw new ResourceNotFoundException(rsrc.getName()); } finally { if (repo != null) { repo.close(); } } }
Source:
<code>public FContext addEphemeralProperties(Map<Object, Object> properties) { for (Map.Entry<Object, Object> pair : properties.entrySet()) { <START> ephemeralProperties.putAll(properties); <END> } return this; }</code><technical_language>Remove loop</technical_language>

Target:
public FContext addEphemeralProperties(Map<Object, Object> properties) { ephemeralProperties.putAll(properties); return this; }
Source:
<code>public void liftEmbargo(Context context, Item item) throws SQLException, AuthorizeException, IOException { <START> lifter.liftEmbargo(context, item); <END> itemService.clearMetadata(context, item, lift_schema, lift_element, lift_qualifier, Item.ANY); itemService.clearMetadata(context, item, MetadataSchema.DC_SCHEMA, "date", "available", Item.ANY); itemService.addMetadata(context, item, MetadataSchema.DC_SCHEMA, "date", "available", null, DCDate.getCurrent().toString()); log.info("Lifting embargo on Item "+item.getHandle()); itemService.update(context, item); }</code><technical_language>recommendation is embargo lifter remove lift date metadata. attempt modify access policies for bitstreams</technical_language>

Target:
public void liftEmbargo(Context context, Item item) throws SQLException, AuthorizeException, IOException { itemService.clearMetadata(context, item, lift_schema, lift_element, lift_qualifier, Item.ANY); itemService.clearMetadata(context, item, MetadataSchema.DC_SCHEMA, "date", "available", Item.ANY); itemService.addMetadata(context, item, MetadataSchema.DC_SCHEMA, "date", "available", null, DCDate.getCurrent().toString()); log.info("Lifting embargo on Item "+item.getHandle()); itemService.update(context, item); }
Source:
<code>public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { BigDecimal finalResult = BigDecimal.ZERO; for(int i=0;i<children.size();i++) { if (!children.get(i).evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } BigDecimal value; PDataType type = children.get(i).getDataType(); ColumnModifier columnModifier = children.get(i).getColumnModifier(); if(type == PDataType.TIMESTAMP) { Timestamp timestamp = (Timestamp)PDataType.TIMESTAMP.toObject(ptr, columnModifier); long millisPart = timestamp.getTime(); BigDecimal nanosPart = BigDecimal.valueOf((timestamp.getNanos() % QueryConstants.MILLIS_TO_NANOS_CONVERTOR)/QueryConstants.MILLIS_TO_NANOS_CONVERTOR); value = BigDecimal.valueOf(millisPart).add(nanosPart); } else if (type.isCoercibleTo(PDataType.DECIMAL)) { value = (((BigDecimal)PDataType.DECIMAL.toObject(ptr, columnModifier)).multiply(BD_MILLIS_IN_DAY)).setScale(6, RoundingMode.HALF_UP); } else if (type.isCoercibleTo(PDataType.DOUBLE)) { value = ((BigDecimal.valueOf(type.getCodec().decodeDouble(ptr, columnModifier))).multiply(BD_MILLIS_IN_DAY)).setScale(6, RoundingMode.HALF_UP); } else { value = BigDecimal.valueOf(type.getCodec().decodeLong(ptr, columnModifier)); } if (i == 0) { finalResult = value; } else { finalResult = finalResult.subtract(value); } } <START> Timestamp ts = DateUtil.getTimestamp(finalResult.longValue(), ((finalResult.remainder(BigDecimal.ONE).multiply(BigDecimal.valueOf(QueryConstants.MILLIS_TO_NANOS_CONVERTOR))).intValue())); <END> byte[] resultPtr = new byte[getDataType().getByteSize()]; PDataType.TIMESTAMP.toBytes(ts, resultPtr, 0); ptr.set(resultPtr); return true; }</code><technical_language>too, I a DateUtil BigDecimal -> Timestamp sense. want support PDataType.TIMESTAMP.toObject(finalResult, PDataType.DECIMAL) this symmetric Timestamp -> BigDecimal conversion support</technical_language>

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { BigDecimal finalResult = BigDecimal.ZERO; for(int i=0; i<children.size(); i++) { if (!children.get(i).evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } BigDecimal value; PDataType type = children.get(i).getDataType(); ColumnModifier columnModifier = children.get(i).getColumnModifier(); if(type == PDataType.TIMESTAMP) { value = (BigDecimal)(PDataType.DECIMAL.toObject(ptr, PDataType.TIMESTAMP, columnModifier)); } else if (type.isCoercibleTo(PDataType.DECIMAL)) { value = (((BigDecimal)PDataType.DECIMAL.toObject(ptr, columnModifier)).multiply(BD_MILLIS_IN_DAY)).setScale(6, RoundingMode.HALF_UP); } else if (type.isCoercibleTo(PDataType.DOUBLE)) { value = ((BigDecimal.valueOf(type.getCodec().decodeDouble(ptr, columnModifier))).multiply(BD_MILLIS_IN_DAY)).setScale(6, RoundingMode.HALF_UP); } else { value = BigDecimal.valueOf(type.getCodec().decodeLong(ptr, columnModifier)); } if (i == 0) { finalResult = value; } else { finalResult = finalResult.subtract(value); } } Timestamp ts = DateUtil.getTimestamp(finalResult); byte[] resultPtr = new byte[getDataType().getByteSize()]; PDataType.TIMESTAMP.toBytes(ts, resultPtr, 0); ptr.set(resultPtr); return true; }
Source:
<code>private static void handleExecStartConnectionReset(RuntimeException exception) { <START> Throwable rootCause = Throwables.getRootCause(exception.getCause()); <END> if (rootCause instanceof IOException && rootCause.getMessage().equals("Connection reset by peer")) { log.warn("Failed to read the output of exec start", exception); } else { throw exception; } }</code><technical_language>curious, getRootCause(exception.getCause()) instead of getRootCause(exception)</technical_language>

Target:
private static void handleExecStartConnectionReset(RuntimeException exception) { Throwable rootCause = Throwables.getRootCause(exception); if (rootCause instanceof IOException && "Connection reset by peer".equals(rootCause.getMessage())) { log.warn("Failed to read the output of exec start", exception); } else { throw exception; } }
Source:
<code>private AccountInfo adaptAccountInfo(CommitInfo commitInfo, IProgressMonitor monitor) throws GerritException { String accountId = commitInfo.getAuthor().getEmail(); for (int retries = 0;; retries++) { try { return retrieveAccountInfo(accountId, monitor); } catch (GerritException e) { if (retries < 3) { accountId = commitInfo.getAuthor().getName(); continue; <START> } <END> } } }</code><technical_language>else throw e</technical_language>

Target:
private AccountInfo adaptAccountInfo(CommitInfo commitInfo, IProgressMonitor monitor) throws GerritException { String accountId = commitInfo.getAuthor().getEmail(); for (int retries = 0;; retries++) { try { return retrieveAccountInfo(accountId, monitor); } catch (GerritException e) { if (retries < 3) { accountId = commitInfo.getAuthor().getName(); continue; } else { throw e; } } } }
Source:
<code><START> public boolean isCompatibleWith(DockerImageName other) { <END> final boolean thisRegistrySame = other.registry.equals(this.registry); final boolean thisRepoSame = other.repo.equals(this.repo); final boolean thisVersioningNotSpecifiedOrSame = other.versioning == null || other.versioning.equals(Versioning.TagVersioning.LATEST) || other.versioning.equals(this.versioning); if (thisRegistrySame && thisRepoSame && thisVersioningNotSpecifiedOrSame) { return true; } if (this.compatibleSubstituteFor == null) { return false; } return this.compatibleSubstituteFor.isCompatibleWith(other); }</code><technical_language>WDYT adding if (equals(other)) return true</technical_language>

Target:
public boolean isCompatibleWith(DockerImageName other) { if (other.equals(this)) { return true; } if (this.compatibleSubstituteFor == null) { return false; } return this.compatibleSubstituteFor.isCompatibleWith(other); }
Source:
<code>private void displayParents(final List<PatchSetInfo.ParentInfo> parents) { if (parents.size() == 0) { infoTable.setWidget(R_PARENTS, 1, new InlineLabel(Util.C.initialCommit())); return; } final Grid parentsTable = new Grid(parents.size(), 2); parentsTable.setStyleName(Gerrit.RESOURCES.css().parentsTable()); parentsTable.addStyleName(Gerrit.RESOURCES.css().noborder()); final CellFormatter ptfmt = parentsTable.getCellFormatter(); int row = 0; for (PatchSetInfo.ParentInfo parent : parents) { parentsTable.setWidget(row, 0, new InlineLabel(parent.id.get())); ptfmt.addStyleName(row, 0, Gerrit.RESOURCES.css().noborder()); ptfmt.addStyleName(row, 0, Gerrit.RESOURCES.css().monospace()); String parentMsg = parent.shortMessage; if (parentMsg.length() > 80) { <START> parentMsg = parentMsg.substring(0, 80) + "..."; <END> } parentsTable.setWidget(row, 1, new InlineLabel(parentMsg)); ptfmt.addStyleName(row, 1, Gerrit.RESOURCES.css().noborder()); row++; } infoTable.setWidget(R_PARENTS, 1, parentsTable); }</code><technical_language>[optional] this print 83 characters length > 80. If length == 81 print more characters actual length of string (same for length of 82). If string is 83 chars long end "..." place for 3 letters. sense limit total length of displayed commit subject 80 chars (or 83 if more) do like: if (parentMsg.length() > MAX_LEN) { parentMsg = parentMsg.substring(0, MAX_LEN - 3) + "..."; }</technical_language>

Target:
private void displayParents(final List<PatchSetInfo.ParentInfo> parents) { if (parents.size() == 0) { infoTable.setWidget(R_PARENTS, 1, new InlineLabel(Util.C.initialCommit())); return; } final Grid parentsTable = new Grid(parents.size(), 2); parentsTable.setStyleName(Gerrit.RESOURCES.css().parentsTable()); parentsTable.addStyleName(Gerrit.RESOURCES.css().noborder()); final CellFormatter ptfmt = parentsTable.getCellFormatter(); int row = 0; for (PatchSetInfo.ParentInfo parent : parents) { parentsTable.setWidget(row, 0, new InlineLabel(parent.id.get())); ptfmt.addStyleName(row, 0, Gerrit.RESOURCES.css().noborder()); ptfmt.addStyleName(row, 0, Gerrit.RESOURCES.css().monospace()); String parentMsg = parent.shortMessage; if (parentMsg.length() > 80) { parentMsg = parentMsg.substring(0, 77) + "..."; } parentsTable.setWidget(row, 1, new InlineLabel(parentMsg)); ptfmt.addStyleName(row, 1, Gerrit.RESOURCES.css().noborder()); row++; } infoTable.setWidget(R_PARENTS, 1, parentsTable); }
Source:
<code>private void validate() { <START> if (shortIndex.equals(longIndex)) { <END> throw new IllegalArgumentException("Interpolation requires two different indices"); } }</code><technical_language>check short index is shorter long index</technical_language>

Target:
private void validate() { if (!shortIndex.getCurrency().equals(longIndex.getCurrency())) { throw new IllegalArgumentException("Interpolation requires two indices in the same currency"); } if (shortIndex.equals(longIndex)) { throw new IllegalArgumentException("Interpolation requires two different indices"); } if (fixingDate.plus(shortIndex.getTenor()).isAfter(fixingDate.plus(longIndex.getTenor()))) { throw new IllegalArgumentException( Messages.format("Interpolation indices passed in wrong order: {}", shortIndex, longIndex)); } }
Source:
<code>private void includeSingleTag(PostDiscoveryFilter filter) { assertTrue(filter.apply(classWithTag1).included()); assertTrue(filter.apply(classWithTag1AndSurroundingWhitespace).included()); assertTrue(filter.apply(classWithBothTags).included()); <START> assertThat(filter.apply(classWithTag1).getReason().get()).contains( "Test included Because it contains tags: [tag1]"); <END> assertThat(filter.apply(classWithTag1AndSurroundingWhitespace).getReason().get()).contains( "Test included Because it contains tags: [tag1]"); assertThat(filter.apply(classWithBothTags).getReason().get()).contains( "Test included Because it contains tags: [tag1,tag2]"); assertTrue(filter.apply(classWithTag2).excluded()); assertTrue(filter.apply(classWithDifferentTags).excluded()); assertTrue(filter.apply(classWithNoTags).excluded()); assertThat(filter.apply(classWithTag2).getReason().get()).contains( "Test excluded Because it contains tags: [tag2]"); assertThat(filter.apply(classWithDifferentTags).getReason().get()).contains( "Test excluded Because it contains tags: [foo,bar]"); assertThat(filter.apply(classWithNoTags).getReason().get()).contains( "Test excluded Because it contains tags: []"); }</code><technical_language>do assertThat(optional).isPresent().contains(...) instead of calling get()</technical_language>

Target:
private void includeSingleTag(PostDiscoveryFilter filter) { assertTrue(filter.apply(classWithTag1).included()); assertTrue(filter.apply(classWithTag1AndSurroundingWhitespace).included()); assertTrue(filter.apply(classWithBothTags).included()); assertReason(filter.apply(classWithTag1), "included because tags match expression(s): [tag1]"); assertReason(filter.apply(classWithTag1AndSurroundingWhitespace), "included because tags match expression(s): [tag1]"); assertReason(filter.apply(classWithBothTags), "included because tags match expression(s): [tag1]"); assertTrue(filter.apply(classWithTag2).excluded()); assertTrue(filter.apply(classWithDifferentTags).excluded()); assertTrue(filter.apply(classWithNoTags).excluded()); assertReason(filter.apply(classWithTag2), "excluded because tags do not match tag expression(s): [tag1]"); assertReason(filter.apply(classWithDifferentTags), "excluded because tags do not match tag expression(s): [tag1]"); assertReason(filter.apply(classWithNoTags), "excluded because tags do not match tag expression(s): [tag1]"); }
Source:
<code>public void changeDiscoveryMode(){ <START> validationProvider = new QualifierValidationProviderCDI11(); <END> prepareBeanXml("all", true); }</code><technical_language>Wrong JSR number in validation provider</technical_language>

Target:
public void changeDiscoveryMode(){ validationProvider = new QualifierValidationProvider("JSR-365"); prepareBeanXml("all", true); }
Source:
<code><START> public void testRemoveProject() throws ProjectManagerException { <END> System.out.println("projectManagerTest: testRemoveProject"); ProjectManager manager = createProjectManager(); String projectName = "myTestRemoveProject"; String projectDescription = "This is to test removing a project"; User user = new User("testUser"); Project project = createProjectUtil(manager, projectName, projectDescription, user); manager.removeProject(project, user); Project fetchedProject = manager.getProject(project.getId()); Assert.assertFalse(fetchedProject.isActive()); System.out.println("Removed project successfully"); }</code><technical_language>method is simple public synchronized Project removeProject(Project project, User deleter) throws ProjectManagerException { projectLoader.removeProject(project, deleter.getUserId()); projectLoader.postEvent(project, EventType.DELETED, deleter.getUserId(), null); return project; } mockito verify internal calls a test? This cover for example user parameter is passed correctly</technical_language>

Target:
public void testRemoveProject() throws Exception { System.out.println("TestRemoveProject"); Project project = manager.createProject(PROJECT_NAME, PROJECT_DESCRIPTION, user); manager.removeProject(project, user); verify(loader).removeProject(project, user.getUserId()); verify(loader).postEvent(project, ProjectLogEvent.EventType.DELETED, user.getUserId(), null); Project fetchedProject = manager.getProject(project.getId()); verify(loader).fetchProjectById(project.getId()); verify(loader).fetchAllProjectFlows(project); Assert.assertFalse(fetchedProject.isActive()); }
Source:
<code>public void testRequestorUid() { final NetworkCapabilities nc = new NetworkCapabilities(); assertEquals(Process.INVALID_UID, new NetworkRequest.Builder() .setCapabilities(nc).build().getRequestorUid()); nc.setRequestorUid(1314); final NetworkRequest nr = new NetworkRequest.Builder().setCapabilities(nc).build(); <START> assertNotEquals(2628, <END> nr.getRequestorUid()); assertEquals(1314, nr.getRequestorUid()); }</code><technical_language>equals(1314) is enough for 1314 != 2628 :)</technical_language>

Target:
public void testRequestorUid() { final NetworkCapabilities nc = new NetworkCapabilities(); assertEquals(Process.INVALID_UID, new NetworkRequest.Builder() .setCapabilities(nc).build().getRequestorUid()); nc.setRequestorUid(1314); final NetworkRequest nr = new NetworkRequest.Builder().setCapabilities(nc).build(); assertEquals(1314, nr.getRequestorUid()); assertEquals(Process.INVALID_UID, new NetworkRequest.Builder() .clearCapabilities().build().getRequestorUid()); }
Source:
<code>@Test void testSignFunc() { tester.setFor( SqlStdOperatorTable.SIGN); tester.checkType("sign(1)", "INTEGER NOT NULL"); tester.checkType("sign(cast(1 as float))", "FLOAT NOT NULL"); tester.checkType( "sign(case when false then 1 else null end)", "INTEGER"); strictTester.checkFails( "^sign('abc')^", "Cannot apply 'SIGN' to arguments of type 'SIGN\\(<CHAR\\(3\\)>\\)'\\. Supported form\\(s\\): 'SIGN\\(<NUMERIC>\\)'", false); tester.checkType("sign('abc')", "DECIMAL(19, 0) NOT NULL"); <START> tester.checkScalar( <END> "sign(1)", 1, "INTEGER NOT NULL"); tester.checkScalar( "sign(cast(-1 as decimal(1, 0)))", BigDecimal.valueOf(-1), "DECIMAL(1, 0) NOT NULL"); tester.checkScalar( "sign(cast(0 as float))", 0d, "FLOAT NOT NULL"); tester.checkNull("sign(cast(null as integer))"); tester.checkNull("sign(cast(null as double))"); tester.checkType("sign(cast(.1 as decimal))", "DECIMAL(19, 0) NOT NULL"); }</code><technical_language>return -1, 1 0, return type INTEGER</technical_language>

Target:
@Test void testSignFunc() { tester.setFor( SqlStdOperatorTable.SIGN); tester.checkType("sign(1)", "INTEGER NOT NULL"); tester.checkType("sign(cast(1 as float))", "FLOAT NOT NULL"); tester.checkType( "sign(case when false then 1 else null end)", "INTEGER"); strictTester.checkFails( "^sign('abc')^", "Cannot apply 'SIGN' to arguments of type 'SIGN\\(<CHAR\\(3\\)>\\)'\\. Supported form\\(s\\): 'SIGN\\(<NUMERIC>\\)'", false); tester.checkType("sign('abc')", "DECIMAL(19, 0) NOT NULL"); tester.checkScalar( "sign(1)", 1, "INTEGER NOT NULL"); tester.checkScalar( "sign(cast(-1 as decimal(1, 0)))", BigDecimal.valueOf(-1), "DECIMAL(1, 0) NOT NULL"); tester.checkScalar( "sign(cast(0 as float))", 0d, "FLOAT NOT NULL"); tester.checkNull("sign(cast(null as integer))"); tester.checkNull("sign(cast(null as double))"); tester.checkType("sign(cast(0.1 as float))", "FLOAT NOT NULL"); tester.checkType("sign(cast(.1 as decimal))", "DECIMAL(19, 0) NOT NULL"); tester.checkScalar( "sign(0.1)", 1, "DECIMAL(2, 0) NOT NULL"); tester.checkScalar( "sign(cast(-0.1 as decimal(2, 0)))", BigDecimal.valueOf(-1), "DECIMAL(2, 0) NOT NULL"); tester.checkScalar( "sign(cast(-.1 as decimal(1, 0)))", BigDecimal.valueOf(-1), "DECIMAL(1, 0) NOT NULL"); tester.checkScalar( "sign(cast(0.1 as float))", 1d, "FLOAT NOT NULL"); }
Source:
<code>public MessageKey(long sequenceId, long producerTimestamp, int producerPid) { this.sequenceId = sequenceId; this.producerId = producerId(producerTimestamp, producerPid); <START> this.routingHash = this.hashCode(); <END> }</code><technical_language>I this class subclassed, if were, this call problematic</technical_language>

Target:
public MessageKey(long sequenceId, long producerTimestamp, int producerPid) { this.sequenceId = sequenceId; this.producerTimestamp = producerTimestamp; this.producerId = producerId(producerTimestamp, producerPid); this.routingHash = this.hashCode(); }
Source:
<code>public void testIgniteSsl() throws Exception { <START> System.setProperty("zookeeper.clientCnxnSocket", "org.apache.zookeeper.ClientCnxnSocketNetty"); <END> IgniteEx ignite = startGrids(2); assertEquals(2, ignite.cluster().topologyVersion()); }</code><technical_language>rule @WithSystemProperty instead</technical_language>

Target:
public void testIgniteSsl() throws Exception { IgniteEx ignite = startGrids(2); assertEquals(2, ignite.cluster().topologyVersion()); }
Source:
<code>public void onScrollChanged(int oldScrollY, int scrollY, boolean isHumanScroll) { if (getVisibility() == View.GONE) { return; } int contentHeight = (int)(webView.getContentHeight() * DimenUtil.getDensityScalar()); int bottomOffset = contentHeight - scrollY - webView.getHeight(); int bottomHeight = getHeight(); if (bottomOffset > bottomHeight) { setTranslationY(bottomHeight); if (getVisibility() != View.INVISIBLE) { setVisibility(View.INVISIBLE); } } else { setTranslationY(bottomOffset); this.postDelayed(() -> { if (getVisibility() != View.VISIBLE) { setVisibility(View.VISIBLE); } }, <START> HALF_SEC_DELAY); <END> if (!firstTimeShown && readMoreItems != null) { firstTimeShown = true; funnel.logSuggestionsShown(page.getTitle(), readMoreItems.getResults()); } } }</code><technical_language>half-second delay is noticeable. scrolling quickly bottom of article, bottom content takes a half-second appear, experience longer seamless. fixing this issue is turning out more difficult meets eye, easily shelve this task a date</technical_language>

Target:
public void onScrollChanged(int oldScrollY, int scrollY, boolean isHumanScroll) { if (getVisibility() == View.GONE) { return; } int contentHeight = (int)(webView.getContentHeight() * DimenUtil.getDensityScalar()); int bottomOffset = contentHeight - scrollY - webView.getHeight(); int bottomHeight = getHeight(); if (bottomOffset > bottomHeight) { setTranslationY(bottomHeight); if (getVisibility() != View.INVISIBLE) { setVisibility(View.INVISIBLE); } } else { setTranslationY(bottomOffset); this.postDelayed(() -> { if (getVisibility() != View.VISIBLE) { setVisibility(View.VISIBLE); } }, QUARTER_SEC_DELAY); if (!firstTimeShown && readMoreItems != null) { firstTimeShown = true; funnel.logSuggestionsShown(page.getTitle(), readMoreItems.getResults()); } } }
Source:
<code>public String newProject() { <START> this.myProjekt = new Project(); <END> this.myProjekt.setClient(serviceManager.getUserService().getSessionClientOfAuthenticatedUser()); return projectEditPath; }</code><technical_language>please translate</technical_language>

Target:
public String newProject() { this.project = new Project(); this.project.setClient(serviceManager.getUserService().getSessionClientOfAuthenticatedUser()); return projectEditPath; }
Source:
<code>private static Geometry createBufferedCircleFromPoint( Measure<Double, Length> distance, CoordinateReferenceSystem origCRS, Geometry point) { Geometry pointGeo = point; MathTransform toTransform, fromTransform = null; Unit<Length> unit = distance.getUnit(); if (!(origCRS instanceof ProjectedCRS)) { double x = point.getCoordinate().x; double y = point.getCoordinate().y; String crsCode = "AUTO:42001," + x + "," + y; CoordinateReferenceSystem utmCrs; try { utmCrs = CRS.decode(crsCode); toTransform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, utmCrs); fromTransform = CRS.findMathTransform(utmCrs, DefaultGeographicCRS.WGS84); pointGeo = JTS.transform(point, toTransform); return JTS.transform(pointGeo.buffer(distance.doubleValue(SI.METER)), fromTransform); } catch (MismatchedDimensionException | TransformException | FactoryException e) { <START> LOGGER.debug("Unable to transform original CRS to UTM.", e); <END> } } else { unit = (Unit<Length>) origCRS.getCoordinateSystem().getAxis(0).getUnit(); } return pointGeo.buffer(distance.doubleValue(unit)); }</code><technical_language>add more context this logging statement stating failed create buffered circle a point</technical_language>

Target:
private static Geometry createBufferedCircleFromPoint( Measure<Double, Length> distance, CoordinateReferenceSystem origCRS, Geometry point) { Geometry pointGeo = point; Unit<Length> unit = distance.getUnit(); if (!(origCRS instanceof ProjectedCRS)) { double x = point.getCoordinate().x; double y = point.getCoordinate().y; String crsCode = "AUTO:42001," + x + "," + y; try { CoordinateReferenceSystem utmCrs = CRS.decode(crsCode); MathTransform toTransform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, utmCrs); MathTransform fromTransform = CRS.findMathTransform(utmCrs, DefaultGeographicCRS.WGS84); pointGeo = JTS.transform(point, toTransform); return JTS.transform(pointGeo.buffer(distance.doubleValue(SI.METER)), fromTransform); } catch (MismatchedDimensionException | TransformException | FactoryException e) { LOGGER.debug("Unable to create buffered circle from point.", e); } } else { unit = (Unit<Length>) origCRS.getCoordinateSystem().getAxis(0).getUnit(); } return pointGeo.buffer(distance.doubleValue(unit)); }
Source:
<code>public void onStatusUpdate(QpidStatus oldStatus, QpidStatus newStatus) { if (newStatus.equals(oldStatus)) { log.debug("Status has not changed."); return; } <START> log.debug("EventSource was notified of a QpidStatus change: {}", newStatus); <END> for (EventReceiver receiver : this.eventReceivers) { if (!receiver.requiresQpid()) { continue; } if (QpidStatus.FLOW_STOPPED.equals(newStatus) || QpidStatus.DOWN.equals(newStatus)) { log.debug("Stopping session for EventReciever."); receiver.stopSession(); } else if (QpidStatus.CONNECTED.equals(newStatus)) { log.debug("Starting session for EventReciever."); receiver.startSession(); } } }</code><technical_language>move this logic main status update dispatcher generate "onStatusUpdate" trigger status change? consider optimizing this a bit drop "oldStatus" method signature, listener retain previous status if needed a thing</technical_language>

Target:
public void onStatusUpdate(QpidStatus oldStatus, QpidStatus newStatus) { if (newStatus.equals(oldStatus)) { log.debug("Status has not changed."); return; } log.debug("EventSource was notified of a QpidStatus change: {}", newStatus); for (MessageReceiver receiver : this.messageReceivers) { if (!receiver.requiresQpid()) { continue; } if (QpidStatus.FLOW_STOPPED.equals(newStatus) || QpidStatus.DOWN.equals(newStatus)) { log.debug("Stopping session for EventReciever."); receiver.stopSession(); } else if (QpidStatus.CONNECTED.equals(newStatus)) { log.debug("Starting session for EventReciever."); receiver.startSession(); } } }
Source:
<code>protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { if (getServletConfig() != null) { request.setAttribute(APPLICATION_TYPE, getServletConfig().getServletContext().getInitParameter(APPLICATION_TYPE)); <START> } <END> request.setAttribute(LOCALE_KEYS, LocaleFilter.getLocaleKeys()); String oVirtVersion = backend.RunPublicQuery(VdcQueryType.GetConfigurationValue, new GetConfigurationValueParameters(ConfigurationValues.ProductRPMVersion, ConfigCommon.defaultConfigurationVersion)).getReturnValue(); request.setAttribute(VERSION, oVirtVersion != null ? oVirtVersion : "myVersion"); request.setAttribute(SECTIONS, brandingManager .getWelcomeSections((Locale) request.getAttribute(LocaleFilter.LOCALE))); RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/ovirt-engine.jsp"); response.setContentType("text/html;charset=UTF-8"); if (dispatcher != null) { dispatcher.include(request, response); } }</code><technical_language>strange, fails? is <jsp-file> using</technical_language>

Target:
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { request.setAttribute(LOCALE_KEYS, LocaleFilter.getLocaleKeys()); String oVirtVersion = backend.RunPublicQuery(VdcQueryType.GetConfigurationValue, new GetConfigurationValueParameters(ConfigurationValues.ProductRPMVersion, ConfigCommon.defaultConfigurationVersion)).getReturnValue(); request.setAttribute(VERSION, oVirtVersion != null ? oVirtVersion : "myVersion"); request.setAttribute(SECTIONS, brandingManager .getWelcomeSections((Locale) request.getAttribute(LocaleFilter.LOCALE))); RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/ovirt-engine.jsp"); response.setContentType("text/html;charset=UTF-8"); if (dispatcher != null) { dispatcher.include(request, response); } }
Source:
<code>public void shouldArrayWithStreamReturnNotNull() { <START> assertThat(array(charSeq('1', '2', '3').toJavaList().stream())).isNotNull(); <END> }</code><technical_language>testing Java's stream</technical_language>

Target:
public void shouldArrayWithStreamReturnNotNull() { assertThat(Array(Stream.of('1', '2', '3'))).isNotNull(); }
Source:
<code>private void initiateCenterCreation(CenterPayload centerPayload) { if (isCenterNameValid()) { mCreateNewCenterPresenter.createCenter(centerPayload); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); alertDialogBuilder <START> .setMessage("Would you like to create another center?") <END> .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { et_centerName.setText(""); cb_centerActiveStatus.setChecked(false); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { getFragmentManager().popBackStack(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } }</code><technical_language>Please hardcoded strings</technical_language>

Target:
private void initiateCenterCreation(CenterPayload centerPayload) { if (isCenterNameValid()) { mCreateNewCenterPresenter.createCenter(centerPayload); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity(), R.style.MaterialAlertDialogStyle); alertDialogBuilder .setMessage(getString(R.string.create_center_dialog)) .setPositiveButton(getString(R.string.action_yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { etCenterName.setText(""); cbCenterActiveStatus.setChecked(false); } }) .setNegativeButton(getString(R.string.action_no), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { getFragmentManager().popBackStack(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } }
Source:
<code>public static boolean isStaleStore( File storeDir, String offsetFileName, long storeDeleteRetentionInMs, long currentTimeMs) { boolean isStaleStore = false; String storePath = storeDir.toPath().toString(); if (storeDir.exists()) { File offsetFileRef = new File(storeDir, offsetFileName); long offsetFileLastModifiedTime = offsetFileRef.lastModified(); if ((currentTimeMs - offsetFileLastModifiedTime) >= storeDeleteRetentionInMs) { LOG.info( String.format("Store: %s is stale since lastModifiedTime of offset file: %d, is older than store deleteRetentionMs: %d.", storePath, offsetFileLastModifiedTime, storeDeleteRetentionInMs)); isStaleStore = true; } } else { LOG.info("Storage partition directory: does not exist.", storePath); <START> LOG.info("{}", storePath, storePath); <END> } return isStaleStore; }</code><technical_language>this removed</technical_language>

Target:
public static boolean isStaleStore( File storeDir, String offsetFileName, long storeDeleteRetentionInMs, long currentTimeMs) { boolean isStaleStore = false; String storePath = storeDir.toPath().toString(); if (storeDir.exists()) { File offsetFileRef = new File(storeDir, offsetFileName); long offsetFileLastModifiedTime = offsetFileRef.lastModified(); if ((currentTimeMs - offsetFileLastModifiedTime) >= storeDeleteRetentionInMs) { LOG.info( String.format("Store: %s is stale since lastModifiedTime of offset file: %d, is older than store deleteRetentionMs: %d.", storePath, offsetFileLastModifiedTime, storeDeleteRetentionInMs)); isStaleStore = true; } } else { LOG.info("Storage partition directory: does not exist.", storePath); } return isStaleStore; }
Source:
<code>public void close() { if (restClient != null) { try { <START> LOGGER.info("Closing Rest Client"); <END> restClient.close(); } catch (IOException e) { LOGGER.error("Could not close ElasticSearch Rest Client", e); } restClient = null; } }</code><technical_language>remove call "Close Elasticsearch Connection"</technical_language>

Target:
public void close() { if (restClient != null) { try { LOGGER.info("Closing ElasticSearch connection"); restClient.close(); } catch (IOException e) { LOGGER.error("Could not close ElasticSearch connection", e); } restClient = null; } }
Source:
<code>public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { if (obj instanceof Number) { Number num = (Number) obj; double value = num.doubleValue() * fFactor; <START> if (Double.isInfinite(value) || Double.isNaN(value)) { <END> return toAppendTo.append(FORMAT.format(value)); } double abs = Math.abs(value); if (abs >= 1) { if (abs >= PETA) { return toAppendTo.append(FORMAT.format(value / PETA)).append(' ').append(PETA_PREFIX); } if (abs >= TERA) { return toAppendTo.append(FORMAT.format(value / TERA)).append(' ').append(TERA_PREFIX); } if (abs >= GIGA) { return toAppendTo.append(FORMAT.format(value / GIGA)).append(' ').append(GIGA_PREFIX); } if (abs >= MEGA) { return toAppendTo.append(FORMAT.format(value / MEGA)).append(' ').append(MEGA_PREFIX); } if (abs >= KILO) { return toAppendTo.append(FORMAT.format(value / KILO)).append(' ').append(KILO_PREFIX); } return toAppendTo.append(FORMAT.format(value)); } if (abs < PICO) { return toAppendTo.append(FORMAT.format(value)); } if (abs < NANO) { return toAppendTo.append(FORMAT.format(value * TERA)).append(' ').append(PICO_PREFIX); } if (abs < MICRO) { return toAppendTo.append(FORMAT.format(value * GIGA)).append(' ').append(NANO_PREFIX); } if (abs < MILLI) { return toAppendTo.append(FORMAT.format(value * MEGA)).append(' ').append(MICRO_PREFIX); } return toAppendTo.append(FORMAT.format(value * KILO)).append(' ').append(MILLI_PREFIX); } throw new IllegalArgumentException("Cannot format given Object as a Number: " + obj); }</code><technical_language>I add == 0 here</technical_language>

Target:
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { if (obj instanceof Number) { Number num = (Number) obj; double value = num.doubleValue() * fFactor; double abs = Math.abs(value); if (Double.isInfinite(value) || Double.isNaN(value) || abs < PICO) { return toAppendTo.append(FORMAT.format(value)); } if (abs >= 1) { if (abs >= PETA) { return toAppendTo.append(FORMAT.format(value / PETA)).append(' ').append(PETA_PREFIX); } if (abs >= TERA) { return toAppendTo.append(FORMAT.format(value / TERA)).append(' ').append(TERA_PREFIX); } if (abs >= GIGA) { return toAppendTo.append(FORMAT.format(value / GIGA)).append(' ').append(GIGA_PREFIX); } if (abs >= MEGA) { return toAppendTo.append(FORMAT.format(value / MEGA)).append(' ').append(MEGA_PREFIX); } if (abs >= KILO) { return toAppendTo.append(FORMAT.format(value / KILO)).append(' ').append(KILO_PREFIX); } return toAppendTo.append(FORMAT.format(value)); } if (abs < NANO) { return toAppendTo.append(FORMAT.format(value * TERA)).append(' ').append(PICO_PREFIX); } if (abs < MICRO) { return toAppendTo.append(FORMAT.format(value * GIGA)).append(' ').append(NANO_PREFIX); } if (abs < MILLI) { return toAppendTo.append(FORMAT.format(value * MEGA)).append(' ').append(MICRO_PREFIX); } return toAppendTo.append(FORMAT.format(value * KILO)).append(' ').append(MILLI_PREFIX); } throw new IllegalArgumentException("Cannot format given Object as a Number: " + obj); }