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:46 UTC
[1/4] marmotta git commit: more code hygiene,
clean up redundant or unnecessary code
Repository: marmotta
Updated Branches:
refs/heads/develop 7160bd1c1 -> f45e3ddd6
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RdfStringMatcher.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RdfStringMatcher.java b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RdfStringMatcher.java
index 7f5adc3..297bdd7 100644
--- a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RdfStringMatcher.java
+++ b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RdfStringMatcher.java
@@ -102,7 +102,7 @@ public class RdfStringMatcher<T extends String> extends SesameMatcher<T> impleme
* @see org.apache.marmotta.commons.sesame.test.base.AbstractRepositoryConnectionMatcher
*/
public static <T extends String> Matcher<T> wrap(RDFFormat format, String baseUri, Matcher<? extends RepositoryConnection> delegate) {
- return new RdfStringMatcher<T>(format, baseUri, delegate);
+ return new RdfStringMatcher<>(format, baseUri, delegate);
}
/**
@@ -115,7 +115,7 @@ public class RdfStringMatcher<T extends String> extends SesameMatcher<T> impleme
*/
@SafeVarargs
public static <T extends String> Matcher<T> wrap(RDFFormat format, String baseUri, Matcher<? extends RepositoryConnection>... delegates) {
- return new RdfStringMatcher<T>(format, baseUri, delegates);
+ return new RdfStringMatcher<>(format, baseUri, delegates);
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RepositoryMatcher.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RepositoryMatcher.java b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RepositoryMatcher.java
index 187b3f9..09e9a3e 100644
--- a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RepositoryMatcher.java
+++ b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/base/RepositoryMatcher.java
@@ -32,6 +32,7 @@ public class RepositoryMatcher<T extends Repository> extends SesameMatcher<T> im
/**
* @param delegates the Matcher to wrap.
*/
+ @SafeVarargs
public RepositoryMatcher(Matcher<? extends RepositoryConnection>... delegates) {
this.delegates = delegates;
}
@@ -92,7 +93,7 @@ public class RepositoryMatcher<T extends Repository> extends SesameMatcher<T> im
* @param connectionMatcher the {@link AbstractRepositoryConnectionMatcher} to wrap
*/
public static <T extends Repository> Matcher<T> wrap(Matcher<? extends RepositoryConnection> connectionMatcher) {
- return new RepositoryMatcher<T>(connectionMatcher);
+ return new RepositoryMatcher<>(connectionMatcher);
}
/**
@@ -100,7 +101,8 @@ public class RepositoryMatcher<T extends Repository> extends SesameMatcher<T> im
*
* @param connectionMatchers the {@link AbstractRepositoryConnectionMatcher}s to wrap
*/
+ @SafeVarargs
public static <T extends Repository> Matcher<T> wrap(Matcher<? extends RepositoryConnection>... connectionMatchers) {
- return new RepositoryMatcher<T>(connectionMatchers);
+ return new RepositoryMatcher<>(connectionMatchers);
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/connection/HasStatementMatcher.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/connection/HasStatementMatcher.java b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/connection/HasStatementMatcher.java
index d4803a0..f1a782b 100644
--- a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/connection/HasStatementMatcher.java
+++ b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/connection/HasStatementMatcher.java
@@ -95,6 +95,6 @@ public class HasStatementMatcher<T extends RepositoryConnection> extends Abstrac
* @see org.openrdf.repository.RepositoryConnection#hasStatement(org.openrdf.model.Resource, org.openrdf.model.URI, org.openrdf.model.Value, boolean, org.openrdf.model.Resource...)
*/
public static <T extends RepositoryConnection> Matcher<T> hasStatement(Resource subject, URI predicate, Value object, Resource... contexts) {
- return new HasStatementMatcher<T>(subject, predicate, object, contexts);
+ return new HasStatementMatcher<>(subject, predicate, object, contexts);
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlAskMatcher.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlAskMatcher.java b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlAskMatcher.java
index f9bd2d0..63bafb3 100644
--- a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlAskMatcher.java
+++ b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlAskMatcher.java
@@ -55,7 +55,7 @@ public class SparqlAskMatcher<T extends RepositoryConnection> extends SparqlMatc
* @see org.openrdf.query.BooleanQuery#evaluate()
*/
public static <T extends RepositoryConnection> Matcher<T> sparqlAsk(String baseUri, String askQuery) {
- return new SparqlAskMatcher<T>(baseUri, askQuery);
+ return new SparqlAskMatcher<>(baseUri, askQuery);
}
/**
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlGraphQueryMatcher.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlGraphQueryMatcher.java b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlGraphQueryMatcher.java
index fca9ed9..f7d2e6d 100644
--- a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlGraphQueryMatcher.java
+++ b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlGraphQueryMatcher.java
@@ -94,7 +94,7 @@ public class SparqlGraphQueryMatcher<T extends RepositoryConnection> extends Spa
* @param matcher the AbstractRepositoryConnectionMatcher to match
*/
public static <T extends RepositoryConnection> Matcher<T> sparqlGraphQuery(String baseUri, String query, Matcher<? extends RepositoryConnection> matcher) {
- return new SparqlGraphQueryMatcher<T>(baseUri, query, matcher);
+ return new SparqlGraphQueryMatcher<>(baseUri, query, matcher);
}
/**
@@ -108,6 +108,6 @@ public class SparqlGraphQueryMatcher<T extends RepositoryConnection> extends Spa
*/
@SafeVarargs
public static <T extends RepositoryConnection> Matcher<T> sparqlGraphQuery(String baseUri, String query, Matcher<? extends RepositoryConnection>... matchers) {
- return new SparqlGraphQueryMatcher<T>(baseUri, query, matchers);
+ return new SparqlGraphQueryMatcher<>(baseUri, query, matchers);
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlTupleQueryMatcher.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlTupleQueryMatcher.java b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlTupleQueryMatcher.java
index 8df97eb..9c88cee 100644
--- a/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlTupleQueryMatcher.java
+++ b/commons/marmotta-sesame-tools/marmotta-sesame-matchers/src/main/java/org/apache/marmotta/commons/sesame/test/sparql/SparqlTupleQueryMatcher.java
@@ -53,12 +53,12 @@ public class SparqlTupleQueryMatcher<T extends RepositoryConnection> extends Spa
}
public static <T extends RepositoryConnection> Matcher<T> sparqlQuery(String baseUri, String query, Matcher<Iterable<BindingSet>> matcher) {
- return new SparqlTupleQueryMatcher<T>(baseUri, query, matcher);
+ return new SparqlTupleQueryMatcher<>(baseUri, query, matcher);
}
@SafeVarargs
public static <T extends RepositoryConnection> Matcher<T> sparqlQuery(String baseUri, String query, Matcher<Iterable<BindingSet>>... matchers) {
- return new SparqlTupleQueryMatcher<T>(baseUri, query, CoreMatchers.allOf(matchers));
+ return new SparqlTupleQueryMatcher<>(baseUri, query, CoreMatchers.allOf(matchers));
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java b/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java
index 8cfba98..24039ab 100644
--- a/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java
+++ b/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingImpl.java
@@ -16,10 +16,6 @@
*/
package org.apache.marmotta.commons.sesame.facading.impl;
-import java.lang.reflect.Proxy;
-import java.util.Collection;
-import java.util.LinkedList;
-
import org.apache.marmotta.commons.sesame.facading.annotations.RDF;
import org.apache.marmotta.commons.sesame.facading.annotations.RDFContext;
import org.apache.marmotta.commons.sesame.facading.annotations.RDFFilter;
@@ -34,6 +30,10 @@ import org.openrdf.repository.RepositoryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.lang.reflect.Proxy;
+import java.util.Collection;
+import java.util.LinkedList;
+
/**
* Offers methods for loading and proxying Facades. A {@link Facade} is an interface that defines a
@@ -171,14 +171,14 @@ public class FacadingImpl implements Facading {
@Override
public <C extends Facade> Collection<C> createFacade(Collection<? extends Resource> list, Class<C> type, URI context) {
log.trace("createFacadeList: creating {} facade over {} content items",type.getName(),list.size());
- LinkedList<C> result = new LinkedList<C>();
+ LinkedList<C> result = new LinkedList<>();
if(type.isAnnotationPresent(RDFFilter.class)) {
try {
if (!connection.isOpen()) { throw new IllegalStateException("the connection is already closed, cannot access triple-store."); }
if (!connection.isActive()) { throw new IllegalStateException("no active transaction, cannot access triple-store."); }
// if the RDFType annotation is present, filter out content items that are of the wrong type
- LinkedList<URI> acceptable_types = new LinkedList<URI>();
+ LinkedList<URI> acceptable_types = new LinkedList<>();
if(FacadeUtils.isFacadeAnnotationPresent(type,RDFFilter.class)) {
String[] a_type = FacadeUtils.getFacadeAnnotation(type,RDFFilter.class).value();
for(String s_type : a_type) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java b/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java
index d6d29a5..987b957 100644
--- a/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java
+++ b/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHandler.java
@@ -57,7 +57,7 @@ class FacadingInvocationHandler implements InvocationHandler {
private static final String[] PX, SPX;
static {
- LinkedList<String> ops = new LinkedList<String>();
+ LinkedList<String> ops = new LinkedList<>();
for (OPERATOR op : OPERATOR.values()) {
Collections.addAll(ops, op.prefixes);
}
@@ -171,7 +171,7 @@ class FacadingInvocationHandler implements InvocationHandler {
this.context = null;
}
- fieldCache = new HashMap<String, Object>();
+ fieldCache = new HashMap<>();
// disable cache, it does not work well with deleted triples ...
useCache = false;
@@ -534,9 +534,8 @@ class FacadingInvocationHandler implements InvocationHandler {
try {
// transformation to appropriate primitive type
- final C result = FacadeUtils.transformToBaseType(value, returnType);
- return result;
+ return FacadeUtils.transformToBaseType(value, returnType);
} catch (final IllegalArgumentException ex) {
return null;
}
@@ -702,7 +701,7 @@ class FacadingInvocationHandler implements InvocationHandler {
private <C> Set<C> queryOutgoingAll(Resource entity, String rdf_property, Class<C> returnType) throws RepositoryException {
final URI property = connection.getValueFactory().createURI(rdf_property);
- final Set<C> dupSet = new LinkedHashSet<C>();
+ final Set<C> dupSet = new LinkedHashSet<>();
final RepositoryResult<Statement> triples = connection.getStatements(entity, property, null, false);
try {
while (triples.hasNext()) {
@@ -728,7 +727,7 @@ class FacadingInvocationHandler implements InvocationHandler {
private <C> Set<C> queryIncomingAll(Resource entity, String rdf_property, Class<C> returnType) throws RepositoryException {
final URI property = connection.getValueFactory().createURI(rdf_property);
- final Set<C> dupSet = new LinkedHashSet<C>();
+ final Set<C> dupSet = new LinkedHashSet<>();
final RepositoryResult<Statement> triples = connection.getStatements(null, property, entity, false);
try {
while (triples.hasNext()) {
@@ -769,7 +768,7 @@ class FacadingInvocationHandler implements InvocationHandler {
private Set<String> getProperties(Resource entity, URI property, Locale loc, URI context) throws RepositoryException {
final String lang = loc == null ? null : loc.getLanguage().toLowerCase();
- final Set<String> values = new HashSet<String>();
+ final Set<String> values = new HashSet<>();
final RepositoryResult<Statement> candidates = connection.getStatements(entity, property, null, false, context);
try {
while (candidates.hasNext()) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHelper.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHelper.java b/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHelper.java
index d4d443e..e333d82 100644
--- a/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHelper.java
+++ b/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/impl/FacadingInvocationHelper.java
@@ -103,9 +103,8 @@ class FacadingInvocationHelper {
static boolean isMultiValue(Method method) {
final FacadingInvocationHandler.OPERATOR oper = FacadingInvocationHandler.OPERATOR.getOperator(method);
- final boolean isMultiValue = oper.writeOp && method.getParameterTypes().length == 0 ||
+ return oper.writeOp && method.getParameterTypes().length == 0 ||
FacadeUtils.isCollection(oper.writeOp && oper.numArgs > 0 ? method.getParameterTypes()[0] : method.getReturnType());
- return isMultiValue;
}
static boolean checkLocale(final Locale loc, final Value object) {
@@ -128,9 +127,9 @@ class FacadingInvocationHelper {
if (Modifier.isAbstract(collectionType.getModifiers())) {
// FIXME: Maybe we should add some more implementations here?
if (collectionType.isAssignableFrom(HashSet.class)) {
- result = new HashSet<E>();
+ result = new HashSet<>();
} else if (collectionType.isAssignableFrom(LinkedList.class)) {
- result = new LinkedList<E>();
+ result = new LinkedList<>();
} else {
throw new InstantiationException("Could not find an implementation of " + collectionType.getName());
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java b/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java
index 0ee82cc..d4da08f 100644
--- a/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java
+++ b/commons/marmotta-sesame-tools/marmotta-util-facading/src/main/java/org/apache/marmotta/commons/sesame/facading/util/FacadeUtils.java
@@ -127,9 +127,8 @@ public class FacadeUtils {
}
final Class<?> clazz = in.getClass();
- final boolean result = isFacade(clazz);
- return result;
+ return isFacade(clazz);
}
/**
@@ -215,8 +214,7 @@ public class FacadeUtils {
}
// even if the char is a primitive is not a number
- final boolean isCharacter = Character.class.equals(clazz);
- return isCharacter;
+ return Character.class.equals(clazz);
}
@@ -254,8 +252,7 @@ public class FacadeUtils {
}
final Class<? super C> superClass = clazz.getSuperclass();
- final boolean isNumber = Number.class.equals(superClass);
- return isNumber;
+ return Number.class.equals(superClass);
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/AllOfFilter.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/AllOfFilter.java b/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/AllOfFilter.java
index 5e531eb..88e2d11 100644
--- a/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/AllOfFilter.java
+++ b/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/AllOfFilter.java
@@ -33,8 +33,9 @@ public class AllOfFilter<T> implements SesameFilter<T> {
private Set<SesameFilter<T>> children;
+ @SafeVarargs
public AllOfFilter(SesameFilter<T>... children) {
- this(new HashSet<SesameFilter<T>>(Arrays.asList(children)));
+ this(new HashSet<>(Arrays.asList(children)));
}
public AllOfFilter(Set<SesameFilter<T>> children) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/OneOfFilter.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/OneOfFilter.java b/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/OneOfFilter.java
index da5af16..790e629 100644
--- a/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/OneOfFilter.java
+++ b/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/OneOfFilter.java
@@ -32,8 +32,9 @@ public class OneOfFilter<T> implements SesameFilter<T> {
private Set<SesameFilter<T>> children;
+ @SafeVarargs
public OneOfFilter(SesameFilter<T>... children) {
- this(new HashSet<SesameFilter<T>>(Arrays.asList(children)));
+ this(new HashSet<>(Arrays.asList(children)));
}
public OneOfFilter(Set<SesameFilter<T>> children) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriPrefixFilter.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriPrefixFilter.java b/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriPrefixFilter.java
index 4287dd0..fd702d2 100644
--- a/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriPrefixFilter.java
+++ b/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriPrefixFilter.java
@@ -35,7 +35,7 @@ public class UriPrefixFilter implements ResourceFilter {
private Set<String> prefixes;
public UriPrefixFilter(String... prefixes) {
- this(new HashSet<String>(Arrays.asList(prefixes)));
+ this(new HashSet<>(Arrays.asList(prefixes)));
}
public UriPrefixFilter(Set<String> prefixes) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriRegexFilter.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriRegexFilter.java b/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriRegexFilter.java
index 608c35e..fc086cc 100644
--- a/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriRegexFilter.java
+++ b/commons/marmotta-sesame-tools/marmotta-util-filter/src/main/java/org/apache/marmotta/commons/sesame/filter/resource/UriRegexFilter.java
@@ -36,7 +36,7 @@ public class UriRegexFilter implements ResourceFilter {
public UriRegexFilter(Collection<String> regexps) {
- patterns = new HashSet<Pattern>();
+ patterns = new HashSet<>();
for(String s : regexps) {
Pattern p = Pattern.compile(s);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java b/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java
index 2897212..7d50b04 100644
--- a/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java
+++ b/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java
@@ -56,15 +56,15 @@ public class TripleTable<Triple extends Statement> implements Set<Triple>, Seria
public TripleTable() {
data = StatementCommons.newQuadrupleSet();
- indexSPOC = new TreeMap<IntArray, Triple>();
- indexCSPO = new TreeMap<IntArray, Triple>();
+ indexSPOC = new TreeMap<>();
+ indexCSPO = new TreeMap<>();
}
public TripleTable(Collection<Triple> triples) {
data = StatementCommons.newQuadrupleSet();
- indexSPOC = new TreeMap<IntArray, Triple>();
- indexCSPO = new TreeMap<IntArray, Triple>();
+ indexSPOC = new TreeMap<>();
+ indexCSPO = new TreeMap<>();
addAll(triples);
}
[4/4] marmotta git commit: more code hygiene,
clean up redundant or unnecessary code
Posted by ss...@apache.org.
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);
}
[3/4] marmotta git commit: more code hygiene,
clean up redundant or unnecessary code
Posted by ss...@apache.org.
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/Atom10Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom10Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom10Generator.java
index 6228b21..82537b7 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom10Generator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom10Generator.java
@@ -16,30 +16,22 @@
*/
package com.sun.syndication.io.impl;
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.List;
-
+import com.sun.syndication.feed.WireFeed;
+import com.sun.syndication.feed.atom.*;
+import com.sun.syndication.io.FeedException;
+import com.sun.syndication.io.WireFeedOutput;
import org.jdom2.Attribute;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.Namespace;
import org.jdom2.input.SAXBuilder;
+import org.jdom2.output.XMLOutputter;
-import com.sun.syndication.feed.WireFeed;
-import com.sun.syndication.feed.atom.Category;
-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.Generator;
-import com.sun.syndication.feed.atom.Link;
-import com.sun.syndication.feed.atom.Person;
-import com.sun.syndication.io.FeedException;
-import com.sun.syndication.io.WireFeedOutput;
import java.io.IOException;
+import java.io.StringReader;
import java.io.Writer;
import java.util.ArrayList;
-import org.jdom2.output.XMLOutputter;
+import java.util.List;
/**
* Feed Generator for Atom
@@ -103,17 +95,16 @@ public class Atom10Generator extends BaseWireFeedGenerator {
}
protected void addFeed(Feed feed,Element parent) throws FeedException {
- Element eFeed = parent;
- populateFeedHeader(feed,eFeed);
- generateForeignMarkup(eFeed, (List)feed.getForeignMarkup());
- checkFeedHeaderConstraints(eFeed);
- generateFeedModules(feed.getModules(),eFeed);
+ populateFeedHeader(feed, parent);
+ generateForeignMarkup(parent, (List)feed.getForeignMarkup());
+ checkFeedHeaderConstraints(parent);
+ generateFeedModules(feed.getModules(), parent);
}
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);
}
@@ -138,17 +129,17 @@ public class Atom10Generator extends BaseWireFeedGenerator {
}
List links = feed.getAlternateLinks();
- if (links != null) for (int i = 0; i < links.size(); i++) {
- eFeed.addContent(generateLinkElement((Link)links.get(i)));
+ if (links != null) for (Object link : links) {
+ eFeed.addContent(generateLinkElement((Link) link));
}
links = feed.getOtherLinks();
- if (links != null) for (int j = 0; j < links.size(); j++) {
- eFeed.addContent(generateLinkElement((Link)links.get(j)));
+ if (links != null) for (Object link : links) {
+ eFeed.addContent(generateLinkElement((Link) link));
}
List cats = feed.getCategories();
- if (cats != null) for (Iterator iter=cats.iterator(); iter.hasNext();) {
- eFeed.addContent(generateCategoryElement((Category)iter.next()));
+ if (cats != null) for (Object cat : cats) {
+ eFeed.addContent(generateCategoryElement((Category) cat));
}
List authors = feed.getAuthors();
@@ -162,9 +153,9 @@ public class Atom10Generator extends BaseWireFeedGenerator {
List contributors = feed.getContributors();
if (contributors != null && contributors.size() > 0) {
- 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);
}
}
@@ -210,21 +201,21 @@ public class Atom10Generator extends BaseWireFeedGenerator {
}
List links = entry.getAlternateLinks();
if (links != null) {
- for (int i = 0; i < links.size(); i++) {
- eEntry.addContent(generateLinkElement((Link)links.get(i)));
+ for (Object link : links) {
+ eEntry.addContent(generateLinkElement((Link) link));
}
}
links = entry.getOtherLinks();
if (links != null) {
- for (int i = 0; i < links.size(); i++) {
- eEntry.addContent(generateLinkElement((Link)links.get(i)));
+ for (Object link : links) {
+ eEntry.addContent(generateLinkElement((Link) link));
}
}
List cats = entry.getCategories();
if (cats != null) {
- for (int i = 0; i < cats.size(); i++) {
- eEntry.addContent(generateCategoryElement((Category)cats.get(i)));
+ for (Object cat : cats) {
+ eEntry.addContent(generateCategoryElement((Category) cat));
}
}
@@ -239,9 +230,9 @@ public class Atom10Generator extends BaseWireFeedGenerator {
List contributors = entry.getContributors();
if (contributors != null && contributors.size() > 0) {
- 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);
}
}
@@ -397,7 +388,7 @@ public class Atom10Generator extends BaseWireFeedGenerator {
if (atomType != null && (atomType.equals(Content.XHTML) || (atomType.indexOf("/xml")) != -1 ||
(atomType.indexOf("+xml")) != -1)) {
- 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/Atom10Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom10Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom10Parser.java
index ccfc237..2c9896e 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom10Parser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Atom10Parser.java
@@ -16,34 +16,22 @@
*/
package com.sun.syndication.io.impl;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jdom2.Document;
-import org.jdom2.Element;
-import org.jdom2.Namespace;
-import org.jdom2.output.XMLOutputter;
-
import com.sun.syndication.feed.WireFeed;
-import com.sun.syndication.feed.atom.Category;
+import com.sun.syndication.feed.atom.*;
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.Generator;
-import com.sun.syndication.feed.atom.Link;
-import com.sun.syndication.feed.atom.Person;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.WireFeedInput;
import com.sun.syndication.io.WireFeedOutput;
+import org.jdom2.*;
+import org.jdom2.input.SAXBuilder;
+import org.jdom2.output.XMLOutputter;
+
import java.io.IOException;
import java.io.Reader;
import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
import java.util.regex.Pattern;
-import org.jdom2.Attribute;
-import org.jdom2.JDOMException;
-import org.jdom2.Parent;
-import org.jdom2.input.SAXBuilder;
/**
* Parser for Atom 1.0
@@ -239,7 +227,7 @@ public class Atom10Parser extends BaseWireFeedParser {
if (att!=null) {
Long val = NumberParser.parseLong(att);
if (val != null) {
- link.setLength(val.longValue());
+ link.setLength(val);
}
}
return link;
@@ -248,8 +236,8 @@ public class Atom10Parser extends BaseWireFeedParser {
// List(Elements) -> List(Link)
private List parseAlternateLinks(Feed feed, Entry entry, String baseURI, List eLinks) {
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;
Link link = parseLink(feed, entry, baseURI, eLink);
if (link.getRel() == null
|| "".equals(link.getRel().trim())
@@ -262,8 +250,8 @@ public class Atom10Parser extends BaseWireFeedParser {
private List parseOtherLinks(Feed feed, Entry entry, String baseURI, List eLinks) {
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;
Link link = parseLink(feed, entry, baseURI, eLink);
if (!"alternate".equals(link.getRel())) {
links.add(link);
@@ -296,8 +284,8 @@ public class Atom10Parser extends BaseWireFeedParser {
// List(Elements) -> List(Persons)
private List parsePersons(String baseURI, List ePersons) {
List persons = new ArrayList();
- for (int i=0;i<ePersons.size();i++) {
- persons.add(parsePerson(baseURI, (Element)ePersons.get(i)));
+ for (Object ePerson : ePersons) {
+ persons.add(parsePerson(baseURI, (Element) ePerson));
}
return (persons.size()>0) ? persons : null;
}
@@ -321,13 +309,12 @@ public class Atom10Parser extends BaseWireFeedParser {
// XHTML content needs special handling
XMLOutputter outputter = new XMLOutputter();
List eContent = e.getContent();
- Iterator i = eContent.iterator();
- while (i.hasNext()) {
- org.jdom2.Content c = (org.jdom2.Content) i.next();
+ for (Object anEContent : eContent) {
+ org.jdom2.Content c = (org.jdom2.Content) anEContent;
if (c instanceof Element) {
Element eC = (Element) c;
if (eC.getNamespace().equals(getAtomNamespace())) {
- ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
+ ((Element) c).setNamespace(Namespace.NO_NAMESPACE);
}
}
}
@@ -342,8 +329,8 @@ public class Atom10Parser extends BaseWireFeedParser {
// List(Elements) -> List(Entries)
protected List parseEntries(Feed feed, String baseURI, List eEntries) {
List entries = new ArrayList();
- for (int i=0;i<eEntries.size();i++) {
- entries.add(parseEntry(feed, (Element)eEntries.get(i), baseURI));
+ for (Object eEntry : eEntries) {
+ entries.add(parseEntry(feed, (Element) eEntry, baseURI));
}
return (entries.size()>0) ? entries : null;
}
@@ -431,8 +418,8 @@ public class Atom10Parser extends BaseWireFeedParser {
private List parseCategories(String baseURI, List eCategories) {
List cats = new ArrayList();
- for (int i=0;i<eCategories.size();i++) {
- Element eCategory = (Element) eCategories.get(i);
+ for (Object eCategory1 : eCategories) {
+ Element eCategory = (Element) eCategory1;
cats.add(parseCategory(baseURI, eCategory));
}
return (cats.size()>0) ? cats : null;
@@ -547,7 +534,7 @@ public class Atom10Parser extends BaseWireFeedParser {
if (findAtomLink(root, "self") != null) {
ret = findAtomLink(root, "self");
if (".".equals(ret) || "./".equals(ret)) ret = "";
- if (ret.indexOf("/") != -1) ret = ret.substring(0, ret.lastIndexOf("/"));
+ if (ret.contains("/")) ret = ret.substring(0, ret.lastIndexOf("/"));
ret = resolveURI(null, root, ret);
}
return ret;
@@ -563,12 +550,12 @@ public class Atom10Parser extends BaseWireFeedParser {
String ret = null;
List linksList = parent.getChildren("link", ATOM_10_NS);
if (linksList != null) {
- for (Iterator links = linksList.iterator(); links.hasNext(); ) {
- Element link = (Element)links.next();
+ for (Object aLinksList : linksList) {
+ Element link = (Element) aLinksList;
Attribute relAtt = getAttribute(link, "rel");
Attribute hrefAtt = getAttribute(link, "href");
- if ( (relAtt == null && "alternate".equals(rel))
- || (relAtt != null && relAtt.getValue().equals(rel))) {
+ if ((relAtt == null && "alternate".equals(rel))
+ || (relAtt != null && relAtt.getValue().equals(rel))) {
ret = hrefAtt.getValue();
break;
}
@@ -589,14 +576,13 @@ public class Atom10Parser extends BaseWireFeedParser {
if (append.startsWith("..")) {
String ret = null;
String[] parts = append.split("/");
- for (int i=0; i<parts.length; i++) {
- if ("..".equals(parts[i])) {
+ for (String part : parts) {
+ if ("..".equals(part)) {
int last = base.lastIndexOf("/");
if (last != -1) {
base = base.substring(0, last);
append = append.substring(3, append.length());
- }
- else break;
+ } else break;
}
}
}
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/Base64.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Base64.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Base64.java
index 3c86ef7..177383b 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Base64.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/Base64.java
@@ -144,9 +144,9 @@ public class Base64 {
}
byte[] cleanEData = (byte[]) eData.clone();
int cleanELength = 0;
- for (int i=0;i<eData.length;i++) {
- if (eData[i]<256 && CODES[eData[i]]<64) {
- cleanEData[cleanELength++] = eData[i];
+ for (byte anEData : eData) {
+ if (anEData < 256 && CODES[anEData] < 64) {
+ cleanEData[cleanELength++] = anEData;
}
}
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/BaseWireFeedGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/BaseWireFeedGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/BaseWireFeedGenerator.java
index 72a2b70..b4181fc 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/BaseWireFeedGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/BaseWireFeedGenerator.java
@@ -64,8 +64,8 @@ public abstract class BaseWireFeedGenerator implements WireFeedGenerator {
}
protected void generateModuleNamespaceDefs(Element root) {
- for (int i = 0; i < _allModuleNamespaces.length; i++) {
- root.addNamespaceDeclaration(_allModuleNamespaces[i]);
+ for (Namespace _allModuleNamespace : _allModuleNamespaces) {
+ root.addNamespaceDeclaration(_allModuleNamespace);
}
}
@@ -113,8 +113,8 @@ public abstract class BaseWireFeedGenerator implements WireFeedGenerator {
List additionalNamespaces = new java.util.ArrayList();
additionalNamespaces.addAll(list); // the duplication will prevent a ConcurrentModificationException below
- for (int i = 0; i < additionalNamespaces.size(); i++) {
- Namespace ns = (Namespace) additionalNamespaces.get(i);
+ for (Object additionalNamespace : additionalNamespaces) {
+ Namespace ns = (Namespace) additionalNamespace;
String prefix = ns.getPrefix();
if (prefix != null && prefix.length() > 0 && !usedPrefixes.contains(prefix)) {
root.removeNamespaceDeclaration(ns);
@@ -128,8 +128,8 @@ public abstract class BaseWireFeedGenerator implements WireFeedGenerator {
collector.add(prefix);
}
List kids = el.getChildren();
- for (int i = 0; i < kids.size(); i++) {
- collectUsedPrefixes((Element) kids.get(i), collector); // recursion - worth it
+ for (Object kid : kids) {
+ collectUsedPrefixes((Element) kid, collector); // recursion - worth it
}
}
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/BaseWireFeedParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/BaseWireFeedParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/BaseWireFeedParser.java
index ba48cef..35db418 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/BaseWireFeedParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/BaseWireFeedParser.java
@@ -3,13 +3,12 @@ package com.sun.syndication.io.impl;
import com.sun.syndication.feed.WireFeed;
import com.sun.syndication.feed.module.Extendable;
import com.sun.syndication.io.WireFeedParser;
-import java.util.ArrayList;
-import java.util.Iterator;
+import org.jdom2.Attribute;
import org.jdom2.Element;
+import org.jdom2.Namespace;
+import java.util.ArrayList;
import java.util.List;
-import org.jdom2.Namespace;
-import org.jdom2.Attribute;
/**
* @author Alejandro Abdelnur
@@ -74,24 +73,21 @@ public abstract class BaseWireFeedParser implements WireFeedParser {
protected List extractForeignMarkup(Element e, Extendable ext, Namespace basens) {
ArrayList foreignMarkup = new ArrayList();
- Iterator children = e.getChildren().iterator();
- while (children.hasNext()) {
- Element elem = (Element)children.next();
- if (
- // if elemet not in the RSS namespace
- !basens.equals(elem.getNamespace())
- // and elem was not handled by a module
- && null == ext.getModule(elem.getNamespaceURI())) {
-
- // save it as foreign markup,
- // but we can't detach it while we're iterating
- foreignMarkup.add(elem.clone());
+ for (Element elem : e.getChildren()) {
+ if (
+ // if elemet not in the RSS namespace
+ !basens.equals(elem.getNamespace())
+ // and elem was not handled by a module
+ && null == ext.getModule(elem.getNamespaceURI())) {
+
+ // save it as foreign markup,
+ // but we can't detach it while we're iterating
+ foreignMarkup.add(elem.clone());
}
}
// Now we can detach the foreign markup elements
- Iterator fm = foreignMarkup.iterator();
- while (fm.hasNext()) {
- Element elem = (Element)fm.next();
+ for (Object aForeignMarkup : foreignMarkup) {
+ Element elem = (Element) aForeignMarkup;
elem.detach();
}
return foreignMarkup;
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/DCModuleGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/DCModuleGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/DCModuleGenerator.java
index b96d3e3..2595b1f 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/DCModuleGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/DCModuleGenerator.java
@@ -101,8 +101,8 @@ public class DCModuleGenerator implements ModuleGenerator {
element.addContent(generateSimpleElementList("creator", dcModule.getCreators()));
}
List subjects = dcModule.getSubjects();
- for (int i = 0; i < subjects.size(); i++) {
- element.addContent(generateSubjectElement((DCSubject) subjects.get(i)));
+ for (Object subject : subjects) {
+ element.addContent(generateSubjectElement((DCSubject) subject));
}
if (dcModule.getDescription() != null) {
element.addContent(generateSimpleElementList("description", dcModule.getDescriptions()));
@@ -114,9 +114,9 @@ public class DCModuleGenerator implements ModuleGenerator {
element.addContent(generateSimpleElementList("contributor", dcModule.getContributors()));
}
if (dcModule.getDate() != null) {
- for (Iterator i = dcModule.getDates().iterator(); i.hasNext();) {
+ for (Date date : dcModule.getDates()) {
element.addContent(generateSimpleElement("date",
- DateParser.formatW3CDateTime((Date) i.next())));
+ DateParser.formatW3CDateTime(date)));
}
}
if (dcModule.getType() != null) {
@@ -197,8 +197,8 @@ public class DCModuleGenerator implements ModuleGenerator {
*/
protected final List generateSimpleElementList(String name, List value) {
List elements = new ArrayList();
- for (Iterator i = value.iterator(); i.hasNext();) {
- elements.add(generateSimpleElement(name, (String) i.next()));
+ for (Object aValue : value) {
+ elements.add(generateSimpleElement(name, (String) aValue));
}
return elements;
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/DCModuleParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/DCModuleParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/DCModuleParser.java
index d42828e..a79beab 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/DCModuleParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/DCModuleParser.java
@@ -23,7 +23,6 @@ import org.jdom2.Element;
import org.jdom2.Namespace;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
/**
@@ -169,14 +168,14 @@ public class DCModuleParser implements ModuleParser {
*/
protected final List parseSubjects(List eList) {
List subjects = new ArrayList();
- for (Iterator i = eList.iterator(); i.hasNext();) {
- Element eSubject = (Element) i.next();
+ for (Object anEList : eList) {
+ Element eSubject = (Element) anEList;
Element eDesc = eSubject.getChild("Description", getRDFNamespace());
if (eDesc != null) {
String taxonomy = getTaxonomy(eDesc);
List eValues = eDesc.getChildren("value", getRDFNamespace());
- for (Iterator v = eValues.iterator(); v.hasNext();) {
- Element eValue = (Element) v.next();
+ for (Object eValue1 : eValues) {
+ Element eValue = (Element) eValue1;
DCSubject subject = new DCSubjectImpl();
subject.setTaxonomyUri(taxonomy);
subject.setValue(eValue.getText());
@@ -200,8 +199,8 @@ public class DCModuleParser implements ModuleParser {
*/
protected final List parseElementList(List eList) {
List values= new ArrayList();
- for (Iterator i = eList.iterator(); i.hasNext();) {
- Element e = (Element) i.next();
+ for (Object anEList : eList) {
+ Element e = (Element) anEList;
values.add(e.getText());
}
@@ -216,8 +215,8 @@ public class DCModuleParser implements ModuleParser {
*/
protected final List parseElementListDate(List eList) {
List values = new ArrayList();
- for (Iterator i = eList.iterator(); i.hasNext();) {
- Element e = (Element) i.next();
+ for (Object anEList : eList) {
+ Element e = (Element) anEList;
values.add(DateParser.parseDate(e.getText()));
}
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/ModuleGenerators.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/ModuleGenerators.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/ModuleGenerators.java
index 9c493f9..83d1f8d 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/ModuleGenerators.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/ModuleGenerators.java
@@ -48,10 +48,10 @@ public class ModuleGenerators extends PluginManager {
public void generateModules(List modules, Element element) {
Map generators = getPluginMap();
- for (int i = 0; i < modules.size(); i++) {
- Module module = (Module) modules.get(i);
+ for (Object module1 : modules) {
+ Module module = (Module) module1;
String namespaceUri = module.getUri();
- ModuleGenerator generator = (ModuleGenerator)generators.get(namespaceUri);
+ ModuleGenerator generator = (ModuleGenerator) generators.get(namespaceUri);
if (generator != null) {
generator.generate(module, element);
}
@@ -62,8 +62,8 @@ public class ModuleGenerators extends PluginManager {
if (_allNamespaces==null) {
_allNamespaces = new HashSet();
List mUris = getModuleNamespaces();
- for (int i=0;i<mUris.size();i++) {
- ModuleGenerator mGen = getGenerator((String)mUris.get(i));
+ for (Object mUri : mUris) {
+ ModuleGenerator mGen = getGenerator((String) mUri);
_allNamespaces.addAll(mGen.getNamespaces());
}
}
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/ModuleParsers.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/ModuleParsers.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/ModuleParsers.java
index ac895fb..447c393 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/ModuleParsers.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/ModuleParsers.java
@@ -43,8 +43,8 @@ public class ModuleParsers extends PluginManager {
public List parseModules(Element root) {
List parsers = getPlugins();
List modules = null;
- for (int i=0;i<parsers.size();i++) {
- ModuleParser parser = (ModuleParser) parsers.get(i);
+ for (Object parser1 : parsers) {
+ ModuleParser parser = (ModuleParser) parser1;
String namespaceUri = parser.getNamespaceUri();
Namespace namespace = Namespace.getNamespace(namespaceUri);
if (hasElementsFrom(root, namespace)) {
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/NumberParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/NumberParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/NumberParser.java
index 6076b7b..58c8ff3 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/NumberParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/NumberParser.java
@@ -33,7 +33,7 @@ public class NumberParser {
public static Long parseLong(String str) {
if (null != str) {
try {
- return new Long(Long.parseLong(str.trim()));
+ return Long.parseLong(str.trim());
} catch (Exception e) {
// :IGNORE:
}
@@ -51,7 +51,7 @@ public class NumberParser {
public static Integer parseInt(String str) {
if (null != str) {
try {
- return new Integer(Integer.parseInt(str.trim()));
+ return Integer.parseInt(str.trim());
} catch (Exception e) {
// :IGNORE:
}
@@ -68,7 +68,7 @@ public class NumberParser {
public static Float parseFloat(String str) {
if (null != str) {
try {
- return new Float(Float.parseFloat(str.trim()));
+ return Float.parseFloat(str.trim());
} catch (Exception e) {
// :IGNORE:
}
@@ -85,7 +85,7 @@ public class NumberParser {
*/
public static float parseFloat(String str, float def) {
Float result = parseFloat(str);
- return (result == null) ? def : result.floatValue();
+ return (result == null) ? def : result;
}
/**
@@ -97,7 +97,7 @@ public class NumberParser {
*/
public static long parseLong(String str, long def) {
Long ret = parseLong(str);
- return (null == ret) ? def : ret.longValue();
+ return (null == ret) ? def : ret;
}
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/PluginManager.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PluginManager.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PluginManager.java
index f10e5cc..b4d46a7 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PluginManager.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PluginManager.java
@@ -85,9 +85,9 @@ public abstract class PluginManager {
String className = null;
try {
Class[] classes = getClasses();
- for (int i=0;i<classes.length;i++) {
- className = classes[i].getName();
- Object plugin = classes[i].newInstance();
+ for (Class aClass : classes) {
+ className = aClass.getName();
+ Object plugin = aClass.newInstance();
if (plugin instanceof DelegatingModuleParser) {
((DelegatingModuleParser) plugin).setFeedParser(_parentParser);
}
@@ -111,10 +111,8 @@ public abstract class PluginManager {
}
}
}
- catch (Exception ex) {
+ catch (Exception | ExceptionInInitializerError ex) {
throw new RuntimeException("could not instantiate plugin "+className,ex);
- }catch (ExceptionInInitializerError er) {
- throw new RuntimeException("could not instantiate plugin "+className,er);
}
}
@@ -131,9 +129,9 @@ public abstract class PluginManager {
private Class[] getClasses() throws ClassNotFoundException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
List classes = new ArrayList();
- boolean useLoadClass = Boolean.valueOf(System.getProperty("rome.pluginmanager.useloadclass", "false")).booleanValue();
- for (int i = 0; i <_propertyValues.length; i++) {
- Class mClass = (useLoadClass ? classLoader.loadClass(_propertyValues[i]) : Class.forName(_propertyValues[i], true, classLoader));
+ boolean useLoadClass = Boolean.valueOf(System.getProperty("rome.pluginmanager.useloadclass", "false"));
+ for (String _propertyValue : _propertyValues) {
+ Class mClass = (useLoadClass ? classLoader.loadClass(_propertyValue) : Class.forName(_propertyValue, true, classLoader));
classes.add(mClass);
}
Class[] array = new Class[classes.size()];
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/PropertiesLoader.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PropertiesLoader.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PropertiesLoader.java
index 2954bed..0ac7c4a 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PropertiesLoader.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PropertiesLoader.java
@@ -116,10 +116,10 @@ public class PropertiesLoader {
*/
public String[] getTokenizedProperty(String key,String separator) {
List entriesList = new ArrayList();
- for (int i=0;i<_properties.length;i++) {
- String values = _properties[i].getProperty(key);
- if (values!=null) {
- StringTokenizer st = new StringTokenizer(values,separator);
+ for (Properties _property : _properties) {
+ String values = _property.getProperty(key);
+ if (values != null) {
+ StringTokenizer st = new StringTokenizer(values, separator);
while (st.hasMoreTokens()) {
String token = st.nextToken();
entriesList.add(token);
@@ -141,9 +141,9 @@ public class PropertiesLoader {
*/
public String[] getProperty(String key) {
List entriesList = new ArrayList();
- for (int i=0;i<_properties.length;i++) {
- String values = _properties[i].getProperty(key);
- if (values!=null) {
+ for (Properties _property : _properties) {
+ String values = _property.getProperty(key);
+ if (values != null) {
entriesList.add(values);
}
}
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/RSS090Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Parser.java
index 94a85f1..b53b3bb 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Parser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Parser.java
@@ -258,9 +258,9 @@ public class RSS090Parser extends BaseWireFeedParser {
Collection eItems = getItems(rssRoot);
List items = new ArrayList();
- for (Iterator i=eItems.iterator();i.hasNext();) {
- Element eItem = (Element) i.next();
- items.add(parseItem(rssRoot,eItem));
+ for (Object eItem1 : eItems) {
+ Element eItem = (Element) eItem1;
+ items.add(parseItem(rssRoot, eItem));
}
return items;
}
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/RSS091UserlandGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandGenerator.java
index d83cb05..463ea68 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandGenerator.java
@@ -21,7 +21,6 @@ import com.sun.syndication.feed.rss.Description;
import com.sun.syndication.feed.rss.Image;
import com.sun.syndication.feed.rss.Item;
import com.sun.syndication.io.FeedException;
-
import org.jdom2.Attribute;
import org.jdom2.Document;
import org.jdom2.Element;
@@ -96,8 +95,8 @@ public class RSS091UserlandGenerator extends RSS090Generator {
if (skipHours != null) {
List hours = skipHours.getChildren();
- for (int i = 0; i < hours.size(); i++) {
- Element hour = (Element) hours.get(i);
+ for (Object hour1 : hours) {
+ Element hour = (Element) hour1;
int value = Integer.parseInt(hour.getText().trim());
if (isHourFormat24()) {
@@ -157,8 +156,8 @@ public class RSS091UserlandGenerator extends RSS090Generator {
protected Element generateSkipDaysElement(List days) {
Element skipDaysElement = new Element("skipDays");
- for (int i = 0; i < days.size(); i++) {
- skipDaysElement.addContent(generateSimpleElement("day", days.get(i).toString()));
+ for (Object day : days) {
+ skipDaysElement.addContent(generateSimpleElement("day", day.toString()));
}
return skipDaysElement;
@@ -167,8 +166,8 @@ public class RSS091UserlandGenerator extends RSS090Generator {
protected Element generateSkipHoursElement(List hours) {
Element skipHoursElement = new Element("skipHours", getFeedNamespace());
- for (int i = 0; i < hours.size(); i++) {
- skipHoursElement.addContent(generateSimpleElement("hour", hours.get(i).toString()));
+ for (Object hour : hours) {
+ skipHoursElement.addContent(generateSimpleElement("hour", hour.toString()));
}
return skipHoursElement;
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/RSS091UserlandParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandParser.java
index 86a0157..257831b 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandParser.java
@@ -17,17 +17,15 @@
package com.sun.syndication.io.impl;
import com.sun.syndication.feed.WireFeed;
-import com.sun.syndication.feed.rss.Channel;
-import com.sun.syndication.feed.rss.Content;
-import com.sun.syndication.feed.rss.Description;
-import com.sun.syndication.feed.rss.Image;
-import com.sun.syndication.feed.rss.Item;
+import com.sun.syndication.feed.rss.*;
import org.jdom2.Attribute;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.Namespace;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
/**
*/
@@ -125,8 +123,8 @@ public class RSS091UserlandParser extends RSS090Parser {
if (e!=null) {
List skipHours = new ArrayList();
List eHours = e.getChildren("hour",getRSSNamespace());
- for (int i=0;i<eHours.size();i++) {
- Element eHour = (Element) eHours.get(i);
+ for (Object eHour1 : eHours) {
+ Element eHour = (Element) eHour1;
skipHours.add(new Integer(eHour.getText().trim()));
}
channel.setSkipHours(skipHours);
@@ -136,8 +134,8 @@ public class RSS091UserlandParser extends RSS090Parser {
if (e!=null) {
List skipDays = new ArrayList();
List eDays = e.getChildren("day",getRSSNamespace());
- for (int i=0;i<eDays.size();i++) {
- Element eDay = (Element) eDays.get(i);
+ for (Object eDay1 : eDays) {
+ Element eDay = (Element) eDay1;
skipDays.add(eDay.getText().trim());
}
channel.setSkipDays(skipDays);
@@ -163,14 +161,14 @@ public class RSS091UserlandParser extends RSS090Parser {
if (e!=null) {
Integer val = NumberParser.parseInt(e.getText());
if (val != null) {
- image.setWidth(val.intValue());
+ image.setWidth(val);
}
}
e = eImage.getChild("height",getRSSNamespace());
if (e!=null) {
Integer val = NumberParser.parseInt(e.getText());
if (val != null) {
- image.setHeight(val.intValue());
+ image.setHeight(val);
}
}
e = eImage.getChild("description",getRSSNamespace());
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/RSS092Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Generator.java
index 12a03d5..9f3cd18 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Generator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Generator.java
@@ -95,8 +95,8 @@ public class RSS092Generator extends RSS091UserlandGenerator {
}
List categories = item.getCategories();
- for(int i = 0; i < categories.size(); i++) {
- eItem.addContent(generateCategoryElement((Category)categories.get(i)));
+ for (Object category : categories) {
+ eItem.addContent(generateCategoryElement((Category) category));
}
}
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/RSS092Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Parser.java
index 9eacee7..b46d0a8 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Parser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Parser.java
@@ -17,13 +17,7 @@
package com.sun.syndication.io.impl;
import com.sun.syndication.feed.WireFeed;
-import com.sun.syndication.feed.rss.Category;
-import com.sun.syndication.feed.rss.Channel;
-import com.sun.syndication.feed.rss.Cloud;
-import com.sun.syndication.feed.rss.Description;
-import com.sun.syndication.feed.rss.Enclosure;
-import com.sun.syndication.feed.rss.Item;
-import com.sun.syndication.feed.rss.Source;
+import com.sun.syndication.feed.rss.*;
import org.jdom2.Element;
import java.util.ArrayList;
@@ -94,19 +88,19 @@ public class RSS092Parser extends RSS091UserlandParser {
List eEnclosures = eItem.getChildren("enclosure");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
if (eEnclosures.size()>0) {
List enclosures = new ArrayList();
- for (int i=0;i<eEnclosures.size();i++) {
- e = (Element) eEnclosures.get(i);
+ for (Object eEnclosure : eEnclosures) {
+ e = (Element) eEnclosure;
Enclosure enclosure = new Enclosure();
String att = e.getAttributeValue("url");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
- if (att!=null) {
+ if (att != null) {
enclosure.setUrl(att);
}
att = e.getAttributeValue("length");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
- enclosure.setLength(NumberParser.parseLong(att,0L));
+ enclosure.setLength(NumberParser.parseLong(att, 0L));
att = e.getAttributeValue("type");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
- if (att!=null) {
+ if (att != null) {
enclosure.setType(att);
}
enclosures.add(enclosure);
@@ -124,11 +118,11 @@ public class RSS092Parser extends RSS091UserlandParser {
List cats = null;
if (eCats.size()>0) {
cats = new ArrayList();
- for (int i=0;i<eCats.size();i++) {
+ for (Object eCat : eCats) {
Category cat = new Category();
- Element e = (Element) eCats.get(i);
+ Element e = (Element) eCat;
String att = e.getAttributeValue("domain");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
- if (att!=null) {
+ if (att != null) {
cat.setDomain(att);
}
cat.setValue(e.getText());
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/RSS094Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Parser.java
index a95b924..439a07f 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Parser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Parser.java
@@ -57,7 +57,7 @@ public class RSS094Parser extends RSS093Parser {
//let it go by
}
if (ttlValue != null) {
- channel.setTtl(ttlValue.intValue());
+ channel.setTtl(ttlValue);
}
}
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/RSS10Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS10Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS10Generator.java
index 9ffdc7d..88d0ebb 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS10Generator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS10Generator.java
@@ -16,9 +16,9 @@
*/
package com.sun.syndication.io.impl;
+import com.sun.syndication.feed.rss.Channel;
import com.sun.syndication.feed.rss.Description;
import com.sun.syndication.feed.rss.Item;
-import com.sun.syndication.feed.rss.Channel;
import com.sun.syndication.io.FeedException;
import org.jdom2.Element;
import org.jdom2.Namespace;
@@ -59,12 +59,12 @@ public class RSS10Generator extends RSS090Generator {
if (items.size()>0) {
Element eItems = new Element("items",getFeedNamespace());
Element eSeq = new Element("Seq",getRDFNamespace());
- for (int i=0;i<items.size();i++) {
- Item item = (Item) items.get(i);
- Element eLi = new Element("li",getRDFNamespace());
+ for (Object item1 : items) {
+ Item item = (Item) item1;
+ Element eLi = new Element("li", getRDFNamespace());
String uri = item.getUri();
- if (uri!=null) {
- eLi.setAttribute("resource",uri,getRDFNamespace());
+ if (uri != null) {
+ eLi.setAttribute("resource", uri, getRDFNamespace());
}
eSeq.addContent(eLi);
}
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/RSS20Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS20Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS20Generator.java
index 14e23ab..b133a87 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS20Generator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS20Generator.java
@@ -57,8 +57,8 @@ public class RSS20Generator extends RSS094Generator {
}
List categories = channel.getCategories();
- for(int i = 0; i < categories.size(); i++) {
- eChannel.addContent(generateCategoryElement((Category)categories.get(i)));
+ for (Object category : categories) {
+ eChannel.addContent(generateCategoryElement((Category) category));
}
}
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/XmlFixerReader.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/XmlFixerReader.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/XmlFixerReader.java
index 88a98b2..621027b 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/XmlFixerReader.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/XmlFixerReader.java
@@ -20,8 +20,8 @@ import java.io.IOException;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
-import java.util.regex.Pattern;
import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* @author Alejandro Abdelnur
@@ -621,7 +621,7 @@ public class XmlFixerReader extends Reader {
if (s.indexOf('&')==-1) {
return s;
}
- StringBuffer sb = new StringBuffer(s.length());
+ StringBuilder sb = new StringBuilder(s.length());
int pos = 0;
while (pos<s.length()) {
String chunck = s.substring(pos);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagGenerator.java
index 090c212..5ea15cb 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagGenerator.java
@@ -20,6 +20,8 @@
package org.rometools.feed.module.base.io;
import com.sun.syndication.feed.module.Module;
+import com.sun.syndication.io.ModuleGenerator;
+import org.jdom2.Element;
import org.rometools.feed.module.base.CustomTag;
import org.rometools.feed.module.base.CustomTagImpl;
import org.rometools.feed.module.base.CustomTags;
@@ -27,15 +29,10 @@ import org.rometools.feed.module.base.types.DateTimeRange;
import org.rometools.feed.module.base.types.FloatUnit;
import org.rometools.feed.module.base.types.IntUnit;
import org.rometools.feed.module.base.types.ShortDate;
-import com.sun.syndication.io.ModuleGenerator;
-
-import org.jdom2.Element;
import java.net.URL;
-
import java.util.Date;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
@@ -68,61 +65,60 @@ public class CustomTagGenerator implements ModuleGenerator {
}
List tags = ((CustomTags)module).getValues();
- Iterator it = tags.iterator();
- while(it.hasNext()) {
- CustomTag tag = (CustomTag)it.next();
+ for (Object tag1 : tags) {
+ CustomTag tag = (CustomTag) tag1;
- if(tag.getValue() instanceof DateTimeRange) {
- DateTimeRange dtr = (DateTimeRange)tag.getValue();
- Element newTag = new Element(tag.getName(),CustomTagParser.NS);
- newTag.setAttribute("type","dateTimeRange");
- newTag.addContent(this.generateSimpleElement("start",GoogleBaseParser.LONG_DT_FMT.format(dtr.getStart())));
- newTag.addContent(this.generateSimpleElement("end",GoogleBaseParser.LONG_DT_FMT.format(dtr.getEnd())));
+ if (tag.getValue() instanceof DateTimeRange) {
+ DateTimeRange dtr = (DateTimeRange) tag.getValue();
+ Element newTag = new Element(tag.getName(), CustomTagParser.NS);
+ newTag.setAttribute("type", "dateTimeRange");
+ newTag.addContent(this.generateSimpleElement("start", GoogleBaseParser.LONG_DT_FMT.format(dtr.getStart())));
+ newTag.addContent(this.generateSimpleElement("end", GoogleBaseParser.LONG_DT_FMT.format(dtr.getEnd())));
element.addContent(newTag);
- } else if(tag.getValue() instanceof ShortDate) {
- ShortDate sd = (ShortDate)tag.getValue();
- Element newTag = this.generateSimpleElement(tag.getName(),GoogleBaseParser.SHORT_DT_FMT.format(sd));
- newTag.setAttribute("type","date");
+ } else if (tag.getValue() instanceof ShortDate) {
+ ShortDate sd = (ShortDate) tag.getValue();
+ Element newTag = this.generateSimpleElement(tag.getName(), GoogleBaseParser.SHORT_DT_FMT.format(sd));
+ newTag.setAttribute("type", "date");
element.addContent(newTag);
- } else if(tag.getValue() instanceof Date) {
- Date d = (Date)tag.getValue();
- Element newTag = this.generateSimpleElement(tag.getName(),GoogleBaseParser.SHORT_DT_FMT.format(d));
- newTag.setAttribute("type","dateTime");
+ } else if (tag.getValue() instanceof Date) {
+ Date d = (Date) tag.getValue();
+ Element newTag = this.generateSimpleElement(tag.getName(), GoogleBaseParser.SHORT_DT_FMT.format(d));
+ newTag.setAttribute("type", "dateTime");
element.addContent(newTag);
- } else if(tag.getValue() instanceof Integer) {
- Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
- newTag.setAttribute("type","int");
+ } else if (tag.getValue() instanceof Integer) {
+ Element newTag = this.generateSimpleElement(tag.getName(), tag.getValue().toString());
+ newTag.setAttribute("type", "int");
element.addContent(newTag);
- } else if(tag.getValue() instanceof IntUnit) {
- Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
- newTag.setAttribute("type","intUnit");
+ } else if (tag.getValue() instanceof IntUnit) {
+ Element newTag = this.generateSimpleElement(tag.getName(), tag.getValue().toString());
+ newTag.setAttribute("type", "intUnit");
element.addContent(newTag);
- } else if(tag.getValue() instanceof Float) {
- Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
- newTag.setAttribute("type","float");
+ } else if (tag.getValue() instanceof Float) {
+ Element newTag = this.generateSimpleElement(tag.getName(), tag.getValue().toString());
+ newTag.setAttribute("type", "float");
element.addContent(newTag);
- } else if(tag.getValue() instanceof FloatUnit) {
- Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
- newTag.setAttribute("type","floatUnit");
+ } else if (tag.getValue() instanceof FloatUnit) {
+ Element newTag = this.generateSimpleElement(tag.getName(), tag.getValue().toString());
+ newTag.setAttribute("type", "floatUnit");
element.addContent(newTag);
- } else if(tag.getValue() instanceof String) {
- Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
- newTag.setAttribute("type","string");
+ } else if (tag.getValue() instanceof String) {
+ Element newTag = this.generateSimpleElement(tag.getName(), tag.getValue().toString());
+ newTag.setAttribute("type", "string");
element.addContent(newTag);
- } else if(tag.getValue() instanceof URL) {
- Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
- newTag.setAttribute("type","url");
+ } else if (tag.getValue() instanceof URL) {
+ Element newTag = this.generateSimpleElement(tag.getName(), tag.getValue().toString());
+ newTag.setAttribute("type", "url");
element.addContent(newTag);
- } else if(tag.getValue() instanceof Boolean) {
- Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
- newTag.setAttribute("type","boolean");
+ } else if (tag.getValue() instanceof Boolean) {
+ Element newTag = this.generateSimpleElement(tag.getName(), tag.getValue().toString());
+ newTag.setAttribute("type", "boolean");
element.addContent(newTag);
- } else if( tag.getValue() instanceof CustomTagImpl.Location ){
- Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
- newTag.setAttribute("type","location");
+ } else if (tag.getValue() instanceof CustomTagImpl.Location) {
+ Element newTag = this.generateSimpleElement(tag.getName(), tag.getValue().toString());
+ newTag.setAttribute("type", "location");
element.addContent(newTag);
- }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagParser.java
index 033cc85..7cf0af8 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/CustomTagParser.java
@@ -21,6 +21,9 @@
package org.rometools.feed.module.base.io;
import com.sun.syndication.feed.module.Module;
+import com.sun.syndication.io.ModuleParser;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
import org.rometools.feed.module.base.CustomTagImpl;
import org.rometools.feed.module.base.CustomTags;
import org.rometools.feed.module.base.CustomTagsImpl;
@@ -28,18 +31,14 @@ import org.rometools.feed.module.base.types.DateTimeRange;
import org.rometools.feed.module.base.types.FloatUnit;
import org.rometools.feed.module.base.types.IntUnit;
import org.rometools.feed.module.base.types.ShortDate;
-import com.sun.syndication.io.ModuleParser;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.ParseException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.jdom2.Element;
-import org.jdom2.Namespace;
/**
* @version $Revision: 1.4 $
@@ -58,60 +57,59 @@ public class CustomTagParser implements ModuleParser {
CustomTags module = new CustomTagsImpl();
ArrayList tags = new ArrayList();
List elements = element.getChildren();
- Iterator it = elements.iterator();
- while( it.hasNext() ){
- Element child = (Element) it.next();
- if( child.getNamespace().equals( NS ) ){
- String type = child.getAttributeValue( "type" );
- try{
- if( type == null ){
- continue;
- } else if( type.equals( "string") ){
- tags.add( new CustomTagImpl( child.getName(), child.getText() ) );
- } else if( type.equals( "int") ){
- tags.add( new CustomTagImpl( child.getName(), new Integer( child.getTextTrim() )));
- } else if( type.equals( "float") ){
- tags.add( new CustomTagImpl( child.getName(), new Float( child.getTextTrim() ) ) );
- } else if( type.equals("intUnit") ){
- tags.add( new CustomTagImpl( child.getName(), new IntUnit( child.getTextTrim()) ) );
- } else if( type.equals( "floatUnit") ){
- tags.add( new CustomTagImpl( child.getName(), new FloatUnit( child.getTextTrim()) ) );
- } else if( type.equals( "date") ){
- try{
- tags.add( new CustomTagImpl( child.getName(), new ShortDate( GoogleBaseParser.SHORT_DT_FMT.parse( child.getTextTrim()))) );
- } catch( ParseException e ){
- log.log( Level.WARNING, "Unable to parse date type on "+child.getName(), e );
- }
- } else if( type.equals( "dateTime") ){
- try{
- tags.add( new CustomTagImpl( child.getName(), GoogleBaseParser.LONG_DT_FMT.parse( child.getTextTrim() )));
- } catch(ParseException e){
- log.log( Level.WARNING, "Unable to parse date type on "+child.getName(), e );
- }
- } else if( type.equals( "dateTimeRange") ){
- try{
- tags.add( new CustomTagImpl( child.getName(), new DateTimeRange(GoogleBaseParser.LONG_DT_FMT.parse(child.getChild("start",CustomTagParser.NS).getText().trim()),GoogleBaseParser.LONG_DT_FMT.parse(child.getChild("end",CustomTagParser.NS).getText().trim()))));
- } catch(Exception e){
- log.log( Level.WARNING, "Unable to parse date type on "+child.getName(), e );
- }
- } else if( type.equals( "url") ){
- try{
- tags.add( new CustomTagImpl( child.getName(), new URL( child.getTextTrim() )) );
- } catch( MalformedURLException e){
- log.log( Level.WARNING, "Unable to parse URL type on "+child.getName(), e );
- }
- } else if( type.equals( "boolean") ){
- tags.add( new CustomTagImpl( child.getName(), new Boolean( child.getTextTrim().toLowerCase()) ));
- } else if( type.equals( "location") ) {
- tags.add( new CustomTagImpl( child.getName(), new CustomTagImpl.Location( child.getText() )));
- } else {
- throw new Exception( "Unknown type: "+ type );
- }
- } catch(Exception e){
- log.log( Level.WARNING, "Unable to parse type on "+child.getName(), e );
- }
- }
- }
+ for (Object element1 : elements) {
+ Element child = (Element) element1;
+ if (child.getNamespace().equals(NS)) {
+ String type = child.getAttributeValue("type");
+ try {
+ if (type == null) {
+ continue;
+ } else if (type.equals("string")) {
+ tags.add(new CustomTagImpl(child.getName(), child.getText()));
+ } else if (type.equals("int")) {
+ tags.add(new CustomTagImpl(child.getName(), new Integer(child.getTextTrim())));
+ } else if (type.equals("float")) {
+ tags.add(new CustomTagImpl(child.getName(), new Float(child.getTextTrim())));
+ } else if (type.equals("intUnit")) {
+ tags.add(new CustomTagImpl(child.getName(), new IntUnit(child.getTextTrim())));
+ } else if (type.equals("floatUnit")) {
+ tags.add(new CustomTagImpl(child.getName(), new FloatUnit(child.getTextTrim())));
+ } else if (type.equals("date")) {
+ try {
+ tags.add(new CustomTagImpl(child.getName(), new ShortDate(GoogleBaseParser.SHORT_DT_FMT.parse(child.getTextTrim()))));
+ } catch (ParseException e) {
+ log.log(Level.WARNING, "Unable to parse date type on " + child.getName(), e);
+ }
+ } else if (type.equals("dateTime")) {
+ try {
+ tags.add(new CustomTagImpl(child.getName(), GoogleBaseParser.LONG_DT_FMT.parse(child.getTextTrim())));
+ } catch (ParseException e) {
+ log.log(Level.WARNING, "Unable to parse date type on " + child.getName(), e);
+ }
+ } else if (type.equals("dateTimeRange")) {
+ try {
+ tags.add(new CustomTagImpl(child.getName(), new DateTimeRange(GoogleBaseParser.LONG_DT_FMT.parse(child.getChild("start", CustomTagParser.NS).getText().trim()), GoogleBaseParser.LONG_DT_FMT.parse(child.getChild("end", CustomTagParser.NS).getText().trim()))));
+ } catch (Exception e) {
+ log.log(Level.WARNING, "Unable to parse date type on " + child.getName(), e);
+ }
+ } else if (type.equals("url")) {
+ try {
+ tags.add(new CustomTagImpl(child.getName(), new URL(child.getTextTrim())));
+ } catch (MalformedURLException e) {
+ log.log(Level.WARNING, "Unable to parse URL type on " + child.getName(), e);
+ }
+ } else if (type.equals("boolean")) {
+ tags.add(new CustomTagImpl(child.getName(), Boolean.valueOf(child.getTextTrim().toLowerCase())));
+ } else if (type.equals("location")) {
+ tags.add(new CustomTagImpl(child.getName(), new CustomTagImpl.Location(child.getText())));
+ } else {
+ throw new Exception("Unknown type: " + type);
+ }
+ } catch (Exception e) {
+ log.log(Level.WARNING, "Unable to parse type on " + child.getName(), e);
+ }
+ }
+ }
module.setValues( tags );
return module;
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseGenerator.java
index 825aed4..708ffcd 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseGenerator.java
@@ -41,28 +41,14 @@ package org.rometools.feed.module.base.io;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
-
-import org.rometools.feed.module.base.GoogleBase;
-import org.rometools.feed.module.base.GoogleBaseImpl;
-import org.rometools.feed.module.base.types.CurrencyEnumeration;
-import org.rometools.feed.module.base.types.DateTimeRange;
-import org.rometools.feed.module.base.types.FloatUnit;
-import org.rometools.feed.module.base.types.GenderEnumeration;
-import org.rometools.feed.module.base.types.IntUnit;
-import org.rometools.feed.module.base.types.PaymentTypeEnumeration;
-import org.rometools.feed.module.base.types.PriceTypeEnumeration;
-import org.rometools.feed.module.base.types.ShippingType;
-import org.rometools.feed.module.base.types.ShortDate;
-import org.rometools.feed.module.base.types.Size;
-import org.rometools.feed.module.base.types.YearType;
-
import org.jdom2.Element;
import org.jdom2.Namespace;
+import org.rometools.feed.module.base.GoogleBase;
+import org.rometools.feed.module.base.GoogleBaseImpl;
+import org.rometools.feed.module.base.types.*;
import java.beans.PropertyDescriptor;
-
import java.net.URL;
-
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -97,34 +83,34 @@ public class GoogleBaseGenerator implements ModuleGenerator {
GoogleBaseImpl mod = (GoogleBaseImpl)module;
HashMap props2tags = new HashMap(GoogleBaseParser.PROPS2TAGS);
PropertyDescriptor[] pds = GoogleBaseParser.pds;
-
- for(int i = 0; i < pds.length; i++) {
- String tagName = (String)props2tags.get(pds[i].getName());
-
- if(tagName == null) {
- continue;
- }
-
- Object[] values = null;
-
- try {
- if(pds[i].getPropertyType().isArray()) {
- values = (Object[])pds[i].getReadMethod().invoke(mod,(Object[])null);
- } else {
- values = new Object[] {
- pds[i].getReadMethod().invoke(mod,(Object[])null)
- };
- }
-
- for(int j = 0; (values != null)&&(j < values.length); j++) {
- if(values[j] != null) {
- element.addContent(this.generateTag(values[j],tagName));
- }
- }
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
+
+ for (PropertyDescriptor pd : pds) {
+ String tagName = (String) props2tags.get(pd.getName());
+
+ if (tagName == null) {
+ continue;
+ }
+
+ Object[] values = null;
+
+ try {
+ if (pd.getPropertyType().isArray()) {
+ values = (Object[]) pd.getReadMethod().invoke(mod, (Object[]) null);
+ } else {
+ values = new Object[]{
+ pd.getReadMethod().invoke(mod, (Object[]) null)
+ };
+ }
+
+ for (int j = 0; (values != null) && (j < values.length); j++) {
+ if (values[j] != null) {
+ element.addContent(this.generateTag(values[j], tagName));
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
public Element generateTag(Object o,String tagName) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseParser.java
index cb7ca9c..6fbf45a 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/io/GoogleBaseParser.java
@@ -40,38 +40,22 @@
package org.rometools.feed.module.base.io;
import com.sun.syndication.feed.module.Module;
-import org.rometools.feed.module.base.GoogleBase;
-import org.rometools.feed.module.base.GoogleBaseImpl;
import com.sun.syndication.io.ModuleParser;
-import org.rometools.feed.module.base.types.CurrencyEnumeration;
-import org.rometools.feed.module.base.types.DateTimeRange;
-import org.rometools.feed.module.base.types.FloatUnit;
-import org.rometools.feed.module.base.types.GenderEnumeration;
-import org.rometools.feed.module.base.types.IntUnit;
-import org.rometools.feed.module.base.types.PaymentTypeEnumeration;
-import org.rometools.feed.module.base.types.PriceTypeEnumeration;
-import org.rometools.feed.module.base.types.ShippingType;
-import org.rometools.feed.module.base.types.Size;
-import org.rometools.feed.module.base.types.YearType;
-
import org.jdom2.Element;
import org.jdom2.Namespace;
+import org.rometools.feed.module.base.GoogleBase;
+import org.rometools.feed.module.base.GoogleBaseImpl;
+import org.rometools.feed.module.base.types.*;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
-
import java.io.IOException;
-
import java.lang.reflect.Array;
-
import java.net.URL;
-
import java.text.SimpleDateFormat;
-
import java.util.Date;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
@@ -119,14 +103,13 @@ public class GoogleBaseParser implements ModuleParser {
GoogleBaseImpl module = new GoogleBaseImpl();
try {
- for(int i = 0; i < pds.length; i++) {
- PropertyDescriptor pd = pds[i];
+ for (PropertyDescriptor pd : pds) {
String tagName = GoogleBaseParser.PROPS2TAGS.getProperty(pd.getName());
- if(tagName == null) {
- log.log(Level.FINE,"Property: " + pd.getName() + " doesn't have a tag mapping. ");
+ if (tagName == null) {
+ log.log(Level.FINE, "Property: " + pd.getName() + " doesn't have a tag mapping. ");
} else {
- tag2pd.put(tagName,pd);
+ tag2pd.put(tagName, pd);
}
}
} catch(Exception e) {
@@ -134,19 +117,18 @@ public class GoogleBaseParser implements ModuleParser {
}
List children = element.getChildren();
- Iterator it = children.iterator();
- while(it.hasNext()) {
- Element child = (Element)it.next();
+ for (Object aChildren : children) {
+ Element child = (Element) aChildren;
- if(child.getNamespace().equals(GoogleBaseParser.NS)) {
- PropertyDescriptor pd = (PropertyDescriptor)tag2pd.get(child.getName());
+ if (child.getNamespace().equals(GoogleBaseParser.NS)) {
+ PropertyDescriptor pd = (PropertyDescriptor) tag2pd.get(child.getName());
- if(pd != null) {
+ if (pd != null) {
try {
- this.handleTag(child,pd,module);
- } catch(Exception e) {
- log.log(Level.WARNING,"Unable to handle tag: " + child.getName(),e);
+ this.handleTag(child, pd, module);
+ } catch (Exception e) {
+ log.log(Level.WARNING, "Unable to handle tag: " + child.getName(), e);
e.printStackTrace();
}
}
@@ -157,12 +139,12 @@ public class GoogleBaseParser implements ModuleParser {
}
public static String stripNonValidCharacters(char[] validCharacters,String input) {
- StringBuffer newString = new StringBuffer();
+ StringBuilder newString = new StringBuilder();
for(int i = 0; i < input.length(); i++) {
- for(int j = 0; j < validCharacters.length; j++) {
- if(input.charAt(i) == validCharacters[j]) {
- newString.append(validCharacters[j]);
+ for (char validCharacter : validCharacters) {
+ if (input.charAt(i) == validCharacter) {
+ newString.append(validCharacter);
}
}
}
@@ -186,7 +168,7 @@ public class GoogleBaseParser implements ModuleParser {
} else if((pd.getPropertyType() == URL.class)||(pd.getPropertyType().getComponentType() == URL.class)) {
tagValue = new URL(tag.getText().trim());
} else if((pd.getPropertyType() == Boolean.class)||(pd.getPropertyType().getComponentType() == Boolean.class)) {
- tagValue = new Boolean(tag.getText().trim());
+ tagValue = Boolean.valueOf(tag.getText().trim());
} else if((pd.getPropertyType() == Date.class)||(pd.getPropertyType().getComponentType() == Date.class)) {
String text = tag.getText().trim();
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/FloatUnit.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/FloatUnit.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/FloatUnit.java
index e3a064c..79f04d2 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/FloatUnit.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/FloatUnit.java
@@ -65,8 +65,8 @@ public class FloatUnit implements CloneableType {
* @return boolean indicating presence.
*/
private boolean inCharArray( char find, char[] array ){
- for( int i=0; i < array.length; i++ ){
- if( find == array[i])
+ for (char anArray : array) {
+ if (find == anArray)
return true;
}
return false;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/IntUnit.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/IntUnit.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/IntUnit.java
index bb424b2..523e7df 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/IntUnit.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/base/types/IntUnit.java
@@ -51,8 +51,8 @@ public class IntUnit implements CloneableType {
private String units;
private int value;
private boolean inCharArray( char find, char[] array ){
- for( int i=0; i < array.length; i++ ){
- if( find == array[i])
+ for (char anArray : array) {
+ if (find == anArray)
return true;
}
return false;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/CCModuleGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/CCModuleGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/CCModuleGenerator.java
index 114def9..ed397a2 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/CCModuleGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/CCModuleGenerator.java
@@ -42,13 +42,14 @@ package org.rometools.feed.module.cc.io;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
import org.rometools.feed.module.cc.CreativeCommons;
import org.rometools.feed.module.cc.CreativeCommonsImpl;
import org.rometools.feed.module.cc.types.License;
+
import java.util.HashSet;
import java.util.Set;
-import org.jdom2.Element;
-import org.jdom2.Namespace;
/**
* @version $Revision: 1.1 $
@@ -101,33 +102,33 @@ public class CCModuleGenerator implements ModuleGenerator{
if( element.getName().equals("channel")){
// Do all licenses list.
License[] all = module.getAllLicenses();
- for( int i=0; i < all.length ; i++){
- Element license = new Element( "License", RSS1 );
- license.setAttribute( "about", all[i].getValue(), RDF );
- License.Behaviour[] permits = all[i].getPermits();
- for( int j=0; permits != null && j < permits.length; j++ ){
- Element permit = new Element( "permits", RSS1 );
- permit.setAttribute( "resource", permits[j].toString(), RDF);
- license.addContent( permit );
- }
- License.Behaviour[] requires = all[i].getPermits();
- for( int j=0; requires != null && j < requires.length; j++ ){
- Element permit = new Element( "requires", RSS1 );
- permit.setAttribute( "resource", permits[j].toString(), RDF);
- license.addContent( permit );
- }
- System.out.println("Is Root?"+element.getParentElement());
- element.getParentElement().addContent( license );
- }
+ for (License anAll : all) {
+ Element license = new Element("License", RSS1);
+ license.setAttribute("about", anAll.getValue(), RDF);
+ License.Behaviour[] permits = anAll.getPermits();
+ for (int j = 0; permits != null && j < permits.length; j++) {
+ Element permit = new Element("permits", RSS1);
+ permit.setAttribute("resource", permits[j].toString(), RDF);
+ license.addContent(permit);
+ }
+ License.Behaviour[] requires = anAll.getPermits();
+ for (int j = 0; requires != null && j < requires.length; j++) {
+ Element permit = new Element("requires", RSS1);
+ permit.setAttribute("resource", permits[j].toString(), RDF);
+ license.addContent(permit);
+ }
+ System.out.println("Is Root?" + element.getParentElement());
+ element.getParentElement().addContent(license);
+ }
}
//Do local licenses
License[] licenses = module.getLicenses();
- for( int i=0; i < licenses.length; i++ ){
- Element license = new Element( "license", RSS1 );
- license.setAttribute( "resource", licenses[i].getValue(), RDF);
- element.addContent( license );
- }
+ for (License license1 : licenses) {
+ Element license = new Element("license", RSS1);
+ license.setAttribute("resource", license1.getValue(), RDF);
+ element.addContent(license);
+ }
}
[2/4] marmotta git commit: more code hygiene,
clean up redundant or unnecessary code
Posted by ss...@apache.org.
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS1.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS1.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS1.java
index 4ff440b..de71ff5 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS1.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS1.java
@@ -42,14 +42,14 @@ package org.rometools.feed.module.cc.io;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleParser;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
import org.rometools.feed.module.cc.CreativeCommonsImpl;
import org.rometools.feed.module.cc.types.License;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.jdom2.Element;
-import org.jdom2.Namespace;
/**
@@ -75,45 +75,43 @@ public class ModuleParserRSS1 implements ModuleParser {
root = root.getParentElement();
List licenseList = root.getChildren( "License", NS );
ArrayList licenses = new ArrayList();
- Iterator it = licenseList.iterator();
- while( it.hasNext() ){
- Element licenseTag = (Element) it.next();
- String licenseURI = licenseTag.getAttributeValue("about", RDF);
- if( licenseURI == null )
- continue;
- License license = License.findByValue( licenseURI );
- {
- ArrayList permitsValues = new ArrayList();
- ArrayList requiresValues = new ArrayList();
- List permitsTags = licenseTag.getChildren("permits", NS );
- Iterator sit = permitsTags.iterator();
- while(sit.hasNext() ){
- Element permitTag = (Element) sit.next();
- permitsValues.add( License.Behaviour.findByValue( permitTag.getAttributeValue( "resource", RDF) ));
- }
- List requiresTags = licenseTag.getChildren( "requires", NS);
- sit = requiresTags.iterator();
- while(sit.hasNext()){
- Element requireTag = (Element) sit.next();
- requiresValues.add( License.Behaviour.findByValue(requireTag.getAttributeValue("resource", RDF)));
- }
- license = new License( licenseURI,
- (License.Behaviour[]) requiresValues.toArray( new License.Behaviour[requiresValues.size()]),
- (License.Behaviour[]) permitsValues.toArray( new License.Behaviour[permitsValues.size()]) );
-
- }
-
- licenses.add( license );
- }
+ for (Object aLicenseList : licenseList) {
+ Element licenseTag = (Element) aLicenseList;
+ String licenseURI = licenseTag.getAttributeValue("about", RDF);
+ if (licenseURI == null)
+ continue;
+ License license = License.findByValue(licenseURI);
+ {
+ ArrayList permitsValues = new ArrayList();
+ ArrayList requiresValues = new ArrayList();
+ List permitsTags = licenseTag.getChildren("permits", NS);
+ Iterator sit = permitsTags.iterator();
+ while (sit.hasNext()) {
+ Element permitTag = (Element) sit.next();
+ permitsValues.add(License.Behaviour.findByValue(permitTag.getAttributeValue("resource", RDF)));
+ }
+ List requiresTags = licenseTag.getChildren("requires", NS);
+ sit = requiresTags.iterator();
+ while (sit.hasNext()) {
+ Element requireTag = (Element) sit.next();
+ requiresValues.add(License.Behaviour.findByValue(requireTag.getAttributeValue("resource", RDF)));
+ }
+ license = new License(licenseURI,
+ (License.Behaviour[]) requiresValues.toArray(new License.Behaviour[requiresValues.size()]),
+ (License.Behaviour[]) permitsValues.toArray(new License.Behaviour[permitsValues.size()]));
+
+ }
+
+ licenses.add(license);
+ }
module.setAllLicenses( (License[]) licenses.toArray( new License[0] ) );
}
ArrayList licenses = new ArrayList();
List licenseTags = element.getChildren( "license", NS );
- Iterator lit = licenseTags.iterator();
- while( lit.hasNext() ){
- Element licenseTag = (Element) lit.next();
- licenses.add( License.findByValue( licenseTag.getAttributeValue( "resource", RDF)));
- }
+ for (Object licenseTag1 : licenseTags) {
+ Element licenseTag = (Element) licenseTag1;
+ licenses.add(License.findByValue(licenseTag.getAttributeValue("resource", RDF)));
+ }
if( licenses.size() > 0 ){
module.setLicenses( (License[]) licenses.toArray( new License[licenses.size()]));
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS2.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS2.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS2.java
index 5524655..28a8e34 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS2.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/io/ModuleParserRSS2.java
@@ -42,14 +42,13 @@ package org.rometools.feed.module.cc.io;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleParser;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
import org.rometools.feed.module.cc.CreativeCommonsImpl;
import org.rometools.feed.module.cc.types.License;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import org.jdom2.Element;
-import org.jdom2.Namespace;
/**
*
@@ -77,19 +76,17 @@ public class ModuleParserRSS2 implements ModuleParser {
items = root.getChildren("item");
else
items = root.getChildren("entry");
-
- Iterator iit = items.iterator();
- while( iit.hasNext() ){
- Element item = (Element) iit.next();
- List licenseTags = item.getChildren( "license", NS );
- Iterator lit = licenseTags.iterator();
- while(lit.hasNext() ){
- Element licenseTag = (Element) lit.next();
- License license = License.findByValue( licenseTag.getTextTrim() );
- if( !licenses.contains( license ));
- licenses.add( license );
- }
- }
+
+ for (Object item1 : items) {
+ Element item = (Element) item1;
+ List licenseTags = item.getChildren("license", NS);
+ for (Object licenseTag1 : licenseTags) {
+ Element licenseTag = (Element) licenseTag1;
+ License license = License.findByValue(licenseTag.getTextTrim());
+ if (!licenses.contains(license)) ;
+ licenses.add(license);
+ }
+ }
if( licenses.size() > 0 ){
module.setAllLicenses( (License[]) licenses.toArray( new License[0] ) );
}
@@ -97,11 +94,10 @@ public class ModuleParserRSS2 implements ModuleParser {
// do element local
ArrayList licenses = new ArrayList();
List licenseTags = element.getChildren( "license", NS );
- Iterator it = licenseTags.iterator();
- while( it.hasNext() ){
- Element licenseTag = (Element) it.next();
- licenses.add( License.findByValue(licenseTag.getTextTrim() ));
- }
+ for (Object licenseTag1 : licenseTags) {
+ Element licenseTag = (Element) licenseTag1;
+ licenses.add(License.findByValue(licenseTag.getTextTrim()));
+ }
if( licenses.size() > 0 ){
module.setLicenses( (License[]) licenses.toArray( new License[0]));
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/types/License.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/types/License.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/types/License.java
index 60aacd1..f4b9c0b 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/types/License.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/cc/types/License.java
@@ -41,6 +41,7 @@ package org.rometools.feed.module.cc.types;
import com.sun.syndication.feed.impl.EqualsBean;
import com.sun.syndication.feed.impl.ToStringBean;
+
import java.util.HashMap;
import java.util.Iterator;
import java.util.StringTokenizer;
@@ -124,7 +125,7 @@ public class License {
//No I am going to try an guess about unknown licenses
// This is try and match known CC licenses of other versions or various URLs to
// current licenses, then make a new one with the same permissions.
- if(found == null && uri.startsWith("http://") && uri.toLowerCase().indexOf("creativecommons.org") != -1) {
+ if(found == null && uri.startsWith("http://") && uri.toLowerCase().contains("creativecommons.org")) {
Iterator it = License.lookupLicense.keySet().iterator();
while(it.hasNext()&&(found == null)) {
try{
@@ -134,7 +135,7 @@ public class License {
StringTokenizer tok = new StringTokenizer( licensePath, "/");
String license = tok.nextToken();
String version = tok.nextToken();
- if( uri.toLowerCase().indexOf("creativecommons.org/licenses/"+license) != -1){
+ if(uri.toLowerCase().contains("creativecommons.org/licenses/" + license)){
License current = (License) lookupLicense.get( key );
found = new License( uri, current.getRequires(), current.getPermits() );
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleGenerator.java
index 980b306..505a0c6 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleGenerator.java
@@ -41,19 +41,11 @@
*/
package org.rometools.feed.module.content.io;
+import org.jdom2.*;
import org.rometools.feed.module.content.ContentItem;
import org.rometools.feed.module.content.ContentModule;
-import org.jdom2.Attribute;
-import org.jdom2.CDATA;
-import org.jdom2.Content;
-import org.jdom2.Element;
-import org.jdom2.Namespace;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+
+import java.util.*;
/**
* @version $Revision: 1.2 $
@@ -95,8 +87,8 @@ public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGene
//
if (encodeds != null) {
System.out.println(cm.getEncodeds().size());
- for (int i = 0; i < encodeds.size(); i++) {
- element.addContent(generateCDATAElement("encoded", encodeds.get(i).toString()));
+ for (Object encoded : encodeds) {
+ element.addContent(generateCDATAElement("encoded", encoded.toString()));
}
}
@@ -107,8 +99,8 @@ public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGene
Element bag = new Element("Bag", RDF_NS);
items.addContent(bag);
- for (int i = 0; i < contentItems.size(); i++) {
- ContentItem contentItem = (ContentItem) contentItems.get(i);
+ for (Object contentItem1 : contentItems) {
+ ContentItem contentItem = (ContentItem) contentItem1;
Element li = new Element("li", RDF_NS);
Element item = new Element("item", CONTENT_NS);
@@ -145,15 +137,15 @@ public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGene
if (contentItem.getContentValueNamespaces() != null) {
List namespaces = contentItem.getContentValueNamespaces();
- for (int ni = 0; ni < namespaces.size(); ni++) {
- value.addNamespaceDeclaration((Namespace) namespaces.get(ni));
+ for (Object namespace : namespaces) {
+ value.addNamespaceDeclaration((Namespace) namespace);
}
}
List detached = new ArrayList();
for (int c = 0;
- c < contentItem.getContentValueDOM().size(); c++) {
+ c < contentItem.getContentValueDOM().size(); c++) {
detached.add(((Content) ((Content) contentItem.getContentValueDOM().get(c)).clone()).detach());
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleParser.java
index 3426b3d..866c8f2 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/content/io/ContentModuleParser.java
@@ -43,14 +43,13 @@
*/
package org.rometools.feed.module.content.io;
-import org.rometools.feed.module.content.ContentItem;
-import org.rometools.feed.module.content.ContentModule;
-import org.rometools.feed.module.content.ContentModuleImpl;
import org.jdom2.Attribute;
import org.jdom2.Element;
import org.jdom2.Namespace;
-
import org.jdom2.output.XMLOutputter;
+import org.rometools.feed.module.content.ContentItem;
+import org.rometools.feed.module.content.ContentModule;
+import org.rometools.feed.module.content.ContentModuleImpl;
import java.util.ArrayList;
import java.util.List;
@@ -80,8 +79,8 @@ public class ContentModuleParser implements com.sun.syndication.io.ModuleParser
if (encodeds.size() > 0) {
foundSomething = true;
- for (int i = 0; i < encodeds.size(); i++) {
- Element encodedElement = (Element) encodeds.get(i);
+ for (Object encoded : encodeds) {
+ Element encodedElement = (Element) encoded;
encodedStrings.add(encodedElement.getText());
contentStrings.add(encodedElement.getText());
}
@@ -90,14 +89,14 @@ public class ContentModuleParser implements com.sun.syndication.io.ModuleParser
ArrayList contentItems = new ArrayList();
List items = element.getChildren("items", CONTENT_NS);
- for (int i = 0; i < items.size(); i++) {
+ for (Object item1 : items) {
foundSomething = true;
- List lis = ((Element) items.get(i)).getChild("Bag", RDF_NS).getChildren("li", RDF_NS);
+ List lis = ((Element) item1).getChild("Bag", RDF_NS).getChildren("li", RDF_NS);
- for (int j = 0; j < lis.size(); j++) {
+ for (Object li1 : lis) {
ContentItem ci = new ContentItem();
- Element li = (Element) lis.get(j);
+ Element li = (Element) li1;
Element item = li.getChild("item", CONTENT_NS);
Element format = item.getChild("format", CONTENT_NS);
Element encoding = item.getChild("encoding", CONTENT_NS);
@@ -148,7 +147,7 @@ public class ContentModuleParser implements com.sun.syndication.io.ModuleParser
}
protected String getXmlInnerText(Element e) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
XMLOutputter xo = new XMLOutputter();
List children = e.getContent();
sb.append(xo.outputString(children));
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLGenerator.java
index 6058c65..69aa500 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLGenerator.java
@@ -16,15 +16,16 @@
*/
package org.rometools.feed.module.georss;
-import java.util.*;
-
-import org.jdom2.Element;
-
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
-
+import org.jdom2.Element;
import org.rometools.feed.module.georss.geometries.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
/**
* GMLGenerator produces georss elements in georss GML format.
*
@@ -44,7 +45,7 @@ public class GMLGenerator implements ModuleGenerator {
private Element createPosListElement(PositionList posList) {
Element posElement = new Element("posList", GeoRSSModule.GML_NS);
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i=0; i<posList.size(); ++i)
sb.append(posList.getLatitude(i)).append(" ").append(posList.getLongitude(i)).append(" ");
@@ -126,16 +127,15 @@ public class GMLGenerator implements ModuleGenerator {
}
}
List interiorList = ((Polygon) geometry).getInterior();
- Iterator it = interiorList.iterator();
- while (it.hasNext()) {
- AbstractRing ring = (AbstractRing)it.next();
+ for (Object anInteriorList : interiorList) {
+ AbstractRing ring = (AbstractRing) anInteriorList;
if (ring instanceof LinearRing) {
Element interiorElement = new Element("interior", GeoRSSModule.GML_NS);
polygonElement.addContent(interiorElement);
Element ringElement = new Element("LinearRing", GeoRSSModule.GML_NS);
interiorElement.addContent(ringElement);
ringElement.addContent(createPosListElement(((LinearRing) ring).getPositionList()));
-
+
} else {
System.err.println("GeoRSS GML format can't handle rings of type: " + ring.getClass().getName());
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLParser.java
index 66c6201..b4c6087 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GMLParser.java
@@ -16,19 +16,12 @@
*/
package org.rometools.feed.module.georss;
-import org.jdom2.Element;
-
import com.sun.syndication.feed.module.Module;
-import org.rometools.feed.module.georss.geometries.LineString;
-import org.rometools.feed.module.georss.geometries.LinearRing;
-import org.rometools.feed.module.georss.geometries.Point;
-import org.rometools.feed.module.georss.geometries.Polygon;
-import org.rometools.feed.module.georss.geometries.Envelope;
-import org.rometools.feed.module.georss.geometries.Position;
-import org.rometools.feed.module.georss.geometries.PositionList;
import com.sun.syndication.io.ModuleParser;
+import org.jdom2.Element;
+import org.rometools.feed.module.georss.geometries.*;
-import java.util.*;
+import java.util.List;
/**
* GMLParser is a parser for the GML georss format.
@@ -54,8 +47,7 @@ public class GMLParser implements ModuleParser {
* @see com.sun.syndication.io.ModuleParser#parse(org.jdom2.Element)
*/
public Module parse(Element element) {
- Module geoRssModule = parseGML(element);
- return geoRssModule;
+ return parseGML(element);
}
private static PositionList parsePosList(Element element) {
@@ -113,9 +105,8 @@ public class GMLParser implements ModuleParser {
// The internal rings (holes)
List interiorElementList = polygonElement.getChildren("interior", GeoRSSModule.GML_NS);
- Iterator it = interiorElementList.iterator();
- while (it.hasNext()) {
- Element interiorElement = (Element)it.next();
+ for (Object anInteriorElementList : interiorElementList) {
+ Element interiorElement = (Element) anInteriorElementList;
if (interiorElement != null) {
Element linearRingElement = interiorElement.getChild("LinearRing", GeoRSSModule.GML_NS);
if (linearRingElement != null) {
@@ -127,7 +118,7 @@ public class GMLParser implements ModuleParser {
}
}
}
-
+
}
if (poly != null) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GeoRSSUtils.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GeoRSSUtils.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GeoRSSUtils.java
index 95cf0b8..7a3cdca 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GeoRSSUtils.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/GeoRSSUtils.java
@@ -30,7 +30,7 @@ public class GeoRSSUtils {
static String trimWhitespace(String in) {
- StringBuffer strbuf = new StringBuffer();
+ StringBuilder strbuf = new StringBuilder();
int i = 0;
for (; i<in.length() && Character.isWhitespace(in.charAt(i)); ++i);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleGenerator.java
index 38f7d33..0178d8e 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleGenerator.java
@@ -16,16 +16,15 @@
*/
package org.rometools.feed.module.georss;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jdom2.Element;
-
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
+import org.jdom2.Element;
import org.rometools.feed.module.georss.geometries.*;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* SimpleGenerator produces georss elements in georss simple format.
*
@@ -43,7 +42,7 @@ public class SimpleGenerator implements ModuleGenerator {
}
private String posListToString(PositionList posList) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i=0; i<posList.size(); ++i)
sb.append(posList.getLatitude(i)).append(" ").append(posList.getLongitude(i)).append(" ");
return sb.toString();
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleParser.java
index e6b411f..aca00f0 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/SimpleParser.java
@@ -16,11 +16,9 @@
*/
package org.rometools.feed.module.georss;
-import org.jdom2.Element;
-
import com.sun.syndication.feed.module.Module;
-import org.rometools.feed.module.georss.GMLParser;
import com.sun.syndication.io.ModuleParser;
+import org.jdom2.Element;
import org.rometools.feed.module.georss.geometries.*;
/**
@@ -56,8 +54,7 @@ public class SimpleParser implements ModuleParser {
* @see com.sun.syndication.io.ModuleParser#parse(org.jdom2.Element)
*/
public Module parse(Element element) {
- Module geoRssModule = parseSimple(element);
- return geoRssModule;
+ return parseSimple(element);
}
static Module parseSimple(Element element) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/W3CGeoParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/W3CGeoParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/W3CGeoParser.java
index 91baebe..8174b20 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/W3CGeoParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/W3CGeoParser.java
@@ -16,11 +16,11 @@
*/
package org.rometools.feed.module.georss;
-import org.jdom2.Element;
-
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleParser;
-import org.rometools.feed.module.georss.geometries.*;
+import org.jdom2.Element;
+import org.rometools.feed.module.georss.geometries.Point;
+import org.rometools.feed.module.georss.geometries.Position;
/**
* W3CGeoParser is a parser for the W3C geo format.
@@ -72,8 +72,7 @@ public class W3CGeoParser implements ModuleParser {
* @see com.sun.syndication.io.ModuleParser#parse(org.jdom2.Element)
*/
public Module parse(Element element) {
- Module geoRssModule = parseW3C(element);
- return geoRssModule;
+ return parseW3C(element);
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/Polygon.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/Polygon.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/Polygon.java
index f2f3ed9..d71c94b 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/Polygon.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/Polygon.java
@@ -9,7 +9,9 @@
package org.rometools.feed.module.georss.geometries;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
/**
* Polygon, a surface object bounded by one external ring and zero or more internal rings
@@ -30,9 +32,8 @@ public final class Polygon extends AbstractSurface implements Cloneable {
retval.exterior = (AbstractRing)exterior.clone();
if (interior != null) {
retval.interior = new ArrayList();
- Iterator it = interior.iterator();
- while (it.hasNext()) {
- AbstractRing r = (AbstractRing)it.next();
+ for (Object anInterior : interior) {
+ AbstractRing r = (AbstractRing) anInterior;
retval.interior.add(r.clone());
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/AbstractITunesObject.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/AbstractITunesObject.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/AbstractITunesObject.java
index 637a23b..4a01684 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/AbstractITunesObject.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/AbstractITunesObject.java
@@ -202,7 +202,7 @@ public abstract class AbstractITunesObject implements ITunes, java.lang.Cloneabl
}
public String toString() {
- StringBuffer sb = new StringBuffer("[");
+ StringBuilder sb = new StringBuilder("[");
sb.append(" Author: ");
sb.append(this.getAuthor());
sb.append(" Block: ");
@@ -213,7 +213,7 @@ public abstract class AbstractITunesObject implements ITunes, java.lang.Cloneabl
if (this.getKeywords() != null) {
for (int i = 0; i < keywords.length; i++) {
- sb.append("'" + this.getKeywords()[i] + "'");
+ sb.append("'").append(this.getKeywords()[i]).append("'");
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformationImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformationImpl.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformationImpl.java
index 5631842..3df3b82 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformationImpl.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformationImpl.java
@@ -109,7 +109,7 @@ public class EntryInformationImpl extends AbstractITunesObject implements EntryI
}
public String toString() {
- StringBuffer sb = new StringBuffer("[");
+ StringBuilder sb = new StringBuilder("[");
sb.append(" Duration: ");
sb.append(this.getDuration());
sb.append("]");
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformationImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformationImpl.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformationImpl.java
index 134f8fb..d9a0a4d 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformationImpl.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformationImpl.java
@@ -40,7 +40,9 @@
*
*/
package org.rometools.feed.module.itunes;
+
import com.sun.syndication.feed.CopyFrom;
+
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -180,7 +182,7 @@ public class FeedInformationImpl extends AbstractITunesObject implements FeedInf
}
public String toString() {
- StringBuffer sb = new StringBuffer("[");
+ StringBuilder sb = new StringBuilder("[");
sb.append(" email: ");
sb.append(this.getOwnerEmailAddress());
sb.append(" name: ");
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesGenerator.java
index 303ba6b..febc756 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesGenerator.java
@@ -41,17 +41,15 @@
package org.rometools.feed.module.itunes.io;
import com.sun.syndication.feed.module.Module;
+import com.sun.syndication.io.ModuleGenerator;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
import org.rometools.feed.module.itunes.AbstractITunesObject;
import org.rometools.feed.module.itunes.EntryInformationImpl;
import org.rometools.feed.module.itunes.FeedInformationImpl;
import org.rometools.feed.module.itunes.types.Category;
-import com.sun.syndication.io.ModuleGenerator;
-
-import org.jdom2.Element;
-import org.jdom2.Namespace;
import java.util.HashSet;
-import java.util.Iterator;
/**
* @version $Revision: 1.3 $
@@ -101,8 +99,8 @@ public class ITunesGenerator implements ModuleGenerator {
element.addContent(image);
}
- for (Iterator it = info.getCategories().iterator(); it.hasNext();) {
- Category cat = (Category) it.next();
+ for (Object o : info.getCategories()) {
+ Category cat = (Category) o;
Element category = this.generateSimpleElement("category", "");
category.setAttribute("text", cat.getName());
@@ -137,7 +135,7 @@ public class ITunesGenerator implements ModuleGenerator {
}
if (itunes.getKeywords() != null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < itunes.getKeywords().length; i++) {
if (i != 0) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParser.java
index f532c0a..692a463 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParser.java
@@ -40,24 +40,20 @@
*/
package org.rometools.feed.module.itunes.io;
+import com.sun.syndication.io.ModuleParser;
+import com.sun.syndication.io.WireFeedParser;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
+import org.jdom2.output.XMLOutputter;
import org.rometools.feed.module.itunes.AbstractITunesObject;
import org.rometools.feed.module.itunes.EntryInformationImpl;
import org.rometools.feed.module.itunes.FeedInformationImpl;
-import com.sun.syndication.io.ModuleParser;
import org.rometools.feed.module.itunes.types.Category;
import org.rometools.feed.module.itunes.types.Duration;
import org.rometools.feed.module.itunes.types.Subcategory;
-import com.sun.syndication.io.WireFeedParser;
-
-import org.jdom2.Element;
-import org.jdom2.Namespace;
-
-import org.jdom2.output.XMLOutputter;
import java.net.MalformedURLException;
import java.net.URL;
-
-import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import java.util.logging.Logger;
@@ -117,20 +113,20 @@ public class ITunesParser implements ModuleParser {
}
List categories = element.getChildren("category", ns);
- for (Iterator it = categories.iterator(); it.hasNext();) {
- Element category = (Element) it.next();
+ for (Object category1 : categories) {
+ Element category = (Element) category1;
if ((category != null) && (category.getAttribute("text") != null)) {
Category cat = new Category();
cat.setName(category.getAttribute("text").getValue().trim());
-
+
Element subcategory = category.getChild("category", ns);
-
+
if (subcategory != null && subcategory.getAttribute("text") != null) {
Subcategory subcat = new Subcategory();
subcat.setName(subcategory.getAttribute("text").getValue().trim());
cat.setSubcategory(subcat);
}
-
+
feedInfo.getCategories().add(cat);
}
}
@@ -199,7 +195,7 @@ public class ITunesParser implements ModuleParser {
}
protected String getXmlInnerText(Element e) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
XMLOutputter xo = new XMLOutputter();
List children = e.getContent();
sb.append(xo.outputString(children));
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Category.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Category.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Category.java
index 8cd0505..2d1400c 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Category.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Category.java
@@ -112,10 +112,10 @@ public class Category implements Serializable {
}
public String toString() {
- StringBuffer sb = new StringBuffer(this.getName());
+ StringBuilder sb = new StringBuilder(this.getName());
if (this.getSubcategory() != null) {
- sb.append(" -> " + this.getSubcategory().toString());
+ sb.append(" -> ").append(this.getSubcategory().toString());
}
return sb.toString();
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleGenerator.java
index 191e35e..fdbed34 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleGenerator.java
@@ -62,14 +62,14 @@ public class MediaModuleGenerator implements ModuleGenerator {
MediaEntryModule m = (MediaEntryModule) module;
MediaGroup[] g = m.getMediaGroups();
- for (int i = 0; i < g.length; i++) {
- this.generateGroup(g[i], element);
+ for (MediaGroup aG : g) {
+ this.generateGroup(aG, element);
}
MediaContent[] c = m.getMediaContents();
- for (int i = 0; i < c.length; i++) {
- this.generateContent(c[i], element);
+ for (MediaContent aC : c) {
+ this.generateContent(aC, element);
}
}
}
@@ -108,8 +108,8 @@ public class MediaModuleGenerator implements ModuleGenerator {
Element t = new Element("group", NS);
MediaContent[] c = g.getContents();
- for (int i = 0; i < c.length; i++) {
- this.generateContent(c[i], t);
+ for (MediaContent aC : c) {
+ this.generateContent(aC, t);
}
this.generateMetadata(g.getMetadata(), t);
@@ -123,10 +123,10 @@ public class MediaModuleGenerator implements ModuleGenerator {
Category[] cats = m.getCategories();
- for (int i = 0; i < cats.length; i++) {
- Element c = generateSimpleElement("category", cats[i].getValue());
- this.addNotNullAttribute(c, "scheme", cats[i].getScheme());
- this.addNotNullAttribute(c, "label", cats[i].getLabel());
+ for (Category cat : cats) {
+ Element c = generateSimpleElement("category", cat.getValue());
+ this.addNotNullAttribute(c, "scheme", cat.getScheme());
+ this.addNotNullAttribute(c, "label", cat.getLabel());
e.addContent(c);
}
@@ -135,10 +135,10 @@ public class MediaModuleGenerator implements ModuleGenerator {
Credit[] creds = m.getCredits();
- for (int i = 0; i < creds.length; i++) {
- Element c = generateSimpleElement("credit", creds[i].getName());
- this.addNotNullAttribute(c, "role", creds[i].getRole());
- this.addNotNullAttribute(c, "scheme", creds[i].getScheme());
+ for (Credit cred : creds) {
+ Element c = generateSimpleElement("credit", cred.getName());
+ this.addNotNullAttribute(c, "role", cred.getRole());
+ this.addNotNullAttribute(c, "scheme", cred.getScheme());
e.addContent(c);
}
@@ -165,34 +165,34 @@ public class MediaModuleGenerator implements ModuleGenerator {
Rating[] rats = m.getRatings();
- for (int i = 0; i < rats.length; i++) {
- Element rat = this.addNotNullElement(e, "rating", rats[i].getValue());
- this.addNotNullAttribute(rat, "scheme", rats[i].getScheme());
+ for (Rating rat1 : rats) {
+ Element rat = this.addNotNullElement(e, "rating", rat1.getValue());
+ this.addNotNullAttribute(rat, "scheme", rat1.getScheme());
- if (rats[i].equals(Rating.ADULT)) {
+ if (rat1.equals(Rating.ADULT)) {
this.addNotNullElement(e, "adult", "true");
- } else if (rats[i].equals(Rating.NONADULT)) {
+ } else if (rat1.equals(Rating.NONADULT)) {
this.addNotNullElement(e, "adult", "false");
}
}
Text[] text = m.getText();
- for (int i = 0; i < text.length; i++) {
- Element t = this.addNotNullElement(e, "text", text[i].getValue());
- this.addNotNullAttribute(t, "type", text[i].getType());
- this.addNotNullAttribute(t, "start", text[i].getStart());
- this.addNotNullAttribute(t, "end", text[i].getEnd());
+ for (Text aText : text) {
+ Element t = this.addNotNullElement(e, "text", aText.getValue());
+ this.addNotNullAttribute(t, "type", aText.getType());
+ this.addNotNullAttribute(t, "start", aText.getStart());
+ this.addNotNullAttribute(t, "end", aText.getEnd());
}
Thumbnail[] thumbs = m.getThumbnail();
- for (int i = 0; i < thumbs.length; i++) {
+ for (Thumbnail thumb : thumbs) {
Element t = new Element("thumbnail", NS);
- this.addNotNullAttribute(t, "url", thumbs[i].getUrl());
- this.addNotNullAttribute(t, "width", thumbs[i].getWidth());
- this.addNotNullAttribute(t, "height", thumbs[i].getHeight());
- this.addNotNullAttribute(t, "time", thumbs[i].getTime());
+ this.addNotNullAttribute(t, "url", thumb.getUrl());
+ this.addNotNullAttribute(t, "width", thumb.getWidth());
+ this.addNotNullAttribute(t, "height", thumb.getHeight());
+ this.addNotNullAttribute(t, "time", thumb.getTime());
e.addContent(t);
}
@@ -201,11 +201,11 @@ public class MediaModuleGenerator implements ModuleGenerator {
Restriction[] r = m.getRestrictions();
- for (int i = 0; i < r.length; i++) {
+ for (Restriction aR : r) {
Element res = this.addNotNullElement(e, "restriction",
- r[i].getValue());
- this.addNotNullAttribute(res, "type", r[i].getType());
- this.addNotNullAttribute(res, "relationship", r[i].getRelationship());
+ aR.getValue());
+ this.addNotNullAttribute(res, "type", aR.getType());
+ this.addNotNullAttribute(res, "relationship", aR.getRelationship());
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleParser.java
index 011ae30..fcdaf5c 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/io/MediaModuleParser.java
@@ -201,7 +201,7 @@ public class MediaModuleParser implements ModuleParser {
for (int j = 0; j < g.getContents().length; j++) {
if (g.getContents()[j].isDefaultContent()) {
- g.setDefaultContentIndex(new Integer(j));
+ g.setDefaultContentIndex(j);
break;
}
@@ -384,25 +384,25 @@ public class MediaModuleParser implements ModuleParser {
{
List restrictions = e.getChildren("restriction", getNS());
ArrayList values = new ArrayList();
-
- for (int i = 0; i < restrictions.size(); i++) {
- Element r = (Element) restrictions.get(i);
+
+ for (Object restriction : restrictions) {
+ Element r = (Element) restriction;
Restriction.Type type = null;
-
+
if (r.getAttributeValue("type").equalsIgnoreCase("uri")) {
type = Restriction.Type.URI;
} else if (r.getAttributeValue("type").equalsIgnoreCase("country")) {
type = Restriction.Type.COUNTRY;
}
-
+
Restriction.Relationship relationship = null;
-
+
if (r.getAttributeValue("relationship").equalsIgnoreCase("allow")) {
relationship = Restriction.Relationship.ALLOW;
} else if (r.getAttributeValue("relationship").equalsIgnoreCase("deny")) {
relationship = Restriction.Relationship.DENY;
}
-
+
Restriction value = new Restriction(relationship, type,
r.getTextTrim());
values.add(value);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/types/MediaGroup.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/types/MediaGroup.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/types/MediaGroup.java
index d7604c4..e3dbbe4 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/types/MediaGroup.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/types/MediaGroup.java
@@ -23,11 +23,11 @@
*/
package org.rometools.feed.module.mediarss.types;
-import java.io.Serializable;
-
import com.sun.syndication.feed.impl.EqualsBean;
import com.sun.syndication.feed.impl.ToStringBean;
+import java.io.Serializable;
+
/**
* <strong><media:group></strong></p>
@@ -95,7 +95,7 @@ public class MediaGroup implements Cloneable, Serializable {
*/
public void setDefaultContentIndex(Integer defaultContentIndex) {
for (int i = 0; i < getContents().length; i++) {
- if (i == defaultContentIndex.intValue()) {
+ if (i == defaultContentIndex) {
getContents()[i].setDefaultContent(true);
} else {
getContents()[i].setDefaultContent(false);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleGenerator.java
index a74c651..7d0f3d6 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleGenerator.java
@@ -15,22 +15,20 @@
package org.rometools.feed.module.opensearch.impl;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
+import com.sun.syndication.feed.atom.Link;
+import com.sun.syndication.feed.module.Module;
+import com.sun.syndication.io.ModuleGenerator;
import org.jdom2.Attribute;
import org.jdom2.Element;
import org.jdom2.Namespace;
-
-import com.sun.syndication.feed.atom.Link;
-import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.opensearch.OpenSearchModule;
import org.rometools.feed.module.opensearch.RequiredAttributeMissingException;
import org.rometools.feed.module.opensearch.entity.OSQuery;
-import com.sun.syndication.io.ModuleGenerator;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
/**
* @author Michael W. Nassif (enrouteinc@gmail.com)
@@ -83,13 +81,13 @@ public class OpenSearchModuleGenerator implements ModuleGenerator {
if(osm.getQueries() != null){
List queries = osm.getQueries();
-
- for (Iterator iter = queries.iterator(); iter.hasNext();) {
- OSQuery query = (OSQuery) iter.next();
- if(query != null){
- element.addContent(generateQueryElement(query));
- }
- }
+
+ for (Object query1 : queries) {
+ OSQuery query = (OSQuery) query1;
+ if (query != null) {
+ element.addContent(generateQueryElement(query));
+ }
+ }
}
if(osm.getLink() != null){
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleParser.java
index 96ba18a..ab7743c 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/opensearch/impl/OpenSearchModuleParser.java
@@ -27,7 +27,6 @@ import org.rometools.feed.module.opensearch.entity.OSQuery;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -88,11 +87,11 @@ public class OpenSearchModuleParser implements ModuleParser{
// Create the OSQuery list
List osqList = new LinkedList();
-
- for (Iterator iter = queries.iterator(); iter.hasNext();) {
- e = (Element) iter.next();
- osqList.add(parseQuery(e));
- }
+
+ for (Object query : queries) {
+ e = (Element) query;
+ osqList.add(parseQuery(e));
+ }
osm.setQueries(osqList);
}
@@ -214,12 +213,12 @@ public class OpenSearchModuleParser implements ModuleParser{
URL baseURI = null;
List linksList = root.getChildren("link", OS_NS);
if (linksList != null) {
- for (Iterator links = linksList.iterator(); links.hasNext(); ) {
- Element link = (Element)links.next();
+ for (Object aLinksList : linksList) {
+ Element link = (Element) aLinksList;
if (!root.equals(link.getParent())) break;
String href = link.getAttribute("href").getValue();
- if ( link.getAttribute("rel", OS_NS) == null
- || link.getAttribute("rel", OS_NS).getValue().equals("alternate")) {
+ if (link.getAttribute("rel", OS_NS) == null
+ || link.getAttribute("rel", OS_NS).getValue().equals("alternate")) {
href = resolveURI(null, link, href);
try {
baseURI = new URL(href);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/photocast/io/Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/photocast/io/Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/photocast/io/Parser.java
index 14580cc..4189674 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/photocast/io/Parser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/photocast/io/Parser.java
@@ -42,19 +42,19 @@
package org.rometools.feed.module.photocast.io;
import com.sun.syndication.feed.module.Module;
+import com.sun.syndication.io.ModuleParser;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
import org.rometools.feed.module.photocast.PhotocastModule;
import org.rometools.feed.module.photocast.PhotocastModuleImpl;
import org.rometools.feed.module.photocast.types.Metadata;
import org.rometools.feed.module.photocast.types.PhotoDate;
-import com.sun.syndication.io.ModuleParser;
+
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;
-import org.jdom2.Element;
-import org.jdom2.Namespace;
/**
*
@@ -80,49 +80,48 @@ public class Parser implements ModuleParser {
return null;
PhotocastModule pm = new PhotocastModuleImpl();
List children = element.getChildren();
- Iterator it = children.iterator();
- while( it.hasNext() ){
- Element e = (Element) it.next();
- if( !e.getNamespace().equals( Parser.NS ) )
+ for (Object aChildren : children) {
+ Element e = (Element) aChildren;
+ if (!e.getNamespace().equals(Parser.NS))
continue;
- if( e.getName().equals("photoDate") ){
- try{
- pm.setPhotoDate( Parser.PHOTO_DATE_FORMAT.parse( e.getText() ) );
- } catch( Exception ex ){
- LOG.warning( "Unable to parse photoDate: "+ e.getText() + " "+ ex.toString());
+ if (e.getName().equals("photoDate")) {
+ try {
+ pm.setPhotoDate(Parser.PHOTO_DATE_FORMAT.parse(e.getText()));
+ } catch (Exception ex) {
+ LOG.warning("Unable to parse photoDate: " + e.getText() + " " + ex.toString());
}
- } else if( e.getName().equals("cropDate") ) {
- try{
- pm.setCropDate( Parser.CROP_DATE_FORMAT.parse( e.getText() ) );
- } catch( Exception ex ){
- LOG.warning( "Unable to parse cropDate: "+ e.getText() + " "+ ex.toString());
+ } else if (e.getName().equals("cropDate")) {
+ try {
+ pm.setCropDate(Parser.CROP_DATE_FORMAT.parse(e.getText()));
+ } catch (Exception ex) {
+ LOG.warning("Unable to parse cropDate: " + e.getText() + " " + ex.toString());
}
- } else if( e.getName().equals("thumbnail") ) {
- try{
- pm.setThumbnailUrl( new URL( e.getText() ) );
- } catch( Exception ex ){
- LOG.warning( "Unable to parse thumnail: "+ e.getText() + " "+ ex.toString());
+ } else if (e.getName().equals("thumbnail")) {
+ try {
+ pm.setThumbnailUrl(new URL(e.getText()));
+ } catch (Exception ex) {
+ LOG.warning("Unable to parse thumnail: " + e.getText() + " " + ex.toString());
}
- } else if( e.getName().equals("image") ) {
- try{
- pm.setImageUrl( new URL( e.getText() ) );
- } catch( Exception ex ){
- LOG.warning( "Unable to parse image: "+ e.getText() + " "+ ex.toString());
+ } else if (e.getName().equals("image")) {
+ try {
+ pm.setImageUrl(new URL(e.getText()));
+ } catch (Exception ex) {
+ LOG.warning("Unable to parse image: " + e.getText() + " " + ex.toString());
}
- } else if( e.getName().equals("metadata") ) {
+ } else if (e.getName().equals("metadata")) {
String comments = "";
PhotoDate photoDate = null;
- if( e.getChildText( "PhotoDate") != null ){
- try{
- photoDate = new PhotoDate( Double.parseDouble( e.getChildText("PhotoDate")));
- } catch( Exception ex ){
- LOG.warning( "Unable to parse PhotoDate: "+ e.getText() + " "+ ex.toString());
+ if (e.getChildText("PhotoDate") != null) {
+ try {
+ photoDate = new PhotoDate(Double.parseDouble(e.getChildText("PhotoDate")));
+ } catch (Exception ex) {
+ LOG.warning("Unable to parse PhotoDate: " + e.getText() + " " + ex.toString());
}
}
- if( e.getChildText("Comments") != null ){
+ if (e.getChildText("Comments") != null) {
comments = e.getChildText("Comments");
}
- pm.setMetadata( new Metadata( photoDate, comments) );
+ pm.setMetadata(new Metadata(photoDate, comments));
}
}
return pm;
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/slash/io/SlashModuleGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/slash/io/SlashModuleGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/slash/io/SlashModuleGenerator.java
index 73cdb04..f1aa635 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/slash/io/SlashModuleGenerator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/slash/io/SlashModuleGenerator.java
@@ -42,10 +42,11 @@ package org.rometools.feed.module.slash.io;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
-import org.rometools.feed.module.slash.Slash;
-import java.util.HashSet;
import org.jdom2.Element;
import org.jdom2.Namespace;
+import org.rometools.feed.module.slash.Slash;
+
+import java.util.HashSet;
/** The ModuleGenerator implementation for the Slash plug in.
* @version $Revision: 1.1 $
@@ -73,7 +74,7 @@ public class SlashModuleGenerator implements ModuleGenerator {
element.addContent( this.generateSimpleElement("section", slash.getSection()));
}
if(slash.getHitParade() != null && slash.getHitParade().length > 0 ){
- StringBuffer buff = new StringBuffer();
+ StringBuilder buff = new StringBuilder();
Integer[] p = slash.getHitParade();
for(int i=0; i < p.length; i++){
if(i!= 0)
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/SleEntryImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/SleEntryImpl.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/SleEntryImpl.java
index 3195448..fc74c7b 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/SleEntryImpl.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/SleEntryImpl.java
@@ -19,8 +19,8 @@ package org.rometools.feed.module.sle;
import com.sun.syndication.feed.CopyFrom;
import com.sun.syndication.feed.impl.ObjectBean;
-import org.rometools.feed.module.sle.io.*;
import org.rometools.feed.module.sle.io.LabelNamespaceElement;
+import org.rometools.feed.module.sle.io.ModuleParser;
import org.rometools.feed.module.sle.types.EntryValue;
import org.rometools.feed.module.sle.types.Group;
import org.rometools.feed.module.sle.types.Sort;
@@ -45,9 +45,9 @@ public class SleEntryImpl implements SleEntry {
public EntryValue getGroupByElement(Group element) {
EntryValue[] values = this.getGroupValues();
LabelNamespaceElement compare = new LabelNamespaceElement( element.getLabel(), element.getNamespace(), element.getElement() );
- for (int i = 0; i < values.length; i++) {
- if( compare.equals( new LabelNamespaceElement( values[i].getLabel(), values[i].getNamespace(), values[i].getElement() )))
- return values[i];
+ for (EntryValue value : values) {
+ if (compare.equals(new LabelNamespaceElement(value.getLabel(), value.getNamespace(), value.getElement())))
+ return value;
}
@@ -79,11 +79,11 @@ public class SleEntryImpl implements SleEntry {
System.out.println("Looking for value for "+element.getLabel() + " from "+this.sortValues.length);
EntryValue[] values = this.getSortValues();
LabelNamespaceElement compare = new LabelNamespaceElement( element.getLabel(), element.getNamespace(), element.getElement() );
- for (int i = 0; i < values.length; i++) {
- System.out.println("Compare to value "+values[i].getLabel());
- if( compare.equals( new LabelNamespaceElement( values[i].getLabel(), values[i].getNamespace(), values[i].getElement() ) ) ){
+ for (EntryValue value : values) {
+ System.out.println("Compare to value " + value.getLabel());
+ if (compare.equals(new LabelNamespaceElement(value.getLabel(), value.getNamespace(), value.getElement()))) {
System.out.println("Match.");
- return values[i];
+ return value;
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/io/ModuleParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/io/ModuleParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/io/ModuleParser.java
index ae2dd0c..1634436 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/io/ModuleParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sle/io/ModuleParser.java
@@ -91,7 +91,7 @@ public class ModuleParser implements com.sun.syndication.io.ModuleParser {
String elementName = se.getAttributeValue("element");
String label = se.getAttributeValue("label");
String dataType = se.getAttributeValue("data-type");
- boolean defaultOrder = se.getAttributeValue("default") != null && new Boolean(se.getAttributeValue("default")).booleanValue();
+ boolean defaultOrder = se.getAttributeValue("default") != null && Boolean.valueOf(se.getAttributeValue("default"));
values.add(new Sort(ns, elementName, dataType, label, defaultOrder));
}
@@ -112,37 +112,37 @@ public class ModuleParser implements com.sun.syndication.io.ModuleParser {
Element e = (Element) elements.get(i);
Group[] groups = sle.getGroupFields();
- for (int g = 0; g < groups.length; g++) {
- Element value = e.getChild(groups[g].getElement(), groups[g].getNamespace());
+ for (Group group1 : groups) {
+ Element value = e.getChild(group1.getElement(), group1.getNamespace());
if (value == null) {
continue;
}
Element group = new Element("group", TEMP);
- addNotNullAttribute(group, "element", groups[g].getElement());
- addNotNullAttribute(group, "label", groups[g].getLabel());
+ addNotNullAttribute(group, "element", group1.getElement());
+ addNotNullAttribute(group, "label", group1.getLabel());
addNotNullAttribute(group, "value", value.getText());
- addNotNullAttribute(group, "ns", groups[g].getNamespace().getURI() );
-
+ addNotNullAttribute(group, "ns", group1.getNamespace().getURI());
+
e.addContent(group);
}
Sort[] sorts = sle.getSortFields();
- for (int s = 0; s < sorts.length; s++) {
- System.out.println("Inserting for "+sorts[s].getElement()+" "+sorts[s].getDataType());
+ for (Sort sort1 : sorts) {
+ System.out.println("Inserting for " + sort1.getElement() + " " + sort1.getDataType());
Element sort = new Element("sort", TEMP);
- // this is the default sort order, so I am just going to ignore
- // the actual values and add a number type. It really shouldn't
+ // this is the default sort order, so I am just going to ignore
+ // the actual values and add a number type. It really shouldn't
// work this way. I should be checking to see if any of the elements
// defined have a value then use that value. This will preserve the
// sort order, however, if anyone is using the SleEntry to display
// the value of the field, it will not give the correct value.
- // This, however, would require knowledge in the item parser that I don't
+ // This, however, would require knowledge in the item parser that I don't
// have right now.
- if (sorts[s].getDefaultOrder()) {
- sort.setAttribute("label", sorts[s].getLabel());
+ if (sort1.getDefaultOrder()) {
+ sort.setAttribute("label", sort1.getLabel());
sort.setAttribute("value", Integer.toString(i));
sort.setAttribute("data-type", Sort.NUMBER_TYPE);
e.addContent(sort);
@@ -150,23 +150,23 @@ public class ModuleParser implements com.sun.syndication.io.ModuleParser {
continue;
}
//System.out.println(e.getName());
- Element value = e.getChild(sorts[s].getElement(), sorts[s].getNamespace());
- if(value == null ){
- System.out.println("No value for "+sorts[s].getElement()+" : "+sorts[s].getNamespace());
+ Element value = e.getChild(sort1.getElement(), sort1.getNamespace());
+ if (value == null) {
+ System.out.println("No value for " + sort1.getElement() + " : " + sort1.getNamespace());
} else {
- System.out.println(sorts[s].getElement() +" value: "+value.getText());
+ System.out.println(sort1.getElement() + " value: " + value.getText());
}
if (value == null) {
continue;
}
- addNotNullAttribute(sort, "label", sorts[s].getLabel());
- addNotNullAttribute(sort, "element", sorts[s].getElement());
+ addNotNullAttribute(sort, "label", sort1.getLabel());
+ addNotNullAttribute(sort, "element", sort1.getElement());
addNotNullAttribute(sort, "value", value.getText());
- addNotNullAttribute(sort, "data-type", sorts[s].getDataType());
- addNotNullAttribute(sort, "ns", sorts[s].getNamespace().getURI() );
+ addNotNullAttribute(sort, "data-type", sort1.getDataType());
+ addNotNullAttribute(sort, "ns", sort1.getNamespace().getURI());
e.addContent(sort);
- System.out.println("Added "+sort+" "+sorts[s].getLabel()+" = "+value.getText());
+ System.out.println("Added " + sort + " " + sort1.getLabel() + " = " + value.getText());
}
}
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Generator.java
index 6a5c088..7b770d0 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Generator.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Generator.java
@@ -1,16 +1,15 @@
package org.rometools.feed.module.sse;
import com.sun.syndication.feed.module.Module;
-import org.rometools.feed.module.sse.modules.*;
import com.sun.syndication.feed.rss.Item;
import com.sun.syndication.io.DelegatingModuleGenerator;
import com.sun.syndication.io.WireFeedGenerator;
import com.sun.syndication.io.impl.DateParser;
import com.sun.syndication.io.impl.RSS20Generator;
import org.jdom2.Element;
+import org.rometools.feed.module.sse.modules.*;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -108,9 +107,9 @@ public class SSE091Generator implements DelegatingModuleGenerator {
private void generateConflicts(Element syncElement, List conflicts) {
if (conflicts != null) {
Element conflictsElement = new Element(Conflicts.NAME, SSEModule.SSE_NS);
- for (Iterator confictIter = conflicts.iterator(); confictIter.hasNext();) {
+ for (Object conflict1 : conflicts) {
Element conflictElement = new Element(Conflict.NAME, SSEModule.SSE_NS);
- Conflict conflict = (Conflict) confictIter.next();
+ Conflict conflict = (Conflict) conflict1;
generateAttribute(conflictElement, Conflict.BY_ATTRIBUTE, conflict.getBy());
generateAttribute(conflictElement, Conflict.VERSION_ATTRIBUTE, conflict.getVersion());
generateAttribute(conflictElement, Conflict.WHEN_ATTRIBUTE, conflict.getWhen());
@@ -142,9 +141,9 @@ public class SSE091Generator implements DelegatingModuleGenerator {
private void generateUpdates(Element historyElement, List updates) {
if (updates != null) {
- for (Iterator updateIter = updates.iterator(); updateIter.hasNext();) {
+ for (Object update1 : updates) {
Element updateElement = new Element(Update.NAME, SSEModule.SSE_NS);
- Update update = (Update) updateIter.next();
+ Update update = (Update) update1;
generateAttribute(updateElement, Update.BY_ATTRIBUTE, update.getBy());
generateAttribute(updateElement, Update.WHEN_ATTRIBUTE, update.getWhen());
historyElement.addContent(updateElement);
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Parser.java
index 81aa3b0..212f1cb 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Parser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/SSE091Parser.java
@@ -1,7 +1,6 @@
package org.rometools.feed.module.sse;
import com.sun.syndication.feed.module.Module;
-import org.rometools.feed.module.sse.modules.*;
import com.sun.syndication.feed.rss.Item;
import com.sun.syndication.io.DelegatingModuleParser;
import com.sun.syndication.io.WireFeedParser;
@@ -11,11 +10,10 @@ import org.jdom2.Attribute;
import org.jdom2.DataConversionException;
import org.jdom2.Element;
import org.jdom2.filter.ElementFilter;
-import org.jdom2.filter.Filter;
+import org.rometools.feed.module.sse.modules.*;
import java.util.ArrayList;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;
@@ -108,17 +106,13 @@ public class SSE091Parser implements DelegatingModuleParser {
List conflicts = null;
List conflictsContent = syncElement.getContent(new ContentFilter(Conflicts.NAME));
- for (Iterator conflictsIter = conflictsContent.iterator();
- conflictsIter.hasNext();)
- {
- Element conflictsElement = (Element) conflictsIter.next();
+ for (Object aConflictsContent : conflictsContent) {
+ Element conflictsElement = (Element) aConflictsContent;
List conflictContent =
conflictsElement.getContent(new ContentFilter(Conflict.NAME));
- for (Iterator conflictIter = conflictContent.iterator();
- conflictIter.hasNext();)
- {
- Element conflictElement = (Element) conflictIter.next();
+ for (Object aConflictContent : conflictContent) {
+ Element conflictElement = (Element) aConflictContent;
Conflict conflict = new Conflict();
conflict.setBy(parseStringAttribute(conflictElement, Conflict.BY_ATTRIBUTE));
@@ -127,10 +121,8 @@ public class SSE091Parser implements DelegatingModuleParser {
List conflictItemContent =
conflictElement.getContent(new ContentFilter("item"));
- for (Iterator conflictItemIter = conflictItemContent.iterator();
- conflictItemIter.hasNext();)
- {
- Element conflictItemElement = (Element) conflictItemIter.next();
+ for (Object aConflictItemContent : conflictItemContent) {
+ Element conflictItemElement = (Element) aConflictItemContent;
Element root = getRoot(conflictItemElement);
Item conflictItem = rssParser.parseItem(root, conflictItemElement);
conflict.setItem(conflictItem);
@@ -180,8 +172,8 @@ public class SSE091Parser implements DelegatingModuleParser {
private void parseUpdates(Element historyChild, History history) {
List updatedChildren = historyChild.getContent(new ContentFilter(Update.NAME));
- for (Iterator childIter = updatedChildren.iterator(); childIter.hasNext();) {
- Element updateChild = (Element) childIter.next();
+ for (Object anUpdatedChildren : updatedChildren) {
+ Element updateChild = (Element) anUpdatedChildren;
Update update = new Update();
update.setBy(parseStringAttribute(updateChild, Update.BY_ATTRIBUTE));
update.setWhen(parseDateAttribute(updateChild, Update.WHEN_ATTRIBUTE));
@@ -199,7 +191,7 @@ public class SSE091Parser implements DelegatingModuleParser {
Integer integerAttr = null;
if (integerAttribute != null) {
try {
- integerAttr = new Integer(integerAttribute.getIntValue());
+ integerAttr = integerAttribute.getIntValue();
} catch (DataConversionException e) {
// dont use the data
}
@@ -212,7 +204,7 @@ public class SSE091Parser implements DelegatingModuleParser {
Boolean attrValue = null;
if (attribute != null) {
try {
- attrValue = Boolean.valueOf(attribute.getBooleanValue());
+ attrValue = attribute.getBooleanValue();
} catch (DataConversionException e) {
// dont use the data
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/modules/SSEModule.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/modules/SSEModule.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/modules/SSEModule.java
index d88b2dd..438150a 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/modules/SSEModule.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/sse/modules/SSEModule.java
@@ -40,10 +40,7 @@ public abstract class SSEModule implements Module {
try {
clone = (SSEModule) this.getClass().newInstance();
clone.copyFrom(this);
- } catch (InstantiationException e) {
- // TODO: use logging
- e.printStackTrace();
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
// TODO: use logging
e.printStackTrace();
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/yahooweather/types/ConditionCode.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/yahooweather/types/ConditionCode.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/yahooweather/types/ConditionCode.java
index 5f09bd1..4dc1018 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/yahooweather/types/ConditionCode.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/yahooweather/types/ConditionCode.java
@@ -37,13 +37,12 @@
*/
package org.rometools.feed.module.yahooweather.types;
-import java.io.Serializable;
+import com.sun.syndication.feed.impl.EqualsBean;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
-import com.sun.syndication.feed.impl.EqualsBean;
-
/**
* <h3>Condition Codes<a name="codes"></a></h3>
@@ -378,7 +377,7 @@ public class ConditionCode implements Serializable {
this.code = code;
this.description = description;
- Object old = ConditionCode.LOOKUP.put(new Integer(code), this);
+ Object old = ConditionCode.LOOKUP.put(code, this);
if(old != null) {
throw new RuntimeException("Duplicate condition code!");
@@ -407,7 +406,7 @@ public class ConditionCode implements Serializable {
* @return a ConditionCode instance or null
*/
public static ConditionCode fromCode(int code) {
- return (ConditionCode) ConditionCode.LOOKUP.get(new Integer(code));
+ return (ConditionCode) ConditionCode.LOOKUP.get(code);
}
public boolean equals(Object o) {
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-rio-vcard/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-vcard/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardParser.java b/commons/marmotta-sesame-tools/marmotta-rio-vcard/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardParser.java
index cffcf82..98718d6 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-vcard/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardParser.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-vcard/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardParser.java
@@ -59,7 +59,7 @@ public class VCardParser extends RDFParserBase {
public static final String NS_RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
public static final String NS_VCARD = "http://www.w3.org/2006/vcard/ns#";
- private static Map<Property.Id, String> propertyMappings = new HashMap<Property.Id, String>();
+ private static Map<Property.Id, String> propertyMappings = new HashMap<>();
static {
propertyMappings.put(Property.Id.ADR, "http://www.w3.org/2006/vcard/ns#adr");
propertyMappings.put(Property.Id.AGENT, "http://www.w3.org/2006/vcard/ns#agent");
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-sail-contextaware/src/main/java/org/apache/marmotta/commons/sesame/contextaware/ContextAwareSailConnection.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-sail-contextaware/src/main/java/org/apache/marmotta/commons/sesame/contextaware/ContextAwareSailConnection.java b/commons/marmotta-sesame-tools/marmotta-sail-contextaware/src/main/java/org/apache/marmotta/commons/sesame/contextaware/ContextAwareSailConnection.java
index 260bcf5..e63f8f5 100644
--- a/commons/marmotta-sesame-tools/marmotta-sail-contextaware/src/main/java/org/apache/marmotta/commons/sesame/contextaware/ContextAwareSailConnection.java
+++ b/commons/marmotta-sesame-tools/marmotta-sail-contextaware/src/main/java/org/apache/marmotta/commons/sesame/contextaware/ContextAwareSailConnection.java
@@ -59,7 +59,7 @@ public class ContextAwareSailConnection extends SailConnectionWrapper {
@Override
public CloseableIteration<? extends Resource, SailException> getContextIDs() throws SailException {
- return new SingletonIteration<Resource, SailException>(context);
+ return new SingletonIteration<>(context);
}
@Override
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/model/TransactionData.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/model/TransactionData.java b/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/model/TransactionData.java
index ee8632f..868c7e0 100644
--- a/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/model/TransactionData.java
+++ b/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/model/TransactionData.java
@@ -54,8 +54,8 @@ public class TransactionData {
public TransactionData() {
transactionId = "TX-" + UUID.randomUUID().toString();
- removedTriples = new TripleTable<Statement>();
- addedTriples = new TripleTable<Statement>();
+ removedTriples = new TripleTable<>();
+ addedTriples = new TripleTable<>();
}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/f45e3ddd/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/sail/KiWiTransactionalSail.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/sail/KiWiTransactionalSail.java b/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/sail/KiWiTransactionalSail.java
index f69ba83..6ad1d3a 100644
--- a/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/sail/KiWiTransactionalSail.java
+++ b/commons/marmotta-sesame-tools/marmotta-sail-transactions/src/main/java/org/apache/marmotta/commons/sesame/transactions/sail/KiWiTransactionalSail.java
@@ -47,7 +47,7 @@ public class KiWiTransactionalSail extends NotifyingSailWrapper implements Trans
public KiWiTransactionalSail(NotifyingSail base) {
super(base);
- this.listeners = new ArrayList<TransactionListener>();
+ this.listeners = new ArrayList<>();
this.transactionsEnabled = true;
}