auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Iterator<Pair<String,String[]>> iterator() { final Iterator<LabelSchemaDescriptor> iterator = indexMap.keySet().iterator(); return new Iterator<Pair<String,String[]>>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Pair<String,String[]> next() { LabelSchemaDescriptor next = iterator.next(); String label = labels.byIdOrFail( next.getLabelId() ); <START> String[] propertyKey = propertyKeys.byIdOrFail( next.getPropertyIds() ); <END> return Pair.of( label, propertyKey ); } @Override public void remove() { iterator.remove(); } }; }</code><technical_language>I suggest updating variable name propertyKeyNames (like in knownNodePropertyExistenceConstraints)</technical_language>

Target:
public Iterator<Pair<String,String[]>> iterator() { final Iterator<LabelSchemaDescriptor> iterator = indexMap.keySet().iterator(); return new Iterator<Pair<String,String[]>>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Pair<String,String[]> next() { LabelSchemaDescriptor next = iterator.next(); String label = labels.byIdOrFail( next.getLabelId() ); String[] propertyKeyNames = propertyKeys.byIdOrFail( next.getPropertyIds() ); return Pair.of( label, propertyKeyNames ); } @Override public void remove() { iterator.remove(); } }; }
Source:
<code><START> public void setUp() throws Exception { <END> tournament = new Tournament(); }</code><technical_language>I this needs throws Exception. throw Exception exception throwing, in this case throwing aware, need :)</technical_language>

Target:
public void setUp() { tournament = new Tournament(); }
Source:
<code>public void testStartWorkflowOperation() throws OperationException { try (OperationContext ctx = new OperationContext(session)) { ctx.setInput(doc); automationService.run(ctx, "Scripting.starytMyRoute"); DocumentModel routeInstance = session.getDocument(new IdRef((String) ctx.get("WorkflowId"))); GraphRoute graph = routeInstance.getAdapter(GraphRoute.class); Map<String, Serializable> vars = graph.getVariables(); assertNotNull(vars.get("datefield")); assertEquals(vars.get("stringfield"), "test"); assertNotNull(vars.get("myassignees")); assertTrue(vars.get("myassignees") instanceof String[]); String[] assignees = (String[]) vars.get("myassignees"); <START> assertEquals(assignees.length, 2); assertEquals(assignees[0], "x"); assertEquals(assignees[1], "y"); <END> } }</code><technical_language>Simper: assertArrayEquals(new String[] { "x", "y" }, assignees)</technical_language>

Target:
public void testStartWorkflowOperation() throws OperationException { try (OperationContext ctx = new OperationContext(session)) { ctx.setInput(doc); automationService.run(ctx, "Scripting.starytMyRoute"); DocumentModel routeInstance = session.getDocument(new IdRef((String) ctx.get("WorkflowId"))); GraphRoute graph = routeInstance.getAdapter(GraphRoute.class); Map<String, Serializable> vars = graph.getVariables(); assertNotNull(vars.get("datefield")); assertEquals(vars.get("stringfield"), "test"); assertNotNull(vars.get("myassignees")); assertTrue(vars.get("myassignees") instanceof String[]); String[] assignees = (String[]) vars.get("myassignees"); assertArrayEquals(new String[] { "x", "y" }, assignees); } }
Source:
<code>public void onAdvancedUserFilter(ActionEvent actionEvent) { <START> advancedUserFilter.setSelected(userFilterController.isFilterAppliedProperty().getValue()); <END> if (filterUserPopup.isShowing()) { filterUserPopup.hide(); return; } ToggleButton button = (ToggleButton) actionEvent.getSource(); Bounds screenBounds = advancedUserFilter.localToScreen(advancedUserFilter.getBoundsInLocal()); filterUserPopup.show(button.getScene().getWindow(), screenBounds.getMinX(), screenBounds.getMaxY()); }</code><technical_language>property.get() instead of getValue() above, getValue() returns a Double, get() a double, primitive double is expected, change behaviour add more consistency</technical_language>

Target:
public void onAdvancedUserFilter(ActionEvent actionEvent) { advancedUserFilter.setSelected(userFilterController.isFilterApplied()); if (filterUserPopup.isShowing()) { filterUserPopup.hide(); return; } ToggleButton button = (ToggleButton) actionEvent.getSource(); Bounds screenBounds = advancedUserFilter.localToScreen(advancedUserFilter.getBoundsInLocal()); filterUserPopup.show(button.getScene().getWindow(), screenBounds.getMinX(), screenBounds.getMaxY()); }
Source:
<code>public synchronized CustomPrintWriter getPrintWriter() { wasUsed = true; if (writer == null) { clearRemover(); try { this.stream = new IsClosedOutputStream(new FileOutputStream(file, append)); this.writer = <START> getExtendedPrintWriter((OutputStream) <END> this.stream); } catch (FileNotFoundException e) { throw new ConcurrentIOException(e); } } return writer; }</code><technical_language>nit: Custom</technical_language>

Target:
public synchronized CustomPrintWriter getPrintWriter() { wasUsed = true; if (writer == null) { clearRemover(); try { this.stream = new QueryableOutputStream(new FileOutputStream(file, append)); this.writer = getCustomPrintWriter((OutputStream) this.stream); } catch (FileNotFoundException e) { throw new ConcurrentIOException(e); } } return writer; }
Source:
<code>public void perform(GraphRewrite event, EvaluationContext context, XmlFileModel sourceFile) { XmlFileService xmlFileService = new XmlFileService(event.getGraphContext()); Document document = xmlFileService.loadDocumentQuiet(context, sourceFile); String xsdUrl = getXSDSchemaLocationUrl(document); try { if(xsdUrl != null && !xsdUrl.isEmpty() && !isXmlValid(sourceFile,xsdUrl)) { ClassificationService classificationService = new ClassificationService(event.getGraphContext()); ClassificationModel model =classificationService.attachClassification(context, sourceFile, XmlFileModel.NOT_VALID_XML, null); TagSetService tagSetService = new TagSetService(event.getGraphContext()); model.setTagModel(tagSetService.getOrCreate(event, Collections.singleton(NOT_VALID_XML_TAG))); } } catch (MalformedURLException e) { <START> e.printStackTrace(); <END> } catch (SAXException e) { final Throwable cause = e.getCause(); if(cause instanceof UnknownHostException) { } else if(cause instanceof FileNotFoundException) { FileLocationModel rootElementLocation = createLocationModelFromNodeElement(document.getDocumentElement(),event.getGraphContext(),sourceFile); final InlineHintModel inlineHintModel = InlineHintService.addTypeToModel(event.getGraphContext(), rootElementLocation, InlineHintModel.class); inlineHintModel.setTitle(XmlFileModel.XSD_URL_NOT_VALID); inlineHintModel.setHint(xsdUrl + " is not a valid url."); inlineHintModel.setEffort(1); } } }</code><technical_language>this add a hint well</technical_language>

Target:
public void perform(GraphRewrite event, EvaluationContext context, XmlFileModel sourceFile) { XmlFileService xmlFileService = new XmlFileService(event.getGraphContext()); Document document = xmlFileService.loadDocumentQuiet(context, sourceFile); String xsdUrl = getXSDSchemaLocationUrl(document); try { if(xsdUrl != null && !xsdUrl.isEmpty() && !isXmlValid(sourceFile,xsdUrl)) { ClassificationService classificationService = new ClassificationService(event.getGraphContext()); ClassificationModel model =classificationService.attachClassification(context, sourceFile, XmlFileModel.NOT_VALID_XML, null); TagSetService tagSetService = new TagSetService(event.getGraphContext()); model.setTagModel(tagSetService.getOrCreate(event, Collections.singleton(NOT_VALID_XML_TAG))); } } catch (MalformedURLException e) { FileLocationModel rootElementLocation = createLocationModelFromNodeElement(document.getDocumentElement(),event.getGraphContext(),sourceFile); createUrlNotValidHint(event.getGraphContext(), rootElementLocation, xsdUrl); } catch (Exception e) { final Throwable cause = e.getCause(); if(cause instanceof UnknownHostException) { } else if(cause instanceof FileNotFoundException) { FileLocationModel rootElementLocation = createLocationModelFromNodeElement(document.getDocumentElement(),event.getGraphContext(),sourceFile); createUrlNotValidHint(event.getGraphContext(),rootElementLocation,xsdUrl); } } }
Source:
<code>private RestResponse resetCounter(RestRequest request) throws RestResponseException { try { String counterName = request.variables().get("counterName"); NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); CounterConfiguration configuration = counterManager.getConfiguration(counterName); if (configuration == null) { return responseBuilder.status(HttpResponseStatus.NOT_FOUND.code()).entity("Counter not found").build(); } else { switch (configuration.type()) { case WEAK: <START> counterManager.getWeakCounter(counterName).reset(); <END> break; case BOUNDED_STRONG: case UNBOUNDED_STRONG: counterManager.getStrongCounter(counterName).reset(); break; } } responseBuilder.status(HttpResponseStatus.OK.code()); return responseBuilder.build(); } catch (CacheException e) { throw new RestResponseException(e); } }</code><technical_language>wait for reset() complete for reason above. (same for strong counter)</technical_language>

Target:
private RestResponse resetCounter(RestRequest request) throws RestResponseException { try { String counterName = request.variables().get("counterName"); NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); CounterConfiguration configuration = counterManager.getConfiguration(counterName); if (configuration == null) { return responseBuilder.status(HttpResponseStatus.NOT_FOUND.code()).entity("Counter not found").build(); } else { switch (configuration.type()) { case WEAK: counterManager.getWeakCounter(counterName).reset().get(1, TimeUnit.MINUTES); break; case BOUNDED_STRONG: case UNBOUNDED_STRONG: counterManager.getStrongCounter(counterName).reset().get(1, TimeUnit.MINUTES); break; } } responseBuilder.status(HttpResponseStatus.OK.code()); return responseBuilder.build(); } catch (Exception e) { throw new RestResponseException(e); } }
Source:
<code>private void report(ConstraintCheckIssue issue, Kind kind) { String message = errorMessages.getString( issue.getMessageKey() ); if ( issue.getMessageParameters() != null ) { <START> message = new MessageFormat( message, Locale.ENGLISH ).format( issue.getMessageParameters() ); <END> } messager.printMessage( kind, message, issue.getElement(), issue.getAnnotationMirror() ); }</code><technical_language>Is a reason String.format here</technical_language>

Target:
private void report(ConstraintCheckIssue issue, Kind kind) { String message = errorMessages.getString( issue.getMessageKey() ); if ( issue.getMessageParameters() != null ) { message = MessageFormat.format( message, issue.getMessageParameters() ); } messager.printMessage( kind, message, issue.getElement(), issue.getAnnotationMirror() ); }
Source:
<code>public void update(Observable observable, Object rawMessage) { NativeInterface.Message message = parseMessage(rawMessage); if (message == null) { return; } <START> Object arg = message.value; <END> switch (message.type) { case INSTALL: handleInstallMessage(arg); break; case ADD_BREADCRUMB: handleAddBreadcrumb(arg); break; case ADD_METADATA: handleAddMetadata(arg); break; case CLEAR_BREADCRUMBS: clearBreadcrumbs(); break; case CLEAR_METADATA_TAB: handleClearMetadataTab(arg); break; case NOTIFY_HANDLED: addHandledEvent(); break; case REMOVE_METADATA: handleRemoveMetadata(arg); break; case START_SESSION: handleStartSession(arg); break; case UPDATE_APP_VERSION: handleAppVersionChange(arg); break; case UPDATE_BUILD_UUID: handleBuildUUIDChange(arg); break; case UPDATE_CONTEXT: handleContextChange(arg); break; case UPDATE_IN_FOREGROUND: handleForegroundActivityChange(arg); break; case UPDATE_LOW_MEMORY: handleLowMemoryChange(arg); break; case UPDATE_METADATA: handleUpdateMetadata(arg); break; case UPDATE_ORIENTATION: handleOrientationChange(arg); break; case UPDATE_RELEASE_STAGE: handleReleaseStageChange(arg); break; case UPDATE_USER_ID: handleUserIdChange(arg); break; case UPDATE_USER_NAME: handleUserNameChange(arg); break; case UPDATE_USER_EMAIL: handleUserEmailChange(arg); break; default: } }</code><technical_language>I this accounts for a scenario calls client.setLoggingEnabled(false) initialisation. worth encapsulating additional warn methods Logger class resolve this</technical_language>

Target:
public void update(Observable observable, Object rawMessage) { NativeInterface.Message message = parseMessage(rawMessage); if (message == null) { return; } Object arg = message.value; switch (message.type) { case INSTALL: handleInstallMessage(arg); break; case DELIVER_PENDING: deliverPendingReports(); break; case ADD_BREADCRUMB: handleAddBreadcrumb(arg); break; case ADD_METADATA: handleAddMetadata(arg); break; case CLEAR_BREADCRUMBS: clearBreadcrumbs(); break; case CLEAR_METADATA_TAB: handleClearMetadataTab(arg); break; case NOTIFY_HANDLED: addHandledEvent(); break; case REMOVE_METADATA: handleRemoveMetadata(arg); break; case START_SESSION: handleStartSession(arg); break; case UPDATE_APP_VERSION: handleAppVersionChange(arg); break; case UPDATE_BUILD_UUID: handleBuildUUIDChange(arg); break; case UPDATE_CONTEXT: handleContextChange(arg); break; case UPDATE_IN_FOREGROUND: handleForegroundActivityChange(arg); break; case UPDATE_LOW_MEMORY: handleLowMemoryChange(arg); break; case UPDATE_METADATA: handleUpdateMetadata(arg); break; case UPDATE_ORIENTATION: handleOrientationChange(arg); break; case UPDATE_RELEASE_STAGE: handleReleaseStageChange(arg); break; case UPDATE_USER_ID: handleUserIdChange(arg); break; case UPDATE_USER_NAME: handleUserNameChange(arg); break; case UPDATE_USER_EMAIL: handleUserEmailChange(arg); break; default: } }
Source:
<code><START> public HttpTGTProfile() { <END> this.ticketGrantingTicketId = null; }</code><technical_language>identifier: yes, TGT, a valid option, theoretically speaking, prefer more long lasting a username. toString() call more relevant. more argument: more consistent do for OAuth Facebook for example a real technical identifier (close username) access token a property (close TGT)</technical_language>

Target:
public HttpTGTProfile() { this.ticketGrantingTicketId = null; this.userName = null; }
Source:
<code>public long calcBuffer(long time, long timespan) { universe.calculateBuffer(time); universe.calculateBuffer(time + timespan); try { <START> Thread.sleep(200); <END> } catch (InterruptedException e) { logger.error("failed to sleep for 200 ms"); } return time + timespan; }</code><technical_language>This tests unstable. Please a waitForAssert call</technical_language>

Target:
public long calcBuffer(long time, long timespan) { universe.calculateBuffer(time); universe.calculateBuffer(time + timespan); logger.debug("calculated buffer for to (difference {})", time, time + timespan, timespan); return time + timespan; }
Source:
<code>public MockPort() throws UnknownHostException { <START> super(null, null, new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 21212), pool, null); <END> }</code><technical_language>tests SSL. dont depend server</technical_language>

Target:
public MockPort() throws UnknownHostException { super(null, null, new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 21212), pool); }
Source:
<code>private Element processServerSideElements(Document doc, ClusteringServiceConfiguration clusteringServiceConfiguration) { Element serverSideConfigurationElem = createServerSideConfigurationElement(doc, clusteringServiceConfiguration); if (clusteringServiceConfiguration.getServerConfiguration() != null) { ServerSideConfiguration serverSideConfiguration = clusteringServiceConfiguration.getServerConfiguration(); String defaultServerResource = serverSideConfiguration.getDefaultServerResource(); if (!(defaultServerResource == null || defaultServerResource.trim().length() == 0)) { Element defaultResourceElement = createDefaultServerResourceElement(doc, defaultServerResource); serverSideConfigurationElem.appendChild(defaultResourceElement); } Map<String, ServerSideConfiguration.Pool> resourcePools = serverSideConfiguration.getResourcePools(); <START> if (!(resourcePools == null || resourcePools.isEmpty())) { <END> resourcePools.forEach( (key, value) -> { Element poolElement = createSharedPoolElement(doc, key, value); serverSideConfigurationElem.appendChild(poolElement); } ); } } return serverSideConfigurationElem; }</code><technical_language>need call isEmpty() forEach works empty collection. Also, is legal for getResourcePools() return null? If allow - this code blow NPE</technical_language>

Target:
private Element processServerSideElements(Document doc, ClusteringServiceConfiguration clusteringServiceConfiguration) { Element serverSideConfigurationElem = createServerSideConfigurationElement(doc, clusteringServiceConfiguration); if (clusteringServiceConfiguration.getServerConfiguration() != null) { ServerSideConfiguration serverSideConfiguration = clusteringServiceConfiguration.getServerConfiguration(); String defaultServerResource = serverSideConfiguration.getDefaultServerResource(); if (!(defaultServerResource == null || defaultServerResource.trim().length() == 0)) { Element defaultResourceElement = createDefaultServerResourceElement(doc, defaultServerResource); serverSideConfigurationElem.appendChild(defaultResourceElement); } Map<String, ServerSideConfiguration.Pool> resourcePools = serverSideConfiguration.getResourcePools(); if (resourcePools != null) { resourcePools.forEach( (key, value) -> { Element poolElement = createSharedPoolElement(doc, key, value); serverSideConfigurationElem.appendChild(poolElement); } ); } } return serverSideConfigurationElem; }
Source:
<code>public void setup() { <START> MockitoAnnotations.initMocks(this); <END> msgUtil = Mockito.mock(ErrorMessageUtil.class); Mockito.when(msgUtil.getMessage(ArgumentMatchers.eq("listing.duplicateTestingLab"), ArgumentMatchers.anyString())) .thenAnswer(i -> String.format(ERR_MSG, i.getArgument(1), "")); reviewer = new AtlDuplicateReviewer(msgUtil); }</code><technical_language>this is necessary, Mockito annotation of classes private members</technical_language>

Target:
public void setup() { msgUtil = Mockito.mock(ErrorMessageUtil.class); Mockito.when(msgUtil.getMessage(ArgumentMatchers.eq("listing.duplicateTestingLab"), ArgumentMatchers.anyString())) .thenAnswer(i -> String.format(ERR_MSG, i.getArgument(1), "")); reviewer = new AtlDuplicateReviewer(msgUtil); }
Source:
<code>@Override public void draw(Canvas canvas) { if (!animating) { super.draw(canvas); } else { boolean useColorMatrixTransition = getPaint().getColorFilter() == null; long duration = useColorMatrixTransition ? TRANSITION.getDuration() : DEFAULT_FADE_DURATION; float fraction = (SystemClock.uptimeMillis() - startTimeMillis) / (float) duration; if (fraction >= 1f) { animating = false; placeholder = null; super.draw(canvas); } else { if (placeholder != null) { placeholder.draw(canvas); } if (useColorMatrixTransition) { colorMatrix.reset(); TRANSITION.apply(colorMatrix, fraction); colorMatrix.getArray()[ROW_ALPHA + COLUMN_ALPHA] *= (alpha / 255); <START> super.setColorFilter(new ColorMatrixColorFilter(colorMatrix)); <END> super.draw(canvas); super.setColorFilter(null); } else { int partialAlpha = (int) (alpha * fraction); super.setAlpha(partialAlpha); super.draw(canvas); super.setAlpha(alpha); } if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { invalidateSelf(); } } } if (debugging) { drawDebugIndicator(canvas); } }</code><technical_language>Ugh :(</technical_language>

Target:
@Override public void draw(Canvas canvas) { if (!animating) { super.draw(canvas); } else { boolean useColorMatrixTransition = getPaint().getColorFilter() == null; long duration = useColorMatrixTransition ? TRANSITION.getDuration() : DEFAULT_FADE_DURATION; float fraction = (SystemClock.uptimeMillis() - startTimeMillis) / (float) duration; if (fraction >= 1f) { animating = false; placeholder = null; super.draw(canvas); } else { if (placeholder != null) { placeholder.draw(canvas); } if (useColorMatrixTransition) { if (colorMatrix == null) { colorMatrix = new ColorMatrix(); } else { colorMatrix.reset(); } TRANSITION.apply(colorMatrix, fraction); colorMatrix.getArray()[ROW_ALPHA + COLUMN_ALPHA] *= (alpha / 255); super.setColorFilter(new ColorMatrixColorFilter(colorMatrix)); super.draw(canvas); super.setColorFilter(null); } else { int partialAlpha = (int) (alpha * fraction); super.setAlpha(partialAlpha); super.draw(canvas); super.setAlpha(alpha); } if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { invalidateSelf(); } } } if (debugging) { drawDebugIndicator(canvas); } }
Source:
<code>private void print(final Request req, final OutputStream output, final boolean keep) throws IOException { try { final Response res = this.retrieveResponse(req, keep); <START> new RsPrint(res).print(output); <END> } catch (final HttpException ex) { new RsPrint(BkBasic.failure(ex, ex.code())).print(output); } catch (final Throwable ex) { new RsPrint( BkBasic.failure( ex, HttpURLConnection.HTTP_INTERNAL_ERROR ) ).print(output); } finally { output.close(); } }</code><technical_language>@mstzn36 res inline, right</technical_language>

Target:
private void print(final Request req, final OutputStream output, final boolean keep) throws IOException { try { new RsPrint( this.response(req, keep) ).print(output); } catch (final HttpException ex) { new RsPrint(BkBasic.failure(ex, ex.code())).print(output); } catch (final Throwable ex) { new RsPrint( BkBasic.failure( ex, HttpURLConnection.HTTP_INTERNAL_ERROR ) ).print(output); } finally { output.close(); } }
Source:
<code>public String getDescription() { <START> return "Project name of the file currently selected in editor"; <END> }</code><technical_language>kind of messages a localized constant</technical_language>

Target:
public String getDescription() { return localizationConstants.macroEditorCurrentProjectNameDescription(); }
Source:
<code>public void setLoggingEnabled(boolean enabled) { <START> delegate.setLoggingEnabled(enabled); <END> }</code><technical_language>Minor: this., anyway..</technical_language>

Target:
public void setLoggingEnabled(boolean enabled) { this.delegate.setLoggingEnabled(enabled); }
Source:
<code>private Object convertTextToJson(Object content, Charset contentCharset, Charset destinationCharset, boolean asString) throws IOException { <START> byte[] bytes = content instanceof byte[] ? (byte[]) content : content.toString().getBytes(); <END> try (InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(bytes), contentCharset)) { String jsonTree = objectMapper.readTree(isr).toString(); return asString ? jsonTree : jsonTree.getBytes(destinationCharset); } catch (IOException e) { String contentAsString = new String(bytes, contentCharset); return asString ? objectMapper.writeValueAsString(contentAsString) : objectMapper.writeValueAsBytes(contentAsString); } }</code><technical_language>getBytes() encoding</technical_language>

Target:
private Object convertTextToJson(Object content, Charset contentCharset, Charset destinationCharset, boolean asString) throws IOException { byte[] bytes = content instanceof byte[] ? (byte[]) content : content.toString().getBytes(contentCharset); try (InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(bytes), contentCharset)) { String jsonTree = objectMapper.readTree(isr).toString(); return asString ? jsonTree : jsonTree.getBytes(destinationCharset); } catch (IOException e) { String contentAsString = new String(bytes, contentCharset); return asString ? objectMapper.writeValueAsString(contentAsString) : objectMapper.writeValueAsBytes(contentAsString); } }
Source:
<code>private boolean hasClassesToNewify() { <START> return (classesToNewify != null && !classesToNewify.getExpressions().isEmpty()) || (classNamePattern != null); END> }</code><technical_language>I TODO here, refine later</technical_language>

Target:
private boolean hasClassesToNewify() { return classesToNewify != null && !classesToNewify.getExpressions().isEmpty(); }
Source:
<code>protected void connectAllHostsToStorage(List<String> connectionIds) { final List<StorageServerConnections> connections = getDbFacade().getStorageServerConnectionDao().getByIds(connectionIds); List<VDS> hosts = getVdsDAO().getAllForStoragePoolAndStatus(getIscsiBond().getStoragePoolId(), VDSStatus.Up); for (final VDS host : hosts) { try { final List<StorageServerConnections> conns = ISCSIStorageHelper.updateIfaces(connections, host.getId()); runVdsCommand(VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(host.getId(), Guid.Empty, StorageType.ISCSI, conns) ); } catch (VdcBLLException e) { log.errorFormat("Could not connect Host {0} - {1} to Iscsi Storage Server. The exception is: {2}", host.getName(), host.getId(), e); } } <START> } <END></code><technical_language>I this code do changing current multithreaded approach: for (final VDS host : hosts) { tasks.add(new Callable<Void>() { @Override public Void call() throws Exception { try { final List<StorageServerConnections> conns = ISCSIStorageHelper.updateIfaces(connections, host.getId()); runVdsCommand(VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(host.getId(), Guid.Empty, StorageType.ISCSI, conns) ); } catch (VdcBLLException e) { ... } return null; } }); }</technical_language>

Target:
protected void connectAllHostsToStorage(List<String> connectionIds) { List<Callable<Void>> tasks = new ArrayList<>(); final List<StorageServerConnections> connections = getDbFacade().getStorageServerConnectionDao().getByIds(connectionIds); List<VDS> hosts = getVdsDAO().getAllForStoragePoolAndStatus(getIscsiBond().getStoragePoolId(), VDSStatus.Up); for (final VDS host : hosts) { tasks.add(new Callable<Void>() { @Override public Void call() throws Exception { try { final List<StorageServerConnections> conns = ISCSIStorageHelper.updateIfaces(connections, host.getId()); runVdsCommand(VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(host.getId(), Guid.Empty, StorageType.ISCSI, conns) ); } catch (VdcBLLException e) { log.errorFormat("Could not connect Host {0} - {1} to Iscsi Storage Server. The exception is: {2}", host.getName(), host.getId(), e); } return null; } }); } ThreadPoolUtil.invokeAll(tasks); }
Source:
<code>public void run() { ui.header("Git Repositories"); File d = gerrit.path("Location of Git repositories", "basePath", "git"); if (d == null) { throw die("gerrit.basePath is required"); } mkdirs(d); <START> mkdirs(site.resolve("notedb")); <END> }</code><technical_language>some point later, want (with question) in init step, though</technical_language>

Target:
public void run() { ui.header("Git Repositories"); File d = gerrit.path("Location of Git repositories", "basePath", "git"); if (d == null) { throw die("gerrit.basePath is required"); } if (!d.exists() && !d.mkdirs()) { throw die("Cannot create " + d); } }
Source:
<code>public static <T, R> List<R> mappedCopy(List<T> elements, Function<T, R> mapper) { return elements.stream() .map(mapper) <START> .collect(toImmutableList()); <END> }</code><technical_language>requireNonNull</technical_language>

Target:
public static <T, R> List<R> mappedCopy(List<T> elements, Function<T, R> mapper) { requireNonNull(elements, "elements is null"); requireNonNull(mapper, "mapper is null"); return elements.stream() .map(mapper) .collect(toImmutableList()); }
Source:
<code><START> public boolean primaryIsManual() { return primaryTarget.exists(manualTargets::contains); } <END></code><technical_language>if BAGS runs finds existing manual guide star</technical_language>

Target:
public boolean primaryIsManual() { return primaryTarget.isDefined() && !primaryIsBagsTarget(); }
Source:
<code>public void endFile() { if (batchRequest != null) { sendBatch(rows); } BatchUpdateSpreadsheetRequest requestBody = new BatchUpdateSpreadsheetRequest(); requestBody.setIncludeSpreadsheetInResponse(false); requestBody.setRequests(requests); Sheets.Spreadsheets.BatchUpdate request; try { logger.info("spreadsheetId: " + spreadsheetId); <START> logger.info("requestBody:" + requestBody.toString()); <END> request = service.spreadsheets().batchUpdate(spreadsheetId, requestBody); BatchUpdateSpreadsheetResponse response = request.execute(); logger.info("response:" + response.toPrettyString()); } catch (IOException e) { exceptions.add(e); } }</code><technical_language>I assume remove this logging request body (and response below) verbose</technical_language>

Target:
public void endFile() { if (batchRequest != null) { sendBatch(rows); } BatchUpdateSpreadsheetRequest requestBody = new BatchUpdateSpreadsheetRequest(); requestBody.setIncludeSpreadsheetInResponse(false); requestBody.setRequests(requests); Sheets.Spreadsheets.BatchUpdate request; try { logger.debug("spreadsheetId: " + spreadsheetId); logger.debug("requestBody:" + requestBody.toString()); request = service.spreadsheets().batchUpdate(spreadsheetId, requestBody); BatchUpdateSpreadsheetResponse response = request.execute(); logger.debug("response:" + response.toPrettyString()); } catch (IOException e) { exceptions.add(e); } }
Source:
<code>public static void injectMessageBus(SingleNodeApplication application, AbstractTestMessageBus testMessageBus) { ConfigurableApplicationContext containerContext = application.getContainerContext(); StreamPlugin streamPlugin = containerContext.getBean(StreamPlugin.class); ModuleDeployer moduleDeployer = containerContext.getBean(ModuleDeployer.class); RootBeanDefinition bDefinition = new RootBeanDefinition(TestStreamPlugin.class); ConstructorArgumentValues constructorArgumentValues = new ConstructorArgumentValues(); constructorArgumentValues.addIndexedArgumentValue(0, streamPlugin); constructorArgumentValues.addIndexedArgumentValue(1, testMessageBus); bDefinition.setConstructorArgumentValues(constructorArgumentValues); <START> bDefinition.setAttribute("streamPlugin", streamPlugin); <END> bDefinition.setAttribute("testMessageBus", testMessageBus); BeanDefinitionRegistry bdr = (BeanDefinitionRegistry) containerContext.getBeanFactory(); bdr.removeBeanDefinition(STREAM_PLUGIN_BEAN_ID); bdr.registerBeanDefinition(STREAM_PLUGIN_BEAN_ID, bDefinition); moduleDeployer.onInit(); }</code><technical_language>2 attributes needed</technical_language>

Target:
public static void injectMessageBus(SingleNodeApplication application, AbstractTestMessageBus testMessageBus) { ConfigurableApplicationContext containerContext = application.getContainerContext(); StreamPlugin streamPlugin = containerContext.getBean(StreamPlugin.class); ModuleDeployer moduleDeployer = containerContext.getBean(ModuleDeployer.class); RootBeanDefinition bDefinition = new RootBeanDefinition(TestStreamPlugin.class); ConstructorArgumentValues constructorArgumentValues = new ConstructorArgumentValues(); constructorArgumentValues.addIndexedArgumentValue(0, streamPlugin); constructorArgumentValues.addIndexedArgumentValue(1, testMessageBus); bDefinition.setConstructorArgumentValues(constructorArgumentValues); BeanDefinitionRegistry bdr = (BeanDefinitionRegistry) containerContext.getBeanFactory(); bdr.removeBeanDefinition(STREAM_PLUGIN_BEAN_ID); bdr.registerBeanDefinition(STREAM_PLUGIN_BEAN_ID, bDefinition); moduleDeployer.onInit(); }
Source:
<code>public void close() throws Exception { mutator.close(); session.close(); <START> } <END></code><technical_language>This is return a future now. in Managed correctly serialize shutdown (now mutator shuts down, _then_ session in a single thread). java public void AsyncFuture<Void> close() { return async.collectAndDiscard(ImmutableList.of(mutator.close(), session.close())); }</technical_language>

Target:
public AsyncFuture<Void> close() { final AsyncFuture<Void> closeSession = async.call(() -> { session.close(); return null; }); return async.collectAndDiscard(ImmutableList.of(mutator.close(), closeSession)); }
Source:
<code><START> public static boolean isPacketMarked(byte[] buffer, int offset, int length) <END> { return (buffer[offset + 1] & 0x80) != 0; }</code><technical_language>please move this static method top of file sanity check length</technical_language>

Target:
public static boolean isPacketMarked(byte[] buffer, int offset, int length) { if (buffer == null || buffer.length < offset + length || length < 2) { return false; } return (buffer[offset + 1] & 0x80) != 0; }
Source:
<code><START> protected Server updateServerStatus(Server server) { <END> try { Thread.sleep(5000); } catch (InterruptedException ex) { Logger.getLogger(ServerApiLiveTest.class.getName()).log(Level.SEVERE, null, ex); } return api.serverApi().get(server.id()); }</code><technical_language>do need this? Is this a common pattern users need consuming this api? If this is case, consider providing predicates block resource is ready</technical_language>

Target:
protected Server updateServerStatus(Server server) { assertNodeAvailable(server); return api.serverApi().get(server.id()); }
Source:
<code>ShardConsumer(ShardInfo shardInfo, StreamConfig streamConfig, ICheckpoint checkpoint, IRecordProcessor recordProcessor, RecordProcessorCheckpointer recordProcessorCheckpointer, ILeaseManager<KinesisClientLease> leaseManager, long parentShardPollIntervalMillis, boolean cleanupLeasesOfCompletedShards, ExecutorService executorService, IMetricsFactory metricsFactory, long backoffTimeMillis, boolean skipShardSyncAtWorkerInitializationIfLeasesExist, KinesisDataFetcher kinesisDataFetcher, Optional<Integer> retryGetRecordsInSeconds, Optional<Integer> maxGetRecordsThreadPool, KinesisClientLibConfiguration config) { this.shardInfo = shardInfo; this.streamConfig = streamConfig; this.checkpoint = checkpoint; this.recordProcessor = recordProcessor; this.recordProcessorCheckpointer = recordProcessorCheckpointer; this.leaseManager = leaseManager; this.parentShardPollIntervalMillis = parentShardPollIntervalMillis; this.cleanupLeasesOfCompletedShards = cleanupLeasesOfCompletedShards; this.executorService = executorService; this.metricsFactory = metricsFactory; this.taskBackoffTimeMillis = backoffTimeMillis; this.skipShardSyncAtWorkerInitializationIfLeasesExist = skipShardSyncAtWorkerInitializationIfLeasesExist; this.config = config; this.dataFetcher = kinesisDataFetcher; this.getRecordsCache = config.getRecordsFetcherFactory().createRecordsFetcher( makeStrategy(this.dataFetcher, retryGetRecordsInSeconds, maxGetRecordsThreadPool, this.shardInfo), <START> this.getShardInfo().getShardId(), metricsFactory, "ProcessTask"); <END> }</code><technical_language>this.metricsFactory instead of metricsFactory</technical_language>

Target:
ShardConsumer(ShardInfo shardInfo, StreamConfig streamConfig, ICheckpoint checkpoint, IRecordProcessor recordProcessor, RecordProcessorCheckpointer recordProcessorCheckpointer, ILeaseManager<KinesisClientLease> leaseManager, long parentShardPollIntervalMillis, boolean cleanupLeasesOfCompletedShards, ExecutorService executorService, IMetricsFactory metricsFactory, long backoffTimeMillis, boolean skipShardSyncAtWorkerInitializationIfLeasesExist, KinesisDataFetcher kinesisDataFetcher, Optional<Integer> retryGetRecordsInSeconds, Optional<Integer> maxGetRecordsThreadPool, KinesisClientLibConfiguration config) { this.shardInfo = shardInfo; this.streamConfig = streamConfig; this.checkpoint = checkpoint; this.recordProcessor = recordProcessor; this.recordProcessorCheckpointer = recordProcessorCheckpointer; this.leaseManager = leaseManager; this.parentShardPollIntervalMillis = parentShardPollIntervalMillis; this.cleanupLeasesOfCompletedShards = cleanupLeasesOfCompletedShards; this.executorService = executorService; this.metricsFactory = metricsFactory; this.taskBackoffTimeMillis = backoffTimeMillis; this.skipShardSyncAtWorkerInitializationIfLeasesExist = skipShardSyncAtWorkerInitializationIfLeasesExist; this.config = config; this.dataFetcher = kinesisDataFetcher; this.getRecordsCache = config.getRecordsFetcherFactory().createRecordsFetcher( makeStrategy(this.dataFetcher, retryGetRecordsInSeconds, maxGetRecordsThreadPool, this.shardInfo), this.getShardInfo().getShardId(), this.metricsFactory); }
Source:
<code>default void contextInitialized(ServletContextEvent event) { if (event.getServletContext().getAttribute(ATTR) == null) { try { init(event); } catch (Exception e) { event.getServletContext().setAttribute(ATTR, true); <START> throw new RuntimeException("Unable to initialize " <END> + this.getClass().getName(), e); } } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Define throw a dedicated exception instead of a generic one. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
default void contextInitialized(ServletContextEvent event) { if (event.getServletContext().getAttribute(ATTR) == null) { try { failFastContextInitialized(event); } catch (Exception e) { event.getServletContext().setAttribute(ATTR, true); throw new RuntimeException("Unable to initialize " + this.getClass().getName(), e); } } }
Source:
<code>public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory, NamedQueries namedQueries) { GraphQueryMethod queryMethod = new GraphQueryMethod(method, metadata, factory); queryMethod.setMappingContext(this.mappingContext); String namedQueryName = queryMethod.getNamedQueryName(); String namedCountQueryName = queryMethod.getNamedCountQueryName(); if (namedQueries.hasQuery(namedQueryName)) { String cypherQuery = namedQueries.getQuery(namedQueryName); <START> String countQuery = ""; <END> if (namedQueries.hasQuery(namedCountQueryName)){ countQuery = namedQueries.getQuery(namedCountQueryName); } return new NamedGraphRepositoryQuery(queryMethod, metaData, session, cypherQuery, countQuery, evaluationContextProvider); } else if (queryMethod.hasAnnotatedQuery()) { return new GraphRepositoryQuery(queryMethod, metaData, session, evaluationContextProvider); } else { return new PartTreeNeo4jQuery(queryMethod, metaData, session); } }</code><technical_language>Ah. I see. I read bottom top I prefer this null</technical_language>

Target:
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory, NamedQueries namedQueries) { GraphQueryMethod queryMethod = new GraphQueryMethod(method, metadata, factory); queryMethod.setMappingContext(this.mappingContext); String namedQueryName = queryMethod.getNamedQueryName(); String namedCountQueryName = queryMethod.getNamedCountQueryName(); if (namedQueries.hasQuery(namedQueryName)) { String cypherQuery = namedQueries.getQuery(namedQueryName); if (namedQueries.hasQuery(namedCountQueryName)){ String countQuery = namedQueries.getQuery(namedCountQueryName); return new NamedGraphRepositoryQuery(queryMethod, metaData, session, cypherQuery, countQuery, evaluationContextProvider); } return new NamedGraphRepositoryQuery(queryMethod, metaData, session, cypherQuery, evaluationContextProvider); } else if (queryMethod.hasAnnotatedQuery()) { return new GraphRepositoryQuery(queryMethod, metaData, session, evaluationContextProvider); } else { return new PartTreeNeo4jQuery(queryMethod, metaData, session); } }
Source:
<code>private void deleteServer() { <START> System.out.format("Delete Server%n"); <END> Set<? extends NodeMetadata> servers = computeService.destroyNodesMatching(inGroup(NAME)); for (NodeMetadata nodeMetadata: servers) { System.out.format(" %s%n", nodeMetadata); } }</code><technical_language>format("Delete Servers in group %s%n", NAME)</technical_language>

Target:
private void deleteServer() { System.out.format("Delete Servers in group %s%n", NAME); Set<? extends NodeMetadata> servers = computeService.destroyNodesMatching(inGroup(NAME)); for (NodeMetadata server : servers) { System.out.format(" %s%n", server); } }
Source:
<code>private boolean isSoftAssertionStatement(ASTStatementExpression expression, Map<String, VariableNameDeclaration> variables) { if (expression != null) { ASTPrimaryExpression pe = expression.getFirstChildOfType(ASTPrimaryExpression.class); if (pe != null) { Node name = pe.getFirstDescendantOfType(ASTName.class); if (name != null) { String img = name.getImage(); if (img.indexOf(".") == -1) { return false; } String[] tokens = img.split("\\."); String methodName = tokens[1]; boolean methodIsAssertAll = "assertAll".equals(methodName); String varName = tokens[0]; <START> boolean variableTypeIsSoftAssertion = variables.containsKey(varName) && variables.get(varName).getTypeImage().endsWith("SoftAssertions"); <END> return methodIsAssertAll && variableTypeIsSoftAssertion; } } } return false; }</code><technical_language>net.sourceforge.pmd.lang.java.typeresolution.TypeHelper.isA(TypeNode, String) for type check, e.g. TypeHelper.isA(variables.get(varName), "org.assertj.core.api.SoftAssertions"). Note: need add a method in TypeHelper, deals a TypeNameDeclaration a class String</technical_language>

Target:
private boolean isSoftAssertionStatement(ASTStatementExpression expression, Map<String, VariableNameDeclaration> variables) { if (expression != null) { ASTPrimaryExpression pe = expression.getFirstChildOfType(ASTPrimaryExpression.class); if (pe != null) { Node name = pe.getFirstDescendantOfType(ASTName.class); if (name != null) { String img = name.getImage(); if (img.indexOf(".") == -1) { return false; } String[] tokens = img.split("\\."); String methodName = tokens[1]; boolean methodIsAssertAll = "assertAll".equals(methodName); String varName = tokens[0]; boolean variableTypeIsSoftAssertion = variables.containsKey(varName) && TypeHelper.isA(variables.get(varName), "org.assertj.core.api.AbstractSoftAssertions"); return methodIsAssertAll && variableTypeIsSoftAssertion; } } } return false; }
Source:
<code>private static void testWrapping(ByteBuffer buffer) { for (int i = 0; i < 50; i++) { buffer.put((byte) i); } Slice slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 50); for (int i = 0; i < 50; i++) { assertEquals(slice.getByte(i), i); } buffer.position(20).limit(30); slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 30); for (int i = 0; i < 30; i++) { <START> assertEquals(slice.getByte(i), i); <END> } buffer = buffer.slice(); slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 10); for (int i = 0; i < 10; i++) { assertEquals(slice.getByte(i), i + 20); } }</code><technical_language>This test needs updated. slice start position 20, comparing i + 20</technical_language>

Target:
private static void testWrapping(ByteBuffer buffer) { for (int i = 0; i < 50; i++) { buffer.put((byte) i); } buffer.rewind(); Slice slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 50); for (int i = 0; i < 50; i++) { assertEquals(slice.getByte(i), i); } buffer.position(10).limit(30); slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 20); for (int i = 0; i < 20; i++) { assertEquals(slice.getByte(i), i + 10); } buffer = buffer.slice(); slice = Slices.wrappedBuffer(buffer); assertEquals(slice.length(), 20); for (int i = 0; i < 20; i++) { assertEquals(slice.getByte(i), i + 10); } }
Source:
<code>private static MultiPath create(final MultiPath path, final double w, final double h, final double voffset) { path.M(0, 0).L(w, 0).L(w + voffset, h / 2).L(w, h).L(0, h).L(voffset, h / 2).L(0, 0).Z().close(); return path <START> .setFillColor("#F9FAD2") <END> .setStrokeColor(ColorName.BLACK); }</code><technical_language>here: This color is close Light Goldenrod Yellow, fafad2 instead of string literal</technical_language>

Target:
private static MultiPath create(final MultiPath path, final double w, final double h, final double voffset) { path.M(0, 0).L(w, 0).L(w + voffset, h / 2).L(w, h).L(0, h).L(voffset, h / 2).L(0, 0).Z().close(); return path .setFillColor(ColorName.LIGHTGOLDENRODYELLOW) .setStrokeColor(ColorName.BLACK); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JdbcExtractionNamespace that = (JdbcExtractionNamespace) o; if (!connectorConfig.equals(that.connectorConfig)) { return false; } if (!table.equals(that.table)) { return false; } if (!keyColumn.equals(that.keyColumn)) { return false; } if (!valueColumn.equals(that.valueColumn)) { return false; } <START> if (filter != null ? !filter.equals(that.filter) : that.filter != null) { <END> return false; } if (tsColumn != null ? !tsColumn.equals(that.tsColumn) : that.tsColumn != null) { return false; } return pollPeriod.equals(that.pollPeriod); }</code><technical_language>Please migrate this equals() Objects.equals()</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JdbcExtractionNamespace that = (JdbcExtractionNamespace) o; return Objects.equals(connectorConfig, that.connectorConfig) && Objects.equals(table, that.table) && Objects.equals(filter, that.filter) && Objects.equals(keyColumn, that.keyColumn) && Objects.equals(valueColumn, that.valueColumn) && Objects.equals(tsColumn, that.tsColumn) && Objects.equals(pollPeriod, that.pollPeriod); }
Source:
<code>private PropagatedDays recalculateSupertaskCompletionPercentage(Task task, TaskContainmentHierarchyFacade facade) { Task[] nestedTasks = facade.getNestedTasks(task); int completedDays = 0; long plannedDays = 0; if (nestedTasks.length > 0) { for (int i = 0; i < nestedTasks.length; i++) { Task next = nestedTasks[i]; PropagatedDays propagatedDays = recalculateSupertaskCompletionPercentage(next, facade); completedDays += propagatedDays.myCompletedDays; plannedDays += propagatedDays.myPlannedDays; } int completionPercentage = plannedDays == 0 ? 0 : (int) (completedDays / plannedDays); task.setCompletionPercentage(completionPercentage); } else { <START> long nextDuration = task.getDuration().getLength(); <END> completedDays += nextDuration * task.getCompletionPercentage(); plannedDays += nextDuration; } return new PropagatedDays(completedDays, plannedDays); }</code><technical_language>I suggest returning new PropagatedDays(nextDuration * task.getCompletionPercentage(), nextDuration) right moving accumulating vars previous branch of if</technical_language>

Target:
private SubtreeCompletion recalculateSupertaskCompletionPercentage(Task task, TaskContainmentHierarchyFacade facade) { Task[] nestedTasks = facade.getNestedTasks(task); if (nestedTasks.length == 0) { long nextDuration = task.getDuration().getLength(); return new SubtreeCompletion(nextDuration * task.getCompletionPercentage(), nextDuration); } long completedDays = 0; long plannedDays = 0; for (int i = 0; i < nestedTasks.length; i++) { Task next = nestedTasks[i]; SubtreeCompletion subtreeCompletion = recalculateSupertaskCompletionPercentage(next, facade); completedDays += subtreeCompletion.myCompletedDays; plannedDays += subtreeCompletion.myPlannedDays; } int completionPercentage = (plannedDays == 0) ? 0 : (int) (completedDays / plannedDays); task.setCompletionPercentage(completionPercentage); return new SubtreeCompletion(completedDays, plannedDays); }
Source:
<code>public InitCommand setDirectory(File directory) throws IllegalStateException { this.directory = directory; <START> validateDirs(); <END> return this; }</code><technical_language>I validate set member if validation succeeded</technical_language>

Target:
public InitCommand setDirectory(File directory) throws IllegalStateException { validateDirs(directory, gitDir, bare); this.directory = directory; return this; }
Source:
<code>public int getReceivedMessagesCountSinceUuid(String uuid) { if (uuid == null) { return 0; } int count = 0; for (int i = messages.size() - 1; i >= 0; i--) { <START> if (Objects.equals(messages.get(i).getUuid(), uuid)) { <END> return count; } if (messages.get(i).getStatus() <= Message.STATUS_RECEIVED) { count = count + 1; } } return 0; }</code><technical_language>is a reason simply uuid.equals(messages.get(i)....) here? uuid is null point this save</technical_language>

Target:
public int getReceivedMessagesCountSinceUuid(String uuid) { if (uuid == null) { return 0; } int count = 0; synchronized (this.messages) { for (int i = messages.size() - 1; i >= 0; i--) { final Message message = messages.get(i); if (uuid.equals(message.getUuid())) { return count; } if (message.getStatus() <= Message.STATUS_RECEIVED) { ++count; } } } return 0; }