auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testRefLocation() throws Exception { File target = new File(verifier.getBasedir(), "target"); File repository = new File(target, "repository"); File contentXml = new File(repository, "content.xml"); assertThat(contentXml, isFile()); File artifactXml = new File(repository, "artifacts.xml"); assertThat(artifactXml, isFile()); assertThat(new File(target, "category.xml"), isFile()); Map<String, String> expected = new HashMap<>(2, 1.f); expected.put("<LINK_0>", "false"); expected.put("<LINK_0>.else", "true"); Document artifactsDocument = XMLParser.parse(contentXml); artifactsDocument.getChild("repository").getChild("references").getChildren("repository").forEach(element -> { String location = element.getAttributeValue("uri"); if (expected.containsKey(location) && expected.get(location).equals(element.getAttributeValue("enabled"))) { expected.remove(location); } else { fail("Unexpected repository reference in artifact repository " + element); } }); assertEquals("Missing repository reference in artifact repository", Collections.emptyMap(), expected); }

Target:
public void testRefLocation() throws Exception { File target = new File(verifier.getBasedir(), "target"); File repository = new File(target, "repository"); File contentXml = new File(repository, "content.xml"); assertThat(contentXml, isFile()); File artifactXml = new File(repository, "artifacts.xml"); assertThat(artifactXml, isFile()); assertThat(new File(target, "category.xml"), isFile()); Map<String, Boolean> expected = new HashMap<>(2, 1.f); expected.put("<LINK_0>", false); expected.put("<LINK_0>.else", true); Document artifactsDocument = XMLParser.parse(contentXml); artifactsDocument.getChild("repository").getChild("references").getChildren("repository").forEach(element -> { String location = element.getAttributeValue("uri"); if (expected.containsKey(location) && expected.get(location).equals(element.getAttributeValue("options").equals("1"))) { expected.remove(location); } else { System.out.println(location); System.out.println(expected.containsKey(location)); System.out.println(expected.get(location)); System.out.println(); fail("Unexpected repository reference in artifact repository " + element); } }); assertEquals("Missing repository reference in artifact repository", Collections.emptyMap(), expected); }
Source:
private static boolean checkStyleGroupLoops(StyleInfo styleGroup, LayerGroupInfo group, Stack<LayerGroupInfo> path) { try { Catalog catalog = getCatalogFromStyle(styleGroup); StyledLayerDescriptor sld = new GeoServerDataDirectory(catalog.getResourceLoader()).parsedSld(styleGroup); final boolean[] hasLoop = {false}; sld.accept(new GeoServerSLDVisitorAdapter(catalog, group.getBounds() == null ? null : group.getBounds().getCoordinateReferenceSystem()) { private final IllegalStateException recursionException = new IllegalStateException("Style group contains recursive structure"); @Override public void visit(StyledLayerDescriptor sld) { try { super.visit(sld); } catch (IllegalStateException e) { if (recursionException.equals(e)) { hasLoop[0] = true; } else { throw e; } } } @Override public PublishedInfo visitNamedLayerInternal(StyledLayer namedLayer) { if (namedLayer.getName() != null && namedLayer.getName().equals(group.getName())) { throw recursionException; } LayerGroupInfo child = catalog.getLayerGroupByName(namedLayer.getName()); if (child != null) { if (isGroupInStack(child, path)) { path.push(child); throw recursionException; } else if (checkLoops(child, path)) { throw recursionException; } return child; } return null; } }); return hasLoop[0]; } catch (IllegalStateException | IOException | ServiceException | UncheckedIOException | UnsupportedOperationException e) { LOGGER.log(Level.WARNING, "Error extracting layers from Style Group '" + styleGroup.getName() + "'. Skipping...", e); return false; } }

Target:
private static boolean checkStyleGroupLoops(StyleInfo styleGroup, LayerGroupInfo group, Stack<LayerGroupInfo> path) { try { StyledLayerDescriptor sld = styleGroup.getSLD(); final boolean[] hasLoop = {false}; sld.accept(new GeoServerSLDVisitorAdapter((Catalog) GeoServerExtensions.bean("catalog"), group.getBounds() == null ? null : group.getBounds().getCoordinateReferenceSystem()) { private final IllegalStateException recursionException = new IllegalStateException("Style group contains recursive structure"); @Override public void visit(StyledLayerDescriptor sld) { try { super.visit(sld); } catch (IllegalStateException e) { if (recursionException.equals(e)) { hasLoop[0] = true; } else { throw e; } } } @Override public PublishedInfo visitNamedLayerInternal(StyledLayer namedLayer) { if (namedLayer.getName() != null && namedLayer.getName().equals(group.getName())) { throw recursionException; } LayerGroupInfo child = catalog.getLayerGroupByName(namedLayer.getName()); if (child != null) { if (isGroupInStack(child, path)) { path.push(child); throw recursionException; } else if (checkLoops(child, path)) { throw recursionException; } return child; } return null; } }); return hasLoop[0]; } catch (IllegalStateException | IOException | ServiceException | UncheckedIOException | UnsupportedOperationException e) { LOGGER.log(Level.WARNING, "Error extracting layers from Style Group '" + styleGroup.getName() + "'. Skipping...", e); return false; } }
Source:
protected WebAppStatus getWebAppStatus(String tenantDomain, String webAppName) throws LazyLoadingTestException { String requestUrl = webAppURL + "/" + IS_WEB_APP_LOADED_METHOD_URL + "/" + tenantDomain + "/" + webAppName; WebAppStatus webAppStatus; try { HttpResponse response = HttpURLConnectionClient.sendGetRequest(requestUrl, null); JSONObject webAppStatusJSON = new JSONObject(response.getData()).getJSONObject("WebAppStatus"); boolean isTenantLoaded = webAppStatusJSON.getJSONObject("tenantStatus").getBoolean("tenantContextLoaded"); boolean isWebAppStarted = webAppStatusJSON.getBoolean("webAppStarted"); boolean isWebAppGhost = webAppStatusJSON.getBoolean("webAppGhost"); webAppStatus = new WebAppStatus(new TenantStatus(isTenantLoaded), isWebAppStarted, isWebAppGhost); } catch (IOException ioException) { String customErrorMessage = "IOException when sending the Get request to:" + requestUrl + "\n" + ioException.getMessage(); log.error(customErrorMessage); throw new LazyLoadingTestException(customErrorMessage, ioException); } catch (JSONException jsonException) { String customErrorMessage = "JSONException when retrieving the values from json object WebAppStatus" + requestUrl + "\n" + jsonException.getMessage(); log.error(customErrorMessage); throw new LazyLoadingTestException(customErrorMessage, jsonException); } return webAppStatus; }

Target:
protected WebAppStatusBean getWebAppStatus(String tenantDomain, String webAppName) throws LazyLoadingTestException { String requestUrl = supperTenantWebAppURL + "/" + IS_WEB_APP_LOADED_METHOD_URL + "/" + tenantDomain + "/" + webAppName; WebAppStatusBean webAppStatus; try { HttpResponse response = HttpURLConnectionClient.sendGetRequest(requestUrl, null); JSONObject webAppStatusJSON = new JSONObject(response.getData()).getJSONObject("WebAppStatus"); boolean isTenantLoaded = webAppStatusJSON.getJSONObject("tenantStatus").getBoolean("tenantContextLoaded"); boolean isWebAppStarted = webAppStatusJSON.getBoolean("webAppStarted"); boolean isWebAppGhost = webAppStatusJSON.getBoolean("webAppGhost"); webAppStatus = new WebAppStatusBean(new TenantStatusBean(isTenantLoaded), isWebAppStarted, isWebAppGhost); } catch (IOException ioException) { String customErrorMessage = "IOException when sending the Get request to:" + requestUrl; log.error(customErrorMessage, ioException); throw new LazyLoadingTestException(customErrorMessage, ioException); } catch (JSONException jsonException) { String customErrorMessage = "JSONException when retrieving the values from json object WebAppStatus" + requestUrl; log.error(customErrorMessage, jsonException); throw new LazyLoadingTestException(customErrorMessage, jsonException); } return webAppStatus; }
Source:
public String format(LoggingEvent event) { if (maskPattern == null || !(event.getMessage() instanceof String)) { return super.format(event); } String message = event.getRenderedMessage(); Matcher matcher = maskPattern.matcher(message); if (matcher.find()) { String maskedMessage = ""; for(int i = 0; i <= matcher.groupCount(); i++) { int start; int end; if (i == 0) { start = 0; } else { start = matcher.end(i); maskedMessage += MASK; } if (i == matcher.groupCount()) { end = message.length()-1; } else { end = matcher.start(i+1) - 1; } if (start > end || end >= message.length()) { continue; } for (int j = start; j <= end; j++) { maskedMessage += message.charAt(j); } } Throwable throwable = event.getThrowableInformation() != null ? event.getThrowableInformation().getThrowable() : null; LoggingEvent maskedEvent = new LoggingEvent(event.fqnOfCategoryClass, Logger.getLogger(event.getLoggerName()), event.timeStamp, event.getLevel(), maskedMessage, throwable); return super.format(maskedEvent); } return super.format(event); }

Target:
public String format(LoggingEvent event) { if (maskPattern == null || !(event.getMessage() instanceof String)) { return super.format(event); } String message = event.getRenderedMessage(); String maskedMessage = maskMessage(message, maskPattern, maskString); Throwable throwable = event.getThrowableInformation() != null ? event.getThrowableInformation().getThrowable() : null; LoggingEvent maskedEvent = new LoggingEvent(event.fqnOfCategoryClass, Logger.getLogger(event.getLoggerName()), event.timeStamp, event.getLevel(), maskedMessage, throwable); return super.format(maskedEvent); }
Source:
public Mono<Void> writeWith(Publisher<? extends DataBuffer> publisher) { String contentType = jettyRequest.getHeaders().contains(HttpHeader.CONTENT_TYPE) ? jettyRequest.getHeaders().getField(HttpHeader.CONTENT_TYPE).getValue(): MediaType.APPLICATION_OCTET_STREAM_VALUE; Publisher<ContentChunk> chunks = Flux.from(publisher).map(DataBuffer::asByteBuffer).map(ContentChunk::new); ReactiveRequest.Content requestContent = ReactiveRequest.Content.fromPublisher(chunks, contentType); this.reactiveRequest = ReactiveRequest.newBuilder(jettyRequest).content(requestContent).build(); return doCommit(this::completes); }

Target:
public Mono<Void> writeWith(Publisher<? extends DataBuffer> publisher) { Flux<ContentChunk> chunks = Flux.from(publisher).map(this::toContentChunk); MediaType contentType = getHeaders().getContentType(); ReactiveRequest.Content requestContent = ReactiveRequest.Content.fromPublisher(chunks, (contentType != null ? contentType.toString() : MediaType.APPLICATION_OCTET_STREAM_VALUE)); this.reactiveRequest = ReactiveRequest.newBuilder(jettyRequest).content(requestContent).build(); return doCommit(this::completes); }
Source:
protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { final Operator child = getChild(); Preconditions.checkNotNull(child, "Child operator cannot be null"); final Schema inputSchema = child.getSchema(); Preconditions.checkNotNull(inputSchema, "Child schema cannot be null"); splitColIdx = inputSchema.columnNameToIndex(columnName); final Type colType = inputSchema.getColumnType(splitColIdx); Preconditions.checkState(colType == Type.STRING_TYPE, "Column to split \"" + columnName + "\" must have type STRING_TYPE but has type " + colType); inputColIndexToOutputColIndex = new int[inputSchema.numColumns()]; int[] colsToKeep = new int[inputSchema.numColumns() - 1]; for (int colIdx = 0; colIdx < inputSchema.numColumns(); ++colIdx) { if (colIdx == splitColIdx) { inputColIndexToOutputColIndex[colIdx] = -1; } else if (colIdx > splitColIdx) { inputColIndexToOutputColIndex[colIdx] = colIdx - 1; colsToKeep[colIdx - 1] = colIdx; } else { inputColIndexToOutputColIndex[colIdx] = colIdx; colsToKeep[colIdx] = colIdx; } } final Schema subSchema = inputSchema.getSubSchema(colsToKeep); outputSchema = Schema.appendColumn(subSchema, Type.STRING_TYPE, "_splits"); }

Target:
protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { final Operator child = getChild(); Preconditions.checkNotNull(child); final Schema inputSchema = child.getSchema(); Preconditions.checkNotNull(inputSchema); final Type colType = inputSchema.getColumnType(splitColumnIndex); Preconditions.checkState(colType == Type.STRING_TYPE, "Column to split at index %d (%s) must have type STRING_TYPE", splitColumnIndex, colType); outputBuffer = new TupleBatchBuffer(getSchema()); }
Source:
public Mono<MsalToken> authenticateWithMsalAccount(TokenRequestContext request, IAccount account) { SilentParameters parameters; SilentParameters forceParameters; if (account != null) { parameters = SilentParameters.builder(new HashSet<>(request.getScopes()), account).build(); forceParameters = SilentParameters.builder(new HashSet<>(request.getScopes()), account) .forceRefresh(true).build(); } else { parameters = SilentParameters.builder(new HashSet<>(request.getScopes())).build(); forceParameters = SilentParameters.builder(new HashSet<>(request.getScopes())).forceRefresh(true).build(); } return Mono.defer(() -> { try { return Mono.fromFuture(getPublicClientApplication(false).acquireTokenSilently(parameters)) .map(ar -> new MsalToken(ar, options)) .filter(t -> !t.isExpired()) .switchIfEmpty(Mono.defer(() -> Mono.fromFuture(() -> { try { return getPublicClientApplication(false).acquireTokenSilently(forceParameters); } catch (MalformedURLException e) { throw logger.logExceptionAsWarning(new RuntimeException(e)); } } ).map(result -> new MsalToken(result, options)))); } catch (MalformedURLException e) { return Mono.error(e); } }); }

Target:
public Mono<MsalToken> authenticateWithMsalAccount(TokenRequestContext request, IAccount account) { return Mono.defer(() -> Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder parametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())); if (account != null) { parametersBuilder = parametersBuilder.account(account); } try { return getPublicClientApplication(false) .acquireTokenSilently(parametersBuilder.build()); } catch (MalformedURLException e) { throw logger.logExceptionAsError(Exceptions.propagate(e)); } }).map(ar -> new MsalToken(ar, options)) .filter(t -> !t.isExpired()) .switchIfEmpty(Mono.fromFuture(() -> { SilentParameters.SilentParametersBuilder forceParametersBuilder = SilentParameters.builder( new HashSet<>(request.getScopes())).forceRefresh(true); if (account != null) { forceParametersBuilder = forceParametersBuilder.account(account); } try { return getPublicClientApplication(false).acquireTokenSilently(forceParametersBuilder.build()); } catch (MalformedURLException e) { throw logger.logExceptionAsError(Exceptions.propagate(e)); } }).map(result -> new MsalToken(result, options)))); }
Source:
void prepareView(final String type, final String constraintValue, final ConstraintType constraintType) { getView().setType(type); if (!isEmpty(constraintValue)) { getView().loadComponent(constraintType); } else { getView().setupEmptyContainer(); } }

Target:
void prepareView(final String type, final String constraintValue, final ConstraintType constraintType) { getView().setType(type); if (!isEmpty(constraintValue) || constraintType != null) { getView().loadComponent(constraintType); } else { getView().setupEmptyContainer(); } }
Source:
public void readBadlyDistributedFileTest() throws Exception { HPCCFile file = new HPCCFile("~benchmark::all_types::200kb", connString , hpccUser, hpccPass); file.setProjectList(""); List<HPCCRecord> records = readFile(file, connTO); assertEquals("Not all records loaded",expectedCounts[1], records.size()); }

Target:
public void readBadlyDistributedFileTest() throws Exception { HPCCFile file = new HPCCFile(datasets[1], connString , hpccUser, hpccPass); file.setProjectList(""); List<HPCCRecord> records = readFile(file, connTO); assertEquals("Not all records loaded",expectedCounts[1], records.size()); }
Source:
public Aggregator newServerAggregator(Configuration conf) { final PDataType type = getAggregatorExpression().getDataType(); SortOrder sortOrder = getAggregatorExpression().getSortOrder(); return new MaxAggregator(sortOrder) { @Override public PDataType getDataType() { return type; } @Override public Integer getMaxLength() { return getAggregatorExpression().getMaxLength(); } }; }

Target:
public Aggregator newServerAggregator(Configuration conf) { final PDataType type = getAggregatorExpression().getDataType(); SortOrder sortOrder = getAggregatorExpression().getSortOrder(); final Integer maxLength = getAggregator().getMaxLength(); return new MaxAggregator(sortOrder) { @Override public PDataType getDataType() { return type; } @Override public Integer getMaxLength() { return maxLength; } }; }
Source:
public boolean equals(Object obj) { return obj instanceof SecureStoreData && storeName.hashCode() == obj.hashCode(); }

Target:
public boolean equals(Object obj) { if (obj instanceof SecureStoreData) { SecureStoreData o = (SecureStoreData) obj; return Objects.equal(storeName, o.storeName); } return equals(obj); }
Source:
public void testSetAndGetExpirationFromDoc() throws CouchbaseLiteException, LiteCoreException { Date dto30 = new Date(System.currentTimeMillis() + 30000L); Date dto0 = new Date(System.currentTimeMillis()); MutableDocument doc1a = new MutableDocument("doc1"); MutableDocument doc1b = new MutableDocument("doc2"); MutableDocument doc1c = new MutableDocument("doc3"); doc1a.setInt("answer", 12); doc1a.setValue("question", "What is six plus six?"); save(doc1a); doc1b.setInt("answer", 22); doc1b.setValue("question", "What is eleven plus eleven?"); save(doc1b); doc1c.setInt("answer", 32); doc1c.setValue("question", "What is twenty plus twelve?"); save(doc1c); assertTrue(db.setDocumentExpiration("doc1", dto30)); assertTrue(db.setDocumentExpiration("doc3", dto30)); assertTrue(db.setDocumentExpiration("doc3", null)); Date v = db.getDocumentExpiration("doc1"); assertSame(v, dto30); assertNull(db.getDocumentExpiration("doc2")); assertNull(db.getDocumentExpiration("doc3")); }

Target:
public void testSetAndGetExpirationFromDoc() throws CouchbaseLiteException, LiteCoreException { Date dto30 = new Date(System.currentTimeMillis() + 30000L); Date dto0 = new Date(System.currentTimeMillis()); MutableDocument doc1a = new MutableDocument("doc1"); MutableDocument doc1b = new MutableDocument("doc2"); MutableDocument doc1c = new MutableDocument("doc3"); doc1a.setInt("answer", 12); doc1a.setValue("question", "What is six plus six?"); save(doc1a); doc1b.setInt("answer", 22); doc1b.setValue("question", "What is eleven plus eleven?"); save(doc1b); doc1c.setInt("answer", 32); doc1c.setValue("question", "What is twenty plus twelve?"); save(doc1c); db.setDocumentExpiration("doc1", dto30); db.setDocumentExpiration("doc3", dto30); db.setDocumentExpiration("doc3", null); Date exp = db.getDocumentExpiration("doc1"); assertSame(exp, dto30); assertNull(db.getDocumentExpiration("doc2")); assertNull(db.getDocumentExpiration("doc3")); }
Source:
boolean isSignedWithSupportedAlgorithm(List<X509Certificate> chain) { for (int index=0; index < chain.size(); ++index) { X509Certificate cert = chain.get(index); boolean certSignatureAlgorithmSupported = false; for (SignatureAndHashAlgorithm supportedAlgorithm : supportedSignatureAlgorithms) { if (supportedAlgorithm.jcaName().equalsIgnoreCase(cert.getSigAlgName())) { certSignatureAlgorithmSupported = true; break; } } if (!certSignatureAlgorithmSupported) { LOGGER.debug("certificate chain is NOT signed with supported algorithm(s)"); return false; } } LOGGER.debug("certificate chain is signed with supported algorithm(s)"); return true; }

Target:
boolean isSignedWithSupportedAlgorithm(List<X509Certificate> chain) { for (X509Certificate certificate : chain) { if (!isSignedWithSupportedAlgorithm(certificate)) { LOGGER.debug("certificate chain is NOT signed with supported algorithm(s)"); return false; } } LOGGER.debug("certificate chain is signed with supported algorithm(s)"); return true; }
Source:
@Nonnull default Set<User> getCulprits() { if (shouldCalculateCulprits()) { return calculateCulprits(); } return new AbstractSet<User>() { public Iterator<User> iterator() { return new AdaptedIterator<String,User>(getCulpritIds().iterator()) { protected User adapt(String id) { return User.get(id); } }; } public int size() { return getCulpritIds().size(); } }; }

Target:
@Nonnull default Set<User> getCulprits() { if (shouldCalculateCulprits()) { return calculateCulprits(); } return new AbstractSet<User>() { private Set<String> culpritIds = ImmutableSet.copyOf(getCulpritIds()); public Iterator<User> iterator() { return new AdaptedIterator<String,User>(culpritIds.iterator()) { protected User adapt(String id) { return User.get(id); } }; } public int size() { return culpritIds.size(); } }; }
Source:
public void deleteText(@Nonnull Mapping field, String lang) { fetchTranslation(field, lang).ifPresent(mongoTranslation -> { mango.delete(mongoTranslation); if (owner instanceof Journaled) { JournalData.addJournalEntry(owner, "Deleted translated text for " + field.getName() + " (" + lang + ")"); } }); }

Target:
public void deleteText(@Nonnull Mapping field, String lang) { mongo.delete() .where(Translation.TRANSLATION_DATA.inner(TranslationData.OWNER), owner.getUniqueName()) .where(Translation.TRANSLATION_DATA.inner(TranslationData.FIELD), field.getName()) .where(Translation.TRANSLATION_DATA.inner(TranslationData.LANG), lang) .singleFrom(MongoTranslation.class); if (owner instanceof Journaled) { JournalData.addJournalEntry(owner, "Deleted translated text for " + field.getName() + " (" + lang + ")"); } }
Source:
public void execute(final JobExecutionContext jobContext) throws JobExecutionException { SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); LOGGER.info("********* Starting the Inheritance Error Report Creator job. *********"); curesRuleEffectiveDate = getCuresRuleEffectiveDate(); if (curesRuleEffectiveDate == null) { return; } inheritanceErrorsReportDAO.deleteAll(); List<CertifiedProductFlatSearchResult> listings = certifiedProductSearchDAO.getAllCertifiedProducts(); List<CertifiedProductFlatSearchResult> certifiedProducts = filterData(listings); certifiedProducts = certifiedProducts.subList(0, 100); ExecutorService executorService = null; try { executorService = Executors.newFixedThreadPool(8); for (CertifiedProductFlatSearchResult result : certifiedProducts) { CompletableFuture.supplyAsync(() -> getCertifiedProductSearchDetails(result.getId()), executorService) .thenApply(cp -> check(cp)) .thenAccept(error -> saveInheritanceErrorsReportSingle(error)); } } finally { executorService.shutdown(); } LOGGER.info("Completed the Inheritance Error Report Creator job. *********"); }

Target:
public void execute(final JobExecutionContext jobContext) throws JobExecutionException { SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); LOGGER.info("********* Starting the Inheritance Error Report Creator job. *********"); curesRuleEffectiveDate = getCuresRuleEffectiveDate(); if (curesRuleEffectiveDate == null) { return; } inheritanceErrorsReportDAO.deleteAll(); List<CertifiedProductFlatSearchResult> listings = certifiedProductSearchDAO.getAllCertifiedProducts(); List<CertifiedProductFlatSearchResult> certifiedProducts = filterData(listings); ExecutorService executorService = null; try { Integer threadPoolSize = getThreadCountForJob(); executorService = Executors.newFixedThreadPool(threadPoolSize); for (CertifiedProductFlatSearchResult result : certifiedProducts) { CompletableFuture.supplyAsync(() -> getCertifiedProductSearchDetails(result.getId()), executorService) .thenApply(cp -> check(cp)) .thenAccept(error -> saveInheritanceErrorsReportSingle(error)); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } finally { executorService.shutdown(); } LOGGER.info("Completed the Inheritance Error Report Creator job. *********"); }
Source:
public DocumentModel publishRendition(DocumentModel doc, DocumentModel target, String renditionName, boolean override) { CoreSession session = doc.getCoreSession(); if (!session.hasPermission(target.getRef(), ADD_CHILDREN)) { log.debug("Permission '" + ADD_CHILDREN + "' is not granted to '" + session.getPrincipal().getName() + "' on document " + target.getPath()); throw new DocumentSecurityException( "Privilege '" + ADD_CHILDREN + "' is not granted to '" + session.getPrincipal().getName() + "'"); } Rendition rendition = StringUtils.isEmpty(renditionName) ? getDefaultRendition(doc, Constants.DEFAULT_RENDTION_PUBLISH_REASON, true, null) : getRendition(doc, renditionName, true); if (rendition == null) { throw new NuxeoException("Unable to render the document"); } DocumentModel renditionDocument = rendition.getHostDocument(); DocumentRef publishedDocumentRef = CoreInstance.doPrivileged(session, (CoreSession s) -> s.publishDocument(renditionDocument, target, override).getRef()); DocumentModel publishedDocument = session.getDocument(publishedDocumentRef); if (override) { RenditionsRemover remover = new RenditionsRemover(publishedDocument); remover.runUnrestricted(); } return publishedDocument; }

Target:
public DocumentModel publishRendition(DocumentModel doc, DocumentModel target, String renditionName, boolean override) { CoreSession session = doc.getCoreSession(); if (!session.hasPermission(target.getRef(), ADD_CHILDREN)) { log.error("Permission '{}' is not granted to '{}' on document '{}'", ADD_CHILDREN, session.getPrincipal().getName(), target.getPath()); throw new DocumentSecurityException( "Privilege '" + ADD_CHILDREN + "' is not granted to '" + session.getPrincipal().getName() + "'"); } Rendition rendition = StringUtils.isEmpty(renditionName) ? getDefaultRendition(doc, Constants.DEFAULT_RENDTION_PUBLISH_REASON, true, null) : getRendition(doc, renditionName, true); if (rendition == null) { throw new NuxeoException("Unable to render the document"); } DocumentModel renditionDocument = rendition.getHostDocument(); DocumentRef publishedDocumentRef = CoreInstance.doPrivileged(session, (CoreSession s) -> s.publishDocument(renditionDocument, target, override).getRef()); DocumentModel publishedDocument = session.getDocument(publishedDocumentRef); if (override) { RenditionsRemover remover = new RenditionsRemover(publishedDocument); remover.runUnrestricted(); } return publishedDocument; }
Source:
public void removePacketInterceptor(StanzaListener packetInterceptor) { synchronized (interceptors) { interceptors.remove(packetInterceptor); } }

Target:
public void removePacketInterceptor(StanzaListener packetInterceptor) { removeStanzaInterceptor(packetInterceptor); }
Source:
public boolean hasNext() { boolean hasNext = !queue.isEmpty(); boolean interrupted = false; long targetTime = timeService.expectedEndTime(timeout, unit); nextLock.lock(); try { while (!(hasNext = !queue.isEmpty()) && !completed) { try { if (!nextCondition.await(timeService.remainingTime(targetTime, TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS)) { if (log.isTraceEnabled()) { log.tracef("Did not retrieve entries in allotted timeout: %s units: unit", timeout, unit); } throw new TimeoutException("Did not retrieve entries in allotted timeout: " + timeout + " units: " + unit); } } catch (InterruptedException e) { interrupted = true; } } } finally { nextLock.unlock(); } if (interrupted) { Thread.currentThread().interrupt(); } return hasNext; }

Target:
public boolean hasNext() { boolean hasNext = !queue.isEmpty(); if (!hasNext) { boolean interrupted = false; long targetTime = timeService.expectedEndTime(timeout, unit); nextLock.lock(); try { while (!(hasNext = !queue.isEmpty()) && !completed) { try { if (!nextCondition.await(timeService.remainingTime(targetTime, TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS)) { if (log.isTraceEnabled()) { log.tracef("Did not retrieve entries in allotted timeout: %s units: unit", timeout, unit); } throw new TimeoutException("Did not retrieve entries in allotted timeout: " + timeout + " units: " + unit); } } catch (InterruptedException e) { interrupted = true; } } } finally { nextLock.unlock(); } if (interrupted) { Thread.currentThread().interrupt(); } } return hasNext; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { IProject project = null; IEditorPart editorPart = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor(); if (editorPart != null) { IFileEditorInput input = (IFileEditorInput) editorPart.getEditorInput(); IFile file = input.getFile(); project = file.getProject(); } else { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); if (window != null) { IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection(); if (selection instanceof TreeSelection) { TreeSelection treeSelection = (TreeSelection) selection; TreePath path = treeSelection.getPaths()[0]; Object first = path.getFirstSegment(); if (first instanceof IAdaptable) { project = ((IAdaptable) first).getAdapter(IProject.class); } } else { Object firstElement = selection.getFirstElement(); if (firstElement instanceof IAdaptable) { project = ((IAdaptable) firstElement).getAdapter(IProject.class); } } } } if (project != null) { IFile file = project.getFile("/gruntfile.js"); if (file.exists()) { StructuredSelection fileSelection = new StructuredSelection(file); GruntLaunch launch = new GruntLaunch(); launch.launch(fileSelection, null); } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = WorkbenchResourceUtil.getNamedFileOrTaskSelection(GruntConstants.GRUNT_FILE_JS); if (selection != null) { new GruntLaunch().launch(selection, GruntConstants.DEFAULT_COMMAND); } return null; }
Source:
private ClassLoader createLoaderForJar(URL jarURL) { LOGGER.debug("Creating Loader For jar: " + jarURL); ClassLoader jarLoader = new URLClassLoader(enumerateJar(jarURL), this); if (jarLoader == null) { LOGGER.warn("No jar found with url: " + jarURL); } return jarLoader; }

Target:
private ClassLoader createLoaderForJar(URL jarURL) { LOGGER.debug("Creating Loader For jar: {}", jarURL); ClassLoader jarLoader = new URLClassLoader(enumerateJar(jarURL), this); if (jarLoader == null) { LOGGER.warn("No jar found with url: {}", jarURL); } return jarLoader; }
Source:
static <E,T> Validation<E,T> valid(T value) { return new Valid<>(value); }

Target:
static <E,T> Validation<E,T> valid(T value) { Objects.requireNonNull(value, "value is null"); return new Valid<>(value); }
Source:
public void beforeSlim218(Scenario scenario) { LOGGER.info("Preparing scenario for @SLIM-218"); final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("cucumber.xml"); this.deviceRepository = context.getBean(DeviceRepository.class); this.dlmsDeviceRepository = context.getBean(DlmsDeviceRepository.class); this.deviceAuthorizationRepository = context.getBean(DeviceAuthorizationRepository.class); this.deleteDevicesFromPlatform(Arrays.asList("E0026000059790003", "G00XX561204926019")); LOGGER.info("Ready preparing scenario for @SLIM-218"); context.close(); }

Target:
public void beforeSlim218(Scenario scenario) { LOGGER.info("Preparing scenario for @SLIM-218"); LOGGER.info("Scenario name: {}", scenario.getName()); final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("cucumber.xml"); this.deviceRepository = context.getBean(DeviceRepository.class); this.dlmsDeviceRepository = context.getBean(DlmsDeviceRepository.class); this.deviceAuthorizationRepository = context.getBean(DeviceAuthorizationRepository.class); this.deleteDevicesFromPlatform(Arrays.asList("E0026000059790003", "G00XX561204926019")); LOGGER.info("Ready preparing scenario for @SLIM-218"); context.close(); }
Source:
private void showSelection(boolean showHead, boolean showRef, boolean showTag, Repository repo, RevCommit selection, Ref ref, Job initJob) { if (initJob == null) { return; } initJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if (event.getResult() == null || !event.getResult().isOK()) { return; } Control control = graph.getControl(); if (control.isDisposed()) { return; } control.getDisplay().asyncExec(() -> { if (control.isDisposed()) { return; } if (showHead) { showHead(repo); } if (showRef) { showRef(ref, repo); } if (showTag) { showTag(ref, repo); } if (selection != null) { graph.selectCommitStored(selection); } }); } }); }

Target:
private void showSelection(boolean showHead, boolean showRef, boolean showTag, Repository repo, RevCommit selection, Ref ref, Job initJob) { if (initJob == null) { return; } initJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if (event.getResult() == null || !event.getResult().isOK() || job != event.getJob()) { return; } Control control = graph.getControl(); if (control.isDisposed()) { return; } control.getDisplay().asyncExec(() -> { if (control.isDisposed()) { return; } if (showHead) { showHead(repo); } if (showRef) { showRef(ref, repo); } if (showTag) { showTag(ref, repo); } if (selection != null) { graph.selectCommitStored(selection); } }); } }); }
Source:
private void send(String message, String vmID, boolean removeClient) throws ClientConnectionException{ try { ReactorClient client = JsonRpcServer.getReactorsMap().get(vmID); client.sendMessage(message.getBytes()); log.debug("sending events message {}", message); }catch (ClientConnectionException e) { log.error("Failure in sending response", e); } if (removeClient){ JsonRpcServer.removeReactorsMap(vmID); } }

Target:
private void send(String message, String vmID, boolean removeClient) throws ClientConnectionException{ String hostName = null; try { ReactorClient client = JsonRpcServer.getReactorsMap().get(vmID); hostName = client.getHostname(); client.sendMessage(message.getBytes()); log.debug("sending events message {}", message); }catch (ClientConnectionException e) { log.error("Host {}, failed to send event message {}", hostName, e); } if (removeClient){ JsonRpcServer.removeReactorsMap(vmID); } }
Source:
public Consumer createConsumer(Processor processor) throws Exception { afterPropertiesSet(); setExchangePattern(ExchangePattern.InOnly); return new GooglePubsubConsumer(this, processor); }

Target:
public Consumer createConsumer(Processor processor) throws Exception { afterPropertiesSet(); setExchangePattern(ExchangePattern.InOnly); GooglePubsubConsumer consumer = new GooglePubsubConsumer(this, processor); configureConsumer(consumer); return consumer; }
Source:
private AmazonPolly getPolly() { if (defaultRegion == null) { defaultRegion = Regions.DEFAULT_REGION; } String key = getKey(AMAZON_POLLY_USER_KEY); String secret = getKey(AMAZON_POLLY_USER_SECRET); if (key == null || secret == null) { error("this service requires 2 keys"); return null; } if (polly == null) { try { if (credentials == null) { credentials = new BasicAWSCredentials(key, secret); } polly = AmazonPollyClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(credentials)).withRegion(defaultRegion).build(); } catch (Exception e) { try { log.error("could not get client with keys supplied - trying default chain", e); polly = AmazonPollyClient.builder().withCredentials(new DefaultAWSCredentialsProviderChain()).withClientConfiguration(new ClientConfiguration()).withRegion(defaultRegion) .build(); } catch (Exception e2) { error("could not get Polly client - did you set the keys?"); log.error("giving up", e2); polly = null; credentials = null; } } } if (polly != null) { try { DescribeVoicesRequest describeVoicesRequest = new DescribeVoicesRequest(); polly.describeVoices(describeVoicesRequest); } catch (AmazonPollyException e3) { error("The keys are invalid"); polly = null; credentials = null; } } return polly; }

Target:
private AmazonPolly getPolly() { if (defaultRegion == null) { defaultRegion = Regions.DEFAULT_REGION; } String key = getKey(AMAZON_POLLY_USER_KEY); String secret = getKey(AMAZON_POLLY_USER_SECRET); if (key == null || secret == null) { error("this service requires a key and a secret"); return null; } if (polly == null) { try { if (credentials == null) { credentials = new BasicAWSCredentials(key, secret); } polly = AmazonPollyClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(credentials)).withRegion(defaultRegion).build(); } catch (Exception e) { try { log.error("could not get client with keys supplied - trying default chain", e); polly = AmazonPollyClient.builder().withCredentials(new DefaultAWSCredentialsProviderChain()).withClientConfiguration(new ClientConfiguration()).withRegion(defaultRegion) .build(); } catch (Exception e2) { error("could not get Polly client - did you set the keys?"); log.error("giving up", e2); polly = null; credentials = null; } } } if (polly != null) { try { DescribeVoicesRequest describeVoicesRequest = new DescribeVoicesRequest(); polly.describeVoices(describeVoicesRequest); } catch (AmazonPollyException e3) { error("The keys are invalid"); polly = null; credentials = null; } } return polly; }
Source:
protected void init() { if (properties == null) { properties = new DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor>(this); } else { properties.setOwner(this); } for (AbstractFolderProperty p : properties) { p.setOwner(this); } if (icon == null) { icon = new StockFolderIcon(); } if (views == null) { views = new CopyOnWriteArrayList<View>(); } if (views.isEmpty()) { try { initViews(views); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to set up the initial view", e); } } if (viewsTabBar == null) { viewsTabBar = new DefaultViewsTabBar(); } if (primaryView == null) { primaryView = views.get(0).getViewName(); } viewGroupMixIn = new ViewGroupMixIn(this) { @Override protected List<View> views() { return views; } @Override protected String primaryView() { return primaryView; } @Override protected void primaryView(String name) { primaryView = name; } }; if (healthMetrics == null) { List<FolderHealthMetric> metrics = new ArrayList<FolderHealthMetric>(); for (FolderHealthMetricDescriptor d : FolderHealthMetricDescriptor.all()) { FolderHealthMetric metric = d.createDefault(); if (metric != null) { metrics.add(metric); } } healthMetrics = new DescribableList<FolderHealthMetric, FolderHealthMetricDescriptor>(this, metrics); } }

Target:
protected void init() { if (properties == null) { properties = new DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor>(this); } else { properties.setOwner(this); } for (AbstractFolderProperty p : properties) { p.setOwner(this); } if (icon == null) { icon = new StockFolderIcon(); } if (views == null) { views = new CopyOnWriteArrayList<View>(); } if (viewsTabBar == null) { viewsTabBar = new DefaultViewsTabBar(); } viewGroupMixIn = new ViewGroupMixIn(this) { @Override protected List<View> views() { return views; } @Override protected String primaryView() { return primaryView == null ? views.get(0).getViewName() : primaryView; } @Override protected void primaryView(String name) { primaryView = name; } }; if (views.isEmpty()) { try { initViews(views); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to set up the initial view", e); } } if (healthMetrics == null) { List<FolderHealthMetric> metrics = new ArrayList<FolderHealthMetric>(); for (FolderHealthMetricDescriptor d : FolderHealthMetricDescriptor.all()) { FolderHealthMetric metric = d.createDefault(); if (metric != null) { metrics.add(metric); } } healthMetrics = new DescribableList<FolderHealthMetric, FolderHealthMetricDescriptor>(this, metrics); } }
Source:
public CloseableIterator<CacheEntry<K, V>> iterator() { Iterator<CacheEntry<K, V>> iterator = new DataContainerRemoveIterator<>(cache); return Closeables.iterator(iterator); }

Target:
public CloseableIterator<CacheEntry<K, V>> iterator() { Iterator<CacheEntry<K, V>> iterator = new DataContainerRemoveIterator<>(cache); RemovableIterator<K, CacheEntry<K, V>> removableIterator = new RemovableIterator<>(iterator, cache, CacheEntry::getKey); return Closeables.iterator(new IteratorMapper<>(removableIterator, e -> new EntryWrapper<>(cache, e))); }
Source:
private boolean isOptionEnabledOnVolume(GlusterVolumeEntity volume, List<PredicateFilter<GlusterVolumeOptionEntity>> predicates) { List<GlusterVolumeOptionEntity> volumeOptionsEnabled = new ArrayList<GlusterVolumeOptionEntity>(volume.getOptions()); List<GlusterVolumeOptionEntity> filteredOptions = volumeOptionsEnabled; for(PredicateFilter<GlusterVolumeOptionEntity> predicate : predicates) { filteredOptions = ListUtils.filter(volumeOptionsEnabled, predicate); } if(filteredOptions.size() > 0) { return true; } return false; }

Target:
private boolean isOptionEnabledOnVolume(GlusterVolumeEntity volume, List<PredicateFilter<GlusterVolumeOptionEntity>> predicates) { List<GlusterVolumeOptionEntity> volumeOptionsEnabled = new ArrayList<GlusterVolumeOptionEntity>(volume.getOptions()); List<GlusterVolumeOptionEntity> filteredOptions = volumeOptionsEnabled; for(PredicateFilter<GlusterVolumeOptionEntity> predicate : predicates) { filteredOptions = ListUtils.filter(filteredOptions, predicate); } if(filteredOptions.size() > 0) { return true; } return false; }
Source:
protected HttpManagement(InterruptingObserver interruptingObserver, String userAgent) { this.interruptingObserver = interruptingObserver; this.client = generateHttpClientBuilder().setUserAgent(userAgent).build(); }

Target:
protected HttpManagement(InterruptingObserver interruptingObserver, String userAgent) { this.interruptingObserver = interruptingObserver; this.userAgent = userAgent; this.client = generateHttpClientBuilder().build(); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); mTextView = (TextView) findViewById(R.id.resultInfo); mTextView.setMovementMethod(new ScrollingMovementMethod()); String resultText; try { resultText = convertIntentDataToJsonString(); } catch (final JSONException e) { resultText = "{\"error \" : \"Unable to convert to JSON\"}"; } mTextView.setText(resultText); mLogView = (TextView) findViewById(R.id.adalLogs); mLogView.setMovementMethod(new ScrollingMovementMethod()); mLogView.setText(getLogsFromIntent()); final Button doneButton = (Button) findViewById(R.id.resultDone); doneButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ResultActivity.this.finish(); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); mTextView = (TextView) findViewById(R.id.resultInfo); mTextView.setMovementMethod(new ScrollingMovementMethod()); String resultText; try { resultText = convertIntentDataToJsonString(); } catch (final JSONException e) { resultText = "{\"error \" : \"Unable to convert to JSON\"}"; } mTextView.setText(resultText); mLogView = (TextView) findViewById(R.id.adalLogs); mLogView.setText(((AndroidAutomationApp)this.getApplication()).getADALLogs()); final Button doneButton = (Button) findViewById(R.id.resultDone); doneButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ResultActivity.this.finish(); } }); }
Source:
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); mEyesRecyclerView = findViewById(R.id.eyesRecyclerView); mMouthRecyclerView = findViewById(R.id.mouthRecyclerView); mHatRecyclerView = findViewById(R.id.hatRecyclerView); mPreviewView = findViewById(R.id.previewView); ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); mMapView.setMap(map); mGraphicsOverlay = new GraphicsOverlay(); mMapView.getGraphicsOverlays().add(mGraphicsOverlay); mMapView.setOnTouchListener( new DefaultMapViewOnTouchListener(MainActivity.this, mMapView) { @Override public boolean onSingleTapConfirmed(MotionEvent motionEvent) { addGraphic(mGraphicsOverlay, mapPointFrom(mMapView, motionEvent), mCurrentMultilayerSymbol); return true; } }); setupRecyclerViews(); symbolStyleSearchResultObservable.addObserver((o, arg) -> { for (SymbolStyleSearchResult symbol : ((SymbolStyleSearchResultObservable) o).getSymbols()) { switch (symbol.getCategory().toLowerCase(Locale.ROOT)) { case "eyes": mEyesAdapter.addSymbol(symbol); break; case "mouth": mMouthAdapter.addSymbol(symbol); break; case "hat": mHatAdapter.addSymbol(symbol); break; case "face": mFaceSymbolKey = symbol.getKey(); break; } Log.d(TAG, symbol.getCategory()); } animateRecyclerViews(); }); requestPermissions(); }

Target:
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); mEyesRecyclerView = findViewById(R.id.eyesRecyclerView); mMouthRecyclerView = findViewById(R.id.mouthRecyclerView); mHatRecyclerView = findViewById(R.id.hatRecyclerView); mPreviewView = findViewById(R.id.previewView); ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); mMapView.setMap(map); mGraphicsOverlay = new GraphicsOverlay(); mMapView.getGraphicsOverlays().add(mGraphicsOverlay); mMapView.setOnTouchListener( new DefaultMapViewOnTouchListener(MainActivity.this, mMapView) { @Override public boolean onSingleTapConfirmed(MotionEvent motionEvent) { addGraphic(mGraphicsOverlay, mapPointFrom(mMapView, motionEvent), mCurrentMultilayerSymbol); return true; } }); setupRecyclerViews(); mSymbolStyleSearchResultObservable.addObserver((o, arg) -> { for (SymbolStyleSearchResult symbol : ((SymbolStyleSearchResultObservable) o).getSymbols()) { switch (symbol.getCategory().toLowerCase(Locale.ROOT)) { case "eyes": mEyesAdapter.addSymbol(symbol); break; case "mouth": mMouthAdapter.addSymbol(symbol); break; case "hat": mHatAdapter.addSymbol(symbol); break; case "face": mFaceSymbolKey = symbol.getKey(); break; } } animateRecyclerViews(); }); requestPermissions(); }
Source:
public FindEventsQueryDto makeFindEventsQueryDto() { FindEventsQueryDto result = new FindEventsQueryDto(EventLogCategoryDto.STANDARD_EVENT_LOG, new DateTime(), new DateTime()); return result; }

Target:
public FindEventsQueryDto makeFindEventsQueryDto() { return new FindEventsQueryDto(EventLogCategoryDto.STANDARD_EVENT_LOG, new DateTime(), new DateTime()); }
Source:
public static boolean isZero(final Number number) { if (Objects.isNull(number)) { return false; } else if (number instanceof Integer) { return number.intValue() == INTEGER_ZERO; } else if (number instanceof Long) { return number.longValue() == LONG_ZERO; } else if (number instanceof Byte) { return number.byteValue() == BYTE_ZERO; } else if (number instanceof Short) { return number.shortValue() == SHORT_ZERO; } else if (number instanceof Float) { return number.floatValue() == FLOAT_ZERO; } else if (number instanceof Double) { return number.doubleValue() == DOUBLE_ZERO; } return false; }

Target:
public static boolean isZero(final Number number) { if (Objects.isNull(number)) { return false; } else if (number instanceof Integer) { return number.intValue() == INTEGER_ZERO; } else if (number instanceof Long || number instanceof LongAccumulator || number instanceof LongAdder) { return number.longValue() == LONG_ZERO; } else if (number instanceof Byte) { return number.byteValue() == BYTE_ZERO; } else if (number instanceof Short) { return number.shortValue() == SHORT_ZERO; } else if (number instanceof Float) { return number.floatValue() == FLOAT_ZERO; } else if (number instanceof Double || number instanceof DoubleAccumulator || number instanceof DoubleAdder) { return number.doubleValue() == DOUBLE_ZERO; } else if (number instanceof BigInteger) { return ((BigInteger) number).signum() == INTEGER_ZERO; } else if (number instanceof BigDecimal) { return ((BigDecimal) number).compareTo(BigDecimal.ZERO) == INTEGER_ZERO; } else if (number instanceof AtomicInteger) { return ((AtomicInteger) number).get() == INTEGER_ZERO; } else if (number instanceof AtomicLong) { return ((AtomicLong) number).get() == LONG_ZERO; } else { return number.intValue() == INTEGER_ZERO && number.longValue() == LONG_ZERO && number.byteValue() == BYTE_ZERO && number.shortValue() == SHORT_ZERO && number.floatValue() == FLOAT_ZERO && number.doubleValue() == DOUBLE_ZERO; } }