auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public RenewableBatchIdSequence( IdSequence source, int batchSize, LongConsumer excessIdConsumer ) <END> { this.source = source; this.batchSize = batchSize; this.excessIdConsumer = excessIdConsumer; }</code><technical_language>constructor package private</technical_language>

Target:
RenewableBatchIdSequence( IdSequence source, int batchSize, LongConsumer excessIdConsumer ) { this.source = source; this.batchSize = batchSize; this.excessIdConsumer = excessIdConsumer; }
Source:
<code>public void run() { SensorJob sensorJob = circuit.getNextSensorJob(); if (sensorJob != null && connectionManager.checkConnection()) { sensorJob.execute(dSAPI, connectionManager.getSessionToken()); } if (circuit.noMoreJobs()) { <START> logger.debug("no more jobs... stop circuit schedduler with id = {}", circuit.getMeterDSID().toString()); <END> pollingSchedulers.get(circuit.getMeterDSID()).cancel(true); } }</code><technical_language>remove toString()</technical_language>

Target:
public void run() { SensorJob sensorJob = circuit.getNextSensorJob(); if (sensorJob != null && connectionManager.checkConnection()) { sensorJob.execute(dSAPI, connectionManager.getSessionToken()); } if (circuit.noMoreJobs()) { logger.debug("no more jobs... stop circuit schedduler with id = {}", circuit.getMeterDSID()); pollingSchedulers.get(circuit.getMeterDSID()).cancel(true); } }
Source:
<code>public void migrate() { List<byte[]> rangeBoundaries = getRangeBoundaries(); int totalTasks = rangeBoundaries.size() - 1; progress.beginTask("Migrating table " + srcTable + "...", totalTasks); Map<Long, byte[]> boundaryById = Maps.newHashMap(); for (long rangeId = 0; rangeId < rangeBoundaries.size() - 1; rangeId++) { boundaryById.put(rangeId, rangeBoundaries.get((int)rangeId)); } checkpointer.createCheckpoints(srcTable.getQualifiedName(), boundaryById); <START> rangeMigrator.checkStatus(rangeBoundaries.size()); <END> List<Future<Void>> futures = Lists.newArrayList(); for (long rangeId = 0; rangeId < rangeBoundaries.size() - 1; rangeId++) { byte[] end = rangeBoundaries.get((int)rangeId + 1); RangeRequest range = RangeRequest.builder(). endRowExclusive(end). batchHint(readBatchSize). retainColumns(columnSelection). build(); Callable<Void> task = createMigrationTask( range, rangeId); Callable<Void> wrappedTask = PTExecutors.wrap(task); Future<Void> f = executor.submit(wrappedTask); futures.add(f); } waitForFutures(futures); progress.taskComplete(); }</code><technical_language>call this logStatus</technical_language>

Target:
public void migrate() { List<byte[]> rangeBoundaries = getRangeBoundaries(); int totalTasks = rangeBoundaries.size() - 1; progress.beginTask("Migrating table " + srcTable + "...", totalTasks); Map<Long, byte[]> boundaryById = Maps.newHashMap(); for (long rangeId = 0; rangeId < rangeBoundaries.size() - 1; rangeId++) { boundaryById.put(rangeId, rangeBoundaries.get((int) rangeId)); } checkpointer.createCheckpoints(srcTable.getQualifiedName(), boundaryById); rangeMigrator.logStatus(rangeBoundaries.size()); List<Future<Void>> futures = Lists.newArrayList(); for (long rangeId = 0; rangeId < rangeBoundaries.size() - 1; rangeId++) { byte[] end = rangeBoundaries.get((int) rangeId + 1); RangeRequest range = RangeRequest.builder() .endRowExclusive(end) .batchHint(readBatchSize) .retainColumns(columnSelection) .build(); Callable<Void> task = createMigrationTask( range, rangeId); Callable<Void> wrappedTask = PTExecutors.wrap(task); Future<Void> future = executor.submit(wrappedTask); futures.add(future); } waitForFutures(futures); progress.taskComplete(); }
Source:
<code>private BufferedWriter writeAsString(String str) throws IOException { int len = str.length(); for ( int i = 0; i < len; i++ ) { char c = str.charAt(i); <START> switch (c) { case '\t': case '\b': case '\n': case '\r': case '\f': case '\"': case '\\': _ps.append('\\').append(c); continue; } <END> _ps.append(c); } return _ps; }</code><technical_language>added a default clause : default: // Do</technical_language>

Target:
private void writeAsString(String str) throws IOException { int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); switch (c) { case '\t': case '\b': case '\n': case '\r': case '\f': case '\"': case '\\': bufferedWriter.append('\\').append(c); continue; default: } bufferedWriter.append(c); } }
Source:
<code>public void endAssociation(Xid _tranID, XAResource _theXAResource, int xaState, int txInfoState) throws XAException { <START> List<XAResource> xars = new ArrayList<XAResource>(); <END> int txInfo = getXAResourceState(_theXAResource); if ((txInfo != TxInfo.NOT_ASSOCIATED) && (txInfo != TxInfo.FAILED)) { xars.add(_theXAResource); } for (Object resource : _duplicateResources.keySet()) { XAResource dupXar = (XAResource) resource; if (_theXAResource.isSameRM(dupXar)) { xars.add(dupXar); } } for (XAResource xar : xars) { try { xar.end(_tranID, xaState); setXAResourceState(xar, txInfoState); } catch (XAException e1) { switch (e1.errorCode) { case XAException.XA_RBROLLBACK: case XAException.XA_RBCOMMFAIL: case XAException.XA_RBDEADLOCK: case XAException.XA_RBINTEGRITY: case XAException.XA_RBOTHER: case XAException.XA_RBPROTO: case XAException.XA_RBTIMEOUT: case XAException.XA_RBTRANSIENT: setXAResourceState(xar, txInfoState); } throw e1; } } }</code><technical_language>save declaring this memory (and extra processing needed add iterate list) if put code line 1132 1150 a separate private method</technical_language>

Target:
public void endAssociation(Xid _tranID, XAResource _theXAResource, int xaState, int txInfoState) throws XAException { int txInfo = getXAResourceState(_theXAResource); XAException toThrow = null; if ((txInfo != TxInfo.NOT_ASSOCIATED) && (txInfo != TxInfo.FAILED)) { try { doEnd(_tranID, _theXAResource, xaState, txInfoState); } catch (XAException e) { if (toThrow == null) { toThrow = e; } } } for (Object resource : _duplicateResources.keySet()) { XAResource dupXar = (XAResource) resource; if (_theXAResource.isSameRM(dupXar)) { try { doEnd(_tranID, dupXar, xaState, txInfoState); } catch (XAException e) { if (toThrow == null) { toThrow = e; } } } } if (toThrow != null) { throw toThrow; } }
Source:
<code>public void setServers(Collection<SocketAddress> servers) { this.servers = servers.toArray(new SocketAddress[servers.size()]); if (index >= this.servers.length) { <START> index = ThreadLocalRandom.current().nextInt(this.servers.length); <END> } if (trace) { log.tracef("New server list is: " + Arrays.toString(this.servers)); } }</code><technical_language>index initialized MAX_INT in order trigger this 1st call</technical_language>

Target:
public void setServers(Collection<SocketAddress> servers) { this.servers = servers.toArray(new SocketAddress[servers.size()]); index = ThreadLocalRandom.current().nextInt(this.servers.length); if (trace) { log.tracef("New server list is: " + Arrays.toString(this.servers)); } }
Source:
<code>public void notifyListeners(int eventType, Event event) { if <START> (this.dropdownTableViewer != <END> null && !this.dropdownTable.isDisposed()) this.dropdownTable.notifyListeners(eventType, event); }</code><technical_language>a check for viewer here? this dropdownTable? table</technical_language>

Target:
public void notifyListeners(int eventType, Event event) { if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.notifyListeners(eventType, event); }
Source:
<code>public void <START> testScrollBarViewShowAllWhenLimitedSpace() <END> { setLayoutRestrictions( true, true, false); onView(withId(androidx.car.test.R.id.page_up)).check(matches(isDisplayed())); onView(withId(androidx.car.test.R.id.scrollbar_thumb)).check(matches(isDisplayed())); onView(withId(androidx.car.test.R.id.alpha_jump)).check(matches(isDisplayed())); }</code><technical_language>Enough</technical_language>

Target:
public void testScrollBarViewShowAllWhenLimitedSpace() { setLayoutRestrictions( true, true, false); onView(withId(R.id.page_up)).check(matches(isDisplayed())); onView(withId(R.id.scrollbar_thumb)).check(matches(isDisplayed())); onView(withId(R.id.alpha_jump)).check(matches(isDisplayed())); }
Source:
<code>private Uri getImageUri(Context context, Intent data) { String imagePath = null; Uri uri = data.getData(); <START> if (Build.VERSION.SDK_INT >= 19) { <END> if (DocumentsContract.isDocumentUri(context, uri)) { String docId = DocumentsContract.getDocumentId(uri); if ("com.android.providers.media.documents".equals(uri.getAuthority())) { String id = docId.split(":")[1]; String selection = MediaStore.Images.Media._ID + "=" + id; imagePath = getImagePath(context, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection); } else if ("com.android.providers.downloads.documents".equals(uri.getAuthority())) { Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(docId)); imagePath = getImagePath(context, contentUri, null); } } else if ("content".equalsIgnoreCase(uri.getScheme())) { imagePath = getImagePath(context, uri, null); } else if ("file".equalsIgnoreCase(uri.getScheme())) { imagePath = uri.getPath(); } } else { uri = data.getData(); imagePath = getImagePath(context, uri, null); } File file = new File(imagePath); mTempImagePath = imagePath; mField.setImagePath(imagePath); mField.setHasTemporaryMedia(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { uri = FileProvider.getUriForFile(context, mActivity.getApplicationContext().getPackageName() + ".apkgfileprovider", file); } else { uri = Uri.fromFile(file); } return uri; }</code><technical_language>mixing version codes version numbers here. I searched codebase VERSION_CODES is majority. VERSION_CODE</technical_language>

Target:
private Uri getImageUri(Context context, Intent data) { String imagePath = null; Uri uri = data.getData(); if (uri == null) { ToastSender.sendToast(context, context.getString(R.string.select_image_failed), Toast.LENGTH_LONG); return null; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (DocumentsContract.isDocumentUri(context, uri)) { String docId = DocumentsContract.getDocumentId(uri); if ("com.android.providers.media.documents".equals(uri.getAuthority())) { String id = docId.split(":")[1]; String selection = MediaStore.Images.Media._ID + "=" + id; imagePath = getImagePath(context, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection); } else if ("com.android.providers.downloads.documents".equals(uri.getAuthority())) { Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(docId)); imagePath = getImagePath(context, contentUri, null); } } else if ("content".equalsIgnoreCase(uri.getScheme())) { imagePath = getImagePath(context, uri, null); } else if ("file".equalsIgnoreCase(uri.getScheme())) { imagePath = uri.getPath(); } } else { uri = data.getData(); imagePath = getImagePath(context, uri, null); } File file = new File(imagePath); mImagePath = imagePath; mField.setImagePath(imagePath); mField.setHasTemporaryMedia(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { uri = FileProvider.getUriForFile(context, mActivity.getApplicationContext().getPackageName() + ".apkgfileprovider", file); } else { uri = Uri.fromFile(file); } return uri; }
Source:
<code>private void addMetaAnnotationsToQueue(Deque<AnnotationTypeMapping> queue, AnnotationTypeMapping source) { Annotation[] metaAnnotations = AnnotationsScanner.getDeclaredAnnotations(source.getAnnotationType(), false); for (Annotation metaAnnotation : metaAnnotations) { if (!isMappable(source, metaAnnotation)) { continue; } Annotation[] repeatedAnnotations = this.repeatableContainers .findRepeatedAnnotations(metaAnnotation); if (repeatedAnnotations != null) { for (Annotation repeatedAnnotation : repeatedAnnotations) { <START> addIfPossible(queue, source, repeatedAnnotation); <END> } } else { addIfPossible(queue, source, metaAnnotation); } } }</code><technical_language>wondering if a copy-and-paste error if be: java if (!isMappable(source, repeatedAnnotation)) { continue; } @philwebb, thoughts matter</technical_language>

Target:
private void addMetaAnnotationsToQueue(Deque<AnnotationTypeMapping> queue, AnnotationTypeMapping source) { Annotation[] metaAnnotations = AnnotationsScanner.getDeclaredAnnotations(source.getAnnotationType(), false); for (Annotation metaAnnotation : metaAnnotations) { if (!isMappable(source, metaAnnotation)) { continue; } Annotation[] repeatedAnnotations = this.repeatableContainers .findRepeatedAnnotations(metaAnnotation); if (repeatedAnnotations != null) { for (Annotation repeatedAnnotation : repeatedAnnotations) { if (!isMappable(source, repeatedAnnotation)) { continue; } addIfPossible(queue, source, repeatedAnnotation); } } else { addIfPossible(queue, source, metaAnnotation); } } }
Source:
<code>public int getSelectedIndex() { return selectedIndex.isPresent() ? selectedIndex.get() : -1; <START> } <END></code><technical_language>need this method all</technical_language>

Target:
public int getSelectedIndex() { return selectedIndex.get(); }
Source:
<code>private static SSLContext getSslContext() { final Boolean check = AccessController.doPrivileged( (PrivilegedAction<Boolean>) () -> (System.getProperty(KEY_STORE) == null || System.getProperty(KEY_STORE_PASS) == null || System.getProperty(TRUST_STORE) == null || System.getProperty(TRUST_STORE_PASS) == null)); if (check) { throw new IllegalArgumentException("KeyStore and TrustStore system properties must be set."); } final KeyStore[] trustStore = new KeyStore[1]; final KeyStore[] keyStore = new KeyStore[1]; AccessController.doPrivileged( (PrivilegedAction<Object>) () -> { trustStore[0] = getKeyStore( System.getProperty(TRUST_STORE), System.getProperty(TRUST_STORE_PASS)); keyStore[0] = getKeyStore(System.getProperty(KEY_STORE), System.getProperty(KEY_STORE_PASS)); return null; }); SSLContext sslContext = null; try { sslContext = SSLContexts.custom() .loadKeyMaterial( keyStore[0], AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(KEY_STORE_PASS)) .toCharArray()) .loadTrustMaterial(trustStore[0]) .useTLS() .build(); } catch (UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { throw new IllegalArgumentException( "Unable to use javax.net.ssl.keyStorePassword to load key material to create SSL context for Solr client."); } sslContext.getDefaultSSLParameters().setNeedClientAuth(true); <START> sslContext.getDefaultSSLParameters().setWantClientAuth(true); <END> return sslContext; }</code><technical_language>This 2 lines in try block technically sslContext null of it</technical_language>

Target:
private static SSLContext getSslContext() { final Boolean check = AccessController.doPrivileged( (PrivilegedAction<Boolean>) () -> (System.getProperty(KEY_STORE) == null || System.getProperty(KEY_STORE_PASS) == null || System.getProperty(TRUST_STORE) == null || System.getProperty(TRUST_STORE_PASS) == null)); if (check) { throw new IllegalArgumentException("KeyStore and TrustStore system properties must be set."); } final KeyStore[] trustStore = new KeyStore[1]; final KeyStore[] keyStore = new KeyStore[1]; AccessController.doPrivileged( (PrivilegedAction<Object>) () -> { trustStore[0] = getKeyStore( System.getProperty(TRUST_STORE), System.getProperty(TRUST_STORE_PASS)); keyStore[0] = getKeyStore(System.getProperty(KEY_STORE), System.getProperty(KEY_STORE_PASS)); return null; }); SSLContext sslContext = null; try { sslContext = SSLContexts.custom() .loadKeyMaterial( keyStore[0], AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(KEY_STORE_PASS)) .toCharArray()) .loadTrustMaterial(trustStore[0]) .useTLS() .build(); sslContext.getDefaultSSLParameters().setNeedClientAuth(true); sslContext.getDefaultSSLParameters().setWantClientAuth(true); } catch (UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { throw new IllegalArgumentException( "Unable to use javax.net.ssl.keyStorePassword to load key material to create SSL context for Solr client."); } return sslContext; }
Source:
<code>History parse(File file, Repository repos, String sinceRevision) throws HistoryException { myDir = repos.getDirectoryName() + File.separator; repository = (GitRepository) repos; RenamedFilesParser parser = new RenamedFilesParser(); try { Executor executor = repository.getHistoryLogExecutor(file, sinceRevision); int status = executor.exec(true, this); if (status != 0) { throw new HistoryException("Failed to get history for: \"" <START> + file.getAbsolutePath() + "\" Exit code: " + status); <END> } if (RuntimeEnvironment.getInstance().isHandleHistoryOfRenamedFiles()) { executor = repository.getRenamedFilesExecutor(file, sinceRevision); status = executor.exec(true, parser); if (status != 0) { throw new HistoryException("Failed to get renamed files for: \"" + file.getAbsolutePath() + "\" Exit code: " + status); } } } catch (IOException e) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\"", e); } return new History(entries, parser.getRenamedFiles()); }</code><technical_language>style - do generally operator wrapping lines</technical_language>

Target:
History parse(File file, Repository repos, String sinceRevision) throws HistoryException { myDir = repos.getDirectoryName() + File.separator; repository = (GitRepository) repos; RenamedFilesParser parser = new RenamedFilesParser(); try { Executor executor = repository.getHistoryLogExecutor(file, sinceRevision); int status = executor.exec(true, this); if (status != 0) { throw new HistoryException( String.format("Failed to get history for: \"%s\" Exit code: %d", file.getAbsolutePath(), status)); } if (RuntimeEnvironment.getInstance().isHandleHistoryOfRenamedFiles()) { executor = repository.getRenamedFilesExecutor(file, sinceRevision); status = executor.exec(true, parser); if (status != 0) { throw new HistoryException( String.format("Failed to get renamed files for: \"%s\" Exit code: %d", file.getAbsolutePath(), status)); } } } catch (IOException e) { throw new HistoryException( String.format("Failed to get history for: \"%s\"", file.getAbsolutePath()), e); } return new History(entries, parser.getRenamedFiles()); }
Source:
<code>public boolean hasPhysMemoryToRunVM(VDS curVds, VM vm, int pendingMemory) { <START> boolean retVal = false; <END> if (curVds.getMemFree() != null && curVds.getGuestOverhead() != null) { double vmMemRequired = vm.getMemSizeMb() + curVds.getGuestOverhead(); double vdsMemLimit = curVds.getMemFree() - pendingMemory; log.debug("hasPhysMemoryToRunVM: host '{}'; free memory is : MB (+ MB pending); free swap is: MB, required memory is MB; Guest overhead MB", curVds.getName(), vdsMemLimit, pendingMemory, curVds.getSwapFree(), vmMemRequired, curVds.getGuestOverhead()); if (curVds.getSwapFree() != null) { vdsMemLimit += curVds.getSwapFree(); } log.debug("{} <= ??? {}", vmMemRequired, vdsMemLimit); retVal = (vmMemRequired <= vdsMemLimit); } return retVal; }</code><technical_language>I get rid of this helper</technical_language>

Target:
public boolean hasPhysMemoryToRunVM(VDS curVds, VM vm, int pendingMemory) { if (curVds.getMemFree() != null && curVds.getGuestOverhead() != null) { double vmMemRequired = vm.getMemSizeMb() + curVds.getGuestOverhead(); double vdsMemLimit = curVds.getMemFree() - pendingMemory; log.debug("hasPhysMemoryToRunVM: host '{}'; free memory is : MB (+ MB pending); free swap is: MB, required memory is MB; Guest overhead MB", curVds.getName(), vdsMemLimit, pendingMemory, curVds.getSwapFree(), vmMemRequired, curVds.getGuestOverhead()); if (curVds.getSwapFree() != null) { vdsMemLimit += curVds.getSwapFree(); } log.debug("{} <= ??? {}", vmMemRequired, vdsMemLimit); return (vmMemRequired <= vdsMemLimit); } else { return false; } }
Source:
<code>private void scheduleCheckStatus() { <START> if (urlInitialized && reportBaseUrl.trim().isEmpty()) { <END> return; } if (scheduledStatusCheckInProgress) { return; } scheduledStatusCheckInProgress = true; Scheduler.get().scheduleFixedDelay( new Scheduler.RepeatingCommand() { @Override public boolean execute() { if (retryCount > MAX_RETRY_COUNTS || reportsWebappDeployed) { scheduledStatusCheckInProgress = false; return false; } retryCount++; checkReportsWebAppStatus(); return true; } }, RETRY_INTERVAL); }</code><technical_language>IMO, urlInitialized check is redundant. I"m get this point urlInitialized=false. (And if is false- want return?)</technical_language>

Target:
private void scheduleCheckStatus() { if (scheduledStatusCheckInProgress || reportsWebappDeployed) { return; } scheduledStatusCheckInProgress = true; Scheduler.get().scheduleFixedDelay( new Scheduler.RepeatingCommand() { @Override public boolean execute() { if (retryCount > MAX_RETRY_COUNTS || reportsWebappDeployed) { scheduledStatusCheckInProgress = false; return false; } retryCount++; checkReportsWebAppStatus(); return true; } }, RETRY_INTERVAL); }
Source:
<code>void removeConnection(String connectionId) { <START> if (availableConnections.remove(connectionId)) { <END> availableCount--; } poolCount--; }</code><technical_language>This operation O(n), size of list small. Making sense a set instead</technical_language>

Target:
void removeConnection(String connectionId) { availableConnections.remove(connectionId); poolCount--; }
Source:
<code>private void loadYolo() { log.info("loadYolo - begin"); <START> log.info("Staritng yolo download verification"); <END> checkFiles(); log.info("Completed downloading yolo model"); net = readNetFromDarknet(darknetHome + File.separator + modelConfig, darknetHome + File.separator + modelWeights); log.info("Loaded yolo darknet model to opencv"); try { classNames = loadClassNames(darknetHome + File.separator + modelNames); } catch (IOException e) { log.warn("Error unable to load class names from file {}", modelNames, e); return; } log.info("Done loading model.."); log.info("loadYolo - end"); }</code><technical_language>this log message is wrong, download anymore.. log message. validation "checkFiles" successful</technical_language>

Target:
private void loadYolo() { log.info("loadYolo - begin"); try { net = readNetFromDarknet(darknetHome + File.separator + modelConfig, darknetHome + File.separator + modelWeights); log.info("Loaded yolo darknet model to opencv"); } catch (Exception e) { log.error("readNetFromDarknet could not read", e); return; } try { classNames = loadClassNames(darknetHome + File.separator + modelNames); } catch (IOException e) { log.warn("Error unable to load class names from file {}", modelNames, e); return; } log.info("Done loading model.."); log.info("loadYolo - end"); }
Source:
<code>public FunctionModel(SedModel sedModel) { this.sedModel = sedModel; StackedStarTable stackedTable = new StackedStarTable(sedModel.getDataTables(), new SegmentColumnInfoMatcher()); <START> stackedTable.setName(sedModel.getSedLayerModel().getSuffix()); <END> try { int col; ColumnIdentifier colId = new ColumnIdentifier(stackedTable); col = colId.getColumnIndex(SegmentColumn.Column.Spectral_Value.name()); sortedStackedStarTable = new SortedStarTable(stackedTable, col, true); sortedStackedStarTable.setName(stackedTable.getName()+FUNCTION_SUFFIX); } catch (IOException ex) { Logger.getLogger(FunctionModel.class.getName()).log(Level.SEVERE, null, ex); } }</code><technical_language>add this, + " Fit" something. O/w some confusion in legend (if show in legend)</technical_language>

Target:
public FunctionModel(SedModel sedModel) { setSedModel(sedModel); }
Source:
<code>private static Set<Annotation> inspectQualifiedCarrier(AnnotatedElement element) { return Arrays.stream(element.getAnnotations()) <START> .filter(anno -> anno instanceof Qualified) <END> .map(Qualified.class::cast) .map(Qualified::value) .flatMap(Arrays::stream) .map(AnnotationFactory::create) .collect(toSet()); }</code><technical_language>Alternatively: Qualified.class::isInstance</technical_language>

Target:
private static Set<Annotation> inspectQualifiedCarrier(AnnotatedElement element) { return Arrays.stream(element.getAnnotations()) .filter(Qualified.class::isInstance) .map(Qualified.class::cast) .map(Qualified::value) .flatMap(Arrays::stream) .map(AnnotationFactory::create) .collect(toSet()); }
Source:
<code>private void addCpuPinning(final String compatibilityVersion) { final String cpuPinning = vm.getCpuPinning(); if (StringUtils.isNotEmpty(cpuPinning) && Boolean.TRUE.equals(Config.<Boolean> GetValue(ConfigValues.CpuPinningEnabled, compatibilityVersion)) <START> && cpuPinning != null) { <END> final XmlRpcStruct pinDict = new XmlRpcStruct(); for (String pin : cpuPinning.split("_")) { final String[] split = pin.split("#"); pinDict.add(split[0], split[1]); } createInfo.add(VdsProperties.cpuPinning, pinDict); } }</code><technical_language>remove "cpuPinning != null" test well</technical_language>

Target:
private void addCpuPinning(final String compatibilityVersion) { final String cpuPinning = vm.getCpuPinning(); if (StringUtils.isNotEmpty(cpuPinning) && Boolean.TRUE.equals(Config.<Boolean> GetValue(ConfigValues.CpuPinningEnabled, compatibilityVersion))) { final XmlRpcStruct pinDict = new XmlRpcStruct(); for (String pin : cpuPinning.split("_")) { final String[] split = pin.split("#"); pinDict.add(split[0], split[1]); } createInfo.add(VdsProperties.cpuPinning, pinDict); } }
Source:
<code>private static ValueCounts getValueCounts(QuickAndDirtyXlsxReader workbook, String tableName, String fieldName) { Sheet tableSheet = null; String targetSheetName = Table.createSheetNameFromTableName(tableName); for (Sheet sheet : workbook) { if (sheet.getName().equals(targetSheetName)) { tableSheet = sheet; break; } } if (tableSheet == null) { return new ValueCounts(); } Iterator<org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row> iterator = tableSheet.iterator(); org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row header = iterator.next(); int index = header.indexOf(fieldName); ValueCounts valueCounts = new ValueCounts(); if (index != -1) while (iterator.hasNext()) { org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row row = iterator.next(); if (row.size() > index) { String value = row.get(index); String count; if (row.size() > index + 1) { count = row.get(index + 1); } else { count = ""; } if (value.equals("") && count.equals("")) { break; } try { <START> valueCounts.add(value, (int) (Double.parseDouble(count))); <END> } catch (NumberFormatException e) { } } } return valueCounts; }</code><technical_language>wondering: do want cut fraction is done (basically a Math.floor operation), closest integer (Math.round)</technical_language>

Target:
private static ValueCounts getValueCounts(QuickAndDirtyXlsxReader workbook, String tableName, String fieldName) { String targetSheetName = Table.createSheetNameFromTableName(tableName); Sheet tableSheet = workbook.getByName(targetSheetName); if (tableSheet == null) { return new ValueCounts(); } Iterator<org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row> iterator = tableSheet.iterator(); org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row header = iterator.next(); int index = header.indexOf(fieldName); ValueCounts valueCounts = new ValueCounts(); if (index != -1) while (iterator.hasNext()) { org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row row = iterator.next(); if (row.size() > index) { String value = row.get(index); String count; if (row.size() > index + 1) { count = row.get(index + 1); } else { count = ""; } if (value.equals("") && count.equals("")) { break; } try { valueCounts.add(value, (int) Double.parseDouble(count)); } catch (NumberFormatException e) { } } } return valueCounts; }
Source:
<code>public void recompile() { TIntIntIterator it = disposalAction.shaderPrograms.iterator(); while (it.hasNext()) { it.advance(); GL20.glDeleteProgram(it.value()); } disposalAction.shaderPrograms.clear(); uniformLocationMap.clear(); bindMap.clear(); disposalAction.shaderPrograms.put(0, shader.linkShaderProgram(0)); for (Set<ShaderProgramFeature> permutation : Sets.powerSet(shader.getAvailableFeatures())) { int featureMask = ShaderProgramFeature.getBitset(permutation); disposalAction.shaderPrograms.put(featureMask, shader.linkShaderProgram(featureMask)); } if (shaderParameters != null) { shaderParameters.initialParameters(this); } for (Map.Entry<String, Texture> entry : materialData.getTextures().entrySet()) { setTexture(entry.getKey(), entry.getValue()); } for (Map.Entry<String, Texture> entry : materialData.getTextures().entrySet()) { setTexture(entry.getKey(), entry.getValue()); } for (Map.Entry<String, Float> entry : materialData.getFloatParams().entrySet()) { setFloat(entry.getKey(), entry.getValue()); } for (Map.Entry<String, Integer> entry : materialData.getIntegerParams().entrySet()) { setInt(entry.getKey(), entry.getValue()); } for (Map.Entry<String, float[]> entry : materialData.getFloatArrayParams().entrySet()) { <START> switch (entry.getValue().length) { <END> case 1: setFloat(entry.getKey(), entry.getValue()[0]); break; case 2: setFloat2(entry.getKey(), entry.getValue()[0], entry.getValue()[1]); break; case 3: setFloat3(entry.getKey(), entry.getValue()[0], entry.getValue()[1], entry.getValue()[2]); break; case 4: setFloat4(entry.getKey(), entry.getValue()[0], entry.getValue()[1], entry.getValue()[2], entry.getValue()[3]); break; default: logger.error("MaterialData contains float array entry of size > 4"); break; } } }</code><technical_language>This is nitpicking, please extract a local variable for getValue()? is accessed times next couple of lines</technical_language>

Target:
public void recompile() { TIntIntIterator it = disposalAction.shaderPrograms.iterator(); while (it.hasNext()) { it.advance(); GL20.glDeleteProgram(it.value()); } disposalAction.shaderPrograms.clear(); uniformLocationMap.clear(); bindMap.clear(); disposalAction.shaderPrograms.put(0, shader.linkShaderProgram(0)); for (Set<ShaderProgramFeature> permutation : Sets.powerSet(shader.getAvailableFeatures())) { int featureMask = ShaderProgramFeature.getBitset(permutation); disposalAction.shaderPrograms.put(featureMask, shader.linkShaderProgram(featureMask)); } if (shaderParameters != null) { shaderParameters.initialParameters(this); } rebindVaribles(materialData); }
Source:
<code>public void write(JsonWriter out, T value) throws IOException { JsonElement element = delegate.toJsonTree(value); JsonObject jsonObject = element.getAsJsonObject(); URI problemType = Optional.ofNullable(jsonObject.remove("type")) .map(TypeURIAdapter.INSTANCE::fromJsonTree).get(); jsonObject.add("type", TypeURIAdapter.INSTANCE.toJsonTree(problemType)); if (value instanceof AbstractThrowableProblem) { Optional.ofNullable(jsonObject.remove("parameters")) .map(JsonElement::getAsJsonObject) .ifPresent(params -> params.keySet().forEach(k -> jsonObject.add(k, params.get(k)))); } if (value instanceof Throwable) { jsonObject.remove("detailMessage"); jsonObject.remove("suppressedExceptions"); Optional.ofNullable(jsonObject.remove("stackTrace")) .filter(s -> stackTraces) .ifPresent(s -> { TypeAdapter<StackTraceElement[]> traceAdapter = gson.getAdapter(StackTraceElement[].class); <START> StackTraceElement[] readTraces = traceAdapter.fromJsonTree(s); <END> TypeAdapter<String[]> arrayAdapter = gson.getAdapter(String[].class); String[] traceArray = Arrays.stream(readTraces) .map(StackTraceElement::toString) .toArray(String[]::new); JsonElement stackTraceElement = arrayAdapter.toJsonTree(traceArray); jsonObject.add("stacktrace", stackTraceElement); }); } Streams.write(element, out); }</code><technical_language>value.getStackTrace() instead of re-parsing it</technical_language>

Target:
public void write(JsonWriter out, T value) throws IOException { JsonElement element = delegate.toJsonTree(value); JsonObject jsonObject = element.getAsJsonObject(); URI problemType = TYPE.fromJsonTree(jsonObject.remove("type")); serializeType(jsonObject, problemType); if (value instanceof AbstractThrowableProblem) { Optional.ofNullable(jsonObject.remove("parameters")) .map(JsonElement::getAsJsonObject) .ifPresent(params -> params.entrySet().forEach(e -> jsonObject.add(e.getKey(), e.getValue()))); } if (value instanceof Throwable) { jsonObject.remove("detailMessage"); jsonObject.remove("suppressedExceptions"); jsonObject.remove("stackTrace"); serializeStackTrace(jsonObject, (Throwable) value); } Streams.write(element, out); }
Source:
<code>public <X> CompletableFuture<X> send(SessionID sessionId, Command<X> command) { long id = NEXT_ID.getAndIncrement(); CompletableFuture<X> result = new CompletableFuture<>(); if (command.getSendsResponse()) { methodCallbacks.put(id, input -> { X value = command.getMapper().apply(input); result.complete(value); }); } ImmutableMap.Builder<String, Object> serialized = ImmutableMap.builder(); serialized.put("id", id); serialized.put("method", command.getMethod()); serialized.put("params", command.getParams()); if (sessionId != null) { serialized.put("sessionId", sessionId); } <START> LOG.finest(JSON.toJson(serialized.build())); <END> socket.sendText(JSON.toJson(serialized.build())); if (!command.getSendsResponse() ) { result.complete(null); } return result; }</code><technical_language>Right this is experimental deeply flaky. left this info debugging user reports a lot easier</technical_language>

Target:
public <X> CompletableFuture<X> send(SessionID sessionId, Command<X> command) { long id = NEXT_ID.getAndIncrement(); CompletableFuture<X> result = new CompletableFuture<>(); if (command.getSendsResponse()) { methodCallbacks.put(id, input -> { X value = command.getMapper().apply(input); result.complete(value); }); } ImmutableMap.Builder<String, Object> serialized = ImmutableMap.builder(); serialized.put("id", id); serialized.put("method", command.getMethod()); serialized.put("params", command.getParams()); if (sessionId != null) { serialized.put("sessionId", sessionId); } LOG.info(JSON.toJson(serialized.build())); socket.sendText(JSON.toJson(serialized.build())); if (!command.getSendsResponse() ) { result.complete(null); } return result; }
Source:
<code>public static <T, B> Function<Type, PojoProperties<T>> immutable(Class<T> defn, Supplier<B> builder) { <START> return t -> (PojoProperties<T>) IMMUTABLE_PROPERTIES.computeIfAbsent(t, x -> new ImmutablePojoProperties<>(t, defn, builder)); <END> }</code><technical_language>this indirection t -> business buys</technical_language>

Target:
public static <T, B> Function<Type, PojoProperties<?>> immutable(Class<T> defn, Supplier<B> builder) { return t -> (PojoProperties<T>) IMMUTABLE_PROPERTIES.computeIfAbsent(t, x -> new ImmutablePojoProperties<>(t, defn, builder)); }
Source:
<code>public void testSetQueryWindowBackward() { List<String> versionList = new ArrayList<>(); versionList.add("5-44"); Calendar cal = new GregorianCalendar(); cal.set(2016, 4, 7, 15, 30, 12); long startTime = cal.getTimeInMillis(); <START> cal.add(Calendar.DAY_OF_MONTH, 3); <END> long endTime = cal.getTimeInMillis(); AdminLogQuery query = new AdminLogQuery(versionList, startTime, endTime); Long fourHours = Long.valueOf(4 * 60 * 60 * 1000); query.moveTimePeriodBackward(fourHours); long expectedEndTime = startTime - 1; long expectedStartTime = expectedEndTime - fourHours; assertEquals(expectedStartTime, query.getStartTime()); assertEquals(expectedEndTime, query.getEndTime()); assertEquals(expectedStartTime, query.getQuery().getStartTimeMillis().longValue()); assertEquals(expectedEndTime, query.getQuery().getEndTimeMillis().longValue()); }</code><technical_language>Calendar.DATE confusing</technical_language>

Target:
public void testSetQueryWindowBackward() { List<String> versionList = new ArrayList<>(); versionList.add("5-44"); Calendar cal = new GregorianCalendar(); cal.set(2016, 4, 7, 15, 30, 12); long startTime = cal.getTimeInMillis(); cal.add(Calendar.DATE, 3); long endTime = cal.getTimeInMillis(); AdminLogQuery query = new AdminLogQuery(versionList, startTime, endTime); Long fourHours = Long.valueOf(4 * 60 * 60 * 1000); query.moveTimePeriodBackward(fourHours); long expectedEndTime = startTime - 1; long expectedStartTime = expectedEndTime - fourHours; assertEquals(expectedStartTime, query.getStartTime()); assertEquals(expectedEndTime, query.getEndTime()); assertEquals(expectedStartTime, query.getQuery().getStartTimeMillis().longValue()); assertEquals(expectedEndTime, query.getQuery().getEndTimeMillis().longValue()); }
Source:
<code>private SqlFunctionProperties( boolean parseDecimalLiteralAsDouble, boolean legacyRowFieldOrdinalAccessEnabled, TimeZoneKey timeZoneKey, boolean legacyTimestamp, boolean legacyMapSubscript, long sessionStartTime, Locale sessionLocale, String sessionUser) { this.parseDecimalLiteralAsDouble = parseDecimalLiteralAsDouble; this.legacyRowFieldOrdinalAccessEnabled = legacyRowFieldOrdinalAccessEnabled; this.timeZoneKey = requireNonNull(timeZoneKey, "timeZoneKey is null"); this.legacyTimestamp = legacyTimestamp; this.legacyMapSubscript = legacyMapSubscript; this.sessionStartTime = sessionStartTime; <START> this.sessionLocale = sessionLocale; this.sessionUser = sessionUser; <END> }</code><technical_language>requireNonNull</technical_language>

Target:
private SqlFunctionProperties( boolean parseDecimalLiteralAsDouble, boolean legacyRowFieldOrdinalAccessEnabled, TimeZoneKey timeZoneKey, boolean legacyTimestamp, boolean legacyMapSubscript, long sessionStartTime, Locale sessionLocale, String sessionUser) { this.parseDecimalLiteralAsDouble = parseDecimalLiteralAsDouble; this.legacyRowFieldOrdinalAccessEnabled = legacyRowFieldOrdinalAccessEnabled; this.timeZoneKey = requireNonNull(timeZoneKey, "timeZoneKey is null"); this.legacyTimestamp = legacyTimestamp; this.legacyMapSubscript = legacyMapSubscript; this.sessionStartTime = sessionStartTime; this.sessionLocale = requireNonNull(sessionLocale, "sessionLocale is null"); this.sessionUser = requireNonNull(sessionUser, "sessionUser is null"); }
Source:
<code>public String registerConfigProvider(String className, Map properties, String layer, String appContext, String description) { AuthConfigProvider acp = null; if (className != null) { try { Class<?> provClass = SecurityActions.getContextClassLoader().loadClass(className); Constructor<?> ctr = provClass.getConstructor(new Class[] {Map.class, AuthConfigFactory.class}); acp = (AuthConfigProvider) ctr.newInstance(new Object[] {properties, null}); } catch (Exception e) { throw PicketBoxMessages.MESSAGES.failedToRegisterAuthConfigProvider(className, e); } } String registrationID = new StringBuilder().append(layer).append(appContext).toString(); <START> boolean providerAlreadyRegistrated = this.keyToAuthConfigProviderMap.containsKey(registrationID); <END> this.keyToAuthConfigProviderMap.put(registrationID, acp); if (providerAlreadyRegistrated) { JBossRegistrationContext context = (JBossRegistrationContext) this.keyToRegistrationContextMap.get(registrationID); context.setDescription(description); context.setIsPersistent(true); RegistrationListener listener = this.keyToRegistrationListenerMap.get(registrationID); if (listener != null) listener.notify(layer, appContext); } else { RegistrationContext context = new JBossRegistrationContext(layer, appContext, description, true); this.keyToRegistrationContextMap.put(registrationID, context); } return registrationID; }</code><technical_language>Logic sense - small typo though: "Registered" instead of "Registrated"</technical_language>

Target:
public String registerConfigProvider(String className, Map properties, String layer, String appContext, String description) { AuthConfigProvider acp = null; if (className != null) { try { Class<?> provClass = SecurityActions.getContextClassLoader().loadClass(className); Constructor<?> ctr = provClass.getConstructor(new Class[] {Map.class, AuthConfigFactory.class}); acp = (AuthConfigProvider) ctr.newInstance(new Object[] {properties, null}); } catch (Exception e) { throw PicketBoxMessages.MESSAGES.failedToRegisterAuthConfigProvider(className, e); } } String registrationID = new StringBuilder().append(layer).append(appContext).toString(); boolean providerAlreadyRegistered = this.keyToAuthConfigProviderMap.containsKey(registrationID); this.keyToAuthConfigProviderMap.put(registrationID, acp); if (providerAlreadyRegistered) { JBossRegistrationContext context = (JBossRegistrationContext) this.keyToRegistrationContextMap.get(registrationID); context.setDescription(description); context.setIsPersistent(true); RegistrationListener listener = this.keyToRegistrationListenerMap.get(registrationID); if (listener != null) listener.notify(layer, appContext); } else { RegistrationContext context = new JBossRegistrationContext(layer, appContext, description, true); this.keyToRegistrationContextMap.put(registrationID, context); } return registrationID; }
Source:
<code>public synchronized void insertEntries(List<BibEntry> newEntries, EntriesEventSource eventSource) throws KeyCollisionException { Objects.requireNonNull(newEntries); BibEntry firstEntry = null; for (BibEntry entry : newEntries) { String id = entry.getId(); if (containsEntryWithId(id)) { throw new KeyCollisionException("ID is already in use, please choose another"); } internalIDs.add(id); entry.registerListener(this); if (firstEntry == null) { firstEntry = entry; } } <START> entries.addAll(newEntries); <END> if (firstEntry == null) { eventBus.post(new EntriesAddedEvent(newEntries, eventSource)); } else { eventBus.post(new EntriesAddedEvent(newEntries, firstEntry, eventSource)); } }</code><technical_language>I think, this wrapped if (!newEntries.isEmpty()) check for firstEntry == null. firstEntry is required more</technical_language>

Target:
public synchronized void insertEntries(List<BibEntry> newEntries, EntriesEventSource eventSource) throws KeyCollisionException { Objects.requireNonNull(newEntries); for (BibEntry entry : newEntries) { String id = entry.getId(); if (containsEntryWithId(id)) { throw new KeyCollisionException("ID is already in use, please choose another", id); } internalIDs.add(id); entry.registerListener(this); } if (newEntries.isEmpty()) { eventBus.post(new EntriesAddedEvent(newEntries, eventSource)); } else { eventBus.post(new EntriesAddedEvent(newEntries, newEntries.get(0), eventSource)); } entries.addAll(newEntries); }
Source:
<code>private Map<FilterExpression, List<TurboIssue>> processFilter(List<FilterExpression> filterExprs) { MultiModel models = logic.getModels(); List<TurboIssue> allModelIssues = models.getIssues(); Map<FilterExpression, List<TurboIssue>> filteredSortedAndCounted = new HashMap<>(); filterExprs.forEach(filterExpr -> { List<TurboIssue> filterAndSortedExpression = filteredSortedAndCounted.get(filterExpr); if (filterAndSortedExpression == null) { boolean hasUpdatedQualifier = Qualifier.hasUpdatedQualifier(filterExpr); FilterExpression filterExprNoAlias = Qualifier.replaceMilestoneAliases(models, filterExpr); List<TurboIssue> filteredSortedAndCountedIssues = allModelIssues.stream() .filter(issue -> Qualifier.process(models, filterExprNoAlias, issue)) <START> .sorted(determineComparator(filterExprNoAlias, hasUpdatedQualifier)) <END> .limit(determineCount(allModelIssues, filterExprNoAlias)) .collect(Collectors.toList()); filteredSortedAndCounted.put(filterExpr, filteredSortedAndCountedIssues); } }); return filteredSortedAndCounted; }</code><technical_language>related this issue, this sort, sorted</technical_language>

Target:
private Map<FilterExpression, List<TurboIssue>> processFilter(List<FilterExpression> filterExprs) { MultiModel models = logic.getModels(); List<TurboIssue> allModelIssues = models.getIssues(); Map<FilterExpression, List<TurboIssue>> filteredSortedAndCounted = new HashMap<>(); filterExprs.forEach(filterExpr -> { List<TurboIssue> filterAndSortedExpression = filteredSortedAndCounted.get(filterExpr); if (filterAndSortedExpression == null) { boolean hasUpdatedQualifier = Qualifier.hasUpdatedQualifier(filterExpr); FilterExpression filterExprNoAlias = Qualifier.replaceMilestoneAliases(models, filterExpr); List<TurboIssue> filteredSortedAndCountedIssues = allModelIssues.stream() .filter(issue -> Qualifier.process(models, filterExprNoAlias, issue)) .sorted(determineComparator(filterExprNoAlias, hasUpdatedQualifier)) .limit(Qualifier.determineCount(allModelIssues, filterExprNoAlias)) .collect(Collectors.toList()); filteredSortedAndCounted.put(filterExpr, filteredSortedAndCountedIssues); } }); return filteredSortedAndCounted; }
Source:
<code><START> private void initEncryption() throws FunctionalException { <END> try { this.key = new SecretKeySpec(Files.readAllBytes(new File(this.keyPath).toPath()), SECRET_KEY_SPEC); } catch (final IOException e) { final String errorMessage = String.format("Unexpected exception when reading keys"); LOGGER.error(errorMessage, e); throw new FunctionalException(FunctionalExceptionType.READING_KEY_EXCEPTION, ComponentType.SHARED, e); } }</code><technical_language>![MAJOR](<LINK_1> Private method 'initEncryption' is used. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private void initEncryption() throws FunctionalException { try { this.key = new SecretKeySpec(Files.readAllBytes(new File(this.keyPath).toPath()), SECRET_KEY_SPEC); } catch (final IOException e) { final String errorMessage = String.format("Unexpected exception when reading keys. Key Path: %s", this.keyPath); LOGGER.error(errorMessage); throw new FunctionalException(FunctionalExceptionType.READING_KEY_EXCEPTION, ComponentType.SHARED, e); } }
Source:
<code>public TimeGraphScale(Composite parent, TimeGraphColorScheme colors) { super(parent, colors, SWT.NO_BACKGROUND | SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED); addMouseListener(this); <START> addMouseMoveListener(this); <END> }</code><technical_language>TmfSignalManager.register(this); is missing</technical_language>

Target:
public TimeGraphScale(Composite parent, TimeGraphColorScheme colors) { super(parent, colors, SWT.NO_BACKGROUND | SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED); TmfSignalManager.register(this); addMouseListener(this); addMouseMoveListener(this); }
Source:
<code>public Response<CommentInfo> apply(DraftResource rsrc, Input input) throws OrmException, IOException { ChangeUpdate update = updateFactory.create(rsrc.getControl()); PatchList patchList = null; try { patchList = patchListCache.get(rsrc.getChange(), rsrc.getPatchSet()); } catch (PatchListNotAvailableException e) { <START> throw new OrmException("could not load PatchList for this patchset", e); <END> } RevId patchSetCommit = new RevId(ObjectId.toString(patchList.getNewId())); RevId baseCommit = new RevId(ObjectId.toString(patchList.getOldId())); PatchLineComment c = rsrc.getComment(); if (c.getRevId() == null) { if (c.getRevId() == null) { c.setRevId((c.getSide() == (short) 0) ? baseCommit : patchSetCommit); } } plcUtil.deleteComments(db.get(), update, Collections.singleton(c)); update.commit(); return Response.none(); }</code><technical_language>new OrmException(e)</technical_language>

Target:
public Response<CommentInfo> apply(DraftResource rsrc, Input input) throws OrmException, IOException { ChangeUpdate update = updateFactory.create(rsrc.getControl()); PatchLineComment c = rsrc.getComment(); if (c.getRevId() == null) { setCommentRevId(c, patchListCache, rsrc.getChange(), rsrc.getPatchSet()); } plcUtil.deleteComments(db.get(), update, Collections.singleton(c)); update.commit(); return Response.none(); }