Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

ANY23-445 Review spotbugs issues #151

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 3 additions & 4 deletions api/src/main/java/org/apache/any23/vocab/HCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ public static HCard getInstance() {
return instance;
}

public IRI Card = createClass(NS, "Card");
public IRI Address = createClass(NS, "Address");
public IRI Geo = createClass(NS, "Geo");

public IRI card = createClass(NS, "Card");
public IRI address = createClass(NS, "Address");
public IRI _Geo = createClass(NS, "Geo");
lewismc marked this conversation as resolved.
Show resolved Hide resolved

public IRI name = createProperty(NS, "name");
public IRI honorific_prefix = createProperty(NS, "honorific-prefix");
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/java/org/apache/any23/vocab/HEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static HEntry getInstance() {
return instance;
}

public IRI Entry = createClass(NS, "Entry");
public IRI entry = createClass(NS, "Entry");
lewismc marked this conversation as resolved.
Show resolved Hide resolved
public IRI author = createClass(NS, "author");
public IRI location = createClass(NS, "location");

Expand All @@ -51,7 +51,7 @@ public static HEntry getInstance() {
public IRI url = createProperty(NS, "url");
public IRI uid = createProperty(NS, "uid");
public IRI syndication = createProperty(NS, "syndication");
public IRI in_reply_to = createProperty(NS, "in-reply-to");
public IRI inReplyTo = createProperty(NS, "in-reply-to");
lewismc marked this conversation as resolved.
Show resolved Hide resolved

private HEntry() {
super(NS);
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/org/apache/any23/vocab/HItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static HItem getInstance() {
return instance;
}

public IRI Item = createClass(NS, "Item");
public IRI item = createClass(NS, "Item");
lewismc marked this conversation as resolved.
Show resolved Hide resolved
public IRI name = createProperty(NS, "name");
public IRI url = createProperty(NS, "url");
public IRI photo = createProperty(NS, "photo");
Expand Down
8 changes: 4 additions & 4 deletions api/src/main/java/org/apache/any23/vocab/HRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public static HRecipe getInstance() {
}

// Resources.
public IRI Recipe = createClass(NS, "Recipe");
public IRI Duration = createClass(NS, "Duration");
public IRI Ingredient = createClass(NS, "Ingredient");
public IRI Nutrition = createClass(NS, "Nutrition");
public IRI recipe = createClass(NS, "Recipe");
public IRI _Duration = createClass(NS, "Duration");
public IRI _Ingredient = createClass(NS, "Ingredient");
public IRI _Nutrition = createClass(NS, "Nutrition");
lewismc marked this conversation as resolved.
Show resolved Hide resolved

// Properties.
public IRI fn = createProperty(NS, "fn");
Expand Down
3 changes: 1 addition & 2 deletions api/src/main/java/org/apache/any23/vocab/HResume.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ public static HResume getInstance() {
return instance;
}

public IRI Resume = createClass(NS, "Resume");
public IRI resume = createClass(NS, "Resume");
lewismc marked this conversation as resolved.
Show resolved Hide resolved
public IRI education = createClass(NS, "education");
public IRI experience = createClass(NS, "experience");
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");
Expand Down
5 changes: 0 additions & 5 deletions api/src/main/java/org/apache/any23/vocab/OGP.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 0 additions & 5 deletions api/src/main/java/org/apache/any23/vocab/OGPArticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 0 additions & 5 deletions api/src/main/java/org/apache/any23/vocab/OGPBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 0 additions & 5 deletions api/src/main/java/org/apache/any23/vocab/OGPMusic.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 0 additions & 5 deletions api/src/main/java/org/apache/any23/vocab/OGPProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 0 additions & 5 deletions api/src/main/java/org/apache/any23/vocab/OGPVideo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 0 additions & 5 deletions api/src/main/java/org/apache/any23/vocab/SINDICE.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions api/src/main/java/org/apache/any23/vocab/Vocabulary.java
Original file line number Diff line number Diff line change
Expand Up @@ -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];
StringBuffer camelCase = new StringBuffer().append(names[0]);
lewismc marked this conversation as resolved.
Show resolved Hide resolved
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)));
HansBrende marked this conversation as resolved.
Show resolved Hide resolved
}
return getProperty(camelCase);
return getProperty(camelCase.toString());
}

/**
Expand Down