auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { if (advertiseError != null) { adv.writeOne("ERR " + advertiseError); return; } try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(CAPABILITY_SIDE_BAND_64K); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); <START> if (!pushCertNonce.isEmpty()) <END> adv.advertiseCapability(CAPABILITY_PUSH_CERT + "=" + pushCertNonce); if (db.getRefDatabase().performsAtomicTransactions()) adv.advertiseCapability(CAPABILITY_ATOMIC); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); adv.send(getAdvertisedOrDefaultRefs()); for (ObjectId obj : advertisedHaves) adv.advertiseHave(obj); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }</code><technical_language>!= null</technical_language>

Target:
public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { if (advertiseError != null) { adv.writeOne("ERR " + advertiseError); return; } try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(CAPABILITY_SIDE_BAND_64K); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); if (pushCertificateParser.enabled()) adv.advertiseCapability( pushCertificateParser.getAdvertiseNonce()); if (db.getRefDatabase().performsAtomicTransactions()) adv.advertiseCapability(CAPABILITY_ATOMIC); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); adv.send(getAdvertisedOrDefaultRefs()); for (ObjectId obj : advertisedHaves) adv.advertiseHave(obj); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }
Source:
<code>public void run() { while (!shutdown) { try { Thread.sleep(logDelayMillis); } catch (InterruptedException e) { continue; } tasksSizes.clear(); for (ScheduledExecutorPartition partition : partitions) { if (partition == null) { continue; } <START> if (partitionService.getPartitionOwner(partition.partitionId()) != nodeEngine.getThisAddress()) { <END> continue; } for (Map.Entry<String, ScheduledExecutorContainer> entry : partition.containers.entrySet()) { String name = entry.getKey(); ScheduledExecutorContainer container = entry.getValue(); MutableInteger tasksSize = tasksSizes.get(name); if (tasksSize == null) { tasksSize = new MutableInteger(); tasksSizes.put(name, tasksSize); } tasksSize.value += container.tasks.size(); } } for (Map.Entry<String, MutableInteger> entry : tasksSizes.entrySet()) { logger.info("ScheduledExecutorService(name=" + entry.getKey() + ",tasksSize=" + entry.getValue().value + ")"); } } }</code><technical_language>This replaced partition.isLocal(). Also, deserve a note reported sizes inaccurate a migration</technical_language>

Target:
public void run() { try { while (!shutdown) { try { Thread.sleep(logDelayMillis); } catch (InterruptedException e) { continue; } gatherStats(); logStats(); tasksSizes.clear(); } } catch (Exception e) { logger.warning("StatsLoggerThread failed, message [" + e.getMessage() + "]", e); } }
Source:
<code>private Widget operatorDropDown(final SingleFieldConstraint constraint, final FlexTable inner, final int rowIndex, final int colIndex) { final HorizontalPanel dropdownContainer = new HorizontalPanel(); if (!this.readOnly) { final SingleFieldConstraintOperatorSelectorBuilder operatorSelectorBuilder = GWT.create(SingleFieldConstraintOperatorSelectorBuilder.class); <START> operatorSelectorBuilder.hasConstraint(constraint); <END> operatorSelectorBuilder.hasConstraintValueEditor(() -> constraintValueEditor); operatorSelectorBuilder.hasConstraintValueEditorProducer(this::createValueEditor); operatorSelectorBuilder.hasParentWidgetWidget(this); operatorSelectorBuilder.hasAsyncPackageDataModel(getConnectives().getDataModelOracle()); operatorSelectorBuilder.hasPlaceholderForOperatorsDropdown(dropdownContainer); operatorSelectorBuilder.hasConstraintValueEditorInWrapperAtPosition(inner, rowIndex, colIndex); operatorSelectorBuilder.build(); } else { final SmallLabel sl = new SmallLabel("<b>" + (constraint.getOperator() == null ? GuidedRuleEditorResources.CONSTANTS.pleaseChoose() : HumanReadable.getOperatorDisplayName(constraint.getOperator())) + "</b>"); dropdownContainer.add(sl); } return dropdownContainer; }</code><technical_language>I builder pattern is great for constructing a complex object optional **configurations** in this case **mandatory** IDK separate "has" setters - in fact construction error prone for example if I call hasPlaceholderForOperatorsDropdown(..) I get a runtime NPE error. Please consider replacing "has" setters a single "configure(..)" method takes mandatory parameters. Or, in build() method validate mandatory parameters set</technical_language>

Target:
private Widget operatorDropDown(final SingleFieldConstraint constraint, final FlexTable inner, final int rowIndex, final int colIndex) { final HorizontalPanel dropdownContainer = new HorizontalPanel(); if (!this.readOnly) { final SingleFieldConstraintOperatorSelector operatorSelectorBuilder = GWT.create(SingleFieldConstraintOperatorSelector.class); operatorSelectorBuilder.configure(constraint, () -> constraintValueEditor, this::createValueEditor, this, dropdownContainer, inner, rowIndex, colIndex, getConnectives().getDataModelOracle()); } else { final SmallLabel sl = new SmallLabel("<b>" + (constraint.getOperator() == null ? GuidedRuleEditorResources.CONSTANTS.pleaseChoose() : HumanReadable.getOperatorDisplayName(constraint.getOperator())) + "</b>"); dropdownContainer.add(sl); } return dropdownContainer; }
Source:
<code>public void authenticatedWhenUserNotAuthenticatedThenDeniedDecision() { AuthenticatedAuthorizationManager<Object> manager = AuthenticatedAuthorizationManager.authenticated(); <START> Supplier<Authentication> authentication = () -> { <END> TestingAuthenticationToken authenticationToken = new TestingAuthenticationToken("user", "password", "ROLE_ADMIN", "ROLE_USER"); authenticationToken.setAuthenticated(false); return authenticationToken; }; Object object = new Object(); assertThat(manager.check(authentication, object).isGranted()).isFalse(); }</code><technical_language>reduce indentation, I if this more readable: java TestingAuthenticationToken authentication = new TestingAuthenticationToken("user", "password", "ROLE_ADMIN", "ROLE_USER"); authentication.setAuthenticated(false); Object object = new Object(); assertThat(manager.check(() -> authentication, object).isGranted()).isFalse();</technical_language>

Target:
public void authenticatedWhenUserNotAuthenticatedThenDeniedDecision() { AuthenticatedAuthorizationManager<Object> manager = AuthenticatedAuthorizationManager.authenticated(); TestingAuthenticationToken authentication = new TestingAuthenticationToken("user", "password", "ROLE_ADMIN", "ROLE_USER"); authentication.setAuthenticated(false); Object object = new Object(); assertThat(manager.check(() -> authentication, object).isGranted()).isFalse(); }
Source:
<code>public void visit(@NonNull DataChartStringDescriptor<?> desc) { <START> fConsumer = new ScatterStringConsumer(IStringResolver.class.cast(desc.getResolver()), fForXAxis ? fXStringMap : fYStringMap); <END> }</code><technical_language>Add a FIXME somewhere, consumers more generic accept Object some <?> need this cast here</technical_language>

Target:
public void visit(@NonNull DataChartStringDescriptor<?> desc) { fConsumer = new ScatterStringConsumer(IStringResolver.class.cast(desc.getResolver()), fMap); }
Source:
<code>public String determineLastName(Optional<User> user) { <START> return Buddy.determineName(this::getLastName, user, User::getLastName, "message.alternative.last.name", getNickname()); <END> }</code><technical_language>Buddy.determineName -> determineName</technical_language>

Target:
public String determineLastName(Optional<User> user) { return determineName(this::getLastName, user, User::getLastName, "message.alternative.last.name", getNickname()); }
Source:
<code>public Class<?> getCellClass(int column) { EditedStyleItem item = myAttributes.get(myRowIndex); String name = item.getName(); AttributeDefinition attrDefinition = myAttributeDefinitions.getAttrDefByName(name); ResourceValue resourceValue = mySelectedStyle.getConfiguration().getResourceResolver().resolveResValue(item.getItemResourceValue()); if (resourceValue == null) { LOG.error("Unable to resolve " + item.getValue()); return null; } ResourceType urlType = resourceValue.getResourceType(); if (urlType == ResourceType.STYLE && <START> column == 1) { <END> return ThemeEditorStyle.class; } if (urlType == ResourceType.DRAWABLE) { return DrawableDomElement.class; } String value = resourceValue.getValue(); if (value == null) { return String.class; } if (urlType == ResourceType.COLOR || (value.startsWith("#") && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Color))) { return Color.class; } if (column == 1) { if (urlType == ResourceType.INTEGER || ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Integer)) { return Integer.class; } if (urlType == ResourceType.BOOL || ((value.equals("true") || value.equals("false")) && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Boolean))) { return Boolean.class; } } return String.class; }</code><technical_language>is this 1 if (column == 1) { section bellow</technical_language>

Target:
public Class<?> getCellClass(int column) { EditedStyleItem item = myAttributes.get(myRowIndex); String name = item.getName(); AttributeDefinition attrDefinition = myAttributeDefinitions.getAttrDefByName(name); ResourceValue resourceValue = mySelectedStyle.getConfiguration().getResourceResolver().resolveResValue(item.getItemResourceValue()); if (resourceValue == null) { LOG.error("Unable to resolve " + item.getValue()); return null; } ResourceType urlType = resourceValue.getResourceType(); String value = resourceValue.getValue(); if (value == null) { if (urlType == ResourceType.STYLE && column == 1) { return ThemeEditorStyle.class; } return String.class; } if (urlType == ResourceType.DRAWABLE) { return DrawableDomElement.class; } if (urlType == ResourceType.COLOR || (value.startsWith("#") && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Color))) { return Color.class; } if (column == 1) { if (urlType == ResourceType.INTEGER || ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Integer)) { return Integer.class; } if (urlType == ResourceType.BOOL || ((value.equals("true") || value.equals("false")) && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Boolean))) { return Boolean.class; } } return String.class; }
Source:
<code>protected Map<String, Pair<String, String>> getExclusiveLocks() { <START> return Collections.singletonMap(getParameters().getStorageDomainId().toString(), <END> LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); }</code><technical_language>Please check if getParameters().getStorageDomainId() is null</technical_language>

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { if (getParameters().getStorageDomainId() != null) { return Collections.singletonMap(getParameters().getStorageDomainId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } return null; }
Source:
<code>private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap, CurrentStateOutput currentStateOutput) { Map<String, Resource> restOfResources = new HashMap<>(resourceMap); WorkflowControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); BestPossibleStateOutput output = new BestPossibleStateOutput(); final List<String> failureResources = new ArrayList<>(); scheduleWorkflows(resourceMap, cache, restOfResources, failureResources, currentStateOutput, output); for (String jobName : cache.getTaskDataCache().getDispatchedJobs()) { updateResourceMap(jobName, resourceMap, output.getPartitionStateMap(jobName).partitionSet()); restOfResources.remove(jobName); } Map<String, Resource> taskResourcesToDrop = event.getAttribute(AttributeName.TASK_RESOURCES_TO_DROP.name()); for (String resourceName : taskResourcesToDrop.keySet()) { <START> ResourceAssignment emptyAssignment = _workflowDispatcher.buildEmptyAssignment(resourceName, currentStateOutput); _workflowDispatcher.updateBestPossibleStateOutput(resourceName, emptyAssignment, output); <END> } return output; }</code><technical_language>this logic handled workflow dispatcher job dispatcher? current code breaks workflow dispatcher OO design lets Stage class takes responsibility of dispatcher</technical_language>

Target:
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap, CurrentStateOutput currentStateOutput) { Map<String, Resource> restOfResources = new HashMap<>(resourceMap); WorkflowControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); BestPossibleStateOutput output = new BestPossibleStateOutput(); final List<String> failureResources = new ArrayList<>(); scheduleWorkflows(resourceMap, cache, restOfResources, failureResources, currentStateOutput, output); for (String jobName : cache.getTaskDataCache().getDispatchedJobs()) { updateResourceMap(jobName, resourceMap, output.getPartitionStateMap(jobName).partitionSet()); restOfResources.remove(jobName); } for (String resourceName : restOfResources.keySet()) { _workflowDispatcher.processJobForDrop(resourceName, currentStateOutput, output); } return output; }
Source:
<code>protected void tearDown() throws Exception { <START> setErrorCatchActive(false); <END> if (isOutlineViewOpened) { designerViews.openOutlineView(); } if (isPropertiesViewOpened) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { PlatformUI.getWorkbench().getWorkbenchWindows()[0].getPages()[0].showView(PROPERTIES_VIEW_ID); } catch (PartInitException e) { fail("Could not reopen property view during teardown : " + e.getMessage()); } } }); } SWTBotUtils.waitAllUiEvents(); super.tearDown(); }</code><technical_language>strange deactivat errorCatch ..</technical_language>

Target:
protected void tearDown() throws Exception { if (isOutlineViewOpened) { designerViews.openOutlineView(); } if (isPropertiesViewOpened) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { PlatformUI.getWorkbench().getWorkbenchWindows()[0].getPages()[0].showView(PROPERTIES_VIEW_ID); } catch (PartInitException e) { fail("Could not reopen property view during teardown : " + e.getMessage()); } } }); } SWTBotUtils.waitAllUiEvents(); super.tearDown(); }
Source:
<code>public static ChallengeDto map(Challenge challenge){ if (challenge == null){ return null; } ChallengeDto dto = new ChallengeDto(challenge); <START> dto.setInvitedUsers(challenge.getInvitedUsers().stream().map(UserShowDto::new).collect(Collectors.toList())); <END> return dto; }</code><technical_language>if challenge.getInvitedUsers() == null</technical_language>

Target:
public static ChallengeDto map(Challenge challenge){ if (challenge == null){ return null; } ChallengeDto dto = new ChallengeDto(challenge); if (challenge.getInvitedUsers() != null){ dto.setInvitedUsers(challenge.getInvitedUsers().stream().map(UserShowDto::new).collect(Collectors.toList())); } return dto; }
Source:
<code>public void writeTo(View t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException { final Timer.Context context = metricRegistry.timer(name(t.getClass(), "rendering")).time(); try { for (ViewRenderer renderer : renderers) { if (renderer.isRenderable(t)) { renderer.render(t, detectLocale(headers), entityStream); return; } } throw new ViewRenderException("Unable to find a renderer for " + t.getTemplateName()); <START> } catch (Throwable e) { <END> logger.debug("Template Error", e); throw new WebApplicationException(Response.serverError() .type(MediaType.TEXT_HTML_TYPE) .entity(TEMPLATE_ERROR_MSG) .build()); } finally { context.stop(); } }</code><technical_language>Catching Throwable instead of Exception broad catches non-recoverable errors OutOfMemoryError</technical_language>

Target:
public void writeTo(View t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException { final Timer.Context context = metricRegistry.timer(name(t.getClass(), "rendering")).time(); try { for (ViewRenderer renderer : renderers) { if (renderer.isRenderable(t)) { renderer.render(t, detectLocale(headers), entityStream); return; } } throw new ViewRenderException("Unable to find a renderer for " + t.getTemplateName()); } catch (Exception e) { logger.debug("Template Error", e); throw new WebApplicationException(Response.serverError() .type(MediaType.TEXT_HTML_TYPE) .entity(TEMPLATE_ERROR_MSG) .build()); } finally { context.stop(); } }
Source:
<code>public void reloadServer() throws Exception { ManagementClient mgmtClient = getManagementClient(); long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); <START> mgmtClient.executeForResult(Operations.createOperation(RELOAD, new ModelNode().setEmptyList())); <END> while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { controller.getClient().isServerInRunningState(); } catch (RuntimeException ex) { ex.printStackTrace(); break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); Thread.sleep(2 * FREQUENCY); Assert.assertTrue(mgmtClient.isServerInRunningState()); }</code><technical_language>In this case I matters, I in general write new tests operations constants. a regression check ensure operation names change in constant value.... ...though I bring this wildfly-dev this PR :)</technical_language>

Target:
public void reloadServer() throws Exception { ManagementClient mgmtClient = getManagementClient(); long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); mgmtClient.executeForResult(Operations.createOperation(RELOAD, new ModelNode().setEmptyList())); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { controller.getClient().isServerInRunningState(); } catch (RuntimeException ex) { break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); Thread.sleep(2 * FREQUENCY); Assert.assertTrue(mgmtClient.isServerInRunningState()); }
Source:
<code>public Set<String> call() { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> filtered = filterUntrackedFolders( status.getUntracked(), status.getUntrackedFolders()); <START> for (String file : filtered) { <END> if (paths.isEmpty() || paths.contains(file)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), file)); files.add(file); } } if (directories) for (String dir : status.getUntrackedFolders()) if (paths.isEmpty() || paths.contains(dir)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); files.add(dir + "/"); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }</code><technical_language>curlies needed</technical_language>

Target:
public Set<String> call() { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> filtered = filterUntrackedFolders( status.getUntracked(), status.getUntrackedFolders()); for (String file : filtered) if (paths.isEmpty() || paths.contains(file)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), file)); files.add(file); } if (directories) for (String dir : status.getUntrackedFolders()) if (paths.isEmpty() || paths.contains(dir)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); files.add(dir + "/"); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }
Source:
<code>public void setUp() { finderUseStartPort = new PortFinder(1200, ImmutableList.of()); for (int i = 1024; i <= 0xFFFF; ++i) { try { <START> new ServerSocket(i).close(); <END> new ServerSocket(i + 1).close(); finderUseCandidatePorts = new PortFinder(1200, ImmutableList.of(i, i + 1)); break; } catch (Exception e) { } } }</code><technical_language>I avoid environment dependent code in unit tests, interfere another process test. mock canBind, if want check class provide occupied *1024* port, method stub of canBind(1024) return false</technical_language>

Target:
public void setUp() { PortFinder finder1 = EasyMock.createMockBuilder(PortFinder.class) .withConstructor(1200, 1201, ImmutableList.of()) .addMockedMethod("canBind") .createMock(); PortFinder finder2 = EasyMock.createMockBuilder(PortFinder.class) .withConstructor(1024, 1025, ImmutableList.of(1200, 1201)) .addMockedMethod("canBind") .createMock(); finders.add(finder1); finders.add(finder2); }
Source:
<code>IngestJob(Content dataSource, List<AbstractFile> files, IngestJobSettings settings) { this.id = IngestJob.nextId.getAndIncrement(); this.ingestJobPipelines = new ConcurrentHashMap<>(); this.settings = settings; this.files = files; this.dataSources.add(dataSource); this.ingestMode = Mode.BATCH; incompleteJobsCount = new AtomicInteger(1); cancellationReason = CancellationReason.NOT_CANCELLED; <START> } <END></code><technical_language>constructors a lot of duplicated code. this reduced call other</technical_language>

Target:
IngestJob(Content dataSource, List<AbstractFile> files, IngestJobSettings settings) { this(Arrays.asList(dataSource), settings); this.files.addAll(files); }
Source:
<code>public Server(int port, int blocksize, int numberOfCacheBlocks) { <START> this(port, blocksize, numberOfCacheBlocks, !Boolean.parseBoolean(System.getProperty("BUFFERSERVER.BACK_PRESSURE_DISABLE"))); <END> }</code><technical_language>Boolean.getBoolean()? Introduce final static</technical_language>

Target:
public Server(int port, int blocksize, int numberOfCacheBlocks) { this.port = port; this.blockSize = blocksize; this.numberOfCacheBlocks = numberOfCacheBlocks; serverHelperExecutor = Executors.newSingleThreadExecutor(new NameableThreadFactory("ServerHelper")); final ArrayBlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(numberOfCacheBlocks); final NameableThreadFactory threadFactory = new NameableThreadFactory("StorageHelper"); storageHelperExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, workQueue, threadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); }
Source:
<code>public ColumnEncoding getColumnEncoding(int sequence) { if (sequence == 0) { return this; } checkState( additionalSequenceEncodings.isPresent(), <START> "Got non-zero sequence: " + sequence + ", but there are no additional sequence encodings, encoding: " + this); <END> return additionalSequenceEncodings.get().get(sequence - 1).getValueEncoding(); }</code><technical_language>nit: consider format here. ... additional sequence encodings: %s</technical_language>

Target:
public ColumnEncoding getColumnEncoding(int sequence) { if (sequence == 0) { return this; } checkState( additionalSequenceEncodings.isPresent(), "Got non-zero sequence: %d, but there are no additional sequence encodings: %s", sequence, this); return additionalSequenceEncodings.get().get(sequence - 1).getValueEncoding(); }
Source:
<code>public static int calculateRequiredMinimumNumberOfNodes(AdvancedCache<?, ?> cache) { Configuration config = cache.getCacheConfiguration(); ClusteringConfiguration clusteringConfiguration = config.clustering(); CacheMode mode = clusteringConfiguration.cacheMode(); if (mode.isReplicated() || !mode.isClustered()) { return 1; } CacheTopology cacheTopology = cache.getDistributionManager().getCacheTopology(); if (mode.isInvalidation()) { <START> return cacheTopology.getMembers().size(); <END> } int numMembers = cacheTopology.getMembers().size(); int numOwners = clusteringConfiguration.hash().numOwners(); int minNodes; if (mode.isScattered()) { minNodes = numMembers - 1; } else { minNodes = numMembers - numOwners + 1; } long maxSize = config.memory().size(); int evictionRestrictedNodes; if (maxSize > 0) { DataContainer dataContainer = cache.getDataContainer(); long totalData = dataContainer.evictionSize() * numOwners; long capacity = dataContainer.capacity(); evictionRestrictedNodes = (int) (totalData / capacity) + (totalData % capacity != 0 ? 1 : 0); } else { evictionRestrictedNodes = 1; } return Math.max(evictionRestrictedNodes, minNodes); }</code><technical_language>In invalidation mode I matters is a lossy mode anyway</technical_language>

Target:
public static int calculateRequiredMinimumNumberOfNodes(AdvancedCache<?, ?> cache) { Configuration config = cache.getCacheConfiguration(); ClusteringConfiguration clusteringConfiguration = config.clustering(); CacheMode mode = clusteringConfiguration.cacheMode(); if (mode.isReplicated() || !mode.isClustered()) { return 1; } CacheTopology cacheTopology = cache.getDistributionManager().getCacheTopology(); if (mode.isInvalidation()) { return cacheTopology.getMembers().size(); } int numMembers = cacheTopology.getMembers().size(); int numOwners = mode.isScattered() ? 2 : clusteringConfiguration.hash().numOwners(); int minNodes = numMembers - numOwners + 1; long maxSize = config.memory().size(); int evictionRestrictedNodes; if (maxSize > 0) { DataContainer dataContainer = cache.getDataContainer(); long totalData = dataContainer.evictionSize() * numOwners; long capacity = dataContainer.capacity(); evictionRestrictedNodes = (int) (totalData / capacity) + (totalData % capacity != 0 ? 1 : 0); } else { evictionRestrictedNodes = 1; } return Math.max(evictionRestrictedNodes, minNodes); }
Source:
<code>private void rollback(Transaction txn, Exception cause) throws Exception { try { txn.rollback(); } catch (Exception e) { <START> } finally { <END> throw cause; } }</code><technical_language>I log this exception throwing other</technical_language>

Target:
private void rollback(Transaction txn, Exception cause) throws Exception { try { txn.rollback(); } catch (Exception e) { LOGGER.debug(e, "Error while rolling back transaction " + txn); } finally { throw cause; } }
Source:
<code>public void end(boolean interrupted) { <START> LogKitten.d("MotorControl interrupted"); <END> }</code><technical_language>This is wrong. This code log "MotorControl interrupted" whenever, command ends, of interrupted. put if statement</technical_language>

Target:
public void end(boolean interrupted) { if (interrupted) { LogKitten.d("MotorControl interrupted"); } }
Source:
<code>public HttpRequest filter(HttpRequest request) throws HttpException { <START> checkNotNull(authToken.identity, "credential returned null"); <END> return request.toBuilder().replaceHeader(AuthHeaders.AUTH_TOKEN, TokenBased()).build(); }</code><technical_language>Move this constructor</technical_language>

Target:
public HttpRequest filter(HttpRequest request) throws HttpException { return request.toBuilder().replaceHeader(AuthHeaders.AUTH_TOKEN, authToken.identity).build(); }
Source:
<code><START> public int serialize(ByteBuffer bb) { <END> int start = bb.position(); if (!cachedFlowStateEthernetHeader.isPresent()) { putFlowStateEthernetHeader(); } bb.put(cachedFlowStateEthernetHeader.get()); final ElasticData elasticData = getCore(); if (elasticData.getLength() > 0) { putElasticData(bb, start, elasticData); } return FLOW_STATE_ETHERNET_OVERHEAD + getElasticDataLength(); }</code><technical_language>call super.serialize() serializes ethernet headers, ip headers, udp headers finally elasticdata</technical_language>

Target:
public int serialize(ByteBuffer bb) { int start = bb.position(); if (cachedFlowStateEthernetHeader == null) { putFlowStateEthernetHeader(); } bb.put(cachedFlowStateEthernetHeader); final ElasticData elasticData = getCore(); if (elasticData.getLength() > 0) { putElasticData(bb, start, elasticData); } return FLOW_STATE_ETHERNET_OVERHEAD + getElasticDataLength(); }
Source:
<code>public void close() throws SQLException { <START> if (closed.compareAndSet(false, true)) { <END> client.close(); } }</code><technical_language>This needed StatementClient.close() idempotent</technical_language>

Target:
public void close() throws SQLException { closed.set(true); client.close(); }
Source:
<code>private CompletableFuture<Layout> fetchLayout(List<String> layoutServers) { return CompletableFuture.supplyAsync(() -> { List<String> layoutServersCopy = new ArrayList<>(layoutServers); parameters.getBeforeRpcHandler().run(); int systemDownTriggerCounter = 0; while (true) { try { <START> CompletableFuture<Layout> layoutFuture = getLatestLayout(layoutServersCopy); <END> Layout l = layoutFuture.get(); if (latestLayout != null && latestLayout.getEpoch() > l.getEpoch()) { log.warn("fetchLayout: Received a layout with epoch " + " smaller than latestLayout epoch {}, " + "discarded.", l.getEpoch(), latestLayout.getEpoch()); continue; } checkClusterId(l); layout = layoutFuture; latestLayout = l; pruneRemovedRouters(l); return l; } catch (Exception e) { log.warn("Tried to get layout but failed with exception:", e); } log.warn("Couldn't connect to any up-to-date layout servers, retrying in {}, " + "Retried times, systemDownHandlerTriggerLimit = {}", parameters.connectionRetryRate, systemDownTriggerCounter, parameters.getSystemDownHandlerTriggerLimit()); if (++systemDownTriggerCounter >= parameters.getSystemDownHandlerTriggerLimit()) { log.info("fetchLayout: Invoking the systemDownHandler."); parameters.getSystemDownHandler().run(); } Sleep.sleepUninterruptibly(parameters.connectionRetryRate); if (isShutdown) { return null; } } }); }</code><technical_language>is runtime tracking layouts (i.e. layout latestLayout), remove latestLayout update this.layout discover layouts higher epochs</technical_language>

Target:
private CompletableFuture<Layout> fetchLayout(List<String> layoutServers) { return CompletableFuture.supplyAsync(() -> { List<String> layoutServersCopy = new ArrayList<>(layoutServers); parameters.getBeforeRpcHandler().run(); int systemDownTriggerCounter = 0; while (true) { if (isShutdown) { return null; } try { Layout l = getLatestLayout(layoutServersCopy); if (latestLayout != null && latestLayout.getEpoch() > l.getEpoch()) { log.warn("fetchLayout: Received a layout with epoch " + " smaller than latestLayout epoch {}, " + "discarded.", l.getEpoch(), latestLayout.getEpoch()); } else { checkClusterId(l); latestLayout = l; CompletableFuture<Layout> completedFuture = new CompletableFuture<Layout>(); completedFuture.complete(latestLayout); layout = completedFuture; pruneRemovedRouters(l); return l; } } catch (Exception e) { log.warn("Tried to get layout but failed with exception:", e); } log.warn("Couldn't connect to any up-to-date layout servers, retrying in {}, " + "Retried times, systemDownHandlerTriggerLimit = {}", parameters.connectionRetryRate, systemDownTriggerCounter, parameters.getSystemDownHandlerTriggerLimit()); if (++systemDownTriggerCounter >= parameters.getSystemDownHandlerTriggerLimit()) { log.info("fetchLayout: Invoking the systemDownHandler."); parameters.getSystemDownHandler().run(); } Sleep.sleepUninterruptibly(parameters.connectionRetryRate); } }); }
Source:
<code>private JcrAccessControlList findAccessList( String absPath, boolean searchParents ) throws PathNotFoundException, RepositoryException { CachedNode startingNode = session.cachedNode(session.pathFactory().create(absPath), false); SessionCache sessionCache = session.cache(); Map<String, Set<String>> permissions = startingNode.getPermissions(sessionCache); CachedNode node = startingNode; <START> if ((permissions == null || permissions.isEmpty()) && searchParents) { <END> while (permissions == null || permissions.isEmpty()) { NodeKey parentKey = node.getParentKey(sessionCache); if (parentKey == null) { break; } node = sessionCache.getNode(parentKey); if (node == null) { break; } permissions = node.getPermissions(sessionCache); } } if (permissions == null || node == null) { return null; } String aclPath = startingNode.getKey().equals(node.getKey()) ? absPath : node.getPath(sessionCache).getString(); JcrAccessControlList acl = new JcrAccessControlList(aclPath); for (String principalName : permissions.keySet()) { Set<String> privileges = permissions.get(principalName); acl.addAccessControlEntry(principal(principalName), privileges(privileges)); } return acl; }</code><technical_language>Minor nit: this line if ( searchParents ) { permission-related criteria handled in while loop</technical_language>

Target:
private JcrAccessControlList findAccessList( String absPath, boolean searchParents ) throws PathNotFoundException, RepositoryException { CachedNode startingNode = session.cachedNode(session.pathFactory().create(absPath), false); SessionCache sessionCache = session.cache(); Map<String, Set<String>> permissions = startingNode.getPermissions(sessionCache); CachedNode node = startingNode; if (searchParents) { while (permissions == null || permissions.isEmpty()) { NodeKey parentKey = node.getParentKey(sessionCache); if (parentKey == null) { break; } node = sessionCache.getNode(parentKey); if (node == null) { break; } permissions = node.getPermissions(sessionCache); } } if (permissions == null || node == null) { return null; } String aclPath = startingNode.getKey().equals(node.getKey()) ? absPath : node.getPath(sessionCache).getString(); JcrAccessControlList acl = new JcrAccessControlList(aclPath); for (String principalName : permissions.keySet()) { Set<String> privileges = permissions.get(principalName); acl.addAccessControlEntry(principal(principalName), privileges(privileges)); } return acl; }
Source:
<code>protected AmqpSession createSession(String sessionName, Session session, SessionHandler handler) { return new ReactorSession(session, handler, sessionName, reactorProvider, handlerProvider, getClaimsBasedSecurityNode(), tokenManagerProvider, messageSerializer, <START> connectionOptions.getRetry().getTryTimeout(), RetryUtil.getRetryPolicy(connectionOptions.getRetry())); <END> }</code><technical_language>ctor creates instance of RetryPolicy. Is a reason for creating another instance instead of this.retryPolicy</technical_language>

Target:
protected AmqpSession createSession(String sessionName, Session session, SessionHandler handler) { return new ReactorSession(session, handler, sessionName, reactorProvider, handlerProvider, getClaimsBasedSecurityNode(), tokenManagerProvider, messageSerializer, connectionOptions.getRetry().getTryTimeout(), retryPolicy); }
Source:
<code><START> @Override protected Application provideApplication() { <END> return new GuiceApplicationBuilder().build(); }</code><technical_language>@Override is line function</technical_language>

Target:
protected Application provideApplication() { return new GuiceApplicationBuilder().build(); }
Source:
<code>public void edit(final VolumeRebalanceStatusModel object) { driver.edit(object); rebalanceHostsTable.asEditor().edit(object.getRebalanceSessions()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { PropertyChangedEventArgs e = (PropertyChangedEventArgs) args; if (e.PropertyName.equals("STATUS_UPDATED")) { status.setVisible(object.isStatusAvailable()); } else if (e.PropertyName.equals("STOP_TIME_UPDATED")) { stopTimePanel.setVisible(object.isStopTimeVisible()); <START> status.setVisible(object.isStatusAvailable()); <END> } } }); }</code><technical_language>is this required</technical_language>

Target:
public void edit(final VolumeRebalanceStatusModel object) { driver.edit(object); rebalanceHostsTable.asEditor().edit(object.getRebalanceSessions()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { status.setVisible(object.isStatusAvailable()); stopTimePanel.setVisible(object.isStopTimeVisible()); } }); }
Source:
<code>private void prepareGuestAgentNetworkDevicesForUpdate() { if (vdsmVm != null) { VmDynamic vdsmVmDynamic = vdsmVm.getVmDynamic(); if (vdsmVmDynamic != null) { if (dbVm != null) { List<VmGuestAgentInterface> vmGuestAgentInterfaces = vdsmVm.getVmGuestAgentInterfaces(); int guestAgentNicHash = vmGuestAgentInterfaces == null ? 0 : vmGuestAgentInterfaces.hashCode(); if (guestAgentNicHash != vdsmVmDynamic.getGuestAgentNicsHash()) { if (vmDynamicToSave == null) { saveDynamic(dbVm.getDynamicData()); } updateGuestAgentInterfacesChanges( vmDynamicToSave, vmGuestAgentInterfaces, guestAgentNicHash); <START> vmsMonitoring.addVmGuestAgentNics(dbVm.getId(), vdsmVm.getVmGuestAgentInterfaces()); <END> } } } } }</code><technical_language>saved in 'vmGuestAgentInterfaces', please argument. in addition, this in called updateGuestAgentInterfacesChanges()</technical_language>

Target:
private void prepareGuestAgentNetworkDevicesForUpdate() { if (vdsmVm != null) { VmDynamic vdsmVmDynamic = vdsmVm.getVmDynamic(); if (vdsmVmDynamic != null) { if (dbVm != null) { List<VmGuestAgentInterface> vmGuestAgentInterfaces = vdsmVm.getVmGuestAgentInterfaces(); int guestAgentNicHash = vmGuestAgentInterfaces == null ? 0 : vmGuestAgentInterfaces.hashCode(); if (guestAgentNicHash != vdsmVmDynamic.getGuestAgentNicsHash()) { if (vmDynamicToSave == null) { saveDynamic(dbVm.getDynamicData()); } updateGuestAgentInterfacesChanges( vmDynamicToSave, vmGuestAgentInterfaces, guestAgentNicHash); } } } } }
Source:
<code>public void createTeam(final Team team, final Type type) { final Map<String, AttributeValue> item = new HashMap<>(); <START> item.put("type", new AttributeValue().withS(type.toString())); <END> item.put("name", new AttributeValue().withS(team.name)); item.put("members", new AttributeValue().withSS(team.ids)); final PutItemRequest putItemRequest = new PutItemRequest(); putItemRequest.withTableName(tableName) .withItem(item); dynamoDB.putItem(putItemRequest); }</code><technical_language>Again, minor good in future: Constant for strings</technical_language>

Target:
public void createTeam(final Team team, final Type type) { final Map<String, AttributeValue> item = new HashMap<>(); item.put(TYPE_ATTRIBUTE_NAME, new AttributeValue().withS(type.toString())); item.put(NAME_ATTRIBUTE_NAME, new AttributeValue().withS(team.name)); item.put(MEMBERS_ATTRIBUTE_NAME, new AttributeValue().withSS(team.ids)); final PutItemRequest putItemRequest = new PutItemRequest(); putItemRequest.withTableName(tableName) .withItem(item); dynamoDB.putItem(putItemRequest); }
Source:
<code>public void testGeneratedConfigIni() { try { ILaunchConfiguration[] launchCfgs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(); Arrays.asList(launchCfgs).forEach(c -> { try { if (c.getFile().getName().toString().equalsIgnoreCase(GENERATED_CFGINI_LAUNCH)) { bundleMap = BundleLauncherHelper.getMergedBundleMap(c, false); bundleMap.keySet().stream().filter(b -> { IPluginBase pmb = b.getPluginBase(); String sl = bundleMap.get(pmb); if (sl == null || sl.equalsIgnoreCase("default:default")) { return false; } else { return true; } }).forEach(x -> System.out.println(x.getPluginBase().getId())); assertStartInfo("-1:true", "org.eclipse.osgi"); assertStartInfo("1:true", "org.eclipse.equinox.simpleconfigurator"); assertStartInfo("1:true", "org.apache.felix.scr"); assertStartInfo("2:true", "org.eclipse.equinox.common"); assertStartInfo("default:default", "org.eclipse.equinox.event"); assertStartInfo("default:default", "org.eclipse.equinox.registry"); } } catch (CoreException e) { assumeNoException(e); } }); } catch (Exception e) { <START> assumeNoException(e); <END> } }</code><technical_language>exception mark test skipped, failed! declares throws Exception test</technical_language>

Target:
public void testGeneratedConfigIni() { try { ILaunchConfiguration[] launchCfgs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(); Arrays.asList(launchCfgs).forEach(c -> { try { if (c.getFile().getName().toString().equalsIgnoreCase(GENERATED_CFGINI_LAUNCH)) { bundleMap = BundleLauncherHelper.getMergedBundleMap(c, false); assertStartInfo("-1:true", "org.eclipse.osgi"); assertStartInfo("1:true", "org.eclipse.equinox.simpleconfigurator"); assertStartInfo("1:true", "org.apache.felix.scr"); assertStartInfo("2:true", "org.eclipse.equinox.common"); assertStartInfo("default:default", "org.eclipse.equinox.event"); assertStartInfo("default:default", "org.eclipse.equinox.registry"); } } catch (CoreException e) { assumeNoException(e); } }); } catch (Exception e) { assumeNoException(e); } }
Source:
<code>private void startDefaultDbServiceInstance() { try { if (configurationService.getComponentConfiguration(H2DbService.DEFAULT_INSTANCE_PID) == null) { logger.info("Default H2DbService instance configuration not found, creating new instance..."); configurationService.createFactoryConfiguration(H2_DB_SERVICE_FACTORY_PID, H2DbService.DEFAULT_INSTANCE_PID, null, true); } else { logger.info("Default H2DbService instance configuration found"); } } catch (KuraException e) { <START> throw new ComponentException(e); <END> } }</code><technical_language>I remember this framework retry component activation. choose this for a specific reason</technical_language>

Target:
private void startDefaultDbServiceInstance() { try { if (configurationService.getComponentConfiguration(H2DbService.DEFAULT_INSTANCE_PID) == null) { logger.info("Default H2DbService instance configuration not found, creating new instance..."); configurationService.createFactoryConfiguration(H2_DB_SERVICE_FACTORY_PID, H2DbService.DEFAULT_INSTANCE_PID, null, true); } else { logger.info("Default H2DbService instance configuration found"); } } catch (KuraException e) { logger.error("Failed to retrieve or create default H2DbService factory configuration", e); } }
Source:
<code>private static List<Method> getRelevantMethods(Class<?> clz) { <START> List<Method> methods = new ArrayList<>(); <END> if (methodCache.containsKey(clz)) { return methodCache.get(clz); } for (Method method : clz.getMethods()) { if (method.getName().startsWith("get")) { if (method.getReturnType().getPackage() == BaseResource.class.getPackage()) { methods.add(method); } } } methodCache.put(clz, methods); return methods; }</code><technical_language>This variable created here, in cases used</technical_language>

Target:
private static List<Method> getRelevantMethods(Class<?> clz) { List<Method> methods = methodCache.get(clz); if (methods == null) { methods = new ArrayList<Method>(); for (Method method : clz.getMethods()) { if (method.getName().startsWith("get")) { if (method.getReturnType().getPackage() == BaseResource.class.getPackage()) { methods.add(method); } } } methodCache.put(clz, methods); } return methods; }
Source:
<code><START> public AbstractTmfStateProvider(ITmfTrace trace, String id, int size, int chunk) { <END> fTrace = trace; fEventsQueue = new BufferedBlockingQueue<>(size, chunk); fStateSystemAssigned = false; fSafeTime = trace.getStartTime().toNanos() - 1; fEventHandlerThread = new Thread(new EventProcessor(), id + " Event Handler"); }</code><technical_language>I @VisibleForTesting and/or protected here, avoid this production code, bbq is about, implementation detail all</technical_language>

Target:
protected AbstractTmfStateProvider(ITmfTrace trace, String id, int size, int chunk) { fTrace = trace; fEventsQueue = new BufferedBlockingQueue<>(size, chunk); fStateSystemAssigned = false; fSafeTime = trace.getStartTime().toNanos() - 1; fEventHandlerThread = new Thread(new EventProcessor(), id + " Event Handler"); }
Source:
<code>public void testSetIdsListToSearchCriteria(){ mgr.setIdsListToSearchCriteria(sc, idsList); <START> Mockito.verify(sc, times(1)).setParameters(Mockito.same("idIN"), Mockito.same(id1), Mockito.same(id2)); <END> }</code><technical_language>default of Mockito.verify "times(1)"; so, is need inform it</technical_language>

Target:
public void testSetIdsListToSearchCriteria(){ mgr.setIdsListToSearchCriteria(sc, idsList); Mockito.verify(sc).setParameters(Mockito.same("idIN"), Mockito.same(id1), Mockito.same(id2)); }
Source:
<code>protected HRegion openHRegion(final CancelableProgressable reporter) throws IOException { try { TableDescriptorChecker.checkCompression(htableDescriptor); LOG.debug("checking encryption for " + this.getRegionInfo().getEncodedName()); TableDescriptorChecker.checkEncryption(conf, htableDescriptor); LOG.debug("checking classloading for " + this.getRegionInfo().getEncodedName()); TableDescriptorChecker.checkClassLoading(conf, htableDescriptor); this.openSeqNum = initialize(reporter); this.mvcc.advanceTo(openSeqNum); if (wal != null && getRegionServerServices() != null && RegionReplicaUtil.isDefaultReplica(getRegionInfo())) { writeRegionOpenMarker(wal, openSeqNum); } } catch (Throwable t) { try { this.close(); } catch (IOException e) { <START> LOG.error("close region exception in openHRegion ", e); <END> } throw t; } return this; }</code><technical_language>LOG.error("Open failed. Try close region exception", e);</technical_language>

Target:
protected HRegion openHRegion(final CancelableProgressable reporter) throws IOException { try { TableDescriptorChecker.checkCompression(htableDescriptor); LOG.debug("checking encryption for " + this.getRegionInfo().getEncodedName()); TableDescriptorChecker.checkEncryption(conf, htableDescriptor); LOG.debug("checking classloading for " + this.getRegionInfo().getEncodedName()); TableDescriptorChecker.checkClassLoading(conf, htableDescriptor); this.openSeqNum = initialize(reporter); this.mvcc.advanceTo(openSeqNum); if (wal != null && getRegionServerServices() != null && RegionReplicaUtil.isDefaultReplica(getRegionInfo())) { writeRegionOpenMarker(wal, openSeqNum); } } catch (Throwable t) { try { this.close(); } catch (Throwable e) { LOG.warn("Open region: failed. Try close region but got exception ", this.getRegionInfo(), e); } throw t; } return this; }
Source:
<code>public void testBug1429ParseError() throws Exception { <START> String c = IOUtils.toString(this.getClass().getResourceAsStream("Bug1429.java"), StandardCharsets.UTF_8); <END> parseJava18(c); }</code><technical_language>readAsString(...) instead</technical_language>

Target:
public void testBug1429ParseError() { String c = readAsString("Bug1429.java"); parseJava18(c); }
Source:
<code>boolean equals(ConfigurationSetting o1, ConfigurationSetting o2) { if (o1 == o2) { return true; } if (!Objects.equals(o1.getKey(), o2.getKey()) || !Objects.equals(o1.getLabel(), o2.getLabel()) || !Objects.equals(o1.getValue(), o2.getValue()) || !Objects.equals(o1.getETag(), o2.getETag()) || !Objects.equals(o1.getLastModified(), o2.getLastModified()) || !Objects.equals(o1.isLocked(), o2.isLocked()) || !Objects.equals(o1.getContentType(), o2.getContentType()) || ImplUtils.isNullOrEmpty(o1.getTags()) != ImplUtils.isNullOrEmpty(o2.getTags())) { return false; } if (!ImplUtils.isNullOrEmpty(o1.getTags())) { <START> return Objects.equals(o1.getTags(), o2.getTags()); <END> } return true; }</code><technical_language>Is this perform object reference comparison contents</technical_language>

Target:
static boolean equals(ConfigurationSetting o1, ConfigurationSetting o2) { if (o1 == o2) { return true; } if (!Objects.equals(o1.getKey(), o2.getKey()) || !Objects.equals(o1.getLabel(), o2.getLabel()) || !Objects.equals(o1.getValue(), o2.getValue()) || !Objects.equals(o1.getETag(), o2.getETag()) || !Objects.equals(o1.getLastModified(), o2.getLastModified()) || !Objects.equals(o1.isLocked(), o2.isLocked()) || !Objects.equals(o1.getContentType(), o2.getContentType()) || ImplUtils.isNullOrEmpty(o1.getTags()) != ImplUtils.isNullOrEmpty(o2.getTags())) { return false; } if (!ImplUtils.isNullOrEmpty(o1.getTags())) { return Objects.equals(o1.getTags(), o2.getTags()); } return true; }