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 ([email protected]) @@ -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; }
