You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2016/11/20 12:42:49 UTC
[4/4] marmotta git commit: more code hygiene,
clean up redundant or unnecessary code
more code hygiene, clean up redundant or unnecessary code
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/f45e3ddd
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/f45e3ddd
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/f45e3ddd
Branch: refs/heads/develop
Commit: f45e3ddd6ca48001c90b643b9d931f1261eb7085
Parents: 7160bd1
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Sun Nov 20 13:42:36 2016 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Sun Nov 20 13:42:37 2016 +0100
----------------------------------------------------------------------
.../commons/sesame/rio/ical/ICalFormat.java | 3 +-
.../commons/sesame/rio/rss/RSSFormat.java | 3 +-
.../commons/sesame/rio/vcard/VCardFormat.java | 3 +-
.../commons/sesame/rio/ical/ICalParser.java | 34 +++---
.../java/com/sun/syndication/feed/WireFeed.java | 8 +-
.../com/sun/syndication/feed/atom/Content.java | 2 +-
.../com/sun/syndication/feed/atom/Entry.java | 12 +-
.../com/sun/syndication/feed/atom/Feed.java | 10 +-
.../syndication/feed/impl/BeanIntrospector.java | 54 ++++-----
.../syndication/feed/impl/CloneableBean.java | 32 +++---
.../syndication/feed/impl/CopyFromHelper.java | 39 +++----
.../sun/syndication/feed/impl/ToStringBean.java | 20 ++--
.../syndication/feed/module/SyModuleImpl.java | 2 +-
.../feed/module/impl/ModuleUtils.java | 2 +-
.../com/sun/syndication/feed/rss/Channel.java | 23 ++--
.../java/com/sun/syndication/feed/rss/Item.java | 10 +-
.../syndication/feed/synd/SyndCategoryImpl.java | 12 +-
.../syndication/feed/synd/SyndEntryImpl.java | 12 +-
.../feed/synd/impl/ConverterForAtom03.java | 66 ++++-------
.../feed/synd/impl/ConverterForAtom10.java | 53 +++++----
.../feed/synd/impl/ConverterForRSS090.java | 8 +-
.../feed/synd/impl/ConverterForRSS092.java | 30 +++--
.../com/sun/syndication/io/WireFeedInput.java | 48 +++-----
.../syndication/io/impl/Atom03Generator.java | 47 ++++----
.../sun/syndication/io/impl/Atom03Parser.java | 63 +++++-----
.../syndication/io/impl/Atom10Generator.java | 69 +++++------
.../sun/syndication/io/impl/Atom10Parser.java | 72 +++++-------
.../com/sun/syndication/io/impl/Base64.java | 6 +-
.../io/impl/BaseWireFeedGenerator.java | 12 +-
.../syndication/io/impl/BaseWireFeedParser.java | 34 +++---
.../syndication/io/impl/DCModuleGenerator.java | 12 +-
.../sun/syndication/io/impl/DCModuleParser.java | 17 ++-
.../syndication/io/impl/ModuleGenerators.java | 10 +-
.../sun/syndication/io/impl/ModuleParsers.java | 4 +-
.../sun/syndication/io/impl/NumberParser.java | 10 +-
.../sun/syndication/io/impl/PluginManager.java | 16 ++-
.../syndication/io/impl/PropertiesLoader.java | 14 +--
.../sun/syndication/io/impl/RSS090Parser.java | 6 +-
.../io/impl/RSS091UserlandGenerator.java | 13 +--
.../io/impl/RSS091UserlandParser.java | 22 ++--
.../syndication/io/impl/RSS092Generator.java | 4 +-
.../sun/syndication/io/impl/RSS092Parser.java | 24 ++--
.../sun/syndication/io/impl/RSS094Parser.java | 2 +-
.../sun/syndication/io/impl/RSS10Generator.java | 12 +-
.../sun/syndication/io/impl/RSS20Generator.java | 4 +-
.../sun/syndication/io/impl/XmlFixerReader.java | 4 +-
.../feed/module/base/io/CustomTagGenerator.java | 90 +++++++--------
.../feed/module/base/io/CustomTagParser.java | 114 +++++++++----------
.../module/base/io/GoogleBaseGenerator.java | 76 +++++--------
.../feed/module/base/io/GoogleBaseParser.java | 58 ++++------
.../feed/module/base/types/FloatUnit.java | 4 +-
.../feed/module/base/types/IntUnit.java | 4 +-
.../feed/module/cc/io/CCModuleGenerator.java | 51 +++++----
.../feed/module/cc/io/ModuleParserRSS1.java | 72 ++++++------
.../feed/module/cc/io/ModuleParserRSS2.java | 38 +++----
.../rometools/feed/module/cc/types/License.java | 5 +-
.../content/io/ContentModuleGenerator.java | 28 ++---
.../module/content/io/ContentModuleParser.java | 21 ++--
.../feed/module/georss/GMLGenerator.java | 20 ++--
.../rometools/feed/module/georss/GMLParser.java | 23 ++--
.../feed/module/georss/GeoRSSUtils.java | 2 +-
.../feed/module/georss/SimpleGenerator.java | 13 +--
.../feed/module/georss/SimpleParser.java | 7 +-
.../feed/module/georss/W3CGeoParser.java | 9 +-
.../feed/module/georss/geometries/Polygon.java | 9 +-
.../module/itunes/AbstractITunesObject.java | 4 +-
.../module/itunes/EntryInformationImpl.java | 2 +-
.../feed/module/itunes/FeedInformationImpl.java | 4 +-
.../feed/module/itunes/io/ITunesGenerator.java | 14 +--
.../feed/module/itunes/io/ITunesParser.java | 26 ++---
.../feed/module/itunes/types/Category.java | 4 +-
.../mediarss/io/MediaModuleGenerator.java | 66 +++++------
.../module/mediarss/io/MediaModuleParser.java | 16 +--
.../feed/module/mediarss/types/MediaGroup.java | 6 +-
.../impl/OpenSearchModuleGenerator.java | 32 +++---
.../opensearch/impl/OpenSearchModuleParser.java | 19 ++--
.../feed/module/photocast/io/Parser.java | 71 ++++++------
.../module/slash/io/SlashModuleGenerator.java | 7 +-
.../rometools/feed/module/sle/SleEntryImpl.java | 16 +--
.../feed/module/sle/io/ModuleParser.java | 46 ++++----
.../feed/module/sse/SSE091Generator.java | 11 +-
.../rometools/feed/module/sse/SSE091Parser.java | 30 ++---
.../feed/module/sse/modules/SSEModule.java | 5 +-
.../yahooweather/types/ConditionCode.java | 9 +-
.../commons/sesame/rio/vcard/VCardParser.java | 2 +-
.../ContextAwareSailConnection.java | 2 +-
.../transactions/model/TransactionData.java | 4 +-
.../sail/KiWiTransactionalSail.java | 2 +-
.../sesame/test/base/RdfStringMatcher.java | 4 +-
.../sesame/test/base/RepositoryMatcher.java | 6 +-
.../test/connection/HasStatementMatcher.java | 2 +-
.../sesame/test/sparql/SparqlAskMatcher.java | 2 +-
.../test/sparql/SparqlGraphQueryMatcher.java | 4 +-
.../test/sparql/SparqlTupleQueryMatcher.java | 4 +-
.../sesame/facading/impl/FacadingImpl.java | 12 +-
.../impl/FacadingInvocationHandler.java | 13 +--
.../facading/impl/FacadingInvocationHelper.java | 7 +-
.../sesame/facading/util/FacadeUtils.java | 9 +-
.../commons/sesame/filter/AllOfFilter.java | 3 +-
.../commons/sesame/filter/OneOfFilter.java | 3 +-
.../sesame/filter/resource/UriPrefixFilter.java | 2 +-
.../sesame/filter/resource/UriRegexFilter.java | 2 +-
.../commons/sesame/tripletable/TripleTable.java | 8 +-
103 files changed, 955 insertions(+), 1131 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java
index 0ff1bd8..20b1229 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java
@@ -20,6 +20,7 @@ import org.openrdf.rio.RDFFormat;
import java.nio.charset.Charset;
import java.util.Arrays;
+import java.util.Collections;
/**
* ICal Format is using ical4j for parsing.
@@ -61,7 +62,7 @@ public class ICalFormat {
*/
public static final RDFFormat FORMAT = new RDFFormat(
"ICal",
- Arrays.asList("text/calendar"),
+ Collections.singletonList("text/calendar"),
Charset.forName("UTF-8"),
Arrays.asList("ics", "ifb", "iCal", "iFBf"),
false,
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java
index eb25fbe..8c8e112 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java
@@ -20,6 +20,7 @@ import org.openrdf.rio.RDFFormat;
import java.nio.charset.Charset;
import java.util.Arrays;
+import java.util.Collections;
/**
* Add file description here!
@@ -33,7 +34,7 @@ public class RSSFormat {
"RSS",
Arrays.asList("application/rss+xml", "application/x-georss+xml"),
Charset.forName("UTF-8"),
- Arrays.asList("rss"),
+ Collections.singletonList("rss"),
false,
false
);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java
index 3e7adc6..2ccb7e1 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java
@@ -20,6 +20,7 @@ import org.openrdf.rio.RDFFormat;
import java.nio.charset.Charset;
import java.util.Arrays;
+import java.util.Collections;
/**
* Add file description here!
@@ -30,7 +31,7 @@ public class VCardFormat {
public static final RDFFormat FORMAT = new RDFFormat(
"VCard",
- Arrays.asList("text/vcard"),
+ Collections.singletonList("text/vcard"),
Charset.forName("UTF-8"),
Arrays.asList("vcf", "vcard"),
false,
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-ical/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-ical/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalParser.java b/commons/marmotta-sesame-tools/marmotta-rio-ical/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalParser.java
index d197f7c..be2ad38 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-ical/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-ical/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalParser.java
@@ -24,8 +24,6 @@ import net.fortuna.ical4j.model.Calendar;
import net.fortuna.ical4j.model.Property;
import net.fortuna.ical4j.model.component.*;
import net.fortuna.ical4j.model.property.*;
-
-import org.apache.marmotta.commons.sesame.rio.ical.ICalFormat;
import org.openrdf.model.Literal;
import org.openrdf.model.Resource;
import org.openrdf.model.URI;
@@ -340,13 +338,13 @@ public class ICalParser extends RDFParserBase {
createStringProperty(component,resource,Property.TRANSP, NS_ICAL + "transp");
URI p_attendee = createURI(NS_ICAL + "attendee");
- for(Iterator<Property> it = component.getProperties(Property.ATTENDEE).iterator(); it.hasNext(); ) {
- Attendee attendee = (Attendee) it.next();
- if(attendee.getCalAddress() != null) {
+ for (Property property4 : (Iterable<Property>) component.getProperties(Property.ATTENDEE)) {
+ Attendee attendee = (Attendee) property4;
+ if (attendee.getCalAddress() != null) {
URI v_attendee = createURI(attendee.getCalAddress().toString());
- rdfHandler.handleStatement(createStatement(resource,p_attendee,v_attendee));
+ rdfHandler.handleStatement(createStatement(resource, p_attendee, v_attendee));
} else {
- log.warn("attendee without calendar address: {}",attendee);
+ log.warn("attendee without calendar address: {}", attendee);
}
}
@@ -365,17 +363,17 @@ public class ICalParser extends RDFParserBase {
createUrlProperty(component,resource,Property.URL, NS_ICAL + "url");
createStringProperty(component,resource,Property.UID, NS_ICAL + "uid");
- for(Iterator<Property> it = component.getProperties(Property.EXDATE).iterator(); it.hasNext(); ) {
- createDateProperty(it.next(),resource, NS_ICAL + "exdate");
+ for (Property property3 : (Iterable<Property>) component.getProperties(Property.EXDATE)) {
+ createDateProperty(property3, resource, NS_ICAL + "exdate");
}
- for(Iterator<Property> it = component.getProperties(Property.EXRULE).iterator(); it.hasNext(); ) {
- createStringProperty(it.next(),resource, NS_ICAL + "exrule");
+ for (Property property2 : (Iterable<Property>) component.getProperties(Property.EXRULE)) {
+ createStringProperty(property2, resource, NS_ICAL + "exrule");
}
- for(Iterator<Property> it = component.getProperties(Property.RDATE).iterator(); it.hasNext(); ) {
- createDateProperty((DateProperty)it.next(),resource, NS_ICAL + "rdate");
+ for (Property property1 : (Iterable<Property>) component.getProperties(Property.RDATE)) {
+ createDateProperty((DateProperty) property1, resource, NS_ICAL + "rdate");
}
- for(Iterator<Property> it = component.getProperties(Property.RRULE).iterator(); it.hasNext(); ) {
- createStringProperty(it.next(),resource, NS_ICAL + "rrule");
+ for (Property property : (Iterable<Property>) component.getProperties(Property.RRULE)) {
+ createStringProperty(property, resource, NS_ICAL + "rrule");
}
if(component.getProperty(Property.TRIGGER) != null) {
@@ -466,9 +464,9 @@ public class ICalParser extends RDFParserBase {
} else if(property instanceof DateListProperty) {
DateListProperty dateProperty = (DateListProperty)property;
URI p_dateprop = createURI(rdfProperty);
- for(@SuppressWarnings("unchecked") Iterator<Date> it = dateProperty.getDates().iterator(); it.hasNext(); ) {
- Literal v_dateprop = valueFactory.createLiteral(getXMLCalendar(it.next(),dateProperty.getTimeZone()));
- rdfHandler.handleStatement(createStatement(r_event,p_dateprop,v_dateprop));
+ for (Date date : (Iterable<Date>) dateProperty.getDates()) {
+ Literal v_dateprop = valueFactory.createLiteral(getXMLCalendar(date, dateProperty.getTimeZone()));
+ rdfHandler.handleStatement(createStatement(r_event, p_dateprop, v_dateprop));
}
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/WireFeed.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/WireFeed.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/WireFeed.java
index 1799f9c..2c9849e 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/WireFeed.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/WireFeed.java
@@ -18,13 +18,13 @@
package com.sun.syndication.feed;
import com.sun.syndication.feed.impl.ObjectBean;
+import com.sun.syndication.feed.module.Extendable;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.feed.module.impl.ModuleUtils;
-import com.sun.syndication.feed.module.Extendable;
-import java.util.List;
-import java.util.ArrayList;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
/**
* Parent class of the RSS (Channel) and Atom (Feed) feed beans.
@@ -184,7 +184,7 @@ public abstract class WireFeed implements Cloneable, Serializable, Extendable {
*
*/
public List<Module> getModules() {
- return (_modules==null) ? (_modules=new ArrayList<Module>()) : _modules;
+ return (_modules==null) ? (_modules= new ArrayList<>()) : _modules;
}
/**
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Content.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Content.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Content.java
index 8e90181..7c2b91b 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Content.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Content.java
@@ -55,7 +55,7 @@ public class Content implements Cloneable,Serializable {
public static final String ESCAPED = "escaped";
private String _mode;
- private static final Set<String> MODES = new HashSet<String>();
+ private static final Set<String> MODES = new HashSet<>();
static {
MODES.add(XML);
MODES.add(BASE64);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Entry.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Entry.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Entry.java
index 848188d..1e5174b 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Entry.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Entry.java
@@ -22,10 +22,8 @@ import com.sun.syndication.feed.module.Module;
import com.sun.syndication.feed.module.impl.ModuleUtils;
import java.io.Serializable;
-
import java.util.ArrayList;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
@@ -100,7 +98,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
*
*/
public List<Person> getAuthors() {
- return (_authors == null) ? (_authors = new ArrayList<Person>()) : _authors;
+ return (_authors == null) ? (_authors = new ArrayList<>()) : _authors;
}
/**
@@ -140,7 +138,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
* an empty list if none.
*/
public List<Content> getContents() {
- return (_contents == null) ? (_contents = new ArrayList<Content>()) : _contents;
+ return (_contents == null) ? (_contents = new ArrayList<>()) : _contents;
}
/**
@@ -250,9 +248,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
boolean mediaEntry = false;
List links = getOtherLinks();
- for (Iterator<Link> it = links.iterator(); it.hasNext();) {
- Link link = it.next();
-
+ for (Link link : (Iterable<Link>) links) {
if ("edit-media".equals(link.getRel())) {
mediaEntry = true;
@@ -330,7 +326,7 @@ public class Entry implements Cloneable, Serializable, Extendable {
* an empty list if none.
*/
public List<Link> getOtherLinks() {
- return (_otherLinks == null) ? (_otherLinks = new ArrayList<Link>()) : _otherLinks;
+ return (_otherLinks == null) ? (_otherLinks = new ArrayList<>()) : _otherLinks;
}
/**
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Feed.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Feed.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Feed.java
index e79b81b..7c7f7bf 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Feed.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/atom/Feed.java
@@ -141,7 +141,7 @@ public class Feed extends WireFeed {
* an empty list if none.
*/
public List<Link> getAlternateLinks() {
- return (_alternateLinks==null) ? (_alternateLinks=new ArrayList<Link>()) : _alternateLinks;
+ return (_alternateLinks==null) ? (_alternateLinks= new ArrayList<>()) : _alternateLinks;
}
/**
@@ -181,7 +181,7 @@ public class Feed extends WireFeed {
*
*/
public List<Person> getAuthors() {
- return (_authors==null) ? (_authors=new ArrayList<Person>()) : _authors;
+ return (_authors==null) ? (_authors= new ArrayList<>()) : _authors;
}
/**
@@ -202,7 +202,7 @@ public class Feed extends WireFeed {
*
*/
public List<Person> getContributors() {
- return (_contributors==null) ? (_contributors=new ArrayList<Person>()) : _contributors;
+ return (_contributors==null) ? (_contributors= new ArrayList<>()) : _contributors;
}
/**
@@ -336,7 +336,7 @@ public class Feed extends WireFeed {
*
*/
public List<Entry> getEntries() {
- return (_entries==null) ? (_entries=new ArrayList<Entry>()) : _entries;
+ return (_entries==null) ? (_entries= new ArrayList<>()) : _entries;
}
/**
@@ -358,7 +358,7 @@ public class Feed extends WireFeed {
*
*/
public List<Module> getModules() {
- return (_modules==null) ? (_modules=new ArrayList<Module>()) : _modules;
+ return (_modules==null) ? (_modules= new ArrayList<>()) : _modules;
}
/**
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/BeanIntrospector.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/BeanIntrospector.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/BeanIntrospector.java
index dded484..24ed030 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/BeanIntrospector.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/BeanIntrospector.java
@@ -60,33 +60,30 @@ public class BeanIntrospector {
private static Map getPDs(Method[] methods,boolean setters) throws IntrospectionException {
Map pds = new HashMap();
- for (int i=0;i<methods.length;i++) {
+ for (Method method : methods) {
String pName = null;
PropertyDescriptor pDescriptor = null;
- if ((methods[i].getModifiers()&Modifier.PUBLIC)!=0) {
+ if ((method.getModifiers() & Modifier.PUBLIC) != 0) {
if (setters) {
- if (methods[i].getName().startsWith(SETTER) &&
- methods[i].getReturnType()==void.class && methods[i].getParameterTypes().length==1) {
- pName = Introspector.decapitalize(methods[i].getName().substring(3));
- pDescriptor = new PropertyDescriptor(pName,null,methods[i]);
+ if (method.getName().startsWith(SETTER) &&
+ method.getReturnType() == void.class && method.getParameterTypes().length == 1) {
+ pName = Introspector.decapitalize(method.getName().substring(3));
+ pDescriptor = new PropertyDescriptor(pName, null, method);
}
- }
- else {
- if (methods[i].getName().startsWith(GETTER) &&
- methods[i].getReturnType()!=void.class && methods[i].getParameterTypes().length==0) {
- pName = Introspector.decapitalize(methods[i].getName().substring(3));
- pDescriptor = new PropertyDescriptor(pName,methods[i],null);
- }
- else
- if (methods[i].getName().startsWith(BOOLEAN_GETTER) &&
- methods[i].getReturnType()==boolean.class && methods[i].getParameterTypes().length==0) {
- pName = Introspector.decapitalize(methods[i].getName().substring(2));
- pDescriptor = new PropertyDescriptor(pName,methods[i],null);
+ } else {
+ if (method.getName().startsWith(GETTER) &&
+ method.getReturnType() != void.class && method.getParameterTypes().length == 0) {
+ pName = Introspector.decapitalize(method.getName().substring(3));
+ pDescriptor = new PropertyDescriptor(pName, method, null);
+ } else if (method.getName().startsWith(BOOLEAN_GETTER) &&
+ method.getReturnType() == boolean.class && method.getParameterTypes().length == 0) {
+ pName = Introspector.decapitalize(method.getName().substring(2));
+ pDescriptor = new PropertyDescriptor(pName, method, null);
}
}
}
- if (pName!=null) {
- pds.put(pName,pDescriptor);
+ if (pName != null) {
+ pds.put(pName, pDescriptor);
}
}
return pds;
@@ -95,25 +92,22 @@ public class BeanIntrospector {
private static List merge(Map getters,Map setters) throws IntrospectionException {
List props = new ArrayList();
Set processedProps = new HashSet();
- Iterator gs = getters.keySet().iterator();
- while (gs.hasNext()) {
- String name = (String) gs.next();
+ for (Object o : getters.keySet()) {
+ String name = (String) o;
PropertyDescriptor getter = (PropertyDescriptor) getters.get(name);
PropertyDescriptor setter = (PropertyDescriptor) setters.get(name);
- if (setter!=null) {
+ if (setter != null) {
processedProps.add(name);
- PropertyDescriptor prop = new PropertyDescriptor(name,getter.getReadMethod(),setter.getWriteMethod());
+ PropertyDescriptor prop = new PropertyDescriptor(name, getter.getReadMethod(), setter.getWriteMethod());
props.add(prop);
- }
- else {
+ } else {
props.add(getter);
}
}
Set writeOnlyProps = new HashSet(setters.keySet());
writeOnlyProps.removeAll(processedProps);
- Iterator ss = writeOnlyProps.iterator();
- while (ss.hasNext()) {
- String name = (String) ss.next();
+ for (Object writeOnlyProp : writeOnlyProps) {
+ String name = (String) writeOnlyProp;
PropertyDescriptor setter = (PropertyDescriptor) setters.get(name);
props.add(setter);
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CloneableBean.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CloneableBean.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CloneableBean.java
index 5e2051b..a4a1cdb 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CloneableBean.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CloneableBean.java
@@ -128,17 +128,17 @@ public class CloneableBean implements Serializable, Cloneable {
clonedBean = _obj.getClass().newInstance();
PropertyDescriptor[] pds = BeanIntrospector.getPropertyDescriptors(_obj.getClass());
if (pds!=null) {
- for (int i=0;i<pds.length;i++) {
- Method pReadMethod = pds[i].getReadMethod();
- Method pWriteMethod = pds[i].getWriteMethod();
- if (pReadMethod!=null && pWriteMethod!=null && // ensure it has getter and setter methods
- !_ignoreProperties.contains(pds[i].getName()) && // is not in the list of properties to ignore
- pReadMethod.getDeclaringClass()!=Object.class && // filter Object.class getter methods
- pReadMethod.getParameterTypes().length==0) { // filter getter methods that take parameters
- Object value = pReadMethod.invoke(_obj,NO_PARAMS);
- if (value!=null) {
+ for (PropertyDescriptor pd : pds) {
+ Method pReadMethod = pd.getReadMethod();
+ Method pWriteMethod = pd.getWriteMethod();
+ if (pReadMethod != null && pWriteMethod != null && // ensure it has getter and setter methods
+ !_ignoreProperties.contains(pd.getName()) && // is not in the list of properties to ignore
+ pReadMethod.getDeclaringClass() != Object.class && // filter Object.class getter methods
+ pReadMethod.getParameterTypes().length == 0) { // filter getter methods that take parameters
+ Object value = pReadMethod.invoke(_obj, NO_PARAMS);
+ if (value != null) {
value = doClone(value);
- pWriteMethod.invoke(clonedBean,new Object[]{value});
+ pWriteMethod.invoke(clonedBean, new Object[]{value});
}
}
}
@@ -204,9 +204,8 @@ public class CloneableBean implements Serializable, Cloneable {
private Object cloneCollection(Collection collection) throws Exception {
Class mClass = collection.getClass();
Collection newColl = (Collection) mClass.newInstance();
- Iterator i = collection.iterator();
- while (i.hasNext()) {
- Object element = doClone(i.next());
+ for (Object aCollection : collection) {
+ Object element = doClone(aCollection);
newColl.add(element);
}
return newColl;
@@ -215,12 +214,11 @@ public class CloneableBean implements Serializable, Cloneable {
private Object cloneMap(Map map) throws Exception {
Class mClass = map.getClass();
Map newMap = (Map) mClass.newInstance();
- Iterator entries = map.entrySet().iterator();
- while (entries.hasNext()) {
- Map.Entry entry = (Map.Entry) entries.next();
+ for (Object o : map.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
Object key = doClone(entry.getKey());
Object value = doClone(entry.getValue());
- newMap.put(key,value);
+ newMap.put(key, value);
}
return newMap;
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CopyFromHelper.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CopyFromHelper.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CopyFromHelper.java
index f13a14a..fc91b66 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CopyFromHelper.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/CopyFromHelper.java
@@ -17,7 +17,6 @@
package com.sun.syndication.feed.impl;
import com.sun.syndication.feed.CopyFrom;
-import com.sun.syndication.feed.impl.BeanIntrospector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Array;
@@ -44,19 +43,19 @@ public class CopyFromHelper {
try {
PropertyDescriptor[] pds = BeanIntrospector.getPropertyDescriptors(_beanInterfaceClass);
if (pds!=null) {
- for (int i=0;i<pds.length;i++) {
- String propertyName = pds[i].getName();
- Method pReadMethod = pds[i].getReadMethod();
- Method pWriteMethod = pds[i].getWriteMethod();
- if (pReadMethod!=null && pWriteMethod!=null && // ensure it has getter and setter methods
- pReadMethod.getDeclaringClass()!=Object.class && // filter Object.class getter methods
- pReadMethod.getParameterTypes().length==0 && // filter getter methods that take parameters
- _baseInterfaceMap.containsKey(propertyName)) { // only copies properties defined as copyFrom-able
- Object value = pReadMethod.invoke(source,NO_PARAMS);
- if (value!=null) {
+ for (PropertyDescriptor pd : pds) {
+ String propertyName = pd.getName();
+ Method pReadMethod = pd.getReadMethod();
+ Method pWriteMethod = pd.getWriteMethod();
+ if (pReadMethod != null && pWriteMethod != null && // ensure it has getter and setter methods
+ pReadMethod.getDeclaringClass() != Object.class && // filter Object.class getter methods
+ pReadMethod.getParameterTypes().length == 0 && // filter getter methods that take parameters
+ _baseInterfaceMap.containsKey(propertyName)) { // only copies properties defined as copyFrom-able
+ Object value = pReadMethod.invoke(source, NO_PARAMS);
+ if (value != null) {
Class baseInterface = (Class) _baseInterfaceMap.get(propertyName);
- value = doCopy(value,baseInterface);
- pWriteMethod.invoke(target,new Object[]{value});
+ value = doCopy(value, baseInterface);
+ pWriteMethod.invoke(target, new Object[]{value});
}
}
}
@@ -127,9 +126,8 @@ public class CopyFromHelper {
private Object doCopyCollection(Collection collection,Class baseInterface) throws Exception {
// expecting SETs or LISTs only, going default implementation of them
Collection newColl = (collection instanceof Set) ? (Collection)new HashSet() : (Collection)new ArrayList();
- Iterator i = collection.iterator();
- while (i.hasNext()) {
- Object element = doCopy(i.next(),baseInterface);
+ for (Object aCollection : collection) {
+ Object element = doCopy(aCollection, baseInterface);
newColl.add(element);
}
return newColl;
@@ -137,12 +135,11 @@ public class CopyFromHelper {
private Object doCopyMap(Map map,Class baseInterface) throws Exception {
Map newMap = new HashMap();
- Iterator entries = map.entrySet().iterator();
- while (entries.hasNext()) {
- Map.Entry entry = (Map.Entry) entries.next();
+ for (Object o : map.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
Object key = entry.getKey(); // we are assuming string KEYS
- Object element = doCopy(entry.getValue(),baseInterface);
- newMap.put(key,element);
+ Object element = doCopy(entry.getValue(), baseInterface);
+ newMap.put(key, element);
}
return newMap;
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/ToStringBean.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/ToStringBean.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/ToStringBean.java
index 50fdc6d..c143903 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/ToStringBean.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/impl/ToStringBean.java
@@ -17,13 +17,13 @@
package com.sun.syndication.feed.impl;
import java.beans.PropertyDescriptor;
+import java.io.Serializable;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Stack;
-import java.io.Serializable;
/**
* Provides deep <b>Bean</b> toString support.
@@ -128,20 +128,20 @@ public class ToStringBean implements Serializable {
try {
PropertyDescriptor[] pds = BeanIntrospector.getPropertyDescriptors(_beanClass);
if (pds!=null) {
- for (int i=0;i<pds.length;i++) {
- String pName = pds[i].getName();
- Method pReadMethod = pds[i].getReadMethod();
- if (pReadMethod!=null && // ensure it has a getter method
- pReadMethod.getDeclaringClass()!=Object.class && // filter Object.class getter methods
- pReadMethod.getParameterTypes().length==0) { // filter getter methods that take parameters
- Object value = pReadMethod.invoke(_obj,NO_PARAMS);
- printProperty(sb,prefix+"."+pName,value);
+ for (PropertyDescriptor pd : pds) {
+ String pName = pd.getName();
+ Method pReadMethod = pd.getReadMethod();
+ if (pReadMethod != null && // ensure it has a getter method
+ pReadMethod.getDeclaringClass() != Object.class && // filter Object.class getter methods
+ pReadMethod.getParameterTypes().length == 0) { // filter getter methods that take parameters
+ Object value = pReadMethod.invoke(_obj, NO_PARAMS);
+ printProperty(sb, prefix + "." + pName, value);
}
}
}
}
catch (Exception ex) {
- sb.append("\n\nEXCEPTION: Could not complete "+_obj.getClass()+".toString(): "+ex.getMessage()+"\n");
+ sb.append("\n\nEXCEPTION: Could not complete ").append(_obj.getClass()).append(".toString(): ").append(ex.getMessage()).append("\n");
}
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/SyModuleImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/SyModuleImpl.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/SyModuleImpl.java
index 2bf8f2e..190abbd 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/SyModuleImpl.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/SyModuleImpl.java
@@ -29,7 +29,7 @@ import java.util.*;
*
*/
public class SyModuleImpl extends ModuleImpl implements SyModule {
- private static final Set<String> PERIODS = new HashSet<String>();
+ private static final Set<String> PERIODS = new HashSet<>();
static {
PERIODS.add(HOURLY );
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/impl/ModuleUtils.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/impl/ModuleUtils.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/impl/ModuleUtils.java
index ca1738c..9ad98e3 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/impl/ModuleUtils.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/module/impl/ModuleUtils.java
@@ -28,7 +28,7 @@ public class ModuleUtils {
public static List<Module> cloneModules(List<Module> modules) {
List<Module> cModules = null;
if (modules!=null) {
- cModules = new ArrayList<Module>();
+ cModules = new ArrayList<>();
for (Module module : modules) {
try {
Module c = (Module) module.clone();
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Channel.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Channel.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Channel.java
index a9e6749..cc89524 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Channel.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Channel.java
@@ -44,7 +44,7 @@ public class Channel extends WireFeed {
private static final Set<String> DAYS;
static {
- HashSet<String> days = new HashSet<String>();
+ HashSet<String> days = new HashSet<>();
days.add(SUNDAY );
days.add(MONDAY );
days.add(TUESDAY );
@@ -201,7 +201,7 @@ public class Channel extends WireFeed {
*
*/
public List<Item> getItems() {
- return (_items==null) ? (_items=new ArrayList<Item>()) : _items;
+ return (_items==null) ? (_items= new ArrayList<>()) : _items;
}
/**
@@ -415,15 +415,14 @@ public class Channel extends WireFeed {
*/
public void setSkipHours(List<Integer> skipHours) {
if (skipHours!=null) {
- for (int i=0;i<skipHours.size();i++) {
- Integer iHour = (Integer) skipHours.get(i);
- if (iHour!=null) {
- int hour = iHour.intValue();
- if (hour<0 || hour>24) {
- throw new IllegalArgumentException("Invalid hour ["+hour+"]");
+ for (Integer skipHour : skipHours) {
+ Integer iHour = (Integer) skipHour;
+ if (iHour != null) {
+ int hour = iHour;
+ if (hour < 0 || hour > 24) {
+ throw new IllegalArgumentException("Invalid hour [" + hour + "]");
}
- }
- else {
+ } else {
throw new IllegalArgumentException("Invalid hour [null]");
}
}
@@ -496,7 +495,7 @@ public class Channel extends WireFeed {
*
*/
public List<Category> getCategories() {
- return (_categories==null) ? (_categories=new ArrayList<Category>()) : _categories;
+ return (_categories==null) ? (_categories= new ArrayList<>()) : _categories;
}
/**
@@ -559,7 +558,7 @@ public class Channel extends WireFeed {
*/
@Override
public List<Module> getModules() {
- return (_modules==null) ? (_modules=new ArrayList<Module>()) : _modules;
+ return (_modules==null) ? (_modules= new ArrayList<>()) : _modules;
}
/**
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Item.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Item.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Item.java
index 9931dd8..ffeaf6e 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Item.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/rss/Item.java
@@ -18,14 +18,14 @@
package com.sun.syndication.feed.rss;
import com.sun.syndication.feed.impl.ObjectBean;
+import com.sun.syndication.feed.module.Extendable;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.feed.module.impl.ModuleUtils;
-import com.sun.syndication.feed.module.Extendable;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import java.io.Serializable;
/**
* Bean for items of RSS feeds.
@@ -248,7 +248,7 @@ public class Item implements Cloneable, Serializable, Extendable {
*
*/
public List<Enclosure> getEnclosures() {
- return (_enclosures==null) ? (_enclosures=new ArrayList<Enclosure>()) : _enclosures;
+ return (_enclosures==null) ? (_enclosures= new ArrayList<>()) : _enclosures;
}
/**
@@ -270,7 +270,7 @@ public class Item implements Cloneable, Serializable, Extendable {
*
*/
public List getCategories() {
- return (_categories==null) ? (_categories=new ArrayList<Category>()) : _categories;
+ return (_categories==null) ? (_categories= new ArrayList<>()) : _categories;
}
/**
@@ -352,7 +352,7 @@ public class Item implements Cloneable, Serializable, Extendable {
*
*/
public List<Module> getModules() {
- return (_modules==null) ? (_modules=new ArrayList<Module>()) : _modules;
+ return (_modules==null) ? (_modules= new ArrayList<>()) : _modules;
}
/**
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndCategoryImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndCategoryImpl.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndCategoryImpl.java
index eacefbb..5661109 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndCategoryImpl.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndCategoryImpl.java
@@ -18,13 +18,13 @@
package com.sun.syndication.feed.synd;
import com.sun.syndication.feed.impl.ObjectBean;
-import com.sun.syndication.feed.module.DCSubjectImpl;
import com.sun.syndication.feed.module.DCSubject;
+import com.sun.syndication.feed.module.DCSubjectImpl;
+import java.io.Serializable;
import java.util.AbstractList;
-import java.util.List;
import java.util.ArrayList;
-import java.io.Serializable;
+import java.util.List;
/**
* Bean for categories of SyndFeedImpl feeds and entries.
@@ -272,10 +272,10 @@ class SyndCategoryListFacade extends AbstractList<SyndCategory> {
List<DCSubject> sList = null;
if (cList!=null) {
sList = new ArrayList();
- for (int i=0;i<cList.size();i++) {
- SyndCategoryImpl sCat = (SyndCategoryImpl) cList.get(i);
+ for (SyndCategory aCList : cList) {
+ SyndCategoryImpl sCat = (SyndCategoryImpl) aCList;
DCSubject subject = null;
- if (sCat!=null) {
+ if (sCat != null) {
subject = sCat.getSubject();
}
sList.add(subject);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndEntryImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndEntryImpl.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndEntryImpl.java
index 13119cd..1e69908 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndEntryImpl.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/SyndEntryImpl.java
@@ -17,14 +17,14 @@
package com.sun.syndication.feed.synd;
import com.sun.syndication.feed.CopyFrom;
+import com.sun.syndication.feed.impl.CopyFromHelper;
import com.sun.syndication.feed.impl.ObjectBean;
import com.sun.syndication.feed.module.*;
import com.sun.syndication.feed.module.impl.ModuleUtils;
import com.sun.syndication.feed.synd.impl.URINormalizer;
-import com.sun.syndication.feed.impl.CopyFromHelper;
+import java.io.Serializable;
import java.util.*;
-import java.io.Serializable;
/**
* Bean for entries of SyndFeedImpl feeds.
@@ -272,7 +272,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
*
*/
public List<SyndContent> getContents() {
- return (_contents==null) ? (_contents=new ArrayList<SyndContent>()) : _contents;
+ return (_contents==null) ? (_contents= new ArrayList<>()) : _contents;
}
/**
@@ -294,7 +294,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
*
*/
public List<SyndEnclosure> getEnclosures() {
- return (_enclosures==null) ? (_enclosures=new ArrayList<SyndEnclosure>()) : _enclosures;
+ return (_enclosures==null) ? (_enclosures= new ArrayList<>()) : _enclosures;
}
/**
@@ -366,7 +366,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
*/
public List<Module> getModules() {
if (_modules==null) {
- _modules=new ArrayList<Module>();
+ _modules= new ArrayList<>();
}
if (ModuleUtils.getModule(_modules,DCModule.URI)==null) {
_modules.add(new DCModuleImpl());
@@ -440,7 +440,7 @@ public class SyndEntryImpl implements Serializable,SyndEntry {
* @return Returns the links.
*/
public List<SyndLink> getLinks() {
- return (_links==null) ? (_links=new ArrayList<SyndLink>()) : _links;
+ return (_links==null) ? (_links= new ArrayList<>()) : _links;
}
/**
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom03.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom03.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom03.java
index 74dd500..1a8c0a9 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom03.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom03.java
@@ -18,29 +18,13 @@
package com.sun.syndication.feed.synd.impl;
import com.sun.syndication.feed.WireFeed;
-import com.sun.syndication.feed.atom.Content;
-import com.sun.syndication.feed.atom.Entry;
-import com.sun.syndication.feed.atom.Feed;
-import com.sun.syndication.feed.atom.Link;
-import com.sun.syndication.feed.atom.Person;
+import com.sun.syndication.feed.atom.*;
import com.sun.syndication.feed.module.impl.ModuleUtils;
-import com.sun.syndication.feed.synd.SyndFeed;
-import com.sun.syndication.feed.synd.Converter;
-import com.sun.syndication.feed.synd.SyndEnclosure;
-import com.sun.syndication.feed.synd.SyndEnclosureImpl;
-import com.sun.syndication.feed.synd.SyndEntry;
-import com.sun.syndication.feed.synd.SyndContentImpl;
-import com.sun.syndication.feed.synd.SyndEntryImpl;
-import com.sun.syndication.feed.synd.SyndContent;
-import com.sun.syndication.feed.synd.SyndLink;
-import com.sun.syndication.feed.synd.SyndLinkImpl;
-import com.sun.syndication.feed.synd.SyndPerson;
-import com.sun.syndication.feed.synd.SyndPersonImpl;
+import com.sun.syndication.feed.synd.*;
import java.util.ArrayList;
-import java.util.List;
import java.util.Date;
-import java.util.Iterator;
+import java.util.List;
/**
*/
@@ -130,8 +114,8 @@ public class ConverterForAtom03 implements Converter {
protected List createSyndLinks(List aLinks) {
ArrayList sLinks = new ArrayList();
- for (Iterator iter = aLinks.iterator(); iter.hasNext();) {
- Link link = (Link)iter.next();
+ for (Object aLink : aLinks) {
+ Link link = (Link) aLink;
if (!link.getRel().equals("enclosure")) {
SyndLink sLink = createSyndLink(link);
sLinks.add(sLink);
@@ -151,8 +135,8 @@ public class ConverterForAtom03 implements Converter {
protected List createSyndEntries(List atomEntries, boolean preserveWireItems) {
List syndEntries = new ArrayList();
- for (int i=0;i<atomEntries.size();i++) {
- syndEntries.add(createSyndEntry((Entry) atomEntries.get(i), preserveWireItems));
+ for (Object atomEntry : atomEntries) {
+ syndEntries.add(createSyndEntry((Entry) atomEntry, preserveWireItems));
}
return syndEntries;
}
@@ -182,8 +166,8 @@ public class ConverterForAtom03 implements Converter {
List syndEnclosures = new ArrayList();
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) {
List oLinks = entry.getOtherLinks();
- for (Iterator iter = oLinks.iterator(); iter.hasNext(); ) {
- Link thisLink = (Link)iter.next();
+ for (Object oLink : oLinks) {
+ Link thisLink = (Link) oLink;
if ("enclosure".equals(thisLink.getRel()))
syndEnclosures.add(createSyndEnclosure(entry, thisLink));
}
@@ -228,8 +212,8 @@ public class ConverterForAtom03 implements Converter {
List contents = entry.getContents();
if (contents.size()>0) {
List sContents = new ArrayList();
- for (int i=0;i<contents.size();i++) {
- content = (Content) contents.get(i);
+ for (Object content1 : contents) {
+ content = (Content) content1;
SyndContent sContent = new SyndContentImpl();
sContent.setType(content.getType());
sContent.setValue(content.getValue());
@@ -296,8 +280,8 @@ public class ConverterForAtom03 implements Converter {
List otherLinks = new ArrayList();
List slinks = syndFeed.getLinks();
if (slinks != null) {
- for (Iterator iter=slinks.iterator(); iter.hasNext();) {
- SyndLink syndLink = (SyndLink)iter.next();
+ for (Object slink : slinks) {
+ SyndLink syndLink = (SyndLink) slink;
Link link = createAtomLink(syndLink);
if (link.getRel() == null ||
"".equals(link.getRel().trim()) ||
@@ -347,8 +331,8 @@ public class ConverterForAtom03 implements Converter {
protected static List createAtomPersons(List sPersons) {
List persons = new ArrayList();
- for (Iterator iter = sPersons.iterator(); iter.hasNext(); ) {
- SyndPerson sPerson = (SyndPerson)iter.next();
+ for (Object sPerson1 : sPersons) {
+ SyndPerson sPerson = (SyndPerson) sPerson1;
Person person = new Person();
person.setName(sPerson.getName());
person.setUri(sPerson.getUri());
@@ -361,8 +345,8 @@ public class ConverterForAtom03 implements Converter {
protected static List createSyndPersons(List aPersons) {
List persons = new ArrayList();
- for (Iterator iter = aPersons.iterator(); iter.hasNext(); ) {
- Person aPerson = (Person)iter.next();
+ for (Object aPerson1 : aPersons) {
+ Person aPerson = (Person) aPerson1;
SyndPerson person = new SyndPersonImpl();
person.setName(aPerson.getName());
person.setUri(aPerson.getUri());
@@ -375,8 +359,8 @@ public class ConverterForAtom03 implements Converter {
protected List createAtomEntries(List syndEntries) {
List atomEntries = new ArrayList();
- for (int i=0;i<syndEntries.size();i++) {
- atomEntries.add(createAtomEntry((SyndEntry)syndEntries.get(i)));
+ for (Object syndEntry : syndEntries) {
+ atomEntries.add(createAtomEntry((SyndEntry) syndEntry));
}
return atomEntries;
}
@@ -407,8 +391,8 @@ public class ConverterForAtom03 implements Converter {
List otherLinks = new ArrayList();
List slinks = sEntry.getLinks();
if (slinks != null) {
- for (Iterator iter=slinks.iterator(); iter.hasNext();) {
- SyndLink syndLink = (SyndLink)iter.next();
+ for (Object slink : slinks) {
+ SyndLink syndLink = (SyndLink) slink;
Link link = createAtomLink(syndLink);
if (link.getRel() == null ||
"".equals(link.getRel().trim()) ||
@@ -429,8 +413,8 @@ public class ConverterForAtom03 implements Converter {
List sEnclosures = sEntry.getEnclosures();
if (sEnclosures != null) {
- for (Iterator iter=sEnclosures.iterator(); iter.hasNext();) {
- SyndEnclosure syndEnclosure = (SyndEnclosure) iter.next();
+ for (Object sEnclosure : sEnclosures) {
+ SyndEnclosure syndEnclosure = (SyndEnclosure) sEnclosure;
Link link = createAtomEnclosure(syndEnclosure);
otherLinks.add(link);
}
@@ -452,8 +436,8 @@ public class ConverterForAtom03 implements Converter {
List contents = sEntry.getContents();
if (contents.size()>0) {
List aContents = new ArrayList();
- for (int i=0;i<contents.size();i++) {
- sContent = (SyndContentImpl) contents.get(i);
+ for (Object content1 : contents) {
+ sContent = (SyndContentImpl) content1;
Content content = new Content();
content.setType(sContent.getType());
content.setValue(sContent.getValue());
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom10.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom10.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom10.java
index d51e9bd..27551c1 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom10.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForAtom10.java
@@ -23,7 +23,6 @@ import com.sun.syndication.feed.synd.*;
import java.util.ArrayList;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
@@ -123,8 +122,8 @@ public class ConverterForAtom10 implements Converter {
protected List createSyndLinks(List aLinks) {
ArrayList sLinks = new ArrayList();
- for (Iterator iter = aLinks.iterator(); iter.hasNext();) {
- Link link = (Link)iter.next();
+ for (Object aLink : aLinks) {
+ Link link = (Link) aLink;
SyndLink sLink = createSyndLink(link);
sLinks.add(sLink);
}
@@ -133,8 +132,8 @@ public class ConverterForAtom10 implements Converter {
protected List createSyndEntries(Feed feed, List atomEntries, boolean preserveWireItems) {
List syndEntries = new ArrayList();
- for (int i=0;i<atomEntries.size();i++) {
- syndEntries.add(createSyndEntry(feed, (Entry) atomEntries.get(i), preserveWireItems));
+ for (Object atomEntry : atomEntries) {
+ syndEntries.add(createSyndEntry(feed, (Entry) atomEntry, preserveWireItems));
}
return syndEntries;
}
@@ -163,8 +162,8 @@ public class ConverterForAtom10 implements Converter {
List contents = entry.getContents();
if (contents != null && contents.size() > 0) {
List sContents = new ArrayList();
- for (Iterator iter=contents.iterator(); iter.hasNext();) {
- Content content = (Content)iter.next();
+ for (Object content1 : contents) {
+ Content content = (Content) content1;
sContents.add(createSyndContent(content));
}
syndEntry.setContents(sContents);
@@ -195,10 +194,10 @@ public class ConverterForAtom10 implements Converter {
List categories = entry.getCategories();
if (categories!=null) {
List syndCategories = new ArrayList();
- for (Iterator iter=categories.iterator(); iter.hasNext();) {
- Category c = (Category)iter.next();
+ for (Object category : categories) {
+ Category c = (Category) category;
SyndCategory syndCategory = new SyndCategoryImpl();
- syndCategory.setName(c.getTerm());
+ syndCategory.setName(c.getTerm());
syndCategory.setTaxonomyUri(c.getSchemeResolved());
// TODO: categories MAY have labels
// syndCategory.setLabel(c.getLabel());
@@ -218,8 +217,8 @@ public class ConverterForAtom10 implements Converter {
List syndEnclosures = new ArrayList();
if (entry.getOtherLinks() != null && entry.getOtherLinks().size() > 0) {
List oLinks = entry.getOtherLinks();
- for (Iterator iter = oLinks.iterator(); iter.hasNext(); ) {
- Link thisLink = (Link)iter.next();
+ for (Object oLink : oLinks) {
+ Link thisLink = (Link) oLink;
if ("enclosure".equals(thisLink.getRel()))
syndEnclosures.add(
createSyndEnclosure(feed, entry, thisLink));
@@ -327,9 +326,9 @@ public class ConverterForAtom10 implements Converter {
List otherLinks = new ArrayList();
List slinks = syndFeed.getLinks();
if (slinks != null) {
- for (Iterator iter=slinks.iterator(); iter.hasNext();) {
- SyndLink syndLink = (SyndLink)iter.next();
- Link link = createAtomLink(syndLink);
+ for (Object slink : slinks) {
+ SyndLink syndLink = (SyndLink) slink;
+ Link link = createAtomLink(syndLink);
if (link.getRel() == null ||
"".equals(link.getRel().trim()) ||
"alternate".equals(link.getRel())) {
@@ -352,8 +351,8 @@ public class ConverterForAtom10 implements Converter {
List sCats = syndFeed.getCategories();
List aCats = new ArrayList();
if (sCats != null) {
- for (Iterator iter=sCats.iterator(); iter.hasNext();) {
- SyndCategory sCat = (SyndCategory)iter.next();
+ for (Object sCat1 : sCats) {
+ SyndCategory sCat = (SyndCategory) sCat1;
Category aCat = new Category();
aCat.setTerm(sCat.getName());
// TODO: aCat.setLabel(sCat.getLabel());
@@ -397,8 +396,8 @@ public class ConverterForAtom10 implements Converter {
protected List createAtomEntries(List syndEntries) {
List atomEntries = new ArrayList();
- for (int i=0;i<syndEntries.size();i++) {
- atomEntries.add(createAtomEntry((SyndEntry)syndEntries.get(i)));
+ for (Object syndEntry : syndEntries) {
+ atomEntries.add(createAtomEntry((SyndEntry) syndEntry));
}
return atomEntries;
}
@@ -412,8 +411,8 @@ public class ConverterForAtom10 implements Converter {
protected List createAtomContents(List syndContents) {
List atomContents = new ArrayList();
- for (int i=0;i<syndContents.size();i++) {
- atomContents.add(createAtomContent((SyndContent)syndContents.get(i)));
+ for (Object syndContent : syndContents) {
+ atomContents.add(createAtomContent((SyndContent) syndContent));
}
return atomContents;
}
@@ -447,8 +446,8 @@ public class ConverterForAtom10 implements Converter {
List enclosures = sEntry.getEnclosures();
boolean linkRelEnclosureExists = false;
if (slinks != null) {
- for (Iterator iter=slinks.iterator(); iter.hasNext();) {
- SyndLink syndLink = (SyndLink)iter.next();
+ for (Object slink : slinks) {
+ SyndLink syndLink = (SyndLink) slink;
Link link = createAtomLink(syndLink);
// Set this flag if there's a link of rel = enclosure so that
// enclosures won't be duplicated when pulled from
@@ -476,8 +475,8 @@ public class ConverterForAtom10 implements Converter {
// add SyndEnclosures as links with rel="enclosure" ONLY if
// there are no SyndEntry.getLinks() with rel="enclosure"
if (enclosures != null && !linkRelEnclosureExists) {
- for (Iterator iter=enclosures.iterator(); iter.hasNext();) {
- SyndEnclosure syndEncl = (SyndEnclosure)iter.next();
+ for (Object enclosure : enclosures) {
+ SyndEnclosure syndEncl = (SyndEnclosure) enclosure;
Link link = createAtomEnclosure(syndEncl);
otherLinks.add(link);
}
@@ -488,8 +487,8 @@ public class ConverterForAtom10 implements Converter {
List sCats = sEntry.getCategories();
List aCats = new ArrayList();
if (sCats != null) {
- for (Iterator iter=sCats.iterator(); iter.hasNext();) {
- SyndCategory sCat = (SyndCategory)iter.next();
+ for (Object sCat1 : sCats) {
+ SyndCategory sCat = (SyndCategory) sCat1;
Category aCat = new Category();
aCat.setTerm(sCat.getName());
// TODO: aCat.setLabel(sCat.getLabel());
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS090.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS090.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS090.java
index 1e4246d..58273ec 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS090.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS090.java
@@ -75,8 +75,8 @@ public class ConverterForRSS090 implements Converter {
protected List createSyndEntries(List rssItems, boolean preserveWireItems) {
List syndEntries = new ArrayList();
- for (int i=0;i<rssItems.size();i++) {
- syndEntries.add(createSyndEntry((Item) rssItems.get(i), preserveWireItems));
+ for (Object rssItem : rssItems) {
+ syndEntries.add(createSyndEntry((Item) rssItem, preserveWireItems));
}
return syndEntries;
}
@@ -145,8 +145,8 @@ public class ConverterForRSS090 implements Converter {
protected List createRSSItems(List sEntries) {
List list = new ArrayList();
- for (int i=0;i<sEntries.size();i++) {
- list.add(createRSSItem((SyndEntry)sEntries.get(i)));
+ for (Object sEntry : sEntries) {
+ list.add(createRSSItem((SyndEntry) sEntry));
}
return list;
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS092.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS092.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS092.java
index f47462d..3689659 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS092.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/feed/synd/impl/ConverterForRSS092.java
@@ -16,20 +16,16 @@
*/
package com.sun.syndication.feed.synd.impl;
+import com.sun.syndication.feed.rss.Category;
+import com.sun.syndication.feed.rss.Enclosure;
+import com.sun.syndication.feed.rss.Item;
+import com.sun.syndication.feed.synd.*;
+
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
-import com.sun.syndication.feed.rss.Category;
-import com.sun.syndication.feed.rss.Enclosure;
-import com.sun.syndication.feed.rss.Item;
-import com.sun.syndication.feed.synd.SyndCategory;
-import com.sun.syndication.feed.synd.SyndCategoryImpl;
-import com.sun.syndication.feed.synd.SyndEnclosure;
-import com.sun.syndication.feed.synd.SyndEnclosureImpl;
-import com.sun.syndication.feed.synd.SyndEntry;
-
/**
*/
public class ConverterForRSS092 extends ConverterForRSS091Userland {
@@ -61,8 +57,8 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
protected List createSyndCategories(List rssCats) {
List syndCats = new ArrayList();
- for (int i=0;i<rssCats.size();i++) {
- Category rssCat = (Category) rssCats.get(i);
+ for (Object rssCat1 : rssCats) {
+ Category rssCat = (Category) rssCat1;
SyndCategory sCat = new SyndCategoryImpl();
sCat.setTaxonomyUri(rssCat.getDomain());
sCat.setName(rssCat.getValue());
@@ -73,8 +69,8 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
protected List createSyndEnclosures(List enclosures) {
List sEnclosures = new ArrayList();
- for (int i=0;i<enclosures.size();i++) {
- Enclosure enc = (Enclosure) enclosures.get(i);
+ for (Object enclosure : enclosures) {
+ Enclosure enc = (Enclosure) enclosure;
SyndEnclosure sEnc = new SyndEnclosureImpl();
sEnc.setUrl(enc.getUrl());
sEnc.setType(enc.getType());
@@ -101,8 +97,8 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
protected List createRSSCategories(List sCats) {
List cats = new ArrayList();
- for (int i=0;i<sCats.size();i++) {
- SyndCategory sCat = (SyndCategory) sCats.get(i);
+ for (Object sCat1 : sCats) {
+ SyndCategory sCat = (SyndCategory) sCat1;
Category cat = new Category();
cat.setDomain(sCat.getTaxonomyUri());
cat.setValue(sCat.getName());
@@ -113,8 +109,8 @@ public class ConverterForRSS092 extends ConverterForRSS091Userland {
protected List createEnclosures(List sEnclosures) {
List enclosures = new ArrayList();
- for (int i=0;i<sEnclosures.size();i++) {
- SyndEnclosure sEnc = (SyndEnclosure) sEnclosures.get(i);
+ for (Object sEnclosure : sEnclosures) {
+ SyndEnclosure sEnc = (SyndEnclosure) sEnclosure;
Enclosure enc = new Enclosure();
enc.setUrl(sEnc.getUrl());
enc.setType(sEnc.getType());
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/WireFeedInput.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/WireFeedInput.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/WireFeedInput.java
index 58e6791..6bad729 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/WireFeedInput.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/WireFeedInput.java
@@ -16,29 +16,19 @@
*/
package com.sun.syndication.io;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
+import com.sun.syndication.feed.WireFeed;
+import com.sun.syndication.io.impl.FeedParsers;
+import com.sun.syndication.io.impl.XmlFixerReader;
import org.jdom2.Document;
import org.jdom2.JDOMException;
import org.jdom2.input.DOMBuilder;
import org.jdom2.input.JDOMParseException;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.XMLReader;
+import org.xml.sax.*;
-import com.sun.syndication.feed.WireFeed;
-import com.sun.syndication.io.impl.FeedParsers;
-import com.sun.syndication.io.impl.XmlFixerReader;
+import java.io.*;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
/**
* Parses an XML document (File, InputStream, Reader, W3C SAX InputSource, W3C DOM Document or JDom DOcument)
@@ -300,31 +290,25 @@ public class WireFeedInput {
try {
parser.setFeature("http://xml.org/sax/features/external-general-entities", false);
saxBuilder.setFeature("http://xml.org/sax/features/external-general-entities", false);
- } catch (SAXNotRecognizedException e) {
- // ignore
- } catch (SAXNotSupportedException e) {
+ } catch (SAXNotRecognizedException | SAXNotSupportedException e) {
// ignore
}
-
- try {
+
+ try {
parser.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
saxBuilder.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
- } catch (SAXNotRecognizedException e) {
- // ignore
- } catch (SAXNotSupportedException e) {
+ } catch (SAXNotRecognizedException | SAXNotSupportedException e) {
// ignore
}
- try {
+ try {
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
saxBuilder.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
- } catch (SAXNotRecognizedException e) {
- // ignore
- } catch (SAXNotSupportedException e) {
+ } catch (SAXNotRecognizedException | SAXNotSupportedException e) {
// ignore
}
-
- } catch (JDOMException e) {
+
+ } catch (JDOMException e) {
throw new IllegalStateException("JDOM could not create a SAX parser");
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Generator.java
index 2c6a4b0..1a7089d 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Generator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Generator.java
@@ -86,17 +86,16 @@ public class Atom03Generator extends BaseWireFeedGenerator {
}
protected void addFeed(Feed feed, Element parent) throws FeedException {
- Element eFeed = parent;
- populateFeedHeader(feed,eFeed);
- checkFeedHeaderConstraints(eFeed);
- generateFeedModules(feed.getModules(),eFeed);
- generateForeignMarkup(eFeed, (List)feed.getForeignMarkup());
+ populateFeedHeader(feed, parent);
+ checkFeedHeaderConstraints(parent);
+ generateFeedModules(feed.getModules(), parent);
+ generateForeignMarkup(parent, (List)feed.getForeignMarkup());
}
protected void addEntries(Feed feed,Element parent) throws FeedException {
List items = feed.getEntries();
- for (int i=0;i<items.size();i++) {
- addEntry((Entry)items.get(i),parent);
+ for (Object item : items) {
+ addEntry((Entry) item, parent);
}
checkEntriesConstraints(parent);
}
@@ -117,13 +116,13 @@ public class Atom03Generator extends BaseWireFeedGenerator {
}
List links = feed.getAlternateLinks();
- for (int i = 0; i < links.size(); i++) {
- eFeed.addContent(generateLinkElement((Link)links.get(i)));
+ for (Object link1 : links) {
+ eFeed.addContent(generateLinkElement((Link) link1));
}
links = feed.getOtherLinks();
- for (int i = 0; i < links.size(); i++) {
- eFeed.addContent(generateLinkElement((Link)links.get(i)));
+ for (Object link : links) {
+ eFeed.addContent(generateLinkElement((Link) link));
}
if (feed.getAuthors()!=null && feed.getAuthors().size() > 0) {
Element authorElement = new Element("author", getFeedNamespace());
@@ -132,9 +131,9 @@ public class Atom03Generator extends BaseWireFeedGenerator {
}
List contributors = feed.getContributors();
- for (int i = 0; i < contributors.size(); i++) {
+ for (Object contributor : contributors) {
Element contributorElement = new Element("contributor", getFeedNamespace());
- fillPersonElement(contributorElement, (Person)contributors.get(i));
+ fillPersonElement(contributorElement, (Person) contributor);
eFeed.addContent(contributorElement);
}
@@ -176,13 +175,13 @@ public class Atom03Generator extends BaseWireFeedGenerator {
eEntry.addContent(titleElement);
}
List links = entry.getAlternateLinks();
- for (int i = 0; i < links.size(); i++) {
- eEntry.addContent(generateLinkElement((Link)links.get(i)));
+ for (Object link1 : links) {
+ eEntry.addContent(generateLinkElement((Link) link1));
}
links = entry.getOtherLinks();
- for (int i = 0; i < links.size(); i++) {
- eEntry.addContent(generateLinkElement((Link)links.get(i)));
+ for (Object link : links) {
+ eEntry.addContent(generateLinkElement((Link) link));
}
if (entry.getAuthors()!=null && entry.getAuthors().size() > 0) {
@@ -192,9 +191,9 @@ public class Atom03Generator extends BaseWireFeedGenerator {
}
List contributors = entry.getContributors();
- for (int i = 0; i < contributors.size(); i++) {
+ for (Object contributor : contributors) {
Element contributorElement = new Element("contributor", getFeedNamespace());
- fillPersonElement(contributorElement, (Person)contributors.get(i));
+ fillPersonElement(contributorElement, (Person) contributor);
eEntry.addContent(contributorElement);
}
if (entry.getId() != null) {
@@ -226,9 +225,9 @@ public class Atom03Generator extends BaseWireFeedGenerator {
}
List contents = entry.getContents();
- for (int i = 0; i < contents.size(); i++) {
+ for (Object content : contents) {
Element contentElement = new Element("content", getFeedNamespace());
- fillContentElement(contentElement, (Content)contents.get(i));
+ fillContentElement(contentElement, (Content) content);
eEntry.addContent(contentElement);
}
@@ -249,7 +248,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
Element linkElement = new Element("link", getFeedNamespace());
if (link.getRel() != null) {
- Attribute relAttribute = new Attribute("rel", link.getRel().toString());
+ Attribute relAttribute = new Attribute("rel", link.getRel());
linkElement.setAttribute(relAttribute);
}
@@ -303,7 +302,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
String mode = content.getMode();
if (mode != null) {
- Attribute modeAttribute = new Attribute("mode", content.getMode().toString());
+ Attribute modeAttribute = new Attribute("mode", content.getMode());
contentElement.setAttribute(modeAttribute);
}
@@ -315,7 +314,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
contentElement.addContent(Base64.encode(content.getValue()));
} else if (mode.equals(Content.XML)) {
- StringBuffer tmpDocString = new StringBuffer("<tmpdoc>");
+ StringBuilder tmpDocString = new StringBuilder("<tmpdoc>");
tmpDocString.append(content.getValue());
tmpDocString.append("</tmpdoc>");
StringReader tmpDocReader = new StringReader(tmpDocString.toString());
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Parser.java
index a6aab55..1943cb2 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Parser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom03Parser.java
@@ -24,7 +24,9 @@ import org.jdom2.Element;
import org.jdom2.Namespace;
import org.jdom2.output.XMLOutputter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
/**
*/
@@ -167,15 +169,14 @@ public class Atom03Parser extends BaseWireFeedParser {
// List(Elements) -> List(Link)
private List parseLinks(List eLinks,boolean alternate) {
List links = new ArrayList();
- for (int i=0;i<eLinks.size();i++) {
- Element eLink = (Element) eLinks.get(i);
+ for (Object eLink1 : eLinks) {
+ Element eLink = (Element) eLink1;
String rel = getAttributeValue(eLink, "rel");
if (alternate) {
if ("alternate".equals(rel)) {
links.add(parseLink(eLink));
}
- }
- else {
+ } else {
if (!("alternate".equals(rel))) {
links.add(parseLink(eLink));
}
@@ -214,8 +215,8 @@ public class Atom03Parser extends BaseWireFeedParser {
// List(Elements) -> List(Persons)
private List parsePersons(List ePersons) {
List persons = new ArrayList();
- for (int i=0;i<ePersons.size();i++) {
- persons.add(parsePerson((Element)ePersons.get(i)));
+ for (Object ePerson : ePersons) {
+ persons.add(parsePerson((Element) ePerson));
}
return (persons.size()>0) ? persons : null;
}
@@ -228,29 +229,29 @@ public class Atom03Parser extends BaseWireFeedParser {
if (mode == null) {
mode = Content.XML; // default to xml content
}
- if (mode.equals(Content.ESCAPED)) {
- // do nothing XML Parser took care of this
- value = e.getText();
- }
- else
- if (mode.equals(Content.BASE64)) {
+ switch (mode) {
+ case Content.ESCAPED:
+ // do nothing XML Parser took care of this
+ value = e.getText();
+ break;
+ case Content.BASE64:
value = Base64.decode(e.getText());
- }
- else
- if (mode.equals(Content.XML)) {
- XMLOutputter outputter = new XMLOutputter();
- List eContent = e.getContent();
- Iterator i = eContent.iterator();
- while (i.hasNext()) {
- org.jdom2.Content c = (org.jdom2.Content) i.next();
- if (c instanceof Element) {
- Element eC = (Element) c;
- if (eC.getNamespace().equals(getAtomNamespace())) {
- ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
+ break;
+ case Content.XML:
+ XMLOutputter outputter = new XMLOutputter();
+ List eContent = e.getContent();
+ Iterator i = eContent.iterator();
+ while (i.hasNext()) {
+ org.jdom2.Content c = (org.jdom2.Content) i.next();
+ if (c instanceof Element) {
+ Element eC = (Element) c;
+ if (eC.getNamespace().equals(getAtomNamespace())) {
+ ((Element) c).setNamespace(Namespace.NO_NAMESPACE);
+ }
}
}
- }
- value = outputter.outputString(eContent);
+ value = outputter.outputString(eContent);
+ break;
}
Content content = new Content();
@@ -263,8 +264,8 @@ public class Atom03Parser extends BaseWireFeedParser {
// List(Elements) -> List(Entries)
private List parseEntries(List eEntries) {
List entries = new ArrayList();
- for (int i=0;i<eEntries.size();i++) {
- entries.add(parseEntry((Element)eEntries.get(i)));
+ for (Object eEntry : eEntries) {
+ entries.add(parseEntry((Element) eEntry));
}
return (entries.size()>0) ? entries : null;
}
@@ -321,8 +322,8 @@ public class Atom03Parser extends BaseWireFeedParser {
eList = eEntry.getChildren("content",getAtomNamespace());
if (eList.size()>0) {
List content = new ArrayList();
- for (int i=0;i<eList.size();i++) {
- content.add(parseContent((Element)eList.get(i)));
+ for (Object anEList : eList) {
+ content.add(parseContent((Element) anEList));
}
entry.setContents(content);
}