auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGenerateNewMetaGlobalSomePersisted() throws Exception { final MockGlobalSessionCallback callback = new MockGlobalSessionCallback(); final GlobalSession session = new MockPrefsGlobalSession(SyncConfiguration.DEFAULT_USER_API, TEST_CLUSTER_URL, TEST_USERNAME, TEST_PASSWORD, null, new KeyBundle(TEST_USERNAME, TEST_SYNC_KEY), callback, null, null, null); session.config.enabledEngineNames = new HashSet<String>(); session.config.enabledEngineNames.add("bookmarks"); session.config.enabledEngineNames.add("clients"); session.config.enabledEngineNames.add("addons"); session.config.enabledEngineNames.add("prefs"); MetaGlobal mg = session.generateNewMetaGlobal(); assertEquals(new Long(GlobalSession.STORAGE_VERSION), mg.getStorageVersion()); List<String> namesList = new ArrayList<String>(mg.getEnabledEngineNames()); Collections.sort(namesList); String[] names = namesList.toArray(new String[namesList.size()]); String[] expected = new String[] { "addons", "bookmarks", "clients", "prefs" }; assertArrayEquals(expected, names); assertEquals(GlobalSession.BOOKMARKS_ENGINE_VERSION, mg.getEngines().getObject("bookmarks").getIntegerSafely("version").intValue()); assertEquals(GlobalSession.CLIENTS_ENGINE_VERSION, mg.getEngines().getObject("clients").getIntegerSafely("version").intValue()); assertEquals(0, mg.getEngines().getObject("addons").getIntegerSafely("version").intValue()); assertEquals(0, mg.getEngines().getObject("prefs").getIntegerSafely("version").intValue()); }

Target:
public void testGenerateNewMetaGlobalSomePersisted() throws Exception { final MockGlobalSessionCallback callback = new MockGlobalSessionCallback(); final GlobalSession session = new MockPrefsGlobalSession(SyncConfiguration.DEFAULT_USER_API, TEST_CLUSTER_URL, TEST_USERNAME, TEST_PASSWORD, null, new KeyBundle(TEST_USERNAME, TEST_SYNC_KEY), callback, null, null, null); session.config.enabledEngineNames = new HashSet<String>(); session.config.enabledEngineNames.add("bookmarks"); session.config.enabledEngineNames.add("clients"); session.config.enabledEngineNames.add("addons"); session.config.enabledEngineNames.add("prefs"); MetaGlobal mg = session.generateNewMetaGlobal(); assertEquals(new Long(GlobalSession.STORAGE_VERSION), mg.getStorageVersion()); assertEquals(VersionConstants.BOOKMARKS_ENGINE_VERSION, mg.getEngines().getObject("bookmarks").getIntegerSafely("version").intValue()); assertEquals(VersionConstants.CLIENTS_ENGINE_VERSION, mg.getEngines().getObject("clients").getIntegerSafely("version").intValue()); assertEquals(0, mg.getEngines().getObject("addons").getIntegerSafely("version").intValue()); assertEquals(0, mg.getEngines().getObject("prefs").getIntegerSafely("version").intValue()); List<String> namesList = new ArrayList<String>(mg.getEnabledEngineNames()); Collections.sort(namesList); String[] names = namesList.toArray(new String[namesList.size()]); String[] expected = new String[] { "addons", "bookmarks", "clients", "prefs" }; assertArrayEquals(expected, names); }
Source:
public Builder setTimes(final int minTimeParam, final int maxTimeParam) { if (times) { throw new IllegalStateException("Times quantifier is already set!"); } if (minTimeParam > maxTimeParam) { throw new IllegalStateException("min time should be less than or equal to max time!"); } if (minTimeParam < 0 || maxTimeParam < 0) { throw new IllegalStateException("Min time and Max time should be positive!"); } times = true; minTimes = minTimeParam; maxTimes = maxTimeParam; return this; }

Target:
public Builder setTimes(final int minTimeParam, final int maxTimeParam) { if (times) { throw new IllegalStateException("Times quantifier is already set!"); } if (minTimeParam > maxTimeParam) { throw new IllegalArgumentException("min time should be less than or equal to max time!"); } if (minTimeParam < 0 || maxTimeParam < 0) { throw new IllegalArgumentException("Min time and Max time should be positive!"); } times = true; minTimes = minTimeParam; maxTimes = maxTimeParam; return this; }
Source:
protected void replaceJavaOptIfExists(String prefix, String value) { for (int i = 0; i < javaOpts.size(); i++) { if (javaOpts.get(i).startsWith(prefix)) { javaOpts.remove(i); } } javaOpts.add(prefix + value); }

Target:
protected void replaceJavaOptIfExists(String prefix, String value) { removeJavaOptIfExists(prefix); javaOpts.add(prefix + value); }
Source:
public void tearDown() { ParseObject.unregisterSubclass(ParseInstallation.class); ParseCorePlugins.getInstance().reset(); ParsePlugins.reset(); }

Target:
public void tearDown() { ParseObject.unregisterSubclass(ParseInstallation.class); ParseCorePlugins.getInstance().reset(); ParsePlugins.reset(); Locale.setDefault(defaultLocale); }
Source:
public void testFSCacheUpdateWithHostName() { final URI newRepo = URI.create("git://repo-name"); provider.addHostName("ssh", "localhost:8080/git"); final FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); JGitFileSystemsCache fileSystemsCache = provider.getFsManager().getFsCache(); final FileSystem fileSystem = fileSystemsCache.get("repo-name"); assertThat(fileSystem).isNotNull(); assertThat(checkProtocolPresent(fileSystem.toString(), "ssh")).isEqualTo(true); assertThat(checkProtocolPresent(fileSystem.toString(), "http")).isEqualTo(false); provider.addHostName("http", "localhost:8080/git"); final FileSystem fileSystem1 = fileSystemsCache.get("repo-name"); assertThat(fileSystem1).isNotNull(); assertThat(checkProtocolPresent(fileSystem1.toString(), "http")).isEqualTo(false); assertThat(fileSystemsCache.getFileSystems().size()).isEqualTo(1); provider.updateCacheWithHostNames(); final FileSystem fileSystem2 = fileSystemsCache.get("repo-name"); assertThat(fileSystem2).isNotNull(); assertThat(checkProtocolPresent(fileSystem2.toString(), "http")).isEqualTo(true); assertThat(fileSystemsCache.getFileSystems().size()).isEqualTo(1); }

Target:
public void testFSCacheUpdateWithHostName() { final URI newRepo = URI.create("git://repo-name"); provider.addHostName("ssh", "localhost:8080/git"); provider.newFileSystem(newRepo, EMPTY_ENV); JGitFileSystemsCache fileSystemsCache = provider.getFsManager().getFsCache(); final FileSystem fileSystem = fileSystemsCache.get("repo-name"); assertThat(fileSystem).isNotNull(); assertTrue(checkProtocolPresent(fileSystem.toString(), "ssh")); assertFalse(checkProtocolPresent(fileSystem.toString(), "http")); provider.addHostName("http", "localhost:8080/git"); final FileSystem fileSystem1 = fileSystemsCache.get("repo-name"); assertThat(fileSystem1).isNotNull(); assertFalse(checkProtocolPresent(fileSystem1.toString(), "http")); assertThat(fileSystemsCache.getFileSystems().size()).isOne(); provider.updateCacheWithHostNames(); final FileSystem fileSystem2 = fileSystemsCache.get("repo-name"); assertThat(fileSystem2).isNotNull(); assertTrue(checkProtocolPresent(fileSystem2.toString(), "http")); assertThat(fileSystemsCache.getFileSystems().size()).isOne(); }
Source:
public <T extends GlowEntity> T spawn(Location location, T entity, SpawnReason reason) throws IllegalArgumentException { checkNotNull(entity).setRawLocation(location, false); checkNotNull(reason); checkNotNull(location); try { EntitySpawnEvent spawnEvent = null; if (entity instanceof LivingEntity) { spawnEvent = EventFactory.getInstance() .callEvent(new CreatureSpawnEvent((LivingEntity) entity, reason)); } else if (!(entity instanceof Item)) { spawnEvent = EventFactory.getInstance().callEvent(new EntitySpawnEvent(entity)); } if (spawnEvent != null && spawnEvent.isCancelled()) { entity.remove(); } else { List<Message> spawnMessage = entity.createSpawnMessage(); final GlowEntity finalEntity = entity; getRawPlayers().stream().filter(player -> player.canSeeEntity(finalEntity)) .forEach(player -> player.getSession().sendAll(spawnMessage .toArray(new Message[spawnMessage.size()]))); } } catch (NoSuchMethodError | IllegalAccessError e) { GlowServer.logger.log(Level.WARNING, "Invalid entity spawn: ", e); } catch (Throwable t) { GlowServer.logger.log(Level.SEVERE, "Unable to spawn entity: ", t); } return entity; }

Target:
public <T extends GlowEntity> T spawn(Location location, T entity, SpawnReason reason) throws IllegalArgumentException { checkNotNull(entity).setRawLocation(location, false); checkNotNull(reason); checkNotNull(location); try { EntitySpawnEvent spawnEvent = null; if (entity instanceof LivingEntity) { spawnEvent = EventFactory.getInstance() .callEvent(new CreatureSpawnEvent((LivingEntity) entity, reason)); } else if (!(entity instanceof Item)) { spawnEvent = EventFactory.getInstance().callEvent(new EntitySpawnEvent(entity)); } if (spawnEvent != null && spawnEvent.isCancelled()) { entity.remove(); } else { List<Message> spawnMessage = entity.createSpawnMessage(); getRawPlayers().stream().filter(player -> player.canSeeEntity(entity)) .forEach(player -> player.getSession().sendAll(spawnMessage .toArray(new Message[spawnMessage.size()]))); } } catch (Throwable t) { GlowServer.logger.log(Level.SEVERE, "Unable to spawn entity: ", t); } return entity; }
Source:
private Collection<ArtifactInfo> asArtifactInfo(Set<SearchResult> results) { Collection<ArtifactInfo> artifactInfos = new LinkedHashSet<>(); for (SearchResult result : results) { artifactInfos.add(new ArtifactInfo(result.getRepositoryId(), ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getGroupId(), ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getArtifactId(), ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getVersion(), ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getClassifier(), ((MavenArtifactCoordinates) result.getArtifactCoordinates()).getExtension())); } return artifactInfos; }

Target:
private Collection<ArtifactInfo> asArtifactInfo(Set<SearchResult> results) { Collection<ArtifactInfo> artifactInfos = new LinkedHashSet<>(); for (SearchResult result : results) { MavenArtifactCoordinates mavenArtifactCoordinates = (MavenArtifactCoordinates) result.getArtifactCoordinates(); artifactInfos.add(new ArtifactInfo(result.getRepositoryId(), mavenArtifactCoordinates.getGroupId(), mavenArtifactCoordinates.getArtifactId(), mavenArtifactCoordinates.getVersion(), mavenArtifactCoordinates.getClassifier(), mavenArtifactCoordinates.getExtension())); } return artifactInfos; }
Source:
public static String onClientChat(EntityPlayerSP sender, String message){ ClientChatEvent event = new ClientChatEvent(sender, message); MinecraftForge.EVENT_BUS.post(event); String newmsg = event.getMessage(); if(event.isCanceled()){ newmsg = null; }else if(newmsg.isEmpty()){ newmsg = null; } return newmsg; }

Target:
public static String onClientChat(EntityPlayerSP sender, String message){ ClientChatEvent event = new ClientChatEvent(sender, message); MinecraftForge.EVENT_BUS.post(event); String newmsg = event.getMessage(); if(event.isCanceled() || Strings.isNullOrEmpty(newmsg)){ newmsg = null; } return newmsg; }
Source:
private File createJar( @Nonnull List<String> classPath, @Nonnull String startClassName ) throws IOException { File file = File.createTempFile( "surefirebooter", ".jar", getTempDirectory() ); if ( !isDebug() ) { file.deleteOnExit(); } Path parent = file.getParentFile().toPath(); FileOutputStream fos = new FileOutputStream( file ); JarOutputStream jos = new JarOutputStream( fos ); try { jos.setLevel( JarOutputStream.STORED ); JarEntry je = new JarEntry( "META-INF/MANIFEST.MF" ); jos.putNextEntry( je ); Manifest man = new Manifest(); StringBuilder cp = new StringBuilder(); for ( Iterator<String> it = classPath.iterator(); it.hasNext(); ) { File file1 = new File( it.next() ); String uri; try { uri = URI.create( parent.relativize( file1.toPath() ).toString() ).toASCIIString(); } catch ( IllegalArgumentException e ) { uri = file1.toURI().toASCIIString(); getConsoleLogger().warning( "Boot Manifest-JAR contains absolute paths in classpath" ); } cp.append( uri ); if ( file1.isDirectory() && !uri.endsWith( "/" ) ) { cp.append( '/' ); } if ( it.hasNext() ) { cp.append( ' ' ); } } man.getMainAttributes().putValue( "Manifest-Version", "1.0" ); man.getMainAttributes().putValue( "Class-Path", cp.toString().trim() ); man.getMainAttributes().putValue( "Main-Class", startClassName ); man.write( jos ); jos.closeEntry(); jos.flush(); return file; } finally { jos.close(); } }

Target:
private File createJar( @Nonnull List<String> classPath, @Nonnull String startClassName ) throws IOException { File file = File.createTempFile( "surefirebooter", ".jar", getTempDirectory() ); if ( !isDebug() ) { file.deleteOnExit(); } Path parent = file.getParentFile().toPath(); FileOutputStream fos = new FileOutputStream( file ); JarOutputStream jos = new JarOutputStream( fos ); try { jos.setLevel( JarOutputStream.STORED ); JarEntry je = new JarEntry( "META-INF/MANIFEST.MF" ); jos.putNextEntry( je ); Manifest man = new Manifest(); StringBuilder cp = new StringBuilder(); for ( Iterator<String> it = classPath.iterator(); it.hasNext(); ) { File file1 = new File( it.next() ); String uri; try { uri = new URI( null, parent.relativize( file1.toPath() ).toString(), null ).toASCIIString(); } catch ( IllegalArgumentException e ) { uri = file1.toURI().toASCIIString(); } catch ( URISyntaxException e ) { throw new IOException( "Could not relativize path " + file1 + " against " + parent, e ); } cp.append( uri ); if ( file1.isDirectory() && !uri.endsWith( "/" ) ) { cp.append( '/' ); } if ( it.hasNext() ) { cp.append( ' ' ); } } man.getMainAttributes().putValue( "Manifest-Version", "1.0" ); man.getMainAttributes().putValue( "Class-Path", cp.toString().trim() ); man.getMainAttributes().putValue( "Main-Class", startClassName ); man.write( jos ); jos.closeEntry(); jos.flush(); return file; } finally { jos.close(); } }
Source:
public void logsMultipleTimesIfAllowedToMultipleTimes() { makeOperationsTakeSpecifiedDuration(LONG_DURATION); for (int i = 0; i < 100; i++) { allowLogging(); profilingTimelockService.lockImmutableTimestamp(); disallowLogging(); profilingTimelockService.lockImmutableTimestamp(); profilingTimelockService.lockImmutableTimestamp(); } verifyLoggerInvokedSpecificNumberOfTimes(100); }

Target:
public void logsMultipleTimesIfAllowedToMultipleTimes() { for (int i = 0; i < 100; i++) { accumulateLogsWithCall(LONG_DURATION, profilingTimelockService::lockImmutableTimestamp); accumulateLogsWithCall(LONG_DURATION, profilingTimelockService::lockImmutableTimestamp); flushLogsWithCall(LONG_DURATION, profilingTimelockService::lockImmutableTimestamp); } verifyLoggerInvokedSpecificNumberOfTimes(100); }
Source:
int serverInitiateHandshake() { this.state = ConnectionState.AWAITING_HANDSHAKE; serverHandler = new NetHandlerPlayServer(scm.getServerInstance(), manager, player) { @Override public void update() { if (NetworkDispatcher.this.state == ConnectionState.FINALIZING) { completeServerSideConnection(ConnectionType.MODDED); } super.update(); } }; this.netHandler = serverHandler; player.playerNetServerHandler = null; this.manager.setConnectionState(EnumConnectionState.PLAY); NBTTagCompound playerNBT = scm.getPlayerNBT(player); if (playerNBT!=null) { int dimension = playerNBT.getInteger("Dimension"); World playerWorld = scm.getServerInstance().worldServerForDimension(dimension); if (playerWorld != null) { return dimension; } } return 0; }

Target:
int serverInitiateHandshake() { this.state = ConnectionState.AWAITING_HANDSHAKE; serverHandler = new NetHandlerPlayServer(scm.getServerInstance(), manager, player) { @Override public void update() { if (NetworkDispatcher.this.state == ConnectionState.FINALIZING) { completeServerSideConnection(ConnectionType.MODDED); } super.update(); } }; this.netHandler = serverHandler; player.playerNetServerHandler = null; this.manager.setConnectionState(EnumConnectionState.PLAY); NBTTagCompound playerNBT = scm.getPlayerNBT(player); if (playerNBT!=null) { int dimension = playerNBT.getInteger("Dimension"); if (DimensionManager.isDimensionRegistered(dimension)) { return dimension; } } return 0; }
Source:
private void ensureUpdatingProfileExists(String googleId, StudentProfile profileToUpdate) throws EntityDoesNotExistException { if (profileToUpdate == null || JDOHelper.isDeleted(profileToUpdate)) { throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT_STUDENT_PROFILE + googleId + ThreadHelper.getCurrentThreadStack()); } }

Target:
private void ensureUpdatingProfileExists(String googleId, StudentProfile profileToUpdate) throws EntityDoesNotExistException { if (profileToUpdate == null) { throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT_STUDENT_PROFILE + googleId + ThreadHelper.getCurrentThreadStack()); } }
Source:
protected void delete(Context context, Integer id) { ClaimedTask task = null; try { task = claimedTaskService.find(context, id); XmlWorkflowItem workflowItem = task.getWorkflowItem(); workflowService.deleteClaimedTask(context, workflowItem, task); workflowRequirementsService.removeClaimedUser(context, workflowItem, task.getOwner(), task.getStepID()); context.addEvent(new Event(Event.MODIFY, Constants.ITEM, workflowItem.getItem().getID(), null, itemService.getIdentifiers(context, workflowItem.getItem()))); } catch (SQLException | IOException | WorkflowConfigurationException | AuthorizeException e) { throw new RuntimeException(e.getMessage(), e); } }

Target:
protected void delete(Context context, Integer id) { ClaimedTask task = null; try { task = claimedTaskService.find(context, id); if (task == null) { throw new ResourceNotFoundException("ClaimedTask ID " + id + " not found"); } XmlWorkflowItem workflowItem = task.getWorkflowItem(); workflowService.deleteClaimedTask(context, workflowItem, task); workflowRequirementsService.removeClaimedUser(context, workflowItem, task.getOwner(), task.getStepID()); } catch (AuthorizeException e) { throw new RESTAuthorizationException(e); } catch (SQLException | IOException | WorkflowConfigurationException e) { throw new RuntimeException(e.getMessage(), e); } }
Source:
public static CompareHandlerService createFor(ICompareContainer container, Shell shell) { IServiceLocator serviceLocator = container.getServiceLocator(); if (serviceLocator != null) { IHandlerService service = (IHandlerService)serviceLocator.getService(IHandlerService.class); if (service != null) return new CompareHandlerService(container, null); } if (!PlatformUI.isWorkbenchRunning() && shell != null) { Expression e = new ActiveShellExpression(shell); return new CompareHandlerService(container, e); } if (container.getWorkbenchPart() == null && shell != null) { IHandlerService service = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); if (service != null) { Expression e = new ActiveShellExpression(shell); return new CompareHandlerService(container, e); } } return new CompareHandlerService(null, null); }

Target:
public static CompareHandlerService createFor(ICompareContainer container, Shell shell) { IServiceLocator serviceLocator = container.getServiceLocator(); if (serviceLocator != null) { IHandlerService service = serviceLocator.getService(IHandlerService.class); if (service != null) return new CompareHandlerService(container, null); } if (!PlatformUI.isWorkbenchRunning() && shell != null) { Expression e = new ActiveShellExpression(shell); return new CompareHandlerService(container, e); } if (container.getWorkbenchPart() == null && shell != null) { IHandlerService service = PlatformUI.getWorkbench().getService(IHandlerService.class); if (service != null) { Expression e = new ActiveShellExpression(shell); return new CompareHandlerService(container, e); } } return new CompareHandlerService(null, null); }
Source:
private void assertJsonErrorResponse(int expectedStatusCode, String expectedMessage, String response) throws IOException { try { ObjectMapper mapper = new ObjectMapper(); Map<?, ?> parseResponse = mapper.readValue(response, Map.class); String message = (String) parseResponse.get("message"); int statusCode = (Integer) parseResponse.get("statusCode"); assertEquals("statusCode", expectedStatusCode, statusCode); assertEquals("message", expectedMessage, message); } catch (JsonMappingException | JsonParseException e) { fail("Response did not parse as JSON. Response: " + response); } }

Target:
private void assertJsonErrorResponse(int expectedStatusCode, String expectedMessage, String response) throws IOException { try { Map<?, ?> parseResponse = MAPPER.readValue(response, Map.class); String message = (String) parseResponse.get("message"); int statusCode = (Integer) parseResponse.get("statusCode"); assertEquals("statusCode", expectedStatusCode, statusCode); assertEquals("message", expectedMessage, message); } catch (JsonMappingException | JsonParseException e) { fail("Response did not parse as JSON. Response: " + response); } }
Source:
public ArrayList<ItemGroup> findByCrfVersionId(Integer crfVersionId) { org.hibernate.Query q = getCurrentSession().createSQLQuery(findAllByCrfVersionIdQuery).addEntity(ItemGroup.class); q.setInteger("crfversionid", crfVersionId.intValue()); return (ArrayList<ItemGroup>) q.list(); }

Target:
public ArrayList<ItemGroup> findByCrfVersionId(Integer crfVersionId) { Query q = getCurrentSession().createSQLQuery(findAllByCrfVersionIdQuery).addEntity(ItemGroup.class); q.setInteger("crfversionid", crfVersionId.intValue()); return (ArrayList<ItemGroup>) q.list(); }
Source:
public void testReceiveAtomFeedWithEntryHavingBeenUpdatedAfterPublishAndRepeatWithPersistentMetadataStore() throws Exception { URL url = new URL("file:src/test/java/org/springframework/integration/feed/atom.xml"); FeedEntryMessageSource feedEntrySource = new FeedEntryMessageSource(url, "foo", this.feedFetcher); feedEntrySource.setBeanName("feedReader"); PropertiesPersistingMetadataStore metadataStore = new PropertiesPersistingMetadataStore(); metadataStore.afterPropertiesSet(); feedEntrySource.setMetadataStore(metadataStore); feedEntrySource.setBeanFactory(mock(BeanFactory.class)); feedEntrySource.afterPropertiesSet(); SyndEntry entry1 = feedEntrySource.receive().getPayload(); assertNull(feedEntrySource.receive()); assertEquals("Atom draft-07 snapshot", entry1.getTitle().trim()); assertEquals(1071318569000L, entry1.getPublishedDate().getTime()); assertEquals(1122812969000L, entry1.getUpdatedDate().getTime()); metadataStore.destroy(); metadataStore.afterPropertiesSet(); feedEntrySource = new FeedEntryMessageSource(url, "foo", this.feedFetcher); feedEntrySource.setBeanName("feedReader"); metadataStore = new PropertiesPersistingMetadataStore(); metadataStore.afterPropertiesSet(); feedEntrySource.setMetadataStore(metadataStore); feedEntrySource.setBeanFactory(mock(BeanFactory.class)); feedEntrySource.afterPropertiesSet(); assertNull(feedEntrySource.receive()); }

Target:
public void testReceiveAtomFeedWithEntryHavingBeenUpdatedAfterPublishAndRepeatWithPersistentMetadataStore() throws Exception { URL url = new ClassPathResource("org/springframework/integration/feed/atom.xml").getURL(); FeedEntryMessageSource feedEntrySource = new FeedEntryMessageSource(url, "foo", this.feedFetcher); feedEntrySource.setBeanName("feedReader"); PropertiesPersistingMetadataStore metadataStore = new PropertiesPersistingMetadataStore(); metadataStore.afterPropertiesSet(); feedEntrySource.setMetadataStore(metadataStore); feedEntrySource.setBeanFactory(mock(BeanFactory.class)); feedEntrySource.afterPropertiesSet(); SyndEntry entry1 = feedEntrySource.receive().getPayload(); assertNull(feedEntrySource.receive()); assertEquals("Atom draft-07 snapshot", entry1.getTitle().trim()); assertEquals(1071318569000L, entry1.getPublishedDate().getTime()); assertEquals(1122812969000L, entry1.getUpdatedDate().getTime()); metadataStore.destroy(); metadataStore.afterPropertiesSet(); feedEntrySource = new FeedEntryMessageSource(url, "foo", this.feedFetcher); feedEntrySource.setBeanName("feedReader"); metadataStore = new PropertiesPersistingMetadataStore(); metadataStore.afterPropertiesSet(); feedEntrySource.setMetadataStore(metadataStore); feedEntrySource.setBeanFactory(mock(BeanFactory.class)); feedEntrySource.afterPropertiesSet(); assertNull(feedEntrySource.receive()); }
Source:
public IImsRegistration getRegistration() { return getTelephonyManager(mContext).getImsRegistration(mSlotId, ImsFeature.MMTEL); }

Target:
public @Nullable IImsRegistration getRegistration() { TelephonyManager tm = getTelephonyManager(mContext); return tm != null ? tm.getImsRegistration(mSlotId, ImsFeature.MMTEL) : null; }
Source:
private void initializeCategories(int variableIndex, SPSSVariable variable, ValueType valueType, Variable.Builder builder) throws SpssInvalidCharacterException { if(variable.categoryMap != null) { for(String category : variable.categoryMap.keySet()) { Value categoryName = new SpssCategoryNameValueFactory(category, variableIndex, variable, valueType).create(); SPSSVariableCategory spssCategory = variable.categoryMap.get(category); validate(spssCategory.label); builder.addCategory(Category.Builder.newCategory(categoryName.getValue().toString()).addAttribute( Attribute.Builder.newAttribute("label").withValue(spssCategory.label).withLocale(new Locale(locale)) .build()).missing(isCategoryValueMissingCode(variable, spssCategory)).build()); } } }

Target:
private void initializeCategories(int variableIndex, SPSSVariable variable, ValueType valueType, Variable.Builder builder) throws SpssInvalidCharacterException { if(variable.categoryMap != null) { for(String category : variable.categoryMap.keySet()) { Value categoryName = new SpssCategoryNameValueFactory(category, variableIndex, variable, valueType).create(); SPSSVariableCategory spssCategory = variable.categoryMap.get(category); validate(spssCategory.label); builder.addCategory(Category.Builder.newCategory(categoryName.getValue().toString()) .addAttribute(addLabelAttribute(spssCategory.label)) .missing(isCategoryValueMissingCode(variable, spssCategory)).build()); } } }
Source:
private ResponseEntity postEventInternal(final String eventTypeName, final String eventsAsString, final NativeWebRequest nativeWebRequest, final EventTypeMetrics eventTypeMetrics, final Client client) throws AccessDeniedException, ServiceTemporarilyUnavailableException, InternalNakadiException, EventTypeTimeoutException, NoSuchEventTypeException { final long startingNanos = System.nanoTime(); try { final EventPublishResult result = publisher.publish(eventsAsString, eventTypeName); final int eventCount = result.getResponses().size(); final int totalSizeBytes = eventsAsString.getBytes(Charsets.UTF_8).length; reportMetrics(eventTypeMetrics, result, totalSizeBytes, eventCount); reportSLOs(startingNanos, totalSizeBytes, eventCount, result, eventTypeName, client); return response(result); } catch (final JSONException e) { LOG.debug("Problem parsing event", e); throw e; } catch (final NoSuchEventTypeException e) { LOG.debug("Event type not found.", e.getMessage()); throw e; } catch (final EventTypeTimeoutException e) { LOG.debug("Failed to publish batch", e); throw e; } finally { eventTypeMetrics.updateTiming(startingNanos, System.nanoTime()); } }

Target:
private ResponseEntity postEventInternal(final String eventTypeName, final String eventsAsString, final NativeWebRequest nativeWebRequest, final EventTypeMetrics eventTypeMetrics, final Client client) throws AccessDeniedException, ServiceTemporarilyUnavailableException, InternalNakadiException, EventTypeTimeoutException, NoSuchEventTypeException { final long startingNanos = System.nanoTime(); try { final EventPublishResult result = publisher.publish(eventsAsString, eventTypeName); final int eventCount = result.getResponses().size(); final int totalSizeBytes = eventsAsString.getBytes(Charsets.UTF_8).length; reportMetrics(eventTypeMetrics, result, totalSizeBytes, eventCount); reportSLOs(startingNanos, totalSizeBytes, eventCount, result, eventTypeName, client); return response(result); } finally { eventTypeMetrics.updateTiming(startingNanos, System.nanoTime()); } }
Source:
public Drawable getDrawable(Context context) { final PackageManager packageManager = context.getPackageManager(); Resources resources; try { if (shortcutPojo.icon != null) { return new BitmapDrawable(shortcutPojo.icon); } resources = packageManager.getResourcesForApplication(shortcutPojo.packageName); final int id = resources.getIdentifier(shortcutPojo.resourceName, null, null); return resources.getDrawable(id); } catch (NameNotFoundException e) { } return null; }

Target:
public Drawable getDrawable(Context context) { final PackageManager packageManager = context.getPackageManager(); Resources resources; if (shortcutPojo.icon != null) { return new BitmapDrawable(shortcutPojo.icon); } try { resources = packageManager.getResourcesForApplication(shortcutPojo.packageName); final int id = resources.getIdentifier(shortcutPojo.resourceName, null, null); return resources.getDrawable(id); } catch (NameNotFoundException e) { } return null; }
Source:
public Map<String, String> getCustomValues() { if(getParameters().getVolumeOption() != null) { addCustomValue(GlusterConstants.OPTION_KEY, getParameters().getVolumeOption().getKey()); addCustomValue(GlusterConstants.OPTION_VALUE, getParameters().getVolumeOption().getValue()); } return super.getCustomValues(); }

Target:
public Map<String, String> getCustomValues() { if(getParameters().getVolumeOption() != null) { addCustomValue(GlusterConstants.OPTION_KEY, getParameters().getVolumeOption().getKey()); if(getParameters().getVolumeOption().getValue() != null) { addCustomValue(GlusterConstants.OPTION_VALUE, getParameters().getVolumeOption().getValue()); } else { addCustomValue(GlusterConstants.OPTION_VALUE, ""); } } return super.getCustomValues(); }
Source:
protected byte[] fetchBinaryContent(String url, IProgressMonitor monitor) throws GerritException { final TypeToken<Byte[]> byteArrayType = new TypeToken<Byte[]>() { }; byte[] bin = restClient.executeGetRestRequestBinary("/cat/" + url, byteArrayType.getType(), monitor); if (isZippedContent(bin)) { return unzip(bin); } else { return bin; } }

Target:
protected byte[] fetchBinaryContent(String url, IProgressMonitor monitor) throws GerritException { final TypeToken<Byte[]> byteArrayType = new TypeToken<Byte[]>() { }; byte[] bin = restClient.executeGetRestRequest("/cat/" + url, byteArrayType.getType(), monitor); if (isZippedContent(bin)) { return unzip(bin); } else { return bin; } }
Source:
public DnsZoneImpl withETagCheck() { this.eTagState.withImplicitETagCheckOnCreate(); this.eTagState.withImplicitETagCheckOnUpdate(); return this; }

Target:
public DnsZoneImpl withETagCheck() { this.eTagState.withImplicitETagCheckOnCreateOrUpdate(this.isInCreateMode()); return this; }
Source:
public boolean isValid() { try { return accessMethod.getConnection().isValid(1); } catch (SQLException e) { LOGGER.warn("Error checking connection validity", e); return false; } }

Target:
public boolean isValid() { try { return accessMethod.getConnection().isValid(1); } catch (SQLException e) { LOGGER.debug("Error checking connection validity", e); return false; } }
Source:
public static Set<String> normalizedLinuxClassifiers() { return Collections.unmodifiableSet(LINUX_OS_CLASSIFIERS); }

Target:
public static Set<String> normalizedLinuxClassifiers() { return LINUX_OS_CLASSIFIERS; }
Source:
public void assertConstructor() { TestSimpleJob testSimpleJob = new TestSimpleJob(); taskExecutor = new TaskExecutor(testSimpleJob); Field fieldElasticJob = TaskExecutor.class.getDeclaredField("elasticJob"); fieldElasticJob.setAccessible(true); Field fieldElasticJobType = TaskExecutor.class.getDeclaredField("elasticJobType"); fieldElasticJobType.setAccessible(true); assertTrue(fieldElasticJob.get(taskExecutor) == testSimpleJob); assertNull(fieldElasticJobType.get(taskExecutor)); taskExecutor = new TaskExecutor("simpleJob"); assertEquals("simpleJob", fieldElasticJobType.get(taskExecutor)); assertNull(fieldElasticJob.get(taskExecutor)); }

Target:
public void assertConstructor() { TestSimpleJob testSimpleJob = new TestSimpleJob(); taskExecutor = new TaskExecutor(testSimpleJob); Field fieldElasticJob = TaskExecutor.class.getDeclaredField("elasticJob"); fieldElasticJob.setAccessible(true); Field fieldElasticJobType = TaskExecutor.class.getDeclaredField("elasticJobType"); fieldElasticJobType.setAccessible(true); assertTrue(fieldElasticJob.get(taskExecutor) == testSimpleJob); assertNull(fieldElasticJobType.get(taskExecutor)); taskExecutor = new TaskExecutor("simpleJob"); assertThat(fieldElasticJobType.get(taskExecutor), is("simpleJob")); assertNull(fieldElasticJob.get(taskExecutor)); }
Source:
public CSVToJSONDataConverter(Configuration config) { this.logger = Logging.getLogger(getClass()); fieldNames = config.readList(FIELDS_KEY, String.class); delimiter = config.readString(DELIMITER_KEY, ","); jsonProducer = ProcessingUtilsFactory.getPrinter(config); }

Target:
public CSVToJSONDataConverter(Configuration config) { fieldNames = config.readList(FIELDS_KEY, String.class); delimiter = config.readString(DELIMITER_KEY, ","); jsonProducer = ProcessingUtilsFactory.getPrinter(config); }
Source:
public GetDeviceListQueryParameters(Guid vdsId, StorageType storageType, boolean checkStatus, List<String> lunIds) { this(vdsId, storageType, checkStatus, lunIds, false); }

Target:
public GetDeviceListQueryParameters(Guid vdsId, StorageType storageType, boolean checkStatus, List<String> lunIds) { super(vdsId); setStorageType(storageType); setCheckStatus(checkStatus); setLunIds(lunIds); }
Source:
public void update(int targetIdx) { if (this.targetIdx == targetIdx) { return; } if (logger.isDebugEnabled()) { long ssrc = weakSource.get().getRTPEncodings()[0].getPrimarySSRC(); logger.debug("target_update ssrc=" + ssrc + ",target=" + targetIdx); } this.targetIdx = targetIdx; if (targetIdx < 0) { transformState = dropState; } else { MediaStreamTrackDesc sourceTrack = weakSource.get(); if (sourceTrack == null) { return; } ((RTPTranslatorImpl) sourceTrack.getMediaStreamTrackReceiver() .getStream().getRTPTranslator()) .getRtcpFeedbackMessageSender().sendFIR((int) targetSSRC); } }

Target:
public void update(int targetIdx) { if (this.targetIdx == targetIdx) { return; } if (logger.isInfoEnabled()) { MediaStreamTrackDesc sourceTrack = weakSource.get(); if (sourceTrack != null) { RTPEncodingDesc[] sourceEncodings = sourceTrack.getRTPEncodings(); if (!ArrayUtils.isNullOrEmpty(sourceEncodings)) { long ssrc = sourceEncodings[0].getPrimarySSRC(); logger.info("target_update ssrc=" + ssrc + ",new_target=" + targetIdx + ",old_target=" + this.targetIdx); } } } this.targetIdx = targetIdx; if (targetIdx < 0) { transformState = dropState; } else { MediaStreamTrackDesc sourceTrack = weakSource.get(); if (sourceTrack == null) { return; } ((RTPTranslatorImpl) sourceTrack.getMediaStreamTrackReceiver() .getStream().getRTPTranslator()) .getRtcpFeedbackMessageSender().sendFIR((int) targetSSRC); } }
Source:
public void should_not_include_ECOM_BILLTO_POSTAL_STREET_LINE1_if_address_line1_not_provided() { authCardDetails.setAddress(address); List<NameValuePair> result = epdqPayloadDefinitionFor3ds2NewOrder.extract(epdqTemplateData); assertThat(result, not(hasItem(new BasicNameValuePair(EpdqPayloadDefinitionForNew3ds2Order.ECOM_BILLTO_POSTAL_STREET_LINE1, "The Money Pool")))); }

Target:
public void should_not_include_ECOM_BILLTO_POSTAL_STREET_LINE1_if_address_line1_not_provided() { authCardDetails.setAddress(address); List<NameValuePair> result = epdqPayloadDefinitionFor3ds2NewOrder.extract(epdqTemplateData); assertThat(result, not(containsNameValuePairWithName(EpdqPayloadDefinitionForNew3ds2Order.ECOM_BILLTO_POSTAL_STREET_LINE1))); }
Source:
public synchronized void resume() { m_isPaused = false; }

Target:
public void resume() { m_isPaused = false; }
Source:
public static boolean removeRejoinNodeIndicator(ZooKeeper zk, String node) { try { ZKUtil.deleteRecursively(zk, node); } catch (KeeperException e) { if (e.code() != KeeperException.Code.NONODE) { return false; } } catch (InterruptedException e) { return false; } return true; }

Target:
public static boolean removeRejoinNodeIndicator(ZooKeeper zk, String node) { try { zk.delete(node, -1); } catch (KeeperException e) { if (e.code() != KeeperException.Code.NONODE) { return false; } } catch (InterruptedException e) { return false; } return true; }
Source:
public void createContract(DataWord value, DataWord memStart, DataWord memSize) { returnDataBuffer = null; byte[] senderAddress = this.getOwnerAddress().getLast20Bytes(); BigInteger endowment = value.value(); if (!verifyCall(senderAddress, endowment)) return;; byte[] nonce = getStorage().getNonce(senderAddress).toByteArray(); byte[] contractAddress = HashUtil.calcNewAddr(senderAddress, nonce); byte[] programCode = memoryChunk(memStart.intValue(), memSize.intValue()); createContractImpl(value, programCode, contractAddress); }

Target:
public void createContract(DataWord value, DataWord memStart, DataWord memSize) { returnDataBuffer = null; byte[] senderAddress = this.getOwnerAddress().getLast20Bytes(); BigInteger endowment = value.value(); if (!verifyCall(senderAddress, endowment)) return; byte[] nonce = getStorage().getNonce(senderAddress).toByteArray(); byte[] contractAddress = HashUtil.calcNewAddr(senderAddress, nonce); byte[] programCode = memoryChunk(memStart.intValue(), memSize.intValue()); createContractImpl(value, programCode, contractAddress); }
Source:
private void updateExpirationTime(long update) { do { long current = this.expirationTime; if (current >= update) { break; } if (EXPIRATIONTIME_UPDATER.compareAndSet(this, current, update)) { break; } } while (true); }

Target:
private void updateExpirationTime(long update) { while (true) { long current = this.expirationTime; if (current >= update) { break; } if (EXPIRATIONTIME_UPDATER.compareAndSet(this, current, update)) { break; } }; }
Source:
protected void executeCommand() { ManagedBlockStorage managedBlockStorage = cinderStorageDao.get(getParameters().getStorageDomainId()); Guid volumeId = Guid.newGuid(); List<String> extraParams = new ArrayList<>(); extraParams.add(volumeId.toString()); Number sizeInGiB = SizeConverter.convert(getParameters().getDiskInfo().getSize(), SizeConverter.SizeUnit.BYTES, SizeConverter.SizeUnit.GiB); extraParams.add(Long.toString(sizeInGiB.longValue())); CinderlibReturnValue returnValue; try { CinderlibCommandParameters params = new CinderlibCommandParameters(JsonHelper.mapToJson( createDriverOptions(managedBlockStorage.getDriverOptions(), managedBlockStorage.getDriverSensitiveOptions()), false), extraParams); returnValue = cinderlibExecutor.runCommand(CinderlibCommand.CREATE_VOLUME, params); } catch (Exception e) { log.error("Failed executing volume creation", e); return; } if (!returnValue.getSucceed()) { return; } saveDisk(volumeId); getReturnValue().setActionReturnValue(volumeId); setSucceeded(true); }

Target:
protected void executeCommand() { ManagedBlockStorage managedBlockStorage = cinderStorageDao.get(getParameters().getStorageDomainId()); Guid volumeId = Guid.newGuid(); List<String> extraParams = new ArrayList<>(); extraParams.add(volumeId.toString()); Number sizeInGiB = SizeConverter.convert(getParameters().getDiskInfo().getSize(), SizeConverter.SizeUnit.BYTES, SizeConverter.SizeUnit.GiB); extraParams.add(Long.toString(sizeInGiB.longValue())); CinderlibReturnValue returnValue; try { CinderlibCommandParameters params = new CinderlibCommandParameters(JsonHelper.mapToJson( managedBlockStorage.getAllDriverOptions(), false), extraParams); returnValue = cinderlibExecutor.runCommand(CinderlibCommand.CREATE_VOLUME, params); } catch (Exception e) { log.error("Failed executing volume creation", e); return; } if (!returnValue.getSucceed()) { return; } saveDisk(volumeId); getReturnValue().setActionReturnValue(volumeId); setSucceeded(true); }
Source:
public static BlobData deserializeBlobRecord(CrcInputStream crcStream) throws IOException, MessageFormatException { DataInputStream dataStream = new DataInputStream(crcStream); long dataSize = dataStream.readLong(); if (dataSize > Integer.MAX_VALUE) { throw new IOException("We only support data of max size == MAX_INT. Error while reading blob from store"); } ByteBufferInputStream output = getByteBufferInputStreamForBlobRecord(crcStream, (int) dataSize); long crc = crcStream.getValue(); long streamCrc = dataStream.readLong(); if (crc != streamCrc) { logger.error("corrupt data while parsing blob content expectedcrc actualcrc {}", crc, streamCrc); throw new MessageFormatException("corrupt data while parsing blob content", MessageFormatErrorCodes.Data_Corrupt); } return new BlobData(BlobType.DataBlob, dataSize, output); }

Target:
public static BlobData deserializeBlobRecord(CrcInputStream crcStream) throws IOException, MessageFormatException { DataInputStream dataStream = new DataInputStream(crcStream); long dataSize = dataStream.readLong(); if (dataSize > Integer.MAX_VALUE) { throw new IOException("We only support data of max size == MAX_INT. Error while reading blob from store"); } ByteBufferInputStream output = getByteBufferInputStreamForBlobRecord(crcStream, dataSize); long crc = crcStream.getValue(); long streamCrc = dataStream.readLong(); if (crc != streamCrc) { logger.error("corrupt data while parsing blob content expectedcrc actualcrc {}", crc, streamCrc); throw new MessageFormatException("corrupt data while parsing blob content", MessageFormatErrorCodes.Data_Corrupt); } return new BlobData(BlobType.DataBlob, dataSize, output); }
Source:
protected void onAnimationEnd() { final double newZoom = mMapView.mTargetZoomLevel.get(); final Projection newProjection = mMapView.getProjection().getOffspring( newZoom, mMapView.getProjection().getScreenRect()); final IGeoPoint newCenter = newProjection.fromPixels( Math.round(mMapView.mMultiTouchScalePoint.x), Math.round(mMapView.mMultiTouchScalePoint.y)); mMapView.mIsAnimating.set(false); setCenter(newCenter); setZoom(newZoom); mMapView.mMultiTouchScale = 1f; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mCurrentAnimator = null; } if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mMapView.clearAnimation(); mZoomInAnimationOld.reset(); mZoomOutAnimationOld.reset(); } }

Target:
protected void onAnimationEnd() { final GeoPoint currentCenter = mMapView.getProjection().getCurrentCenter(); final double newZoom = mMapView.mTargetZoomLevel.get(); mMapView.mIsAnimating.set(false); setZoom(newZoom); mMapView.setCenter(currentCenter); mMapView.mMultiTouchScale = 1f; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mCurrentAnimator = null; } if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mMapView.clearAnimation(); mZoomInAnimationOld.reset(); mZoomOutAnimationOld.reset(); } }
Source:
public void writeSiteinfo(Siteinfo info) throws IOException { XmlWriter writer = this.writer; writer.openElement("siteinfo"); writer.textElement("sitename", info.Sitename); writer.textElement("dbname", info.Dbname); writer.textElement("base", info.Base); writer.textElement("generator", info.Generator); writer.textElement("case", info.Case); writer.openElement("namespaces"); for (Iterator<Map.Entry<Integer, Namespace>> i = info.Namespaces.orderedEntries(); i.hasNext();) { Map.Entry<Integer, Namespace> e = i.next(); ArrayList<String[]> textAttribs = new ArrayList<String[]>(); textAttribs.add(new String[] {"key", e.getKey().toString()}); if (e.getValue().Case != null) { textAttribs.add(new String[] {"case", e.getValue().Case}); } writer.textElement("namespace", e.getValue().Prefix, textAttribs.toArray(new String[][] {}) ); } writer.closeElement(); writer.closeElement(); }

Target:
public void writeSiteinfo(Siteinfo info) throws IOException { XmlWriter writer = this.writer; writer.openElement("siteinfo"); writer.textElement("sitename", info.Sitename); if (info.Dbname != null) { writer.textElement("dbname", info.Dbname); } writer.textElement("base", info.Base); writer.textElement("generator", info.Generator); writer.textElement("case", info.Case); writer.openElement("namespaces"); for (Iterator<Map.Entry<Integer, Namespace>> i = info.Namespaces.orderedEntries(); i.hasNext();) { Map.Entry<Integer, Namespace> e = i.next(); ArrayList<String[]> textAttribs = new ArrayList<String[]>(); textAttribs.add(new String[] {"key", e.getKey().toString()}); if (e.getValue().Case != null) { textAttribs.add(new String[] {"case", e.getValue().Case}); } writer.textElement("namespace", e.getValue().Prefix, textAttribs.toArray(new String[][] {}) ); } writer.closeElement(); writer.closeElement(); }
Source:
public void testClearRecordList() { long record = 1; long record2 = 2; long record3 = 3; List<Long> recordsList = new ArrayList<Long>(); recordsList.add(record); recordsList.add(record2); client.add("a", 1, record); client.add("a", 2, record); client.add("a", 3, record); client.add("b", 1, record); client.add("b", 2, record); client.add("b", 3, record); client.add("c", 1, record2); client.add("c", 2, record2); client.add("c", 3, record2); client.add("d", 1, record3); client.add("d", 2, record3); client.add("d", 3, record3); client.clear(recordsList); Assert.assertEquals(client.browse(record), client.browse(record2)); Assert.assertFalse(client.browse(record3).isEmpty()); }

Target:
public void testClearRecordList() { long record = 1; long record2 = 2; long record3 = 3; List<Long> recordsList = new ArrayList<Long>(); recordsList.add(record); recordsList.add(record2); client.add("a", 1, record); client.add("a", 2, record); client.add("a", 3, record); client.add("b", 1, record); client.add("b", 2, record); client.add("b", 3, record); client.add("c", 1, record2); client.add("c", 2, record2); client.add("c", 3, record2); client.add("d", 1, record3); client.add("d", 2, record3); client.add("d", 3, record3); client.clear(recordsList); Assert.assertEquals(client.browse(record).isEmpty(), client.browse(record2).isEmpty()); Assert.assertFalse(client.browse(record3).isEmpty()); }
Source:
public List<Notification> getNotifications(boolean archived) { CustomApiResult notificationNode = null; try { if (archived) { notificationNode = api.action("query") .param("notprop", "list") .param("format", "xml") .param("meta", "notifications") .param("notformat", "model") .param("notwikis", "wikidatawiki|commonswiki|enwiki") .param("notfilter", "read") .get() .getNode("/api/query/notifications/list"); }else { notificationNode = api.action("query") .param("notprop", "list") .param("format", "xml") .param("meta", "notifications") .param("notformat", "model") .param("notwikis", "wikidatawiki|commonswiki|enwiki") .param("notfilter", "!read") .get() .getNode("/api/query/notifications/list"); } } catch (IOException e) { Timber.e(e, "Failed to obtain searchCategories"); } if (notificationNode == null || notificationNode.getDocument() == null || notificationNode.getDocument().getChildNodes() == null || notificationNode.getDocument().getChildNodes().getLength() == 0) { return new ArrayList<>(); } NodeList childNodes = notificationNode.getDocument().getChildNodes(); return NotificationUtils.getNotificationsFromList(context, childNodes); }

Target:
public List<Notification> getNotifications(boolean archived) { CustomApiResult notificationNode = null; String notfilter; try { if (archived) { notfilter = "read"; }else { notfilter = "!read"; } notificationNode = api.action("query") .param("notprop", "list") .param("format", "xml") .param("meta", "notifications") .param("notformat", "model") .param("notwikis", "wikidatawiki|commonswiki|enwiki") .param("notfilter", notfilter) .get() .getNode("/api/query/notifications/list"); } catch (IOException e) { Timber.e(e, "Failed to obtain searchCategories"); } if (notificationNode == null || notificationNode.getDocument() == null || notificationNode.getDocument().getChildNodes() == null || notificationNode.getDocument().getChildNodes().getLength() == 0) { return new ArrayList<>(); } NodeList childNodes = notificationNode.getDocument().getChildNodes(); return NotificationUtils.getNotificationsFromList(context, childNodes); }