auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shutdown() { long startTime = SystemTime.getInstance().milliseconds(); try { logger.info("shutdown started"); if (scheduler != null) { scheduler.shutdown(); if (!scheduler.awaitTermination(1, TimeUnit.DAYS)) { logger.error("Could not terminate all tasks after scheduler shutdown"); } } if (networkServer != null) { networkServer.shutdown(); } if (requestHandlerPool != null) { requestHandlerPool.shutdown(); } if (replicationManager != null) { replicationManager.shutdown(); } if (storeManager != null) { storeManager.shutdown(); } if (connectionPool != null) { connectionPool.shutdown(); } if (reporter != null) { reporter.stop(); } if (notificationSystem != null) { try { notificationSystem.close(); } catch (IOException e) { logger.error("Error while closing notification system.", e); } } logger.info("shutdown completed"); } catch (Exception e) { logger.error("Error while shutting down server", e); } finally { shutdownLatch.countDown(); long processingTime = SystemTime.getInstance().milliseconds() - startTime; metrics.serverShutdownTimeInMs.update(processingTime); logger.info("Server shutdown time in Ms " + processingTime); } }

Target:
public void shutdown() { long startTime = SystemTime.getInstance().milliseconds(); try { logger.info("shutdown started"); if (scheduler != null) { scheduler.shutdown(); if (!scheduler.awaitTermination(5, TimeUnit.MINUTES)) { logger.error("Could not terminate all tasks after scheduler shutdown"); } } if (networkServer != null) { networkServer.shutdown(); } if (requestHandlerPool != null) { requestHandlerPool.shutdown(); } if (replicationManager != null) { replicationManager.shutdown(); } if (storageManager != null) { storageManager.shutdown(); } if (connectionPool != null) { connectionPool.shutdown(); } if (reporter != null) { reporter.stop(); } if (notificationSystem != null) { try { notificationSystem.close(); } catch (IOException e) { logger.error("Error while closing notification system.", e); } } logger.info("shutdown completed"); } catch (Exception e) { logger.error("Error while shutting down server", e); } finally { shutdownLatch.countDown(); long processingTime = SystemTime.getInstance().milliseconds() - startTime; metrics.serverShutdownTimeInMs.update(processingTime); logger.info("Server shutdown time in Ms " + processingTime); } }
Source:
public Orchestrator build() { String version = getSonarVersion(); Configuration.Builder configBuilder = Configuration.builder(); Configuration finalConfig = configBuilder .addConfiguration(config) .addMap(overriddenProperties) .setUpdateCenter(getUpdateCenter()) .build(); checkState(!isEmpty(version), "Missing Sonar version"); this.distribution.setVersion(Version.create(version)); this.distribution.addPluginLocation(ResourceLocation.create("/com/sonar/orchestrator/sonar-reset-data-plugin-1.0-SNAPSHOT.jar")); return new Orchestrator(finalConfig, distribution, startupLogWatcher); }

Target:
public Orchestrator build() { getSonarVersion().ifPresent(s -> this.distribution.setVersion(Version.create(s))); checkState(distribution.getZipFile().isPresent() || distribution.version().isPresent(), "Version or path to ZIP of SonarQube is missing"); Configuration.Builder configBuilder = Configuration.builder(); Configuration finalConfig = configBuilder .addConfiguration(config) .addMap(overriddenProperties) .setUpdateCenter(getUpdateCenter()) .build(); this.distribution.addPluginLocation(ResourceLocation.create("/com/sonar/orchestrator/sonar-reset-data-plugin-1.0-SNAPSHOT.jar")); return new Orchestrator(finalConfig, distribution, startupLogWatcher); }
Source:
public void testCanDoActionNonExistingStorageDomain() { assertFalse("canDoActtion shouldn't be possible for a non-existant storage domain", command.canDoAction()); command.setActionMessageParameters(); List<String> messages = command.getReturnValue().getCanDoActionMessages(); assertEquals("Wrong number of messages", 3, messages.size()); assertEquals("Wrong message", VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST.name(), messages.get(0)); assertEquals("Wrong message", VdcBllMessages.VAR__TYPE__STORAGE__DOMAIN.name(), messages.get(1)); assertEquals("Wrong message", VdcBllMessages.VAR__ACTION__REMOVE.name(), messages.get(2)); }

Target:
public void testCanDoActionNonExistingStorageDomain() { assertFalse("canDoActtion shouldn't be possible for a non-existant storage domain", command.canDoAction()); checkMessages(command, VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); }
Source:
public void shouldCallProcedureWithByteArrayWithParameterAndYield() throws Throwable { try ( Transaction ignore = db.beginTx() ) { Result res = db.execute( "CALL org.neo4j.procedure.bytesWithDefault([7,8,9]) YIELD bytes RETURN bytes" ); assertThat( res.columnAs( "bytes" ).next(), equalTo( new byte[]{7, 8, 9} ) ); assertFalse( res.hasNext() ); } }

Target:
public void shouldCallProcedureWithByteArrayWithParameterAndYield() throws Throwable { try ( Transaction ignore = db.beginTx() ) { Result res = db.execute( "WITH $param AS b CALL org.neo4j.procedure.incrBytes(b) YIELD bytes RETURN bytes", map( "param", new byte[]{7, 8, 9} ) ); assertThat( res.columnAs( "bytes" ).next(), equalTo( new byte[]{8, 9, 10} ) ); assertFalse( res.hasNext() ); } }
Source:
public void testNoSessionKey() throws Exception { exception.expectMessage("attribute sessionKey must be specified"); exception.expect(ConfigurationException.class); pipe.setValue("val"); pipe.configure(); PipeRunResult res = pipe.doPipe(null, session); assertFalse(res.getPipeForward().getName().isEmpty()); }

Target:
public void testNoSessionKey() throws Exception { exception.expectMessage("attribute sessionKey must be specified"); exception.expect(ConfigurationException.class); pipe.setValue("val"); pipe.configure(); pipe.doPipe(null, session); fail("this is expected to fail"); }
Source:
public void testUnregisterTwice() { Handler<Message> handler = msg -> {}; eb.registerHandler(ADDRESS1, handler, ar -> { assertTrue(ar.succeeded()); EventBusRegistration reg = ar.result(); reg.unregister(); reg.unregister(); }); testComplete(); }

Target:
public void testUnregisterTwice() { Handler<Message> handler = msg -> {}; Registration reg = eb.registerHandler(ADDRESS1, handler); reg.unregister(); reg.unregister(); testComplete(); }
Source:
void convertWhenSimpleWeeksShouldReturnPeriod(ConversionService conversionService) { assertThat(convert(conversionService, "10W")).isEqualTo(Period.ofWeeks(10)); assertThat(convert(conversionService, "+10w")).isEqualTo(Period.ofWeeks(10)); assertThat(convert(conversionService, "-10W")).isEqualTo(Period.ofWeeks(-10)); }

Target:
void convertWhenSimpleWeeksShouldReturnPeriod(ConversionService conversionService) { assertThat(convert(conversionService, "10w")).isEqualTo(Period.ofWeeks(10)); assertThat(convert(conversionService, "10W")).isEqualTo(Period.ofWeeks(10)); assertThat(convert(conversionService, "+10w")).isEqualTo(Period.ofWeeks(10)); assertThat(convert(conversionService, "-10W")).isEqualTo(Period.ofWeeks(-10)); }
Source:
public void testOutstandingSplitSize() throws Exception { DataSize maxOutstandingSplitsSize = new DataSize(1, MEGABYTE); HiveSplitSource hiveSplitSource = new HiveSplitSource( "client-id", SESSION, "database", "table", TupleDomain.all(), 10, 10000, maxOutstandingSplitsSize, new TestingHiveSplitLoader(), Executors.newFixedThreadPool(5), new CounterStat()); InternalHiveSplit testSplit = new InternalHiveSplit( "partition-name", "path", 0, 100, 100, new Properties(), ImmutableList.of(new HivePartitionKey("pk_col", "pk_value")), ImmutableList.of(new InternalHiveSplit.InternalHiveBlock(0, 100, ImmutableList.of(HostAddress.fromString("localhost")))), OptionalInt.empty(), true, false, ImmutableMap.of()); int testSplitSizeInBytes = testSplit.getEstimatedSizeInBytes(); int maxSplitCount = toIntExact(maxOutstandingSplitsSize.toBytes()) / testSplitSizeInBytes; for (int i = 0; i < maxSplitCount; i++) { hiveSplitSource.addToQueue(testSplit); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } assertEquals(getFutureValue(hiveSplitSource.getNextBatch(maxSplitCount)).size(), maxSplitCount); for (int i = 0; i < maxSplitCount; i++) { hiveSplitSource.addToQueue(testSplit); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } try { hiveSplitSource.addToQueue(testSplit); fail("expect failure"); } catch (PrestoException e) { assertContains(e.getMessage(), "Split buffering for database.table exceeded memory limit"); } }

Target:
public void testOutstandingSplitSize() throws Exception { DataSize maxOutstandingSplitsSize = new DataSize(1, MEGABYTE); HiveSplitSource hiveSplitSource = new HiveSplitSource( SESSION, "database", "table", TupleDomain.all(), 10, 10000, maxOutstandingSplitsSize, new TestingHiveSplitLoader(), Executors.newFixedThreadPool(5), new CounterStat()); InternalHiveSplit testSplit = new InternalHiveSplit( "partition-name", "path", 0, 100, 100, new Properties(), ImmutableList.of(new HivePartitionKey("pk_col", "pk_value")), ImmutableList.of(new InternalHiveBlock(0, 100, ImmutableList.of(HostAddress.fromString("localhost")))), OptionalInt.empty(), true, false, ImmutableMap.of()); int testSplitSizeInBytes = testSplit.getEstimatedSizeInBytes(); int maxSplitCount = toIntExact(maxOutstandingSplitsSize.toBytes()) / testSplitSizeInBytes; for (int i = 0; i < maxSplitCount; i++) { hiveSplitSource.addToQueue(testSplit); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } assertEquals(getFutureValue(hiveSplitSource.getNextBatch(maxSplitCount)).size(), maxSplitCount); for (int i = 0; i < maxSplitCount; i++) { hiveSplitSource.addToQueue(testSplit); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } try { hiveSplitSource.addToQueue(testSplit); fail("expect failure"); } catch (PrestoException e) { assertContains(e.getMessage(), "Split buffering for database.table exceeded memory limit"); } }
Source:
public void testHashPipe() throws Exception { session.put("key", "3:2342:2342" ); pipe.configure(); PipeRunResult res = doPipe(pipe, "password", session); assertEquals("success", res.getPipeForward().getName()); }

Target:
public void testHashPipe() throws Exception { pipe.configure(); PipeRunResult res = doPipe(pipe, "password", session); assertTrue(PasswordHash.validatePassword("password", res.getResult().asString())); int hashLength = res.getResult().asString().length(); assertEquals("success", res.getPipeForward().getName()); assertTrue(hashLength == 135); }
Source:
public boolean remove(R resource) { Thread myself = Thread.currentThread(); return resources.remove(myself, resource); }

Target:
public boolean remove(R resource) { return resources.values().remove(resource); }
Source:
public void testGetNonePermittedStorageDomains() { List<StorageDomain> result = dao.getPermittedStorageDomainsByStoragePool(EXISTING_USER_ID, ActionGroup.CONSUME_QUOTA, Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d")); assertNotNull(result); assertTrue(result.isEmpty()); }

Target:
public void testGetNonePermittedStorageDomains() { List<StorageDomain> result = dao.getPermittedStorageDomainsByStoragePool(EXISTING_USER_ID, ActionGroup.CONSUME_QUOTA, new Guid("6d849ebf-755f-4552-ad09-9a090cda105d")); assertNotNull(result); assertTrue(result.isEmpty()); }
Source:
ColumnIndexWriterProjection(StreamInput in) throws IOException { super(in); if (in.readBoolean()) { targetColsSymbolsExclPartition = Symbols.listFromStream(in); } else { targetColsSymbolsExclPartition = Collections.emptyList(); } if (in.readBoolean()) { int length = in.readVInt(); targetColsExclPartitionCols = new ArrayList<>(length); for (int i = 0; i < length; i++) { targetColsExclPartitionCols.add(Reference.fromStream(in)); } } else { targetColsExclPartitionCols = Collections.emptyList(); } ignoreDuplicateKeys = in.readBoolean(); if (in.readBoolean()) { int mapSize = in.readVInt(); onDuplicateKeyAssignments = new HashMap<>(mapSize); for (int i = 0; i < mapSize; i++) { onDuplicateKeyAssignments.put(Reference.fromStream(in), Symbols.fromStream(in)); } } else { onDuplicateKeyAssignments = Collections.emptyMap(); } if (in.getVersion().onOrAfter(Version.V_4_1_0)) { int mapSize = in.readVInt(); allTargetColumns = new ArrayList<>(); for (int i = 0; i < mapSize; i++) { allTargetColumns.add(Reference.fromStream(in)); } } else { allTargetColumns = List.of(); } }

Target:
ColumnIndexWriterProjection(StreamInput in) throws IOException { super(in); if (in.readBoolean()) { targetColsSymbolsExclPartition = Symbols.listFromStream(in); } else { targetColsSymbolsExclPartition = Collections.emptyList(); } if (in.readBoolean()) { int length = in.readVInt(); targetColsExclPartitionCols = new ArrayList<>(length); for (int i = 0; i < length; i++) { targetColsExclPartitionCols.add(Reference.fromStream(in)); } } else { targetColsExclPartitionCols = Collections.emptyList(); } ignoreDuplicateKeys = in.readBoolean(); if (in.readBoolean()) { int mapSize = in.readVInt(); onDuplicateKeyAssignments = new HashMap<>(mapSize); for (int i = 0; i < mapSize; i++) { onDuplicateKeyAssignments.put(Reference.fromStream(in), Symbols.fromStream(in)); } } else { onDuplicateKeyAssignments = Collections.emptyMap(); } if (in.getVersion().onOrAfter(Version.V_4_2_0)) { int mapSize = in.readVInt(); allTargetColumns = new ArrayList<>(); for (int i = 0; i < mapSize; i++) { allTargetColumns.add(Reference.fromStream(in)); } } else { allTargetColumns = List.of(); } }
Source:
private static IAtomContainer parseSmiles(String smiles) throws CDKException { parser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer molecule = parser.parseSmiles(smiles); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(molecule); CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(molecule.getBuilder()); hAdder.addImplicitHydrogens(molecule); AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); Aromaticity.cdkLegacy().apply(molecule); return molecule; }

Target:
private static IAtomContainer parseSmiles(String smiles) throws CDKException { parser = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer molecule = parser.parseSmiles(smiles); AtomContainerManipulator.percieveAtomTypesAndConfigureUnsetProperties(molecule); AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule); Aromaticity.cdkLegacy().apply(molecule); return molecule; }
Source:
public void testGetMessage() throws Exception { Field[] fields = BKException.Code.class.getFields(); int count = 0; for (Field f : fields) { if (f.getType() == Integer.TYPE && !f.getName().equals("UNINITIALIZED")) { int code = f.getInt(null); String msg = BKException.getMessage(code); if (code == UnexpectedConditionException) { assertThat(msg, equalTo("Unexpected condition")); } else { assertThat("failure on code " + f.getName(), msg, not(equalTo("Unexpected condition"))); } count++; } } assertThat(count, greaterThan(2)); }

Target:
public void testGetMessage() throws Exception { Field[] fields = BKException.Code.class.getFields(); int count = 0; for (Field f : fields) { if (f.getType() == Integer.TYPE && !f.getName().equals("UNINITIALIZED")) { int code = f.getInt(null); String msg = BKException.getMessage(code); if (code == UnexpectedConditionException) { assertEquals("Unexpected condition", msg); } else { assertNotEquals("failure on code " + f.getName(), "Unexpected condition", msg); } count++; } } assertTrue(count > 2); }
Source:
private void handleTagDeleted(ContentTagDeletedEvent tagDeletedEvent) { if (!isNotableTagName(tagDeletedEvent.getDeletedTagInfo().getName())) { return; } try { long contentID = tagDeletedEvent.getDeletedTagInfo().getContentID(); Content content = Case.getCurrentCaseThrows().getSleuthkitCase().getContentById(contentID); TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); List<ContentTag> tags = tagsManager.getContentTagsByContent(content); AbstractFile af = getAbstractFile(content); if (af == null) return; if (hasNotableTag(tags)) { String comment = getMostRecentNotableComment(tags); setContentKnownStatus(af, comment, TskData.FileKnown.BAD, false); } else { String comment = tagDeletedEvent.getDeletedTagInfo().getComment(); setContentKnownStatus(af, comment, TskData.FileKnown.UNKNOWN, true); } } catch (TskCoreException | NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Failed to find content", ex); return; } }

Target:
private void handleTagDeleted(ContentTagDeletedEvent tagDeletedEvent) { if (!isNotableTagName(tagDeletedEvent.getDeletedTagInfo().getName())) { return; } Long contentID = null; try { contentID = tagDeletedEvent.getDeletedTagInfo().getContentID(); Content content = Case.getCurrentCaseThrows().getSleuthkitCase().getContentById(contentID); TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); List<ContentTag> tags = tagsManager.getContentTagsByContent(content); AbstractFile af = Case.getCurrentCaseThrows().getSleuthkitCase().getAbstractFileById(contentID); if (af == null) { return; } CorrelationAttributeInstance eamArtifact = CorrelationAttributeUtil.makeCorrAttrFromFile(af); AttributeUpdate attrUpdate = assessTagDelete(dbManager, eamArtifact, tags); setContentKnownStatus(af, attrUpdate.getComment(), attrUpdate.getFileKnown()); } catch (TskCoreException | NoCurrentCaseException ex) { LOGGER.log(Level.SEVERE, "Failed to find content", ex); } catch (CentralRepoException | CorrelationAttributeNormalizationException ex) { LOGGER.log(Level.SEVERE, "Failed to query database for current correlation attribute instance for content with ID: " + contentID, ex); } }
Source:
CheckoutConflictException(String message, List<String> conflictingPaths) { super(message); this.conflictingPaths=(conflictingPaths); }

Target:
CheckoutConflictException(String message, List<String> conflictingPaths) { super(message); this.conflictingPaths = conflictingPaths; }
Source:
public static boolean isJenkinsAvailable() { logger.trace("Checking Jenkins availability..."); try { HttpURLConnection conn = (HttpURLConnection) new URL(JENKINS_URL).openConnection(); try (AutoCloseable ac = conn::disconnect) { conn.setConnectTimeout(JENKINS_TIMEOUT); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { logger.trace("Jenkins is available at {}", JENKINS_URL); return true; } else { throw new ConnectException(); } } } catch (IOException e) { e.printStackTrace(); logger.warn("Could not connect to Jenkins at {}", JENKINS_URL); } catch (Exception e) { logger.warn("Failed to disconnect an HttpURLConnection to Jenkins at {}", JENKINS_URL); } return false; }

Target:
public static boolean isJenkinsAvailable() { logger.trace("Checking Jenkins availability..."); try { HttpURLConnection conn = (HttpURLConnection) new URL(JENKINS_URL).openConnection(); try (AutoCloseable ac = conn::disconnect) { conn.setConnectTimeout(JENKINS_TIMEOUT); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { logger.trace("Jenkins is available at {}", JENKINS_URL); return true; } } } catch (Exception e) { logger.warn("Could not connect to Jenkins at - {}", JENKINS_URL, e.getMessage()); } return false; }
Source:
public void execute() throws InsufficientCapacityException, ConcurrentOperationException { User callerUser = _accountService.getActiveUser(CallContext.current().getCallingUserId()); Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId()); Network network = _networkService.getNetwork(id); if (network == null) { throw new InvalidParameterValueException("Couldn't find network by id"); } Network result = _networkService.migrateGuestNetwork(getId(), getNetworkOfferingId(), callerAccount, callerUser, getResume()); if (result != null) { NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network"); } }

Target:
public void execute() { User callerUser = _accountService.getActiveUser(CallContext.current().getCallingUserId()); Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId()); Network network = _networkService.getNetwork(id); if (network == null) { throw new InvalidParameterValueException("Couldn't find network by id"); } Network result = _networkService.migrateGuestNetwork(getId(), getNetworkOfferingId(), callerAccount, callerUser, getResume()); if (result != null) { NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network"); } }
Source:
public String getDocumentation() { String documentation = super.getDocumentation(); if (documentation == null || documentation.isEmpty()) { return ""; } else { return documentation; } }

Target:
public String getDocumentation() { String documentation = super.getDocumentation(); if (StringUtils.isEmpty(documentation)) { String defaultDocumentation = workItemDefinition.getDocumentation(); return defaultDocumentation == null ? "" : defaultDocumentation; } else { return documentation; } }
Source:
private void checkFestEqualityAsserts(MethodInvocationTree mit, boolean flipped) { if (mit.arguments().isEmpty()) { return; } ExpressionTree expected = mit.arguments().get(0); ExpressionTree actual = findActualValueForFest(mit); boolean actualIsLiteral = actual != null && isBoolOrNullLiteral(actual); if (isBoolOrNullLiteral(expected) && actualIsLiteral) { reportIssue(mit, DEFAULT_MESSAGE); } else if (isBoolOrNullLiteral(expected)) { checkEqualityAssertWithOneLiteral(mit, expected, flipped, IS); } else if (actualIsLiteral) { checkEqualityAssertWithOneLiteral(mit, actual, flipped, IS); } }

Target:
private void checkFestEqualityAsserts(MethodInvocationTree mit, boolean flipped) { if (mit.arguments().isEmpty()) { return; } Optional<LiteralTree> expectedLiteral = getBoolOrNullLiteral(mit.arguments().get(0)); Optional<LiteralTree> actualLiteral = findActualLiteralForFest(mit); IdentifierTree methodName = ExpressionUtils.methodName(mit); if (expectedLiteral.isPresent() && actualLiteral.isPresent()) { reportDefaultMessage(methodName, Arrays.asList(expectedLiteral.get(), actualLiteral.get())); } else { expectedLiteral.ifPresent(literal -> checkEqualityAssertWithOneLiteral(methodName, literal, flipped, IS)); actualLiteral.ifPresent(literal -> checkEqualityAssertWithOneLiteral(methodName, literal, flipped, IS)); } }
Source:
public boolean include(final TreeWalk walker) { final int n = walker.getTreeCount(); if (n == 1) return true; final int m = walker.getRawMode(baseTree); for (int i = 1; i < n; i++) { DirCacheIterator baseDirCache = walker.getTree(baseTree, DirCacheIterator.class); DirCacheIterator newDirCache = walker.getTree(i, DirCacheIterator.class); if (baseDirCache != null && newDirCache != null) { DirCacheEntry baseDci = baseDirCache.getDirCacheEntry(); DirCacheEntry newDci = newDirCache.getDirCacheEntry(); if (baseDci != null && newDci != null) { if (baseDci.isAssumeValid() != newDci.isAssumeValid()) return true; if (baseDci.isAssumeValid() && newDci.isAssumeValid()) return false; } } if (walker.getRawMode(i) != m || !walker.idEqual(i, baseTree)) return true; } return false; }

Target:
public boolean include(final TreeWalk walker) { final int n = walker.getTreeCount(); if (n == 1) return true; final int m = walker.getRawMode(baseTree); for (int i = 1; i < n; i++) { DirCacheIterator baseDirCache = walker.getTree(baseTree, DirCacheIterator.class); DirCacheIterator newDirCache = walker.getTree(i, DirCacheIterator.class); if (baseDirCache != null && newDirCache != null) { DirCacheEntry baseDci = baseDirCache.getDirCacheEntry(); DirCacheEntry newDci = newDirCache.getDirCacheEntry(); if (baseDci != null && newDci != null) { if (baseDci.isAssumeValid() != newDci.isAssumeValid()) return true; if (baseDci.isAssumeValid()) return false; } } if (walker.getRawMode(i) != m || !walker.idEqual(i, baseTree)) return true; } return false; }
Source:
public void chain8() { final List<Comparable> result = $.chain($.chain($.class.getDeclaredMethods()) .reduce(new FunctionAccum<List<String>, Method>() { public List<String> apply(final List<String> accum, final Method method) { accum.add(method.getName()); return accum; } }, new ArrayList<String>()).item()) .reject(new Predicate<String>() { public Boolean apply(final String name) { return name.contains("$"); } }) .uniq(new Function1<String, Character>() { public Character apply(final String name) { return name.charAt(0); } }) .sort() .first(4) .value(); assertEquals(4, result.size()); }

Target:
public void chain8() { final List<Comparable> result = $.chain($.class.getDeclaredMethods()) .map(new Function1<Method, String>() { public String apply(final Method method) { return method.getName(); } }) .reject(new Predicate<String>() { public Boolean apply(final String name) { return name.contains("$"); } }) .uniq(new Function1<String, Character>() { public Character apply(final String name) { return name.charAt(0); } }) .sort() .first(4) .value(); assertEquals(4, result.size()); }
Source:
private void readMetaDataText(Reader metadataTextInput) throws IOException, RecognitionException, ParseException { CommonTree tree = createAST(metadataTextInput); fTreeParser = new IOStructGen(tree, fTrace); fTreeParser.generate(); ByteOrder localDetectedByteOrder = getDetectedByteOrder(); if (fDetectedByteOrder != null && fTrace.getByteOrder() != localDetectedByteOrder) { throw new ParseException("Metadata byte order and trace byte order inconsistent."); } }

Target:
private void readMetaDataText(Reader metadataTextInput) throws IOException, RecognitionException, ParseException { CommonTree tree = createAST(metadataTextInput); fTreeParser = new IOStructGen(tree, fTrace); fTreeParser.generate(); ByteOrder detectedByteOrder = getDetectedByteOrder(); if (detectedByteOrder != null && fTrace.getByteOrder() != detectedByteOrder) { throw new ParseException("Metadata byte order and trace byte order inconsistent."); } }
Source:
public static void validateEfoConfiguration(Properties config, List<String> streams) { String efoRegistrationType; if (config.containsKey(ConsumerConfigConstants.EFO_REGISTRATION_TYPE)) { efoRegistrationType = config.getProperty(ConsumerConfigConstants.EFO_REGISTRATION_TYPE); try { EFORegistrationType.valueOf(efoRegistrationType); } catch (IllegalArgumentException e) { String errorMessage = Arrays.stream(EFORegistrationType.values()) .map(Enum::name).collect(Collectors.joining(", ")); throw new IllegalArgumentException("Invalid efo registration type in stream set in config. Valid values are: " + errorMessage); } } else { efoRegistrationType = EFORegistrationType.LAZY.toString(); } if (EFORegistrationType.valueOf(efoRegistrationType) == EFORegistrationType.NONE) { List<String> missingConsumerArnKeys = new ArrayList<>(); for (String stream : streams) { String efoConsumerARNKey = ConsumerConfigConstants.EFO_CONSUMER_ARN_PREFIX + "." + stream; if (!config.containsKey(efoConsumerARNKey)) { missingConsumerArnKeys.add(efoConsumerARNKey); } } if (!missingConsumerArnKeys.isEmpty()) { String errorMessage = Arrays .stream(missingConsumerArnKeys.toArray()) .map(Object::toString) .collect(Collectors.joining(", ")); throw new IllegalArgumentException("Invalid efo consumer arn settings for not providing consumer arns: " + errorMessage); } } else { if (!config.containsKey(ConsumerConfigConstants.EFO_CONSUMER_NAME)) { throw new IllegalArgumentException("No valid enhanced fan-out consumer name is set through " + ConsumerConfigConstants.EFO_CONSUMER_NAME); } } }

Target:
public static void validateEfoConfiguration(Properties config, List<String> streams) { EFORegistrationType efoRegistrationType; if (config.containsKey(ConsumerConfigConstants.EFO_REGISTRATION_TYPE)) { String typeInString = config.getProperty(ConsumerConfigConstants.EFO_REGISTRATION_TYPE); try { efoRegistrationType = EFORegistrationType.valueOf(typeInString); } catch (IllegalArgumentException e) { String errorMessage = Arrays.stream(EFORegistrationType.values()) .map(Enum::name).collect(Collectors.joining(", ")); throw new IllegalArgumentException("Invalid efo registration type in stream set in config. Valid values are: " + errorMessage); } } else { efoRegistrationType = EFORegistrationType.LAZY; } if (efoRegistrationType == EFORegistrationType.NONE) { List<String> missingConsumerArnKeys = new ArrayList<>(); for (String stream : streams) { String efoConsumerARNKey = ConsumerConfigConstants.EFO_CONSUMER_ARN_PREFIX + "." + stream; if (!config.containsKey(efoConsumerARNKey)) { missingConsumerArnKeys.add(efoConsumerARNKey); } } if (!missingConsumerArnKeys.isEmpty()) { String errorMessage = Arrays .stream(missingConsumerArnKeys.toArray()) .map(Object::toString) .collect(Collectors.joining(", ")); throw new IllegalArgumentException("Invalid efo consumer arn settings for not providing consumer arns: " + errorMessage); } } else { if (!config.containsKey(ConsumerConfigConstants.EFO_CONSUMER_NAME)) { throw new IllegalArgumentException("No valid enhanced fan-out consumer name is set through " + ConsumerConfigConstants.EFO_CONSUMER_NAME); } } }
Source:
public Promise<Map<JSITImport, JSITDefinitions>> getImportDefinitionsAsync(final Metadata metadata, final List<JSITImport> imports) { if (!imports.isEmpty()) { return loadDMNDefinitions().then(otherDefinitions -> { final Map<JSITImport, JSITDefinitions> importDefinitions = new HashMap<>(); for (final Map.Entry<String, JSITDefinitions> entry : otherDefinitions.entrySet()) { final JSITDefinitions def = Js.uncheckedCast(entry.getValue()); findImportByDefinitions(def, imports).ifPresent(anImport -> { final JSITImport foundImported = Js.uncheckedCast(anImport); importDefinitions.put(foundImported, def); }); } return promises.resolve(importDefinitions); }); } return promises.resolve(new HashMap<>()); }

Target:
public Promise<Map<JSITImport, JSITDefinitions>> getImportDefinitionsAsync(final Metadata metadata, final List<JSITImport> imports) { if (!imports.isEmpty()) { return loadDMNDefinitions().then(otherDefinitions -> { final Map<JSITImport, JSITDefinitions> importDefinitions = new HashMap<>(); for (final Map.Entry<String, JSITDefinitions> entry : otherDefinitions.entrySet()) { final JSITDefinitions def = Js.uncheckedCast(entry.getValue()); findImportByDefinitions(def, imports).ifPresent(anImport -> { final JSITImport foundImported = Js.uncheckedCast(anImport); importDefinitions.put(foundImported, def); }); } return promises.resolve(importDefinitions); }); } return promises.resolve(Collections.emptyMap()); }
Source:
public String toString() { Request.Builder reqBuilder = Request.newBuilder().setHeader(request.getHeader()); reqBuilder.setAddRequest( AddRequest.newBuilder().mergeFrom(request.getAddRequest()).clearBody().clearMasterKey().buildPartial()); return reqBuilder.buildPartial().toString(); }

Target:
public String toString() { return RequestUtils.toSafeString(request); }
Source:
public void decorate(JLabel label) { label.setText("" + "<html>" + "URL: <a style='text-decoration: none' href=\"" + server.getBaseUrl().toString() + "\">" + getDescription() + "</a><br/>" + "Project ID: " + server.getProjectId() + "" + "</html>"); makeClickable(label, () -> uncheckedBrowse(server.getBaseUrl())); }

Target:
public void decorate(JLabel label) { label.setText("" + "<html>" + "URL: <a style=\"text-decoration: none\" href=\"" + server.getBaseUrl().toString() + "\">" + getDescription() + "</a><br/>" + "Project ID: " + server.getProjectId() + "" + "</html>"); makeClickable(label, () -> uncheckedBrowse(server.getBaseUrl())); }
Source:
public FluoQuery createPcj( final String pcjId, final String sparql, final Set<ExportStrategy> strategies, final FluoClient fluo) throws MalformedQueryException, UnsupportedQueryException { requireNonNull(pcjId); requireNonNull(sparql); requireNonNull(fluo); FluoQuery fluoQuery = makeFluoQuery(sparql, pcjId, strategies); writeFluoQuery(fluo, fluoQuery, pcjId); return fluoQuery; }

Target:
public FluoQuery createPcj( final String pcjId, final String sparql, final Set<ExportStrategy> strategies, final FluoClient fluo) throws MalformedQueryException, UnsupportedQueryException { requireNonNull(pcjId); requireNonNull(sparql); requireNonNull(strategies); requireNonNull(fluo); FluoQuery fluoQuery = makeFluoQuery(sparql, pcjId, strategies); writeFluoQuery(fluo, fluoQuery, pcjId); return fluoQuery; }
Source:
public int hashCode() { return Objects.hash( fieldNames, staticFields, this.keyBufferStaticPrefixLength, this.keyBufferStaticPrefixLength); }

Target:
public int hashCode() { return Objects.hash( delimiter, fieldNames, staticFields, keyBufferStaticPrefixLength, fieldNamesStaticPrefixLength); }
Source:
public void initializeDataSource() { ITmfTrace trace = getTrace(); if (trace == null) { return; } if (fRoots.get(trace) != null) { return; } TmfTreeViewerEntry root = new TmfTreeViewerEntry(StringUtils.EMPTY); Iterable<@NonNull CounterAnalysis> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CounterAnalysis.class); for (CounterAnalysis module : modules) { ITmfTrace moduleTrace = module.getTrace(); if (moduleTrace == null) { return; } TmfTreeViewerEntry rootBranch = new TmfTreeViewerEntry(moduleTrace.getName()); root.getChildren().add(rootBranch); module.schedule(); module.waitForCompletion(); ITmfStateSystem stateSystem = module.getStateSystem(); if (stateSystem != null) { addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.GROUPED_COUNTER_ASPECTS_ATTRIB); addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.UNGROUPED_COUNTER_ASPECTS_ATTRIB); fRoots.put(trace, root); } } }

Target:
public void initializeDataSource() { ITmfTrace trace = getTrace(); if (trace == null) { return; } if (fRoots.containsKey(trace)) { return; } TmfTreeViewerEntry root = new TmfTreeViewerEntry(StringUtils.EMPTY); Iterable<@NonNull CounterAnalysis> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CounterAnalysis.class); for (CounterAnalysis module : modules) { ITmfTrace moduleTrace = module.getTrace(); if (moduleTrace == null) { return; } TmfTreeViewerEntry rootBranch = new TmfTreeViewerEntry(moduleTrace.getName()); root.getChildren().add(rootBranch); module.schedule(); module.waitForCompletion(); ITmfStateSystem stateSystem = module.getStateSystem(); if (stateSystem != null) { addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.GROUPED_COUNTER_ASPECTS_ATTRIB); addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.UNGROUPED_COUNTER_ASPECTS_ATTRIB); fRoots.put(trace, root); } } }
Source:
public final void fetchCommits() throws Exception { final Request request = new ApacheRequest( RtRepoCommitsITCase.REQUEST_URL); final Coordinates coordinates = new Coordinates.Simple(RtRepoCommitsITCase.USER, RtRepoCommitsITCase.REPO); final RepoCommits repoCommits = new RtRepoCommits(request, RtRepoCommitsITCase.github().repos().get(coordinates)); final Iterator<Commit> iterator = repoCommits.iterate().iterator(); final List<String> shas = new ArrayList<String>(); shas.add("1aa4af45aa2c56421c3d911a0a06da513a7316a0"); shas.add("940dd5081fada0ead07762933036bf68a005cc40"); shas.add("05940dbeaa6124e4a87d9829fb2fce80b713dcbe"); shas.add(RtRepoCommitsITCase.SHA); shas.add("11bd4d527236f9cb211bc6667df06fde075beded"); int existsCount = 0; while (iterator.hasNext()) { if (shas.contains(iterator.next().sha())) { existsCount += 1; } } MatcherAssert.assertThat( existsCount, Matchers.equalTo(shas.size()) ); }

Target:
public final void fetchCommits() throws Exception { final Iterator<Commit> iterator = repo().commits().iterate().iterator(); final List<String> shas = new ArrayList<String>(); shas.add("1aa4af45aa2c56421c3d911a0a06da513a7316a0"); shas.add("940dd5081fada0ead07762933036bf68a005cc40"); shas.add("05940dbeaa6124e4a87d9829fb2fce80b713dcbe"); shas.add("51cabb8e759852a6a40a7a2a76ef0afd4beef96d"); shas.add("11bd4d527236f9cb211bc6667df06fde075beded"); int found = 0; while (iterator.hasNext()) { if (shas.contains(iterator.next().sha())) { found += 1; } } MatcherAssert.assertThat( found, Matchers.equalTo(shas.size()) ); }
Source:
public static void assertEqualsDeep(Set<?> actual, Set<?> expected, String message) { if (actual == expected) { return; } if (actual == null || expected == null) { if (message == null) { fail("Sets not equal: expected: " + expected + " and actual: " + actual); } else { failNotEquals(actual, expected, message); } } if(expected.size()>actual.size()){ if (message == null) { fail("Sets not equal: expected: " + expected + " and actual: " + actual); } else { fail(format(actual,expected,message,true)); } } Iterator<?> actualIterator = actual.iterator(); Iterator<?> expectedIterator = expected.iterator(); while (expectedIterator.hasNext()) { Object expectedValue = expectedIterator.next(); Object value = actualIterator.next(); if (expectedValue.getClass().isArray()) { assertArrayEquals(value, expectedValue, message); } else { assertEqualsImpl(value, expectedValue, message); } } }

Target:
public static void assertEqualsDeep(Set<?> actual, Set<?> expected, String message) { if (actual == expected) { return; } if (actual == null || expected == null) { if (message == null) { fail("Sets not equal: expected: " + expected + " and actual: " + actual); } else { failNotEquals(actual, expected, message); } } if (expected.size() != actual.size()) { if (message == null) { fail("Sets not equal: expected: " + expected + " and actual: " + actual); } else { fail(format(actual, expected, message, true)); } } Iterator<?> actualIterator = actual.iterator(); Iterator<?> expectedIterator = expected.iterator(); while (expectedIterator.hasNext()) { Object expectedValue = expectedIterator.next(); Object value = actualIterator.next(); if (expectedValue.getClass().isArray()) { assertArrayEquals(value, expectedValue, message); } else { assertEqualsImpl(value, expectedValue, message); } } }
Source:
private void initSearchView(final Context context){ isExpanded = false; LinearLayout searchPlate = (LinearLayout)findViewById(R.id.search_plate); searchPlate.setBackgroundColor(Color.TRANSPARENT); final ImageView searchCloseButton = (ImageView) searchPlate.findViewById(R.id.search_close_btn); searchCloseButton.setImageResource(R.drawable.ic_clear_gray_24dp); EditText editText = ((EditText)findViewById(R.id.search_src_text)); editText.setTextColor(Color.BLACK); setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_SEARCH| EditorInfo.IME_FLAG_NO_FULLSCREEN); setQueryHint(context.getString(R.string.box_browsesdk_search_hint)); this.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { mOnBoxSearchListener.onQueryTextSubmit(query); return true; } @Override public boolean onQueryTextChange(String newText) { mOnBoxSearchListener.onQueryTextChange(newText); return true; } }); this.setOnSearchClickListener(new OnClickListener() { @Override public void onClick(View v) { isExpanded = true; mOnBoxSearchListener.onSearchExpanded(); } }); this.setOnCloseListener(new OnCloseListener() { @Override public boolean onClose() { isExpanded = false; mOnBoxSearchListener.onSearchCollapsed(); return false; } }); }

Target:
private void initSearchView(final Context context){ isExpanded = false; LinearLayout searchPlate = (LinearLayout)findViewById(R.id.search_plate); searchPlate.setBackgroundColor(Color.TRANSPARENT); final ImageView searchCloseButton = (ImageView) searchPlate.findViewById(R.id.search_close_btn); searchCloseButton.setImageResource(R.drawable.ic_clear_gray_24dp); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { EditText editText = ((EditText) findViewById(R.id.search_src_text)); editText.setTextColor(Color.BLACK); } setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_SEARCH| EditorInfo.IME_FLAG_NO_FULLSCREEN); setQueryHint(context.getString(R.string.box_browsesdk_search_hint)); this.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { mOnBoxSearchListener.onQueryTextSubmit(query); return true; } @Override public boolean onQueryTextChange(String newText) { mOnBoxSearchListener.onQueryTextChange(newText); return true; } }); this.setOnSearchClickListener(new OnClickListener() { @Override public void onClick(View v) { isExpanded = true; mOnBoxSearchListener.onSearchExpanded(); } }); this.setOnCloseListener(new OnCloseListener() { @Override public boolean onClose() { isExpanded = false; mOnBoxSearchListener.onSearchCollapsed(); return false; } }); }
Source:
private String redirectToList() { try { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap() .get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("usergroupEdit.jsf")) { return "/pages/users.jsf?id=1&" + redirectParameter; } else { return "/pages/BenutzergruppenAlle?" + redirectParameter; } } catch (NullPointerException e) { return "/pages/BenutzergruppenAlle?" + redirectParameter; } }

Target:
private String redirectToList() { try { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap() .get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("usergroupEdit.jsf")) { return "/pages/users.jsf?id=" + userForm.getActiveTabIndex() + "&" + REDIRECT_PARAMETER; } else { return "/pages/BenutzergruppenAlle?" + REDIRECT_PARAMETER; } } catch (NullPointerException e) { return "/pages/BenutzergruppenAlle?" + REDIRECT_PARAMETER; } }
Source:
private String getStackTraceAsString(Throwable cause) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); cause.printStackTrace(new PrintStream(byteArrayOutputStream)); String exceptionAsString = byteArrayOutputStream.toString(); return exceptionAsString; }

Target:
private String getStackTraceAsString(Throwable cause) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter, true); cause.printStackTrace(printWriter); return stringWriter.getBuffer().toString(); }
Source:
private void changeLocalPlaylistName(long id, String name) { if (localPlaylistManager == null) { return; } Log.d(TAG, "Updating playlist id=[" + id + "] with new name=[" + name + "] items"); localPlaylistManager.renamePlaylist(id, name); final Disposable disposable = localPlaylistManager.renamePlaylist(id, name) .observeOn(AndroidSchedulers.mainThread()) .subscribe(longs -> { }, this::onError); disposables.add(disposable); }

Target:
private void changeLocalPlaylistName(long id, String name) { if (localPlaylistManager == null) { return; } if (DEBUG) { Log.d(TAG, "Updating playlist id=[" + id + "] with new name=[" + name + "] items"); } localPlaylistManager.renamePlaylist(id, name); final Disposable disposable = localPlaylistManager.renamePlaylist(id, name) .observeOn(AndroidSchedulers.mainThread()) .subscribe(longs -> { }, this::onError); disposables.add(disposable); }
Source:
private void checkClusterAdditionalFeaturesSupported(VDSGroup cluster, VDS vds) { ClusterFeatureDao clusterFeatureDao = getClusterFeatureDao(); VdsDynamicDAO vdsDynamicDao = getVdsDynamicDao(); Set<SupportedAdditionalClusterFeature> featuresSupportedByCluster = clusterFeatureDao.getSupportedFeaturesByClusterId(cluster.getId()); Set<String> featuresSupportedByVds = vdsDynamicDao.getSupportedHostFeaturesByVdsId(vds.getId()); for (SupportedAdditionalClusterFeature feature : featuresSupportedByCluster) { if (feature.isEnabled() && !featuresSupportedByVds.contains(feature.getFeature().getName())) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("FeaturesSupportedByHost", feature.getFeature().getName()); reportNonOperationReason(NonOperationalReason.VDS_FEATURES_INCOMPATIBILE_WITH_CLUSTER, customLogValues); return; } } return; }

Target:
private void checkClusterAdditionalFeaturesSupported(VDSGroup cluster, VDS vds) { Set<SupportedAdditionalClusterFeature> clusterSupportedFeatures = clusterFeatureDao.getSupportedFeaturesByClusterId(cluster.getId()); Set<String> hostSupportedFeatures = hostFeatureDao.getSupportedHostFeaturesByHostId(vds.getId()); for (SupportedAdditionalClusterFeature feature : clusterSupportedFeatures) { if (feature.isEnabled() && !hostSupportedFeatures.contains(feature.getFeature().getName())) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("FeaturesSupportedByHost", feature.getFeature().getName()); reportNonOperationReason(NonOperationalReason.VDS_FEATURES_INCOMPATIBILE_WITH_CLUSTER, customLogValues); return; } } return; }
Source:
private void reloadConfig() { try { FileReader fr = new FileReader(configFile); Map<String, Object> newYamlConfig = (Map<String, Object>)new Yaml().load(fr); config = loadConfig(newYamlConfig); } catch (Exception e) { LOGGER.severe("Configuration reload failed: " + e.toString()); return; } }

Target:
private void reloadConfig() { try { FileReader fr = new FileReader(configFile); try { Map<String, Object> newYamlConfig = (Map<String, Object>)new Yaml().load(fr); config = loadConfig(newYamlConfig); config.lastUpdate = configFile.lastModified(); configReloadSuccess.inc(); } catch (Exception e) { LOGGER.severe("Configuration reload failed: " + e.toString()); configReloadFailure.inc(); } finally { fr.close(); } } catch (IOException e) { LOGGER.severe("Configuration reload failed: " + e.toString()); configReloadFailure.inc(); } }
Source:
private void maybeDelete(DocumentReference documentReference) { Boolean skipRecycleBin = this.getRequest().getProperty(SKIP_RECYCLE_BIN_PROPERTY); boolean toRecycleBin = !this.configuration.canSkipRecycleBin() || !this.documentAccessBridge.isAdvancedUser() || !ObjectUtils.defaultIfNull(skipRecycleBin, false); EntitySelection entitySelection = this.concernedEntities.get(documentReference); if (entitySelection != null && !entitySelection.isSelected()) { this.logger.info("Skipping because it has been unselected.", documentReference); } else if (!this.modelBridge.exists(documentReference)) { this.logger.warn("Skipping because it doesn't exist.", documentReference); } else if (!hasAccess(Right.DELETE, documentReference)) { this.logger.error("You are not allowed to delete [{}].", documentReference); } else if (toRecycleBin) { this.modelBridge.delete(documentReference); this.logger.debug("[{}] has been successfully moved to the recycle bin.", documentReference); } else { this.modelBridge.delete(documentReference, false); this.logger.debug("[{}] has been successfully removed.", documentReference); } }

Target:
private void maybeDelete(DocumentReference documentReference) { Boolean skipRecycleBinProperty = this.getRequest().getProperty(SKIP_RECYCLE_BIN_PROPERTY); boolean skipRecycleBin = this.configuration.canSkipRecycleBin() && this.documentAccessBridge.isAdvancedUser() && ObjectUtils.defaultIfNull(skipRecycleBinProperty, false); EntitySelection entitySelection = this.concernedEntities.get(documentReference); if (entitySelection != null && !entitySelection.isSelected()) { this.logger.info("Skipping because it has been unselected.", documentReference); } else if (!this.modelBridge.exists(documentReference)) { this.logger.warn("Skipping because it doesn't exist.", documentReference); } else if (!hasAccess(Right.DELETE, documentReference)) { this.logger.error("You are not allowed to delete [{}].", documentReference); } else if (!skipRecycleBin) { this.modelBridge.delete(documentReference); this.logger.debug("[{}] has been successfully moved to the recycle bin.", documentReference); } else { this.modelBridge.delete(documentReference, true); this.logger.debug("[{}] has been successfully removed.", documentReference); } }