From 7e5cf653d8a9e64f484efec35f457615a686f2ff Mon Sep 17 00:00:00 2001 From: Antonio Santos Date: Sun, 12 Mar 2023 15:28:40 +0100 Subject: [PATCH] Polish code (#631) --- .../atom/modules/AtomLinkModuleImpl.java | 3 +- .../modules/base/io/CustomTagParser.java | 6 +-- .../modules/base/io/GoogleBaseParser.java | 6 +-- .../modules/feedburner/FeedBurner.java | 4 +- .../feedpress/modules/FeedpressModule.java | 3 +- .../modules/FeedpressModuleImpl.java | 4 +- .../modules/fyyd/modules/FyydModule.java | 3 +- .../modules/fyyd/modules/FyydModuleImpl.java | 4 +- .../modules/georss/GeoRSSModule.java | 2 +- .../modules/georss/geometries/Polygon.java | 2 +- .../modules/itunes/AbstractITunesObject.java | 2 +- .../modules/itunes/EntryInformationImpl.java | 1 - .../modules/itunes/FeedInformation.java | 1 - .../modules/itunes/FeedInformationImpl.java | 1 - .../modules/itunes/io/ITunesParser.java | 2 - .../mediarss/MediaEntryModuleImpl.java | 4 +- .../modules/mediarss/MediaModuleImpl.java | 4 +- .../mediarss/io/MediaModuleParser.java | 2 +- .../modules/mediarss/types/Hash.java | 4 +- .../opensearch/impl/OpenSearchModuleImpl.java | 3 +- .../modules/photocast/types/PhotoDate.java | 5 ++- .../modules/PodloveSimpleChapterModule.java | 3 +- .../PodloveSimpleChapterModuleImpl.java | 3 +- .../com/rometools/modules/slash/Slash.java | 4 +- .../modules/slash/io/SlashModuleParser.java | 4 +- .../modules/sle/io/ModuleParser.java | 2 +- .../rometools/modules/sse/SSE091Parser.java | 2 +- .../modules/sse/modules/SSEModule.java | 9 +++-- .../yahooweather/types/ConditionCode.java | 4 +- .../modules/ITunesGeneratorTest.java | 4 +- .../activitystreams/types/VerbTest.java | 2 - .../modules/atom/AtomGeneratorTest.java | 2 +- .../rometools/modules/atom/AtomLinkTest.java | 1 - .../modules/atom/AtomParserTest.java | 2 +- .../modules/base/io/CustomTagParserTest.java | 4 +- .../modules/base/io/GoogleBaseParserTest.java | 39 +++++++++---------- .../modules/base/types/FloatUnitTest.java | 2 - .../modules/base/types/IntUnitTest.java | 1 - .../content/ContentModuleGeneratorTest.java | 3 +- .../content/ContentModuleImplTest.java | 4 -- .../content/ContentModuleParserTest.java | 4 +- .../feedpress/FeedpressGeneratorTest.java | 4 +- .../feedpress/FeedpressParserTest.java | 4 +- .../modules/fyyd/FyydGeneratorTest.java | 4 +- .../modules/fyyd/FyydParserTest.java | 4 +- .../modules/itunes/ITunesGeneratorTest.java | 4 +- .../modules/itunes/ITunesParserTest.java | 36 ++++++++--------- .../modules/itunes/types/DurationTest.java | 2 - .../modules/mediarss/GoogleTest.java | 2 - .../mediarss/io/MediaModuleParserTest.java | 2 +- .../modules/mediarss/types/TimeTest.java | 2 - .../opensearch/OpenSearchModuleTest.java | 1 - .../PodloveSimpleChapterGeneratorTest.java | 4 +- .../psc/PodloveSimpleChapterParserTest.java | 4 +- .../modules/sle/GroupAndSortTest.java | 2 - .../rometools/modules/sse/SSEParserTest.java | 6 +-- .../io/WeatherModuleParserTest.java | 1 - .../feed/synd/impl/ConverterForOPML10.java | 2 +- .../opml/io/impl/OPML10Generator.java | 3 +- .../rometools/opml/io/impl/OPML10Parser.java | 5 +-- .../com/rometools/utils/Alternatives.java | 14 ++++--- .../com/rometools/utils/AlternativesTest.java | 2 +- .../java/com/rometools/utils/DatesTest.java | 2 +- .../java/com/rometools/utils/ListsTest.java | 2 +- .../java/com/rometools/utils/StringsTest.java | 2 +- .../com/rometools/rome/feed/atom/Person.java | 3 +- .../rome/feed/impl/CloneableBean.java | 8 ++-- .../rome/feed/impl/CopyFromHelper.java | 4 +- .../rome/feed/module/DCSubjectImpl.java | 2 +- .../rome/feed/module/ModuleImpl.java | 3 +- .../java/com/rometools/rome/io/XmlReader.java | 1 - .../rometools/rome/io/impl/NumberParser.java | 6 +-- .../rometools/rome/io/impl/PluginManager.java | 2 +- .../rome/io/impl/RSS091UserlandParser.java | 2 +- .../com/rometools/rome/io/XmlReaderTest.java | 30 ++++++-------- .../rome/io/impl/NumberParserTest.java | 7 ++-- 76 files changed, 144 insertions(+), 203 deletions(-) diff --git a/rome-modules/src/main/java/com/rometools/modules/atom/modules/AtomLinkModuleImpl.java b/rome-modules/src/main/java/com/rometools/modules/atom/modules/AtomLinkModuleImpl.java index 76d101490..630f5d9ac 100644 --- a/rome-modules/src/main/java/com/rometools/modules/atom/modules/AtomLinkModuleImpl.java +++ b/rome-modules/src/main/java/com/rometools/modules/atom/modules/AtomLinkModuleImpl.java @@ -23,11 +23,10 @@ import com.rometools.rome.feed.synd.SyndPerson; import com.rometools.rome.feed.synd.SyndPersonImpl; -import java.io.Serializable; import java.util.LinkedList; import java.util.List; -public class AtomLinkModuleImpl implements AtomLinkModule, Cloneable, Serializable { +public class AtomLinkModuleImpl implements AtomLinkModule { private List links = new LinkedList(); private List authors = new LinkedList(); diff --git a/rome-modules/src/main/java/com/rometools/modules/base/io/CustomTagParser.java b/rome-modules/src/main/java/com/rometools/modules/base/io/CustomTagParser.java index 05fa151ff..1366cffa9 100644 --- a/rome-modules/src/main/java/com/rometools/modules/base/io/CustomTagParser.java +++ b/rome-modules/src/main/java/com/rometools/modules/base/io/CustomTagParser.java @@ -65,9 +65,9 @@ public Module parse(final Element element, final Locale locale) { } 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()))); + tags.add(new CustomTagImpl(child.getName(), Integer.valueOf(child.getTextTrim()))); } else if (type.equals("float")) { - tags.add(new CustomTagImpl(child.getName(), new Float(child.getTextTrim()))); + tags.add(new CustomTagImpl(child.getName(), Float.valueOf(child.getTextTrim()))); } else if (type.equals("intUnit")) { tags.add(new CustomTagImpl(child.getName(), new IntUnit(child.getTextTrim()))); } else if (type.equals("floatUnit")) { @@ -99,7 +99,7 @@ public Module parse(final Element element, final Locale locale) { LOG.warn("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()))); + 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 { diff --git a/rome-modules/src/main/java/com/rometools/modules/base/io/GoogleBaseParser.java b/rome-modules/src/main/java/com/rometools/modules/base/io/GoogleBaseParser.java index f7c5e8e36..92572c940 100644 --- a/rome-modules/src/main/java/com/rometools/modules/base/io/GoogleBaseParser.java +++ b/rome-modules/src/main/java/com/rometools/modules/base/io/GoogleBaseParser.java @@ -142,15 +142,15 @@ private void handleTag(final Element tag, final PropertyDescriptor pd, final Goo Object tagValue = null; if (pd.getPropertyType() == Integer.class || pd.getPropertyType().getComponentType() == Integer.class) { - tagValue = new Integer(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.INTEGER_CHARS, tag.getText())); + tagValue = Integer.valueOf(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.INTEGER_CHARS, tag.getText())); } else if (pd.getPropertyType() == Float.class || pd.getPropertyType().getComponentType() == Float.class) { - tagValue = new Float(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.FLOAT_CHARS, tag.getText())); + tagValue = Float.valueOf(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.FLOAT_CHARS, tag.getText())); } else if (pd.getPropertyType() == String.class || pd.getPropertyType().getComponentType() == String.class) { tagValue = tag.getText(); } 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) { final String text = tag.getText().trim(); diff --git a/rome-modules/src/main/java/com/rometools/modules/feedburner/FeedBurner.java b/rome-modules/src/main/java/com/rometools/modules/feedburner/FeedBurner.java index e21366a25..23a375848 100644 --- a/rome-modules/src/main/java/com/rometools/modules/feedburner/FeedBurner.java +++ b/rome-modules/src/main/java/com/rometools/modules/feedburner/FeedBurner.java @@ -17,14 +17,12 @@ package com.rometools.modules.feedburner; -import java.io.Serializable; - import com.rometools.rome.feed.module.Module; /** * Interface for the FeedBurner RSS extension. */ -public interface FeedBurner extends Module, Serializable, Cloneable { +public interface FeedBurner extends Module { public static final String URI = "http://rssnamespace.org/feedburner/ext/1.0"; diff --git a/rome-modules/src/main/java/com/rometools/modules/feedpress/modules/FeedpressModule.java b/rome-modules/src/main/java/com/rometools/modules/feedpress/modules/FeedpressModule.java index 1ddaacc44..8e31327e3 100644 --- a/rome-modules/src/main/java/com/rometools/modules/feedpress/modules/FeedpressModule.java +++ b/rome-modules/src/main/java/com/rometools/modules/feedpress/modules/FeedpressModule.java @@ -15,13 +15,12 @@ */ package com.rometools.modules.feedpress.modules; -import com.rometools.rome.feed.CopyFrom; import com.rometools.rome.feed.module.Module; /** * This is a ROME module that provides support for the https://feed.press/xmlns namespace. */ -public interface FeedpressModule extends Module, CopyFrom { +public interface FeedpressModule extends Module { /** * The URI of the namespace. (https://feed.press/xmlns) diff --git a/rome-modules/src/main/java/com/rometools/modules/feedpress/modules/FeedpressModuleImpl.java b/rome-modules/src/main/java/com/rometools/modules/feedpress/modules/FeedpressModuleImpl.java index be3b54165..278a8f884 100644 --- a/rome-modules/src/main/java/com/rometools/modules/feedpress/modules/FeedpressModuleImpl.java +++ b/rome-modules/src/main/java/com/rometools/modules/feedpress/modules/FeedpressModuleImpl.java @@ -5,11 +5,9 @@ import com.rometools.rome.feed.impl.ToStringBean; import com.rometools.rome.feed.module.ModuleImpl; -import java.io.Serializable; - public class FeedpressModuleImpl extends ModuleImpl - implements FeedpressModule, Cloneable, Serializable { + implements FeedpressModule { private String newsletterId; private String locale; diff --git a/rome-modules/src/main/java/com/rometools/modules/fyyd/modules/FyydModule.java b/rome-modules/src/main/java/com/rometools/modules/fyyd/modules/FyydModule.java index 1bdbbfd82..a3cbde36c 100644 --- a/rome-modules/src/main/java/com/rometools/modules/fyyd/modules/FyydModule.java +++ b/rome-modules/src/main/java/com/rometools/modules/fyyd/modules/FyydModule.java @@ -15,13 +15,12 @@ */ package com.rometools.modules.fyyd.modules; -import com.rometools.rome.feed.CopyFrom; import com.rometools.rome.feed.module.Module; /** * This is a ROME module that provides support for the https://fyyd.de/fyyd-ns/ namespace. */ -public interface FyydModule extends Module, CopyFrom { +public interface FyydModule extends Module { /** * The URI of the namespace. (https://fyyd.de/fyyd-ns/) diff --git a/rome-modules/src/main/java/com/rometools/modules/fyyd/modules/FyydModuleImpl.java b/rome-modules/src/main/java/com/rometools/modules/fyyd/modules/FyydModuleImpl.java index 47c566980..cc8d5ccde 100644 --- a/rome-modules/src/main/java/com/rometools/modules/fyyd/modules/FyydModuleImpl.java +++ b/rome-modules/src/main/java/com/rometools/modules/fyyd/modules/FyydModuleImpl.java @@ -20,11 +20,9 @@ import com.rometools.rome.feed.impl.ToStringBean; import com.rometools.rome.feed.module.ModuleImpl; -import java.io.Serializable; - public class FyydModuleImpl extends ModuleImpl - implements FyydModule, Cloneable, Serializable { + implements FyydModule { private String verify; diff --git a/rome-modules/src/main/java/com/rometools/modules/georss/GeoRSSModule.java b/rome-modules/src/main/java/com/rometools/modules/georss/GeoRSSModule.java index 029b1ca70..7bc56c3a7 100644 --- a/rome-modules/src/main/java/com/rometools/modules/georss/GeoRSSModule.java +++ b/rome-modules/src/main/java/com/rometools/modules/georss/GeoRSSModule.java @@ -26,7 +26,7 @@ * GeoRSSModule is the main georss interface defining the methods to produce and consume georss * elements. */ -public abstract class GeoRSSModule extends ModuleImpl implements Cloneable { +public abstract class GeoRSSModule extends ModuleImpl { private static final long serialVersionUID = 1L; diff --git a/rome-modules/src/main/java/com/rometools/modules/georss/geometries/Polygon.java b/rome-modules/src/main/java/com/rometools/modules/georss/geometries/Polygon.java index c81455a6a..3bdad8f07 100644 --- a/rome-modules/src/main/java/com/rometools/modules/georss/geometries/Polygon.java +++ b/rome-modules/src/main/java/com/rometools/modules/georss/geometries/Polygon.java @@ -22,7 +22,7 @@ /** * Polygon, a surface object bounded by one external ring and zero or more internal rings */ -public final class Polygon extends AbstractSurface implements Cloneable { +public final class Polygon extends AbstractSurface { private static final long serialVersionUID = 1L; private AbstractRing exterior; diff --git a/rome-modules/src/main/java/com/rometools/modules/itunes/AbstractITunesObject.java b/rome-modules/src/main/java/com/rometools/modules/itunes/AbstractITunesObject.java index 6bbd0a831..786293619 100644 --- a/rome-modules/src/main/java/com/rometools/modules/itunes/AbstractITunesObject.java +++ b/rome-modules/src/main/java/com/rometools/modules/itunes/AbstractITunesObject.java @@ -22,7 +22,7 @@ * This is an abstract object that implements the attributes common across Feeds or Items in an * iTunes compatible RSS feed. */ -public abstract class AbstractITunesObject implements ITunes, java.lang.Cloneable { +public abstract class AbstractITunesObject implements ITunes { private static final long serialVersionUID = 1L; diff --git a/rome-modules/src/main/java/com/rometools/modules/itunes/EntryInformationImpl.java b/rome-modules/src/main/java/com/rometools/modules/itunes/EntryInformationImpl.java index 3ace7c4c5..7f568cecd 100644 --- a/rome-modules/src/main/java/com/rometools/modules/itunes/EntryInformationImpl.java +++ b/rome-modules/src/main/java/com/rometools/modules/itunes/EntryInformationImpl.java @@ -19,7 +19,6 @@ import com.rometools.modules.itunes.types.Duration; import com.rometools.rome.feed.CopyFrom; -import java.net.URISyntaxException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/rome-modules/src/main/java/com/rometools/modules/itunes/FeedInformation.java b/rome-modules/src/main/java/com/rometools/modules/itunes/FeedInformation.java index 537abbc49..6f0a547ea 100644 --- a/rome-modules/src/main/java/com/rometools/modules/itunes/FeedInformation.java +++ b/rome-modules/src/main/java/com/rometools/modules/itunes/FeedInformation.java @@ -16,7 +16,6 @@ */ package com.rometools.modules.itunes; -import java.net.URL; import java.util.List; import com.rometools.modules.itunes.types.Category; diff --git a/rome-modules/src/main/java/com/rometools/modules/itunes/FeedInformationImpl.java b/rome-modules/src/main/java/com/rometools/modules/itunes/FeedInformationImpl.java index 566ace826..63cd17cd7 100644 --- a/rome-modules/src/main/java/com/rometools/modules/itunes/FeedInformationImpl.java +++ b/rome-modules/src/main/java/com/rometools/modules/itunes/FeedInformationImpl.java @@ -17,7 +17,6 @@ package com.rometools.modules.itunes; import java.net.MalformedURLException; -import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; import java.util.List; diff --git a/rome-modules/src/main/java/com/rometools/modules/itunes/io/ITunesParser.java b/rome-modules/src/main/java/com/rometools/modules/itunes/io/ITunesParser.java index 678e5a135..9b75f5d39 100644 --- a/rome-modules/src/main/java/com/rometools/modules/itunes/io/ITunesParser.java +++ b/rome-modules/src/main/java/com/rometools/modules/itunes/io/ITunesParser.java @@ -17,8 +17,6 @@ package com.rometools.modules.itunes.io; import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; import java.util.Arrays; import java.util.List; diff --git a/rome-modules/src/main/java/com/rometools/modules/mediarss/MediaEntryModuleImpl.java b/rome-modules/src/main/java/com/rometools/modules/mediarss/MediaEntryModuleImpl.java index 8bb5b337e..cdbe31e51 100644 --- a/rome-modules/src/main/java/com/rometools/modules/mediarss/MediaEntryModuleImpl.java +++ b/rome-modules/src/main/java/com/rometools/modules/mediarss/MediaEntryModuleImpl.java @@ -21,8 +21,6 @@ */ package com.rometools.modules.mediarss; -import java.io.Serializable; - import com.rometools.modules.mediarss.types.MediaContent; import com.rometools.modules.mediarss.types.MediaGroup; import com.rometools.modules.mediarss.types.Metadata; @@ -33,7 +31,7 @@ /** * Represents information for an Entry/Item level. */ -public class MediaEntryModuleImpl extends MediaModuleImpl implements MediaEntryModule, Cloneable, Serializable { +public class MediaEntryModuleImpl extends MediaModuleImpl implements MediaEntryModule { private static final long serialVersionUID = 1L; /* diff --git a/rome-modules/src/main/java/com/rometools/modules/mediarss/MediaModuleImpl.java b/rome-modules/src/main/java/com/rometools/modules/mediarss/MediaModuleImpl.java index 77ebfee10..3e1d049bc 100644 --- a/rome-modules/src/main/java/com/rometools/modules/mediarss/MediaModuleImpl.java +++ b/rome-modules/src/main/java/com/rometools/modules/mediarss/MediaModuleImpl.java @@ -22,8 +22,6 @@ */ package com.rometools.modules.mediarss; -import java.io.Serializable; - import com.rometools.modules.mediarss.types.Metadata; import com.rometools.modules.mediarss.types.PlayerReference; import com.rometools.rome.feed.CopyFrom; @@ -33,7 +31,7 @@ * * This class represents feed/channel level elements for MediaRSS */ -public class MediaModuleImpl extends ModuleImpl implements MediaModule, Serializable { +public class MediaModuleImpl extends ModuleImpl implements MediaModule { private static final long serialVersionUID = 1L; private Metadata metadata; diff --git a/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleParser.java b/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleParser.java index d450b776e..2145d4957 100644 --- a/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleParser.java +++ b/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleParser.java @@ -281,7 +281,7 @@ private MediaGroup[] parseGroup(final Element e, final Locale locale) { for (int j = 0; j < g.getContents().length; j++) { if (g.getContents()[j].isDefaultContent()) { - g.setDefaultContentIndex(new Integer(j)); + g.setDefaultContentIndex(Integer.valueOf(j)); break; } diff --git a/rome-modules/src/main/java/com/rometools/modules/mediarss/types/Hash.java b/rome-modules/src/main/java/com/rometools/modules/mediarss/types/Hash.java index 07a2524d2..e1ef93583 100644 --- a/rome-modules/src/main/java/com/rometools/modules/mediarss/types/Hash.java +++ b/rome-modules/src/main/java/com/rometools/modules/mediarss/types/Hash.java @@ -22,8 +22,6 @@ */ package com.rometools.modules.mediarss.types; -import java.io.Serializable; - import com.rometools.rome.feed.impl.EqualsBean; import com.rometools.rome.feed.impl.ToStringBean; @@ -46,7 +44,7 @@ * algo indicates the algorithm used to create the hash. Possible values are 'md5' and * 'sha-1'. Default value is 'md5'. It is an optional attribute. */ -public class Hash extends AbstractSchemeValue implements Serializable { +public class Hash extends AbstractSchemeValue { private static final long serialVersionUID = 1L; /** diff --git a/rome-modules/src/main/java/com/rometools/modules/opensearch/impl/OpenSearchModuleImpl.java b/rome-modules/src/main/java/com/rometools/modules/opensearch/impl/OpenSearchModuleImpl.java index f1874d53d..b609b40a1 100644 --- a/rome-modules/src/main/java/com/rometools/modules/opensearch/impl/OpenSearchModuleImpl.java +++ b/rome-modules/src/main/java/com/rometools/modules/opensearch/impl/OpenSearchModuleImpl.java @@ -11,7 +11,6 @@ */ package com.rometools.modules.opensearch.impl; -import java.io.Serializable; import java.util.LinkedList; import java.util.List; @@ -24,7 +23,7 @@ import com.rometools.rome.feed.atom.Link; import com.rometools.rome.feed.module.ModuleImpl; -public class OpenSearchModuleImpl extends ModuleImpl implements OpenSearchModule, Serializable { +public class OpenSearchModuleImpl extends ModuleImpl implements OpenSearchModule { private static final long serialVersionUID = 1L; private static final Logger LOG = LoggerFactory.getLogger(OpenSearchModuleImpl.class); private int totalResults = -1; diff --git a/rome-modules/src/main/java/com/rometools/modules/photocast/types/PhotoDate.java b/rome-modules/src/main/java/com/rometools/modules/photocast/types/PhotoDate.java index aa15da832..8fede5f83 100644 --- a/rome-modules/src/main/java/com/rometools/modules/photocast/types/PhotoDate.java +++ b/rome-modules/src/main/java/com/rometools/modules/photocast/types/PhotoDate.java @@ -17,6 +17,7 @@ package com.rometools.modules.photocast.types; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.Date; /** @@ -66,8 +67,8 @@ public String toString() { BigDecimal d = new BigDecimal(getTime()); d = d.subtract(new BigDecimal(Y2K)); d = d.multiply(new BigDecimal(1000000)); - d = d.divide(new BigDecimal(DAY), BigDecimal.ROUND_HALF_UP); - return d.divide(new BigDecimal(1000000), 7, BigDecimal.ROUND_HALF_UP).toString(); + d = d.divide(new BigDecimal(DAY), RoundingMode.HALF_UP); + return d.divide(new BigDecimal(1000000), 7, RoundingMode.HALF_UP).toString(); } @Override diff --git a/rome-modules/src/main/java/com/rometools/modules/psc/modules/PodloveSimpleChapterModule.java b/rome-modules/src/main/java/com/rometools/modules/psc/modules/PodloveSimpleChapterModule.java index 5cf77c17c..5657143a9 100644 --- a/rome-modules/src/main/java/com/rometools/modules/psc/modules/PodloveSimpleChapterModule.java +++ b/rome-modules/src/main/java/com/rometools/modules/psc/modules/PodloveSimpleChapterModule.java @@ -17,7 +17,6 @@ package com.rometools.modules.psc.modules; import com.rometools.modules.psc.types.SimpleChapter; -import com.rometools.rome.feed.CopyFrom; import com.rometools.rome.feed.module.Module; import java.util.List; @@ -25,7 +24,7 @@ /** * An interface describing the item level data for Podlove Simple Chapters. */ -public interface PodloveSimpleChapterModule extends Module, CopyFrom { +public interface PodloveSimpleChapterModule extends Module { /** "http://podlove.org/simple-chapters". */ String URI = "http://podlove.org/simple-chapters"; diff --git a/rome-modules/src/main/java/com/rometools/modules/psc/modules/PodloveSimpleChapterModuleImpl.java b/rome-modules/src/main/java/com/rometools/modules/psc/modules/PodloveSimpleChapterModuleImpl.java index 08e5ad62c..11647c73e 100644 --- a/rome-modules/src/main/java/com/rometools/modules/psc/modules/PodloveSimpleChapterModuleImpl.java +++ b/rome-modules/src/main/java/com/rometools/modules/psc/modules/PodloveSimpleChapterModuleImpl.java @@ -22,7 +22,6 @@ import com.rometools.rome.feed.impl.ToStringBean; import com.rometools.rome.feed.module.ModuleImpl; -import java.io.Serializable; import java.util.LinkedList; import java.util.List; @@ -31,7 +30,7 @@ */ public class PodloveSimpleChapterModuleImpl extends ModuleImpl - implements PodloveSimpleChapterModule, Cloneable, Serializable { + implements PodloveSimpleChapterModule { private List chapters; diff --git a/rome-modules/src/main/java/com/rometools/modules/slash/Slash.java b/rome-modules/src/main/java/com/rometools/modules/slash/Slash.java index 068e405ce..75f41734c 100644 --- a/rome-modules/src/main/java/com/rometools/modules/slash/Slash.java +++ b/rome-modules/src/main/java/com/rometools/modules/slash/Slash.java @@ -16,14 +16,12 @@ package com.rometools.modules.slash; -import java.io.Serializable; - import com.rometools.rome.feed.module.Module; /** * This interface represents the Slash RSS extension. */ -public interface Slash extends Module, Serializable { +public interface Slash extends Module { public static final String URI = "http://purl.org/rss/1.0/modules/slash/"; diff --git a/rome-modules/src/main/java/com/rometools/modules/slash/io/SlashModuleParser.java b/rome-modules/src/main/java/com/rometools/modules/slash/io/SlashModuleParser.java index d4943f141..a7d7044c9 100644 --- a/rome-modules/src/main/java/com/rometools/modules/slash/io/SlashModuleParser.java +++ b/rome-modules/src/main/java/com/rometools/modules/slash/io/SlashModuleParser.java @@ -51,14 +51,14 @@ public Module parse(final Element element, final Locale locale) { final StringTokenizer tok = new StringTokenizer(tag.getText(), ","); final Integer[] hp = new Integer[tok.countTokens()]; for (int i = 0; tok.hasMoreTokens(); i++) { - hp[i] = new Integer(tok.nextToken()); + hp[i] = Integer.valueOf(tok.nextToken()); } si.setHitParade(hp); } tag = null; tag = element.getChild("comments", SlashModuleParser.NS); if (tag != null && !tag.getText().trim().isEmpty()) { - si.setComments(new Integer(tag.getText().trim())); + si.setComments(Integer.valueOf(tag.getText().trim())); } tag = null; tag = element.getChild("department", SlashModuleParser.NS); diff --git a/rome-modules/src/main/java/com/rometools/modules/sle/io/ModuleParser.java b/rome-modules/src/main/java/com/rometools/modules/sle/io/ModuleParser.java index 3eca7d1f3..780e1d50f 100644 --- a/rome-modules/src/main/java/com/rometools/modules/sle/io/ModuleParser.java +++ b/rome-modules/src/main/java/com/rometools/modules/sle/io/ModuleParser.java @@ -88,7 +88,7 @@ public Module parse(final Element element, final Locale locale) { final String elementName = se.getAttributeValue("element"); final String label = se.getAttributeValue("label"); final String dataType = se.getAttributeValue("data-type"); - final boolean defaultOrder = se.getAttributeValue("default") == null ? false : new Boolean(se.getAttributeValue("default")).booleanValue(); + final boolean defaultOrder = se.getAttributeValue("default") == null ? false : Boolean.valueOf(se.getAttributeValue("default")).booleanValue(); values.add(new Sort(ns, elementName, dataType, label, defaultOrder)); } diff --git a/rome-modules/src/main/java/com/rometools/modules/sse/SSE091Parser.java b/rome-modules/src/main/java/com/rometools/modules/sse/SSE091Parser.java index dbc3a446e..7b292ce39 100644 --- a/rome-modules/src/main/java/com/rometools/modules/sse/SSE091Parser.java +++ b/rome-modules/src/main/java/com/rometools/modules/sse/SSE091Parser.java @@ -208,7 +208,7 @@ private Integer parseIntegerAttribute(final Element sharingChild, final String a Integer integerAttr = null; if (integerAttribute != null) { try { - integerAttr = new Integer(integerAttribute.getIntValue()); + integerAttr = Integer.valueOf(integerAttribute.getIntValue()); } catch (final DataConversionException e) { // dont use the data } diff --git a/rome-modules/src/main/java/com/rometools/modules/sse/modules/SSEModule.java b/rome-modules/src/main/java/com/rometools/modules/sse/modules/SSEModule.java index ad5c7db35..64275af33 100644 --- a/rome-modules/src/main/java/com/rometools/modules/sse/modules/SSEModule.java +++ b/rome-modules/src/main/java/com/rometools/modules/sse/modules/SSEModule.java @@ -11,6 +11,7 @@ */ package com.rometools.modules.sse.modules; +import java.lang.reflect.InvocationTargetException; import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -59,11 +60,11 @@ public Class getInterface() { public Object clone() { SSEModule clone = null; try { - clone = this.getClass().newInstance(); + clone = this.getClass().getDeclaredConstructor().newInstance(); clone.copyFrom(this); - } catch (final InstantiationException e) { - LOG.error("Error", e); - } catch (final IllegalAccessException e) { + } catch (final InstantiationException | IllegalAccessException | + IllegalArgumentException | InvocationTargetException | + NoSuchMethodException | SecurityException e) { LOG.error("Error", e); } return clone; diff --git a/rome-modules/src/main/java/com/rometools/modules/yahooweather/types/ConditionCode.java b/rome-modules/src/main/java/com/rometools/modules/yahooweather/types/ConditionCode.java index b885a73a7..c32b7936d 100644 --- a/rome-modules/src/main/java/com/rometools/modules/yahooweather/types/ConditionCode.java +++ b/rome-modules/src/main/java/com/rometools/modules/yahooweather/types/ConditionCode.java @@ -321,7 +321,7 @@ private ConditionCode(final int code, final String description) { this.code = code; this.description = description; - final Object old = ConditionCode.LOOKUP.put(new Integer(code), this); + final Object old = ConditionCode.LOOKUP.put(Integer.valueOf(code), this); if (old != null) { throw new RuntimeException("Duplicate condition code!"); @@ -351,7 +351,7 @@ public String getDescription() { * @return a ConditionCode instance or null */ public static ConditionCode fromCode(final int code) { - return ConditionCode.LOOKUP.get(new Integer(code)); + return ConditionCode.LOOKUP.get(Integer.valueOf(code)); } @Override diff --git a/rome-modules/src/test/java/com/rometools/modules/ITunesGeneratorTest.java b/rome-modules/src/test/java/com/rometools/modules/ITunesGeneratorTest.java index 122bab920..27053b334 100644 --- a/rome-modules/src/test/java/com/rometools/modules/ITunesGeneratorTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/ITunesGeneratorTest.java @@ -63,13 +63,13 @@ public void testEndToEnd() throws Exception { private void testFile(final String filename) throws Exception { final File feed = new File(getTestFile(filename)); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL())); + final SyndFeed syndfeed = input.build(new XmlReader(feed)); final SyndFeedOutput output = new SyndFeedOutput(); final File outfeed = new File("target/" + feed.getName()); output.output(syndfeed, outfeed); - final SyndFeed syndCheck = input.build(new XmlReader(outfeed.toURI().toURL())); + final SyndFeed syndCheck = input.build(new XmlReader(outfeed)); LOG.debug(syndCheck.getModule(AbstractITunesObject.URI).toString()); assertEquals("Feed Level: ", syndfeed.getModule(AbstractITunesObject.URI).toString(), syndCheck.getModule(AbstractITunesObject.URI).toString()); diff --git a/rome-modules/src/test/java/com/rometools/modules/activitystreams/types/VerbTest.java b/rome-modules/src/test/java/com/rometools/modules/activitystreams/types/VerbTest.java index cf620bdff..adce1a4b8 100644 --- a/rome-modules/src/test/java/com/rometools/modules/activitystreams/types/VerbTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/activitystreams/types/VerbTest.java @@ -22,8 +22,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.rometools.modules.activitystreams.types.Verb; - public class VerbTest extends TestCase { private static final Logger LOG = LoggerFactory.getLogger(VerbTest.class); diff --git a/rome-modules/src/test/java/com/rometools/modules/atom/AtomGeneratorTest.java b/rome-modules/src/test/java/com/rometools/modules/atom/AtomGeneratorTest.java index 66d046f61..a89cf1dec 100644 --- a/rome-modules/src/test/java/com/rometools/modules/atom/AtomGeneratorTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/atom/AtomGeneratorTest.java @@ -40,7 +40,7 @@ public void testGenerate() throws Exception { log.debug("testGenerate"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("atom/rss.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("atom/rss.xml")))); feed.getModule(AtomLinkModule.URI); final SyndEntry entry = feed.getEntries().get(0); diff --git a/rome-modules/src/test/java/com/rometools/modules/atom/AtomLinkTest.java b/rome-modules/src/test/java/com/rometools/modules/atom/AtomLinkTest.java index 4c740d90b..b13bc2ef4 100644 --- a/rome-modules/src/test/java/com/rometools/modules/atom/AtomLinkTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/atom/AtomLinkTest.java @@ -31,7 +31,6 @@ import junit.framework.Test; import junit.framework.TestSuite; -import java.io.File; import java.util.List; /** diff --git a/rome-modules/src/test/java/com/rometools/modules/atom/AtomParserTest.java b/rome-modules/src/test/java/com/rometools/modules/atom/AtomParserTest.java index 90b016d06..6d320df5b 100644 --- a/rome-modules/src/test/java/com/rometools/modules/atom/AtomParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/atom/AtomParserTest.java @@ -39,7 +39,7 @@ public void testParse() throws Exception { log.debug("testParse"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("atom/rss.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("atom/rss.xml")))); final AtomLinkModule feedAtomModule = (AtomLinkModule) feed.getModule(AtomLinkModule.URI); for (SyndPerson author : feedAtomModule.getAuthors()) { diff --git a/rome-modules/src/test/java/com/rometools/modules/base/io/CustomTagParserTest.java b/rome-modules/src/test/java/com/rometools/modules/base/io/CustomTagParserTest.java index dea02991d..950be995c 100644 --- a/rome-modules/src/test/java/com/rometools/modules/base/io/CustomTagParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/base/io/CustomTagParserTest.java @@ -70,7 +70,7 @@ public void testParse() throws Exception { Assert.assertEquals("Fluent in English and German", tag.getValue()); } if (tag.getName().equals("prior_experience_years")) { - Assert.assertEquals(new Integer(5), tag.getValue()); + Assert.assertEquals(Integer.valueOf(5), tag.getValue()); } else if (tag.getName().equals("start_date")) { final Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(0); @@ -79,7 +79,7 @@ public void testParse() throws Exception { } else if (tag.getName().equals("test_url")) { Assert.assertEquals(new URL("http://www.screaming-penguin.com"), tag.getValue()); } else if (tag.getName().equals("test_boolean")) { - Assert.assertEquals(new Boolean(true), tag.getValue()); + Assert.assertEquals(Boolean.TRUE, tag.getValue()); } else if (tag.getName().equals("test_intUnit")) { Assert.assertEquals(new IntUnit(25, "horses"), tag.getValue()); } else if (tag.getName().equals("test_floatUnit")) { diff --git a/rome-modules/src/test/java/com/rometools/modules/base/io/GoogleBaseParserTest.java b/rome-modules/src/test/java/com/rometools/modules/base/io/GoogleBaseParserTest.java index ea67d47de..6fc4cdf47 100644 --- a/rome-modules/src/test/java/com/rometools/modules/base/io/GoogleBaseParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/base/io/GoogleBaseParserTest.java @@ -46,7 +46,6 @@ import com.rometools.modules.base.Travel; import com.rometools.modules.base.Vehicle; import com.rometools.modules.base.Wanted; -import com.rometools.modules.base.io.GoogleBaseParser; import com.rometools.modules.base.types.CurrencyEnumeration; import com.rometools.modules.base.types.FloatUnit; import com.rometools.modules.base.types.GenderEnumeration; @@ -154,7 +153,7 @@ public void testEvent2Parse() throws Exception { // TODO: Determine what to do about the bogus services. Assert.assertEquals("Shipping Country", "US", event.getShipping()[0].getCountry()); Assert.assertEquals("Tax Region", "California", event.getTaxRegion()); - Assert.assertEquals("Tax Percentage", new Float(8.25), event.getTaxPercent()); + Assert.assertEquals("Tax Percentage", Float.valueOf(8.25f), event.getTaxPercent()); entry = entries.get(1); event = (Event) entry.getModule(GoogleBase.URI); @@ -183,7 +182,7 @@ public void testEvent2Parse() throws Exception { // TODO: Determine what to do about the bogus services. Assert.assertEquals("Shipping Country", "US", event.getShipping()[0].getCountry()); Assert.assertEquals("Tax Region", "California", event.getTaxRegion()); - Assert.assertEquals("Tax Percentage", new Float(8.25), event.getTaxPercent()); + Assert.assertEquals("Tax Percentage", Float.valueOf(8.25f), event.getTaxPercent()); } @@ -210,19 +209,19 @@ public void testHousing2Parse() throws Exception { this.assertEquals("Payment Accepted", new PaymentTypeEnumeration[] { PaymentTypeEnumeration.CASH, PaymentTypeEnumeration.CHECK, PaymentTypeEnumeration.VISA }, module.getPaymentAccepted()); Assert.assertEquals("Payment Notes", "1000 deposit", module.getPaymentNotes()); - Assert.assertEquals("Listing Type", new Boolean(true), module.getListingType()); + Assert.assertEquals("Listing Type", Boolean.TRUE, module.getListingType()); this.assertEquals("PropertyTypes", new String[] { "Townhouse" }, module.getPropertyTypes()); Assert.assertEquals("Location", "123 Main St, Anytown, CA, 12345, USA", module.getLocation()); - Assert.assertEquals("Bedrooms", new Integer(3), module.getBedrooms()); - Assert.assertEquals("Bathrooms", new Float(3), module.getBathrooms()); + Assert.assertEquals("Bedrooms", Integer.valueOf(3), module.getBedrooms()); + Assert.assertEquals("Bathrooms", Float.valueOf(3f), module.getBathrooms()); Assert.assertEquals("Area", 1300, module.getArea().getValue()); Assert.assertEquals("Area Units", null, module.getArea().getUnits()); Assert.assertEquals("School District", "Union School District", module.getSchoolDistrict()); - Assert.assertEquals("HOA Dues", new Float(120), module.getHoaDues()); + Assert.assertEquals("HOA Dues", Float.valueOf(120f), module.getHoaDues()); Assert.assertEquals("Year", "2005", module.getYear().toString()); this.assertEquals("Agents", new String[] { "Sue Smith" }, module.getAgents()); Assert.assertEquals("Tax Region", "California", module.getTaxRegion()); - Assert.assertEquals("Tax Percentage", new Float(8.25), module.getTaxPercent()); + Assert.assertEquals("Tax Percentage", Float.valueOf(8.25f), module.getTaxPercent()); entry = entries.get(1); module = (Housing) entry.getModule(GoogleBase.URI); @@ -236,11 +235,11 @@ public void testHousing2Parse() throws Exception { Assert.assertEquals("PriceType", PriceTypeEnumeration.STARTING, module.getPriceType()); this.assertEquals("Payment Accepted", new PaymentTypeEnumeration[] { PaymentTypeEnumeration.CHECK }, module.getPaymentAccepted()); Assert.assertEquals("Payment Notes", "1000 deposit", module.getPaymentNotes()); - Assert.assertEquals("Listing Type", new Boolean(false), module.getListingType()); + Assert.assertEquals("Listing Type", Boolean.FALSE, module.getListingType()); this.assertEquals("PropertyTypes", new String[] { "apartment" }, module.getPropertyTypes()); Assert.assertEquals("Location", "123 Main St, Anytown, CA, 12345, USA", module.getLocation()); - Assert.assertEquals("Bedrooms", new Integer(2), module.getBedrooms()); - Assert.assertEquals("Bathrooms", new Float(2), module.getBathrooms()); + Assert.assertEquals("Bedrooms", Integer.valueOf(2), module.getBedrooms()); + Assert.assertEquals("Bathrooms", Float.valueOf(2f), module.getBathrooms()); Assert.assertEquals("Area", 1100, module.getArea().getValue()); Assert.assertEquals("Area Units", null, module.getArea().getUnits()); Assert.assertEquals("School District", "Union School District", module.getSchoolDistrict()); @@ -273,7 +272,7 @@ public void testJobs2Parse() throws Exception { LOG.debug("{}", new Object[] { module.getJobTypes() }); this.assertEquals("Job Type", new String[] { "full-time" }, module.getJobTypes()); Assert.assertEquals("Currency", CurrencyEnumeration.USD, module.getCurrency()); - Assert.assertEquals("Salary", new Float(40000), module.getSalary()); + Assert.assertEquals("Salary", Float.valueOf(40000f), module.getSalary()); Assert.assertEquals("Salary Type", PriceTypeEnumeration.STARTING, module.getSalaryType()); Assert.assertEquals("Education", "BS", module.getEducation()); Assert.assertEquals("Immigration", "Permanent Resident", module.getImmigrationStatus()); @@ -301,7 +300,7 @@ public void testNews2Parse() throws Exception { cal.set(1961, 3, 12, 0, 0, 0); Assert.assertEquals("Pub Date", cal.getTime(), module.getPublishDate()); this.assertEquals("Authors", new String[] { "James Smith" }, module.getAuthors()); - Assert.assertEquals("Pages", new Integer(1), module.getPages()); + Assert.assertEquals("Pages", Integer.valueOf(1), module.getPages()); } @@ -328,7 +327,7 @@ public void testTravel2Parse() throws Exception { this.assertEquals("Payment Accepted", new PaymentTypeEnumeration[] { PaymentTypeEnumeration.CHECK, PaymentTypeEnumeration.VISA }, module.getPaymentAccepted()); Assert.assertEquals("Payment notes", "minimum payment on credit cards:45", module.getPaymentNotes()); - Assert.assertEquals("Quantity", new Integer(204), module.getQuantity()); + Assert.assertEquals("Quantity", Integer.valueOf(204), module.getQuantity()); Assert.assertEquals("From", "Mytown, USA", module.getFromLocation()); Assert.assertEquals("To", "Anytown, USA", module.getToLocation()); cal.set(2005, 11, 20, 18, 0, 0); @@ -339,7 +338,7 @@ public void testTravel2Parse() throws Exception { this.assertEquals("Shipping", new ShippingType[] { new ShippingType(new FloatUnit("32.95"), ShippingType.ServiceEnumeration.OVERNIGHT, "US") }, module.getShipping()); Assert.assertEquals("Tax Region", "California", module.getTaxRegion()); - Assert.assertEquals("Tax Percentage", new Float(8.25), module.getTaxPercent()); + Assert.assertEquals("Tax Percentage", Float.valueOf(8.25f), module.getTaxPercent()); } @@ -366,7 +365,7 @@ public void testPersona2Parse() throws Exception { Assert.assertEquals("Marital Status", "single", module.getMaritalStatus()); Assert.assertEquals("Occupation", "Sales", module.getOccupation()); Assert.assertEquals("Employer", "Google, Inc.", module.getEmployer()); - Assert.assertEquals("Age", new Integer(23), module.getAge()); + Assert.assertEquals("Age", Integer.valueOf(23), module.getAge()); Assert.assertEquals("Location", "Anytown, 12345, USA", module.getLocation()); } @@ -403,7 +402,7 @@ public void testProduct2Parse() throws Exception { Assert.assertEquals("Size", 50, module.getSize().getWidth().getValue(), 0); Assert.assertEquals("Size", 20, module.getSize().getHeight().getValue(), 0); Assert.assertEquals("Weight", 2, module.getWeight().getValue(), 0); - Assert.assertEquals("Quantity", new Integer(300), module.getQuantity()); + Assert.assertEquals("Quantity", Integer.valueOf(300), module.getQuantity()); Assert.assertEquals("Condition", "new", module.getCondition()); this.assertEquals("Colors", new String[] { "blue" }, module.getColors()); Assert.assertEquals("Location", "1600 Amphitheatre Pkwy Mountain View, CA 94043-1351, US", module.getLocation()); @@ -431,7 +430,7 @@ public void testResearch2Parse() throws Exception { this.assertEquals("Authors", new String[] { "James Smith" }, module.getAuthors()); Assert.assertEquals("Pub Name", "Tsunami and the Economy", module.getPublicationName()); Assert.assertEquals("Pub Vol", "III", module.getPublicationVolume()); - Assert.assertEquals("Pages", new Integer(5), module.getPages()); + Assert.assertEquals("Pages", Integer.valueOf(5), module.getPages()); } /** @@ -456,7 +455,7 @@ public void testReview2Parse() throws Exception { Assert.assertEquals("Name of Item Rev", "Google Earth", module.getNameOfItemBeingReviewed()); Assert.assertEquals("Type", "Product", module.getReviewType()); Assert.assertEquals("Rever Type", "editorial", module.getReviewerType()); - Assert.assertEquals("Rating", new Float(5), module.getRating()); + Assert.assertEquals("Rating", Float.valueOf(5f), module.getRating()); Assert.assertEquals("URL of Item", new URL("http://earth.google.com/"), module.getUrlOfItemBeingReviewed()); } @@ -518,7 +517,7 @@ public void testVehicle2Parse() throws Exception { Assert.assertEquals("Make", "Mini", module.getMake()); Assert.assertEquals("Model", "Cooper S", module.getModel()); Assert.assertEquals("Year", "2006", module.getYear().toString()); - Assert.assertEquals("Mileage", new Integer(0), module.getMileage()); + Assert.assertEquals("Mileage", Integer.valueOf(0), module.getMileage()); this.assertEquals("Colors", new String[] { "red" }, module.getColors()); Assert.assertEquals("Vin", "1M8GDM9AXKP042788", module.getVin()); Assert.assertEquals("Location", "123 Main Street, Anytown, CA, 12345, USA", module.getLocation()); diff --git a/rome-modules/src/test/java/com/rometools/modules/base/types/FloatUnitTest.java b/rome-modules/src/test/java/com/rometools/modules/base/types/FloatUnitTest.java index 9b0593e80..23261df5d 100644 --- a/rome-modules/src/test/java/com/rometools/modules/base/types/FloatUnitTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/base/types/FloatUnitTest.java @@ -27,8 +27,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.rometools.modules.base.types.FloatUnit; - public class FloatUnitTest extends TestCase { private static final Logger LOG = LoggerFactory.getLogger(FloatUnitTest.class); diff --git a/rome-modules/src/test/java/com/rometools/modules/base/types/IntUnitTest.java b/rome-modules/src/test/java/com/rometools/modules/base/types/IntUnitTest.java index 6652afe3c..ab074c2c8 100644 --- a/rome-modules/src/test/java/com/rometools/modules/base/types/IntUnitTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/base/types/IntUnitTest.java @@ -27,7 +27,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.rometools.modules.base.types.IntUnit; import com.rometools.modules.cc.io.CCModuleGenerator; public class IntUnitTest extends TestCase { diff --git a/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleGeneratorTest.java b/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleGeneratorTest.java index 676ce0a1b..da68ac243 100644 --- a/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleGeneratorTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleGeneratorTest.java @@ -26,7 +26,6 @@ import org.slf4j.LoggerFactory; import com.rometools.modules.AbstractTestCase; -import com.rometools.modules.content.ContentModule; import com.rometools.rome.feed.synd.SyndEntry; import com.rometools.rome.feed.synd.SyndFeed; import com.rometools.rome.io.SyndFeedInput; @@ -63,7 +62,7 @@ public void testGenerate() throws Exception { LOG.debug("testGenerate"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("xml/test-rdf.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("xml/test-rdf.xml")))); final SyndEntry entry = feed.getEntries().get(0); entry.getModule(ContentModule.URI); final SyndFeedOutput output = new SyndFeedOutput(); diff --git a/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleImplTest.java b/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleImplTest.java index 8ec2f588b..e74ae462f 100644 --- a/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleImplTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleImplTest.java @@ -28,10 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.rometools.modules.content.ContentItem; -import com.rometools.modules.content.ContentModule; -import com.rometools.modules.content.ContentModuleImpl; - public class ContentModuleImplTest extends TestCase { private static final Logger LOG = LoggerFactory.getLogger(ContentModuleImplTest.class); diff --git a/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleParserTest.java b/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleParserTest.java index d23fc8fc8..44bde69dc 100644 --- a/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/content/ContentModuleParserTest.java @@ -23,8 +23,6 @@ import java.util.List; import com.rometools.modules.AbstractTestCase; -import com.rometools.modules.content.ContentItem; -import com.rometools.modules.content.ContentModule; import com.rometools.rome.feed.synd.SyndEntry; import com.rometools.rome.feed.synd.SyndFeed; import com.rometools.rome.io.SyndFeedInput; @@ -56,7 +54,7 @@ public static junit.framework.Test suite() { public void testParse() throws Exception { final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("xml/test-rdf.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("xml/test-rdf.xml")))); final SyndEntry entry = feed.getEntries().get(0); final ContentModule module = (ContentModule) entry.getModule(ContentModule.URI); final List items = module.getContentItems(); diff --git a/rome-modules/src/test/java/com/rometools/modules/feedpress/FeedpressGeneratorTest.java b/rome-modules/src/test/java/com/rometools/modules/feedpress/FeedpressGeneratorTest.java index 889af63d4..9973d685b 100644 --- a/rome-modules/src/test/java/com/rometools/modules/feedpress/FeedpressGeneratorTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/feedpress/FeedpressGeneratorTest.java @@ -39,7 +39,7 @@ public void testGenerateRss() throws Exception { log.debug("testGenerateRss"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("feedpress/rss.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("feedpress/rss.xml")))); feed.getModule(FeedpressModule.URI); final SyndFeedOutput output = new SyndFeedOutput(); final StringWriter writer = new StringWriter(); @@ -61,7 +61,7 @@ public void testGenerateAtom() throws Exception { log.debug("testGenerateAtom"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("feedpress/atom.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("feedpress/atom.xml")))); feed.getModule(FeedpressModule.URI); final SyndFeedOutput output = new SyndFeedOutput(); final StringWriter writer = new StringWriter(); diff --git a/rome-modules/src/test/java/com/rometools/modules/feedpress/FeedpressParserTest.java b/rome-modules/src/test/java/com/rometools/modules/feedpress/FeedpressParserTest.java index db3c743d4..df46d8fd8 100644 --- a/rome-modules/src/test/java/com/rometools/modules/feedpress/FeedpressParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/feedpress/FeedpressParserTest.java @@ -37,7 +37,7 @@ public void testParseRss() throws Exception { log.debug("testParseRss"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("feedpress/rss.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("feedpress/rss.xml")))); final FeedpressModule feedpress = (FeedpressModule) feed.getModule(FeedpressModule.URI); assertNotNull(feedpress); @@ -52,7 +52,7 @@ public void testParseAtom() throws Exception { log.debug("testParseAtom"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("feedpress/atom.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("feedpress/atom.xml")))); final FeedpressModule feedpress = (FeedpressModule) feed.getModule(FeedpressModule.URI); assertNotNull(feedpress); diff --git a/rome-modules/src/test/java/com/rometools/modules/fyyd/FyydGeneratorTest.java b/rome-modules/src/test/java/com/rometools/modules/fyyd/FyydGeneratorTest.java index 8b2fb7158..172db7d51 100644 --- a/rome-modules/src/test/java/com/rometools/modules/fyyd/FyydGeneratorTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/fyyd/FyydGeneratorTest.java @@ -39,7 +39,7 @@ public void testGenerateRss() throws Exception { log.debug("testGenerateRss"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("fyyd/rss.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("fyyd/rss.xml")))); feed.getModule(FyydModule.URI); final SyndFeedOutput output = new SyndFeedOutput(); final StringWriter writer = new StringWriter(); @@ -58,7 +58,7 @@ public void testGenerateAtom() throws Exception { log.debug("testGenerateAtom"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("fyyd/atom.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("fyyd/atom.xml")))); feed.getModule(FyydModule.URI); final SyndFeedOutput output = new SyndFeedOutput(); final StringWriter writer = new StringWriter(); diff --git a/rome-modules/src/test/java/com/rometools/modules/fyyd/FyydParserTest.java b/rome-modules/src/test/java/com/rometools/modules/fyyd/FyydParserTest.java index d5888ffe6..bea956acd 100644 --- a/rome-modules/src/test/java/com/rometools/modules/fyyd/FyydParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/fyyd/FyydParserTest.java @@ -37,7 +37,7 @@ public void testParseRss() throws Exception { log.debug("testParseRss"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("fyyd/rss.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("fyyd/rss.xml")))); final FyydModule fyyd = (FyydModule) feed.getModule(FyydModule.URI); assertNotNull(fyyd); @@ -49,7 +49,7 @@ public void testParseAtom() throws Exception { log.debug("testParseAtom"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("fyyd/atom.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("fyyd/atom.xml")))); final FyydModule fyyd = (FyydModule) feed.getModule(FyydModule.URI); assertNotNull(fyyd); diff --git a/rome-modules/src/test/java/com/rometools/modules/itunes/ITunesGeneratorTest.java b/rome-modules/src/test/java/com/rometools/modules/itunes/ITunesGeneratorTest.java index 8ed7d7258..ce025ae41 100644 --- a/rome-modules/src/test/java/com/rometools/modules/itunes/ITunesGeneratorTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/itunes/ITunesGeneratorTest.java @@ -64,13 +64,13 @@ public void testEndToEnd() throws Exception { private void testFile(final String filename) throws Exception { final File feed = new File(getTestFile(filename)); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL())); + final SyndFeed syndfeed = input.build(new XmlReader(feed)); final SyndFeedOutput output = new SyndFeedOutput(); final File outfeed = new File(feed.getAbsolutePath() + ".output"); output.output(syndfeed, outfeed); - final SyndFeed syndCheck = input.build(new XmlReader(outfeed.toURI().toURL())); + final SyndFeed syndCheck = input.build(new XmlReader(outfeed)); LOG.debug(syndCheck.getModule(AbstractITunesObject.URI).toString()); assertEquals("Feed Level: ", syndfeed.getModule(AbstractITunesObject.URI).toString(), syndCheck.getModule(AbstractITunesObject.URI).toString()); diff --git a/rome-modules/src/test/java/com/rometools/modules/itunes/ITunesParserTest.java b/rome-modules/src/test/java/com/rometools/modules/itunes/ITunesParserTest.java index f48e0ae4a..87aa06f03 100644 --- a/rome-modules/src/test/java/com/rometools/modules/itunes/ITunesParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/itunes/ITunesParserTest.java @@ -20,7 +20,6 @@ package com.rometools.modules.itunes; import java.io.File; -import java.net.URI; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -32,11 +31,7 @@ import org.slf4j.LoggerFactory; import com.rometools.modules.AbstractTestCase; -import com.rometools.modules.itunes.AbstractITunesObject; -import com.rometools.modules.itunes.EntryInformationImpl; -import com.rometools.modules.itunes.FeedInformationImpl; import com.rometools.modules.itunes.io.ITunesGenerator; -import com.rometools.modules.itunes.types.Duration; import com.rometools.rome.feed.module.Module; import com.rometools.rome.feed.synd.SyndEntry; import com.rometools.rome.feed.synd.SyndFeed; @@ -80,7 +75,7 @@ public void testGetNamespaceUri() { public void testParse() throws Exception { File feed = new File(getTestFile("itunes/leshow.xml")); final SyndFeedInput input = new SyndFeedInput(); - SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL())); + SyndFeed syndfeed = input.build(new XmlReader(feed)); final Module module = syndfeed.getModule(AbstractITunesObject.URI); final FeedInformationImpl feedInfo = (FeedInformationImpl) module; @@ -114,7 +109,7 @@ public void testParse() throws Exception { } feed = new File(getTestFile("xml/rsr.xml")); - syndfeed = input.build(new XmlReader(feed.toURI().toURL())); + syndfeed = input.build(new XmlReader(feed)); entries = syndfeed.getEntries(); it = entries.iterator(); @@ -131,7 +126,7 @@ public void testParse() throws Exception { public void testParseItem() throws Exception { File feed = new File(getTestFile("xml/leshow.xml")); final SyndFeedInput input = new SyndFeedInput(); - SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL())); + SyndFeed syndfeed = input.build(new XmlReader(feed)); SyndEntry entry = syndfeed.getEntries().get(0); @@ -153,7 +148,8 @@ public void testParseItem() throws Exception { } public void testDuration() throws Exception { - SyndFeed feed = new SyndFeedInput().build(new XmlReader(getClass().getResource("duration.xml"))); + final File feedFile = new File(getTestFile("com/rometools/modules/itunes/duration.xml")); + SyndFeed feed = new SyndFeedInput().build(new XmlReader(feedFile)); SyndEntry entry = feed.getEntries().get(0); EntryInformationImpl module = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI); @@ -161,7 +157,8 @@ public void testDuration() throws Exception { } public void testDurationEmpty() throws Exception { - SyndFeed feed = new SyndFeedInput().build(new XmlReader(getClass().getResource("duration-empty.xml"))); + final File feedFile = new File(getTestFile("com/rometools/modules/itunes/duration-empty.xml")); + SyndFeed feed = new SyndFeedInput().build(new XmlReader(feedFile)); SyndEntry entry = feed.getEntries().get(0); EntryInformationImpl module = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI); @@ -169,7 +166,8 @@ public void testDurationEmpty() throws Exception { } public void testDurationBad() throws Exception { - SyndFeed feed = new SyndFeedInput().build(new XmlReader(getClass().getResource("duration-bad.xml"))); + final File feedFile = new File(getTestFile("com/rometools/modules/itunes/duration-bad.xml")); + SyndFeed feed = new SyndFeedInput().build(new XmlReader(feedFile)); SyndEntry entry = feed.getEntries().get(0); EntryInformationImpl module = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI); @@ -178,11 +176,12 @@ public void testDurationBad() throws Exception { public void testExplicitnessTrue() throws Exception { ArrayList xmlFiles = new ArrayList(); - xmlFiles.add("explicitness-capital-yes.xml"); - xmlFiles.add("explicitness-yes.xml"); + xmlFiles.add("com/rometools/modules/itunes/explicitness-capital-yes.xml"); + xmlFiles.add("com/rometools/modules/itunes/explicitness-yes.xml"); for (String xml : xmlFiles) { - SyndFeed feed = new SyndFeedInput().build(new XmlReader(getClass().getResource(xml))); + final File feedFile = new File(getTestFile(xml)); + SyndFeed feed = new SyndFeedInput().build(new XmlReader(feedFile)); FeedInformationImpl module = (FeedInformationImpl) feed.getModule(AbstractITunesObject.URI); assertTrue(module.getExplicitNullable()); @@ -191,11 +190,12 @@ public void testExplicitnessTrue() throws Exception { public void testExplicitnessFalse() throws Exception { ArrayList xmlFiles = new ArrayList(); - xmlFiles.add("explicitness-no.xml"); - xmlFiles.add("explicitness-clean.xml"); + xmlFiles.add("com/rometools/modules/itunes/explicitness-no.xml"); + xmlFiles.add("com/rometools/modules/itunes/explicitness-clean.xml"); for (String xml : xmlFiles) { - SyndFeed feed = new SyndFeedInput().build(new XmlReader(getClass().getResource(xml))); + final File feedFile = new File(getTestFile(xml)); + SyndFeed feed = new SyndFeedInput().build(new XmlReader(feedFile)); FeedInformationImpl module = (FeedInformationImpl) feed.getModule(AbstractITunesObject.URI); assertFalse(module.getExplicitNullable()); @@ -205,7 +205,7 @@ public void testExplicitnessFalse() throws Exception { public void testParseNonHttpUris() throws Exception { File feed = new File(getTestFile("itunes/no-http-uris.xml")); final SyndFeedInput input = new SyndFeedInput(); - SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL())); + SyndFeed syndfeed = input.build(new XmlReader(feed)); final FeedInformationImpl feedInfo = (FeedInformationImpl) syndfeed.getModule(AbstractITunesObject.URI); diff --git a/rome-modules/src/test/java/com/rometools/modules/itunes/types/DurationTest.java b/rome-modules/src/test/java/com/rometools/modules/itunes/types/DurationTest.java index 9a28bbdc4..dade80e90 100644 --- a/rome-modules/src/test/java/com/rometools/modules/itunes/types/DurationTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/itunes/types/DurationTest.java @@ -22,8 +22,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.rometools.modules.itunes.types.Duration; - public class DurationTest extends TestCase { private static final Logger LOG = LoggerFactory.getLogger(DurationTest.class); diff --git a/rome-modules/src/test/java/com/rometools/modules/mediarss/GoogleTest.java b/rome-modules/src/test/java/com/rometools/modules/mediarss/GoogleTest.java index 2b31477ef..86ba0aa6f 100644 --- a/rome-modules/src/test/java/com/rometools/modules/mediarss/GoogleTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/mediarss/GoogleTest.java @@ -27,8 +27,6 @@ import junit.framework.TestSuite; import com.rometools.modules.AbstractTestCase; -import com.rometools.modules.mediarss.MediaEntryModule; -import com.rometools.modules.mediarss.MediaModule; import com.rometools.rome.feed.synd.SyndEntry; import com.rometools.rome.feed.synd.SyndFeed; import com.rometools.rome.io.SyndFeedInput; diff --git a/rome-modules/src/test/java/com/rometools/modules/mediarss/io/MediaModuleParserTest.java b/rome-modules/src/test/java/com/rometools/modules/mediarss/io/MediaModuleParserTest.java index c87b77d0c..260b55f2b 100644 --- a/rome-modules/src/test/java/com/rometools/modules/mediarss/io/MediaModuleParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/mediarss/io/MediaModuleParserTest.java @@ -21,7 +21,7 @@ import java.math.BigDecimal; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; public class MediaModuleParserTest extends AbstractTestCase { diff --git a/rome-modules/src/test/java/com/rometools/modules/mediarss/types/TimeTest.java b/rome-modules/src/test/java/com/rometools/modules/mediarss/types/TimeTest.java index 4ce4314c5..147e8362b 100644 --- a/rome-modules/src/test/java/com/rometools/modules/mediarss/types/TimeTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/mediarss/types/TimeTest.java @@ -28,8 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.rometools.modules.mediarss.types.Time; - public class TimeTest extends TestCase { private static final Logger LOG = LoggerFactory.getLogger(TimeTest.class); diff --git a/rome-modules/src/test/java/com/rometools/modules/opensearch/OpenSearchModuleTest.java b/rome-modules/src/test/java/com/rometools/modules/opensearch/OpenSearchModuleTest.java index 5fb3d9940..8ab2333d1 100644 --- a/rome-modules/src/test/java/com/rometools/modules/opensearch/OpenSearchModuleTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/opensearch/OpenSearchModuleTest.java @@ -26,7 +26,6 @@ import junit.framework.TestSuite; import com.rometools.modules.AbstractTestCase; -import com.rometools.modules.opensearch.OpenSearchModule; import com.rometools.rome.feed.module.Module; import com.rometools.rome.feed.synd.SyndFeed; import com.rometools.rome.io.SyndFeedInput; diff --git a/rome-modules/src/test/java/com/rometools/modules/psc/PodloveSimpleChapterGeneratorTest.java b/rome-modules/src/test/java/com/rometools/modules/psc/PodloveSimpleChapterGeneratorTest.java index ce721af45..cddb4db21 100644 --- a/rome-modules/src/test/java/com/rometools/modules/psc/PodloveSimpleChapterGeneratorTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/psc/PodloveSimpleChapterGeneratorTest.java @@ -40,7 +40,7 @@ public void testGenerateRss() throws Exception { log.debug("testGenerateRss"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/rss.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/rss.xml")))); final SyndEntry entry = feed.getEntries().get(0); entry.getModule(PodloveSimpleChapterModule.URI); final SyndFeedOutput output = new SyndFeedOutput(); @@ -60,7 +60,7 @@ public void testGenerateAtom() throws Exception { log.debug("testGenerateAtom"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/atom.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/atom.xml")))); final SyndEntry entry = feed.getEntries().get(0); entry.getModule(PodloveSimpleChapterModule.URI); final SyndFeedOutput output = new SyndFeedOutput(); diff --git a/rome-modules/src/test/java/com/rometools/modules/psc/PodloveSimpleChapterParserTest.java b/rome-modules/src/test/java/com/rometools/modules/psc/PodloveSimpleChapterParserTest.java index 7f2d399af..f34bbe966 100644 --- a/rome-modules/src/test/java/com/rometools/modules/psc/PodloveSimpleChapterParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/psc/PodloveSimpleChapterParserTest.java @@ -39,7 +39,7 @@ public void testParseRss() throws Exception { log.debug("testParseRss"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/rss.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/rss.xml")))); final SyndEntry entry = feed.getEntries().get(0); final PodloveSimpleChapterModule simpleChapters = (PodloveSimpleChapterModule) entry.getModule(PodloveSimpleChapterModule.URI); @@ -57,7 +57,7 @@ public void testParseAtom() throws Exception { log.debug("testParseAtom"); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/atom.xml")).toURI().toURL())); + final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/atom.xml")))); final SyndEntry entry = feed.getEntries().get(0); final PodloveSimpleChapterModule simpleChapters = (PodloveSimpleChapterModule) entry.getModule(PodloveSimpleChapterModule.URI); diff --git a/rome-modules/src/test/java/com/rometools/modules/sle/GroupAndSortTest.java b/rome-modules/src/test/java/com/rometools/modules/sle/GroupAndSortTest.java index 516cfdc7b..2c5076ad7 100644 --- a/rome-modules/src/test/java/com/rometools/modules/sle/GroupAndSortTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/sle/GroupAndSortTest.java @@ -26,8 +26,6 @@ import org.slf4j.LoggerFactory; import com.rometools.modules.AbstractTestCase; -import com.rometools.modules.sle.SimpleListExtension; -import com.rometools.modules.sle.SleUtility; import com.rometools.modules.sle.types.Sort; import com.rometools.rome.feed.module.Extendable; import com.rometools.rome.feed.synd.SyndEntry; diff --git a/rome-modules/src/test/java/com/rometools/modules/sse/SSEParserTest.java b/rome-modules/src/test/java/com/rometools/modules/sse/SSEParserTest.java index 6f4f8fbc5..9c81d5e43 100644 --- a/rome-modules/src/test/java/com/rometools/modules/sse/SSEParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/sse/SSEParserTest.java @@ -20,7 +20,6 @@ package com.rometools.modules.sse; import java.io.File; -import java.net.URL; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; @@ -37,7 +36,6 @@ import org.jdom2.input.SAXBuilder; import com.rometools.modules.AbstractTestCase; -import com.rometools.modules.sse.SSE091Generator; import com.rometools.modules.sse.modules.Conflict; import com.rometools.modules.sse.modules.History; import com.rometools.modules.sse.modules.SSEModule; @@ -78,7 +76,7 @@ public void testGetNamespaceUri() { } public void xtestParseGenerateV5() throws Exception { - final URL feedURL = new File(getTestFile("xml/v/v5.xml")).toURI().toURL(); + final File feedURL = new File(getTestFile("xml/v/v5.xml")); // parse the document for comparison final SAXBuilder builder = new SAXBuilder(); final Document directlyBuilt = builder.build(feedURL); @@ -240,7 +238,7 @@ private void asserEqualContent(final Element one, final Element two) { public void xtestV5() throws Exception { final File feed = new File(getTestFile("xml/v/v5.xml")); final SyndFeedInput input = new SyndFeedInput(); - final SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL())); + final SyndFeed syndfeed = input.build(new XmlReader(feed)); final List entries = syndfeed.getEntries(); final Iterator it = entries.iterator(); diff --git a/rome-modules/src/test/java/com/rometools/modules/yahooweather/io/WeatherModuleParserTest.java b/rome-modules/src/test/java/com/rometools/modules/yahooweather/io/WeatherModuleParserTest.java index a4bb743c0..47d9d36bc 100644 --- a/rome-modules/src/test/java/com/rometools/modules/yahooweather/io/WeatherModuleParserTest.java +++ b/rome-modules/src/test/java/com/rometools/modules/yahooweather/io/WeatherModuleParserTest.java @@ -34,7 +34,6 @@ import com.rometools.modules.yahooweather.YWeatherEntryModule; import com.rometools.modules.yahooweather.YWeatherModule; import com.rometools.modules.yahooweather.YWeatherModuleImpl; -import com.rometools.modules.yahooweather.io.WeatherModuleParser; import com.rometools.rome.feed.synd.SyndEntry; import com.rometools.rome.feed.synd.SyndFeed; import com.rometools.rome.io.SyndFeedInput; diff --git a/rome-opml/src/main/java/com/rometools/opml/feed/synd/impl/ConverterForOPML10.java b/rome-opml/src/main/java/com/rometools/opml/feed/synd/impl/ConverterForOPML10.java index b482d7e4b..75132b6e0 100644 --- a/rome-opml/src/main/java/com/rometools/opml/feed/synd/impl/ConverterForOPML10.java +++ b/rome-opml/src/main/java/com/rometools/opml/feed/synd/impl/ConverterForOPML10.java @@ -174,7 +174,7 @@ protected SyndEntry createEntry(final Stack context, final List T firstNotNull(final T... objects) { - for (final T object : objects) { - if (object != null) { - return object; - } - } - return null; + return Stream.of(objects) + .filter(Objects::nonNull) + .findFirst() + .orElse(null); } } diff --git a/rome-utils/src/test/java/com/rometools/utils/AlternativesTest.java b/rome-utils/src/test/java/com/rometools/utils/AlternativesTest.java index d609b5d05..29080b733 100644 --- a/rome-utils/src/test/java/com/rometools/utils/AlternativesTest.java +++ b/rome-utils/src/test/java/com/rometools/utils/AlternativesTest.java @@ -16,7 +16,7 @@ import static org.hamcrest.core.Is.is; import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test; diff --git a/rome-utils/src/test/java/com/rometools/utils/DatesTest.java b/rome-utils/src/test/java/com/rometools/utils/DatesTest.java index b2a79dc05..1dbb676f3 100644 --- a/rome-utils/src/test/java/com/rometools/utils/DatesTest.java +++ b/rome-utils/src/test/java/com/rometools/utils/DatesTest.java @@ -17,7 +17,7 @@ import static org.hamcrest.core.Is.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.util.Date; diff --git a/rome-utils/src/test/java/com/rometools/utils/ListsTest.java b/rome-utils/src/test/java/com/rometools/utils/ListsTest.java index 2ee475d68..c89bb9a73 100644 --- a/rome-utils/src/test/java/com/rometools/utils/ListsTest.java +++ b/rome-utils/src/test/java/com/rometools/utils/ListsTest.java @@ -18,7 +18,7 @@ import static org.hamcrest.core.Is.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.util.ArrayList; import java.util.Arrays; diff --git a/rome-utils/src/test/java/com/rometools/utils/StringsTest.java b/rome-utils/src/test/java/com/rometools/utils/StringsTest.java index 7d3acd08e..af3cd249a 100644 --- a/rome-utils/src/test/java/com/rometools/utils/StringsTest.java +++ b/rome-utils/src/test/java/com/rometools/utils/StringsTest.java @@ -16,7 +16,7 @@ import static org.hamcrest.core.Is.is; import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test; diff --git a/rome/src/main/java/com/rometools/rome/feed/atom/Person.java b/rome/src/main/java/com/rometools/rome/feed/atom/Person.java index 91974d9c2..04d5496aa 100644 --- a/rome/src/main/java/com/rometools/rome/feed/atom/Person.java +++ b/rome/src/main/java/com/rometools/rome/feed/atom/Person.java @@ -23,7 +23,6 @@ import com.rometools.rome.feed.impl.CloneableBean; import com.rometools.rome.feed.impl.EqualsBean; import com.rometools.rome.feed.impl.ToStringBean; -import com.rometools.rome.feed.module.Extendable; import com.rometools.rome.feed.module.Module; import com.rometools.rome.feed.module.impl.ModuleUtils; import com.rometools.rome.feed.synd.SyndPerson; @@ -33,7 +32,7 @@ /** * Bean for person elements of Atom feeds. */ -public class Person implements SyndPerson, Cloneable, Serializable, Extendable { +public class Person implements SyndPerson, Serializable { private static final long serialVersionUID = 1L; diff --git a/rome/src/main/java/com/rometools/rome/feed/impl/CloneableBean.java b/rome/src/main/java/com/rometools/rome/feed/impl/CloneableBean.java index 24de3131c..6ec1d5974 100644 --- a/rome/src/main/java/com/rometools/rome/feed/impl/CloneableBean.java +++ b/rome/src/main/java/com/rometools/rome/feed/impl/CloneableBean.java @@ -17,6 +17,7 @@ package com.rometools.rome.feed.impl; import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; @@ -79,7 +80,7 @@ public static Object beanClone(Object obj, Set ignoreProperties) throws try { - final Object clonedBean = clazz.newInstance(); + final Object clonedBean = clazz.getDeclaredConstructor().newInstance(); final List propertyDescriptors = BeanIntrospector.getPropertyDescriptorsWithGettersAndSetters(clazz); for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) { @@ -162,7 +163,8 @@ private static Collection cloneCollection(final Collection collection) } private static , E> Collection newCollection(Class type) - throws InstantiationException, IllegalAccessException { + throws InstantiationException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException, NoSuchMethodException, SecurityException { Collection collection; if (SortedSet.class.isAssignableFrom(type)) { collection = new TreeSet(); @@ -171,7 +173,7 @@ private static , E> Collection newCollection(Class } else if (List.class.isAssignableFrom(type)) { collection = new ArrayList(); } else { - collection = type.newInstance(); + collection = type.getDeclaredConstructor().newInstance(); } return collection; } diff --git a/rome/src/main/java/com/rometools/rome/feed/impl/CopyFromHelper.java b/rome/src/main/java/com/rometools/rome/feed/impl/CopyFromHelper.java index cbb1ffd1e..d78909fc6 100644 --- a/rome/src/main/java/com/rometools/rome/feed/impl/CopyFromHelper.java +++ b/rome/src/main/java/com/rometools/rome/feed/impl/CopyFromHelper.java @@ -97,7 +97,7 @@ private CopyFrom createInstance(final Class interfaceClass) if (baseImplMap.get(interfaceClass) == null) { return null; } else { - return (CopyFrom) baseImplMap.get(interfaceClass).newInstance(); + return (CopyFrom) baseImplMap.get(interfaceClass).getDeclaredConstructor().newInstance(); } } @@ -121,7 +121,7 @@ private T doCopy(T value, final Class baseInterface) throws Exception { final CopyFrom source = (CopyFrom) value; CopyFrom target = createInstance(source.getInterface()); if (target == null) { - target = (CopyFrom) value.getClass().newInstance(); + target = (CopyFrom) value.getClass().getDeclaredConstructor().newInstance(); } target.copyFrom(source); value = (T) target; diff --git a/rome/src/main/java/com/rometools/rome/feed/module/DCSubjectImpl.java b/rome/src/main/java/com/rometools/rome/feed/module/DCSubjectImpl.java index 1cea129c6..7f7811932 100644 --- a/rome/src/main/java/com/rometools/rome/feed/module/DCSubjectImpl.java +++ b/rome/src/main/java/com/rometools/rome/feed/module/DCSubjectImpl.java @@ -33,7 +33,7 @@ * * @see Dublin Core module. */ -public class DCSubjectImpl implements Cloneable, Serializable, DCSubject { +public class DCSubjectImpl implements Serializable, DCSubject { private static final long serialVersionUID = 1L; private static final CopyFromHelper COPY_FROM_HELPER; diff --git a/rome/src/main/java/com/rometools/rome/feed/module/ModuleImpl.java b/rome/src/main/java/com/rometools/rome/feed/module/ModuleImpl.java index b40bacfba..49d33a4d8 100644 --- a/rome/src/main/java/com/rometools/rome/feed/module/ModuleImpl.java +++ b/rome/src/main/java/com/rometools/rome/feed/module/ModuleImpl.java @@ -16,7 +16,6 @@ */ package com.rometools.rome.feed.module; -import java.io.Serializable; import java.util.Collections; import com.rometools.rome.feed.impl.CloneableBean; @@ -27,7 +26,7 @@ * Base class for modules describing Metadata of feeds, default implementations. Examples of such * modules are the Dublin Core and Syndication modules. */ -public abstract class ModuleImpl implements Cloneable, Serializable, Module { +public abstract class ModuleImpl implements Module { private static final long serialVersionUID = 1L; private final Class beanClass; private final String uri; diff --git a/rome/src/main/java/com/rometools/rome/io/XmlReader.java b/rome/src/main/java/com/rometools/rome/io/XmlReader.java index 2f15fb008..036f14d86 100644 --- a/rome/src/main/java/com/rometools/rome/io/XmlReader.java +++ b/rome/src/main/java/com/rometools/rome/io/XmlReader.java @@ -287,7 +287,6 @@ public XmlReader(final URLConnection conn, final Map requestHead defaultEncoding = staticDefaultEncoding; final boolean lenient = true; if (conn instanceof HttpURLConnection) { - final Package pckg = this.getClass().getPackage(); setRequestHeader(conn, requestHeaders); try { doHttpStream(conn.getInputStream(), conn.getContentType(), lenient); diff --git a/rome/src/main/java/com/rometools/rome/io/impl/NumberParser.java b/rome/src/main/java/com/rometools/rome/io/impl/NumberParser.java index 10bf3a2df..7e7b9b7d1 100644 --- a/rome/src/main/java/com/rometools/rome/io/impl/NumberParser.java +++ b/rome/src/main/java/com/rometools/rome/io/impl/NumberParser.java @@ -42,7 +42,7 @@ private NumberParser() { public static Long parseLong(final String str) { if (null != str) { try { - return new Long(Long.parseLong(str.trim())); + return Long.valueOf(str.trim()); } catch (final Exception e) { // :IGNORE: } @@ -60,7 +60,7 @@ public static Long parseLong(final String str) { public static Integer parseInt(final String str) { if (null != str) { try { - return new Integer(Integer.parseInt(str.trim())); + return Integer.valueOf(str.trim()); } catch (final Exception e) { // :IGNORE: } @@ -78,7 +78,7 @@ public static Integer parseInt(final String str) { public static Float parseFloat(final String str) { if (null != str) { try { - return new Float(Float.parseFloat(str.trim())); + return Float.valueOf(str.trim()); } catch (final Exception e) { // :IGNORE: } diff --git a/rome/src/main/java/com/rometools/rome/io/impl/PluginManager.java b/rome/src/main/java/com/rometools/rome/io/impl/PluginManager.java index 95ad302e7..16bd86099 100644 --- a/rome/src/main/java/com/rometools/rome/io/impl/PluginManager.java +++ b/rome/src/main/java/com/rometools/rome/io/impl/PluginManager.java @@ -92,7 +92,7 @@ private void loadPlugins() { for (final Class clazz : classes) { className = clazz.getName(); - final T plugin = clazz.newInstance(); + final T plugin = clazz.getDeclaredConstructor().newInstance(); if (plugin instanceof DelegatingModuleParser) { ((DelegatingModuleParser) plugin).setFeedParser(parentParser); diff --git a/rome/src/main/java/com/rometools/rome/io/impl/RSS091UserlandParser.java b/rome/src/main/java/com/rometools/rome/io/impl/RSS091UserlandParser.java index ab358ba16..1593d79e4 100644 --- a/rome/src/main/java/com/rometools/rome/io/impl/RSS091UserlandParser.java +++ b/rome/src/main/java/com/rometools/rome/io/impl/RSS091UserlandParser.java @@ -128,7 +128,7 @@ protected WireFeed parseChannel(final Element rssRoot, final Locale locale) { final List skipHours = new ArrayList(); final List eHours = eSkipHours.getChildren("hour", getRSSNamespace()); for (final Element eHour : eHours) { - skipHours.add(new Integer(eHour.getText().trim())); + skipHours.add(Integer.valueOf(eHour.getText().trim())); } channel.setSkipHours(skipHours); } diff --git a/rome/src/test/java/com/rometools/rome/io/XmlReaderTest.java b/rome/src/test/java/com/rometools/rome/io/XmlReaderTest.java index a0c08f7c8..3aa9dd960 100644 --- a/rome/src/test/java/com/rometools/rome/io/XmlReaderTest.java +++ b/rome/src/test/java/com/rometools/rome/io/XmlReaderTest.java @@ -22,9 +22,9 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import org.junit.Rule; +import org.junit.Assert; import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.function.ThrowingRunnable; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -45,9 +45,6 @@ public class XmlReaderTest { private static final String XML2 = "xml-prolog"; private static final String XML1 = "xml"; - @Rule - public ExpectedException expectedException = ExpectedException.none(); - public static void main(final String[] args) throws Exception { final XmlReaderTest test = new XmlReaderTest(); test.testRawBom(); @@ -258,8 +255,7 @@ protected void testHttpInvalid(final String cT, final String bomEnc, final Strin } else { is = getXmlStream(bomEnc, XML3, streamEnc, prologEnc); } - try { - new XmlReader(is, cT, false); + try (XmlReader xr = new XmlReader(is, cT, false);) { fail("It should have failed for HTTP Content-type " + cT + ", BOM " + bomEnc + ", streamEnc " + streamEnc + " and prologEnc " + prologEnc); } catch (final IOException ex) { assertTrue(ex.getMessage().indexOf("Invalid encoding,") > -1); @@ -433,9 +429,8 @@ public void testGetXmlProlog_DifferentAsciiIncompatible() throws IOException { final InputStream input = stringToStream("", "UTF-16BE"); final String guessedEncoding = "UTF-16LE"; - expectedException.expect(IOException.class); - - XmlReader.getXmlProlog(input, guessedEncoding); + final ThrowingRunnable tr = () -> XmlReader.getXmlProlog(input, guessedEncoding); + Assert.assertThrows(IOException.class, tr); } @Test @@ -443,9 +438,8 @@ public void testGetXmlProlog_NoClosingAngleBracket() throws IOException { final InputStream input = stringToStream(" XmlReader.getXmlProlog(input, guessedEncoding); + Assert.assertThrows(IOException.class, tr); } @Test @@ -453,9 +447,8 @@ public void testGetXmlProlog_Empty() throws IOException { final InputStream input = stringToStream("", "UTF-8"); final String guessedEncoding = "UTF-8"; - expectedException.expect(IOException.class); - - XmlReader.getXmlProlog(input, guessedEncoding); + final ThrowingRunnable tr = () -> XmlReader.getXmlProlog(input, guessedEncoding); + Assert.assertThrows(IOException.class, tr); } @Test @@ -468,9 +461,8 @@ public void testGetXmlProlog_ClosingAngleBracketIsTooFar() throws IOException { final InputStream input = stringToStream("", "UTF-8"); final String guessedEncoding = "UTF-8"; - expectedException.expect(IOException.class); - - XmlReader.getXmlProlog(input, guessedEncoding); + final ThrowingRunnable tr = () -> XmlReader.getXmlProlog(input, guessedEncoding); + Assert.assertThrows(IOException.class, tr); } static InputStream stringToStream(String string, String encoding) { diff --git a/rome/src/test/java/com/rometools/rome/io/impl/NumberParserTest.java b/rome/src/test/java/com/rometools/rome/io/impl/NumberParserTest.java index ebb93ea05..02b8ed762 100644 --- a/rome/src/test/java/com/rometools/rome/io/impl/NumberParserTest.java +++ b/rome/src/test/java/com/rometools/rome/io/impl/NumberParserTest.java @@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; public class NumberParserTest { @@ -18,7 +17,7 @@ public void testLongParseFailure() { @Test public void testLongParseSuccess() { Long num = NumberParser.parseLong("1"); - assertEquals(new Long(1L), num); + assertEquals(Long.valueOf(1L), num); } @Test @@ -42,7 +41,7 @@ public void testIntParseFailure() { @Test public void testIntParseSuccess() { Integer num = NumberParser.parseInt("1"); - assertEquals(new Integer(1), num); + assertEquals(Integer.valueOf(1), num); } @Test @@ -54,7 +53,7 @@ public void testFloatParseFailure() { @Test public void testFloatParseSuccess() { Float num = NumberParser.parseFloat("1.0"); - assertEquals(new Float(1.0f), num); + assertEquals(Float.valueOf(1.0f), num); } @Test