diff --git a/api/pom.xml b/api/pom.xml index 18ea19b01..ae368594f 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -28,7 +28,7 @@ apache-any23-api Apache Any23 :: Base API - Any23 library external API. + Any23 library external API @@ -89,6 +89,16 @@ + + + com.github.spotbugs + spotbugs-maven-plugin + ${maven-spotbugs-plugin.version} + + UnreadFields,Naming,FindUnrelatedTypesInGenericContainer + + + diff --git a/api/src/main/java/org/apache/any23/configuration/DefaultConfiguration.java b/api/src/main/java/org/apache/any23/configuration/DefaultConfiguration.java index ce346b592..e83bbab61 100644 --- a/api/src/main/java/org/apache/any23/configuration/DefaultConfiguration.java +++ b/api/src/main/java/org/apache/any23/configuration/DefaultConfiguration.java @@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; +import java.io.InputStream; import java.util.Properties; /** @@ -74,8 +75,8 @@ public static synchronized ModifiableConfiguration copy() { private static Properties loadDefaultProperties() { final Properties properties = new Properties(); - try { - properties.load( DefaultConfiguration.class.getResourceAsStream(DEFAULT_CONFIG_FILE) ); + try(InputStream is = DefaultConfiguration.class.getResourceAsStream(DEFAULT_CONFIG_FILE)) { + properties.load(is); } catch (IOException ioe) { throw new IllegalStateException("Error while loading default configuration.", ioe); } @@ -129,9 +130,6 @@ public synchronized int getPropertyIntOrFail(String propertyName) { @Override public synchronized boolean getFlagProperty(final String propertyName) { final String value = getPropertyOrFail(propertyName); - if(value == null) { - return false; - } if(FLAG_PROPERTY_ON.equals(value)) { return true; } diff --git a/api/src/main/java/org/apache/any23/extractor/ExtractorFactory.java b/api/src/main/java/org/apache/any23/extractor/ExtractorFactory.java index 67464904f..3ed0f7abf 100644 --- a/api/src/main/java/org/apache/any23/extractor/ExtractorFactory.java +++ b/api/src/main/java/org/apache/any23/extractor/ExtractorFactory.java @@ -37,7 +37,7 @@ public interface ExtractorFactory> extends ExtractorDescr /** * Supports wildcards, e.g. "*/*" for blind extractors that merely call a web service. - * @return a {@link java.util.Collection} of supported mimetypes. + * @return a {@link java.util.Collection} of supported {@link org.apache.any23.mime.MIMEType}'s. */ Collection getSupportedMIMETypes(); diff --git a/api/src/main/java/org/apache/any23/extractor/ExtractorGroup.java b/api/src/main/java/org/apache/any23/extractor/ExtractorGroup.java index 4e77690ea..be6923f95 100644 --- a/api/src/main/java/org/apache/any23/extractor/ExtractorGroup.java +++ b/api/src/main/java/org/apache/any23/extractor/ExtractorGroup.java @@ -24,8 +24,8 @@ import java.util.Iterator; /** - * It simple models a group of {@link ExtractorFactory} providing - * simple accessing methods. + * Models a group of {@link ExtractorFactory} objcts providing + * simple accessor methods. */ public class ExtractorGroup implements Iterable> { diff --git a/api/src/main/java/org/apache/any23/vocab/HCard.java b/api/src/main/java/org/apache/any23/vocab/HCard.java index 75ba514f6..24e49e89f 100644 --- a/api/src/main/java/org/apache/any23/vocab/HCard.java +++ b/api/src/main/java/org/apache/any23/vocab/HCard.java @@ -40,7 +40,6 @@ public static HCard getInstance() { public IRI Address = createClass(NS, "Address"); public IRI Geo = createClass(NS, "Geo"); - public IRI name = createProperty(NS, "name"); public IRI honorific_prefix = createProperty(NS, "honorific-prefix"); public IRI given_name = createProperty(NS, "given-name"); diff --git a/api/src/main/java/org/apache/any23/vocab/HResume.java b/api/src/main/java/org/apache/any23/vocab/HResume.java index f8ee68e7d..6e3ce325f 100644 --- a/api/src/main/java/org/apache/any23/vocab/HResume.java +++ b/api/src/main/java/org/apache/any23/vocab/HResume.java @@ -42,7 +42,6 @@ public static HResume getInstance() { public IRI contact = createClass(NS, "contact"); public IRI affiliation = createClass(NS, "affiliation"); - public IRI name = createProperty(NS, "name"); public IRI summary = createProperty(NS, "summary"); public IRI skill = createProperty(NS, "skill"); diff --git a/api/src/main/java/org/apache/any23/vocab/OGP.java b/api/src/main/java/org/apache/any23/vocab/OGP.java index 5ee0e927f..9276555c5 100644 --- a/api/src/main/java/org/apache/any23/vocab/OGP.java +++ b/api/src/main/java/org/apache/any23/vocab/OGP.java @@ -172,11 +172,6 @@ public static OGP getInstance() { public final IRI audioType = createProperty(AUDIO__TYPE); public final IRI audioAlt = createProperty(AUDIO__ALT); - @SuppressWarnings("unused") - private IRI createClass(String localName) { - return createClass(NS, localName); - } - private IRI createProperty(String localName) { return createProperty(NS, localName); } diff --git a/api/src/main/java/org/apache/any23/vocab/OGPArticle.java b/api/src/main/java/org/apache/any23/vocab/OGPArticle.java index 0381bd470..d1ffb8b74 100644 --- a/api/src/main/java/org/apache/any23/vocab/OGPArticle.java +++ b/api/src/main/java/org/apache/any23/vocab/OGPArticle.java @@ -71,11 +71,6 @@ public static OGPArticle getInstance() { public final IRI articleSection = createProperty(ARTICLE__SECTION); public final IRI articleTag = createProperty(ARTICLE__TAG); - @SuppressWarnings("unused") - private IRI createClass(String localName) { - return createClass(NS, localName); - } - private IRI createProperty(String localName) { return createProperty(NS, localName); } diff --git a/api/src/main/java/org/apache/any23/vocab/OGPBook.java b/api/src/main/java/org/apache/any23/vocab/OGPBook.java index 2f2debc31..7f50ec564 100644 --- a/api/src/main/java/org/apache/any23/vocab/OGPBook.java +++ b/api/src/main/java/org/apache/any23/vocab/OGPBook.java @@ -63,11 +63,6 @@ public static OGPBook getInstance() { public final IRI bookReleaseDate = createProperty(BOOK__RELEASE_DATE); public final IRI bookTag = createProperty(BOOK__TAG); - @SuppressWarnings("unused") - private IRI createClass(String localName) { - return createClass(NS, localName); - } - private IRI createProperty(String localName) { return createProperty(NS, localName); } diff --git a/api/src/main/java/org/apache/any23/vocab/OGPMusic.java b/api/src/main/java/org/apache/any23/vocab/OGPMusic.java index 405b85eb3..ae2ceb19a 100644 --- a/api/src/main/java/org/apache/any23/vocab/OGPMusic.java +++ b/api/src/main/java/org/apache/any23/vocab/OGPMusic.java @@ -99,11 +99,6 @@ public static OGPMusic getInstance() { public final IRI musicCreator = createProperty(MUSIC__CREATOR); - @SuppressWarnings("unused") - private IRI createClass(String localName) { - return createClass(NS, localName); - } - private IRI createProperty(String localName) { return createProperty(NS, localName); } diff --git a/api/src/main/java/org/apache/any23/vocab/OGPProfile.java b/api/src/main/java/org/apache/any23/vocab/OGPProfile.java index 48b0b3be5..419c42a13 100644 --- a/api/src/main/java/org/apache/any23/vocab/OGPProfile.java +++ b/api/src/main/java/org/apache/any23/vocab/OGPProfile.java @@ -63,11 +63,6 @@ public static OGPProfile getInstance() { public final IRI profileUsername = createProperty(PROFILE__USERNAME); public final IRI profileGender = createProperty(PROFILE__GENDER); - @SuppressWarnings("unused") - private IRI createClass(String localName) { - return createClass(NS, localName); - } - private IRI createProperty(String localName) { return createProperty(NS, localName); } diff --git a/api/src/main/java/org/apache/any23/vocab/OGPVideo.java b/api/src/main/java/org/apache/any23/vocab/OGPVideo.java index 774c7fd9d..ee241cf7b 100644 --- a/api/src/main/java/org/apache/any23/vocab/OGPVideo.java +++ b/api/src/main/java/org/apache/any23/vocab/OGPVideo.java @@ -78,11 +78,6 @@ public static OGPVideo getInstance() { public final IRI videoTag = createProperty(VIDEO__TAG); public final IRI videoSeries = createProperty(VIDEO__SERIES); - @SuppressWarnings("unused") - private IRI createClass(String localName) { - return createClass(NS, localName); - } - private IRI createProperty(String localName) { return createProperty(NS, localName); } diff --git a/api/src/main/java/org/apache/any23/vocab/SINDICE.java b/api/src/main/java/org/apache/any23/vocab/SINDICE.java index 287f04cd3..76000c912 100644 --- a/api/src/main/java/org/apache/any23/vocab/SINDICE.java +++ b/api/src/main/java/org/apache/any23/vocab/SINDICE.java @@ -93,11 +93,6 @@ public static SINDICE getInstance() { */ public final IRI date = createProperty(DATE); - - private IRI createClass(String localName) { - return createClass(NS, localName); - } - private IRI createProperty(String localName) { return createProperty(NS, localName); } diff --git a/api/src/main/java/org/apache/any23/vocab/Vocabulary.java b/api/src/main/java/org/apache/any23/vocab/Vocabulary.java index 7e4de653d..b226d12a3 100644 --- a/api/src/main/java/org/apache/any23/vocab/Vocabulary.java +++ b/api/src/main/java/org/apache/any23/vocab/Vocabulary.java @@ -142,12 +142,12 @@ public IRI getProperty(String name, IRI defaultValue) { */ public IRI getPropertyCamelCase(String property) { String[] names = property.split("\\W"); - String camelCase = names[0]; + StringBuilder camelCase = new StringBuilder(property.length()).append(names[0]); for (int i = 1; i < names.length; i++) { String tmp = names[i]; - camelCase += tmp.replaceFirst("(.)", tmp.substring(0, 1).toUpperCase(java.util.Locale.ROOT)); + camelCase.append(tmp.replaceFirst("(.)", tmp.substring(0, 1).toUpperCase(java.util.Locale.ROOT))); } - return getProperty(camelCase); + return getProperty(camelCase.toString()); } /** diff --git a/pom.xml b/pom.xml index 577b5fdc7..9b1cce0be 100644 --- a/pom.xml +++ b/pom.xml @@ -311,7 +311,7 @@ 1.6 3.2.3 3.2.1 - 3.1.12.2 + 3.1.12.2 2.6