auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void test_SSLSocket_ClientGetsAlertDuringHandshake_HasGoodExceptionMessage() throws Exception { TestSSLContext context = TestSSLContext.create(); final ServerSocket listener = ServerSocketFactory.getDefault().createServerSocket(0); final SSLSocket client = (SSLSocket) context.clientContext.getSocketFactory().createSocket( context.host, listener.getLocalPort()); final Socket server = listener.accept(); ExecutorService executor = Executors.newFixedThreadPool(2); Future<Void> c = executor.submit(new Callable<Void>() { public Void call() throws Exception { try { client.startHandshake(); fail("Should receive handshake exception"); } catch (SSLHandshakeException expected) { assertFalse(expected.getMessage().contains("SSL_ERROR_ZERO_RETURN")); assertFalse(expected.getMessage().contains("You should never see this.")); } return null; } }); Future<Void> s = executor.submit(new Callable<Void>() { public Void call() throws Exception { byte[] scratch = new byte[8192]; server.getInputStream().read(scratch); server.getOutputStream().write(new byte[] { 0x15, 0x03, 0x03, 0x00, 0x02, 0x01, 0x46 }); server.getOutputStream().write(new byte[] { 0x15, 0x03, 0x03, 0x00, 0x02, 0x01, 0x00 }); return null; } }); executor.shutdown(); c.get(5, TimeUnit.SECONDS); s.get(5, TimeUnit.SECONDS); client.close(); server.close(); listener.close(); context.close(); }

Target:
public void test_SSLSocket_ClientGetsAlertDuringHandshake_HasGoodExceptionMessage() throws Exception { TestSSLContext context = TestSSLContext.create(); final ServerSocket listener = ServerSocketFactory.getDefault().createServerSocket(0); final SSLSocket client = (SSLSocket) context.clientContext.getSocketFactory().createSocket( context.host, listener.getLocalPort()); final Socket server = listener.accept(); ExecutorService executor = Executors.newFixedThreadPool(2); Future<Void> c = executor.submit(new Callable<Void>() { public Void call() throws Exception { try { client.startHandshake(); fail("Should receive handshake exception"); } catch (SSLHandshakeException expected) { assertFalse(expected.getMessage().contains("SSL_ERROR_ZERO_RETURN")); assertFalse(expected.getMessage().contains("You should never see this.")); } return null; } }); Future<Void> s = executor.submit(new Callable<Void>() { public Void call() throws Exception { byte[] scratch = new byte[8192]; server.getInputStream().read(scratch); server.getOutputStream().write(new byte[] { 0x15, 0x03, 0x03, 0x00, 0x02, 0x01, 0x46 }); server.getOutputStream().write(new byte[] { 0x15, 0x03, 0x03, 0x00, 0x02, 0x01, 0x00 }); return null; } }); executor.shutdown(); try { c.get(5, TimeUnit.SECONDS); s.get(5, TimeUnit.SECONDS); } finally { client.close(); server.close(); listener.close(); context.close(); } }
Source:
static Long extractHighestModSeq(ImapResponse imapResponse) { for (Object token : imapResponse) { if (token instanceof ImapList) { ImapList list = (ImapList) token; if (list.size() < 2 || !(equalsIgnoreCase(list.get(0), Responses.HIGHESTMODSEQ) || equalsIgnoreCase(list.get(1), Responses.NOMODSEQ)) || !list.isString(1)) { continue; } if (equalsIgnoreCase(list.get(0), Responses.HIGHESTMODSEQ)) { return Long.parseLong(list.getString(1)); } } } return null; }

Target:
static Long extractHighestModSeq(ImapResponse imapResponse) { for (Object token : imapResponse) { if (token instanceof ImapList) { ImapList list = (ImapList) token; if (list.size() < 2 || !(ImapResponseParser.equalsIgnoreCase(list.get(0), Responses.HIGHESTMODSEQ) || ImapResponseParser.equalsIgnoreCase(list.get(0), Responses.NOMODSEQ)) || !list.isString(1)) { continue; } if (ImapResponseParser.equalsIgnoreCase(list.get(0), Responses.HIGHESTMODSEQ)) { return Long.parseLong(list.getString(1)); } } } return null; }
Source:
public MailMessage(MailMessage other) { Objects.requireNonNull(other); this.bounceAddress = other.bounceAddress; this.from = other.from; this.to = other.to; this.cc = other.cc; this.bcc = other.bcc; this.subject = other.subject; this.text = other.text; this.html = other.html; if (other.attachment != null) { List<MailAttachment> newList = new ArrayList<MailAttachment>(); for (MailAttachment a : other.attachment) { newList.add(new MailAttachment(a)); } this.attachment = newList; } }

Target:
public MailMessage(MailMessage other) { Objects.requireNonNull(other); this.bounceAddress = other.bounceAddress; this.from = other.from; this.to = copyList(other.to); this.cc = copyList(other.cc); this.bcc = copyList(other.bcc); this.subject = other.subject; this.text = other.text; this.html = other.html; if (other.attachment != null) { List<MailAttachment> newList = new ArrayList<MailAttachment>(other.attachment.size()); for (MailAttachment a : other.attachment) { newList.add(new MailAttachment(a)); } this.attachment = newList; } }
Source:
static void runSQL(String sql, Connection cx) throws SQLException { Statement st = cx.createStatement(); try { st.execute(sql); } catch (SQLException e) { LOGGER.log(Level.WARNING, e.getMessage(), e); } finally { close(st); } }

Target:
static void runSQL(String sql, Connection cx) throws SQLException { Statement st = cx.createStatement(); try { st.execute(sql); } finally { close(st); } }
Source:
public void stopServer() { if (server == null) throw new IllegalStateException("Jetty has to be initialized before stopping it"); if (server.isStopped() || server.isStopping()) throw new IllegalStateException("Jetty is not running stopped"); try { server.stop(); } catch (Exception e) { log.severe(e.getMessage()); throw new KumuluzServerException(e.getMessage(), e.getCause()); } }

Target:
public void stopServer() { if (server == null) throw new IllegalStateException("Jetty has to be initialized before stopping it"); if (server.isStopped() || server.isStopping()) throw new IllegalStateException("Jetty is already stopped"); try { server.stop(); } catch (Exception e) { log.severe(e.getMessage()); throw new KumuluzServerException(e.getMessage(), e.getCause()); } }
Source:
protected void addVirtualEvents(FormattedEventBase[] indexedEvents, int initialIndex) { for (int index = initialIndex; index < mMinItems; ++index) { if (indexedEvents[index] == null) { indexedEvents[index] = mVirtualEvent; } } }

Target:
protected void addVirtualEvents(FormattedEventBase[] indexedEvents, int initialIndex) { for (int index = initialIndex; index < mMinItems; index++) { if (indexedEvents[index] == null) { indexedEvents[index] = mVirtualEvent; } } }
Source:
private static Map<String, Collection<String>> caseInsensitiveCopyOf(Map<String, Collection<String>> headers) { Map<String, Collection<String>> result = new TreeMap<String, Collection<String>>(String.CASE_INSENSITIVE_ORDER); for (Map.Entry<String, Collection<String>> entry : headers.entrySet()) { String headerName = entry.getKey(); Collection<String> values = result.get(headerName); if (values == null) { values = new LinkedList<String>(); result.put(headerName.toLowerCase(Locale.US), values); } values.addAll(entry.getValue()); } return result; }

Target:
private static Map<String, Collection<String>> caseInsensitiveCopyOf(Map<String, Collection<String>> headers) { Map<String, Collection<String>> result = new TreeMap<String, Collection<String>>(String.CASE_INSENSITIVE_ORDER); for (Map.Entry<String, Collection<String>> entry : headers.entrySet()) { String headerName = entry.getKey(); if (!result.containsKey(headerName)) { result.put(headerName.toLowerCase(Locale.ROOT), new LinkedList<String>()); } result.get(headerName).addAll(entry.getValue()); } return result; }
Source:
public void setCompletionInfo(String deviceId, String folderId, CompletionInfo completionInfo) { if (!deviceFolderMap.containsKey(deviceId)) { deviceFolderMap.put(deviceId, defaultDevice); } deviceFolderMap.get(deviceId).put(folderId, completionInfo); }

Target:
public void setCompletionInfo(String deviceId, String folderId, CompletionInfo completionInfo) { if (!deviceFolderMap.containsKey(deviceId)) { deviceFolderMap.put(deviceId, new HashMap<String, CompletionInfo>()); } deviceFolderMap.get(deviceId).put(folderId, completionInfo); }
Source:
private static CharPredicate getHostMatcherForPattern(GrokParserStageSequenceBuilder.GrokPattern pattern) { final List<Character> hostNameCharacters = ImmutableList.of('-', '.', '_'); final CharPredicate hostNameMatcher = c -> Character.isDigit(c) || Character.isLetter(c) || hostNameCharacters.contains(c); final CharPredicate ipV4AddressMatcher = c -> Character.isDigit(c) || c == '.'; final CharPredicate ipV6AddressMatcher = c -> Character.digit(c, 16) >= 0 || c == ':'; final CharPredicate ipV4OrV6AddressMatcher = ipV4AddressMatcher.or(ipV6AddressMatcher); final CharPredicate hostnameOrIPMatcher = hostNameMatcher.or(ipV4OrV6AddressMatcher); switch (pattern) { case HOSTNAME: return hostNameMatcher; case HOSTNAMEORIP: return hostnameOrIPMatcher; case IPADDRESS: return ipV4OrV6AddressMatcher; default: throw new IllegalArgumentException("Unsupported pattern."); } }

Target:
private static CharPredicate getHostMatcherForPattern(GrokParserStageSequenceBuilder.GrokPattern pattern) { final List<Character> hostNameCharacters = ImmutableList.of('-', '.', '_'); final CharPredicate hostNameMatcher = c -> Character.isDigit(c) || Character.isLetter(c) || hostNameCharacters.contains(c); final CharPredicate ipV4AddressMatcher = c -> Character.isDigit(c) || c == '.'; final CharPredicate ipV6AddressMatcher = c -> Character.digit(c, 16) >= 0 || c == ':'; final CharPredicate ipV4OrV6AddressMatcher = ipV4AddressMatcher.or(ipV6AddressMatcher); final CharPredicate hostnameOrIPMatcher = hostNameMatcher.or(ipV4OrV6AddressMatcher); switch (pattern) { case HOSTNAME: return hostNameMatcher; case HOSTNAMEORIP: return hostnameOrIPMatcher; case IPADDRESS: return ipV4OrV6AddressMatcher; default: throw new IllegalArgumentException("Unsupported host pattern '" + pattern + "'"); } }
Source:
public String marshal( final RuleModel model ) { return marshalRule( model, null ); }

Target:
public String marshal(final RuleModel model) { return marshalRule(model, Collections.emptyList()); }
Source:
private void setupRuleModeller() { view.setupRuleModellerWidget(ruleModeller()); if (plugin() instanceof BRLActionColumnPlugin) { view.setRuleModelerDescription(translate(GuidedDecisionTableErraiConstants.RuleModellerPage_InsertAnActionBRLFragment)); } else { view.setRuleModelerDescription(translate(GuidedDecisionTableErraiConstants.RuleModellerPage_InsertAConditionBRLFragment)); } }

Target:
private void setupRuleModeller() { view.setupRuleModellerWidget(ruleModeller()); view.setRuleModelerDescription(plugin().getRuleModellerDescription()); }
Source:
public boolean canPublicAndRetrictPage(Page currentPage, String currentUser) throws WikiException { boolean canPublicAndRetrictPage = false; if (currentPage.getPermissions() != null) { for (PermissionEntry permissionEntry : currentPage.getPermissions()) { if(permissionEntry.getId().equals(currentUser)) { for(Permission permission : permissionEntry.getPermissions()) { if(permission.getPermissionType().equals(PermissionType.EDITPAGE) && permission.isAllowed()) { canPublicAndRetrictPage = true; break; } } } if(canPublicAndRetrictPage) { break; } } } Wiki wiki = getWikiByTypeAndOwner(currentPage.getWikiType(), currentPage.getWikiOwner()); return hasAdminPagePermission(wiki.getType(), wiki.getOwner()) || hasAdminSpacePermission(wiki.getType(), wiki.getOwner()) || canPublicAndRetrictPage; }

Target:
public boolean canPublicAndRetrictPage(Page currentPage, String currentUser) throws WikiException { if (currentPage.getPermissions() != null) { for (PermissionEntry permissionEntry : currentPage.getPermissions()) { if(permissionEntry.getId().equals(currentUser)) { for(Permission permission : permissionEntry.getPermissions()) { if(permission.getPermissionType().equals(PermissionType.EDITPAGE) && permission.isAllowed()) { return true; } } } } } Wiki wiki = getWikiByTypeAndOwner(currentPage.getWikiType(), currentPage.getWikiOwner()); return hasAdminPagePermission(wiki.getType(), wiki.getOwner()) || hasAdminSpacePermission(wiki.getType(), wiki.getOwner()); }
Source:
public void testToString() { SmsMessage.Builder builder = new SmsMessage.Builder(); SmsMessage smsMessage = builder.newDataObject(); assertNotNull(smsMessage.toString()); }

Target:
public void testToString() { SmsMessage.Builder builder = new SmsMessage.Builder(); SmsMessage smsMessage = builder.newDataObject(); assertNotNull(smsMessage.toString()); assertEquals(emptyString, smsMessage.toString()); }
Source:
public Dialect getDialect() { Dialect dialect = myDialect; if (dialect == null) { String dialectClass = (String) myEntityManagerFactory.getJpaPropertyMap().get("hibernate.dialect"); dialect = ReflectionUtil.newInstanceOrReturnNull(dialectClass, Dialect.class); Validate.notNull(dialect, "Unable to create class: %s", dialectClass); myDialect = dialect; } return dialect; }

Target:
public Dialect getDialect() { Dialect dialect = myDialect; if (dialect == null) { String dialectClass = (String) myEntityManagerFactory.getJpaPropertyMap().get("hibernate.dialect"); dialect = ReflectionUtil.newInstanceOrReturnNull(dialectClass, Dialect.class); Validate.notNull(dialect, "Unable to create instance of class: %s", dialectClass); myDialect = dialect; } return dialect; }
Source:
void shouldNotFailOnDeleteByIdWithNullVersion(@Autowired VersionedThingWithAssignedIdRepository repository) { try (Session session = driver.session()) { session.writeTransaction(tx -> { tx.run("CREATE (v:VersionedThingWithAssignedId {id:1})").consume(); return null; }); } StepVerifier.create(repository.deleteById(1L)) .verifyComplete(); try (Session session = driver.session()) { long count = session.readTransaction(tx -> tx.run("MATCH (v:VersionedThingWithAssignedId) return count(v) as vCount").next() .get("vCount").asLong()); assertThat(count).isEqualTo(0); } }

Target:
void shouldNotFailOnDeleteByIdWithNullVersion(@Autowired VersionedThingWithAssignedIdRepository repository) { try (Session session = driver.session()) { session.writeTransaction(tx -> tx.run("CREATE (v:VersionedThingWithAssignedId {id:1})").consume()); } StepVerifier.create(repository.deleteById(1L)) .verifyComplete(); try (Session session = driver.session()) { long count = session.readTransaction(tx -> tx.run("MATCH (v:VersionedThingWithAssignedId) return count(v) as vCount").next() .get("vCount").asLong()); assertThat(count).isEqualTo(0); } }
Source:
public void commitCreateTable(JdbcOutputTableHandle handle) { StringBuilder sql = new StringBuilder() .append("sp_rename ") .append("'" + quoted(handle.getCatalogName(), handle.getSchemaName(), handle.getTemporaryTableName()) + "'") .append(", ") .append("'" + handle.getTableName() + "'"); try (Connection connection = this.getConnection(handle)) { this.execute(connection, sql.toString()); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }

Target:
public void commitCreateTable(JdbcOutputTableHandle handle) { try (Connection connection = getConnection(handle); PreparedStatement statement = connection.prepareStatement("EXEC sp_rename ?, ?")) { statement.setString(1, quoted(handle.getCatalogName(), handle.getSchemaName(), handle.getTemporaryTableName())); statement.setString(2, handle.getTableName()); statement.executeUpdate(); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }
Source:
static boolean ignoreOptionName(final String name, final String value) { return name.equalsIgnoreCase("takeUnitControl") || (name.equalsIgnoreCase("giveUnitControl") && (value.equals("false") || value.equals("true"))); }

Target:
static boolean ignoreOptionName(final String name, final String value) { return name.equalsIgnoreCase("takeUnitControl") || (name.equalsIgnoreCase("giveUnitControl") && (value == null || value.equals("false") || value.equals("true"))); }
Source:
public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); final Resource[] resources = new Resource[] { new ClassPathResource("schemas/common.xsd"), new ClassPathResource("schemas/adhocmanagement.xsd") }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }

Target:
public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); final Resource[] resources = new Resource[] { new ClassPathResource(COMMON_XSD_PATH), new ClassPathResource(ADHOC_MANAGEMENT_XSD_PATH) }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }
Source:
public FileManager create() { final short hdfsReplication = configuration.configuration() .getSinkConfiguration(Objects.requireNonNull(name), HdfsSinkConfiguration.class).replication; try { final String hdfsWorkingDir = configuration.configuration().getSinkConfiguration(name, FileSinkConfiguration.class).fileStrategy.workingDir; final String hdfsPublishDir = configuration.configuration().getSinkConfiguration(name, FileSinkConfiguration.class).fileStrategy.publishDir; return new HdfsFileManager(getFileSystemInstance(), hdfsReplication, hdfsWorkingDir, hdfsPublishDir, schema); } catch (final IOException e) { logger.error("Failed to construct HDFS file system instance from verified configuration."); throw new RuntimeException(e); } }

Target:
public FileManager create() { final short hdfsReplication = configuration.configuration() .getSinkConfiguration(Objects.requireNonNull(name), HdfsSinkConfiguration.class).replication; try { final String hdfsWorkingDir = configuration.configuration().getSinkConfiguration(name, FileSinkConfiguration.class).fileStrategy.workingDir; final String hdfsPublishDir = configuration.configuration().getSinkConfiguration(name, FileSinkConfiguration.class).fileStrategy.publishDir; return new HdfsFileManager(getFileSystemInstance(), hdfsReplication, hdfsWorkingDir, hdfsPublishDir, schema); } catch (final IOException e) { logger.error("Failed to construct HDFS file system instance from verified configuration."); throw new UncheckedIOException(e); } }
Source:
public List<Substudy> getSubstudies(StudyIdentifier studyId, boolean includeDeleted) { checkNotNull(studyId); Map<String,Object> parameters = ImmutableMap.of("studyId", studyId.getIdentifier()); String query = "from HibernateSubstudy as substudy where studyId=:studyId"; if (!includeDeleted) { query += " and deleted != 1"; } return hibernateHelper.queryGet(query, parameters, null, null, HibernateSubstudy.class) .stream().map((oneSubstudy) -> (Substudy) oneSubstudy).collect(Collectors.toList()); }

Target:
public List<Substudy> getSubstudies(StudyIdentifier studyId, boolean includeDeleted) { checkNotNull(studyId); Map<String,Object> parameters = ImmutableMap.of("studyId", studyId.getIdentifier()); String query = "from HibernateSubstudy as substudy where studyId=:studyId"; if (!includeDeleted) { query += " and deleted != 1"; } return ImmutableList.copyOf(hibernateHelper.queryGet(query, parameters, null, null, HibernateSubstudy.class)); }
Source:
protected List<MethodMatcher> getMethodInvocationMatchers() { return ImmutableList.of(FOREACH); }

Target:
protected List<MethodMatcher> getMethodInvocationMatchers() { return Collections.singletonList(FOREACH); }
Source:
public void checkNonCacheableReads() throws Exception { final int size = 10; final long start = 0L, end = start + size; LogUnitServer logUnitServer = (LogUnitServer) getDefaultServer(); setServer(logUnitServer); List<Long> addresses = LongStream.range(start, end).boxed().collect(Collectors.toList()); List<LogData> payloads = new ArrayList<>(); for (long i = start; i < end; i++) { LogData logData = new LogData(DataType.DATA, new Object()); logData.setGlobalAddress(i); payloads.add(logData); } sendMessage(CorfuMsgType.RANGE_WRITE.payloadMsg(new RangeWriteMsg(payloads))); waitForLogUnit(logUnitServer); sendMessage(CorfuMsgType.MULTIPLE_READ_REQUEST.payloadMsg(new MultipleReadRequest(addresses, false))); waitForLogUnit(logUnitServer); checkReadResponse(getLastPayloadMessageAs(ReadResponse.class), size); assertThat(logUnitServer.getDataCache().getSize()).isEqualTo(0); sendMessage(CorfuMsgType.MULTIPLE_READ_REQUEST.payloadMsg(new MultipleReadRequest(addresses, true))); waitForLogUnit(logUnitServer); checkReadResponse(getLastPayloadMessageAs(ReadResponse.class), size); assertThat(logUnitServer.getDataCache().getSize()).isEqualTo(size); }

Target:
public void checkNonCacheableReads() throws Exception { final int size = 10; final long start = 0L; final long end = start + size; LogUnitServer logUnitServer = (LogUnitServer) getDefaultServer(); setServer(logUnitServer); List<Long> addresses = LongStream.range(start, end).boxed().collect(Collectors.toList()); List<LogData> payloads = new ArrayList<>(); for (long i = start; i < end; i++) { LogData logData = new LogData(DataType.DATA, new Object()); logData.setGlobalAddress(i); payloads.add(logData); } sendMessage(CorfuMsgType.RANGE_WRITE.payloadMsg(new RangeWriteMsg(payloads))); waitForLogUnit(logUnitServer); sendMessage(CorfuMsgType.MULTIPLE_READ_REQUEST.payloadMsg(new MultipleReadRequest(addresses, false))); waitForLogUnit(logUnitServer); checkReadResponse(getLastPayloadMessageAs(ReadResponse.class), size); assertThat(logUnitServer.getDataCache().getSize()).isEqualTo(0); sendMessage(CorfuMsgType.MULTIPLE_READ_REQUEST.payloadMsg(new MultipleReadRequest(addresses, true))); waitForLogUnit(logUnitServer); checkReadResponse(getLastPayloadMessageAs(ReadResponse.class), size); assertThat(logUnitServer.getDataCache().getSize()).isEqualTo(size); }
Source:
public Map<String, Map> getFlooders() { return new HashedMap() { { put("consumers", new HashMap<String, Set<String>>() {{ put("event_types", getChildren(Type.CONSUMER_ET)); put("apps", getChildren(Type.CONSUMER_APP)); }}); put("producers", new HashMap<String, Set<String>>() {{ put("event_types", getChildren(Type.PRODUCER_ET)); put("apps", getChildren(Type.PRODUCER_APP)); }}); } }; }

Target:
public Map<String, Map> getFlooders() { return ImmutableMap.of( "consumers", ImmutableMap.of( "event_types", getChildren(Type.CONSUMER_ET), "apps", getChildren(Type.CONSUMER_APP)), "producers", ImmutableMap.of( "event_types", getChildren(Type.PRODUCER_ET), "apps", getChildren(Type.PRODUCER_APP))); }
Source:
private CompletableFuture<Long> replicate(List<Entry> entries) { CompletableFuture<Long> future = new CompletableFuture<>(); FutureUtils.addListener(conn .replay(regionInfo.getTable(), regionInfo.getEncodedNameAsBytes(), entries, regionInfo.getReplicaId(), 1, operationTimeoutNs, location), (r, e) -> { if (e != null) { LOG.warn("Failed to replicate to {}", regionInfo); LOG.warn("Exception: " + e); future.completeExceptionally(e); } else { future.complete(r); } }); return future; }

Target:
private CompletableFuture<Long> replicate(List<Entry> entries) { CompletableFuture<Long> future = new CompletableFuture<>(); FutureUtils.addListener(conn .replay(regionInfo.getTable(), regionInfo.getEncodedNameAsBytes(), regionInfo.getStartKey(), entries, regionInfo.getReplicaId(), numRetries, operationTimeoutNs), (r, e) -> { if (e != null) { LOG.warn("Failed to replicate to {}, exception: ", regionInfo, e); future.completeExceptionally(e); } else { future.complete(r); } }); return future; }
Source:
public void onButtonClick() { if (MultiClickGuard.allowClick(QuestionWidget.class.getName())) { if (!isUrlEmpty(stringAnswer)) { customTabHelper.bindCustomTabsService(getContext(), null); customTabHelper.openUri(getContext(), uri); } else { Toast.makeText(getContext(), "No URL set", Toast.LENGTH_SHORT).show(); } } }

Target:
public void onButtonClick() { if (!isUrlEmpty(binding.urlAnswerText)) { customTabHelper.bindCustomTabsService(getContext(), null); customTabHelper.openUri(getContext(), getUri()); } else { ToastUtils.showShortToast("No URL set"); } }
Source:
public void addMemberToSynchronizedGroup() throws Exception { System.out.println(CLASS_NAME + "addMemberToSynchronizedGroup"); vo = setUpVo(); setUpGroup(vo); Attribute synchroAttr = new Attribute(perun.getAttributesManager().getAttributeDefinition(sess, "urn:perun:group:attribute-def:def:synchronizationEnabled")); synchroAttr.setValue("true"); perun.getAttributesManager().setAttribute(sess, group, synchroAttr); Member member = setUpMember(vo); groupsManager.addMember(sess, group, member); }

Target:
public void addMemberToSynchronizedGroup() throws Exception { System.out.println(CLASS_NAME + "addMemberToSynchronizedGroup"); vo = setUpVo(); setUpGroup(vo); Attribute synchroAttr = new Attribute(perun.getAttributesManager().getAttributeDefinition(sess, GroupsManager.GROUPSYNCHROENABLED_ATTRNAME)); synchroAttr.setValue("true"); perun.getAttributesManager().setAttribute(sess, group, synchroAttr); Member member = setUpMember(vo); groupsManager.addMember(sess, group, member); }
Source:
public void testCreateInvalidConfigAeadWithAuth() throws Exception { IpSecConfig ipSecConfig = new IpSecConfig(); addDefaultSpisAndRemoteAddrToIpSecConfig(ipSecConfig); for (int direction : DIRECTIONS) { ipSecConfig.setAuthentication(direction, AUTH_ALGO); try { ipSecConfig.setAuthenticatedEncryption(direction, AEAD_ALGO); } catch (IllegalArgumentException expected) { } } try { mIpSecService.createTransportModeTransform(ipSecConfig, new Binder()); fail( "IpSecService should have thrown an error on authentication being" + " enabled with authenticated encryption"); } catch (IllegalArgumentException expected) { } }

Target:
public void testCreateInvalidConfigAeadWithAuth() throws Exception { IpSecConfig ipSecConfig = new IpSecConfig(); addDefaultSpisAndRemoteAddrToIpSecConfig(ipSecConfig); for (int direction : DIRECTIONS) { ipSecConfig.setAuthentication(direction, AUTH_ALGO); ipSecConfig.setAuthenticatedEncryption(direction, AEAD_ALGO); } try { mIpSecService.createTransportModeTransform(ipSecConfig, new Binder()); fail( "IpSecService should have thrown an error on authentication being" + " enabled with authenticated encryption"); } catch (IllegalArgumentException expected) { } }
Source:
public ActiveTxnCacheSupplier(TxnSupplier delegate, int initialSize, int maxSize, boolean threadSafe) { this.cache = CacheBuilder.newBuilder().initialCapacity(initialSize).maximumSize(maxSize).concurrencyLevel(threadSafe ? 32 : 1).build(); this.delegate = delegate; }

Target:
public ActiveTxnCacheSupplier(TxnSupplier delegate, int initialSize, int maxSize, boolean threadSafe) { this.cache = CacheBuilder.newBuilder().initialCapacity(initialSize).maximumSize(maxSize) .concurrencyLevel(threadSafe ? CACHE_DEFAULT_CONCURRENCY_LEVEL : 1).build(); this.delegate = delegate; }
Source:
public static void assertEquals(Object[] actual, Object[] expected, String message) { if (actual == expected) { return; } if ((actual == null && expected != null) || (actual != null && expected == null)) { if (message != null) { fail(message); } else { fail("Arrays not equal: " + Arrays.toString(expected) + " and " + Arrays.toString(actual)); } } if (actual.length != expected.length) { failAssertNoEqual( "Arrays do not have the same size:" + actual.length + " != " + expected.length, message); } for(int i=0; i<expected.length; i++) { Object e = expected[i]; Object a = actual[i]; String explanation = "Arrays differ at element [" + i + "]: " + e + " != " + a; String errorMessage = message == null ? explanation : message + ": " + explanation; if(a == null && e == null) continue; if ((a == null && e != null) || (a != null && e == null)) { failNotEquals(a, e, message); } if(a != null && e != null){ if(e.getClass().isArray()) { assertEquals(a, e, errorMessage); } else { assertEqualsImpl(a, e, errorMessage); } } } }

Target:
public static void assertEquals(Object[] actual, Object[] expected, String message) { if (actual == expected) { return; } if ((actual == null && expected != null) || (actual != null && expected == null)) { if (message != null) { fail(message); } else { fail("Arrays not equal: " + Arrays.toString(expected) + " and " + Arrays.toString(actual)); } } if (actual.length != expected.length) { failAssertNoEqual( "Arrays do not have the same size:" + actual.length + " != " + expected.length, message); } for(int i=0; i<expected.length; i++) { Object e = expected[i]; Object a = actual[i]; String explanation = "Arrays differ at element [" + i + "]: " + e + " != " + a; String errorMessage = message == null ? explanation : message + ": " + explanation; if (a == null && e == null) { continue; } if ((a == null && e != null) || (a != null && e == null)) { failNotEquals(a, e, message); } if(e.getClass().isArray()) { assertEquals(a, e, errorMessage); } else { assertEqualsImpl(a, e, errorMessage); } } }
Source:
@Override public final void run() { if (isCanceled) { return; } try { final ResponseWrapper wrapper = obtainResponse(); if (isCanceled) { return; } callbackExecutor.execute(new Runnable() { @Override public void run() { if (!isCanceled) { callback.success((T) wrapper.responseBody, wrapper.response); } } }); } catch (final RetrofitError e) { callbackExecutor.execute(new Runnable() { @Override public void run() { if (!isCanceled) { callback.failure(e); } } }); } }

Target:
@Override public final void run() { if (callback == null) { return; } try { final ResponseWrapper wrapper = obtainResponse(); if (callback == null) { return; } callbackExecutor.execute(new Runnable() { @Override public void run() { if (callback != null) { callback.success((T) wrapper.responseBody, wrapper.response); } } }); } catch (final RetrofitError e) { callbackExecutor.execute(new Runnable() { @Override public void run() { if (callback != null) { callback.failure(e); } } }); } }
Source:
public void testReadObjectsWithFailedGet() throws SignatureException, IOException, XmlProcessingException { final Ds3Client ds3Client = Mockito.mock(Ds3Client.class); final Ds3ClientFactory ds3ClientFactory = ds3ClientFactory(ds3Client); Mockito.when(ds3Client.buildFactory(Mockito.<Iterable<Node>>any())).thenReturn(ds3ClientFactory); final BulkGetResponse buildBulkGetResponse = buildBulkGetResponse(); Mockito.when(ds3Client.bulkGet(hasChunkOrdering(ChunkClientProcessingOrderGuarantee.NONE))).thenReturn(buildBulkGetResponse); final GetAvailableJobChunksResponse jobChunksResponse = buildJobChunksResponse2(); Mockito.when(ds3Client.getAvailableJobChunks(hasJobId(jobId))).thenReturn(jobChunksResponse); Mockito.when(ds3Client.getObject(getRequestHas(MYBUCKET, "foo", jobId, 6))).thenThrow(new StubException()); Mockito.when(ds3Client.getObject(getRequestHas(MYBUCKET, "baz", jobId, 6))).then(getObjectAnswer("ntents")); final Job job = Ds3ClientHelpers.wrap(ds3Client).startReadJob(MYBUCKET, Lists.newArrayList( new Ds3Object("foo"), new Ds3Object("bar"), new Ds3Object("baz") )); job.transfer(new ObjectChannelBuilder() { @Override public SeekableByteChannel buildChannel(final String key) throws IOException { return new ByteArraySeekableByteChannel(); } }); Assert.fail("Should have failed with an exception before we got here."); }

Target:
public void testReadObjectsWithFailedGet() throws SignatureException, IOException, XmlProcessingException { final Ds3Client ds3Client = Mockito.mock(Ds3Client.class); final Ds3ClientFactory ds3ClientFactory = ds3ClientFactory(ds3Client); Mockito.when(ds3Client.buildFactory(Mockito.<Iterable<Node>>any())).thenReturn(ds3ClientFactory); final BulkGetResponse buildBulkGetResponse = buildBulkGetResponse(); Mockito.when(ds3Client.bulkGet(hasChunkOrdering(ChunkClientProcessingOrderGuarantee.NONE))).thenReturn(buildBulkGetResponse); final GetAvailableJobChunksResponse jobChunksResponse = buildJobChunksResponse2(); Mockito.when(ds3Client.getAvailableJobChunks(hasJobId(jobId))).thenReturn(jobChunksResponse); Mockito.when(ds3Client.getObject(getRequestHas(MYBUCKET, "foo", jobId, 6))).thenThrow(new StubException()); Mockito.when(ds3Client.getObject(getRequestHas(MYBUCKET, "baz", jobId, 6))).then(getObjectAnswer("ntents")); final Job job = Ds3ClientHelpers.wrap(ds3Client).startReadJob(MYBUCKET, Lists.newArrayList( new Ds3Object("foo"), new Ds3Object("bar"), new Ds3Object("baz") )); job.transfer(new ObjectChannelBuilder() { @Override public SeekableByteChannel buildChannel(final String key) throws IOException { return new ByteArraySeekableByteChannel(); } }); }
Source:
public void setup() throws Exception { httpClientFactory = new HttpClientFactory(); String[] args = new String[] { "-role", "hub", "-type", "sauce", "-host", "localhost", "-servlets", "com.paypal.selion.grid.servlets.LoginServlet,com.paypal.selion.grid.servlets.SauceServlet", }; GridHubConfiguration ghc = GridHubConfiguration.build(args); hub = new Hub(ghc); System.setProperty("selionHome", (new File("src/main/resources")).getAbsolutePath()); }

Target:
public void setup() throws Exception { httpClientFactory = new HttpClientFactory(); String[] args = new String[] { "-role", "hub", "-type", "sauce", "-host", "localhost", "-servlets", "com.paypal.selion.grid.servlets.LoginServlet,com.paypal.selion.grid.servlets.SauceServlet", }; GridHubConfiguration ghc = GridHubConfiguration.build(args); hub = new Hub(ghc); }
Source:
public void refreshVdsStats() { if (Config.<Boolean> getValue(ConfigValues.DebugTimerLogging)) { log.debug("vdsManager::refreshVdsStats entered, vds='{}'({})", vds.getName(), vds.getId()); } fetchHostInterfaces(); VDSReturnValue statsReturnValue = getResourceManager().runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(vds)); getResourceManager().getEventListener().updateSchedulingStats(vds); if (!statsReturnValue.getSucceeded() && statsReturnValue.getExceptionObject() != null) { log.error(" Failed getting vds stats, vds='{}'({}): {}", vds.getName(), vds.getId(), statsReturnValue.getExceptionString()); return; } saveVdsDynamic = true; saveVdsStatistics = true; alertIfLowDiskSpaceOnHost(); checkVdsInterfaces(); if (Config.<Boolean> getValue(ConfigValues.DebugTimerLogging)) { log.debug("vds::refreshVdsStats\n{0}", this); } }

Target:
public void refreshVdsStats() { if (Config.<Boolean> getValue(ConfigValues.DebugTimerLogging)) { log.debug("vdsManager::refreshVdsStats entered, vds='{}'({})", vds.getName(), vds.getId()); } fetchHostInterfaces(); VDSReturnValue statsReturnValue = getResourceManager().runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(vds)); getVdsEventListener().updateSchedulingStats(vds); if (!statsReturnValue.getSucceeded() && statsReturnValue.getExceptionObject() != null) { log.error(" Failed getting vds stats, vds='{}'({}): {}", vds.getName(), vds.getId(), statsReturnValue.getExceptionString()); return; } saveVdsDynamic = true; saveVdsStatistics = true; alertIfLowDiskSpaceOnHost(); checkVdsInterfaces(); if (Config.<Boolean> getValue(ConfigValues.DebugTimerLogging)) { log.debug("vds::refreshVdsStats\n{0}", this); } }
Source:
public void reset() { if (!initialized) { throw new ISE("Grouper is not initialized"); } if (closed) { throw new ISE("Grouper is closed"); } for (Grouper<KeyType> grouper : groupers) { grouper.reset(); } }

Target:
public void reset() { if (!initialized) { throw new ISE("Grouper is not initialized"); } if (closed) { throw new ISE("Grouper is closed"); } groupers.forEach(Grouper::reset); }
Source:
public void serialize(T t, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { generateObject(t, jsonGenerator); jsonGenerator.writeObjectFieldStart("tuples"); for(String key : t.keys()) jsonGenerator.writeObjectField(key, t.getAll(key)); jsonGenerator.writeEndObject(); }

Target:
public void serialize(T t, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { jsonGenerator.writeStartObject(); writeUniqueFields(t, jsonGenerator); jsonGenerator.writeObjectFieldStart("tuples"); for(String key : t.keys()) jsonGenerator.writeObjectField(key, t.getAll(key)); jsonGenerator.writeEndObject(); }
Source:
private Collection<CompilerInput> createEntryPointInputs( DependencyOptions depOptions, List<CompilerInput> inputs, SortedDependencies<CompilerInput> sorter) throws MissingModuleException, MissingProvideException { Set<CompilerInput> entryPointInputs = new LinkedHashSet<>(); Map<String, JSModule> modulesByName = getModulesByName(); if (depOptions.shouldPruneDependencies()) { if (!depOptions.shouldDropMoochers()) { entryPointInputs.addAll(sorter.getInputsWithoutProvides()); } for (DependencyOptions.ModuleIdentifier entryPoint : depOptions.getEntryPoints()) { String inputName = entryPoint.getNormalizedModuleName(); int splitPoint = entryPoint.getNormalizedModuleName().indexOf(':'); CompilerInput entryPointInput = null; try { if (splitPoint != -1) { String moduleName = entryPoint.getNormalizedModuleName().substring(0, splitPoint); inputName = entryPoint.getNormalizedModuleName().substring( Math.min(splitPoint + 1, entryPoint.getNormalizedModuleName().length() - 1)); JSModule module = modulesByName.get(moduleName); if (module == null) { throw new MissingModuleException(moduleName); } else { entryPointInput = sorter.getInputProviding(inputName); entryPointInput.overrideModule(module); } } else { entryPointInput = sorter.getInputProviding(inputName); } } catch (MissingProvideException e) { throw new MissingProvideException(entryPoint.getName()); } entryPointInputs.add(entryPointInput); } CompilerInput baseJs = sorter.maybeGetInputProviding("goog"); if (baseJs != null) { entryPointInputs.add(baseJs); } } else { entryPointInputs.addAll(inputs); } return entryPointInputs; }

Target:
private Collection<CompilerInput> createEntryPointInputs( DependencyOptions depOptions, List<CompilerInput> inputs, SortedDependencies<CompilerInput> sorter) throws MissingModuleException, MissingProvideException { Set<CompilerInput> entryPointInputs = new LinkedHashSet<>(); Map<String, JSModule> modulesByName = getModulesByName(); if (depOptions.shouldPruneDependencies()) { if (!depOptions.shouldDropMoochers()) { entryPointInputs.addAll(sorter.getInputsWithoutProvides()); } for (DependencyOptions.ModuleIdentifier entryPoint : depOptions.getEntryPoints()) { CompilerInput entryPointInput = null; try { if (entryPoint.getClosureNamespace().equals(entryPoint.getModuleName())) { entryPointInput = sorter.getInputProviding(entryPoint.getClosureNamespace()); } else { JSModule module = modulesByName.get(entryPoint.getModuleName()); if (module == null) { throw new MissingModuleException(entryPoint.getModuleName()); } else { entryPointInput = sorter.getInputProviding(entryPoint.getClosureNamespace()); entryPointInput.overrideModule(module); } } } catch (MissingProvideException e) { throw new MissingProvideException(entryPoint.getName(), e); } entryPointInputs.add(entryPointInput); } CompilerInput baseJs = sorter.maybeGetInputProviding("goog"); if (baseJs != null) { entryPointInputs.add(baseJs); } } else { entryPointInputs.addAll(inputs); } return entryPointInputs; }
Source:
public String toStatement(String statement) { return statementBuilder + statement; }

Target:
public String toStatement(String statement) { return cteStatement + statement; }
Source:
public Future<JsonRpcResponse> call(JsonRpcRequest req, BrokerCommandCallback callback) throws ClientConnectionException { final Call call = new Call(req, executorService, callback); this.tracker.registerCall(req, call); retryCall(req, call); try { this.getClient().sendMessage(jsonToByteArray(req.toJson())); } finally { retryCall(req, call); } return call; }

Target:
public Future<JsonRpcResponse> call(JsonRpcRequest req, BrokerCommandCallback callback) throws ClientConnectionException { final Call call = new Call(req, callback); this.tracker.registerCall(req, call); retryCall(req, call); try { this.getClient().sendMessage(jsonToByteArray(req.toJson())); } finally { retryCall(req, call); } return call; }
Source:
public Bundle[] getBundles(String symbolicName, String versionRange) { Map<String, String> directives = Collections.singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, getRequirementFilter(symbolicName, versionRange)); Collection<BundleCapability> matchingBundleCapabilities = fwkWiring.findProviders(ModuleContainer .createRequirement(IdentityNamespace.IDENTITY_NAMESPACE, directives, Collections.emptyMap())); if (matchingBundleCapabilities.isEmpty()) { return null; } Bundle[] results = matchingBundleCapabilities.stream().map(c -> c.getRevision().getBundle()) .filter(bundle -> (bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) .toArray(Bundle[]::new); return results.length > 0 ? results : null; }

Target:
public Bundle[] getBundles(String symbolicName, String versionRange) { Map<String, String> directives = Collections.singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, getRequirementFilter(symbolicName, versionRange)); Collection<BundleCapability> matchingBundleCapabilities = fwkWiring.findProviders(ModuleContainer .createRequirement(IdentityNamespace.IDENTITY_NAMESPACE, directives, Collections.emptyMap())); if (matchingBundleCapabilities.isEmpty()) { return null; } Bundle[] results = matchingBundleCapabilities.stream().map(c -> c.getRevision().getBundle()) .filter(bundle -> (bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) .sorted() .toArray(Bundle[]::new); return results.length > 0 ? results : null; }
Source:
private <R> R readCollectionValue(@Nullable List<?> source, ElasticsearchPersistentProperty property, TypeInformation<R> targetType) { if (source == null) { return null; } Collection<Object> target = createCollectionForValue(targetType, source.size()); for (Object value : source) { if(null == value) return null; if (isSimpleType(value)) { target.add( readSimpleValue(value, targetType.getComponentType() != null ? targetType.getComponentType() : targetType)); } else { if (value instanceof List) { target.add(readValue(value, property, property.getTypeInformation().getActualType())); } else { target.add(readEntity(computeGenericValueTypeForRead(property, value), (Map<String, Object>) value)); } } } return (R) target; }

Target:
private <R> R readCollectionValue(@Nullable List<?> source, ElasticsearchPersistentProperty property, TypeInformation<R> targetType) { if (source == null) { return null; } Collection<Object> target = createCollectionForValue(targetType, source.size()); for (Object value : source) { if(value == null) { return null; } if (isSimpleType(value)) { target.add( readSimpleValue(value, targetType.getComponentType() != null ? targetType.getComponentType() : targetType)); } else { if (value instanceof List) { target.add(readValue(value, property, property.getTypeInformation().getActualType())); } else { target.add(readEntity(computeGenericValueTypeForRead(property, value), (Map<String, Object>) value)); } } } return (R) target; }
Source:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { Map<String, GC100IRHost> hosts = new HashMap<String, GC100IRHost>(); Enumeration<String> keys = config.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if ("service.pid".equals(key)) { continue; } String[] parts = key.split("\\."); String hostname = parts[0]; GC100IRHost host = hosts.get(hostname); if (host == null) { host = new GC100IRHost(); } String value = ((String) config.get(key)).trim(); if ("host".equals(parts[1])) { host.setHostname(value); } hosts.put(hostname, host); } nameHostMapper = hosts; registerAllWatches(); }

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config == null) { return; } Map<String, GC100IRHost> hosts = new HashMap<String, GC100IRHost>(); Enumeration<String> keys = config.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if ("service.pid".equals(key)) { continue; } String[] parts = key.split("\\."); String hostname = parts[0]; GC100IRHost host = hosts.get(hostname); if (host == null) { host = new GC100IRHost(); } String value = ((String) config.get(key)).trim(); if ("host".equals(parts[1])) { host.setHostname(value); } hosts.put(hostname, host); } nameHostMapper = hosts; registerAllWatches(); }
Source:
public ASTNode transform(Rule node) throws TransformerException { Term body = node.getBody(); if (body instanceof Rewrite) { body = ((Rewrite) body).getLeft(); } if (body instanceof TermCons) { Production prod = context.conses.get(((TermCons) body).getCons()); if (prod.containsAttribute("function") || prod.containsAttribute("predicate")) { node = addFunction(node); } } if (body instanceof KApp) { Term l = ((KApp) body).getLabel(); if (l instanceof KLabelConstant) { KLabelConstant label = (KLabelConstant) l; if (label.isPredicate()) { node = addFunction(node); } else { List<Production> productions = context.productionsOf(label.getLabel()); Production functionProduction = null; for (Production production : productions) { if (production.containsAttribute("function") || production.containsAttribute("predicate")) { functionProduction = production; } else if (functionProduction != null) { GlobalSettings.kem.register(new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, "Ambiguity: Top symbol " + label + " corresponds to both a functional declaration (" + functionProduction + ") and to a non-functional one (" + production + ")", getName(), node.getFilename(), node.getLocation())); } } if (functionProduction != null) { node = addFunction(node); } } } } return node; }

Target:
public ASTNode transform(Rule node) throws TransformerException { Term body = node.getBody(); if (body instanceof Rewrite) { body = ((Rewrite) body).getLeft(); } if (body instanceof TermCons) { Production prod = context.conses.get(((TermCons) body).getCons()); if (prod.containsAttribute("function") || prod.containsAttribute("predicate")) { node = addFunction(node); } } if (body instanceof KApp) { Term l = ((KApp) body).getLabel(); if (l instanceof KLabelConstant) { KLabelConstant label = (KLabelConstant) l; if (label.isFunctional(context)) { node = addFunction(node); } } } return node; }
Source:
public List<DocumentModel> getCurrentPage() { if (currentPage == null) { currentPage = new ArrayList<DocumentModel>(); PageProviderService pps = Framework.getService(PageProviderService.class); PageProvider<?> pp = pps.getPageProvider(LATEST_AUDITED_CREATED_USERS_OR_GROUPS_PROVIDER, null, getPageSize(), getCurrentPageIndex(), getProperties(), new Object[] { null }); @SuppressWarnings("unchecked") List<LogEntry> entries = (List<LogEntry>) pp.getCurrentPage(); if (entries != null) { UserManager um = Framework.getService(UserManager.class); DirectoryService directoryService = Framework.getService(DirectoryService.class); try (Session userDir = directoryService.open(um.getUserDirectoryName(), null)) { for (LogEntry e : entries) { String id = (String) e.getExtendedInfos().get("id").getSerializableValue(); if (StringUtils.isNotBlank(id)) { DocumentModel doc; if (UserManagerImpl.GROUPCREATED_EVENT_ID.equals(e.getEventId())) { doc = um.getGroupModel(id); } else if (UserManagerImpl.USERCREATED_EVENT_ID.equals(e.getEventId())) { doc = um.getUserModel(id); if (doc == null) { continue; } } else { continue; } if (doc == null) { continue; } currentPage.add(doc); } } } } } return currentPage; }

Target:
public List<DocumentModel> getCurrentPage() { if (currentPage != null) { return currentPage; } currentPage = new ArrayList<DocumentModel>(); PageProviderService pps = Framework.getService(PageProviderService.class); CoreSession coreSession = (CoreSession) getProperties().get(CORE_SESSION_PROPERTY); PageProvider<?> pp = pps.getPageProvider(LATEST_AUDITED_CREATED_USERS_OR_GROUPS_PROVIDER, null, getPageSize(), getCurrentPageIndex(), getProperties(), coreSession != null ? coreSession.getRootDocument().getId() : new Object[] { null }); @SuppressWarnings("unchecked") List<LogEntry> entries = (List<LogEntry>) pp.getCurrentPage(); if (entries != null) { UserManager um = Framework.getService(UserManager.class); DirectoryService directoryService = Framework.getService(DirectoryService.class); try (Session userDir = directoryService.open(um.getUserDirectoryName(), null)) { for (LogEntry e : entries) { String id = (String) e.getExtendedInfos().get("id").getSerializableValue(); if (StringUtils.isNotBlank(id)) { DocumentModel doc; if (UserManagerImpl.GROUPCREATED_EVENT_ID.equals(e.getEventId())) { doc = um.getGroupModel(id); } else if (UserManagerImpl.USERCREATED_EVENT_ID.equals(e.getEventId())) { doc = um.getUserModel(id); } else { continue; } if (doc == null) { continue; } currentPage.add(doc); } } } } return currentPage; }