auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private DbSpace(EnvironmentImpl envImpl) { this.envImpl = envImpl; UtilizationProfile profile = this.envImpl.getUtilizationProfile(); SortedMap<Long, FileSummary> map = profile.getFileSummaryMap(true); Map<Long, FileSummary> recalcMap = (this.recalc) ? UtilizationFileReader.calcFileSummaryMap(this.envImpl) : null; int fileIndex = 0; totals = new Summary(); summaries = new Summary[map.size()]; Iterator<Map.Entry<Long, FileSummary>> iter = map.entrySet().iterator(); while(iter.hasNext()) { Map.Entry<Long, FileSummary> entry = iter.next(); Long fileNum = entry.getKey(); FileSummary fs = entry.getValue(); FileSummary recalcFs = null; if(recalcMap != null) { recalcFs = recalcMap.get(fileNum); } Summary summary = new Summary(fileNum, fs, recalcFs); if(summaries != null) { summaries[fileIndex] = summary; } totals.add(summary); fileIndex++; } if(summaries != null) { summaryDetails.append((this.recalc) ? " File Size (KB) % Used % Used (recalculated)\n-------- --------- ------ ------\n" : " File Size (KB) % Used\n-------- --------- ------\n"); for(int i = 0; i < summaries.length; ++i) { summaryDetails.append(summaries[i].toString()); summaryDetails.append("\n"); } } summaryDetails.append(totals.toString()); }

Target:
private DbSpace(EnvironmentImpl envImpl) { this.envImpl = envImpl; UtilizationProfile profile = this.envImpl.getUtilizationProfile(); SortedMap<Long, FileSummary> map = profile.getFileSummaryMap(true); int fileIndex = 0; totals = new Summary(); summaries = new Summary[map.size()]; Iterator<Map.Entry<Long, FileSummary>> iter = map.entrySet().iterator(); while(iter.hasNext()) { Map.Entry<Long, FileSummary> entry = iter.next(); Long fileNum = entry.getKey(); FileSummary fs = entry.getValue(); Summary summary = new Summary(fileNum, fs); summaries[fileIndex] = summary; totals.add(summary); fileIndex++; } summaryDetails.append(" File Size (KB) % Used\n-------- --------- ------\n"); for(int i = 0; i < summaries.length; ++i) { summaryDetails.append(summaries[i].toString()); summaryDetails.append("\n"); } summaryDetails.append(totals.toString()); }
Source:
public String getDataSharingNotificationForCurrentUser(Request request, Response response) { boolean shouldAllow = dataSharingNotification.allowNotificationFor(currentUsername()); return jsonizeAsTopLevelObject(request, writer -> writer.add("allow", shouldAllow)); }

Target:
public String getDataSharingNotificationForCurrentUser(Request request, Response response) { boolean shouldAllow = dataSharingNotification.allowNotificationFor(currentUsername()); return jsonizeAsTopLevelObject(request, writer -> writer.add("show_notification", shouldAllow)); }
Source:
public String index(Request request, Response response) throws IOException { List<CombinedPluginInfo> pluginInfos = new ArrayList<>(); String pluginType = request.queryParams("type"); Boolean includeBad = Boolean.valueOf(request.queryParams("include_bad")); try { Collection<CombinedPluginInfo> validPluginInfos = this.pluginInfoFinder.allPluginInfos(pluginType).stream() .filter(pluginInfo -> !hasUnsupportedExtensionType(pluginInfo)) .collect(Collectors.toList()); pluginInfos.addAll(validPluginInfos); } catch (InvalidPluginTypeException exception) { throw new UnprocessableEntityException(String.format("Invalid plugins type - `%s` !", pluginType)); } if (includeBad) { List<BadPluginInfo> badPluginInfos = defaultPluginManager.plugins().stream() .filter(GoPluginDescriptor::isInvalid) .map(BadPluginInfo::new) .collect(toList()); pluginInfos.addAll(badPluginInfos); } String etag = etagFor(pluginInfos); if (fresh(request, etag)) { return notModified(response); } setEtagHeader(response, etag); return writerForTopLevelObject(request, response, writer -> PluginInfosRepresenter.toJSON(writer, pluginInfos)); }

Target:
public String index(Request request, Response response) throws IOException { List<CombinedPluginInfo> pluginInfos = new ArrayList<>(); String pluginType = request.queryParams("type"); Boolean includeBad = Boolean.valueOf(request.queryParams("include_bad")); if (StringUtils.isNotBlank(pluginType) && !extensionsRegistry.allRegisteredExtensions().contains(pluginType)) { throw new UnprocessableEntityException(String.format("Invalid plugin type '%s'. It has to be one of '%s'.", pluginType, String.join(", ", extensionsRegistry.allRegisteredExtensions()))); } Collection<CombinedPluginInfo> validPluginInfos = this.pluginInfoFinder.allPluginInfos(pluginType).stream() .filter(pluginInfo -> !hasUnsupportedExtensionType(pluginInfo)) .collect(Collectors.toList()); pluginInfos.addAll(validPluginInfos); if (includeBad) { List<BadPluginInfo> badPluginInfos = defaultPluginManager.plugins().stream() .filter(GoPluginDescriptor::isInvalid) .map(BadPluginInfo::new) .collect(toList()); pluginInfos.addAll(badPluginInfos); } pluginInfos.sort(Comparator.comparing((CombinedPluginInfo pluginInfos1) -> pluginInfos1.getDescriptor().id())); String etag = etagFor(pluginInfos); if (fresh(request, etag)) { return notModified(response); } setEtagHeader(response, etag); return writerForTopLevelObject(request, response, writer -> PluginInfosRepresenter.toJSON(writer, pluginInfos)); }
Source:
public List<StoredEntry> getCompressedBitmaps() { while (!searchOffset.isEmpty()) { StoredEntry writeEntry = generateStoredEntry( searchOffset.pollFirst()); bitmapsToWrite.add(writeEntry); } Collections.reverse(bitmapsToWrite); return bitmapsToWrite; }

Target:
public List<StoredEntry> getCompressedBitmaps() { while (!bitmapsToWriteXorBuffer.isEmpty()) { bitmapsToWrite.add( generateStoredEntry(bitmapsToWriteXorBuffer.pollFirst())); } Collections.reverse(bitmapsToWrite); return bitmapsToWrite; }
Source:
public void reset() { this.sequenceIndex = -1; this.in.close(); if (getPath() != null) { this.in = new FastLineReader(IOUtil.openFileForReading(getPath())); } else { try { this.seekableStream.seek(0); } catch (IOException e) { throw new SAMException("Problem seeking to start of stream during reset", e); } this.in = new FastLineReader(this.seekableStream); } }

Target:
public void reset() { this.sequenceIndex = -1; if (getPath() != null) { this.in.close(); this.in = new FastLineReader(IOUtil.openFileForReading(getPath())); } else { try { this.seekableStream.seek(0); } catch (IOException e) { throw new SAMException("Problem seeking to start of stream during reset", e); } this.in = new FastLineReader(this.seekableStream); } }
Source:
public BUILDER removeAlternatives(String... alternatives) { if (this.alternatives == null) { return (BUILDER) this; } else { for (String alternative : alternatives) { if (isAlternativePresent(alternative)) { int length = this.alternatives.length; String[] newAlternatives = new String[length - 1]; int k = 0; for (String alt : this.alternatives) { if (alt != alternative) { newAlternatives[k] = alt; k++; } } this.alternatives = newAlternatives; } } } return (BUILDER) this; }

Target:
public final BUILDER removeAlternatives(String... alternatives) { if (this.alternatives == null) { return (BUILDER) this; } else { for (String alternative : alternatives) { if (isAlternativePresent(alternative)) { int length = this.alternatives.length; String[] newAlternatives = new String[length - 1]; int k = 0; for (String alt : this.alternatives) { if (alt != alternative) { newAlternatives[k] = alt; k++; } } this.alternatives = newAlternatives; } } } return (BUILDER) this; }
Source:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { MultiMap<String, GoImportSpec> importMap = file.getImportMap(); for (PsiElement importIdentifier : GoImportOptimizer.findRedundantImportIdentifiers(importMap)) { problemsHolder.registerProblem(importIdentifier, "Redundant alias", ProblemHighlightType.LIKE_UNUSED_SYMBOL, OPTIMIZE_QUICK_FIX); } Set<GoImportSpec> duplicatedEntries = GoImportOptimizer.findDuplicatedEntries(importMap); for (GoImportSpec duplicatedImportSpec : duplicatedEntries) { problemsHolder.registerProblem(duplicatedImportSpec, "Redeclared import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } for (Map.Entry<String, Collection<GoImportSpec>> specs : importMap.entrySet()) { if (".".equals(specs.getKey()) || "_".equals(specs.getKey())) { continue; } Iterator<GoImportSpec> imports = specs.getValue().iterator(); imports.next(); while (imports.hasNext()) { GoImportSpec redeclaredImport = imports.next(); if (!duplicatedEntries.contains(redeclaredImport)) { problemsHolder.registerProblem(redeclaredImport, "Redeclared import", ProblemHighlightType.GENERIC_ERROR); } } } if (!problemsHolder.isOnTheFly()) { resolveAllReferences(file); } for (PsiElement importEntry : GoImportOptimizer.filterUnusedImports(file, importMap).values()) { GoImportSpec spec = GoImportOptimizer.getImportSpec(importEntry); if (spec != null) { if (spec.getImportString().resolve() != null) { problemsHolder.registerProblem(spec, "Unused import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } } } }

Target:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { MultiMap<String, GoImportSpec> importMap = file.getImportMap(); for (PsiElement importIdentifier : GoImportOptimizer.findRedundantImportIdentifiers(importMap)) { problemsHolder.registerProblem(importIdentifier, "Redundant alias", ProblemHighlightType.LIKE_UNUSED_SYMBOL, OPTIMIZE_QUICK_FIX); } Set<GoImportSpec> duplicatedEntries = GoImportOptimizer.findDuplicatedEntries(importMap); for (GoImportSpec duplicatedImportSpec : duplicatedEntries) { problemsHolder.registerProblem(duplicatedImportSpec, "Redeclared import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } for (Map.Entry<String, Collection<GoImportSpec>> specs : importMap.entrySet()) { Iterator<GoImportSpec> imports = specs.getValue().iterator(); GoImportSpec originalImport = imports.next(); if (originalImport.isDot() || originalImport.isForSideEffects()) { continue; } while (imports.hasNext()) { GoImportSpec redeclaredImport = imports.next(); if (!duplicatedEntries.contains(redeclaredImport)) { problemsHolder.registerProblem(redeclaredImport, "Redeclared import", ProblemHighlightType.GENERIC_ERROR); } } } if (!problemsHolder.isOnTheFly()) { resolveAllReferences(file); } for (PsiElement importEntry : GoImportOptimizer.filterUnusedImports(file, importMap).values()) { GoImportSpec spec = GoImportOptimizer.getImportSpec(importEntry); if (spec != null) { if (spec.getImportString().resolve() != null) { problemsHolder.registerProblem(spec, "Unused import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX); } } } }
Source:
private static void oneProducer1Consumer(int prodBatchSz) { JCQueue q1 = new JCQueue("q1", null, 50_000, 0, prodBatchSz, new WaitStrategyPark(100), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry()); final Producer prod1 = new Producer(q1); final Consumer cons1 = new Consumer(q1); runAllThds(prod1, cons1); }

Target:
private static void oneProducer1Consumer(int prodBatchSz) { JCQueue q1 = new JCQueue("q1", "q1", 50_000, 0, prodBatchSz, new WaitStrategyPark(100), "test", "test", Collections.singletonList(1000), 1000, new StormMetricRegistry()); final Producer prod1 = new Producer(q1); final Consumer cons1 = new Consumer(q1); runAllThds(prod1, cons1); }
Source:
private boolean shouldBypassThrottling(HttpServletRequest request) { if (enableThrottlingIfHeader == null || enableThrottlingIfHeader.length() == 0) { return false; } return request.getHeader(enableThrottlingIfHeader) == null; }

Target:
private boolean shouldBypassThrottling(HttpServletRequest request) { if (enableThrottlingIfHeader == null) return false; return request.getHeader(enableThrottlingIfHeader) == null; }
Source:
public ImmutableBitmap fromByteBuffer(ByteBuffer buffer, int numBytes) { if (numBytes == 0) { return null; } buffer.limit(buffer.position() + numBytes); return new WrappedImmutableRoaringBitmap(new ImmutableRoaringBitmap(buffer)); }

Target:
public ImmutableBitmap fromByteBuffer(ByteBuffer buffer, int numBytes) { buffer.limit(buffer.position() + numBytes); return new WrappedImmutableRoaringBitmap(new ImmutableRoaringBitmap(buffer)); }
Source:
public Set<User> getMembers(DateTime when) { if (registered == null) { return Bennu.getInstance().getStudentsSet().stream() .filter(student -> student.getAlumni() != null || student.hasAnyRegistrationInState(RegistrationStateType.CONCLUDED) || student.hasAnyRegistrationInState(RegistrationStateType.STUDYPLANCONCLUDED) || isAlumni(student)) .map(student -> student.getPerson().getUser()) .collect(Collectors.toSet()); } else { return Bennu.getInstance().getAlumnisSet().stream() .filter(alumni -> alumni.getStudent().getPerson().getUser() != null) .map(alumni -> alumni.getStudent().getPerson().getUser()) .filter(user -> isMember(user, when)) .collect(Collectors.toSet()); } }

Target:
public Set<User> getMembers(DateTime when) { Set<Student> students = Bennu.getInstance().getStudentsSet(); if (registered == null) { students = students.stream() .filter(student -> student.getAlumni() != null || hasConcludedRegistration(student) || isAlumni(student)) .collect(Collectors.toSet()); } else if (registered) { students = students.stream().filter(student -> student.getAlumni() != null && isAlumni(student)) .collect(Collectors.toSet()); } else if (!registered) { students = students.stream() .filter(student -> student.getAlumni() == null && hasConcludedRegistration(student) && !isAlumni(student)) .collect(Collectors.toSet()); } if (degree != null) { students = students.stream().filter(student -> isDegreeConcluded(student)).collect(Collectors.toSet()); } return students.stream().map(student -> student.getPerson().getUser()).collect(Collectors.toSet()); }
Source:
public void acronym(String text, String definition) { throw new UnsupportedOperationException(); }

Target:
public void acronym(String text, String definition) { assertOpenBlock(); try { currentBlock.write(text); currentBlock.write('('); currentBlock.write(definition); currentBlock.write(')'); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
private void writeTestReportDocuments(Set<String> combinedTests, Map<String, List<Report.Test>> testsByName) { for (Map.Entry<String, List<Report.Test>> entry : testsByName.entrySet()) { if (combinedTests.contains(entry.getKey())) { continue; } TestAggregations ta = new TestAggregations(entry.getKey(), entry.getValue()); TestReportDocument testReport = new TestReportDocument(ta, targetDir, testReportConfig); freemarker.template.Configuration cfg = initConfig(); try { testReport.createReportDirectory(); testReport.createTestCharts(); Template reportTemplate = cfg.getTemplate("testReport.ftl"); PrintWriter printWriter = new PrintWriter(targetDir + File.separator + "test_" + testReport.testName + ".html"); Map root = new HashMap(); root.put("testReport", testReport); root.put("enums", DefaultObjectWrapper.getDefaultInstance().getEnumModels()); reportTemplate.process(root, printWriter); printWriter.close(); } catch (Exception e) { log.error("Templating exception", e); } } }

Target:
private void writeTestReportDocuments(Set<String> combinedTests, Map<String, List<Report.Test>> testsByName) { for (Map.Entry<String, List<Report.Test>> entry : testsByName.entrySet()) { if (combinedTests.contains(entry.getKey())) { continue; } TestAggregations ta = new TestAggregations(entry.getKey(), entry.getValue()); TestReportDocument testReport = new TestReportDocument(ta, targetDir, testReportConfig); testReport.createReportDirectory(); testReport.createTestCharts(); Map root = new HashMap(); root.put("testReport", testReport); root.put("enums", DefaultObjectWrapper.getDefaultInstance().getEnumModels()); processTemplate(root, targetDir, "test_" + testReport.testName + ".html", "testReport.ftl"); } }
Source:
public void preQuery(final UpToken token, final QueryHandler completeHandler) { final ZonesInfo zonesInfo = getZonesInfo(token); if (zonesInfo != null) { completeHandler.complete(0, null, null); return; } final RequestTranscation transcation = createUploadRequestTranscation(token); transcation.quertUploadHosts(true, new RequestTranscation.RequestCompleteHandler() { @Override public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) { if (responseInfo != null && responseInfo.isOK() && response != null){ ZonesInfo zonesInfoP = ZonesInfo.createZonesInfo(response); ZonesInfoMap.put(token.index(), zonesInfoP); completeHandler.complete(0, responseInfo, requestMetrics); } else { if (responseInfo.isNetworkBroken()){ completeHandler.complete(ResponseInfo.NetworkError, responseInfo, requestMetrics); } else { ZonesInfo zonesInfoP = FixedZone.localsZoneInfo().getZonesInfo(token); ZonesInfoMap.put(token.index(), zonesInfoP); completeHandler.complete(0, responseInfo, requestMetrics); } } destoryUploadRequestTranscation(transcation); } }); }

Target:
public void preQuery(final UpToken token, final QueryHandler completeHandler) { final ZonesInfo zonesInfo = getZonesInfo(token); if (zonesInfo != null) { completeHandler.complete(0, null, null); return; } final RequestTransaction transaction = createUploadRequestTransaction(token); transaction.queryUploadHosts(true, new RequestTransaction.RequestCompleteHandler() { @Override public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) { if (responseInfo != null && responseInfo.isOK() && response != null){ ZonesInfo zonesInfoP = ZonesInfo.createZonesInfo(response); ZonesInfoMap.put(token.index(), zonesInfoP); completeHandler.complete(0, responseInfo, requestMetrics); } else { if (responseInfo.isNetworkBroken()){ completeHandler.complete(ResponseInfo.NetworkError, responseInfo, requestMetrics); } else { ZonesInfo zonesInfoP = FixedZone.localsZoneInfo().getZonesInfo(token); ZonesInfoMap.put(token.index(), zonesInfoP); completeHandler.complete(0, responseInfo, requestMetrics); } } destroyUploadRequestTransaction(transaction); } }); }
Source:
private boolean isSwrveRemoteNotification(final Bundle msg) { Object rawId = msg.get(SwrveGcmConstants.SWRVE_TRACKING_KEY); String msgId = (rawId != null) ? rawId.toString() : null; return !SwrveHelper.isNullOrEmpty(msgId); }

Target:
protected boolean isSwrveRemoteNotification(final Bundle msg) { Object rawId = msg.get(SwrveGcmConstants.SWRVE_TRACKING_KEY); String msgId = (rawId != null) ? rawId.toString() : null; return !SwrveHelper.isNullOrEmpty(msgId); }
Source:
public final boolean matchesSafely(final T item) { try { final Iterator<String> headers = headers(item).iterator(); if (headers.hasNext()) { headers.next(); } final List<String> values = new ArrayList<String>(0); while (headers.hasNext()) { final String[] parts = AbstractHmHeader.split(headers.next()); if (this.header.matches(parts[0].trim())) { values.add(parts[1].trim()); } } final boolean result = this.value.matches(values); if (!result) { this.failed = values; } return result; } catch (final IOException ex) { throw new IllegalStateException(ex); } }

Target:
public final boolean matchesSafely(final T item) { try { final Iterator<String> headers = headers(item).iterator(); if (headers.hasNext()) { headers.next(); } final Collection<String> values = new ArrayList<String>(0); while (headers.hasNext()) { final String[] parts = AbstractHmHeader.split(headers.next()); if (this.header.matches(parts[0].trim())) { values.add(parts[1].trim()); } } final boolean result = this.value.matches(values); if (!result) { this.failed = values; } return result; } catch (final IOException ex) { throw new IllegalStateException(ex); } }
Source:
public void testDelete() throws Exception { URI uri = api().delete(resourcegroup); assertNotNull(uri); assertTrue(uri.toString().contains("api-version")); assertTrue(uri.toString().contains("operationresults")); String[] params = uri.getQuery().split("&"); String apiversion = ""; for (String param : params) { String name = param.split("=")[0]; if (name.equals("api-version")){ apiversion = param.split("=")[1]; break; } } JobStatus status = api.getJobApi().jobDone(uri, apiversion); assertEquals(status, JobStatus.DONE); uri = api().delete("jcloudstest"); assertNotNull(uri); uri = api().delete("blahblah"); assertNull(uri); }

Target:
public void testDelete() throws Exception { URI uri = api().delete(resourcegroup); if (uri != null){ assertTrue(uri.toString().contains("api-version")); assertTrue(uri.toString().contains("operationresults")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return JobStatus.DONE == api.getJobApi().jobStatus(uri); } }, 60 * 1 * 1000 ).apply(uri); assertTrue(jobDone, "delete operation did not complete in the configured timeout"); } uri = api().delete("jcloudstest"); if (uri != null){ assertTrue(uri.toString().contains("api-version")); assertTrue(uri.toString().contains("operationresults")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return JobStatus.DONE == api.getJobApi().jobStatus(uri); } }, 60 * 1 * 1000 ).apply(uri); assertTrue(jobDone, "delete operation did not complete in the configured timeout"); } }
Source:
public void testRemoveValueUnequalStoreEntryCacheAccessExceptionEqualCacheWriterEntry() throws Exception { final MockStore realStore = new MockStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(realStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final MockCacheWriter realCache = new MockCacheWriter(Collections.singletonMap("key", "value")); this.cacheWriter = spy(realCache); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); assertThat(realCache.getEntries().containsKey("key"), is(true)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }

Target:
public void testRemoveValueUnequalStoreEntryCacheAccessExceptionEqualCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.singletonMap("key", "value")); this.cacheWriter = spy(fakeWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); ehcache.remove("key", "value"); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
public void getJoinCond(ASTNode node) { if (node == null) { return; } int rootType = node.getToken().getType(); if (rootType == TOK_JOIN || rootType == TOK_LEFTOUTERJOIN || rootType == TOK_RIGHTOUTERJOIN || rootType == TOK_FULLOUTERJOIN || rootType == TOK_LEFTSEMIJOIN || rootType == TOK_UNIQUEJOIN) { ASTNode left = (ASTNode) node.getChild(0); ASTNode right = (ASTNode) node.getChild(1); String joinType = ""; String JoinToken = node.getToken().getText(); if (JoinToken.equals("TOK_JOIN")) { joinType = "inner join"; } else if (JoinToken.equals("TOK_LEFTOUTERJOIN")) { joinType = "left outer join"; } else if (JoinToken.equals("TOK_RIGHTOUTERJOIN")) { joinType = "right outer join"; } else if (JoinToken.equals("TOK_FULLOUTERJOIN")) { joinType = "full outer join"; } else if (JoinToken.equals("TOK_LEFTSEMIJOIN")) { joinType = "left semi join"; } else if (JoinToken.equals("TOK_UNIQUEJOIN")) { joinType = "unique join"; } else { LOG.info("Non supported join type : " + JoinToken); } String joinCond = ""; if (node.getChildCount() > 2) { joinCond = HQLParser.getString((ASTNode) node.getChild(2)); } String joinClause = joinType.concat(HQLParser.getString(right)) .concat(" on ").concat(joinCond); joinCondition.append(" ").append(joinClause); } for (int i = 0; i < node.getChildCount(); i++) { ASTNode child = (ASTNode) node.getChild(i); getJoinCond(child); } }

Target:
public void getJoinCond(ASTNode node) { if (node == null) { return; } try { int rootType = node.getToken().getType(); if (rootType == TOK_JOIN || rootType == TOK_LEFTOUTERJOIN || rootType == TOK_RIGHTOUTERJOIN || rootType == TOK_FULLOUTERJOIN || rootType == TOK_LEFTSEMIJOIN || rootType == TOK_UNIQUEJOIN) { ASTNode left = (ASTNode) node.getChild(0); ASTNode right = (ASTNode) node.getChild(1); String joinType = ""; String JoinToken = node.getToken().getText(); if (JoinToken.equals("TOK_JOIN")) { joinType = "inner join"; } else if (JoinToken.equals("TOK_LEFTOUTERJOIN")) { joinType = "left outer join"; } else if (JoinToken.equals("TOK_RIGHTOUTERJOIN")) { joinType = "right outer join"; } else if (JoinToken.equals("TOK_FULLOUTERJOIN")) { joinType = "full outer join"; } else if (JoinToken.equals("TOK_LEFTSEMIJOIN")) { joinType = "left semi join"; } else if (JoinToken.equals("TOK_UNIQUEJOIN")) { joinType = "unique join"; } else { LOG.info("Non supported join type : " + JoinToken); } String joinCond = ""; if (node.getChildCount() > 2) { joinCond = HQLParser.getString((ASTNode) node.getChild(2)); } String joinClause = joinType.concat(HQLParser.getString(right)) .concat(" on ").concat(joinCond); joinCondition.append(" ").append(joinClause); } } catch (Exception e) { e.printStackTrace(); } for (int i = 0; i < node.getChildCount(); i++) { ASTNode child = (ASTNode) node.getChild(i); getJoinCond(child); } }
Source:
public void testIgnoreDefault() { Map<String, String> result = sessionProperties.createHeaderFromSession( createTestSession( ImmutableMap.of( "int_session_prop", 0, "double_session_prop", 0.0, "bool_session_prop", false))); assertTrue(result.isEmpty()); }

Target:
public void testIgnoreDefault() { Map<String, Object> sessionValues = ImmutableMap.<String, Object>builder() .put("int_session_prop", -1) .put("long_session_prop", 1) .put("double_session_prop", 0.01) .put("bool_session_prop", false) .put("another_string_session_prop", "123") .build(); Map<String, String> result = sessionProperties.toHeader(createTestSession(sessionValues)); assertTrue(result.isEmpty()); }
Source:
public void loadProductiveCollectionSheet(int centerId, CollectionSheetRequestPayload payload) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscription.add(collectionDataManager.fetchProductiveCollectionSheet(centerId, payload) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<CollectionSheetResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); try { if (e instanceof HttpException) { String errorMessage = ((HttpException) e).response().errorBody() .string(); getMvpView().showError(MFErrorParser.parseError(errorMessage) .getErrors().get(0).getDefaultUserMessage()); } } catch (Throwable throwable) { RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } } @Override public void onNext(CollectionSheetResponse sheet) { getMvpView().showProgressbar(false); getMvpView().showProductive(sheet); } })); }

Target:
public void loadProductiveCollectionSheet(int centerId, CollectionSheetRequestPayload payload) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscription.add(collectionDataManager.fetchProductiveCollectionSheet(centerId, payload) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<CollectionSheetResponse>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showError(MFErrorParser.errorMessage(e)); } @Override public void onNext(CollectionSheetResponse collectionSheetResponse) { getMvpView().showProgressbar(false); getMvpView().showProductive(collectionSheetResponse); } })); }
Source:
private Object handleMessage(String message) { Map parsed; try { parsed = GSON.fromJson(message, Map.class); Map<String, Object> numberTypeFix = (Map<String, Object>) parsed; if (numberTypeFix.containsKey("id")) { if (numberTypeFix.get("id") instanceof Number) { numberTypeFix.put("id", ((Number) numberTypeFix.get("id")).intValue()); } } } catch (RuntimeException ex) { return response(null, error(PARSE_ERROR, "Parse error", message)); } return exec(parsed); }

Target:
private Object handleMessage(String message) { Map parsed; try { parsed = GSON.fromJson(message, Map.class); Map<String, Object> numberTypeFix = (Map<String, Object>) parsed; if (numberTypeFix.containsKey("id")) { Object id = numberTypeFix.get("id"); if (id instanceof Number) { numberTypeFix.put("id", ((Number) id).intValue()); } } } catch (RuntimeException ex) { return response(null, error(PARSE_ERROR, "Parse error", message)); } return exec(parsed); }
Source:
public List<String> getColumnNames() { if ( count ) { return new ArrayList<String>( ) { { add( "n" ); } }; } return projection != null ? new ArrayList<>( projection.keySet() ) : Collections.<String>emptyList(); }

Target:
public List<String> getColumnNames() { if ( operation.isAggregation ) { return Collections.singletonList( "n" ); } return projection != null ? new ArrayList<>( projection.keySet() ) : Collections.<String>emptyList(); }
Source:
public CompletableFuture<Void> visitGetCacheEntryCommand(InvocationContext ctx, GetCacheEntryCommand command) throws Throwable { Object key = command.getKey(); TypeConverter<Object, Object, Object, Object> converter = determineTypeConverter(command.getFlags()); if (ctx.isOriginLocal()) { command.setKey(converter.boxKey(key)); } ctx.onReturn((ctx1, command1, rv, throwable) -> { if (throwable != null) throw throwable; if (rv == null) { return null; } CacheEntry entry = (CacheEntry) rv; Object returnValue = entry.getValue(); if (needsUnboxing(ctx)) { returnValue = converter.unboxValue(entry.getValue()); } return CompletableFuture.completedFuture(entryFactory .create(entry.getKey(), returnValue, entry.getMetadata(), entry.getLifespan(), entry.getMaxIdle())); }); return ctx.continueInvocation(); }

Target:
public CompletableFuture<Void> visitGetCacheEntryCommand(InvocationContext ctx, GetCacheEntryCommand command) throws Throwable { Object key = command.getKey(); TypeConverter<Object, Object, Object, Object> converter = determineTypeConverter(command.getFlags()); if (ctx.isOriginLocal()) { command.setKey(converter.boxKey(key)); } return ctx.onReturn((rCtx, rCommand, rv, throwable) -> { if (throwable != null) throw throwable; if (rv == null || !needsUnboxing(rCtx)) { return null; } CacheEntry entry = (CacheEntry) rv; Object returnValue = converter.unboxValue(entry.getValue()); return CompletableFuture.completedFuture(entryFactory .create(entry.getKey(), returnValue, entry.getMetadata(), entry.getLifespan(), entry.getMaxIdle())); }); }
Source:
public InternalTypeResolver(Function<ColumnHandle, String> nameResolver, Function<String, Class<? extends ColumnHandle>> classResolver, Map<String,Class<? extends TupleExpression>> expressionResolver) { this.nameResolver = requireNonNull(nameResolver, "nameResolver is null"); this.classResolver = requireNonNull(classResolver, "classResolver is null"); this.expressionResolver = expressionResolver; }

Target:
public InternalTypeResolver(Function<ColumnHandle, String> nameResolver, Function<String, Class<? extends ColumnHandle>> classResolver, Map<String, Class<? extends TupleExpression>> expressionResolver) { this.nameResolver = requireNonNull(nameResolver, "nameResolver is null"); this.classResolver = requireNonNull(classResolver, "classResolver is null"); this.expressionResolver = requireNonNull(expressionResolver, "expression resolver is null"); }
Source:
private static void updateScenarioStatus(@Nullable ITmfEvent event, IXmlStateSystemContainer container, final TmfXmlScenarioInfo info) { ITmfStateSystemBuilder ss = (ITmfStateSystemBuilder) container.getStateSystem(); long ts = getTimestamp(event, ss); ITmfStateValue value; try { switch (info.getStatus()) { case IN_PROGRESS: value = STATUS_MAP.get(ScenarioStatusType.IN_PROGRESS); break; case ABANDONED: value = STATUS_MAP.get(ScenarioStatusType.ABANDONED); break; case MATCHED: value = STATUS_MAP.get(ScenarioStatusType.MATCHED); break; case PENDING: value = STATUS_MAP.get(ScenarioStatusType.PENDING); break; default: value = TmfStateValue.nullValue(); break; } if (value != null) { ss.modifyAttribute(ts, value, info.getStatusQuark()); } } catch (StateValueTypeException | AttributeNotFoundException e) { Activator.logError("failed to update scenario status"); } }

Target:
private static void updateScenarioStatus(@Nullable ITmfEvent event, IXmlStateSystemContainer container, final TmfXmlScenarioInfo info) { ITmfStateSystemBuilder ss = (ITmfStateSystemBuilder) container.getStateSystem(); long ts = getTimestamp(event, ss); ITmfStateValue value; try { switch (info.getStatus()) { case IN_PROGRESS: value = STATUS_MAP.get(ScenarioStatusType.IN_PROGRESS); break; case ABANDONED: value = STATUS_MAP.get(ScenarioStatusType.ABANDONED); break; case MATCHED: value = STATUS_MAP.get(ScenarioStatusType.MATCHED); break; case PENDING: value = STATUS_MAP.get(ScenarioStatusType.PENDING); break; default: value = TmfStateValue.nullValue(); break; } ss.modifyAttribute(ts, NonNullUtils.checkNotNull(value), info.getStatusQuark()); } catch (StateValueTypeException | AttributeNotFoundException e) { Activator.logError("failed to update scenario status"); } }
Source:
public void parse(final SetCookie cookie, final String value) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); if (value == null) { return; } final int age; try { age = Integer.parseInt(value); } catch (final NumberFormatException e) { return; } if (age < 0) { return; } cookie.setExpiryDate(new Date(System.currentTimeMillis() + age * 1000L)); }

Target:
public void parse(final SetCookie cookie, final String value) throws MalformedCookieException { Args.notNull(cookie, "Cookie"); if (value == null) { throw new MalformedCookieException("Missing value for 'max-age' attribute"); } final int age; try { age = Integer.parseInt(value); } catch (final NumberFormatException e) { throw new MalformedCookieException ("Invalid 'max-age' attribute: " + value); } if (age < 0) { throw new MalformedCookieException ("Negative 'max-age' attribute: " + value); } cookie.setExpiryDate(new Date(System.currentTimeMillis() + age * 1000L)); }
Source:
private String transformToPluralForm(String singular) { StringBuilder plural = new StringBuilder(); plural.append(singular); if (singular.endsWith(LAST_CHAR_Y)) { int length = plural.length(); plural.replace(length - 1, length, PLURAL_SUFFIX_IES); } else if (singular.endsWith(LAST_CHAR_S) || singular.endsWith(LAST_CHAR_X) || singular.endsWith(LAST_CHAR_Z) || singular.endsWith(LAST_CHARS_CH) || singular.endsWith(LAST_CHARS_SH)) { plural.append(PLURAL_SUFFIX_ES); } else { plural.append(PLURAL_SUFFIX_S); } return plural.toString(); }

Target:
private String transformToPluralForm(String singular) { StringBuilder plural = new StringBuilder(); plural.append(singular); if (singular.endsWith(String.valueOf(LAST_CHAR_Y))) { int length = plural.length(); plural.replace(length - 1, length, PLURAL_SUFFIX_IES); } else if (singular.endsWith(String.valueOf(LAST_CHAR_S)) || singular.endsWith(String.valueOf(LAST_CHAR_X)) || singular.endsWith(String.valueOf(LAST_CHAR_Z)) || singular.endsWith(LAST_CHARS_CH) || singular.endsWith(LAST_CHARS_SH)) { plural.append(PLURAL_SUFFIX_ES); } else { plural.append(PLURAL_SUFFIX_S); } return plural.toString(); }
Source:
private List<Pair<Throwable, ErrorType>> collectUnsuppressedErrors(Component obj, MessagingException me, ErrorTypeLocator locator) { List<Pair<Throwable, ErrorType>> errors = new ArrayList<>(4); final List<Throwable> exceptionsAsList = getExceptionsAsList(me); for (Throwable e : exceptionsAsList) { if (e instanceof SuppressedMuleException) { break; } else { ErrorType type = errorTypeFromException(obj, locator, e); if (!isUnknownMuleError(type) && !isCriticalMuleError(type)) { errors.add(new Pair<>(e, type)); } } } return errors; }

Target:
private List<Pair<Throwable, ErrorType>> collectUnsuppressedErrors(Component obj, MessagingException me, ErrorTypeLocator locator) { List<Pair<Throwable, ErrorType>> errors = new ArrayList<>(4); final List<Throwable> exceptionsAsList = getExceptionsAsList(me); for (Throwable e : exceptionsAsList) { ErrorType type = errorTypeFromException(obj, locator, e); if (!isUnknownMuleError(type) && !isCriticalMuleError(type)) { errors.add(new Pair<>(e, type)); } } return errors; }
Source:
public void addTimer(final TimerImpl timerEntity) { String timedObjectId = timerEntity.getTimedObjectId(); synchronized (this) { if(!knownTimerIds.containsKey(timedObjectId)) { EjbLogger.EJB3_TIMER_LOGGER.timerCannotBeAdded(timerEntity); } } String createTimer = sql(CREATE_TIMER); Connection connection = null; PreparedStatement statement = null; try { synchronized (this) { knownTimerIds.get(timerEntity.getTimedObjectId()).add(timerEntity.getId()); } connection = dataSource.getConnection(); statement = connection.prepareStatement(createTimer); statementParameters(timerEntity, statement); statement.execute(); } catch (SQLException e) { throw new RuntimeException(e); } finally { safeClose(statement); safeClose(connection); } }

Target:
public void addTimer(final TimerImpl timerEntity) { String timedObjectId = timerEntity.getTimedObjectId(); synchronized (this) { if(!knownTimerIds.containsKey(timedObjectId)) { throw EjbLogger.EJB3_TIMER_LOGGER.timerCannotBeAdded(timerEntity); } } String createTimer = sql(CREATE_TIMER); Connection connection = null; PreparedStatement statement = null; try { synchronized (this) { knownTimerIds.get(timerEntity.getTimedObjectId()).add(timerEntity.getId()); } connection = dataSource.getConnection(); statement = connection.prepareStatement(createTimer); statementParameters(timerEntity, statement); statement.execute(); } catch (SQLException e) { throw new RuntimeException(e); } finally { safeClose(statement); safeClose(connection); } }
Source:
public DRepresentationDescriptor createRepresentation(final String name, final EObject semantic, final RepresentationDescription description, final Session session, final IProgressMonitor monitor) { DRepresentation diagram = null; DRepresentationDescriptor representationDescriptor = null; try { monitor.beginTask(MessageFormat.format(Messages.DiagramDialectServices_createDiagramMsg, name), 6); monitor.subTask(MessageFormat.format(Messages.DiagramDialectServices_createDiagramMsg, name)); diagram = createRepresentation(name, semantic, description, new SubProgressMonitor(monitor, 2)); if (diagram != null) { DialectManager.INSTANCE.refresh(diagram, new SubProgressMonitor(monitor, 26)); if (DisplayMode.NORMAL.equals(DisplayServiceManager.INSTANCE.getMode())) { DisplayServiceManager.INSTANCE.getDisplayService().refreshAllElementsVisibility((DDiagram) diagram); monitor.worked(1); } representationDescriptor = RepresentationsHelper.createDRepresentationDescriptor(diagram, (DAnalysisSessionImpl) session, semantic.eResource(), name); monitor.worked(1); Diagram gmfDiag = DiagramDialectServices.createAndStoreGMFDiagram(session, (DSemanticDiagram) diagram); monitor.worked(1); CanonicalSynchronizer canonicalSynchronizer = CanonicalSynchronizerFactory.INSTANCE.createCanonicalSynchronizer(gmfDiag); canonicalSynchronizer.storeViewsToArrange(true); canonicalSynchronizer.synchronize(); canonicalSynchronizer.postCreation(); monitor.worked(10); } } finally { monitor.done(); } return representationDescriptor; }

Target:
public DRepresentation createRepresentation(final String name, final EObject semantic, final RepresentationDescription description, final Session session, final IProgressMonitor monitor) { DRepresentation diagram = null; try { monitor.beginTask(MessageFormat.format(Messages.DiagramDialectServices_createDiagramMsg, name), 6); monitor.subTask(MessageFormat.format(Messages.DiagramDialectServices_createDiagramMsg, name)); diagram = createRepresentation(name, semantic, description, new SubProgressMonitor(monitor, 2)); if (diagram != null) { DialectManager.INSTANCE.refresh(diagram, new SubProgressMonitor(monitor, 26)); if (DisplayMode.NORMAL.equals(DisplayServiceManager.INSTANCE.getMode())) { DisplayServiceManager.INSTANCE.getDisplayService().refreshAllElementsVisibility((DDiagram) diagram); monitor.worked(1); } DRepresentationDescriptorInternalHelper.createDRepresentationDescriptor(diagram, (DAnalysisSessionImpl) session, semantic.eResource(), name); monitor.worked(1); Diagram gmfDiag = DiagramDialectServices.createAndStoreGMFDiagram(session, (DSemanticDiagram) diagram); monitor.worked(1); CanonicalSynchronizer canonicalSynchronizer = CanonicalSynchronizerFactory.INSTANCE.createCanonicalSynchronizer(gmfDiag); canonicalSynchronizer.storeViewsToArrange(true); canonicalSynchronizer.synchronize(); canonicalSynchronizer.postCreation(); monitor.worked(10); } } finally { monitor.done(); } return diagram; }
Source:
public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException { ClientResponse response = getAPIResponse(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames); if (response.getStatusInfo().getFamily() != Family.SUCCESSFUL) { String respBody = null; respBody = response.getEntity(String.class); throw new ApiException( response.getStatusInfo().getStatusCode(), "Error while requesting server, received a non successful HTTP code " + response.getStatusInfo().getStatusCode() + " with response Body: '" + respBody + "'", response.getHeaders(), respBody); } statusCode = response.getStatusInfo().getStatusCode(); responseHeaders = response.getHeaders(); if(response.getStatusInfo() == ClientResponse.Status.NO_CONTENT) { return null; } else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) { if (returnType == null) return null; else return response.getEntity(returnType); } else { String message = "error"; String respBody = null; if (response.hasEntity()) { try { respBody = response.getEntity(String.class); message = respBody; } catch (RuntimeException e) { } } throw new ApiException( response.getStatusInfo().getStatusCode(), message, response.getHeaders(), respBody); } }

Target:
public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException { ClientResponse response = getAPIResponse(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames); if (response.getStatusInfo().getFamily() != Family.SUCCESSFUL) { String respBody = response.getEntity(String.class); throw new ApiException( response.getStatusInfo().getStatusCode(), "Error while requesting server, received a non successful HTTP code " + response.getStatusInfo().getStatusCode() + " with response Body: '" + respBody + "'", response.getHeaders(), respBody); } statusCode = response.getStatusInfo().getStatusCode(); responseHeaders = response.getHeaders(); if(response.getStatusInfo() == ClientResponse.Status.NO_CONTENT) { return null; } else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) { if (returnType == null) return null; else return response.getEntity(returnType); } else { String message = "error"; String respBody = null; if (response.hasEntity()) { try { respBody = response.getEntity(String.class); message = respBody; } catch (RuntimeException e) { } } throw new ApiException( response.getStatusInfo().getStatusCode(), message, response.getHeaders(), respBody); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); loadData(); if (getPackageName().startsWith("com.example")) { throw new RuntimeException("Please change the sample's package name! See README."); } Log.d(TAG, "Creating IAB helper."); OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder() .addStoreKeys(Config.STORE_KEYS_MAP); mHelper = new OpenIabHelper(this, builder.build()); Log.d(TAG, "Starting setup."); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { Log.d(TAG, "Setup finished."); if (!result.isSuccess()) { setupDone = false; complain("Problem setting up in-app billing: " + result); return; } Log.d(TAG, "Setup successful. Querying inventory."); setupDone = true; mHelper.queryInventoryAsync(mGotInventoryListener); } }); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); loadData(); if (getPackageName().startsWith("com.example")) { throw new RuntimeException("Please change the sample's package name! See README."); } Log.d(TAG, "Creating IAB helper."); OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder() .setVerifyMode(OpenIabHelper.Options.VERIFY_EVERYTHING) .addStoreKeys(Config.STORE_KEYS_MAP); mHelper = new OpenIabHelper(this, builder.build()); Log.d(TAG, "Starting setup."); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { Log.d(TAG, "Setup finished."); if (!result.isSuccess()) { setupDone = false; complain("Problem setting up in-app billing: " + result); return; } Log.d(TAG, "Setup successful. Querying inventory."); setupDone = true; mHelper.queryInventoryAsync(mGotInventoryListener); } }); }
Source:
public Object[][] getData() { return new Object[][]{ {TestClassWithConfigFailureSample.class, 6}, {TestClassWithConfigSkipSample.class, 4}, {TestClassWithConfigSkipAndFailureSample.class, 6} }; }

Target:
public Object[][] getData() { return new Object[][]{ {TestClassWithConfigFailureSample.class, 3}, {TestClassWithConfigSkipSample.class, 2}, {TestClassWithConfigSkipAndFailureSample.class, 3} }; }
Source:
public static boolean tryWriteLock( long address ) { long s, n; for (; ; ) { s = getState( address ); boolean unwritablyLocked = (s & EXL_MASK) != 0; boolean writeCountOverflow = (s & CNT_MASK) == CNT_MASK; if ( unwritablyLocked | writeCountOverflow ) { return failWriteLock( s, writeCountOverflow ); } n = s + CNT_UNIT | MOD_MASK; if ( compareAndSetState( address, s, n ) ) { UnsafeUtil.storeFence(); return true; } } }

Target:
public static boolean tryWriteLock( long address ) { long s; long n; for ( ; ; ) { s = getState( address ); boolean unwritablyLocked = (s & EXL_MASK) != 0; boolean writeCountOverflow = (s & CNT_MASK) == CNT_MASK; if ( unwritablyLocked | writeCountOverflow ) { return failWriteLock( s, writeCountOverflow ); } n = s + CNT_UNIT | MOD_MASK; if ( compareAndSetState( address, s, n ) ) { UnsafeUtil.storeFence(); return true; } } }