auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Retryer<HttpResponse> getHttpRequestRetryer() { Predicate<HttpResponse> predicate = new Predicate<HttpResponse>() { public boolean apply(HttpResponse resposne) { if (resposne.statusCode() >= 500) { return true; } else { return false; } } }; return RetryerBuilder.<HttpResponse>newBuilder() .retryIfExceptionOfType(IOException.class) .retryIfRuntimeException() .withWaitStrategy(WaitStrategies.exponentialWait(100, SLEEP_DURATION, TimeUnit.MILLISECONDS)) <START> .withStopStrategy(StopStrategies.neverStop()) <END> .retryIfResult(predicate) .build(); }</code><technical_language>this infinite loop? want retry some sane amount of times</technical_language>

Target:
public static Retryer<HttpResponse> getHttpRequestRetryer() { Predicate<HttpResponse> responseCodeIsEqualOrHigherThan500 = new Predicate<HttpResponse>() { public boolean apply(HttpResponse response) { return response.statusCode() >= 500; } }; return RetryerBuilder.<HttpResponse>newBuilder() .retryIfExceptionOfType(IOException.class) .retryIfRuntimeException() .withWaitStrategy(WaitStrategies.exponentialWait(100, SLEEP_DURATION.toMillis(), TimeUnit.MILLISECONDS)) .withStopStrategy(StopStrategies.neverStop()) .retryIfResult(responseCodeIsEqualOrHigherThan500) .build(); }
Source:
<code>public void handleClose(CloseEvent event, List<DashboardPanel> panels) { String id = event.getComponent().getId(); for (DashboardPanel panel : panels) { <START> if (panel.getType().replace(" ", "_").toLowerCase(Locale.ENGLISH).equals(id)) { <END> panel.close(); break; } } }</code><technical_language>id.equalIgnoreCase check instead of other around? This option is more flexible hard code English locale</technical_language>

Target:
public void handleClose(CloseEvent event, List<DashboardPanel> panels) { String id = event.getComponent().getId(); for (DashboardPanel panel : panels) { if (id.equalsIgnoreCase(panel.getType().replace(" ", "_"))) { panel.close(); break; } } }
Source:
<code>public void testGetElapsedAfterStop() { final org.slf4j.Logger logger = createSlf4jLoggerMock(); final AtomicBoolean isOpen = new AtomicBoolean(true); @SuppressWarnings("resource") final TsdTimer timer = new TsdTimer("timerName", isOpen, logger); Mockito.verify(logger, Mockito.never()).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); timer.getValue(); Mockito.verify(logger).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); <START> Mockito.verify(logger, Mockito.times(1)).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); <END> }</code><technical_language>[nit] This a restatement (or slightly stronger version of) previous line</technical_language>

Target:
public void testGetElapsedAfterStop() { final org.slf4j.Logger logger = createSlf4jLoggerMock(); final AtomicBoolean isOpen = new AtomicBoolean(true); @SuppressWarnings("resource") final TsdTimer timer = new TsdTimer("timerName", isOpen, logger); Mockito.verify(logger, Mockito.never()).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); timer.getValue(); Mockito.verify(logger).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); }
Source:
<code>public boolean isApplicable(Class<? extends Item> itemClass) { <START> if (itemClass.isAssignableFrom(MavenModule.class) || itemClass.isAssignableFrom(MavenModuleSet.class)) { <END> return true; } else { return false; } }</code><technical_language>return itemClass.isAssignableFrom(MavenModule.class) || itemClass.isAssignableFrom(MavenModuleSet.class)</technical_language>

Target:
public boolean isApplicable(Class<? extends Item> itemClass) { return itemClass.isAssignableFrom(MavenModule.class) || itemClass.isAssignableFrom(MavenModuleSet.class); }
Source:
<code>public void testSingleColumnValueFilterNotEqualEmptyString() throws IOException { byte[] rowKey1 = dataHelper.randomData("scvfrk1"); byte[] rowKey2 = dataHelper.randomData("scvfrk2"); byte[] qualifier1 = dataHelper.randomData("scvfq1"); byte[] value1_1 = dataHelper.randomData("val1.1"); byte[] value1_2 = "".getBytes(); Table table = getDefaultTable(); Put put = new Put(rowKey1); put.addColumn(COLUMN_FAMILY, qualifier1, value1_1); table.put(put); put = new Put(rowKey2); put.addColumn(COLUMN_FAMILY, qualifier1, value1_2); table.put(put); Result[] results; Scan scan = new Scan(); scan.addColumn(COLUMN_FAMILY, qualifier1); <START> scanAddVersion(scan,3); <END> ByteArrayComparable valueComparable1 = new BinaryComparator(value1_2); SingleColumnValueFilter filter = new SingleColumnValueFilter(COLUMN_FAMILY, qualifier1, CompareOp.NOT_EQUAL, valueComparable1); filter.setFilterIfMissing(false); filter.setLatestVersionOnly(true); scan.setFilter(filter); results = table.getScanner(scan).next(10); Assert.assertEquals(1, results.length); Assert.assertEquals(1,results[0].listCells().size()); }</code><technical_language>Please add a space ,</technical_language>

Target:
public void testSingleColumnValueFilterNotEqualEmptyString() throws IOException { byte[] rowKey1 = dataHelper.randomData("scvfrk1"); byte[] rowKey2 = dataHelper.randomData("scvfrk2"); byte[] qualifier1 = dataHelper.randomData("scvfq1"); byte[] qualifier2 = dataHelper.randomData("scvfq2"); byte[] nonEmptyStringValue = dataHelper.randomData("val1.1"); byte[] emptyStringValue = "".getBytes(); Table table = getDefaultTable(); Put put = new Put(rowKey1); put.addColumn(COLUMN_FAMILY, qualifier1, nonEmptyStringValue); put.addColumn(COLUMN_FAMILY, qualifier2, nonEmptyStringValue); table.put(put); put = new Put(rowKey2); put.addColumn(COLUMN_FAMILY, qualifier1, nonEmptyStringValue); put.addColumn(COLUMN_FAMILY, qualifier2, emptyStringValue); table.put(put); Result[] results; Scan scan = new Scan(); scan.addColumn(COLUMN_FAMILY, qualifier1); scan.setRowPrefixFilter(Bytes.toBytes("scvfrk")); scanAddVersion(scan, 3); ByteArrayComparable emptyStringValueComparable = new BinaryComparator(emptyStringValue); SingleColumnValueFilter filter = new SingleColumnValueFilter(COLUMN_FAMILY, qualifier2, CompareOp.NOT_EQUAL, emptyStringValueComparable); scan.setFilter(filter); results = table.getScanner(scan).next(10); Assert.assertEquals(1, results.length); Assert.assertArrayEquals(rowKey1, results[0].getRow()); }
Source:
<code>public void checkAutocompleteFeature() { editor.selectTabByName(GO_FILE_NAME); editor.goToPosition(21, 58); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.typeTextIntoEditor("fmt."); editor.launchAutocompleteAndWaitContainer(); editor.checkProposalDocumentation("No documentation found."); <START> editor.waitTextIntoAutocompleteContainer("Print"); <END> editor.waitTextIntoAutocompleteContainer("Println"); editor.waitTextIntoAutocompleteContainer("Printf"); editor.deleteCurrentLine(); editor.waitAllMarkersInvisibility(ERROR); }</code><technical_language>works this method for of multiple arguments: CodenvyEditor#waitTextIntoAutocompleteContainer(String ... expectedText); helps reach more compact syntax: editor.waitTextIntoAutocompleteContainer("Print", "Println", "Printf"); do this</technical_language>

Target:
public void checkAutocompleteFeature() { editor.selectTabByName(GO_FILE_NAME); editor.goToPosition(21, 58); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.typeTextIntoEditor("fmt."); editor.launchAutocompleteAndWaitContainer(); editor.checkProposalDocumentation("No documentation found."); editor.waitProposalsIntoAutocompleteContainer(expectedProposals); editor.deleteCurrentLine(); editor.waitAllMarkersInvisibility(ERROR); }
Source:
<code>private void addIntegerStatistics(long valueCount, IntegerStatistics value) { requireNonNull(value, "value is null"); requireNonNull(value.getMin(), "value.getMin() is null"); requireNonNull(value.getMax(), "value.getMax() is null"); nonNullValueCount += valueCount; minimum = Math.min(value.getMin(), minimum); maximum = Math.max(value.getMax(), maximum); <START> if (value.getSum() != null) { <END> try { sum = addExact(sum, value.getSum()); } catch (ArithmeticException e) { overflow = true; } } }</code><technical_language>I execute this try if overflow is set. this code is currently written, concerned repeated throws in a tight loop</technical_language>

Target:
private void addIntegerStatistics(long valueCount, IntegerStatistics value) { requireNonNull(value, "value is null"); requireNonNull(value.getMin(), "value.getMin() is null"); requireNonNull(value.getMax(), "value.getMax() is null"); nonNullValueCount += valueCount; minimum = Math.min(value.getMin(), minimum); maximum = Math.max(value.getMax(), maximum); if (value.getSum() == null) { overflow = true; } else if (!overflow) { try { sum = addExact(sum, value.getSum()); } catch (ArithmeticException e) { overflow = true; } } }
Source:
<code>public void testCaptureObject() { com.alliander.osgp.domain.core.valueobjects.smartmetering.CaptureObject captureObjectVo = this .makeCaptureObjectVo(); CaptureObject captureObject = this.monitoringMapper.map(captureObjectVo, CaptureObject.class); <START> Assert.assertTrue(captureObject != null); <END> }</code><technical_language>assertNotNull</technical_language>

Target:
public void testCaptureObject() { com.alliander.osgp.domain.core.valueobjects.smartmetering.CaptureObject captureObjectVo = this .makeCaptureObjectVo(); CaptureObject captureObject = this.monitoringMapper.map(captureObjectVo, CaptureObject.class); assertNotNull("mapping ProfileGenericDataResponse should not return null", captureObject); }
Source:
<code><START> public void createRule() { <END> final HttpMockRule rule = this.stubbing.createRule(); assertThat(rule, is(notNullValue())); }</code><technical_language>I content of HttpMockRule tested well, existence</technical_language>

Target:
public void createRule() { this.stubbing.thenRespond(); final HttpMockRule rule = this.stubbing.createRule(); assertThat(rule, is(notNullValue())); }
Source:
<code>public boolean isUserBooked(final String eventId, final Long userId) throws SegueDatabaseException { try { final EventBooking bookingByEventAndUser = dao.findBookingByEventAndUser(eventId, userId); List<BookingStatus> bookedStatuses = Arrays.asList( <START> BookingStatus.CONFIRMED, BookingStatus.ATTENDED, BookingStatus.ABSENT, BookingStatus.RESERVED); <END> return bookingByEventAndUser != null && bookedStatuses.contains(bookingByEventAndUser.getBookingStatus()); } catch (ResourceNotFoundException e) { return false; } }</code><technical_language>careful meaning of this method. meant a user a confirmed booking. defining reserved confirmed now</technical_language>

Target:
public boolean isUserBooked(final String eventId, final Long userId) throws SegueDatabaseException { try { final EventBooking bookingByEventAndUser = dao.findBookingByEventAndUser(eventId, userId); List<BookingStatus> bookedStatuses = Arrays.asList( BookingStatus.CONFIRMED, BookingStatus.ATTENDED, BookingStatus.ABSENT); return bookingByEventAndUser != null && bookedStatuses.contains(bookingByEventAndUser.getBookingStatus()); } catch (ResourceNotFoundException e) { return false; } }
Source:
<code>public void install() { OsDetails osDetails = getMachine().getMachineDetails().getOsDetails(); if (osDetails.isLinux()) { String apt = BashCommands.chainGroup( <START> "which apt-get", <END> "export DEBIAN_FRONTEND=noninteractive", BashCommands.sudo("wget -O/etc/apt/sources.list.d/couchbase.list <LINK_0>"), "wget -O- <LINK_1> | sudo apt-key add - ", BashCommands.sudo("apt-get update"), BashCommands.sudo("apt-get install -y libcouchbase2-libevent libcouchbase-dev libcouchbase2-bin") ); String yum = BashCommands.chainGroup( "which yum", BashCommands.sudo("wget -O/etc/yum.repos.d/couchbase.repo <LINK_2>"), BashCommands.ok(BashCommands.sudo("yum check-update")), BashCommands.sudo("yum install -y libcouchbase2-libevent libcouchbase-devel libcouchbase2-bin") ); List<String> commands = ImmutableList.<String>builder() .add(BashCommands.INSTALL_WGET) .add(BashCommands.alternatives(apt, yum)) .build(); newScript(INSTALLING) .body.append(commands).execute(); } }</code><technical_language>BashCommands.ifExecutableElse0("apt-get", BashCommands.chainGroup(...))</technical_language>

Target:
public void install() { OsDetails osDetails = getMachine().getMachineDetails().getOsDetails(); if (osDetails.isLinux()) { String aptSetup = BashCommands.ifExecutableElse0("apt-get", BashCommands.chainGroup( BashCommands.sudo("wget -O/etc/apt/sources.list.d/couchbase.list <LINK_0>"), "wget -O- <LINK_1> | sudo apt-key add - " )); String yumSetup = BashCommands.ifExecutableElse0("yum", BashCommands.sudo("wget -O/etc/yum.repos.d/couchbase.repo <LINK_2>") ); String installPackage = BashCommands.installPackage(ImmutableMap.of( "apt-get", "libcouchbase2-libevent libcouchbase-dev libcouchbase2-bin", "yum", "libcouchbase2-libevent libcouchbase-devel libcouchbase2-bin" ), null); List<String> commands = ImmutableList.<String>builder() .add(BashCommands.INSTALL_WGET) .add(BashCommands.alternatives(aptSetup, yumSetup, installPackage)) .build(); newScript(INSTALLING) .body.append(commands).execute(); } }
Source:
<code>public DataSegment push(File dataSegmentFile, DataSegment segment) throws IOException { final String storageDir = DataSegmentPusherUtil.getStorageDir(segment); final File baseStorageDir = config.getStorageDirectory(); File outDir = new File(baseStorageDir, storageDir); log.info("Copying segment[%s] to local filesystem at location[%s]", segment.getIdentifier(), outDir.toString()); if (dataSegmentFile.equals(outDir)) { long size = 0; for (File file : dataSegmentFile.listFiles()) { size += file.length(); } return createDescriptorFile( segment.withLoadSpec(makeLoadSpec(outDir)) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(dataSegmentFile)), outDir ); } File tmpOutDir = new File(baseStorageDir, storageDir + "." + UUID.randomUUID().toString()); long size = compressSegment(dataSegmentFile, tmpOutDir); DataSegment dataSegment = createDescriptorFile( segment.withLoadSpec(makeLoadSpec(new File(outDir, "index.zip"))) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(dataSegmentFile)), tmpOutDir ); try { java.nio.file.Files.move(tmpOutDir.toPath(), outDir.toPath()); } catch (FileAlreadyExistsException e) { log.warn("Push destination directory[%s] exists, ignore this message if replication is configured."); <START> dataSegment = jsonMapper.readValue(new File(outDir, "descriptor.json"), DataSegment.class); <END> FileUtils.deleteDirectory(tmpOutDir); } return dataSegment; }</code><technical_language>this throw IOException if I recall correctly, handled properly deleteDirectory is cleaned regardless</technical_language>

Target:
public DataSegment push(File dataSegmentFile, DataSegment segment) throws IOException { final String storageDir = DataSegmentPusherUtil.getStorageDir(segment); final File baseStorageDir = config.getStorageDirectory(); final File outDir = new File(baseStorageDir, storageDir); log.info("Copying segment[%s] to local filesystem at location[%s]", segment.getIdentifier(), outDir.toString()); if (dataSegmentFile.equals(outDir)) { long size = 0; for (File file : dataSegmentFile.listFiles()) { size += file.length(); } return createDescriptorFile( segment.withLoadSpec(makeLoadSpec(outDir)) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(dataSegmentFile)), outDir ); } final File tmpOutDir = new File(baseStorageDir, intermediateDirFor(storageDir)); log.info("Creating intermediate directory[%s] for segment[%s]", tmpOutDir.toString(), segment.getIdentifier()); final long size = compressSegment(dataSegmentFile, tmpOutDir); final DataSegment dataSegment = createDescriptorFile( segment.withLoadSpec(makeLoadSpec(new File(outDir, "index.zip"))) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(dataSegmentFile)), tmpOutDir ); createDirectoryIfNotExists(outDir.getParentFile()); try { java.nio.file.Files.move(tmpOutDir.toPath(), outDir.toPath()); } catch (FileAlreadyExistsException e) { log.warn("Push destination directory[%s] exists, ignore this message if replication is configured.", outDir); FileUtils.deleteDirectory(tmpOutDir); return jsonMapper.readValue(new File(outDir, "descriptor.json"), DataSegment.class); } return dataSegment; }
Source:
<code>public void reloadServer() throws Exception { try (ManagementClient managementClient = getManagementClient()) { block(managementClient); long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); managementClient.executeForResult(Operations.createOperation(RELOAD, new ModelNode().setEmptyList())); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { controller.getClient().isServerInRunningState(); } catch (RuntimeException ex) { break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); Thread.sleep(2 * FREQUENCY); <START> Assert.assertTrue(managementClient.isServerInRunningState()); <END> } }</code><technical_language>This fragile. odd if this > 1 second. I valid loop for a long time (say 20 secs) intermittently testing for reload completion. RuntimeException L103 tells reload progressed, AIUI relevant this test long takes complete</technical_language>

Target:
public void reloadServer() throws Exception { try (ManagementClient managementClient = getManagementClient()) { block(managementClient); long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); managementClient.executeForResult(Operations.createOperation(RELOAD, new ModelNode().setEmptyList())); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { managementClient.isServerInRunningState(); } catch (RuntimeException ex) { break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); timeout = RESTART_WAITING_TIME + System.currentTimeMillis(); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { managementClient.isServerInRunningState(); } catch (RuntimeException ex) { break; } } } }
Source:
<code>public String getClientInfo(String name) throws SQLException { <START> return this.properties.getProperty(name); <END> }</code><technical_language>is ok return null if property exists throw exception? pls check spec</technical_language>

Target:
public String getClientInfo(String name) throws SQLException { checkClosed(); return properties.getProperty(name); }
Source:
<code>private void bindLowMemoryKiller(String name, Class<? extends LowMemoryKiller> clazz) { install(installModuleIf( MemoryManagerConfig.class, config -> name.equals(config.getLowMemoryKillerPolicy()), <START> moduleBinder -> moduleBinder.bind(LowMemoryKiller.class).to(clazz).in(Scopes.SINGLETON))); <END> }</code><technical_language>Nit: name this variable binder</technical_language>

Target:
private void bindLowMemoryKiller(String name, Class<? extends LowMemoryKiller> clazz) { install(installModuleIf( MemoryManagerConfig.class, config -> name.equals(config.getLowMemoryKillerPolicy()), binder -> binder.bind(LowMemoryKiller.class).to(clazz).in(Scopes.SINGLETON))); }
Source:
<code>protected void finalize() { try { threadGroup.destroy(); } catch (RuntimeException e) { <START> log.warn(e, "Leaked thread group"); <END> } }</code><technical_language>Add thread group name</technical_language>

Target:
protected void finalize() { try { threadGroup.destroy(); } catch (RuntimeException e) { log.warn(e, "Leaked thread group '%s'", threadGroup.getName()); } }
Source:
<code>public ElideConfigParser(String localFilePath) { if (DynamicConfigHelpers.isNullOrEmpty(localFilePath)) { throw new IllegalArgumentException("Config path is null"); } try { String basePath = DynamicConfigHelpers.formatFilePath(localFilePath); this.variables = DynamicConfigHelpers.getVaribalesPojo(basePath); this.elideTableConfig = DynamicConfigHelpers.getElideTablePojo(basePath); this.elideSecurityConfig = DynamicConfigHelpers.getElideSecurityPojo(basePath); } catch (JsonProcessingException e) { log.error("Error while parsing dynamic config at location " + localFilePath); <START> log.error(e.getMessage()); <END> } }</code><technical_language>If config format is busted, I if throw IllegalStateException here</technical_language>

Target:
public ElideConfigParser(String localFilePath) { if (DynamicConfigHelpers.isNullOrEmpty(localFilePath)) { throw new IllegalArgumentException("Config path is null"); } try { String basePath = DynamicConfigHelpers.formatFilePath(localFilePath); this.variables = DynamicConfigHelpers.getVariablesPojo(basePath); this.elideTableConfig = DynamicConfigHelpers.getElideTablePojo(basePath, this.variables); this.elideSecurityConfig = DynamicConfigHelpers.getElideSecurityPojo(basePath, this.variables); } catch (IOException e) { log.error("Error while parsing dynamic config at location " + localFilePath); log.error(e.getMessage()); throw new IllegalStateException(e); } }
Source:
<code>private static Exception classifyException(Exception e) { <START> if (e instanceof TApplicationException) { <END> return new PrestoException(THRIFT_SERVICE_GENERIC_REMOTE_ERROR, "Exception raised by a remote thrift server", e); } return e; }</code><technical_language>need rebase add TRuntime Exception</technical_language>

Target:
private static Exception classifyException(Exception e) { if (e instanceof TApplicationException || e instanceof RuntimeTApplicationException) { return new PrestoException(THRIFT_SERVICE_GENERIC_REMOTE_ERROR, "Exception raised by a remote thrift server", e); } return e; }
Source:
<code>@Test public void testHintsPropagateWithDifferentKindOfRels() { final String sql = "select \n" + "ename, avg(sal)\n" + "from emp group by ename"; final RelNode rel = tester.convertSqlToRel(sql).rel; final RelHint hint = RelHint.of( Collections.emptyList(), "AGG_STRATEGY", Collections.singletonList("TWO_PHASE")); HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateReduceFunctionsRule.INSTANCE) <START> .build(); <END> HepPlanner planner = new HepPlanner(program); planner.setRoot(rel); RelNode newRel = planner.findBestExp(); new ValidateHintVisitor(hint, Aggregate.class).go(newRel); }</code><technical_language>write a mock rule (similar MockJoin) simulate Project + Aggregate split want test? I a hard time understand AggregateReduceFunctionsRule trigger expects tested. Another benefit is this test stable if changes AggregateReduceFunctionsRule</technical_language>

Target:
@Test public void testHintsPropagateWithDifferentKindOfRels() { final String sql = "select \n" + "ename, avg(sal)\n" + "from emp group by ename"; final RelNode rel = tester.convertSqlToRel(sql).rel; final RelHint hint = RelHint.of( Collections.singletonList(0), "AGG_STRATEGY", Collections.singletonList("TWO_PHASE")); HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateReduceFunctionsRule.INSTANCE) .build(); HepPlanner planner = new HepPlanner(program); planner.setRoot(rel); RelNode newRel = planner.findBestExp(); new ValidateHintVisitor(hint, Aggregate.class).go(newRel); }
Source:
<code>public List<ParagraphInfo> getParagraphList(String user, String noteId) throws TException, ServiceException { try { AuthenticationInfo authInfo = new AuthenticationInfo(); authInfo.setUser(user); Set<String> userAndRoles = new HashSet<>(); userAndRoles.add(user); ServiceContext serviceContext = new ServiceContext(authInfo, userAndRoles); <START> Note note = getNotebookService().getNote(noteId, serviceContext, <END> new SimpleServiceCallback<Note>() { @Override public void onSuccess(Note note, ServiceContext context) throws IOException { }; @Override public void onFailure(Exception e, ServiceContext context) throws IOException { LOG.error(e.getMessage(), e); String message = e.getMessage(); if (e instanceof NoteNotFoundException) { message = "Not found this note : " + noteId; } else if (e instanceof ForbiddenException) { message = "No READER permission access to this note : " + noteId; } throw new IOException(message); }; }); if (null != note) { List<ParagraphInfo> paragraphInfos = new ArrayList(); List<Paragraph> paragraphs = note.getParagraphs(); for (Iterator<Paragraph> iter = paragraphs.iterator(); iter.hasNext();) { Paragraph paragraph = iter.next(); ParagraphInfo paraInfo = new ParagraphInfo(); paraInfo.setNoteId(noteId); paraInfo.setParagraphId(paragraph.getId()); paraInfo.setParagraphTitle(paragraph.getTitle()); paraInfo.setParagraphText(paragraph.getText()); paragraphInfos.add(paraInfo); } return paragraphInfos; } else { String msg = "User " + user + " does not have READER permission to the note: " + noteId; throw new ServiceException(msg); } } catch (IOException e) { LOG.error(e.getMessage(), e); throw new ServiceException(e.getMessage()); } }</code><technical_language>NotebookService is for external call (such websocket rest api). websocket & rest api needs callback. call notebook() get Note check permission</technical_language>

Target:
public List<ParagraphInfo> getParagraphList(String user, String noteId) throws TException, ServiceException { Notebook notebook = getNotebook(); Note note = notebook.getNote(noteId); if (null == note) { throw new ServiceException("Not found this note : " + noteId); } Set<String> userAndRoles = new HashSet<>(); userAndRoles.add(user); NotebookAuthorization notebookAuthorization = notebook.getNotebookAuthorization(); boolean isAllowed = notebookAuthorization.isReader(noteId, userAndRoles); Set<String> allowed = notebookAuthorization.getReaders(noteId); if (false == isAllowed) { String errorMsg = "Insufficient privileges to READER note. " + "Allowed users or roles: " + allowed; throw new ServiceException(errorMsg); } List<ParagraphInfo> paragraphInfos = new ArrayList(); List<Paragraph> paragraphs = note.getParagraphs(); for (Iterator<Paragraph> iter = paragraphs.iterator(); iter.hasNext();) { Paragraph paragraph = iter.next(); ParagraphInfo paraInfo = new ParagraphInfo(); paraInfo.setNoteId(noteId); paraInfo.setParagraphId(paragraph.getId()); paraInfo.setParagraphTitle(paragraph.getTitle()); paraInfo.setParagraphText(paragraph.getText()); paragraphInfos.add(paraInfo); } return paragraphInfos; }
Source:
<code>public void initialize() { <START> data = mlrParser.parse(); <END> final List<Long> dataKeys; try { dataKeys = idFactory.getIds(data.size()); } catch (final IdGenerationException e) { throw new RuntimeException("Fail to generate data keys", e); } memoryStore.putList(dataKeys, data); classPartitionIndices = new ArrayList<>(numClasses * numPartitionsPerClass); for (int classIndex = 0; classIndex < numClasses; ++classIndex) { for (int partitionIndex = 0; partitionIndex < numPartitionsPerClass; ++partitionIndex) { classPartitionIndices.add(classIndex * numPartitionsPerClass + partitionIndex); } } LOG.log(Level.INFO, "Step size = {0}", stepSize); LOG.log(Level.INFO, "Number of batches per iteration = {0}", numBatchPerIter); LOG.log(Level.INFO, "Total number of samples = {0}", data.size()); if (data.size() < trainErrorDatasetSize) { LOG.log(Level.WARNING, "Number of samples is less than trainErrorDatasetSize = {0}", trainErrorDatasetSize); } synchronizer.globalBarrier(); }</code><technical_language>data accessed MemoryStore, need data a class variable; Instead, change local variable, data loaded MemoryStore (the values of workloadMap in L253)</technical_language>

Target:
public void initialize() { final List<Pair<Vector, Integer>> dataValues = mlrParser.parse(); final List<Long> dataKeys; try { dataKeys = idFactory.getIds(dataValues.size()); } catch (final IdGenerationException e) { throw new RuntimeException("Fail to generate data keys", e); } memoryStore.putList(dataKeys, dataValues); classPartitionIndices = new ArrayList<>(numClasses * numPartitionsPerClass); for (int classIndex = 0; classIndex < numClasses; ++classIndex) { for (int partitionIndex = 0; partitionIndex < numPartitionsPerClass; ++partitionIndex) { classPartitionIndices.add(classIndex * numPartitionsPerClass + partitionIndex); } } LOG.log(Level.INFO, "Step size = {0}", stepSize); LOG.log(Level.INFO, "Number of batches per iteration = {0}", numBatchPerIter); LOG.log(Level.INFO, "Total number of samples = {0}", dataValues.size()); if (dataValues.size() < trainErrorDatasetSize) { LOG.log(Level.WARNING, "Number of samples is less than trainErrorDatasetSize = {0}", trainErrorDatasetSize); } synchronizer.globalBarrier(); }
Source:
<code>private void checkFollowingUserStatus() { new CheckFollowingUserTask(this, user.getLogin()) { @Override protected void onSuccess(Boolean following) throws Exception { super.onSuccess(following); isFollowing = following; ViewUtils.setGone(loadingBar, true); setGone(false); } @Override <START> protected void onException(Exception e) throws RuntimeException { <END> super.onException(e); ToastUtils.show(UserViewActivity.this, string.error_checking_following_status); ViewUtils.setGone(loadingBar, true); } }.execute(); }</code><technical_language>follow menu item disabled in this case running follow unfollow</technical_language>

Target:
private void checkFollowingUserStatus() { followingStatusChecked = false; new CheckFollowingUserTask(this, user.getLogin()) { @Override protected void onSuccess(Boolean following) throws Exception { super.onSuccess(following); isFollowing = following; followingStatusChecked = true; ViewUtils.setGone(loadingBar, true); setGone(false); } @Override protected void onException(Exception e) throws RuntimeException { super.onException(e); ToastUtils.show(UserViewActivity.this, string.error_checking_following_status); ViewUtils.setGone(loadingBar, true); } }.execute(); }
Source:
<code>public ParquetReader restoreReader( Configuration config, Path filePath, long splitOffset, long splitLength, CheckpointedPosition checkpointedPosition) throws IOException { ParquetReader reader = createReader(config, filePath, splitOffset, splitLength); <START> reader.seek(checkpointedPosition.getOffset() + checkpointedPosition.getRecordsAfterOffset()); <END> return reader; }</code><technical_language>1 represent NO_OFFSET, a problem here</technical_language>

Target:
public ParquetReader restoreReader( Configuration config, Path filePath, long splitOffset, long splitLength, CheckpointedPosition checkpointedPosition) throws IOException { Preconditions.checkArgument( checkpointedPosition.getOffset() == CheckpointedPosition.NO_OFFSET, "The offset of CheckpointedPosition should always be NO_OFFSET"); ParquetReader reader = createReader(config, filePath, splitOffset, splitLength); reader.seek(checkpointedPosition.getRecordsAfterOffset()); return reader; }
Source:
<code>public void transform(NodeType node) { for(Object om : node.getMetadata()){ <START> MetadataType metadata = (MetadataType) om; <END> for(Object oc : metadata.getColumn()){ ColumnType column = (ColumnType) oc; if(column.getType().equals("id_Date")) { if("true".equals(ComponentUtilities.getNodePropertyValue(node, name))){ column.setPattern("\"yyyy-MM-dd HH:mm:ss\""); } else if ("false".equals(ComponentUtilities.getNodePropertyValue(node, name))) { column.setPattern("\"dd-MM-yyyy\""); } } } } }</code><technical_language>type safe. objects _MetadataType_</technical_language>

Target:
public void transform(NodeType node) { for(Object om : node.getMetadata()){ MetadataType metadata = (MetadataType) om; for(Object oc : metadata.getColumn()){ ColumnType column = (ColumnType) oc; if(column.getType().equals("id_Date")) { if("true".equals(ComponentUtilities.getNodePropertyValue(node, CHECK_BOX_NAME))){ column.setPattern("\"yyyy-MM-dd HH:mm:ss\""); } else if ("false".equals(ComponentUtilities.getNodePropertyValue(node, CHECK_BOX_NAME))) { column.setPattern("\"dd-MM-yyyy\""); } } } } }
Source:
<code>public List<PlanNode> getSources() { <START> return Collections.singletonList(source); <END> }</code><technical_language>static import</technical_language>

Target:
public List<PlanNode> getSources() { return singletonList(source); }
Source:
<code>private static void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) throws IOException { File folder = new File(srcFolder); <START> if (path.equals("")) { <END> zip.putNextEntry(new ZipEntry(folder.getName() + File.separator)); } else { zip.putNextEntry(new ZipEntry(path + File.separator + folder.getName() + File.separator)); } for (String fileName : folder.list()) { if (path.equals("")) { addFileToZip(folder.getName(), srcFolder + File.separator + fileName, zip); } else { addFileToZip(path + File.separator + folder.getName(), srcFolder + File.separator + fileName, zip); } } }</code><technical_language>simply isEmpty</technical_language>

Target:
private static void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) throws IOException { File folder = new File(srcFolder); if (path.isEmpty()) { zip.putNextEntry(new ZipEntry(folder.getName() + File.separator)); } else { zip.putNextEntry(new ZipEntry(path + File.separator + folder.getName() + File.separator)); } for (String fileName : folder.list()) { if (path.isEmpty()) { addFileToZip(folder.getName(), srcFolder + File.separator + fileName, zip); } else { addFileToZip(path + File.separator + folder.getName(), srcFolder + File.separator + fileName, zip); } } }
Source:
<code>private StorageDomain recoverStorageDomain(String sdUUID) { <START> log.info("about to recover SD {}", sdUUID); <END> StorageDomain storageDomain = new StorageDomain(); storageDomain.setId(sdUUID); updateStorageDomain(storageDomain); return storageDomain; }</code><technical_language>log.debug</technical_language>

Target:
private StorageDomain recoverStorageDomain(String sdUUID) { log.warn("about to recover SD {}", sdUUID); StorageDomain storageDomain = new StorageDomain(); storageDomain.setId(sdUUID); updateStorageDomain(storageDomain); return storageDomain; }
Source:
<code>public Secret setSecret(String name, String value) { <START> return client.setSecret(name, value, Context.NONE).block().value(); <END> }</code><technical_language>Call setSecretWithResponse(name, value, Context.NONE).value()</technical_language>

Target:
public Secret setSecret(String name, String value) { return client.setSecretWithResponse(name, value, Context.NONE).block().value(); }
Source:
<code><START> private static void populatePartitionGroups(Integer hostId, VoltTable vt) { <END> try { byte[] bytes = VoltDB.instance().getHostMessenger().getZK().getData(CoreZK.hosts_host + hostId, false, new Stat()); String hostInfo = new String(bytes, StandardCharsets.UTF_8); final JSONObject obj = new JSONObject(hostInfo); vt.addRow(hostId, "PLACEMENTGROUP",obj.getString("group")); Set<Integer> buddies = VoltDB.instance().getCartograhper().getHostIdsWithinPartitionGroup(hostId); vt.addRow(hostId, "PARTITIONGROUP",buddies.toString()); } catch (Exception e) { org.voltdb.VoltDB.crashLocalVoltDB("Error getting host info", false, e); } }</code><technical_language>HostMessenger a helper function getHostGroupsFromZK(), get there</technical_language>

Target:
private static void populatePartitionGroups(Integer hostId, VoltTable vt) { try { byte[] bytes = VoltDB.instance().getHostMessenger().getZK().getData(CoreZK.hosts_host + hostId, false, new Stat()); String hostInfo = new String(bytes, StandardCharsets.UTF_8); JSONObject obj = new JSONObject(hostInfo); vt.addRow(hostId, "PLACEMENTGROUP",obj.getString("group")); } catch (KeeperException | InterruptedException | JSONException e) { vt.addRow(hostId, "PLACEMENTGROUP","NULL"); } Set<Integer> buddies = VoltDB.instance().getCartograhper().getHostIdsWithinPartitionGroup(hostId); String[] strIds = buddies.stream().sorted().map(i -> String.valueOf(i)).toArray(String[]::new); vt.addRow(hostId, "PARTITIONGROUP",String.join(",", strIds)); }
Source:
<code>public void showMenuStep(Message<MenuItem> doneCallback, String textToShow, List<String> menuItems, String defaultValue) { <START> doneCallback.send(new MenuItem("", 0)); <END> }</code><technical_language>send null instead</technical_language>

Target:
public void showMenuStep(Message<MenuItem> doneCallback, String textToShow, List<String> menuItems, String defaultValue) { doneCallback.send(null); }
Source:
<code>public void validateVector(TestVector vector) { final byte[] key = CryptoUtil.decodeHex(vector.key); final byte[] salt = vector.salt.isEmpty() ? null : CryptoUtil.decodeHex(vector.salt); final byte[] info = vector.info.isEmpty() ? null : CryptoUtil.decodeHex(vector.info); final byte[] expected = CryptoUtil.decodeHex(vector.expected); final byte[] actual = CryptoUtil.hkdf(key, salt, info, expected.length); <START> Assert.assertEquals(actual, expected); <END> }</code><technical_language>Static import</technical_language>

Target:
public void validateVector(TestVector vector) { byte[] key = decodeHex(vector.key); byte[] salt = vector.salt.isEmpty() ? null : decodeHex(vector.salt); byte[] info = vector.info.isEmpty() ? null : decodeHex(vector.info); byte[] expected = decodeHex(vector.expected); byte[] actual = hkdf(key, salt, info, expected.length); Assert.assertEquals(actual, expected); }
Source:
<code>public String evaluateTemplateString(String template) throws TaskHandlerException { String conversionTemplate = template; for (KeyInformation key : parseAll(template)) { Object value = getValue(key); <START> <END> if (value != null) { String stringValue = value.toString(); stringValue = manipulateValue(key.getManipulations(), stringValue); conversionTemplate = conversionTemplate.replace( String.format("{{%s}}", key.getOriginalKey()), stringValue ); } else { conversionTemplate = (String) value; } } return conversionTemplate; }</code><technical_language>change "" null</technical_language>

Target:
public String evaluateTemplateString(String template) throws TaskHandlerException { String conversionTemplate = template; for (KeyInformation key : parseAll(template)) { Object value = getValue(key); if (value != null) { String stringValue = value.toString(); stringValue = manipulateValue(key.getManipulations(), stringValue); conversionTemplate = conversionTemplate.replace( String.format("{{%s}}", key.getOriginalKey()), stringValue ); } else { conversionTemplate = null; } } return conversionTemplate; }
Source:
<code>public void process(ClusterEvent event) throws Exception { WorkflowControllerDataProvider dataProvider = event.getAttribute(AttributeName.ControllerDataProvider.name()); <START> event.addAttribute(AttributeName.WORKFLOW_CONFIG_MAP.name(), dataProvider.getWorkflowConfigMap()); event.addAttribute(AttributeName.RESOURCE_CONTEXT_MAP.name(), dataProvider.getContexts()); <END> super.process(event); }</code><technical_language>this affect memory footprint of event? Also, is a soft copy here? I guess if soft copy is okay, overhead this more references</technical_language>

Target:
public void process(ClusterEvent event) throws Exception { HelixManager manager = event.getAttribute(AttributeName.helixmanager.name()); if (manager == null) { LOG.warn( "HelixManager is null for event {}({}) in cluster {}. Skip TaskGarbageCollectionStage.", event.getEventId(), event.getEventType(), event.getClusterName()); return; } Map<String, Set<String>> expiredJobsMap = new HashMap<>(); Set<String> workflowsToBePurged = new HashSet<>(); WorkflowControllerDataProvider dataProvider = event.getAttribute(AttributeName.ControllerDataProvider.name()); for (Map.Entry<String, ZNRecord> entry : dataProvider.getContexts().entrySet()) { WorkflowConfig workflowConfig = dataProvider.getWorkflowConfig(entry.getKey()); if (workflowConfig != null && (!workflowConfig.isTerminable() || workflowConfig .isJobQueue())) { WorkflowContext workflowContext = dataProvider.getWorkflowContext(entry.getKey()); long purgeInterval = workflowConfig.getJobPurgeInterval(); long currentTime = System.currentTimeMillis(); if (purgeInterval > 0 && workflowContext.getLastJobPurgeTime() + purgeInterval <= currentTime) { Set<String> expiredJobs = TaskUtil.getExpiredJobsFromCache(dataProvider, workflowConfig, workflowContext); if (!expiredJobs.isEmpty()) { expiredJobsMap.put(workflowConfig.getWorkflowId(), expiredJobs); } scheduleNextJobPurge(workflowConfig.getWorkflowId(), currentTime, purgeInterval, _rebalanceScheduler, manager); } } else if (workflowConfig == null && entry.getValue() != null && entry.getValue().getId() .equals(TaskUtil.WORKFLOW_CONTEXT_KW)) { workflowsToBePurged.add(entry.getKey()); } } event.addAttribute(AttributeName.TO_BE_PURGED_JOBS_MAP.name(), Collections.unmodifiableMap(expiredJobsMap)); event.addAttribute(AttributeName.TO_BE_PURGED_WORKFLOWS.name(), Collections.unmodifiableSet(workflowsToBePurged)); super.process(event); }
Source:
<code>public List<FilterDescriptor> getFiltersDescriptorsByRole(final User user) throws DotDataException { <START> if(APILocator.getUserAPI().isCMSAdmin(user)){ <END> return new ArrayList<>(this.loadedFilters.values()); } final List<Role> roles = APILocator.getRoleAPI().loadRolesForUser(user.getUserId(), true); Logger.info(this,"User Roles: " + roles.toString()); final List<FilterDescriptor> filters = new ArrayList<>(); for(final Map.Entry<String,FilterDescriptor> filterDescriptorMap : this.loadedFilters.entrySet()){ final String filterRoles = filterDescriptorMap.getValue().getRoles(); Logger.info(PublisherAPI.class,"File: " +filterDescriptorMap.getKey() + " Roles: " + filterRoles ); for(final Role role : roles){ if(UtilMethods.isSet(role.getRoleKey()) && filterRoles.contains(role.getRoleKey())){ filters.add(filterDescriptorMap.getValue()); } } } return filters; }</code><technical_language>replace this for user.isAdmin</technical_language>

Target:
public List<FilterDescriptor> getFiltersDescriptorsByRole(final User user) throws DotDataException { if(user.isAdmin()){ return new ArrayList<>(this.loadedFilters.values()); } final List<Role> roles = APILocator.getRoleAPI().loadRolesForUser(user.getUserId(), true); Logger.info(this,"User Roles: " + roles.toString()); final List<FilterDescriptor> filters = new ArrayList<>(); for(final Map.Entry<String,FilterDescriptor> filterDescriptorMap : this.loadedFilters.entrySet()){ final String filterRoles = filterDescriptorMap.getValue().getRoles(); Logger.info(PublisherAPI.class,"File: " +filterDescriptorMap.getKey() + " Roles: " + filterRoles ); for(final Role role : roles){ if(UtilMethods.isSet(role.getRoleKey()) && filterRoles.contains(role.getRoleKey())){ filters.add(filterDescriptorMap.getValue()); } } } return filters; }
Source:
<code>public View getView(int position, View view, ViewGroup parent){ if(view == null){ view = mInflater.inflate(R.layout.calendar_date, null); } TextView text = (TextView) view; Date date = getItem(position); <START> text.setText(String.valueOf(date.getDate())); <END> Date current = calendar.getTime(); if(date.equals(current)){ text.setTextColor(getResources().getColor(R.color.white)); text.setBackgroundColor(getResources().getColor(R.color.cc_attention_positive_color)); } else if(date.getMonth() != current.getMonth()){ text.setTextColor(getResources().getColor(R.color.grey_dark)); text.setBackgroundColor(getResources().getColor(R.color.grey_lighter)); } else{ text.setTextColor(getResources().getColor(R.color.black)); text.setBackgroundColor(getResources().getColor(R.color.transparent)); } return text; }</code><technical_language>getDate is deprecated. Is a non-deprecated method call result</technical_language>

Target:
public View getView(int position, View view, ViewGroup parent){ if(view == null){ view = mInflater.inflate(R.layout.calendar_date, null); } TextView text = (TextView) view; Date date = getItem(position); Calendar gridPopulator = (Calendar) calendar.clone(); gridPopulator.setTime(date); text.setText(String.valueOf(gridPopulator.get(Calendar.DAY_OF_MONTH))); Date current = calendar.getTime(); highlightCalendarGridCell(text, gridPopulator, calendar); return text; }
Source:
<code>public void run() throws Exception { for (int i = 0; i < (Integer)argModuleMap.get("iterations"); i++) { <START> log.info("Interation: {}", i); <END> action.execute(this); } }</code><technical_language>Typo is well, Iteration</technical_language>

Target:
public void run() throws Exception { for (int i = 0; i < (Integer)argModuleMap.get("iterations"); i++) { log.info("Iterations: {}", i); action.execute(this); } }
Source:
<code>private MoodManager(XMPPConnection connection) { super(connection); PEPManager.getInstanceFor(connection).addPEPListener(new PEPListener() { @Override public void eventReceived(final EntityBareJid from, final EventElement event, Message message) { <START> if (MOOD_NODE.equals(event.getEvent().getNode())) { <END> final BareJid contact = from.asBareJid(); Async.go(new Runnable() { @Override public void run() { ItemsExtension items = (ItemsExtension) event.getExtensions().get(0); PayloadItem<?> payload = (PayloadItem) items.getItems().get(0); MoodElement mood = (MoodElement) payload.getPayload(); for (MoodListener listener : moodListeners) { listener.onMoodUpdated(contact, mood); } } }, "MoodListener"); } } }); ServiceDiscoveryManager.getInstanceFor(connection).addFeature(MOOD_NOTIFY); }</code><technical_language>Try avoid level of indentation (!MOOD_NODE</technical_language>

Target:
private MoodManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager.getInstanceFor(connection).addFeature(MOOD_NOTIFY); PepManager.getInstanceFor(connection).addPepListener(new PepListener() { @Override public void eventReceived(final EntityBareJid from, final EventElement event, final Message message) { if (!MOOD_NODE.equals(event.getEvent().getNode())) { return; } final BareJid contact = from.asBareJid(); asyncButOrdered.performAsyncButOrdered(contact, new Runnable() { @Override public void run() { ItemsExtension items = (ItemsExtension) event.getExtensions().get(0); PayloadItem<?> payload = (PayloadItem) items.getItems().get(0); MoodElement mood = (MoodElement) payload.getPayload(); for (MoodListener listener : moodListeners) { listener.onMoodUpdated(contact, message, mood); } } }); } }); }
Source:
<code>public void pidFileDeletedOnExit() throws Exception { TestUtils.SwarmClientProcessWrapper node = TestUtils.runSwarmClient( "agentDeletePid", j, processDestroyer, temporaryFolder, "-pidFile", getPidFile().getAbsolutePath()); <START> Thread.sleep(1000); END> assertTrue("Pid file created", getPidFile().exists()); node.process.destroy(); node.process.waitFor(5, TimeUnit.SECONDS); assertFalse("Client should exit on kill", node.process.isAlive()); assertFalse("Pid file removed", getPidFile().exists()); }</code><technical_language>this more bulletproof, wait for file exist empty in a loop? If file created, test eventually time out I above</technical_language>

Target:
public void pidFileDeletedOnExit() throws Exception { Assume.assumeFalse( "TODO The PID file doesn't seem to be deleted on exit on Windows", Functions.isWindows()); File pidFile = getPidFile(); TestUtils.SwarmClientProcessWrapper node = TestUtils.runSwarmClient( "agentDeletePid", j, processDestroyer, temporaryFolder, "-pidFile", pidFile.getAbsolutePath()); while (!pidFile.exists()) { Thread.sleep(1000); } assertTrue("PID file created", pidFile.exists()); node.process.destroy(); node.process.waitFor(); assertFalse("Client should exit on kill", node.process.isAlive()); assertFalse("PID file removed", pidFile.exists()); }
Source:
<code>public void recordAdjustment(long adjustmentUnits) { if (adjustmentUnits > 0) { rateLimiter.steal(adjustmentUnits); } else { try { rateLimiter.returnPermits(LongMath.checkedMultiply(adjustmentUnits, -1), stopwatch.readNanos()); <START> } catch (ArithmeticException e) { <END> rateLimiter.returnPermits(Long.MAX_VALUE, stopwatch.readNanos()); } } }</code><technical_language>multiplying -1 issue</technical_language>

Target:
public void recordAdjustment(long adjustmentUnits) { if (adjustmentUnits > 0) { rateLimiter.steal(adjustmentUnits); } else if (adjustmentUnits < 0) { rateLimiter.returnPermits(safeNegative(adjustmentUnits)); } }
Source:
<code>public void refreshNotationStructure() { if (hostView != null) { removeUnappliedStereotypes(comment); <START> if (stereoList.size() != 0) { <END> refreshStereotypeCommentStructure(); } } }</code><technical_language>List#isEmpty()</technical_language>

Target:
public void refreshNotationStructure() { if (hostView != null) { removeUnappliedStereotypes(comment); if (!stereotypeList.isEmpty()) { refreshStereotypeCommentStructure(); } } }