auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static ColdStorageContentStatus checkColdStorageContentAvailability(CoreSession session) { <START> log.debug("Start checking the available cold storage content for repository: {}", session::getRepositoryName); <END> DocumentModelList documents = session.query(GET_DOCUMENTS_TO_CHECK_QUERY); int beingRetrieved = documents.size(); int available = 0; EventService eventService = Framework.getService(EventService.class); for (DocumentModel doc : documents) { if (isColdStorageContentAvailable(doc)) { available++; beingRetrieved--; DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), doc); Event event = ctx.newEvent(COLD_STORAGE_CONTENT_AVAILABLE_EVENT_NAME); eventService.fireEvent(event); } } log.debug( "End checking the available cold storage content for repository: {}, beingRetrieved: {}, available: {}", session.getRepositoryName(), beingRetrieved, available); return new ColdStorageContentStatus(session.getRepositoryName(), beingRetrieved, available); }</code><technical_language>point of storing numberOfDaysOfAvailability effective end date, (it's advisory S3, precisely timezone mechanics (or change)). usage for it? a blob status query check restore / availability return this info S3 anyway</technical_language>

Target:
public static ColdStorageContentStatus checkColdStorageContentAvailability(CoreSession session) { log.debug("Start checking the available cold storage content for repository: {}", session::getRepositoryName); DocumentModelList documents = session.query(GET_DOCUMENTS_TO_CHECK_QUERY); int beingRetrieved = documents.size(); int available = 0; EventService eventService = Framework.getService(EventService.class); DownloadService downloadService = Framework.getService(DownloadService.class); for (DocumentModel doc : documents) { Blob coldContent = (Blob) doc.getPropertyValue(COLD_STORAGE_CONTENT_PROPERTY); BlobStatus blobStatus; try { blobStatus = Framework.getService(BlobManager.class) .getBlobProvider(coldContent) .getStatus((ManagedBlob) coldContent); } catch (IOException e) { log.error("Unable to get the cold storage blob status for document: {}", doc, e); continue; } if (blobStatus.downloadable) { available++; beingRetrieved--; doc.setPropertyValue(COLD_STORAGE_BEING_RETRIEVED_PROPERTY, false); session.saveDocument(doc); DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), doc); Instant downloadableUntil = blobStatus.downloadableUntil; if (downloadableUntil != null) { ctx.getProperties() .put(COLD_STORAGE_CONTENT_AVAILABLE_UNTIL_MAIL_TEMPLATE_KEY, downloadableUntil.toString()); } String downloadUrl = downloadService.getDownloadUrl(doc, COLD_STORAGE_CONTENT_PROPERTY, null); ctx.getProperties().put(COLD_STORAGE_CONTENT_ARCHIVE_LOCATION_MAIL_TEMPLATE_KEY, downloadUrl); eventService.fireEvent(ctx.newEvent(COLD_STORAGE_CONTENT_AVAILABLE_EVENT_NAME)); } } log.debug( "End checking the available cold storage content for repository: {}, beingRetrieved: {}, available: {}", session.getRepositoryName(), beingRetrieved, available); return new ColdStorageContentStatus(beingRetrieved, available); }
Source:
<code>public void writeProperty(final OutputStream outputStream, final Property p) throws IOException { final Output output = new Output(outputStream); writeHeader(output); <START> kryo.writeObject(output, DetachedFactory.detach(p)); <END> output.flush(); }</code><technical_language>Is this lead a serialization format is compatible</technical_language>

Target:
public void writeProperty(final OutputStream outputStream, final Property p) throws IOException { final Output output = new Output(outputStream); writeHeader(output); kryo.writeObject(output, DetachedFactory.detach(p, true)); output.flush(); }
Source:
<code><START> public void testPageFetch() throws Throwable { <END> WikiSite wiki = new WikiSite("test.wikipedia.org"); PageTitle title = new PageTitle(null, "Test_page_for_app_testing/Section1", wiki); new EditPreviewClient().wikitext(wiki, title, 2, new EditPreviewClient.WikitextCallback() { @Override public void success(@NonNull String wikitext) { assertNotNull(wikitext); } @Override public void failure(@NonNull Throwable caught) { throw new RuntimeException(caught); } }); }</code><technical_language>I need @Test annotation here</technical_language>

Target:
public void testPageFetch() throws Throwable { WikiSite wiki = new WikiSite("test.wikipedia.org"); PageTitle title = new PageTitle(null, "Test_page_for_app_testing/Section1", wiki); new WikitextClient().request(wiki, title, 2, new WikitextClient.Callback() { @Override public void success(@NonNull String wikitext, @NonNull Call<Wikitext> call) { assertNotNull(wikitext); } @Override public void failure(@NonNull Throwable caught, @NonNull Call<Wikitext> call) { throw new RuntimeException(caught); } }); }
Source:
<code>public Object deserialize(final Writable blob) throws SerDeException { final Text t = (Text) blob; if (t.getLength() == 0) { if (!this.nullEmptyLines) { <START> throw new SerDeException("Encountered an empty row in the text file"); <END> } final int fieldCount = soi.getAllStructFieldRefs().size(); return Collections.nCopies(fieldCount, null); } try { return jsonReader.parseStruct( new ByteArrayInputStream((t.getBytes()), 0, t.getLength())); } catch (Exception e) { LOG.warn("Error parsing JSON text [{}].", t, e); throw new SerDeException(e); } }</code><technical_language>merging 2 ifs</technical_language>

Target:
public Object deserialize(final Writable blob) throws SerDeException { final Text t = (Text) blob; if (t.getLength() == 0) { if (!this.nullEmptyLines) { throw new SerDeException("Encountered an empty row in the text file"); } final int fieldCount = soi.getAllStructFieldRefs().size(); return Collections.nCopies(fieldCount, null); } try { return jsonReader.parseStruct( new ByteArrayInputStream((t.getBytes()), 0, t.getLength())); } catch (Exception e) { LOG.debug("Problem parsing JSON text [{}].", t, e); throw new SerDeException(e); } }
Source:
<code>protected void executeVdsBrokerCommand() { status = getBroker().glusterVolumeGeoRepSessionDelete(getParameters().getVolumeName(), <START> getParameters().getSlaveHost(), <END> getParameters().getVolumeName()); proceedProxyReturnValue(); }</code><technical_language>I u need pass slaveVolumeName here</technical_language>

Target:
protected void executeVdsBrokerCommand() { status = getBroker().glusterVolumeGeoRepSessionDelete(getParameters().getVolumeName(), getParameters().getSlaveHost(), getParameters().getSlaveVolume()); proceedProxyReturnValue(); }
Source:
<code>public void testCallingDecisionService() throws Exception { KieBase kbase = readKnowledgeBase(); KieSession ksession = createSession(kbase); BusinessRuleTaskHandler handler = new BusinessRuleTaskHandler(GROUP_ID, ARTIFACT_ID, <START> VERSION); <END> Map<String, Object> params = new HashMap<String, Object>(); params.put("Input", "Hello World"); WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("CallDecision", params); Object output = processInstance.getVariable("Output Decision"); assertEquals("Hello World", output); Object encapsulatedOutput = processInstance.getVariable("Encapsulated Output"); assertEquals(null, encapsulatedOutput); }</code><technical_language>This handler is all, please remove it</technical_language>

Target:
public void testCallingDecisionService() throws Exception { KieBase kbase = readKnowledgeBase(); KieSession ksession = createSession(kbase); Map<String, Object> params = new HashMap<String, Object>(); params.put("Input", "Hello World"); WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("CallDecision", params); Object output = processInstance.getVariable("Output Decision"); assertEquals("Hello World", output); Object encapsulatedOutput = processInstance.getVariable("Encapsulated Output"); assertEquals(null, encapsulatedOutput); }
Source:
<code>public boolean isEdgeWithRectilinearRoutingStyle() { boolean isEdgeRectilinearRoutingStyle = false; if <START> (Routing.RECTILINEAR_LITERAL.getLiteral().equals(getRoutingStyle())) <END> { isEdgeRectilinearRoutingStyle = true; } return isEdgeRectilinearRoutingStyle; }</code><technical_language>remove remark</technical_language>

Target:
public boolean isEdgeWithRectilinearRoutingStyle() { boolean isEdgeRectilinearRoutingStyle = false; if (Routing.RECTILINEAR_LITERAL.equals(getRoutingStyle())) { isEdgeRectilinearRoutingStyle = true; } return isEdgeRectilinearRoutingStyle; }
Source:
<code><START> public Object processElement(Object framedElement, Method method, <END> Object[] arguments, JavaHandler annotation, FramedGraph<?> framedGraph, Element element) { try { Class<?>[] interfaces = framedElement.getClass().getInterfaces(); Class<?> superInterface = findTheMostSubInterface(interfaces); ClassAndMethod cAndMethod = new ClassAndMethod(superInterface.getName(),method.getName()); if (proxyToJavaHandlerCache.containsKey(cAndMethod)) { Class<?> classInvoke = proxyToJavaHandlerCache.get(cAndMethod); Object handler = module.createHandler(framedElement, framedGraph, element, classInvoke, method); return method.invoke(handler, arguments); } for (Class<?> interfaceClass : framedElement.getClass().getInterfaces()) { try { Object handler = module.createHandler(framedElement, framedGraph, element, interfaceClass, method); Object result = method.invoke(handler, arguments); proxyToJavaHandlerCache.put(cAndMethod, interfaceClass); return result; } catch (Exception e) { } } proxyToJavaHandlerCache.put(cAndMethod, method.getDeclaringClass()); Object handler = module.createHandler(framedElement, framedGraph, element, method.getDeclaringClass(), method); return method.invoke(handler, arguments); } catch (IllegalArgumentException e) { throw new JavaHandlerException("Problem calling Java handler", e); } catch (IllegalAccessException e) { throw new JavaHandlerException("Problem calling Java handler", e); } catch (InvocationTargetException e) { ExceptionUtils.sneakyThrow(e.getTargetException()); return null; } }</code><technical_language>I a difficult time understanding scenario this necessary? reading... this more obvious on</technical_language>

Target:
public Object processElement(Object framedElement, Method method, Object[] arguments, JavaHandler annotation, FramedGraph<?> framedGraph, Element element) { try { Object handler = module.createHandler(framedElement, framedGraph, element, method.getDeclaringClass(), method); return method.invoke(handler, arguments); } catch (IllegalArgumentException e) { throw new JavaHandlerException("Problem calling Java handler", e); } catch (IllegalAccessException e) { throw new JavaHandlerException("Problem calling Java handler", e); } catch (InvocationTargetException e) { ExceptionUtils.sneakyThrow(e.getTargetException()); return null; } }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse= (HttpServletResponse) response; GHMyself myself = this.loginProvider.get(httpRequest).getMyself(); if (myself != null) { List<GHEmail> emails = myself.getEmails2(); ReviewDb db = null; try { <START> <END> db = this.schema.open(); AccountAccess accounts = db.accounts(); for (GHEmail email: emails) { List<Account> results = accounts.byPreferredEmail(email.getEmail()).toList(); if (results.size() > 1) { log.error(String.format("'%s' is register as preferred email for multiple accounts", email.getEmail())); break; } Account.Id accountId =results.get(0).getId(); AccountExternalId.Key gitHubKey = new AccountExternalId.Key(AccountExternalId.SCHEME_GERRIT, myself.getLogin()); if (haveGitHubIdEntry(db, accountId, gitHubKey)) { break; } log.info(String.format("Inserting external id entry for '%s' " + "who's preferred email '%s' matched their GitHub account.", myself.getLogin(), email.getEmail())); db.accountExternalIds().insert( Arrays .asList(new AccountExternalId(accountId, gitHubKey))); break; } } catch(com.google.gwtorm.server.OrmException orex) { log.error("Exception inserting GitHub external id entry", orex); } finally { if (db != null) { db.close(); } } } super.doFilter(request, response, chain); }</code><technical_language>nit: unnecessary blank line</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse= (HttpServletResponse) response; GHMyself myself = this.loginProvider.get(httpRequest).getMyself(); if (myself != null) { List<GHEmail> emails = myself.getEmails2(); ReviewDb db = null; try { db = this.schema.open(); AccountAccess accounts = db.accounts(); for (GHEmail email: emails) { List<Account> results = accounts.byPreferredEmail(email.getEmail()).toList(); if (results.isEmpty()) { continue; } else if (results.size() > 1) { log.error(String.format("'%s' is register as preferred email for multiple accounts", email.getEmail())); break; } Account.Id accountId = results.get(0).getId(); AccountExternalId.Key gitHubKey = new AccountExternalId.Key(AccountExternalId.SCHEME_GERRIT, myself.getLogin()); if (haveGitHubIdEntry(db, accountId, gitHubKey)) { break; } log.info(String.format("Inserting external id entry for '%s' " + "whose preferred email '%s' matched their GitHub account.", myself.getLogin(), email.getEmail())); db.accountExternalIds().insert( Arrays .asList(new AccountExternalId(accountId, gitHubKey))); break; } } catch(OrmException orex) { log.error("Exception inserting GitHub external id entry", orex); } finally { if (db != null) { db.close(); } } } super.doFilter(request, response, chain); }
Source:
<code>public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { case CREATE_REQUEST: try { reportingArea.setText(JMeterUtils.getResString("generate_report_ui.html_report_processing") + "\n"); reportLaunchButton.setForeground(Color.orange); new ReportGenerationWorker(reportLaunchButton).execute(); } catch (Exception exception) { if (LOGGER.isErrorEnabled()) { <START> LOGGER.error("Error during html report generation : {}", exception.getMessage(), exception); <END> } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("CSV file path \n user.properties file path : \nOutput directory file path : {}", csvFilePathTextField.getText(), userPropertiesFilePathTextField.getText(), outputDirectoryPathTextField.getText()); } break; case BROWSE_USER_PROPERTIES: userPropertiesFilePathTextField.setText(showFileChooser(userPropertiesFileButton.getParent(), userPropertiesFilePathTextField, false, new String[] { ".properties" })); break; case BROWSE_CSV: csvFilePathTextField.setText(showFileChooser(csvFileButton.getParent(), csvFilePathTextField, false, new String[] { ".jtl", ".csv" })); break; case BROWSE_OUTPUT: outputDirectoryPathTextField.setText( showFileChooser(outputDirectoryButton.getParent(), outputDirectoryPathTextField, true, null)); break; default: break; } }</code><technical_language>In English typography colon is text; is space :)</technical_language>

Target:
public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { case CREATE_REQUEST: try { reportArea.setText(JMeterUtils.getResString("generate_report_ui.html_report_processing") + "\n"); reportLaunchButton.setForeground(Color.orange); new ReportGenerationWorker(reportLaunchButton).execute(); } catch (Exception exception) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Error during html report generation: {}", exception.getMessage(), exception); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("CSV file path {}\nuser.properties file path: {}\nOutput directory file path: {}", csvFilePathTextField.getText(), userPropertiesFilePathTextField.getText(), outputDirectoryPathTextField.getText()); } break; case BROWSE_USER_PROPERTIES: userPropertiesFilePathTextField.setText(showFileChooser(userPropertiesFileButton.getParent(), userPropertiesFilePathTextField, false, new String[] { ".properties" })); break; case BROWSE_CSV: csvFilePathTextField.setText(showFileChooser(csvFileButton.getParent(), csvFilePathTextField, false, new String[] { ".jtl", ".csv" })); break; case BROWSE_OUTPUT: outputDirectoryPathTextField.setText( showFileChooser(outputDirectoryButton.getParent(), outputDirectoryPathTextField, true, null)); break; default: break; } }
Source:
<code>private AbstractAlgorithm getAlgorithm(final ARXConfiguration config, final DataManager manager, final SolutionSpace solutionSpace, final NodeChecker checker) { for (PrivacyCriterion c : config.getPrivacyModels()) { if (c instanceof DataDependentEDDifferentialPrivacy) { int[] rootValues = new int[manager.getHierarchies().length]; for (int i = 0; i < manager.getHierarchies().length; i++) { int[] row = manager.getHierarchies()[i].getArray()[0]; <START> rootValues[i] = row[row.length - 1]; <END> } DataDependentEDDifferentialPrivacy dpCriterion = (DataDependentEDDifferentialPrivacy)c; return DataDependentEDDPAlgorithm.create(solutionSpace, checker, config.getQualityModel(), dpCriterion.isDeterministic(), dpCriterion.getSteps(), dpCriterion.getEpsilonSearch(), c.getMinimalClassSize(), manager.getDataGeneralized().getDataLength(), rootValues); } } if (config.isHeuristicSearchEnabled() || solutionSpace.getSize() > config.getHeuristicSearchThreshold()) { return LIGHTNINGAlgorithm.create(solutionSpace, checker, config.getHeuristicSearchTimeLimit()); } else { FLASHStrategy strategy = new FLASHStrategy(solutionSpace, manager.getHierarchies()); return FLASHAlgorithm.create(solutionSpace, checker, strategy); } }</code><technical_language>I root values needed. Also: please consider fact hierarchies in ARX a root value</technical_language>

Target:
private AbstractAlgorithm getAlgorithm(final ARXConfiguration config, final DataManager manager, final SolutionSpace solutionSpace, final NodeChecker checker) { if (config.isPrivacyModelSpecified(EDDifferentialPrivacyOptimal.class)){ EDDifferentialPrivacyOptimal dpCriterion = config.getPrivacyModel(EDDifferentialPrivacyOptimal.class); return DataDependentEDDPAlgorithm.create(solutionSpace, checker, dpCriterion.isDeterministic(), dpCriterion.getSteps(), dpCriterion.getEpsilonSearch()); } if (config.isHeuristicSearchEnabled() || solutionSpace.getSize() > config.getHeuristicSearchThreshold()) { return LIGHTNINGAlgorithm.create(solutionSpace, checker, config.getHeuristicSearchTimeLimit()); } else { FLASHStrategy strategy = new FLASHStrategy(solutionSpace, manager.getHierarchies()); return FLASHAlgorithm.create(solutionSpace, checker, strategy); } }
Source:
<code>public void setMeter(Meter m) { if (lastSelectedMeterMenuItem != null) lastSelectedMeterMenuItem.setSelected(false); if (meter != null) { meter.disable(); meter.removePropertyChangeListener(NamedBean.PROPERTY_STATE, propertyChangeListener); } meter = m; if (meter == null) return; meter.addPropertyChangeListener(NamedBean.PROPERTY_STATE, propertyChangeListener); meter.enable(); if (frameIsInitialized) { scaleImage(); JCheckBoxMenuItem menuItem = meter_MenuItemMap.get(meter); menuItem.setSelected(true); lastSelectedMeterMenuItem = menuItem; updateMenuUnits(); initSelectedUnit(); } <START> if (meter instanceof VoltageMeter) { setTitle(Bundle.getMessage("TrackVoltageMeterTitle2", m.getDisplayName())); } else { setTitle(Bundle.getMessage("TrackCurrentMeterTitle2", m.getDisplayName())); } <END> }</code><technical_language>This structure "forces" displayed titles GUI specifically "track voltage" "track current", in bundle jmrit/swing/meter. This is limiting. Reported voltages "other track" voltages. Reported currents "other track" currents. Presumably, other "meter" types, a fictitious "LocoNet Message Traffic Meter" need some other title (and some other "units"). silly title units effectively hard-coded in MeterFrame bundle, provided concrete implementation provides meter data. I recommend some future implementation move "title" information out of MeterFrame bundle, concrete implementations of meter data sources. Ditto for "default number of whole-unit digits" "default number of fractional-unit digits", units themselves</technical_language>

Target:
public void setMeter(Meter m) { if (lastSelectedMeterMenuItem != null) lastSelectedMeterMenuItem.setSelected(false); if (meter != null) { meter.disable(); meter.removePropertyChangeListener(NamedBean.PROPERTY_STATE, propertyChangeListener); } meter = m; if (meter == null) return; meter.addPropertyChangeListener(NamedBean.PROPERTY_STATE, propertyChangeListener); meter.enable(); if (frameIsInitialized) { scaleImage(); JCheckBoxMenuItem menuItem = meter_MenuItemMap.get(meter); menuItem.setSelected(true); lastSelectedMeterMenuItem = menuItem; updateMenuUnits(); initSelectedUnit(); } if (meter instanceof VoltageMeter) { setTitle(Bundle.getMessage("VoltageMeterTitle2", m.getDisplayName())); } else { setTitle(Bundle.getMessage("CurrentMeterTitle2", m.getDisplayName())); } }
Source:
<code>protected void executeCommand() { getStoragePool().setstatus(getParameters().getStatus()); setVdsIdRef(getStoragePool().getspm_vds_id()); DbFacade.getInstance().getStoragePoolDAO().updateStatus(getStoragePool().getId(), getStoragePool().getstatus()); if (getParameters().getStatus() == StoragePoolStatus.Problematic || getParameters().getStatus() == StoragePoolStatus.NotOperational) { List<storage_pool_iso_map> storagesStatusInPool = DbFacade.getInstance() .getStoragePoolIsoMapDAO().getAllForStoragePool(getStoragePool().getId()); for (storage_pool_iso_map storageStatusInPool : storagesStatusInPool) { if (storageStatusInPool.getstatus() != null && storageStatusInPool.getstatus() == StorageDomainStatus.Active) { storageStatusInPool.setstatus(StorageDomainStatus.Unknown); DbFacade.getInstance() .getStoragePoolIsoMapDAO() .updateStatus(storageStatusInPool.getId(), storageStatusInPool.getstatus()); final List<Guid> asyncTasks = getDbFacade().getAsyncTaskDAO().getAsyncTaskIdsByEntity(storageStatusInPool.getstorage_id()); for(Guid taskId: asyncTasks) { AuditLogableBase auditLogableBase = new AuditLogableBase() { @Override public AuditLogType getAuditLogTypeValue() { return AuditLogType.STORAGE_DOMAIN_TASKS_ERROR; } <START> }; <END> auditLogableBase.setStorageDomain(getStorageDomain()); auditLogableBase.setJobId(taskId); AuditLogDirector.log(auditLogableBase); } } } } StoragePoolStatusHandler.PoolStatusChanged(getStoragePool().getId(), getStoragePool().getstatus()); setSucceeded(true); }</code><technical_language>is this created for loop</technical_language>

Target:
protected void executeCommand() { getStoragePool().setstatus(getParameters().getStatus()); setVdsIdRef(getStoragePool().getspm_vds_id()); DbFacade.getInstance().getStoragePoolDAO().updateStatus(getStoragePool().getId(), getStoragePool().getstatus()); if (getParameters().getStatus() == StoragePoolStatus.Problematic || getParameters().getStatus() == StoragePoolStatus.NotOperational) { List<storage_pool_iso_map> storagesStatusInPool = DbFacade.getInstance() .getStoragePoolIsoMapDAO().getAllForStoragePool(getStoragePool().getId()); for (storage_pool_iso_map storageStatusInPool : storagesStatusInPool) { if (storageStatusInPool.getstatus() != null && storageStatusInPool.getstatus() == StorageDomainStatus.Active) { storageStatusInPool.setstatus(StorageDomainStatus.Unknown); DbFacade.getInstance() .getStoragePoolIsoMapDAO() .updateStatus(storageStatusInPool.getId(), storageStatusInPool.getstatus()); final List<Guid> asyncTasks = getDbFacade().getAsyncTaskDAO().getAsyncTaskIdsByEntity(storageStatusInPool.getstorage_id()); for(Guid taskId: asyncTasks) { AuditLogableBase auditLogableBase = new AuditLogableBase(); auditLogableBase.setStorageDomain(getStorageDomain()); auditLogableBase.setJobId(taskId); AuditLogDirector.log(auditLogableBase, AuditLogType.STORAGE_DOMAIN_TASKS_ERROR); } } } } StoragePoolStatusHandler.PoolStatusChanged(getStoragePool().getId(), getStoragePool().getstatus()); setSucceeded(true); }
Source:
<code>private static ObjectMapper configure(ObjectMapper mapper) { <START> return mapper <END> .registerModule(new DecimalModule()) .enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); }</code><technical_language>mapper is set env.service(ObjectMapper.class), copying it, statements change configuration of shared ObjectMapper instance</technical_language>

Target:
private static ObjectMapper configure(ObjectMapper mapper) { return mapper.copy() .registerModule(new DecimalModule()) .enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); }
Source:
<code>private static void addFilesToCompression(TarArchiveOutputStream taos, File file, String dir, String bundleRoot) throws IOException { if(!file.isHidden()) { if(!dir.equals(".")) if(File.separator.equals("\\")){ dir = dir.replaceAll("\\\\", "/"); } taos.putArchiveEntry(new TarArchiveEntry(file, dir + "/" + file.getName())); if (file.isFile()) { BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); <START> FileInputStream in = new FileInputStream(file); <END> IOUtils.copy(in, taos); taos.closeArchiveEntry(); in.close(); bis.close(); } else if (file.isDirectory()) { if(!dir.equals(".")) taos.closeArchiveEntry(); for (File childFile : file.listFiles()) { addFilesToCompression(taos, childFile, file.getPath().substring(bundleRoot.length()), bundleRoot); } } } }</code><technical_language>is FileInputStream in line 78? If so, object reused. I suggest handle input streams this way: <LINK_0></technical_language>

Target:
private static void addFilesToCompression(TarArchiveOutputStream taos, File file, String dir, String bundleRoot) throws IOException { if(!file.isHidden()) { if(!dir.equals(".")) if(File.separator.equals("\\")){ dir = dir.replaceAll("\\\\", "/"); } taos.putArchiveEntry(new TarArchiveEntry(file, dir + "/" + file.getName())); if (file.isFile()) { try(BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) { IOUtils.copy(bis, taos); taos.closeArchiveEntry(); } } else if (file.isDirectory()) { if(!dir.equals(".")) taos.closeArchiveEntry(); for (File childFile : file.listFiles()) { addFilesToCompression(taos, childFile, file.getPath().substring(bundleRoot.length()), bundleRoot); } } } }
Source:
<code>public void generate() throws MojoExecutionException, MojoFailureException { log.info(format("Mirroring repository for [%s]", project.toString())); try { initializeProjectBuildingRequest(); ArtifactLocator artifactLocator = buildArtifactLocator(); Set<Artifact> artifacts = artifactLocator.getArtifacts(); Set<Artifact> excludedArtifacts = artifactLocator.getExclusions(); File repositoryFolder = getRepositoryFolder(); ArtifactInstaller artifactInstaller = buildArtifactInstaller(remoteArtifactRepositories); installArtifacts(repositoryFolder, artifacts, artifactInstaller); generateExcludedDependenciesMetadata(repositoryFolder, excludedArtifacts, artifactInstaller); } catch (Exception e) { log.debug(format("There was an exception while building [%s]", project.toString()), e); try { throw e; <START> } catch (DependencyTreeBuilderException e1) { <END> log.debug(format("There was an exception while resolving transitive dependencies of [%s]", project.toString()), e); } } }</code><technical_language>catch dEpendencyTreeBuilderException exception</technical_language>

Target:
public void generate() throws MojoExecutionException, MojoFailureException { log.info(format("Mirroring repository for [%s]", project.toString())); try { initializeProjectBuildingRequest(); ArtifactLocator artifactLocator = buildArtifactLocator(); Set<Artifact> artifacts = artifactLocator.getArtifacts(); Set<Artifact> excludedArtifacts = artifactLocator.getExclusions(); File repositoryFolder = getRepositoryFolder(); ArtifactInstaller artifactInstaller = buildArtifactInstaller(remoteArtifactRepositories); installArtifacts(repositoryFolder, artifacts, artifactInstaller); generateExcludedDependenciesMetadata(repositoryFolder, excludedArtifacts, artifactInstaller); } catch (DependencyTreeBuilderException e) { log.debug(format("There was an exception while resolving transitive dependencies of [%s]", project.toString()), e); } catch (Exception e) { log.debug(format("There was an exception while building [%s]", project.toString()), e); } }
Source:
<code>private InitializationManager() { WatchDogGlobals.setLogDirectory( "watchdog" + File.separator + "logs" + File.separator); WatchDogGlobals.setPreferences(Preferences.getInstance()); File baseFolder = Activator.getDefault().getStateLocation().toFile(); File toTransferDatabaseFile = new File(baseFolder, "watchdog.mapdb"); File statisticsDatabaseFile = new File(baseFolder, "watchdogStatistics.mapdb"); toTransferPersister = new PersisterBase(toTransferDatabaseFile); statisticsPersister = new PersisterBase(statisticsDatabaseFile); new ClientVersionChecker(); intervalManager = new IntervalManager(toTransferPersister, statisticsPersister); eventManager = new EventManager(toTransferPersister, statisticsPersister); eventManager.setSessionSeed(intervalManager.getSessionSeed()); watchDogEventManager = new WatchDogEventManager(intervalManager, USER_ACTIVITY_TIMEOUT); new TimeSynchronityChecker(intervalManager, watchDogEventManager); WorkbenchListener workbenchListener = new WorkbenchListener( watchDogEventManager, new TransferManager(toTransferPersister, WatchDogUtils.getWorkspaceName())); workbenchListener.attachListeners(); <START> DebugPlugin.getDefault().getBreakpointManager() <END> .addBreakpointListener(new BreakpointListener(eventManager)); DebugPlugin.getDefault() .addDebugEventListener(new DebugEventListener(eventManager)); }</code><technical_language>extract DebugPlugin.getDefault()</technical_language>

Target:
private InitializationManager() { WatchDogGlobals.setLogDirectory( "watchdog" + File.separator + "logs" + File.separator); WatchDogGlobals.setPreferences(Preferences.getInstance()); File baseFolder = Activator.getDefault().getStateLocation().toFile(); File toTransferDatabaseFile = new File(baseFolder, "watchdog.mapdb"); File statisticsDatabaseFile = new File(baseFolder, "watchdogStatistics.mapdb"); toTransferPersister = new PersisterBase(toTransferDatabaseFile); statisticsPersister = new PersisterBase(statisticsDatabaseFile); new ClientVersionChecker(); intervalManager = new IntervalManager(toTransferPersister, statisticsPersister); debugEventManager = new DebugEventManager(toTransferPersister, statisticsPersister); debugEventManager.setSessionSeed(intervalManager.getSessionSeed()); watchDogEventManager = new WatchDogEventManager(intervalManager, USER_ACTIVITY_TIMEOUT); new TimeSynchronityChecker(intervalManager, watchDogEventManager); WorkbenchListener workbenchListener = new WorkbenchListener( watchDogEventManager, debugEventManager, new TransferManager( toTransferPersister, WatchDogUtils.getWorkspaceName())); workbenchListener.attachListeners(); }
Source:
<code>Leader(QuorumPeer self,LeaderZooKeeperServer zk) throws IOException, X509Exception { this.self = self; try { if (self.shouldUsePortUnification()) { if (self.getQuorumListenOnAllIPs()) { ss = new UnifiedServerSocket(new QuorumX509Util(), self.getQuorumAddress().getPort()); } else { ss = new UnifiedServerSocket(new QuorumX509Util()); } } else if (self.isSslQuorum()) { if (self.getQuorumListenOnAllIPs()) { ss = new QuorumX509Util().createSSLServerSocket(self.getQuorumAddress().getPort()); } else { <START> ss = new QuorumX509Util().createSSLServerSocket(); <END> } } else { if (self.getQuorumListenOnAllIPs()) { ss = new ServerSocket(self.getQuorumAddress().getPort()); } else { ss = new ServerSocket(); } } ss.setReuseAddress(true); if (!self.getQuorumListenOnAllIPs()) { ss.bind(self.getQuorumAddress()); } } catch (X509Exception e) { LOG.error("failed to setup ssl server socket", e); throw e; } catch (BindException e) { if (self.getQuorumListenOnAllIPs()) { LOG.error("Couldn't bind to port " + self.getQuorumAddress().getPort(), e); } else { LOG.error("Couldn't bind to " + self.getQuorumAddress(), e); } throw e; } this.zk = zk; }</code><technical_language>Is move this code a class SSLSocketFactory Leader code similar number of branches if more</technical_language>

Target:
Leader(QuorumPeer self,LeaderZooKeeperServer zk) throws IOException, X509Exception { this.self = self; this.proposalStats = new BufferStats(); try { if (self.shouldUsePortUnification()) { if (self.getQuorumListenOnAllIPs()) { ss = new UnifiedServerSocket(new QuorumX509Util(), self.getQuorumAddress().getPort()); } else { ss = new UnifiedServerSocket(new QuorumX509Util()); } } else if (self.isSslQuorum()) { if (self.getQuorumListenOnAllIPs()) { ss = new QuorumX509Util().createSSLServerSocket(self.getQuorumAddress().getPort()); } else { ss = new QuorumX509Util().createSSLServerSocket(); } } else { if (self.getQuorumListenOnAllIPs()) { ss = new ServerSocket(self.getQuorumAddress().getPort()); } else { ss = new ServerSocket(); } } ss.setReuseAddress(true); if (!self.getQuorumListenOnAllIPs()) { ss.bind(self.getQuorumAddress()); } } catch (X509Exception e) { LOG.error("Failed to setup ssl server socket", e); throw e; } catch (BindException e) { if (self.getQuorumListenOnAllIPs()) { LOG.error("Couldn't bind to port " + self.getQuorumAddress().getPort(), e); } else { LOG.error("Couldn't bind to " + self.getQuorumAddress(), e); } throw e; } this.zk = zk; }
Source:
<code>public void queryPageWithComplexStartEndKeyAndJsonObjectValue() { init(); View view = db.view("example/boolean_creator_created") .startKey(false ,"uuid",1) .endKey(false ,"uuid", 2000); Page page = null; try { page = view.queryPage(30, null, Object.class); <START> } catch (Exception e) { <END> e.printStackTrace(); } assertThat(page.getResultList().size(), is(1)); }</code><technical_language>I is good for tests swallow exceptions. Removing this try/catch allow test fail if exception is thrown</technical_language>

Target:
public void queryPageWithComplexStartEndKeyAndJsonObjectValue() { init(); View view = db.view("example/boolean_creator_created") .startKey(true ,"uuid",1) .endKey(true ,"uuid", 2000); Page page = view.queryPage(30, null, Object.class); assertThat(page.getResultList().size(), is(2)); Gson gson = new Gson(); ArrayList<JsonObject> expectedJsonObject = new ArrayList<JsonObject>(), actualJsonObject = new ArrayList<JsonObject>(); for(int i = 0; i < page.getResultList().size(); i++) { expectedJsonObject.add(multiValueKeyInit(null, i + 1)); JsonObject actualJsonContentObject = (gson.toJsonTree(page.getResultList().get(i))) .getAsJsonObject().get("contentArray") .getAsJsonArray().get(0).getAsJsonObject(); actualJsonObject.add(actualJsonContentObject); } assertJsonObjectKeysAndValues(expectedJsonObject, actualJsonObject); }
Source:
<code>public boolean isCellEditable(int row, int col) { if (row == myAssignments.size()) { <START> return true; <END> } if (Column.UNIT.equals(Column.values()[col])) { return true; } return false; }</code><technical_language>want ID editable anyway. more, I task name editable in new row</technical_language>

Target:
public boolean isCellEditable(int row, int col) { if (row == myAssignments.size()) { return Column.NAME.equals(Column.values()[col]); } else { return Column.UNIT.equals(Column.values()[col]); } }
Source:
<code>public void startOvertime() { synchronized (runLock) { requestBatchStart(); ClockModel pc = getClockModel(Clock.ID_PERIOD); ClockModel jc = getClockModel(Clock.ID_JAM); ClockModel lc = getClockModel(Clock.ID_LINEUP); ClockModel tc = getClockModel(Clock.ID_TIMEOUT); if (pc.isRunning() || jc.isRunning()) return; if (pc.getNumber() < pc.getMaximumNumber()) return; if (!pc.isTimeAtEnd()) return; createSnapshot(ACTION_OVERTIME); setInOvertime(true); <START> if (tc.isRunning()) { <END> _endTimeout(); } long otLineupTime = settings.getLong("Clock." + Clock.ID_LINEUP + ".OvertimeTime"); if (lc.getMaximumTime() < otLineupTime) { lc.setMaximumTime(otLineupTime); } _startLineup(); requestBatchEnd(); } }</code><technical_language>_endTimeout checks for this, rely</technical_language>

Target:
public void startOvertime() { synchronized (runLock) { ClockModel pc = getClockModel(Clock.ID_PERIOD); ClockModel jc = getClockModel(Clock.ID_JAM); ClockModel lc = getClockModel(Clock.ID_LINEUP); if (pc.isRunning() || jc.isRunning()) return; if (pc.getNumber() < pc.getMaximumNumber()) return; if (!pc.isTimeAtEnd()) return; createSnapshot(ACTION_OVERTIME); requestBatchStart(); setInOvertime(true); _endTimeout(); long otLineupTime = settings.getLong("Clock." + Clock.ID_LINEUP + ".OvertimeTime"); if (lc.getMaximumTime() < otLineupTime) { lc.setMaximumTime(otLineupTime); } _startLineup(); requestBatchEnd(); } }
Source:
<code>public void shouldGenerateCoverageMeasures() throws Exception { parser.parse(getReportsWithAbsolutePath("phpunit.coverage.xml")); ArgumentCaptor<Measure> measures = ArgumentCaptor.forClass(Measure.class); verify(context, atLeastOnce()).saveMeasure(any(Resource.class), measures.capture()); for (Measure measure : measures.getAllValues()) { if (measure.getMetricKey().equals(CoreMetrics.COVERAGE_LINE_HITS_DATA_KEY)) { assertThat(measure.getData()).isEqualTo("34=1;35=1;38=1;40=0;45=1;46=1"); } else if (measure.getMetricKey().equals(CoreMetrics.UNCOVERED_LINES_KEY)) { assertThat(measure.getValue()).isEqualTo(2.); <START> } <END> } }</code><technical_language>@vilchik-elena This test fail if save coverage measure</technical_language>

Target:
public void shouldGenerateCoverageMeasures() throws Exception { parser.parse(getReportsWithAbsolutePath("phpunit.coverage.xml")); ArgumentCaptor<Measure> measures = ArgumentCaptor.forClass(Measure.class); verify(context, atLeastOnce()).saveMeasure(any(Resource.class), measures.capture()); Measure coverageLineHitsDataMeasure = getMeasure(measures, CoreMetrics.COVERAGE_LINE_HITS_DATA_KEY); assertThat(coverageLineHitsDataMeasure).isNotNull(); assertThat(coverageLineHitsDataMeasure.getData()).isEqualTo("34=1;35=1;38=1;40=0;45=1;46=1"); verify(context, atLeastOnce()).saveMeasure(any(Resource.class), eq(CoreMetrics.UNCOVERED_LINES), eq(2.)); }
Source:
<code>public void RequestDirections() { AsynchUtil.runAsynchronously(new Runnable() { @Override public void run() { try { <START> performRequest(); <END> } catch (IOException e) { form.dispatchErrorOccurredEvent(Navigation.this, "RequestDirections", ErrorMessages.ERROR_DEFAULT); } catch (JSONException je) { form.dispatchErrorOccurredEvent(Navigation.this, "RequestDirections", ErrorMessages.ERROR_DEFAULT); } } }); }</code><technical_language>developer multiple requests in block stack. Therefore, guarantee time this code executes a thread changed start, end, method of direction. Instead, copy method, start end coordinates (make final in this function prior runAsynchronously call), in body of performRequest referencing declared this</technical_language>

Target:
public void RequestDirections() { if (apiKey.equals("")) { form.dispatchErrorOccurredEvent(this, "Authorization", ErrorMessages.ERROR_INVALID_API_KEY); return; } final GeoPoint startLocation = this.startLocation; final GeoPoint endLocation = this.endLocation; final TransportMethod method = this.method; AsynchUtil.runAsynchronously(new Runnable() { @SuppressWarnings("TryWithIdenticalCatches") @Override public void run() { try { performRequest(startLocation, endLocation, method); } catch (IOException e) { form.dispatchErrorOccurredEvent(Navigation.this, "RequestDirections", ErrorMessages.ERROR_DEFAULT); } catch (JSONException je) { form.dispatchErrorOccurredEvent(Navigation.this, "RequestDirections", ErrorMessages.ERROR_DEFAULT); } } }); }
Source:
<code>public void testObtainPublicNetworkSeveralExternalNetworks () throws OpenStackException { String CONTENT_NETWORKS= "{\"networks\": [{\"status\": \"ACTIVE\", \"subnets\": [\"eb602a2b-13cd-46c8-9055-99ad45180730\"],"+ "\"name\": \"net04_ext\", \"provider:physical_network\": null, \"admin_state_up\": true, \"tenant_id\": "+ "\"eab8403e83e048719ab220353c10806f\", \"provider:network_type\": \"gre\", \"router:external\": true, \"shared\": "+ "true, \"id\": \"04c9aedf-aeb6-4553-8ddb-845701da71bd\", \"provider:segmentation_id\": 3}, "+ "{\"status\": \"ACTIVE\", \"subnets\": [\"6ba86d6b-b7ad-4d0b-b552-cb63b36c9ef2\"], \"name\": \"sec_ext_net\", "+ "\"provider:physical_network\": \"physnet1\", \"admin_state_up\": true, \"tenant_id\": \"eab8403e83e048719ab220353c10806f\", "+ "\"provider:network_type\": \"flat\", \"router:external\": true, \"shared\": false, \"id\": \"063f1075-77eb-45f9-be7a-205a591840ee\"," + "\"provider:segmentation_id\": null}]}"; <START> <END> System.out.print(CONTENT_NETWORKS); String region = "RegionOne5"; when(openOperationUtil.getAdminUser(any(PaasManagerUser.class))).thenReturn(paasManagerUser); when(openOperationUtil.executeNovaRequest(any(HttpUriRequest.class))).thenReturn(CONTENT_NETWORKS); String net = openStackUtil.getPublicAdminNetwork(paasManagerUser, region); assertNotNull(net); assertEquals(net, "04c9aedf-aeb6-4553-8ddb-845701da71bd"); }</code><technical_language>Check longitude of lines, some of more 120 characters</technical_language>

Target:
public void testObtainPublicNetworkSeveralExternalNetworks () throws OpenStackException { String CONTENT_NETWORKS= "{\"networks\": [{\"status\": \"ACTIVE\", " + "\"subnets\": [\"eb602a2b-13cd-46c8-9055-99ad45180730\"],"+ "\"name\": \"net04_ext\", \"provider:physical_network\": null, " + "\"admin_state_up\": true, \"tenant_id\": "+ "\"eab8403e83e048719ab220353c10806f\", \"provider:network_type\": " + "\"gre\", \"router:external\": true, \"shared\": "+ "true, \"id\": \"04c9aedf-aeb6-4553-8ddb-845701da71bd\", " + "\"provider:segmentation_id\": 3}, "+ "{\"status\": \"ACTIVE\", \"subnets\": [\"6ba86d6b-b7ad-4d0b-b552-cb63b36c9ef2\"], " + "\"name\": \"sec_ext_net\", "+ "\"provider:physical_network\": \"physnet1\", \"admin_state_up\": true, \"tenant_id\":" + "\"eab8403e83e048719ab220353c10806f\", "+ "\"provider:network_type\": \"flat\", \"router:external\": true, \"shared\": false," + " \"id\": \"063f1075-77eb-45f9-be7a-205a591840ee\"," + "\"provider:segmentation_id\": null}]}"; System.out.print(CONTENT_NETWORKS); String region = "RegionOne5"; when(openOperationUtil.getAdminUser(any(PaasManagerUser.class))).thenReturn(paasManagerUser); when(openOperationUtil.executeNovaRequest(any(HttpUriRequest.class))).thenReturn(CONTENT_NETWORKS); String net = openStackUtil.getPublicAdminNetwork(paasManagerUser, region); assertNotNull(net); assertEquals(net, "04c9aedf-aeb6-4553-8ddb-845701da71bd"); }
Source:
<code>public URL serve(FixedLengthAudioStream stream, int seconds) { String streamId = UUID.randomUUID().toString(); multiTimeStreams.put(streamId, stream); <START> streamTimeouts.put(streamId, System.currentTimeMillis() + (seconds * 1000L)); <END> return getURL(streamId); }</code><technical_language>I prefer System.nanoTime() for time, is independent of system time corrupted time changes</technical_language>

Target:
public URL serve(FixedLengthAudioStream stream, int seconds) { String streamId = UUID.randomUUID().toString(); multiTimeStreams.put(streamId, stream); streamTimeouts.put(streamId, System.nanoTime() + (seconds * TimeUnit.SECONDS.toNanos(1))); return getURL(streamId); }
Source:
<code>public void update( @Observes final ProjectDetailEvent event ) { this.projectInfo = event.getProjectInfo(); final POM pom = projectInfo.getProject().getPom(); if ( pom != null && pom.getDescription() != null ) { <START> view.updateDescription( pom.getDescription() ); <END> } Displayer displayer = projectMetricsFactory.lookupCommitsOverTimeDisplayer_small(projectInfo); displayer.draw(); view.updateContributionsMetric(displayer); }</code><technical_language>Ok, create EDIT: I opened separate [jira](<LINK_0> for that</technical_language>

Target:
public void update( @Observes final ProjectDetailEvent event ) { this.projectInfo = event.getProjectInfo(); final POM pom = projectInfo.getProject().getPom(); if (pom != null && pom.getDescription() != null) { view.updateDescription(pom.getDescription()); } commitsDisplayer = projectMetricsFactory.lookupCommitsOverTimeDisplayer_small(projectInfo); commitsDisplayer.draw(); view.updateContributionsMetric(commitsDisplayer); }
Source:
<code>public void updating_the_parent_of_a_deprecated_rule_key_should_work() { execute(context -> { NewRepository repo = context.createRepository("javascript", "javascript"); repo.createRule("linelength") <START> .setName("s103") <END> .setHtmlDescription("Description of One") .setSeverity(BLOCKER) .setType(RuleType.CODE_SMELL) .setStatus(RuleStatus.BETA); repo.createRule("s103") .setName("s103") .setHtmlDescription("Description of One") .setSeverity(BLOCKER) .setType(RuleType.CODE_SMELL) .setStatus(RuleStatus.BETA); repo.done(); }); execute(context -> { NewRepository repo = context.createRepository("javascript", "javascript"); repo.createRule("s103") .setName("s103") .setHtmlDescription("Description of One") .setSeverity(BLOCKER) .setType(RuleType.CODE_SMELL) .setStatus(RuleStatus.BETA) .addDeprecatedRuleKey("javascript", "linelength"); repo.done(); }); execute(context -> { NewRepository repo = context.createRepository("sonarjs", "javascript"); repo.createRule("s103") .setName("s103") .setHtmlDescription("Description of One") .setSeverity(BLOCKER) .setType(RuleType.CODE_SMELL) .setStatus(RuleStatus.BETA) .addDeprecatedRuleKey("javascript", "linelength"); repo.done(); }); }</code><technical_language>"linelength"</technical_language>

Target:
public void updating_the_parent_of_a_deprecated_rule_key_should_work() { execute(context -> createRule(context, "javascript", "javascript", "s103")); execute(context -> createRule(context, "javascript", "javascript", "s103", r -> r.addDeprecatedRuleKey("javascript", "linelength"))); execute(context -> createRule(context, "javascript", "sonarjs", "s103", r -> r.addDeprecatedRuleKey("javascript", "linelength"))); }
Source:
<code>public HealthCheckResponse call() { HealthCheckResponseBuilder responseBuilder = HealthCheckResponse.named(name); boolean state = true; checker.doCheck(); for (HealthCheckResultEntry healthCheckResultEntry : checker.getMostRecentResult().getEntries()) { responseBuilder.withData("Message", healthCheckResultEntry.getMessage()); } <START> String healthStatus = checker.getMostRecentCumulativeStatus().name(); if (!healthStatus.trim().isEmpty()) { responseBuilder.withData("HealthCheckStatus", healthStatus); if (healthStatus.equals("CRITICAL") || healthStatus.equals("CHECK_ERROR")) { state = false; } } <END> return responseBuilder.state(state).build(); }</code><technical_language>Good candidate for a method returning state</technical_language>

Target:
public HealthCheckResponse call() { HealthCheckResponseBuilder responseBuilder = HealthCheckResponse.named(name); boolean state = true; checker.doCheck(); List<HealthCheckResultEntry> healthCheckResults = checker.getMostRecentResult().getEntries(); if (healthCheckResults.isEmpty()) { responseBuilder.withData("Message", "No result to display"); return responseBuilder.state(state).build(); } for (HealthCheckResultEntry healthCheckResultEntry : healthCheckResults) { responseBuilder.withData("Message", healthCheckResultEntry.getMessage()); } String healthStatus = checker.getMostRecentCumulativeStatus().name(); if (!healthStatus.trim().isEmpty()) { responseBuilder.withData("HealthCheckStatus", healthStatus); if (healthStatus.equals("CRITICAL") || healthStatus.equals("CHECK_ERROR")) { state = false; } } return responseBuilder.state(state).build(); }