sonarqube fixes, set RouteHandler interface to public

This commit is contained in:
Jörg Prante 2016-11-08 21:14:24 +01:00
parent cfff322595
commit 7a056ec4aa
50 changed files with 212 additions and 185 deletions

View file

@ -14,7 +14,7 @@ ext {
allprojects { allprojects {
group = 'org.xbib' group = 'org.xbib'
version = '1.0.2' version = '1.0.3'
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'maven' apply plugin: 'maven'

View file

@ -10,15 +10,6 @@ public interface ToXContent {
XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException; XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException;
/**
*
*/
interface Params {
String param(String key);
String param(String key, String defaultValue);
}
Params EMPTY_PARAMS = new Params() { Params EMPTY_PARAMS = new Params() {
@ -33,4 +24,14 @@ public interface ToXContent {
} }
}; };
/**
*
*/
interface Params {
String param(String key);
String param(String key, String defaultValue);
}
} }

View file

@ -41,10 +41,10 @@ public class Settings {
public static final Settings EMPTY_SETTINGS = new Builder().build(); public static final Settings EMPTY_SETTINGS = new Builder().build();
public static final String[] EMPTY_ARRAY = new String[0]; public static final String[] EMPTY_ARRAY = new String[0];
public static final int BUFFER_SIZE = 1024 * 8; public static final int BUFFER_SIZE = 1024 * 8;
private final Map<String, String> settings; private final Map<String, String> map;
private Settings(Map<String, String> settings) { private Settings(Map<String, String> settings) {
this.settings = new HashMap<>(settings); this.map = new HashMap<>(settings);
} }
public static Settings readSettingsFromMap(Map<String, Object> map) throws IOException { public static Settings readSettingsFromMap(Map<String, Object> map) throws IOException {
@ -131,27 +131,27 @@ public class Settings {
} }
public Map<String, String> getAsMap() { public Map<String, String> getAsMap() {
return this.settings; return this.map;
} }
public Map<String, Object> getAsStructuredMap() { public Map<String, Object> getAsStructuredMap() {
Map<String, Object> map = new HashMap<>(2); Map<String, Object> stringObjectMap = new HashMap<>(2);
for (Map.Entry<String, String> entry : settings.entrySet()) { for (Map.Entry<String, String> entry : this.map.entrySet()) {
processSetting(map, "", entry.getKey(), entry.getValue()); processSetting(stringObjectMap, "", entry.getKey(), entry.getValue());
} }
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : stringObjectMap.entrySet()) {
if (entry.getValue() instanceof Map) { if (entry.getValue() instanceof Map) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, Object> valMap = (Map<String, Object>) entry.getValue(); Map<String, Object> valMap = (Map<String, Object>) entry.getValue();
entry.setValue(convertMapsToArrays(valMap)); entry.setValue(convertMapsToArrays(valMap));
} }
} }
return map; return stringObjectMap;
} }
public Settings getByPrefix(String prefix) { public Settings getByPrefix(String prefix) {
Builder builder = new Builder(); Builder builder = new Builder();
for (Map.Entry<String, String> entry : settings.entrySet()) { for (Map.Entry<String, String> entry : map.entrySet()) {
if (entry.getKey().startsWith(prefix)) { if (entry.getKey().startsWith(prefix)) {
if (entry.getKey().length() < prefix.length()) { if (entry.getKey().length() < prefix.length()) {
continue; continue;
@ -167,10 +167,10 @@ public class Settings {
} }
public boolean containsSetting(String setting) { public boolean containsSetting(String setting) {
if (settings.containsKey(setting)) { if (map.containsKey(setting)) {
return true; return true;
} }
for (Map.Entry<String, String> entry : settings.entrySet()) { for (Map.Entry<String, String> entry : map.entrySet()) {
if (entry.getKey().startsWith(setting)) { if (entry.getKey().startsWith(setting)) {
return true; return true;
} }
@ -179,7 +179,7 @@ public class Settings {
} }
public String get(String setting) { public String get(String setting) {
String retVal = settings.get(setting); String retVal = map.get(setting);
if (retVal != null) { if (retVal != null) {
return retVal; return retVal;
} }
@ -187,7 +187,7 @@ public class Settings {
} }
public String get(String setting, String defaultValue) { public String get(String setting, String defaultValue) {
String retVal = settings.get(setting); String retVal = map.get(setting);
return retVal == null ? defaultValue : retVal; return retVal == null ? defaultValue : retVal;
} }
@ -251,15 +251,15 @@ public class Settings {
return parseTimeValue(get(setting), defaultValue); return parseTimeValue(get(setting), defaultValue);
} }
public ByteSizeValue getAsBytesSize(String setting, ByteSizeValue defaultValue) throws SettingsException { public ByteSizeValue getAsBytesSize(String setting, ByteSizeValue defaultValue) {
return parseBytesSizeValue(get(setting), defaultValue); return parseBytesSizeValue(get(setting), defaultValue);
} }
public String[] getAsArray(String settingPrefix) throws SettingsException { public String[] getAsArray(String settingPrefix) {
return getAsArray(settingPrefix, EMPTY_ARRAY); return getAsArray(settingPrefix, EMPTY_ARRAY);
} }
public String[] getAsArray(String settingPrefix, String[] defaultArray) throws SettingsException { public String[] getAsArray(String settingPrefix, String[] defaultArray) {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
if (get(settingPrefix) != null) { if (get(settingPrefix) != null) {
String[] strings = splitStringByCommaToArray(get(settingPrefix)); String[] strings = splitStringByCommaToArray(get(settingPrefix));
@ -283,14 +283,14 @@ public class Settings {
return result.toArray(new String[result.size()]); return result.toArray(new String[result.size()]);
} }
public Map<String, Settings> getGroups(String prefix) throws SettingsException { public Map<String, Settings> getGroups(String prefix) {
String settingPrefix = prefix; String settingPrefix = prefix;
if (settingPrefix.charAt(settingPrefix.length() - 1) != '.') { if (settingPrefix.charAt(settingPrefix.length() - 1) != '.') {
settingPrefix = settingPrefix + "."; settingPrefix = settingPrefix + ".";
} }
// we don't really care that it might happen twice // we don't really care that it might happen twice
Map<String, Map<String, String>> map = new LinkedHashMap<>(); Map<String, Map<String, String>> hashMap = new LinkedHashMap<>();
for (Object o : settings.keySet()) { for (Object o : this.map.keySet()) {
String setting = (String) o; String setting = (String) o;
if (setting.startsWith(settingPrefix)) { if (setting.startsWith(settingPrefix)) {
String nameValue = setting.substring(settingPrefix.length()); String nameValue = setting.substring(settingPrefix.length());
@ -302,16 +302,16 @@ public class Settings {
} }
String name = nameValue.substring(0, dotIndex); String name = nameValue.substring(0, dotIndex);
String value = nameValue.substring(dotIndex + 1); String value = nameValue.substring(dotIndex + 1);
Map<String, String> groupSettings = map.get(name); Map<String, String> groupSettings = hashMap.get(name);
if (groupSettings == null) { if (groupSettings == null) {
groupSettings = new LinkedHashMap<>(); groupSettings = new LinkedHashMap<>();
map.put(name, groupSettings); hashMap.put(name, groupSettings);
} }
groupSettings.put(value, get(setting)); groupSettings.put(value, get(setting));
} }
} }
Map<String, Settings> retVal = new LinkedHashMap<>(); Map<String, Settings> retVal = new LinkedHashMap<>();
for (Map.Entry<String, Map<String, String>> entry : map.entrySet()) { for (Map.Entry<String, Map<String, String>> entry : hashMap.entrySet()) {
retVal.put(entry.getKey(), new Settings(Collections.unmodifiableMap(entry.getValue()))); retVal.put(entry.getKey(), new Settings(Collections.unmodifiableMap(entry.getValue())));
} }
return Collections.unmodifiableMap(retVal); return Collections.unmodifiableMap(retVal);
@ -319,19 +319,12 @@ public class Settings {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) { return this == o || !(o == null || getClass() != o.getClass()) && map.equals(((Settings) o).map);
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Settings that = (Settings) o;
return settings != null ? settings.equals(that.settings) : that.settings == null;
} }
@Override @Override
public int hashCode() { public int hashCode() {
return settings != null ? settings.hashCode() : 0; return map.hashCode();
} }
private void processSetting(Map<String, Object> map, String prefix, String setting, String value) { private void processSetting(Map<String, Object> map, String prefix, String setting, String value) {

View file

@ -2,7 +2,6 @@ package org.xbib.content.util.geo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator;
/** /**
* Utilities for encoding and decoding geohashes. Based on * Utilities for encoding and decoding geohashes. Based on
@ -81,7 +80,7 @@ public class GeoHashUtils {
* @param geohash Geohash of the defined cell * @param geohash Geohash of the defined cell
* @return geohashes of all neighbor cells * @return geohashes of all neighbor cells
*/ */
public static Collection<? extends CharSequence> neighbors(String geohash) { public static Collection<CharSequence> neighbors(String geohash) {
return addNeighbors(geohash, geohash.length(), new ArrayList<CharSequence>(8)); return addNeighbors(geohash, geohash.length(), new ArrayList<CharSequence>(8));
} }
@ -93,12 +92,7 @@ public class GeoHashUtils {
* @return {@link Iterable} of path * @return {@link Iterable} of path
*/ */
public static Iterable<String> path(final String geohash) { public static Iterable<String> path(final String geohash) {
return new Iterable<String>() { return () -> new GeohashPathIterator(geohash);
@Override
public Iterator<String> iterator() {
return new GeohashPathIterator(geohash);
}
};
} }
/** /**

View file

@ -9,6 +9,7 @@ public final class GeoPoint {
private double lon; private double lon;
public GeoPoint() { public GeoPoint() {
this(0, 0);
} }
/** /**

View file

@ -12,6 +12,9 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
/**
*
*/
final class DiffFactorizer { final class DiffFactorizer {
private static final Equivalence<JsonNode> EQUIVALENCE = JsonNumEquals.getInstance(); private static final Equivalence<JsonNode> EQUIVALENCE = JsonNumEquals.getInstance();
@ -91,7 +94,8 @@ final class DiffFactorizer {
private static void findPairs(final List<Diff> diffs) { private static void findPairs(final List<Diff> diffs) {
final int diffsSize = diffs.size(); final int diffsSize = diffs.size();
Diff addition, removal; Diff addition;
Diff removal;
for (int addIndex = 0; addIndex < diffsSize; addIndex++) { for (int addIndex = 0; addIndex < diffsSize; addIndex++) {
addition = diffs.get(addIndex); addition = diffs.get(addIndex);

View file

@ -358,7 +358,8 @@ public final class JsonDiff {
*/ */
private static void postLCS(final List<Diff> diffs, final JsonPointer path, private static void postLCS(final List<Diff> diffs, final JsonPointer path,
final IndexedJsonArray source, final IndexedJsonArray target) { final IndexedJsonArray source, final IndexedJsonArray target) {
JsonNode src, dst; JsonNode src;
JsonNode dst;
while (!(source.isEmpty() || target.isEmpty())) { while (!(source.isEmpty() || target.isEmpty())) {
src = source.getElement(); src = source.getElement();

View file

@ -103,7 +103,8 @@ final class LeastCommonSubsequence {
} }
// return result out of the LCS lengths matrix // return result out of the LCS lengths matrix
int x = size1, y = size2; int x = size1;
int y = size2;
while (x > 0 && y > 0) { while (x > 0 && y > 0) {
if (lengths[x][y] == lengths[x - 1][y]) { if (lengths[x][y] == lengths[x - 1][y]) {
x--; x--;

View file

@ -48,13 +48,13 @@ public enum NodeType {
* Reverse map to find a node type out of this type's name. * Reverse map to find a node type out of this type's name.
*/ */
private static final Map<String, NodeType> NAME_MAP private static final Map<String, NodeType> NAME_MAP
= new HashMap<String, NodeType>(); = new HashMap<>();
/** /**
* Mapping of {@link com.fasterxml.jackson.core.JsonToken} back to node types (used in {@link * Mapping of {@link com.fasterxml.jackson.core.JsonToken} back to node types (used in {@link
* #getNodeType(com.fasterxml.jackson.databind.JsonNode)}). * #getNodeType(com.fasterxml.jackson.databind.JsonNode)}).
*/ */
private static final Map<JsonToken, NodeType> TOKEN_MAP private static final Map<JsonToken, NodeType> TOKEN_MAP
= new EnumMap<JsonToken, NodeType>(JsonToken.class); = new EnumMap<>(JsonToken.class);
static { static {
TOKEN_MAP.put(JsonToken.START_ARRAY, ARRAY); TOKEN_MAP.put(JsonToken.START_ARRAY, ARRAY);

View file

@ -39,9 +39,9 @@ public final class Wrapper<T> {
* whatever type it is, it is assignable to the type handled by this wrapper's equivalence. * whatever type it is, it is assignable to the type handled by this wrapper's equivalence.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Equivalence<Object> equivalence = (Equivalence<Object>) this.equivalence; Equivalence<Object> equiv = (Equivalence<Object>) this.equivalence;
return equivalence.equals(that.equivalence) return equiv.equals(that.equivalence)
&& equivalence.equivalent(this.reference, that.reference); && equiv.equivalent(this.reference, that.reference);
} else { } else {
return false; return false;
} }

View file

@ -1,7 +1,6 @@
package org.xbib.content.json.patch; package org.xbib.content.json.patch;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
@ -32,8 +31,7 @@ public abstract class DualPathOperation extends JsonPatchOperation {
@Override @Override
public final void serialize(final JsonGenerator jgen, public final void serialize(final JsonGenerator jgen,
final SerializerProvider provider) final SerializerProvider provider) throws IOException {
throws IOException, JsonProcessingException {
jgen.writeStartObject(); jgen.writeStartObject();
jgen.writeStringField("op", op); jgen.writeStringField("op", op);
jgen.writeStringField("path", path.toString()); jgen.writeStringField("path", path.toString());
@ -44,7 +42,7 @@ public abstract class DualPathOperation extends JsonPatchOperation {
@Override @Override
public final void serializeWithType(final JsonGenerator jgen, public final void serializeWithType(final JsonGenerator jgen,
final SerializerProvider provider, final TypeSerializer typeSer) final SerializerProvider provider, final TypeSerializer typeSer)
throws IOException, JsonProcessingException { throws IOException {
serialize(jgen, provider); serialize(jgen, provider);
} }

View file

@ -1,7 +1,6 @@
package org.xbib.content.json.patch; package org.xbib.content.json.patch;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@ -46,7 +45,7 @@ public abstract class PathValueOperation
@Override @Override
public final void serializeWithType(final JsonGenerator jgen, public final void serializeWithType(final JsonGenerator jgen,
final SerializerProvider provider, final TypeSerializer typeSer) final SerializerProvider provider, final TypeSerializer typeSer)
throws IOException, JsonProcessingException { throws IOException {
serialize(jgen, provider); serialize(jgen, provider);
} }

View file

@ -70,7 +70,8 @@ public final class Lang extends SubtagSet {
return parse(locale.toString()).primary; return parse(locale.toString()).primary;
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.FINE, e.getMessage(), e); logger.log(Level.FINE, e.getMessage(), e);
Subtag c = null, primary = new Subtag(Type.PRIMARY, locale.getLanguage()); Subtag c = null;
Subtag primary = new Subtag(Type.PRIMARY, locale.getLanguage());
String country = locale.getCountry(); String country = locale.getCountry();
String variant = locale.getVariant(); String variant = locale.getVariant();
if (country != null) { if (country != null) {
@ -344,7 +345,8 @@ public final class Lang extends SubtagSet {
public Lang canonicalize() { public Lang canonicalize() {
Subtag primary = null; Subtag primary = null;
Subtag current; Subtag current;
int p = -1, t = -1; int p = -1;
int t = -1;
List<Subtag> tags = new LinkedList<>(); List<Subtag> tags = new LinkedList<>();
for (Subtag tag : this) { for (Subtag tag : this) {
tags.add(tag); tags.add(tag);

View file

@ -14,9 +14,9 @@ import java.util.regex.Pattern;
*/ */
public class Range extends SubtagSet { public class Range extends SubtagSet {
private static final String RANGE = "((?:[a-zA-Z]{1,8}|\\*))((?:[-_](?:[a-zA-Z0-9]{1,8}|\\*))*)"; private static final String RANGE_PATTERN = "((?:[a-zA-Z]{1,8}|\\*))((?:[-_](?:[a-zA-Z0-9]{1,8}|\\*))*)";
private static final String RANGE_COMPONENT = "[-_]((?:[a-zA-Z0-9]{1,8}|\\*))"; private static final String RANGE_COMPONENT = "[-_]((?:[a-zA-Z0-9]{1,8}|\\*))";
private static final Pattern P_RANGE = Pattern.compile(RANGE); private static final Pattern P_RANGE = Pattern.compile(RANGE_PATTERN);
private static final Pattern P_RANGE_COMPONENT = Pattern.compile(RANGE_COMPONENT); private static final Pattern P_RANGE_COMPONENT = Pattern.compile(RANGE_COMPONENT);
private static final String LANGUAGE = private static final String LANGUAGE =
"((?:[a-zA-Z]{2,3}(?:[-_](?:[a-zA-Z]{3}|\\*)){0,3})|[a-zA-Z]{4}|[a-zA-Z]{5,8}|\\*)"; "((?:[a-zA-Z]{2,3}(?:[-_](?:[a-zA-Z]{3}|\\*)){0,3})|[a-zA-Z]{4}|[a-zA-Z]{5,8}|\\*)";
@ -309,7 +309,8 @@ public class Range extends SubtagSet {
list.add(tag); list.add(tag);
} }
} }
Subtag primary = null, current = null; Subtag primary = null;
Subtag current = null;
for (Subtag tag : list) { for (Subtag tag : list) {
tag.setNext(null); tag.setNext(null);
tag.setPrevious(null); tag.setPrevious(null);

View file

@ -173,6 +173,7 @@ public final class Subtag implements Comparable<Subtag> {
} }
} }
@Override
public String toString() { public String toString() {
switch (type) { switch (type) {
case REGION: case REGION:
@ -184,6 +185,7 @@ public final class Subtag implements Comparable<Subtag> {
} }
} }
@Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
@ -192,6 +194,7 @@ public final class Subtag implements Comparable<Subtag> {
return result; return result;
} }
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
@ -345,6 +348,7 @@ public final class Subtag implements Comparable<Subtag> {
} }
} }
@Override
public int compareTo(Subtag o) { public int compareTo(Subtag o) {
int c = o.type.compareTo(type); int c = o.type.compareTo(type);
return c != 0 ? c : o.name.compareTo(name); return c != 0 ? c : o.name.compareTo(name);

View file

@ -6,6 +6,9 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
/**
*
*/
abstract class SubtagSet implements Cloneable, Iterable<Subtag>, Comparable<SubtagSet> { abstract class SubtagSet implements Cloneable, Iterable<Subtag>, Comparable<SubtagSet> {
protected final Subtag primary; protected final Subtag primary;

View file

@ -8,24 +8,24 @@ public interface RDF {
String NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; String NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
String BNODE_PREFIX = "_:"; String BNODE_PREFIX = "_:";
String SHORTENABLE_BNODE_SUFFIX = "sbl"; String SHORTENABLE_BNODE_SUFFIX = "sbl";
String PROPERTY = NS + "Property"; String PROPERTY_ELEMENT = NS + "Property";
String XML_LITERAL = NS + "XMLLiteral"; String XML_LITERAL = NS + "XMLLiteral";
String TYPE = NS + "type"; String TYPE = NS + "type";
String VALUE = NS + "value"; String VALUE = NS + "value";
String ALT = NS + "Alt"; String ALT_ELEMENT = NS + "Alt";
String BAG = NS + "Bag"; String BAG_ELEMENT = NS + "Bag";
String SEQ = NS + "Seq"; String SEQ_ELEMENT = NS + "Seq";
String LIST = NS + "List"; String LIST_ELEMENT = NS + "List";
String FIRST = NS + "first"; String FIRST = NS + "first";
String NIL = NS + "nil"; String NIL = NS + "nil";
String REST = NS + "rest"; String REST = NS + "rest";
String STATEMENT = NS + "Statement"; String STATEMENT_ELEMENT = NS + "Statement";
String OBJECT = NS + "object"; String OBJECT = NS + "object";
String PREDICATE = NS + "predicate"; String PREDICATE = NS + "predicate";
String SUBJECT = NS + "subject"; String SUBJECT = NS + "subject";
String DESCRIPTION = NS + "Description"; String DESCRIPTION_ELEMENT = NS + "Description";
String ID = NS + "ID"; String ID = NS + "ID";
String RDF = NS + "RDF"; String RDF_ELEMENT = NS + "RDF";
String ABOUT = NS + "about"; String ABOUT = NS + "about";
String DATATYPE = NS + "datatype"; String DATATYPE = NS + "datatype";
String LI = NS + "li"; String LI = NS + "li";

View file

@ -19,6 +19,9 @@ import java.io.OutputStream;
*/ */
public class RdfContentFactory { public class RdfContentFactory {
private RdfContentFactory() {
}
public static RdfContentBuilder<NTripleContentParams> ntripleBuilder() throws IOException { public static RdfContentBuilder<NTripleContentParams> ntripleBuilder() throws IOException {
return NTripleContent.contentBuilder(NTripleContentParams.N_TRIPLE_CONTENT_PARAMS); return NTripleContent.contentBuilder(NTripleContentParams.N_TRIPLE_CONTENT_PARAMS);
} }
@ -67,7 +70,7 @@ public class RdfContentFactory {
public static RdfContentBuilder<TurtleContentParams> turtleBuilder(OutputStream out, TurtleContentParams params) public static RdfContentBuilder<TurtleContentParams> turtleBuilder(OutputStream out, TurtleContentParams params)
throws IOException { throws IOException {
return TurtleContent.contentBuilder(out, TurtleContentParams.TURTLE_CONTENT_PARAMS); return TurtleContent.contentBuilder(out, params);
} }
public static RdfContentBuilder<XmlContentParams> xmlBuilder() throws IOException { public static RdfContentBuilder<XmlContentParams> xmlBuilder() throws IOException {

View file

@ -41,7 +41,7 @@ public class RouteRdfXContent implements RdfContent<RouteRdfXContentParams> {
* *
*/ */
@FunctionalInterface @FunctionalInterface
interface RouteHandler { public interface RouteHandler {
void complete(String content, RouteRdfXContentParams params) throws IOException; void complete(String content, RouteRdfXContentParams params) throws IOException;
} }
} }

View file

@ -124,7 +124,7 @@ public class DefaultRdfGraph implements RdfGraph<RdfGraphParams> {
// nothing to do here // nothing to do here
} }
private Resource expand(Resource resource) { public Resource expand(Resource resource) {
Resource expanded = new DefaultResource(resource.id()); Resource expanded = new DefaultResource(resource.id());
new GraphTriples(resource).triples.forEach(expanded::add); new GraphTriples(resource).triples.forEach(expanded::add);
return expanded; return expanded;
@ -166,5 +166,4 @@ public class DefaultRdfGraph implements RdfGraph<RdfGraphParams> {
} }
} }
} }

View file

@ -5,11 +5,11 @@ import org.xbib.content.rdf.RdfConstants;
import org.xbib.content.rdf.Resource; import org.xbib.content.rdf.Resource;
import org.xbib.content.rdf.Triple; import org.xbib.content.rdf.Triple;
import org.xbib.content.rdf.XSDResourceIdentifiers; import org.xbib.content.rdf.XSDResourceIdentifiers;
import org.xbib.content.rdf.util.LinkedHashMultiMap;
import org.xbib.content.rdf.util.MultiMap;
import org.xbib.content.resource.IRI; import org.xbib.content.resource.IRI;
import org.xbib.content.resource.IRINamespaceContext; import org.xbib.content.resource.IRINamespaceContext;
import org.xbib.content.resource.Node; import org.xbib.content.resource.Node;
import org.xbib.content.rdf.util.LinkedHashMultiMap;
import org.xbib.content.rdf.util.MultiMap;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -231,7 +231,7 @@ public class DefaultResource implements Resource, Comparable<Resource>, XSDResou
if (object instanceof Map) { if (object instanceof Map) {
add(predicate, (Map) object); add(predicate, (Map) object);
} else if (object instanceof List) { } else if (object instanceof List) {
add(predicate, ((List) object)); add(predicate, (List) object);
} else if (object instanceof Resource) { } else if (object instanceof Resource) {
add(predicate, (Resource) object); add(predicate, (Resource) object);
} else { } else {
@ -251,7 +251,7 @@ public class DefaultResource implements Resource, Comparable<Resource>, XSDResou
if (obj instanceof Map) { if (obj instanceof Map) {
r.add(newPredicate(pred), (Map<Object, Object>) obj); r.add(newPredicate(pred), (Map<Object, Object>) obj);
} else if (obj instanceof List) { } else if (obj instanceof List) {
r.add(newPredicate(pred), ((List) obj)); r.add(newPredicate(pred), (List) obj);
} else if (obj instanceof Resource) { } else if (obj instanceof Resource) {
r.add(newPredicate(pred), (Resource) obj); r.add(newPredicate(pred), (Resource) obj);
} else { } else {
@ -311,7 +311,7 @@ public class DefaultResource implements Resource, Comparable<Resource>, XSDResou
Resource r = newResource(newPredicate(pred)); Resource r = newResource(newPredicate(pred));
r.add((Map) obj); r.add((Map) obj);
} else if (obj instanceof List) { } else if (obj instanceof List) {
add(newPredicate(pred), ((List) obj)); add(newPredicate(pred), (List) obj);
} else if (obj instanceof Resource) { } else if (obj instanceof Resource) {
add(newPredicate(pred), (Resource) obj); add(newPredicate(pred), (Resource) obj);
} else { } else {
@ -520,22 +520,22 @@ public class DefaultResource implements Resource, Comparable<Resource>, XSDResou
private static class Triples { private static class Triples {
private final List<Triple> triples; private final List<Triple> tripleList;
private final boolean recursive; private final boolean recursive;
Triples(Resource resource, boolean recursive) { Triples(Resource resource, boolean recursive) {
this.recursive = recursive; this.recursive = recursive;
this.triples = unfold(resource); this.tripleList = unfold(resource);
} }
Triples(Resource resource, IRI predicate, Literal literal) { Triples(Resource resource, IRI predicate, Literal literal) {
this.recursive = true; this.recursive = true;
this.triples = find(resource, predicate, literal); this.tripleList = find(resource, predicate, literal);
} }
List<Triple> list() { List<Triple> list() {
return triples; return tripleList;
} }
private List<Triple> unfold(Resource resource) { private List<Triple> unfold(Resource resource) {

View file

@ -45,7 +45,6 @@ public class NTripleContentGenerator
@Override @Override
public NTripleContentGenerator receive(IRI iri) throws IOException { public NTripleContentGenerator receive(IRI iri) throws IOException {
//String compact = params.getNamespaceContext().compact(iri);
return this; return this;
} }

View file

@ -136,27 +136,6 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
return this; return this;
} }
private void yield(Object s, Object p, Object o) throws IOException {
yield(new DefaultTriple(resource.newSubject(s), resource.newPredicate(p), resource.newObject(o)));
}
private void yield(Triple triple) throws IOException {
if (builder != null) {
builder.receive(triple);
}
}
// produce a (possibly) reified triple
private void yield(Object s, IRI p, Object o, IRI reified) throws IOException {
yield(s, p, o);
if (reified != null) {
yield(reified, RDF_TYPE, RDF_STATEMENT);
yield(reified, RDF_SUBJECT, s);
yield(reified, RDF_PREDICATE, p);
yield(reified, RDF_OBJECT, o);
}
}
// get the most-specific language tag in scope // get the most-specific language tag in scope
private String getLanguage(Deque<Frame> stack) { private String getLanguage(Deque<Frame> stack) {
String lang = ""; String lang = "";
@ -194,16 +173,6 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
return ip; return ip;
} }
// do we expect to encounter a subject (rather than a predicate?)
private boolean expectSubject(Deque<Frame> stack) {
boolean b = true;
Iterator<Frame> it = stack.descendingIterator();
while (it.hasNext()) {
Frame frame = it.next();
b = !frame.isSubject;
}
return b;
}
// if we're in a predicate, get its frame // if we're in a predicate, get its frame
private Frame parentPredicateFrame(Deque<Frame> stack) throws SAXException { private Frame parentPredicateFrame(Deque<Frame> stack) throws SAXException {
@ -247,15 +216,6 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
return subjectFrame != null ? subjectFrame.node : null; return subjectFrame != null ? subjectFrame.node : null;
} }
// if we're looking at a subject, is it an item in a Collection?
private boolean isCollectionItem(Deque<Frame> stack) throws SAXException {
if (inPredicate(stack)) {
Frame predicateFrame = parentPredicateFrame(stack);
return predicateFrame != null && predicateFrame.isCollection;
} else {
return false;
}
}
private Resource blankNode() { private Resource blankNode() {
return new DefaultAnonymousResource("b" + (bn++)); return new DefaultAnonymousResource("b" + (bn++));
@ -566,7 +526,7 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
String aQn = attrs.getQName(i); String aQn = attrs.getQName(i);
IRI aUri = IRI.create(attrs.getURI(i) + attrs.getLocalName(i)); IRI aUri = IRI.create(attrs.getURI(i) + attrs.getLocalName(i));
String aVal = attrs.getValue(i); String aVal = attrs.getValue(i);
if (((aUri.toString().equals(RDF_TYPE.toString()) || !aUri.toString().startsWith(RDF_STRING))) if ((aUri.toString().equals(RDF_TYPE.toString()) || !aUri.toString().startsWith(RDF_STRING))
&& !aQn.startsWith("xml:")) { && !aQn.startsWith("xml:")) {
if (object == null) { if (object == null) {
object = blankNode().id(); object = blankNode().id();
@ -666,5 +626,48 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
xmlLiteral.append("<?").append(target).append(" ").append(data).append("?>"); xmlLiteral.append("<?").append(target).append(" ").append(data).append("?>");
} }
} }
// do we expect to encounter a subject (rather than a predicate?)
private boolean expectSubject(Deque<Frame> stack) {
boolean b = true;
Iterator<Frame> it = stack.descendingIterator();
while (it.hasNext()) {
Frame frame = it.next();
b = !frame.isSubject;
}
return b;
}
// produce a (possibly) reified triple
private void yield(Object s, IRI p, Object o, IRI reified) throws IOException {
yield(s, p, o);
if (reified != null) {
yield(reified, RDF_TYPE, RDF_STATEMENT);
yield(reified, RDF_SUBJECT, s);
yield(reified, RDF_PREDICATE, p);
yield(reified, RDF_OBJECT, o);
}
}
private void yield(Object s, Object p, Object o) throws IOException {
yield(new DefaultTriple(resource.newSubject(s), resource.newPredicate(p), resource.newObject(o)));
}
private void yield(Triple triple) throws IOException {
if (builder != null) {
builder.receive(triple);
}
}
// if we're looking at a subject, is it an item in a Collection?
private boolean isCollectionItem(Deque<Frame> stack) throws SAXException {
if (inPredicate(stack)) {
Frame predicateFrame = parentPredicateFrame(stack);
return predicateFrame != null && predicateFrame.isCollection;
} else {
return false;
}
}
} }
} }

View file

@ -43,6 +43,7 @@ public class XmlContentGenerator implements RdfContentGenerator<XmlContentParams
this.writer = writer; this.writer = writer;
} }
@Override
public XmlContentParams getParams() { public XmlContentParams getParams() {
return params; return params;
} }

View file

@ -4,6 +4,7 @@ import java.util.Collection;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
/** /**
@ -13,15 +14,15 @@ import java.util.Set;
*/ */
public class LinkedHashMultiMap<K, V> implements MultiMap<K, V> { public class LinkedHashMultiMap<K, V> implements MultiMap<K, V> {
private final Map<K, Set<V>> map = new LinkedHashMap<>(); private final Map<K, Set<V>> map;
public LinkedHashMultiMap() { public LinkedHashMultiMap() {
this.map = new LinkedHashMap<>();
} }
public LinkedHashMultiMap(MultiMap<K, V> map) { public LinkedHashMultiMap(MultiMap<K, V> map) {
if (map == null) { Objects.requireNonNull(map);
throw new IllegalArgumentException("must not be null"); this.map = new LinkedHashMap<>();
}
for (K k : map.keySet()) { for (K k : map.keySet()) {
putAll(k, map.get(k)); putAll(k, map.get(k));
} }

View file

@ -0,0 +1,4 @@
/**
* Classes for RDF content utilities.
*/
package org.xbib.content.rdf.util;

View file

@ -520,8 +520,8 @@ public class IRI implements Comparable<IRI>, Node {
} }
public boolean isPathAbsolute() { public boolean isPathAbsolute() {
String path = getPath(); String s = getPath();
return (path != null) && path.length() > 0 && path.charAt(0) == '/'; return s != null && s.length() > 0 && s.charAt(0) == '/';
} }
public boolean isSameDocumentReference() { public boolean isSameDocumentReference() {
@ -545,9 +545,9 @@ public class IRI implements Comparable<IRI>, Node {
@Override @Override
public String toString() { public String toString() {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
String scheme = getScheme(); String s = getScheme();
if (scheme != null && !scheme.isEmpty()) { if (s != null && !s.isEmpty()) {
buf.append(scheme).append(':'); buf.append(s).append(':');
} }
buf.append(getSchemeSpecificPart()); buf.append(getSchemeSpecificPart());
return buf.toString(); return buf.toString();
@ -564,9 +564,9 @@ public class IRI implements Comparable<IRI>, Node {
public String toASCIIString() { public String toASCIIString() {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
String scheme = getScheme(); String s = getScheme();
if (scheme != null && !scheme.isEmpty()) { if (s != null && !s.isEmpty()) {
buf.append(scheme).append(':'); buf.append(s).append(':');
} }
buf.append(getASCIISchemeSpecificPart()); buf.append(getASCIISchemeSpecificPart());
return buf.toString(); return buf.toString();

View file

@ -60,7 +60,7 @@ public final class IRINamespaceContext extends XmlNamespaceContext {
@Override @Override
public void addNamespace(String prefix, String namespace) { public void addNamespace(String prefix, String namespace) {
super.addNamespace(prefix, namespace); super.addNamespace(prefix, namespace);
sortedNamespacesByPrefixLength = new ArrayList<String>(getNamespaces().values()); sortedNamespacesByPrefixLength = new ArrayList<>(getNamespaces().values());
// sort from longest to shortest prefix for successful matching // sort from longest to shortest prefix for successful matching
Collections.sort(sortedNamespacesByPrefixLength, (s1, s2) -> { Collections.sort(sortedNamespacesByPrefixLength, (s1, s2) -> {
Integer l1 = s1.length(); Integer l1 = s1.length();

View file

@ -116,6 +116,7 @@ public class XmlNamespaceContext implements NamespaceContext {
prefixes.get(namespace).iterator() : null; prefixes.get(namespace).iterator() : null;
} }
@Override
public String toString() { public String toString() {
return namespaces.toString(); return namespaces.toString();
} }

View file

@ -12,7 +12,7 @@ public final class SchemeRegistry {
private final Map<String, Scheme> schemes; private final Map<String, Scheme> schemes;
SchemeRegistry() { SchemeRegistry() {
schemes = new HashMap<String, Scheme>(); schemes = new HashMap<>();
schemes.put(HttpScheme.HTTP_SCHEME_NAME, new HttpScheme()); schemes.put(HttpScheme.HTTP_SCHEME_NAME, new HttpScheme());
schemes.put(HttpsScheme.HTTPS_SCHEME_NAME, new HttpsScheme()); schemes.put(HttpsScheme.HTTPS_SCHEME_NAME, new HttpsScheme());
schemes.put(FtpScheme.FTP_SCHEME_NAME, new FtpScheme()); schemes.put(FtpScheme.FTP_SCHEME_NAME, new FtpScheme());

View file

@ -6,7 +6,7 @@ package org.xbib.content.resource.text;
public class InvalidCharacterException extends RuntimeException { public class InvalidCharacterException extends RuntimeException {
private static final long serialVersionUID = -3037013255350562940L; private static final long serialVersionUID = -3037013255350562940L;
private int input; private final int input;
public InvalidCharacterException(int input) { public InvalidCharacterException(int input) {
this.input = input; this.input = input;

View file

@ -87,15 +87,6 @@ public final class UrlEncoding {
return e; return e;
} }
private static byte decode(char c, int shift) {
return (byte) ((((c >= '0' && c <= '9') ? c - '0' : (c >= 'A' && c <= 'F') ? c - 'A' + 10
: (c >= 'a' && c <= 'f') ? c - 'a' + 10 : -1) & 0xf) << shift);
}
private static byte decode(char c1, char c2) {
return (byte) (decode(c1, 4) | decode(c2, 0));
}
/** /**
* *
*/ */
@ -144,5 +135,14 @@ public final class UrlEncoding {
} }
return i; return i;
} }
private static byte decode(char c, int shift) {
return (byte) ((((c >= '0' && c <= '9') ? c - '0' : (c >= 'A' && c <= 'F') ? c - 'A' + 10
: (c >= 'a' && c <= 'f') ? c - 'a' + 10 : -1) & 0xf) << shift);
}
private static byte decode(char c1, char c2) {
return (byte) (decode(c1, 4) | decode(c2, 0));
}
} }
} }

View file

@ -14,6 +14,9 @@ import java.util.Map;
*/ */
public class XmlXContentHelper { public class XmlXContentHelper {
private XmlXContentHelper() {
}
public static Map<String, Object> convertFromXmlToMap(Reader reader) { public static Map<String, Object> convertFromXmlToMap(Reader reader) {
try { try {
return XmlXContent.xmlXContent().createParser(reader).mapOrderedAndClose(); return XmlXContent.xmlXContent().createParser(reader).mapOrderedAndClose();

View file

@ -150,6 +150,8 @@ public class XmlXContentParser extends AbstractXContentParser {
return NumberType.BIG_INTEGER; return NumberType.BIG_INTEGER;
case BIG_DECIMAL: case BIG_DECIMAL:
return NumberType.BIG_DECIMAL; return NumberType.BIG_DECIMAL;
default:
break;
} }
throw new IllegalStateException("No matching token for number_type [" + numberType + "]"); throw new IllegalStateException("No matching token for number_type [" + numberType + "]");
} }
@ -181,6 +183,8 @@ public class XmlXContentParser extends AbstractXContentParser {
return Token.END_ARRAY; return Token.END_ARRAY;
case VALUE_EMBEDDED_OBJECT: case VALUE_EMBEDDED_OBJECT:
return Token.VALUE_EMBEDDED_OBJECT; return Token.VALUE_EMBEDDED_OBJECT;
default:
break;
} }
throw new IllegalStateException("No matching token for json_token [" + token + "]"); throw new IllegalStateException("No matching token for json_token [" + token + "]");
} }

View file

@ -64,7 +64,7 @@ public class JsonStaxReader implements XMLStreamReader {
} }
@Override @Override
public Object getProperty(String name) throws IllegalArgumentException { public Object getProperty(String name) {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }

View file

@ -199,7 +199,7 @@ public abstract class JsonReaderXmlEvent {
public void addAttribute(QName name, String value) { public void addAttribute(QName name, String value) {
if (null == attributes) { if (null == attributes) {
attributes = new LinkedList<JsonReaderXmlEvent.Attribute>(); attributes = new LinkedList<>();
} }
attributes.add(new Attribute(name, value)); attributes.add(new Attribute(name, value));
} }

View file

@ -25,9 +25,9 @@ public abstract class AbstractCharactersEvent extends AbstractXMLEvent implement
@Override @Override
public boolean isWhiteSpace() { public boolean isWhiteSpace() {
String data = getData(); String s1 = getData();
for (int i = 0, s = data.length(); i < s; i++) { for (int i = 0, s = s1.length(); i < s; i++) {
char ch = data.charAt(i); char ch = s1.charAt(i);
if (ch != ' ' && ch != '\n' && ch != '\t' && ch != '\r') { if (ch != ' ' && ch != '\n' && ch != '\t' && ch != '\r') {
return false; return false;
} }

View file

@ -85,7 +85,7 @@ abstract class AbstractStaxContentHandler implements ContentHandler {
throws XMLStreamException; throws XMLStreamException;
@Override @Override
public final void characters(char ch[], int start, int length) throws SAXException { public final void characters(char[] ch, int start, int length) throws SAXException {
try { try {
charactersInternal(ch, start, length); charactersInternal(ch, start, length);
} catch (XMLStreamException ex) { } catch (XMLStreamException ex) {

View file

@ -1,7 +1,6 @@
package org.xbib.content.xml.stream; package org.xbib.content.xml.stream;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -110,9 +109,6 @@ public abstract class AbstractXMLEvent implements XMLEvent {
return getEventType() == START_ELEMENT; return getEventType() == START_ELEMENT;
} }
@Override
public abstract void writeAsEncodedUnicode(Writer writer) throws XMLStreamException;
@Override @Override
public String toString() { public String toString() {
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();

View file

@ -277,12 +277,15 @@ public class SaxEventConsumer implements XMLEventConsumer {
} }
private void handleNamespace() { private void handleNamespace() {
// not used
} }
private void handleAttribute() { private void handleAttribute() {
// not used
} }
private void handleDTD() { private void handleDTD() {
// not used
} }
private void handleComment(Comment comment) throws XMLStreamException { private void handleComment(Comment comment) throws XMLStreamException {
@ -295,17 +298,22 @@ public class SaxEventConsumer implements XMLEventConsumer {
} }
private void handleEntityReference() { private void handleEntityReference() {
// not used
} }
private void handleSpace() { private void handleSpace() {
// not used
} }
private void handleNotationDecl() { private void handleNotationDecl() {
// not used
} }
private void handleEntityDecl() { private void handleEntityDecl() {
// not used
} }
private void handleCDATA() { private void handleCDATA() {
// not used
} }
} }

View file

@ -108,7 +108,7 @@ public class StaxEventContentHandler extends AbstractStaxContentHandler {
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private List<Namespace> createNamespaces(SimpleNamespaceContext namespaceContext) { private List<Namespace> createNamespaces(SimpleNamespaceContext namespaceContext) {
List<Namespace> namespaces = new ArrayList<Namespace>(); List<Namespace> namespaces = new ArrayList<>();
String defaultNamespaceUri = namespaceContext.getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX); String defaultNamespaceUri = namespaceContext.getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX);
if (defaultNamespaceUri != null && defaultNamespaceUri.length() > 0) { if (defaultNamespaceUri != null && defaultNamespaceUri.length() > 0) {
namespaces.add(eventFactory.createNamespace(defaultNamespaceUri)); namespaces.add(eventFactory.createNamespace(defaultNamespaceUri));
@ -122,7 +122,7 @@ public class StaxEventContentHandler extends AbstractStaxContentHandler {
} }
private List<Attribute> getAttributes(Attributes attributes) { private List<Attribute> getAttributes(Attributes attributes) {
List<Attribute> list = new ArrayList<Attribute>(); List<Attribute> list = new ArrayList<>();
for (int i = 0; i < attributes.getLength(); i++) { for (int i = 0; i < attributes.getLength(); i++) {
QName name = toQName(attributes.getURI(i), attributes.getQName(i)); QName name = toQName(attributes.getURI(i), attributes.getQName(i));
if (!("xmlns".equals(name.getLocalPart()) || "xmlns".equals(name.getPrefix()))) { if (!("xmlns".equals(name.getLocalPart()) || "xmlns".equals(name.getPrefix()))) {
@ -134,6 +134,7 @@ public class StaxEventContentHandler extends AbstractStaxContentHandler {
@Override @Override
protected void skippedEntityInternal(String name) throws XMLStreamException { protected void skippedEntityInternal(String name) throws XMLStreamException {
// not used
} }
private static class SaxLocation implements Location { private static class SaxLocation implements Location {

View file

@ -74,8 +74,8 @@ public class StaxSource extends SAXSource {
} }
int eventType = reader.getEventType(); int eventType = reader.getEventType();
if (!(eventType == XMLStreamConstants.START_DOCUMENT) if (eventType != XMLStreamConstants.START_DOCUMENT
&& !(eventType == XMLStreamConstants.START_ELEMENT)) { && eventType != XMLStreamConstants.START_ELEMENT) {
throw new IllegalStateException(); throw new IllegalStateException();
} }

View file

@ -28,6 +28,7 @@ public class StaxStreamContentHandler extends AbstractStaxContentHandler {
@Override @Override
public void setDocumentLocator(Locator locator) { public void setDocumentLocator(Locator locator) {
// not used
} }
@Override @Override
@ -57,6 +58,7 @@ public class StaxStreamContentHandler extends AbstractStaxContentHandler {
@Override @Override
protected void skippedEntityInternal(String name) { protected void skippedEntityInternal(String name) {
// not used
} }
@Override @Override

View file

@ -18,7 +18,7 @@ public abstract class StreamWriterDelegate implements XMLStreamWriter {
} }
@Override @Override
public Object getProperty(String name) throws IllegalArgumentException { public Object getProperty(String name) {
return out.getProperty(name); return out.getProperty(name);
} }

View file

@ -83,7 +83,7 @@ public class XMLFilterImplEx extends XMLFilterImpl implements LexicalHandler {
} }
@Override @Override
public void comment(char ch[], int start, int length) throws SAXException { public void comment(char[] ch, int start, int length) throws SAXException {
if (lexicalHandler != null) { if (lexicalHandler != null) {
lexicalHandler.comment(ch, start, length); lexicalHandler.comment(ch, start, length);
} }

View file

@ -324,29 +324,38 @@ public class XMLStreamReaderToContentHandler {
} }
private void handleNamespace() { private void handleNamespace() {
// not used
} }
private void handleAttribute() { private void handleAttribute() {
// not used
} }
private void handleDTD() { private void handleDTD() {
// not used
} }
private void handleComment() { private void handleComment() {
// not used
} }
private void handleEntityReference() { private void handleEntityReference() {
// not used
} }
private void handleSpace() { private void handleSpace() {
// not used
} }
private void handleNotationDecl() { private void handleNotationDecl() {
// not used
} }
private void handleEntityDecl() { private void handleEntityDecl() {
// not used
} }
private void handleCDATA() { private void handleCDATA() {
// not used
} }
} }

View file

@ -1,12 +0,0 @@
package org.xbib.content.xml.transform;
import java.io.IOException;
/**
* A callback listener for providing information about the content type and encoding of
* the output.
*/
public interface ContentTypeListener {
void setContentType(String contentType, String encoding) throws IOException;
}

View file

@ -37,7 +37,7 @@ public class StylesheetTransformer implements Closeable {
private static final StylesheetPool pool = new StylesheetPool(); private static final StylesheetPool pool = new StylesheetPool();
private final Map<String, Object> parameters = new HashMap<String, Object>(); private final Map<String, Object> parameters = new HashMap<>();
private SAXTransformerFactory transformerFactory; private SAXTransformerFactory transformerFactory;

View file

@ -89,7 +89,7 @@ public class ISO9075 {
StringBuilder decoded = new StringBuilder(); StringBuilder decoded = new StringBuilder();
for (int i = 0, l = toDecode.length(); i < l; i++) { for (int i = 0, l = toDecode.length(); i < l; i++) {
if (matchesEncodedPattern(toDecode, i)) { if (matchesEncodedPattern(toDecode, i)) {
decoded.append(((char) Integer.parseInt(toDecode.substring(i + 2, i + 6), 16))); decoded.append((char) Integer.parseInt(toDecode.substring(i + 2, i + 6), 16));
i += 6; i += 6;
} else { } else {
decoded.append(toDecode.charAt(i)); decoded.append(toDecode.charAt(i));

View file

@ -8,6 +8,9 @@ import javax.xml.namespace.QName;
*/ */
public class ToQName { public class ToQName {
private ToQName() {
}
public static QName toQName(QName root, NamespaceContext context, String string) { public static QName toQName(QName root, NamespaceContext context, String string) {
String name = string; String name = string;
String nsPrefix = root.getPrefix(); String nsPrefix = root.getPrefix();