auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) throw die(MessageFormat.format( CLIText.get().noRemoteUriSubscribe, remote)); <START> String uriRoot = PubSubConfig.getUriRoot(uris.get(0)); <END> String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null) { p = new Publisher(uriRoot); pubsubConfig.addPublisher(p); } Subscriber s = p.getSubscriber(remote, dir); if (s == null) p.addSubscriber(new Subscriber(p, remote, dir)); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { throw die(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); } out.println(MessageFormat.format( CLIText.get().didSubscribe, remote, uriRoot)); }</code><technical_language>need check is subscriber line in config uri path host, do support writing repository in multiple local directories</technical_language>

Target:
protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) throw die(MessageFormat.format( CLIText.get().noRemoteUriSubscribe, remote)); URIish uri = uris.get(0); String uriRoot = PubSubConfig.getUriRoot(uri); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null) { p = new Publisher(uriRoot); pubsubConfig.addPublisher(p); } Subscriber s = p.getSubscriber(remote, dir); if (s == null) { Subscriber newSubscriber = new Subscriber(p, remote, dir); for (Subscriber oldSubscriber : p.getSubscribers()) { if (newSubscriber.getName() == oldSubscriber.getName()) throw die(MessageFormat.format( CLIText.get().cannotSubscribeTwice, uri, oldSubscriber.getDirectory())); } p.addSubscriber(newSubscriber); } try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { throw die(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); } out.println(MessageFormat.format( CLIText.get().didSubscribe, remote, uriRoot)); }
Source:
<code>private void buildAnchorUri(ProductDto product) { PlaceRequest request = new PlaceRequest.Builder() .nameToken(NameTokens.PRODUCT) <START> .with("productId", String.valueOf(product.getId())) <END> .build(); String token = tokenFormatter.toPlaceToken(request); shopAnchor.setHref("#" + token); }</code><technical_language>Extract variable</technical_language>

Target:
private void buildAnchorUri(ProductDto product) { String productId = String.valueOf(product.getId()); PlaceRequest request = new PlaceRequest.Builder() .nameToken(NameTokens.PRODUCT) .with("productId", productId) .build(); String token = tokenFormatter.toPlaceToken(request); shopAnchor.setHref("#" + token); }
Source:
<code>private UniqueTeamErrorOutput validateTeamName(List<StudentAttributes> existingStudents, List<StudentAttributes> studentsToEnroll) { Map<String, String> teamInSection = new HashMap<>(); for (StudentAttributes existingStudent : existingStudents) { teamInSection.put(existingStudent.getTeam(), existingStudent.getSection()); } for (StudentAttributes studentToEnroll : studentsToEnroll) { if (teamInSection.containsKey(studentToEnroll.getTeam()) && !teamInSection.get(studentToEnroll.getTeam()).equals(studentToEnroll.getSection())) { return new UniqueTeamErrorOutput(studentToEnroll.getTeam(), teamInSection.get(studentToEnroll.getTeam()), studentToEnroll.getSection()); } teamInSection.put(studentToEnroll.getTeam(), studentToEnroll.getSection()); } <START> return null; <END> }</code><technical_language>Here, throw InvalidHttpRequestBodyException</technical_language>

Target:
private void validateTeamName(List<StudentAttributes> existingStudents, List<StudentAttributes> studentsToEnroll) throws InvalidHttpRequestBodyException { Map<String, String> teamInSection = new HashMap<>(); for (StudentAttributes existingStudent : existingStudents) { teamInSection.put(existingStudent.getTeam(), existingStudent.getSection()); } for (StudentAttributes studentToEnroll : studentsToEnroll) { if (teamInSection.containsKey(studentToEnroll.getTeam()) && !teamInSection.get(studentToEnroll.getTeam()).equals(studentToEnroll.getSection())) { throw new InvalidHttpRequestBodyException(String.format(ERROR_MESSAGE_SAME_TEAM_IN_DIFFERENT_SECTION, studentToEnroll.getTeam(), teamInSection.get(studentToEnroll.getTeam()), studentToEnroll.getSection())); } teamInSection.put(studentToEnroll.getTeam(), studentToEnroll.getSection()); } }
Source:
<code>public HttpResponse doIndex(StaplerRequest request) { <START> return HttpResponses.redirectTo(Jenkins.getActiveInstance().getRootUrlFromRequest() + computation.getUrl() ); <END> }</code><technical_language>java return HttpResponses.redirectViaContextPath(computation.getUrl());</technical_language>

Target:
public HttpResponse doIndex(StaplerRequest request) { return HttpResponses.redirectViaContextPath(computation.getUrl()); }
Source:
<code>public void flushBuffer(final ByteBuf byteBuf, final boolean requestedSync, final List<IOCallback> callbacks) { final int bytes = byteBuf.readableBytes(); if (bytes > 0) { <START> final ByteBuffer buffer = newBuffer(byteBuf.capacity(), bytes, false); <END> buffer.limit(bytes); byteBuf.getBytes(byteBuf.readerIndex(), buffer); buffer.flip(); writeDirect(buffer, requestedSync, new DelegateCallback(callbacks)); } else { IOCallback.done(callbacks); } }</code><technical_language>In case pool a buffer, wrote 300 bytes, a place previously 4K filled fill 300 bytes... buffer flipped, libaio write takes place.. afraid this cleanup rest of 4K. I run tests this.. I remember pool mechanism. previously pooled buffer journal</technical_language>

Target:
public void flushBuffer(final ByteBuf byteBuf, final boolean requestedSync, final List<IOCallback> callbacks) { final int bytes = byteBuf.readableBytes(); if (bytes > 0) { final ByteBuffer buffer = newBuffer(bytes, false); final int alignedLimit = buffer.limit(); assert alignedLimit == factory.calculateBlockSize(bytes); buffer.limit(bytes); byteBuf.getBytes(byteBuf.readerIndex(), buffer); final int missingNonZeroedBytes = alignedLimit - bytes; if (missingNonZeroedBytes > 0) { ByteUtil.zeros(buffer, bytes, missingNonZeroedBytes); } buffer.flip(); writeDirect(buffer, requestedSync, new DelegateCallback(callbacks)); } else { IOCallback.done(callbacks); } }
Source:
<code>private static boolean shouldRewriteTableLayout(TableScanNode source) { <START> return !source.getLayout().isPresent() || source.getOriginalConstraint().equals(BooleanLiteral.TRUE_LITERAL); <END> }</code><technical_language>source.getOriginalConstraint() is marked nullable</technical_language>

Target:
private static boolean shouldRewriteTableLayout(TableScanNode source) { return !source.getLayout().isPresent() || source.getCurrentConstraint().isAll(); }
Source:
<code>public void initialize() { try { lock.lock(); product = Products.getLikelyProduct(getThing().getThingTypeUID()); macAddress = new MACAddress((String) getConfig().get(LifxBindingConstants.CONFIG_PROPERTY_DEVICE_ID), true); macAsHex = this.macAddress.getHex(); logger.debug("Initializing the LIFX handler for light '{}'.", macAsHex); fadeTime = getFadeTime(); powerOnBrightness = getPowerOnBrightness(); channelStates = new HashMap<>(); currentLightState = new CurrentLightState(); pendingLightState = new LifxLightState(); communicationHandler = new LifxLightCommunicationHandler(macAddress, currentLightState); currentStateUpdater = new LifxLightCurrentStateUpdater(macAddress, currentLightState, communicationHandler, product); onlineStateUpdater = new LifxLightOnlineStateUpdater(macAddress, currentLightState, communicationHandler); lightStateChanger = new LifxLightStateChanger(macAddress, pendingLightState, communicationHandler, product, fadeTime); communicationHandler.start(); currentStateUpdater.start(); onlineStateUpdater.start(); lightStateChanger.start(); } catch (Exception e) { <START> logger.debug("Error occurred while initializing LIFX handler: " + e.getMessage(), e); <END> updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage()); } finally { lock.unlock(); } }</code><technical_language>touched this logging statement, fix stop string building (use parameters instead, logging framework build string if logging is done)</technical_language>

Target:
public void initialize() { try { lock.lock(); product = Products.getLikelyProduct(getThing().getThingTypeUID()); macAddress = new MACAddress((String) getConfig().get(LifxBindingConstants.CONFIG_PROPERTY_DEVICE_ID), true); macAsHex = this.macAddress.getHex(); logger.debug("Initializing the LIFX handler for light '{}'.", macAsHex); fadeTime = getFadeTime(); powerOnBrightness = getPowerOnBrightness(); channelStates = new HashMap<>(); currentLightState = new CurrentLightState(); pendingLightState = new LifxLightState(); communicationHandler = new LifxLightCommunicationHandler(macAddress, currentLightState); currentStateUpdater = new LifxLightCurrentStateUpdater(macAddress, currentLightState, communicationHandler, product); onlineStateUpdater = new LifxLightOnlineStateUpdater(macAddress, currentLightState, communicationHandler); lightStateChanger = new LifxLightStateChanger(macAddress, pendingLightState, communicationHandler, product, fadeTime); communicationHandler.start(); currentStateUpdater.start(); onlineStateUpdater.start(); lightStateChanger.start(); } catch (Exception e) { logger.debug("Error occurred while initializing LIFX handler: {}", e.getMessage(), e); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage()); } finally { lock.unlock(); } }
Source:
<code>public BlockBuilder getFieldBlockBuilder(int fieldIndex) { if (currentFieldIndexToWrite != 0) { <START> throw new IllegalStateException("column write mode can only be enabled before any value has been appended"); <END> } fieldWriteMode = true; return fieldBlockBuilders[fieldIndex]; }</code><technical_language>Update error messages in this file "column/field write mode" is longer users of this class explicitly sees</technical_language>

Target:
public BlockBuilder getFieldBlockBuilder(int fieldIndex) { if (currentFieldIndexToWrite != 0) { throw new IllegalStateException("field block builder can only be obtained before any sequential write has done"); } fieldBlockBuilderReturned = true; return fieldBlockBuilders[fieldIndex]; }
Source:
<code>private void processChild(TaggedValuePointable tvp, DictionaryBuilder db) throws IOException, SystemException { <START> IMutableValueStorage mvs = new ArrayBackedValueStorage(); <END> if (tvp.getTag() != ValueTag.NODE_TREE_TAG) { enb.addChild(tvp); } else { NodeTreePointable ntp = ppool.takeOne(NodeTreePointable.class); try { tvp.getValue(ntp); TaggedValuePointable innerTvp = ppool.takeOne(TaggedValuePointable.class); try { ntp.getRootNode(innerTvp); byte nTag = innerTvp.getTag(); switch (nTag) { case ValueTag.ATTRIBUTE_NODE_TAG: { throw new SystemException(ErrorCode.XQTY0024); } case ValueTag.ELEMENT_NODE_TAG: { ElementNodePointable enp = ppool.takeOne(ElementNodePointable.class); try { innerTvp.getValue(enp); copyElement(enb, db, ntp, enp); } finally { ppool.giveBack(enp); } break; } case ValueTag.COMMENT_NODE_TAG: copyComment(innerTvp, ntp, mvs); enb.addChild(mvs); break; case ValueTag.PI_NODE_TAG: copyPI(innerTvp, ntp, mvs); enb.addChild(mvs); break; case ValueTag.TEXT_NODE_TAG: { copyText(innerTvp, ntp, mvs); enb.addChild(mvs); break; } case ValueTag.DOCUMENT_NODE_TAG: { DocumentNodePointable dnp = ppool.takeOne(DocumentNodePointable.class); try { innerTvp.getValue(dnp); copyDocument(enb, db, ntp, dnp); } finally { ppool.giveBack(dnp); } break; } } } finally { ppool.giveBack(innerTvp); } } finally { ppool.giveBack(ntp); } } }</code><technical_language>this reuse class level abvs variable</technical_language>

Target:
private void processChild(TaggedValuePointable tvp, DictionaryBuilder db) throws IOException, SystemException { if (tvp.getTag() != ValueTag.NODE_TREE_TAG) { enb.addChild(tvp); } else { NodeTreePointable ntp = ppool.takeOne(NodeTreePointable.class); try { tvp.getValue(ntp); TaggedValuePointable innerTvp = ppool.takeOne(TaggedValuePointable.class); try { ntp.getRootNode(innerTvp); byte nTag = innerTvp.getTag(); switch (nTag) { case ValueTag.ATTRIBUTE_NODE_TAG: { throw new SystemException(ErrorCode.XQTY0024); } case ValueTag.ELEMENT_NODE_TAG: { ElementNodePointable enp = ppool.takeOne(ElementNodePointable.class); try { innerTvp.getValue(enp); copyElement(enb, db, ntp, enp); } finally { ppool.giveBack(enp); } break; } case ValueTag.COMMENT_NODE_TAG: abvs.reset(); copyComment(innerTvp, ntp, abvs); enb.addChild(abvs); break; case ValueTag.PI_NODE_TAG: abvs.reset(); copyPI(innerTvp, ntp, abvs); enb.addChild(abvs); break; case ValueTag.TEXT_NODE_TAG: { abvs.reset(); copyText(innerTvp, ntp, abvs); enb.addChild(abvs); break; } case ValueTag.DOCUMENT_NODE_TAG: { DocumentNodePointable dnp = ppool.takeOne(DocumentNodePointable.class); try { innerTvp.getValue(dnp); copyDocument(enb, db, ntp, dnp); } finally { ppool.giveBack(dnp); } break; } } } finally { ppool.giveBack(innerTvp); } } finally { ppool.giveBack(ntp); } } }
Source:
<code>public JsonElement index(@Context HttpServletRequest request, @QueryParam(value = "page") final String pageStr) { int page; try { <START> if (pageStr == null) { <END> page = 0; } else { page = Integer.parseInt(pageStr); } if (page < 0) { page = 0; } } catch (final NumberFormatException e) { throw new WebApplicationException(400); } final SearchMissionsDTO searchMissions = new SearchMissionsDTO(request); final List<Mission> missions = searchMissions.sortedSearch(); final int ipp = 10; int skip = page * ipp; final int total = missions.size(); final int totalPages = (total + ipp - 1) / ipp; if (page >= totalPages && totalPages > 0) { page = totalPages - 1; skip = page * ipp; } final JsonObject json; if (missions.isEmpty()) { json = super.view(missions, "missions", AbbreviatedMissionAdapter.class).getAsJsonObject(); } else { json = super.viewPaginated(missions, "missions", AbbreviatedMissionAdapter.class, skip, ipp).getAsJsonObject(); } json.addProperty("totalPages", totalPages); json.addProperty("currentPage", page); json.addProperty("itemsPerPage", ipp); json.addProperty("sortBy", request.getParameter("sortBy")); return json; }</code><technical_language>Usage of ternary operators code more reader friendly: page = pageStr == null ? 0 : Integer.parseInt(pageStr);</technical_language>

Target:
public JsonElement index(@Context HttpServletRequest request, @QueryParam(value = "page") final String pageStr) { int page; try { page = (pageStr == null) ? 0 : Integer.parseInt(pageStr); if (page < 0) { page = 0; } } catch (final NumberFormatException e) { throw new WebApplicationException(400); } final SearchMissionsDTO searchMissions = new SearchMissionsDTO(request); final List<Mission> missions = searchMissions.sortedSearch(); final int ipp = 10; int skip = page * ipp; final int total = missions.size(); final int totalPages = (total + ipp - 1) / ipp; if (page >= totalPages && totalPages > 0) { page = totalPages - 1; skip = page * ipp; } final JsonObject json; if (missions.isEmpty()) { json = super.view(missions, "missions", AbbreviatedMissionAdapter.class).getAsJsonObject(); } else { json = super.viewPaginated(missions, "missions", AbbreviatedMissionAdapter.class, skip, ipp).getAsJsonObject(); } json.addProperty("totalPages", totalPages); json.addProperty("currentPage", page); json.addProperty("itemsPerPage", ipp); json.addProperty("sortBy", request.getParameter("sortBy")); return json; }
Source:
<code>public String getUserName() { if (principal == null || principal.isEmpty()) { <START> return System.getProperty("user.name", "<NA>"); <END> } return principal; }</code><technical_language>sample a static variable. save access system properties map</technical_language>

Target:
public String getUserName() { if (principal == null || principal.isEmpty()) { return SYSTEM_USER; } return principal; }
Source:
<code>public void testLoadInvalidFlowYamlFiles() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(INVALID_FLOW_YAML_DIR)); Assert.assertEquals(2, loader.getErrors().size()); Assert.assertEquals(2, loader.getFlowMap().size()); Assert.assertEquals(2, loader.getEdgeMap().size()); Assert.assertTrue(loader.getFlowMap().containsKey(INVALID_FLOW_1)); final Flow flow1 = loader.getFlowMap().get(INVALID_FLOW_1); Assert.assertEquals(3, flow1.getNodes().size()); Assert.assertEquals(1, flow1.getErrors().size()); Assert.assertEquals(3, loader.getEdgeMap().get(INVALID_FLOW_1).size()); Assert.assertEquals(3, flow1.getEdges().size()); for (final Edge edge : loader.getEdgeMap().get(INVALID_FLOW_1)) { this.logger.info(INVALID_FLOW_1 + ".flow has edge: " + edge.getId()); if (edge.getError() != null) { Assert.assertEquals(DEPENDENCY_NOT_FOUND_ERROR, edge.getError()); } } Assert.assertTrue(loader.getFlowMap().containsKey(INVALID_FLOW_2)); final Flow flow2 = loader.getFlowMap().get(INVALID_FLOW_2); <START> Assert.assertEquals(4, flow2.getNodes().size()); <END> Assert.assertEquals(1, flow2.getErrors().size()); Assert.assertEquals(4, loader.getEdgeMap().get(INVALID_FLOW_2).size()); Assert.assertEquals(4, flow2.getEdges().size()); for (final Edge edge : loader.getEdgeMap().get(INVALID_FLOW_2)) { this.logger.info(INVALID_FLOW_2 + ".flow has edge: " + edge.getId()); if (edge.getError() != null) { Assert.assertEquals(CYCLE_FOUND_ERROR, edge.getError()); } } }</code><technical_language>parsing yaml runs issue, nodes identified anyhow. intention this behavior</technical_language>

Target:
public void testLoadInvalidFlowYamlFiles() { final DirectoryYamlFlowLoader loader = new DirectoryYamlFlowLoader(new Props()); loader.loadProjectFlow(this.project, ExecutionsTestUtil.getFlowDir(INVALID_FLOW_YAML_DIR)); checkFlowLoaderProperties(loader, 2, 2, 2); checkFlowProperties(loader, INVALID_FLOW_1, 1, 3, 3, DEPENDENCY_NOT_FOUND_ERROR); checkFlowProperties(loader, INVALID_FLOW_2, 1, 4, 4, CYCLE_FOUND_ERROR); }
Source:
<code>public void Namespace(String namespace) { this.namespace = namespace; sharedPreferences = context.getSharedPreferences(namespace, Context.MODE_PRIVATE); <START> if (sharedPreferenceChangeListener != null) { <END> sharedPreferences.unregisterOnSharedPreferenceChangeListener(sharedPreferenceChangeListener); } sharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { notifyDataObservers(key, GetValue(key, null)); } }; sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener); }</code><technical_language>need unregister line 94, calling unregister a sharedPreferences object register call on</technical_language>

Target:
public void Namespace(String namespace) { this.namespace = namespace; if (sharedPreferences != null) { sharedPreferences.unregisterOnSharedPreferenceChangeListener(sharedPreferenceChangeListener); } sharedPreferences = context.getSharedPreferences(namespace, Context.MODE_PRIVATE); sharedPreferences.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener); }
Source:
<code>public static URI appendParameters(URI oldUri, Map<String, String> queryParams) { String newQuery = oldUri.getQuery(); <START> String appendQuery = queryParams.entrySet().stream() <END> .map(param -> param.getKey() + "=" + param.getValue()) .reduce("", (a, b) -> a + "&" + b); if (newQuery == null) { newQuery = StringUtils.removeStart(appendQuery, "&"); } else { newQuery += appendQuery; } try { return new URI(oldUri.getScheme(), oldUri.getAuthority(), oldUri.getPath(), newQuery, oldUri.getFragment()); } catch (URISyntaxException e) { throw new RuntimeException(e); } }</code><technical_language>UriComponentsBuilder</technical_language>

Target:
public static URI appendParameters(URI oldUri, Map<String, String> queryParams) { MultiValueMap<String, String> localQueryParams = new LinkedMultiValueMap<>(); queryParams.entrySet().forEach(entry -> localQueryParams.add(entry.getKey(), entry.getValue())); return fromUri(oldUri).queryParams(localQueryParams).build().toUri(); }
Source:
<code>private static boolean checkGitIgnore(IResource resource) { <START> IContainer container = resource.getParent(); <END> IFile gitignore = container.getFile(new Path(Constants.GITIGNORE_FILENAME)); return searchForExact("/" + resource.getName(), gitignore); }</code><technical_language><LINK_0> .gitignore files exist in hierarchy level of repository. precedence properly account</technical_language>

Target:
private static boolean checkGitIgnore(IResource resource) { IResource res = resource; boolean isContainer = false; DoubleBool retval = new DoubleBool(false); String name = "/" + resource.getName(); while (!retval.changed && res.getProjectRelativePath() != Path.EMPTY) { res = res.getParent(); System.out.println("Checking file in " + res.getName()); IFile gitignore = ((IContainer) res).getFile( new Path(Constants.GITIGNORE_FILENAME)); if (res instanceof IContainer) isContainer = true; if (!gitignore.exists()) continue; retval = searchForExact(name, gitignore, isContainer); name = "/" + res.getName() + name; } return retval.value; }
Source:
<code>public void handle(Request request, Response response) throws Exception { try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto project = componentFinder.getByKey(dbSession, request.mandatoryParam(PARAM_PROJECT)); if (!userSession.hasComponentPermission(UserRole.USER, project) && !userSession.hasComponentPermission(UserRole.ADMIN, project)) { throw insufficientPrivilegesException(); } Optional<OrganizationDto> organization = dbClient.organizationDao().selectByUuid(dbSession, project.getOrganizationUuid()); if (!organization.isPresent()) { throw new NotFoundException(format("Organization [%s] is absent", project.getOrganizationUuid())); <START> } <END> Optional<QualityGateData> data = qualityGateFinder.getQualityGate(dbSession, organization.get(), project.getId()); writeProtobuf(buildResponse(data), request, response); } }</code><technical_language>Please QualityGateWsSupport#getOrganization (QualityGateWsSupport is in this class, need rebase common branch)</technical_language>

Target:
public void handle(Request request, Response response) throws Exception { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = wsSupport.getOrganization(dbSession, request); ComponentDto project = componentFinder.getByKey(dbSession, request.mandatoryParam(PARAM_PROJECT)); wsSupport.checkProjectBelongsToOrganization(organization, project); if (!userSession.hasComponentPermission(USER, project) && !userSession.hasComponentPermission(ADMIN, project)) { throw insufficientPrivilegesException(); } QualityGateData data = qualityGateFinder.getQualityGate(dbSession, organization, project.getId()); writeProtobuf(buildResponse(data), request, response); } }
Source:
<code>private void execute() { if (fFinishedLatch.getCount() == 0) { return; } synchronized (syncObj) { if (fStarted) { return; } fStarted = true; } final ITmfTrace trace = fTrace; fJob = new Job(NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName())) { @Override protected IStatus run(final IProgressMonitor monitor) { try { monitor.beginTask("", IProgressMonitor.UNKNOWN); broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this, TmfAbstractAnalysisModule.this)); fAnalysisCancelled = !executeAnalysis(monitor); } catch (TmfAnalysisException e) { Activator.logError("Error executing analysis with trace " + getTrace().getName(), e); } finally { synchronized (syncObj) { monitor.done(); setAnalysisCompleted(); } } if (!fAnalysisCancelled) { TmfTraceManager.refreshSupplementaryFiles(trace); return Status.OK_STATUS; } resetAnalysis(); return Status.CANCEL_STATUS; } @Override protected void canceling() { TmfAbstractAnalysisModule.this.canceling(); <START> TmfTraceManager.refreshSupplementaryFiles(trace); <END> } }; fJob.schedule(); }</code><technical_language>I refreshing is sufficient. I understand it, if job is sleeping, cancel() call cancelling() refresh happen</technical_language>

Target:
private void execute() { if (fFinishedLatch.getCount() == 0) { return; } synchronized (syncObj) { if (fStarted) { return; } fStarted = true; } final ITmfTrace trace = fTrace; fJob = new Job(NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, getName())) { @Override protected IStatus run(final IProgressMonitor monitor) { try { monitor.beginTask("", IProgressMonitor.UNKNOWN); broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this, TmfAbstractAnalysisModule.this)); fAnalysisCancelled = !executeAnalysis(monitor); } catch (TmfAnalysisException e) { Activator.logError("Error executing analysis with trace " + getTrace().getName(), e); } finally { synchronized (syncObj) { monitor.done(); setAnalysisCompleted(); } TmfTraceManager.refreshSupplementaryFiles(trace); } if (!fAnalysisCancelled) { return Status.OK_STATUS; } resetAnalysis(); return Status.CANCEL_STATUS; } @Override protected void canceling() { TmfAbstractAnalysisModule.this.canceling(); } }; fJob.schedule(); }
Source:
<code>private List<String> multiLinesIn() { <START> String[] lines = getImage().split("\\R"); <END> List<String> filteredLines = new ArrayList<>(lines.length); for (String rawLine : lines) { String line = rawLine.trim(); Matcher allMatcher = COMMENT_LINE_COMBINED.matcher(line); if (allMatcher.matches()) { filteredLines.add(allMatcher.group(1).trim()); } } return filteredLines; }</code><technical_language>support for line break matcher is Java8+ only. extended version of this: \u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]</technical_language>

Target:
private List<String> multiLinesIn() { String[] lines = NEWLINES_PATTERN.split(getImage()); List<String> filteredLines = new ArrayList<>(lines.length); for (String rawLine : lines) { String line = rawLine.trim(); Matcher allMatcher = COMMENT_LINE_COMBINED.matcher(line); if (allMatcher.matches()) { filteredLines.add(allMatcher.group(1).trim()); } } return filteredLines; }
Source:
<code>private void checkOpenGL() { boolean[] requiredCapabilities = { GLContext.getCapabilities().OpenGL12, GLContext.getCapabilities().OpenGL14, GLContext.getCapabilities().OpenGL15, GLContext.getCapabilities().OpenGL20, GLContext.getCapabilities().OpenGL21, <START> <END> GLContext.getCapabilities().GL_ARB_framebuffer_object, GLContext.getCapabilities().GL_ARB_texture_float, GLContext.getCapabilities().GL_ARB_half_float_pixel}; String[] capabilityNames = {"OpenGL12", "OpenGL14", "OpenGL15", "OpenGL20", "OpenGL21", "OpenGL30", "OpenGL32", "OpenGL33", "GL_ARB_framebuffer_object", "GL_ARB_texture_float", "GL_ARB_half_float_pixel"}; boolean canRunTheGame = true; String missingCapabilitiesMessage = ""; for (int index = 0; index < requiredCapabilities.length; index++) { if (!requiredCapabilities[index]) { missingCapabilitiesMessage += " - " + capabilityNames[index] + "\n"; canRunTheGame = false; } } if (!canRunTheGame) { String completeErrorMessage = completeErrorMessage(missingCapabilitiesMessage); throw new IllegalStateException(completeErrorMessage); } }</code><technical_language>remove versions capabilityNames too</technical_language>

Target:
private void checkOpenGL() { boolean[] requiredCapabilities = { GLContext.getCapabilities().OpenGL12, GLContext.getCapabilities().OpenGL14, GLContext.getCapabilities().OpenGL15, GLContext.getCapabilities().OpenGL20, GLContext.getCapabilities().OpenGL21, GLContext.getCapabilities().GL_ARB_framebuffer_object, GLContext.getCapabilities().GL_ARB_texture_float, GLContext.getCapabilities().GL_ARB_half_float_pixel}; String[] capabilityNames = {"OpenGL12", "OpenGL14", "OpenGL15", "OpenGL20", "OpenGL21", "GL_ARB_framebuffer_object", "GL_ARB_texture_float", "GL_ARB_half_float_pixel"}; boolean canRunTheGame = true; String missingCapabilitiesMessage = ""; for (int index = 0; index < requiredCapabilities.length; index++) { if (!requiredCapabilities[index]) { missingCapabilitiesMessage += " - " + capabilityNames[index] + "\n"; canRunTheGame = false; } } if (!canRunTheGame) { String completeErrorMessage = completeErrorMessage(missingCapabilitiesMessage); throw new IllegalStateException(completeErrorMessage); } }
Source:
<code><START> public CharSequence format(Coin coin) { <END> int maxDecimals = minDecimals; if (decimalGroups != null) for (int group : decimalGroups) maxDecimals += group; checkState(maxDecimals <= 8); long satoshis = Math.abs(coin.value); long precisionDivisor = checkedPow(10, 8 - shift - maxDecimals); satoshis = checkedMultiply(divide(satoshis, precisionDivisor, roundingMode), precisionDivisor); long shiftDivisor = checkedPow(10, 8 - shift); long numbers = satoshis / shiftDivisor; long decimals = satoshis % shiftDivisor; String decimalsStr = String.format(Locale.US, "%0" + (8 - shift) + "d", decimals); StringBuilder str = new StringBuilder(decimalsStr); while (str.length() > minDecimals && str.charAt(str.length() - 1) == '0') str.setLength(str.length() - 1); int i = minDecimals; if (decimalGroups != null) { for (int group : decimalGroups) { if (str.length() > i && str.length() < i + group) { while (str.length() < i + group) str.append('0'); break; } i += group; } } if (str.length() > 0) str.insert(0, decimalMark); str.insert(0, numbers); if (coin.value < 0) str.insert(0, negativeSign); else if (positiveSign != 0) str.insert(0, positiveSign); return str; }</code><technical_language>Is a reason avoid BigDecimal here</technical_language>

Target:
public CharSequence format(Coin coin) { int maxDecimals = minDecimals; if (decimalGroups != null) for (int group : decimalGroups) maxDecimals += group; checkState(maxDecimals <= Coin.NUM_COIN_DECIMALS); long satoshis = Math.abs(coin.value); long precisionDivisor = checkedPow(10, Coin.NUM_COIN_DECIMALS - shift - maxDecimals); satoshis = checkedMultiply(divide(satoshis, precisionDivisor, roundingMode), precisionDivisor); long shiftDivisor = checkedPow(10, Coin.NUM_COIN_DECIMALS - shift); long numbers = satoshis / shiftDivisor; long decimals = satoshis % shiftDivisor; String decimalsStr = String.format(Locale.US, "%0" + (Coin.NUM_COIN_DECIMALS - shift) + "d", decimals); StringBuilder str = new StringBuilder(decimalsStr); while (str.length() > minDecimals && str.charAt(str.length() - 1) == '0') str.setLength(str.length() - 1); int i = minDecimals; if (decimalGroups != null) { for (int group : decimalGroups) { if (str.length() > i && str.length() < i + group) { while (str.length() < i + group) str.append('0'); break; } i += group; } } if (str.length() > 0) str.insert(0, decimalMark); str.insert(0, numbers); if (coin.value < 0) str.insert(0, negativeSign); else if (positiveSign != 0) str.insert(0, positiveSign); return str; }
Source:
<code>public Identifier save(Identifier delegate) { <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>reason some times ResourceDoesNotSupportOperationException other times UnsupportedOperationException</technical_language>

Target:
public Identifier save(Identifier delegate) { throw new ResourceDoesNotSupportOperationException(); }
Source:
<code>public Builder withAppProfileId(ValueProvider<String> appProfileId) { return withConfiguration(BigtableOptionsFactory.APP_PROFILE_ID_KEY, appProfileId); <START> } <END></code><technical_language>Nit: extra space end removed</technical_language>

Target:
Builder withAppProfileId(ValueProvider<String> appProfileId) { return withConfiguration(BigtableOptionsFactory.APP_PROFILE_ID_KEY, appProfileId); }
Source:
<code>public static String lastModifiedDateFormat( final Date date ) { <START> return LAST_MODIFIED_DATE_FORMAT.format(date); <END> }</code><technical_language>SimpleDateFormat is thread safe, share threads. static instance _can_ threads this method is static, safe this change</technical_language>

Target:
public static String lastModifiedDateFormat( final Date date ) { return LAST_MODIFIED_DATE_FORMAT.format(date.toInstant()); }
Source:
<code>public void sendReminderNotification() { <START> String NOTIFICATION_TITLE = "\u23f0"; <END> String NOTIFICATION_TEXT = context.getString(R.string.reminders_notification_text); String NOTIFICATION_ACTION = context.getString(R.string.reminders_notification_action); Intent intent = new Intent(context, AddGlucoseActivity.class); intent.putExtra("glucose_reminder_notification", true); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); Notification notification; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { notification = new Notification.Builder(context) .setContentTitle(NOTIFICATION_TITLE) .setContentText(NOTIFICATION_TEXT) .setAutoCancel(true) .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) .setVibrate(new long[]{1000, 1000}) .setColor(context.getColor(R.color.glucosio_pink)) .setContentIntent(pendingIntent) .setSmallIcon(R.drawable.ic_stat_glucosio) .build(); } else { notification = new Notification.Builder(context) .setContentTitle(NOTIFICATION_TITLE) .setContentText(NOTIFICATION_TEXT) .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) .setVibrate(new long[]{1000, 1000}) .setAutoCancel(true) .setContentIntent(pendingIntent) .setSmallIcon(R.drawable.ic_stat_glucosio) .build(); } NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context); notificationManagerCompat.notify(NOTIFICATION_ID, notification); }</code><technical_language>capitalised</technical_language>

Target:
public void sendReminderNotification() { String NOTIFICATION_TITLE = "\u23f0"; String NOTIFICATION_TEXT = context.getString(R.string.reminders_notification_text); Intent intent = new Intent(context, AddGlucoseActivity.class); intent.putExtra("glucose_reminder_notification", true); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); Notification.Builder notificationBuilder; notificationBuilder = new Notification.Builder(context) .setContentTitle(NOTIFICATION_TITLE) .setContentText(NOTIFICATION_TEXT) .setAutoCancel(true) .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) .setVibrate(new long[]{1000, 1000}) .setContentIntent(pendingIntent) .setSmallIcon(R.drawable.ic_stat_glucosio); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { notificationBuilder.setColor(context.getColor(R.color.glucosio_pink)); } Notification notification = notificationBuilder.build(); NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context); notificationManagerCompat.notify(NOTIFICATION_ID, notification); }
Source:
<code>private Map<String, DataRight> getClassificationToDataRights(QueryBuilder query) { Map<String, DataRight> toReturn = new HashMap<String, DataRight>(); @SuppressWarnings("unchecked") ArtifactReadable footerMappingArt = query.andIds(MAPPING_ARTIFACT).getResults().getOneOrNull(); <START> <END> List<String> footers = new ArrayList<String>(); if (footerMappingArt != null) { footers = footerMappingArt.getAttributeValues(CoreAttributeTypes.GeneralStringData); for (String footer : footers) { String[] enumToFooter = footer.split("\\n", 2); if (enumToFooter.length == 2) { DataRightId id = new DataRightId(); id.setId(GUID.create()); DataRight dataRight = new DataRight(); dataRight.setId(id); dataRight.setContent(enumToFooter[1].trim()); toReturn.put(enumToFooter[0].trim(), dataRight); } } } return toReturn; }</code><technical_language>move list declaration if section</technical_language>

Target:
private Map<String, DataRight> getClassificationToDataRights(QueryBuilder query) { Map<String, DataRight> toReturn = new HashMap<String, DataRight>(); @SuppressWarnings("unchecked") ArtifactReadable footerMappingArt = query.andIds(MAPPING_ARTIFACT).getResults().getOneOrNull(); if (footerMappingArt != null) { List<String> footers = new ArrayList<String>(); footers = footerMappingArt.getAttributeValues(CoreAttributeTypes.GeneralStringData); for (String footer : footers) { String[] enumToFooter = footer.split("\\n", 2); if (enumToFooter.length == 2) { DataRightId id = new DataRightId(); id.setId(GUID.create()); DataRight dataRight = new DataRight(); dataRight.setId(id); dataRight.setContent(enumToFooter[1].trim()); toReturn.put(enumToFooter[0].trim(), dataRight); } } } return toReturn; }
Source:
<code>@Override public void close() throws Exception { log.info("Pipeline task is starting shutdown"); int size = phaseComplete.size(); for (int i = (size - 1); i >= 0; i--) { phaseComplete.get(i).cancel(false); } for (int i = (size - 1); i >= 0; i--) { try { <START> if (!phaseComplete.get(i).isCancelled()) { <END> phaseNext.get(i).join(); } } catch (CompletionException ex) { log.error("Phase phaseNext future encountered an exception while starting phase {}: ", i + 1, i + 2, ex); throw ex; } catch (CancellationException ex) { log.error("Race condition: Phase phaseNext future was cancelled by another thread: ", i + 1, ex); throw ex; } } if (currentPhase != null) { currentPhase.close(); } }</code><technical_language>result cancel attempt earlier</technical_language>

Target:
@Override public void close() throws Exception { log.info("Pipeline task is starting shutdown"); int size = phaseComplete.size(); boolean cancel[] = new boolean[size]; for (int i = (size - 1); i >= 0; i--) { cancel[i] = phaseComplete.get(i).cancel(false); } for (int i = (size - 1); i >= 0; i--) { try { if (!cancel[i]) { phaseNext.get(i).join(); } } catch (CompletionException ex) { String msg = "Phase " + (i + 1) + " phaseNext future encountered an " + "exception while starting phase " + (i + 2); throw new IOException(msg, ex); } catch (CancellationException ex) { String msg = "Race condition: Phase " + (i + 1) + " phaseNext " + "future was cancelled by another thread"; throw new IOException(msg, ex); } } if (currentPhase != null) { currentPhase.close(); } }
Source:
<code>public boolean matchesSuffixOnly(@Nullable final String s) { if (suffixStyle == SuffixStyle.MATCH_ANY) { return true; } else if (suffixStyle == SuffixStyle.MATCH_EMPTY) { <START> return s == null || s.length() == prefix.length(); <END> } else { return suffixPattern.matcher(Strings.nullToEmpty(s).substring(prefix.length())).matches(); } }</code><technical_language>in this case s == null means a match here? if prefix.length() == 0</technical_language>

Target:
public boolean matchesSuffixOnly(@Nullable final String s) { if (suffixMatch == SuffixMatch.MATCH_ANY) { return true; } else if (suffixMatch == SuffixMatch.MATCH_EMPTY) { return (s == null ? 0 : s.length()) == prefix.length(); } else { return matches(s); } }
Source:
<code><START> private static Map<Integer, String> getExecutableNames(ITmfTrace trace) { <END> Map<Integer, String> executableNames = new HashMap<>(); KernelAnalysisModule kernelAnlysis = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID); if (kernelAnlysis == null) { return Collections.emptyMap(); } Collection<Integer> collection = KernelThreadInformationProvider.getThreadIds(kernelAnlysis); if (!collection.equals(Collections.emptySet())) { for (Integer TID : collection) { String execName = KernelThreadInformationProvider.getExecutableName(kernelAnlysis, TID); if (execName != null) { executableNames.put(TID, execName); } } } return executableNames; }</code><technical_language>this a bug: tids re-used. need compensate for that. This is more for Gen consider</technical_language>

Target:
private static Map<Integer, String> getExecutableNames(ITmfTrace trace) { Map<Integer, String> executableNames = new HashMap<>(); KernelAnalysisModule kernelAnlysis = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID); if (kernelAnlysis == null) { return Collections.emptyMap(); } Collection<Integer> threadIds = KernelThreadInformationProvider.getThreadIds(kernelAnlysis); if (!threadIds.isEmpty()) { for (Integer tid : threadIds) { String execName = KernelThreadInformationProvider.getExecutableName(kernelAnlysis, tid); if (execName != null) { executableNames.put(tid, execName); } } } return executableNames; }
Source:
<code>public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, CANCELLING, <START> ""); <END> }</code><technical_language>suggestion EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, CANCELLING, EMPTY_VALUE); }
Source:
<code>public void saveLastVitalsEncounter(Encounter encounter, String patientUUID) { if (null != encounter) { encounter.setPatientUUID(patientUUID); long oldLastVitalsEncounterID = getLastVitalsEncounterID(patientUUID); if (0 != oldLastVitalsEncounterID) { for (Observation obs: new ObservationDAO().findObservationByEncounterID(oldLastVitalsEncounterID)) { new ObservationTable().delete(obs.getId()); } new EncounterTable().delete(oldLastVitalsEncounterID); } ObservationDAO observationDAO = new ObservationDAO(); long encounterID = saveEncounter(encounter, null); for (Observation obs : encounter.getObservations()) { observationDAO.saveObservation(obs, encounterID) <START> .observeOn(AndroidSchedulers.mainThread()) <END> .subscribe(); } } }</code><technical_language>yeah I need mainThread learning :D</technical_language>

Target:
public void saveLastVitalsEncounter(Encounter encounter, String patientUUID) { if (null != encounter) { encounter.setPatientUUID(patientUUID); long oldLastVitalsEncounterID = getLastVitalsEncounterID(patientUUID); if (0 != oldLastVitalsEncounterID) { for (Observation obs: new ObservationDAO().findObservationByEncounterID(oldLastVitalsEncounterID)) { new ObservationTable().delete(obs.getId()); } new EncounterTable().delete(oldLastVitalsEncounterID); } ObservationDAO observationDAO = new ObservationDAO(); long encounterID = saveEncounter(encounter, null); for (Observation obs : encounter.getObservations()) { observationDAO.saveObservation(obs, encounterID) .observeOn(Schedulers.io()) .subscribe(); } } }
Source:
<code>protected void handleRemoteBrowseSelected() { IRemoteConnection currentConnectionSelected = getCurrentConnection(); RemoteResourceBrowser b = new RemoteResourceBrowser(getControl().getShell(), SWT.RESIZE); b.setConnection(currentConnectionSelected); b.setTitle(Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title); <START> b.setType(RemoteResourceBrowser.FILE_BROWSER); <END> int returnCode = b.open(); if (returnCode == Window.CANCEL) { return; } IFileStore selectedFile = b.getResource(); if (selectedFile != null) { String absPath = selectedFile.toURI().getPath(); if (selectedFile.fetchInfo().isDirectory()) { IPath appPath = new Path(fProgText.getText().trim()); String lastSegment = appPath.lastSegment(); if (lastSegment != null && lastSegment.trim().length() > 0) { IPath remotePath = new Path(absPath).append(lastSegment.trim()); absPath = remotePath.toPortableString(); } } remoteProgText.setText(absPath); } }</code><technical_language>This setting limits browsing files, this solution allowed directories files, this covers for possibility binary file exits e.g. time trigger launch. selection of a directory, CDT remote launch append name of binary complete file path use. thefore remove this line</technical_language>

Target:
protected void handleRemoteBrowseSelected() { IRemoteConnection currentConnectionSelected = getCurrentConnection(); RemoteResourceBrowser b = new RemoteResourceBrowser(getControl().getShell(), SWT.NONE); b.setConnection(currentConnectionSelected); b.setTitle(Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title); int returnCode = b.open(); if (returnCode == Window.CANCEL) { return; } IFileStore selectedFile = b.getResource(); if (selectedFile != null) { String absPath = selectedFile.toURI().getPath(); if (selectedFile.fetchInfo().isDirectory()) { IPath appPath = new Path(fProgText.getText().trim()); String lastSegment = appPath.lastSegment(); if (lastSegment != null && lastSegment.trim().length() > 0) { IPath remotePath = new Path(absPath).append(lastSegment.trim()); absPath = remotePath.toPortableString(); } } remoteProgText.setText(absPath); } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final MessageMetadata other = (MessageMetadata) obj; return Objects.equals(this.id, other.id) && Objects.equals(this.timestamp, other.timestamp) <START> && Objects.equals(this.traceId, other.traceId); <END> }</code><technical_language>do need traceId identify object? i previous implementation fine</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final MessageMetadata other = (MessageMetadata) obj; return Objects.equals(this.id, other.id) && Objects.equals(this.timestamp, other.timestamp); }
Source:
<code>public StatementPatternMetadata readStatementPatternMetadata(SnapshotBase tx, String nodeId) { Optional<NodeType> type = NodeType.fromNodeId(nodeId); try { <START> checkArgument(type.isPresent() && type.get() == NodeType.STATEMENT_PATTERN); <END> LOG.debug("Retrieving Metadata from Cache: {}", nodeId); return (StatementPatternMetadata) commonNodeMetadataCache.get(nodeId, new Callable<CommonNodeMetadata>() { @Override public CommonNodeMetadata call() throws Exception { LOG.debug("Seeking Metadata from Fluo Table: {}", nodeId); return dao.readStatementPatternMetadata(tx, nodeId); } }); } catch (Exception e) { throw new RuntimeException("Unable to access StatementPatternMetadata for nodeId: " + nodeId, e); } }</code><technical_language>Add a message for exception thrown this method</technical_language>

Target:
public StatementPatternMetadata readStatementPatternMetadata(SnapshotBase tx, String nodeId) { checkNotNull(nodeId); checkNotNull(tx); Optional<NodeType> type = NodeType.fromNodeId(nodeId); checkArgument(type.isPresent() && type.get() == NodeType.STATEMENT_PATTERN); try { LOG.debug("Retrieving Metadata from Cache: {}", nodeId); return (StatementPatternMetadata) commonNodeMetadataCache.get(nodeId, () -> { LOG.debug("Seeking Metadata from Fluo Table: {}", nodeId); return dao.readStatementPatternMetadata(tx, nodeId); }); } catch (Exception e) { throw new RuntimeException("Unable to access StatementPatternMetadata for nodeId: " + nodeId, e); } }