sonarqube fixes, set RouteHandler interface to public
This commit is contained in:
parent
cfff322595
commit
7a056ec4aa
50 changed files with 212 additions and 185 deletions
|
@ -14,7 +14,7 @@ ext {
|
|||
allprojects {
|
||||
|
||||
group = 'org.xbib'
|
||||
version = '1.0.2'
|
||||
version = '1.0.3'
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
|
|
|
@ -10,15 +10,6 @@ public interface ToXContent {
|
|||
|
||||
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() {
|
||||
|
||||
|
@ -33,4 +24,14 @@ public interface ToXContent {
|
|||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
interface Params {
|
||||
String param(String key);
|
||||
|
||||
String param(String key, String defaultValue);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,10 +41,10 @@ public class Settings {
|
|||
public static final Settings EMPTY_SETTINGS = new Builder().build();
|
||||
public static final String[] EMPTY_ARRAY = new String[0];
|
||||
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) {
|
||||
this.settings = new HashMap<>(settings);
|
||||
this.map = new HashMap<>(settings);
|
||||
}
|
||||
|
||||
public static Settings readSettingsFromMap(Map<String, Object> map) throws IOException {
|
||||
|
@ -131,27 +131,27 @@ public class Settings {
|
|||
}
|
||||
|
||||
public Map<String, String> getAsMap() {
|
||||
return this.settings;
|
||||
return this.map;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAsStructuredMap() {
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
for (Map.Entry<String, String> entry : settings.entrySet()) {
|
||||
processSetting(map, "", entry.getKey(), entry.getValue());
|
||||
Map<String, Object> stringObjectMap = new HashMap<>(2);
|
||||
for (Map.Entry<String, String> entry : this.map.entrySet()) {
|
||||
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) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> valMap = (Map<String, Object>) entry.getValue();
|
||||
entry.setValue(convertMapsToArrays(valMap));
|
||||
}
|
||||
}
|
||||
return map;
|
||||
return stringObjectMap;
|
||||
}
|
||||
|
||||
public Settings getByPrefix(String prefix) {
|
||||
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().length() < prefix.length()) {
|
||||
continue;
|
||||
|
@ -167,10 +167,10 @@ public class Settings {
|
|||
}
|
||||
|
||||
public boolean containsSetting(String setting) {
|
||||
if (settings.containsKey(setting)) {
|
||||
if (map.containsKey(setting)) {
|
||||
return true;
|
||||
}
|
||||
for (Map.Entry<String, String> entry : settings.entrySet()) {
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
if (entry.getKey().startsWith(setting)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class Settings {
|
|||
}
|
||||
|
||||
public String get(String setting) {
|
||||
String retVal = settings.get(setting);
|
||||
String retVal = map.get(setting);
|
||||
if (retVal != null) {
|
||||
return retVal;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public class Settings {
|
|||
}
|
||||
|
||||
public String get(String setting, String defaultValue) {
|
||||
String retVal = settings.get(setting);
|
||||
String retVal = map.get(setting);
|
||||
return retVal == null ? defaultValue : retVal;
|
||||
}
|
||||
|
||||
|
@ -251,15 +251,15 @@ public class Settings {
|
|||
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);
|
||||
}
|
||||
|
||||
public String[] getAsArray(String settingPrefix) throws SettingsException {
|
||||
public String[] getAsArray(String settingPrefix) {
|
||||
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<>();
|
||||
if (get(settingPrefix) != null) {
|
||||
String[] strings = splitStringByCommaToArray(get(settingPrefix));
|
||||
|
@ -283,14 +283,14 @@ public class Settings {
|
|||
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;
|
||||
if (settingPrefix.charAt(settingPrefix.length() - 1) != '.') {
|
||||
settingPrefix = settingPrefix + ".";
|
||||
}
|
||||
// we don't really care that it might happen twice
|
||||
Map<String, Map<String, String>> map = new LinkedHashMap<>();
|
||||
for (Object o : settings.keySet()) {
|
||||
Map<String, Map<String, String>> hashMap = new LinkedHashMap<>();
|
||||
for (Object o : this.map.keySet()) {
|
||||
String setting = (String) o;
|
||||
if (setting.startsWith(settingPrefix)) {
|
||||
String nameValue = setting.substring(settingPrefix.length());
|
||||
|
@ -302,16 +302,16 @@ public class Settings {
|
|||
}
|
||||
String name = nameValue.substring(0, dotIndex);
|
||||
String value = nameValue.substring(dotIndex + 1);
|
||||
Map<String, String> groupSettings = map.get(name);
|
||||
Map<String, String> groupSettings = hashMap.get(name);
|
||||
if (groupSettings == null) {
|
||||
groupSettings = new LinkedHashMap<>();
|
||||
map.put(name, groupSettings);
|
||||
hashMap.put(name, groupSettings);
|
||||
}
|
||||
groupSettings.put(value, get(setting));
|
||||
}
|
||||
}
|
||||
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())));
|
||||
}
|
||||
return Collections.unmodifiableMap(retVal);
|
||||
|
@ -319,19 +319,12 @@ public class Settings {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Settings that = (Settings) o;
|
||||
return settings != null ? settings.equals(that.settings) : that.settings == null;
|
||||
return this == o || !(o == null || getClass() != o.getClass()) && map.equals(((Settings) o).map);
|
||||
}
|
||||
|
||||
@Override
|
||||
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) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.xbib.content.util.geo;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Utilities for encoding and decoding geohashes. Based on
|
||||
|
@ -81,7 +80,7 @@ public class GeoHashUtils {
|
|||
* @param geohash Geohash of the defined cell
|
||||
* @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));
|
||||
}
|
||||
|
||||
|
@ -93,12 +92,7 @@ public class GeoHashUtils {
|
|||
* @return {@link Iterable} of path
|
||||
*/
|
||||
public static Iterable<String> path(final String geohash) {
|
||||
return new Iterable<String>() {
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
return new GeohashPathIterator(geohash);
|
||||
}
|
||||
};
|
||||
return () -> new GeohashPathIterator(geohash);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,7 @@ public final class GeoPoint {
|
|||
private double lon;
|
||||
|
||||
public GeoPoint() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,9 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
final class DiffFactorizer {
|
||||
|
||||
private static final Equivalence<JsonNode> EQUIVALENCE = JsonNumEquals.getInstance();
|
||||
|
@ -91,7 +94,8 @@ final class DiffFactorizer {
|
|||
private static void findPairs(final List<Diff> diffs) {
|
||||
final int diffsSize = diffs.size();
|
||||
|
||||
Diff addition, removal;
|
||||
Diff addition;
|
||||
Diff removal;
|
||||
|
||||
for (int addIndex = 0; addIndex < diffsSize; addIndex++) {
|
||||
addition = diffs.get(addIndex);
|
||||
|
|
|
@ -358,7 +358,8 @@ public final class JsonDiff {
|
|||
*/
|
||||
private static void postLCS(final List<Diff> diffs, final JsonPointer path,
|
||||
final IndexedJsonArray source, final IndexedJsonArray target) {
|
||||
JsonNode src, dst;
|
||||
JsonNode src;
|
||||
JsonNode dst;
|
||||
|
||||
while (!(source.isEmpty() || target.isEmpty())) {
|
||||
src = source.getElement();
|
||||
|
|
|
@ -103,7 +103,8 @@ final class LeastCommonSubsequence {
|
|||
}
|
||||
|
||||
// return result out of the LCS lengths matrix
|
||||
int x = size1, y = size2;
|
||||
int x = size1;
|
||||
int y = size2;
|
||||
while (x > 0 && y > 0) {
|
||||
if (lengths[x][y] == lengths[x - 1][y]) {
|
||||
x--;
|
||||
|
|
|
@ -48,13 +48,13 @@ public enum NodeType {
|
|||
* Reverse map to find a node type out of this type's name.
|
||||
*/
|
||||
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
|
||||
* #getNodeType(com.fasterxml.jackson.databind.JsonNode)}).
|
||||
*/
|
||||
private static final Map<JsonToken, NodeType> TOKEN_MAP
|
||||
= new EnumMap<JsonToken, NodeType>(JsonToken.class);
|
||||
= new EnumMap<>(JsonToken.class);
|
||||
|
||||
static {
|
||||
TOKEN_MAP.put(JsonToken.START_ARRAY, ARRAY);
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
Equivalence<Object> equivalence = (Equivalence<Object>) this.equivalence;
|
||||
return equivalence.equals(that.equivalence)
|
||||
&& equivalence.equivalent(this.reference, that.reference);
|
||||
Equivalence<Object> equiv = (Equivalence<Object>) this.equivalence;
|
||||
return equiv.equals(that.equivalence)
|
||||
&& equiv.equivalent(this.reference, that.reference);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.xbib.content.json.patch;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
||||
|
@ -32,8 +31,7 @@ public abstract class DualPathOperation extends JsonPatchOperation {
|
|||
|
||||
@Override
|
||||
public final void serialize(final JsonGenerator jgen,
|
||||
final SerializerProvider provider)
|
||||
throws IOException, JsonProcessingException {
|
||||
final SerializerProvider provider) throws IOException {
|
||||
jgen.writeStartObject();
|
||||
jgen.writeStringField("op", op);
|
||||
jgen.writeStringField("path", path.toString());
|
||||
|
@ -44,7 +42,7 @@ public abstract class DualPathOperation extends JsonPatchOperation {
|
|||
@Override
|
||||
public final void serializeWithType(final JsonGenerator jgen,
|
||||
final SerializerProvider provider, final TypeSerializer typeSer)
|
||||
throws IOException, JsonProcessingException {
|
||||
throws IOException {
|
||||
serialize(jgen, provider);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.xbib.content.json.patch;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
@ -46,7 +45,7 @@ public abstract class PathValueOperation
|
|||
@Override
|
||||
public final void serializeWithType(final JsonGenerator jgen,
|
||||
final SerializerProvider provider, final TypeSerializer typeSer)
|
||||
throws IOException, JsonProcessingException {
|
||||
throws IOException {
|
||||
serialize(jgen, provider);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,8 @@ public final class Lang extends SubtagSet {
|
|||
return parse(locale.toString()).primary;
|
||||
} catch (Exception 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 variant = locale.getVariant();
|
||||
if (country != null) {
|
||||
|
@ -344,7 +345,8 @@ public final class Lang extends SubtagSet {
|
|||
public Lang canonicalize() {
|
||||
Subtag primary = null;
|
||||
Subtag current;
|
||||
int p = -1, t = -1;
|
||||
int p = -1;
|
||||
int t = -1;
|
||||
List<Subtag> tags = new LinkedList<>();
|
||||
for (Subtag tag : this) {
|
||||
tags.add(tag);
|
||||
|
|
|
@ -14,9 +14,9 @@ import java.util.regex.Pattern;
|
|||
*/
|
||||
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 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 String LANGUAGE =
|
||||
"((?:[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);
|
||||
}
|
||||
}
|
||||
Subtag primary = null, current = null;
|
||||
Subtag primary = null;
|
||||
Subtag current = null;
|
||||
for (Subtag tag : list) {
|
||||
tag.setNext(null);
|
||||
tag.setPrevious(null);
|
||||
|
|
|
@ -173,6 +173,7 @@ public final class Subtag implements Comparable<Subtag> {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (type) {
|
||||
case REGION:
|
||||
|
@ -184,6 +185,7 @@ public final class Subtag implements Comparable<Subtag> {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
|
@ -192,6 +194,7 @@ public final class Subtag implements Comparable<Subtag> {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
|
@ -345,6 +348,7 @@ public final class Subtag implements Comparable<Subtag> {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Subtag o) {
|
||||
int c = o.type.compareTo(type);
|
||||
return c != 0 ? c : o.name.compareTo(name);
|
||||
|
|
|
@ -6,6 +6,9 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class SubtagSet implements Cloneable, Iterable<Subtag>, Comparable<SubtagSet> {
|
||||
|
||||
protected final Subtag primary;
|
||||
|
|
|
@ -8,24 +8,24 @@ public interface RDF {
|
|||
String NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
||||
String BNODE_PREFIX = "_:";
|
||||
String SHORTENABLE_BNODE_SUFFIX = "sbl";
|
||||
String PROPERTY = NS + "Property";
|
||||
String PROPERTY_ELEMENT = NS + "Property";
|
||||
String XML_LITERAL = NS + "XMLLiteral";
|
||||
String TYPE = NS + "type";
|
||||
String VALUE = NS + "value";
|
||||
String ALT = NS + "Alt";
|
||||
String BAG = NS + "Bag";
|
||||
String SEQ = NS + "Seq";
|
||||
String LIST = NS + "List";
|
||||
String ALT_ELEMENT = NS + "Alt";
|
||||
String BAG_ELEMENT = NS + "Bag";
|
||||
String SEQ_ELEMENT = NS + "Seq";
|
||||
String LIST_ELEMENT = NS + "List";
|
||||
String FIRST = NS + "first";
|
||||
String NIL = NS + "nil";
|
||||
String REST = NS + "rest";
|
||||
String STATEMENT = NS + "Statement";
|
||||
String STATEMENT_ELEMENT = NS + "Statement";
|
||||
String OBJECT = NS + "object";
|
||||
String PREDICATE = NS + "predicate";
|
||||
String SUBJECT = NS + "subject";
|
||||
String DESCRIPTION = NS + "Description";
|
||||
String DESCRIPTION_ELEMENT = NS + "Description";
|
||||
String ID = NS + "ID";
|
||||
String RDF = NS + "RDF";
|
||||
String RDF_ELEMENT = NS + "RDF";
|
||||
String ABOUT = NS + "about";
|
||||
String DATATYPE = NS + "datatype";
|
||||
String LI = NS + "li";
|
||||
|
|
|
@ -19,6 +19,9 @@ import java.io.OutputStream;
|
|||
*/
|
||||
public class RdfContentFactory {
|
||||
|
||||
private RdfContentFactory() {
|
||||
}
|
||||
|
||||
public static RdfContentBuilder<NTripleContentParams> ntripleBuilder() throws IOException {
|
||||
return NTripleContent.contentBuilder(NTripleContentParams.N_TRIPLE_CONTENT_PARAMS);
|
||||
}
|
||||
|
@ -67,7 +70,7 @@ public class RdfContentFactory {
|
|||
|
||||
public static RdfContentBuilder<TurtleContentParams> turtleBuilder(OutputStream out, TurtleContentParams params)
|
||||
throws IOException {
|
||||
return TurtleContent.contentBuilder(out, TurtleContentParams.TURTLE_CONTENT_PARAMS);
|
||||
return TurtleContent.contentBuilder(out, params);
|
||||
}
|
||||
|
||||
public static RdfContentBuilder<XmlContentParams> xmlBuilder() throws IOException {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class RouteRdfXContent implements RdfContent<RouteRdfXContentParams> {
|
|||
*
|
||||
*/
|
||||
@FunctionalInterface
|
||||
interface RouteHandler {
|
||||
public interface RouteHandler {
|
||||
void complete(String content, RouteRdfXContentParams params) throws IOException;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class DefaultRdfGraph implements RdfGraph<RdfGraphParams> {
|
|||
// nothing to do here
|
||||
}
|
||||
|
||||
private Resource expand(Resource resource) {
|
||||
public Resource expand(Resource resource) {
|
||||
Resource expanded = new DefaultResource(resource.id());
|
||||
new GraphTriples(resource).triples.forEach(expanded::add);
|
||||
return expanded;
|
||||
|
@ -166,5 +166,4 @@ public class DefaultRdfGraph implements RdfGraph<RdfGraphParams> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@ import org.xbib.content.rdf.RdfConstants;
|
|||
import org.xbib.content.rdf.Resource;
|
||||
import org.xbib.content.rdf.Triple;
|
||||
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.IRINamespaceContext;
|
||||
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.util.ArrayList;
|
||||
|
@ -231,7 +231,7 @@ public class DefaultResource implements Resource, Comparable<Resource>, XSDResou
|
|||
if (object instanceof Map) {
|
||||
add(predicate, (Map) object);
|
||||
} else if (object instanceof List) {
|
||||
add(predicate, ((List) object));
|
||||
add(predicate, (List) object);
|
||||
} else if (object instanceof Resource) {
|
||||
add(predicate, (Resource) object);
|
||||
} else {
|
||||
|
@ -251,7 +251,7 @@ public class DefaultResource implements Resource, Comparable<Resource>, XSDResou
|
|||
if (obj instanceof Map) {
|
||||
r.add(newPredicate(pred), (Map<Object, Object>) obj);
|
||||
} else if (obj instanceof List) {
|
||||
r.add(newPredicate(pred), ((List) obj));
|
||||
r.add(newPredicate(pred), (List) obj);
|
||||
} else if (obj instanceof Resource) {
|
||||
r.add(newPredicate(pred), (Resource) obj);
|
||||
} else {
|
||||
|
@ -311,7 +311,7 @@ public class DefaultResource implements Resource, Comparable<Resource>, XSDResou
|
|||
Resource r = newResource(newPredicate(pred));
|
||||
r.add((Map) obj);
|
||||
} else if (obj instanceof List) {
|
||||
add(newPredicate(pred), ((List) obj));
|
||||
add(newPredicate(pred), (List) obj);
|
||||
} else if (obj instanceof Resource) {
|
||||
add(newPredicate(pred), (Resource) obj);
|
||||
} else {
|
||||
|
@ -520,22 +520,22 @@ public class DefaultResource implements Resource, Comparable<Resource>, XSDResou
|
|||
|
||||
private static class Triples {
|
||||
|
||||
private final List<Triple> triples;
|
||||
private final List<Triple> tripleList;
|
||||
|
||||
private final boolean recursive;
|
||||
|
||||
Triples(Resource resource, boolean recursive) {
|
||||
this.recursive = recursive;
|
||||
this.triples = unfold(resource);
|
||||
this.tripleList = unfold(resource);
|
||||
}
|
||||
|
||||
Triples(Resource resource, IRI predicate, Literal literal) {
|
||||
this.recursive = true;
|
||||
this.triples = find(resource, predicate, literal);
|
||||
this.tripleList = find(resource, predicate, literal);
|
||||
}
|
||||
|
||||
List<Triple> list() {
|
||||
return triples;
|
||||
return tripleList;
|
||||
}
|
||||
|
||||
private List<Triple> unfold(Resource resource) {
|
||||
|
|
|
@ -45,7 +45,6 @@ public class NTripleContentGenerator
|
|||
|
||||
@Override
|
||||
public NTripleContentGenerator receive(IRI iri) throws IOException {
|
||||
//String compact = params.getNamespaceContext().compact(iri);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,27 +136,6 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
|
|||
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
|
||||
private String getLanguage(Deque<Frame> stack) {
|
||||
String lang = "";
|
||||
|
@ -194,16 +173,6 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
|
|||
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
|
||||
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;
|
||||
}
|
||||
|
||||
// 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() {
|
||||
return new DefaultAnonymousResource("b" + (bn++));
|
||||
|
@ -566,7 +526,7 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
|
|||
String aQn = attrs.getQName(i);
|
||||
IRI aUri = IRI.create(attrs.getURI(i) + attrs.getLocalName(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:")) {
|
||||
if (object == null) {
|
||||
object = blankNode().id();
|
||||
|
@ -666,5 +626,48 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public class XmlContentGenerator implements RdfContentGenerator<XmlContentParams
|
|||
this.writer = writer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlContentParams getParams() {
|
||||
return params;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Collection;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -13,15 +14,15 @@ import java.util.Set;
|
|||
*/
|
||||
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() {
|
||||
this.map = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
public LinkedHashMultiMap(MultiMap<K, V> map) {
|
||||
if (map == null) {
|
||||
throw new IllegalArgumentException("must not be null");
|
||||
}
|
||||
Objects.requireNonNull(map);
|
||||
this.map = new LinkedHashMap<>();
|
||||
for (K k : map.keySet()) {
|
||||
putAll(k, map.get(k));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* Classes for RDF content utilities.
|
||||
*/
|
||||
package org.xbib.content.rdf.util;
|
|
@ -520,8 +520,8 @@ public class IRI implements Comparable<IRI>, Node {
|
|||
}
|
||||
|
||||
public boolean isPathAbsolute() {
|
||||
String path = getPath();
|
||||
return (path != null) && path.length() > 0 && path.charAt(0) == '/';
|
||||
String s = getPath();
|
||||
return s != null && s.length() > 0 && s.charAt(0) == '/';
|
||||
}
|
||||
|
||||
public boolean isSameDocumentReference() {
|
||||
|
@ -545,9 +545,9 @@ public class IRI implements Comparable<IRI>, Node {
|
|||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
String scheme = getScheme();
|
||||
if (scheme != null && !scheme.isEmpty()) {
|
||||
buf.append(scheme).append(':');
|
||||
String s = getScheme();
|
||||
if (s != null && !s.isEmpty()) {
|
||||
buf.append(s).append(':');
|
||||
}
|
||||
buf.append(getSchemeSpecificPart());
|
||||
return buf.toString();
|
||||
|
@ -564,9 +564,9 @@ public class IRI implements Comparable<IRI>, Node {
|
|||
|
||||
public String toASCIIString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
String scheme = getScheme();
|
||||
if (scheme != null && !scheme.isEmpty()) {
|
||||
buf.append(scheme).append(':');
|
||||
String s = getScheme();
|
||||
if (s != null && !s.isEmpty()) {
|
||||
buf.append(s).append(':');
|
||||
}
|
||||
buf.append(getASCIISchemeSpecificPart());
|
||||
return buf.toString();
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class IRINamespaceContext extends XmlNamespaceContext {
|
|||
@Override
|
||||
public void addNamespace(String prefix, String 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
|
||||
Collections.sort(sortedNamespacesByPrefixLength, (s1, s2) -> {
|
||||
Integer l1 = s1.length();
|
||||
|
|
|
@ -116,6 +116,7 @@ public class XmlNamespaceContext implements NamespaceContext {
|
|||
prefixes.get(namespace).iterator() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return namespaces.toString();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public final class SchemeRegistry {
|
|||
private final Map<String, Scheme> schemes;
|
||||
|
||||
SchemeRegistry() {
|
||||
schemes = new HashMap<String, Scheme>();
|
||||
schemes = new HashMap<>();
|
||||
schemes.put(HttpScheme.HTTP_SCHEME_NAME, new HttpScheme());
|
||||
schemes.put(HttpsScheme.HTTPS_SCHEME_NAME, new HttpsScheme());
|
||||
schemes.put(FtpScheme.FTP_SCHEME_NAME, new FtpScheme());
|
||||
|
|
|
@ -6,7 +6,7 @@ package org.xbib.content.resource.text;
|
|||
public class InvalidCharacterException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -3037013255350562940L;
|
||||
private int input;
|
||||
private final int input;
|
||||
|
||||
public InvalidCharacterException(int input) {
|
||||
this.input = input;
|
||||
|
|
|
@ -87,15 +87,6 @@ public final class UrlEncoding {
|
|||
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;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ import java.util.Map;
|
|||
*/
|
||||
public class XmlXContentHelper {
|
||||
|
||||
private XmlXContentHelper() {
|
||||
}
|
||||
|
||||
public static Map<String, Object> convertFromXmlToMap(Reader reader) {
|
||||
try {
|
||||
return XmlXContent.xmlXContent().createParser(reader).mapOrderedAndClose();
|
||||
|
|
|
@ -150,6 +150,8 @@ public class XmlXContentParser extends AbstractXContentParser {
|
|||
return NumberType.BIG_INTEGER;
|
||||
case BIG_DECIMAL:
|
||||
return NumberType.BIG_DECIMAL;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
throw new IllegalStateException("No matching token for number_type [" + numberType + "]");
|
||||
}
|
||||
|
@ -181,6 +183,8 @@ public class XmlXContentParser extends AbstractXContentParser {
|
|||
return Token.END_ARRAY;
|
||||
case VALUE_EMBEDDED_OBJECT:
|
||||
return Token.VALUE_EMBEDDED_OBJECT;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
throw new IllegalStateException("No matching token for json_token [" + token + "]");
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class JsonStaxReader implements XMLStreamReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(String name) throws IllegalArgumentException {
|
||||
public Object getProperty(String name) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ public abstract class JsonReaderXmlEvent {
|
|||
|
||||
public void addAttribute(QName name, String value) {
|
||||
if (null == attributes) {
|
||||
attributes = new LinkedList<JsonReaderXmlEvent.Attribute>();
|
||||
attributes = new LinkedList<>();
|
||||
}
|
||||
attributes.add(new Attribute(name, value));
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ public abstract class AbstractCharactersEvent extends AbstractXMLEvent implement
|
|||
|
||||
@Override
|
||||
public boolean isWhiteSpace() {
|
||||
String data = getData();
|
||||
for (int i = 0, s = data.length(); i < s; i++) {
|
||||
char ch = data.charAt(i);
|
||||
String s1 = getData();
|
||||
for (int i = 0, s = s1.length(); i < s; i++) {
|
||||
char ch = s1.charAt(i);
|
||||
if (ch != ' ' && ch != '\n' && ch != '\t' && ch != '\r') {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ abstract class AbstractStaxContentHandler implements ContentHandler {
|
|||
throws XMLStreamException;
|
||||
|
||||
@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 {
|
||||
charactersInternal(ch, start, length);
|
||||
} catch (XMLStreamException ex) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.xbib.content.xml.stream;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -110,9 +109,6 @@ public abstract class AbstractXMLEvent implements XMLEvent {
|
|||
return getEventType() == START_ELEMENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void writeAsEncodedUnicode(Writer writer) throws XMLStreamException;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringWriter writer = new StringWriter();
|
||||
|
|
|
@ -277,12 +277,15 @@ public class SaxEventConsumer implements XMLEventConsumer {
|
|||
}
|
||||
|
||||
private void handleNamespace() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleAttribute() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleDTD() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleComment(Comment comment) throws XMLStreamException {
|
||||
|
@ -295,17 +298,22 @@ public class SaxEventConsumer implements XMLEventConsumer {
|
|||
}
|
||||
|
||||
private void handleEntityReference() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleSpace() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleNotationDecl() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleEntityDecl() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleCDATA() {
|
||||
// not used
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class StaxEventContentHandler extends AbstractStaxContentHandler {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
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);
|
||||
if (defaultNamespaceUri != null && defaultNamespaceUri.length() > 0) {
|
||||
namespaces.add(eventFactory.createNamespace(defaultNamespaceUri));
|
||||
|
@ -122,7 +122,7 @@ public class StaxEventContentHandler extends AbstractStaxContentHandler {
|
|||
}
|
||||
|
||||
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++) {
|
||||
QName name = toQName(attributes.getURI(i), attributes.getQName(i));
|
||||
if (!("xmlns".equals(name.getLocalPart()) || "xmlns".equals(name.getPrefix()))) {
|
||||
|
@ -134,6 +134,7 @@ public class StaxEventContentHandler extends AbstractStaxContentHandler {
|
|||
|
||||
@Override
|
||||
protected void skippedEntityInternal(String name) throws XMLStreamException {
|
||||
// not used
|
||||
}
|
||||
|
||||
private static class SaxLocation implements Location {
|
||||
|
|
|
@ -74,8 +74,8 @@ public class StaxSource extends SAXSource {
|
|||
}
|
||||
|
||||
int eventType = reader.getEventType();
|
||||
if (!(eventType == XMLStreamConstants.START_DOCUMENT)
|
||||
&& !(eventType == XMLStreamConstants.START_ELEMENT)) {
|
||||
if (eventType != XMLStreamConstants.START_DOCUMENT
|
||||
&& eventType != XMLStreamConstants.START_ELEMENT) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ public class StaxStreamContentHandler extends AbstractStaxContentHandler {
|
|||
|
||||
@Override
|
||||
public void setDocumentLocator(Locator locator) {
|
||||
// not used
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,6 +58,7 @@ public class StaxStreamContentHandler extends AbstractStaxContentHandler {
|
|||
|
||||
@Override
|
||||
protected void skippedEntityInternal(String name) {
|
||||
// not used
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@ public abstract class StreamWriterDelegate implements XMLStreamWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(String name) throws IllegalArgumentException {
|
||||
public Object getProperty(String name) {
|
||||
return out.getProperty(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class XMLFilterImplEx extends XMLFilterImpl implements LexicalHandler {
|
|||
}
|
||||
|
||||
@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) {
|
||||
lexicalHandler.comment(ch, start, length);
|
||||
}
|
||||
|
|
|
@ -324,29 +324,38 @@ public class XMLStreamReaderToContentHandler {
|
|||
}
|
||||
|
||||
private void handleNamespace() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleAttribute() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleDTD() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleComment() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleEntityReference() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleSpace() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleNotationDecl() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleEntityDecl() {
|
||||
// not used
|
||||
}
|
||||
|
||||
private void handleCDATA() {
|
||||
// not used
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -37,7 +37,7 @@ public class StylesheetTransformer implements Closeable {
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public class ISO9075 {
|
|||
StringBuilder decoded = new StringBuilder();
|
||||
for (int i = 0, l = toDecode.length(); i < l; 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;
|
||||
} else {
|
||||
decoded.append(toDecode.charAt(i));
|
||||
|
|
|
@ -8,6 +8,9 @@ import javax.xml.namespace.QName;
|
|||
*/
|
||||
public class ToQName {
|
||||
|
||||
private ToQName() {
|
||||
}
|
||||
|
||||
public static QName toQName(QName root, NamespaceContext context, String string) {
|
||||
String name = string;
|
||||
String nsPrefix = root.getPrefix();
|
||||
|
|
Loading…
Reference in a new issue