remove java.util.logging from core, json, yaml, settings

This commit is contained in:
Jörg Prante 2020-05-07 20:07:21 +02:00
parent 0e37917c47
commit 00639d970b
23 changed files with 43 additions and 136 deletions

View file

@ -20,16 +20,12 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* *
*/ */
public final class XContentBuilder implements ToXContent, Flushable, Closeable { public final class XContentBuilder implements ToXContent, Flushable, Closeable {
private static final Logger logger = Logger.getLogger(XContentBuilder.class.getName());
private final OutputStream outputStream; private final OutputStream outputStream;
private final XContentGenerator generator; private final XContentGenerator generator;
@ -802,12 +798,8 @@ public final class XContentBuilder implements ToXContent, Flushable, Closeable {
generator.close(); generator.close();
} }
public BytesReference bytes() { public BytesReference bytes() throws IOException {
try { generator.close();
generator.close();
} catch (IOException e) {
logger.log(Level.FINE, e.getMessage(), e);
}
return ((BytesStreamOutput) outputStream).bytes(); return ((BytesStreamOutput) outputStream).bytes();
} }
@ -815,8 +807,9 @@ public final class XContentBuilder implements ToXContent, Flushable, Closeable {
* Returns a string representation of the builder (only applicable for text based xcontent). * Returns a string representation of the builder (only applicable for text based xcontent).
* Only applicable when the builder is constructed with {@link BytesStreamOutput}. * Only applicable when the builder is constructed with {@link BytesStreamOutput}.
* @return string * @return string
* @throws IOException if string can not be converted to UTF-8
*/ */
public String string() { public String string() throws IOException {
return bytes().toUtf8(); return bytes().toUtf8();
} }

View file

@ -7,16 +7,12 @@ import java.io.IOException;
import java.io.Reader; import java.io.Reader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* *
*/ */
public class XContentHelper { public class XContentHelper {
private static final Logger logger = Logger.getLogger(XContentHelper.class.getName());
private static final String UNKNOWN_FORMAT = "unknown format"; private static final String UNKNOWN_FORMAT = "unknown format";
private XContentHelper() { private XContentHelper() {
@ -169,7 +165,6 @@ public class XContentHelper {
try { try {
generator.writeBinary(parseBase16(parser.text())); generator.writeBinary(parseBase16(parser.text()));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
logger.log(Level.FINE, e.getMessage(), e);
generator.writeString(parser.text()); generator.writeString(parser.text());
} }
} else { } else {

View file

@ -8,37 +8,23 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.ServiceLoader; import java.util.ServiceLoader;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* *
*/ */
public class XContentService { public class XContentService {
private static final Logger logger = Logger.getLogger(XContentService.class.getName());
private static final Map<String, XContent> xcontents = new HashMap<>(); private static final Map<String, XContent> xcontents = new HashMap<>();
private static final XContentService instance = new XContentService(); static {
ServiceLoader<XContent> loader = ServiceLoader.load(XContent.class);
private XContentService() { for (XContent xContent : loader) {
try { if (!xcontents.containsKey(xContent.name())) {
ServiceLoader<XContent> loader = ServiceLoader.load(XContent.class); xcontents.put(xContent.name(), xContent);
for (XContent xContent : loader) {
if (!xcontents.containsKey(xContent.name())) {
xcontents.put(xContent.name(), xContent);
}
} }
} catch (Exception e) {
logger.log(Level.SEVERE, e.getMessage(), e);
} }
} }
public static XContentService getInstance() {
return instance;
}
public static XContentBuilder builder(String name) throws IOException { public static XContentBuilder builder(String name) throws IOException {
return xcontents.containsKey(name) ? XContentBuilder.builder(xcontents.get(name)) : null; return xcontents.containsKey(name) ? XContentBuilder.builder(xcontents.get(name)) : null;
} }
@ -59,5 +45,4 @@ public class XContentService {
} }
return null; return null;
} }
} }

View file

@ -30,21 +30,17 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* *
*/ */
public class Settings implements AutoCloseable { public class Settings implements AutoCloseable {
private static final Logger logger = Logger.getLogger(Settings.class.getName());
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 * 4;
private DefaultSettingsRefresher refresher; private DefaultSettingsRefresher refresher;
@ -621,7 +617,8 @@ public class Settings implements AutoCloseable {
* @return builder * @return builder
*/ */
public Builder loadFromString(String source) { public Builder loadFromString(String source) {
SettingsLoader settingsLoader = SettingsLoaderService.loaderFromString(source); SettingsLoaderService settingsLoaderService = new SettingsLoaderService();
SettingsLoader settingsLoader = settingsLoaderService.loaderFromString(source);
try { try {
Map<String, String> loadedSettings = settingsLoader.load(source); Map<String, String> loadedSettings = settingsLoader.load(source);
put(loadedSettings); put(loadedSettings);
@ -666,7 +663,8 @@ public class Settings implements AutoCloseable {
* @return builder * @return builder
*/ */
public Builder loadFromStream(String resourceName, InputStream inputStream) throws SettingsException { public Builder loadFromStream(String resourceName, InputStream inputStream) throws SettingsException {
SettingsLoader settingsLoader = SettingsLoaderService.loaderFromResource(resourceName); SettingsLoaderService settingsLoaderService = new SettingsLoaderService();
SettingsLoader settingsLoader = settingsLoaderService.loaderFromResource(resourceName);
try { try {
Map<String, String> loadedSettings = settingsLoader Map<String, String> loadedSettings = settingsLoader
.load(copyToString(new InputStreamReader(inputStream, StandardCharsets.UTF_8))); .load(copyToString(new InputStreamReader(inputStream, StandardCharsets.UTF_8)));
@ -725,7 +723,6 @@ public class Settings implements AutoCloseable {
try { try {
return DateTimeFormatter.ofPattern(placeholderName).format(LocalDate.now()); return DateTimeFormatter.ofPattern(placeholderName).format(LocalDate.now());
} catch (IllegalArgumentException | DateTimeException e) { } catch (IllegalArgumentException | DateTimeException e) {
logger.log(Level.FINER, e.getMessage(), e);
return map.get(placeholderName); return map.get(placeholderName);
} }
} }
@ -759,11 +756,14 @@ public class Settings implements AutoCloseable {
private final AtomicBoolean closed; private final AtomicBoolean closed;
private final SettingsLoaderService settingsLoaderService;
DefaultSettingsRefresher(Path path, long initialDelay, long period, TimeUnit timeUnit) { DefaultSettingsRefresher(Path path, long initialDelay, long period, TimeUnit timeUnit) {
this.path = path; this.path = path;
this.executorService = Executors.newSingleThreadScheduledExecutor(); this.executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleAtFixedRate(this, initialDelay, period, timeUnit); executorService.scheduleAtFixedRate(this, initialDelay, period, timeUnit);
this.closed = new AtomicBoolean(); this.closed = new AtomicBoolean();
this.settingsLoaderService = new SettingsLoaderService();
} }
@Override @Override
@ -771,7 +771,7 @@ public class Settings implements AutoCloseable {
try { try {
if (!closed.get()) { if (!closed.get()) {
String settingsSource = Files.readString(path); String settingsSource = Files.readString(path);
SettingsLoader settingsLoader = SettingsLoaderService.loaderFromResource(path.toString()); SettingsLoader settingsLoader = settingsLoaderService.loaderFromResource(path.toString());
map = settingsLoader.load(settingsSource); map = settingsLoader.load(settingsSource);
} }
} catch (IOException e) { } catch (IOException e) {

View file

@ -6,41 +6,30 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.ServiceLoader; import java.util.ServiceLoader;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* A settings loader service for loading {@link SettingsLoader} implementations. * A settings loader service for loading {@link SettingsLoader} implementations.
*/ */
public final class SettingsLoaderService { public final class SettingsLoaderService {
private static final Logger logger = Logger.getLogger(SettingsLoaderService.class.getName()); private final Map<Set<String>, SettingsLoader> settingsLoaderMap;
private static final Map<Set<String>, SettingsLoader> settingsLoaderMap; public SettingsLoaderService() {
this.settingsLoaderMap = new HashMap<>();
static { ServiceLoader<SettingsLoader> serviceLoader = ServiceLoader.load(SettingsLoader.class);
settingsLoaderMap = new HashMap<>(); for (SettingsLoader settingsLoader : serviceLoader) {
try { if (!settingsLoaderMap.containsKey(settingsLoader.suffixes())) {
ServiceLoader<SettingsLoader> serviceLoader = ServiceLoader.load(SettingsLoader.class); settingsLoaderMap.put(settingsLoader.suffixes(), settingsLoader);
for (SettingsLoader settingsLoader : serviceLoader) {
if (!settingsLoaderMap.containsKey(settingsLoader.suffixes())) {
settingsLoaderMap.put(settingsLoader.suffixes(), settingsLoader);
}
} }
} catch (Exception e) {
logger.log(Level.SEVERE, e.getMessage(), e);
} }
} }
private SettingsLoaderService() {
}
/** /**
* Returns a {@link SettingsLoader} based on the resource name. * Returns a {@link SettingsLoader} based on the resource name.
* @param resourceName the resource * @param resourceName the resource
* @return the settings loader * @return the settings loader
*/ */
public static SettingsLoader loaderFromResource(String resourceName) { public SettingsLoader loaderFromResource(String resourceName) {
for (Map.Entry<Set<String>, SettingsLoader> entry : settingsLoaderMap.entrySet()) { for (Map.Entry<Set<String>, SettingsLoader> entry : settingsLoaderMap.entrySet()) {
Set<String> suffixes = entry.getKey(); Set<String> suffixes = entry.getKey();
for (String suffix : suffixes) { for (String suffix : suffixes) {
@ -57,7 +46,7 @@ public final class SettingsLoaderService {
* @param source the source * @param source the source
* @return the settings loader * @return the settings loader
*/ */
public static SettingsLoader loaderFromString(String source) { public SettingsLoader loaderFromString(String source) {
for (SettingsLoader loader : settingsLoaderMap.values()) { for (SettingsLoader loader : settingsLoaderMap.values()) {
if (loader.canLoad(source)) { if (loader.canLoad(source)) {
return loader; return loader;

View file

@ -20,15 +20,12 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
/** /**
* *
*/ */
public class SettingsTest extends Assert { public class SettingsTest extends Assert {
private static final Logger logger = Logger.getLogger(SettingsTest.class.getName());
@Test @Test
public void testEmpty() { public void testEmpty() {
Settings settings = Settings.EMPTY_SETTINGS; Settings settings = Settings.EMPTY_SETTINGS;
@ -60,7 +57,6 @@ public class SettingsTest extends Assert {
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
list.add((Map<String, Object>) entry.getValue()); list.add((Map<String, Object>) entry.getValue());
} }
logger.info(list.toString());
assertEquals("[{name=Name 0, code=Code 0}, {name=Name 1, code=Code 1}]", list.toString()); assertEquals("[{name=Name 0, code=Code 0}, {name=Name 1, code=Code 1}]", list.toString());
} }

View file

@ -14,8 +14,6 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* Utility class for Jackson. * Utility class for Jackson.
@ -27,8 +25,6 @@ import java.util.logging.Logger;
*/ */
public final class JacksonUtils { public final class JacksonUtils {
private static final Logger logger = Logger.getLogger(JacksonUtils.class.getName());
private static final JsonNodeFactory FACTORY = JsonNodeFactory.instance; private static final JsonNodeFactory FACTORY = JsonNodeFactory.instance;
private static final ObjectReader READER; private static final ObjectReader READER;
@ -91,17 +87,11 @@ public final class JacksonUtils {
* *
* @param node the JSON value to print * @param node the JSON value to print
* @return the pretty printed value as a string * @return the pretty printed value as a string
* @see #newMapper() * @throws IOException if writing as UTF-8 fails
*/ */
public static String prettyPrint(final JsonNode node) { public static String prettyPrint(final JsonNode node) throws IOException {
final StringWriter writer = new StringWriter(); final StringWriter writer = new StringWriter();
WRITER.writeValue(writer, node);
try {
WRITER.writeValue(writer, node);
writer.flush();
} catch (IOException e) {
logger.log(Level.FINE, e.getMessage(), e);
}
return writer.toString(); return writer.toString();
} }

View file

@ -11,8 +11,6 @@ import com.fasterxml.jackson.databind.ObjectReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.Reader; import java.io.Reader;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* Class dedicated to reading JSON values from {@link java.io.InputStream}s and {@link * Class dedicated to reading JSON values from {@link java.io.InputStream}s and {@link
@ -33,8 +31,6 @@ import java.util.logging.Logger;
*/ */
public final class JsonNodeReader { public final class JsonNodeReader {
private static final Logger logger = Logger.getLogger(JsonNodeReader.class.getName());
private final ObjectReader reader; private final ObjectReader reader;
public JsonNodeReader(final ObjectMapper mapper) { public JsonNodeReader(final ObjectMapper mapper) {
@ -59,7 +55,6 @@ public final class JsonNodeReader {
throw builder.build(); throw builder.build();
} }
} catch (JsonParseException e) { } catch (JsonParseException e) {
logger.log(Level.FINE, e.getMessage(), e);
throw builder.setLocation(e.getLocation()).build(); throw builder.setLocation(e.getLocation()).build();
} }
return ret; return ret;

View file

@ -6,8 +6,6 @@ import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -16,8 +14,6 @@ import java.util.regex.Pattern;
*/ */
public final class Lang extends SubtagSet { public final class Lang extends SubtagSet {
private static final Logger logger = Logger.getLogger(Lang.class.getName());
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})"; 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})";
private static final String SCRIPT = "((?:[-_][a-zA-Z]{4})?)"; private static final String SCRIPT = "((?:[-_][a-zA-Z]{4})?)";
private static final String REGION = "((?:[-_](?:(?:[a-zA-Z]{2})|(?:[0-9]{3})))?)"; private static final String REGION = "((?:[-_](?:(?:[a-zA-Z]{2})|(?:[0-9]{3})))?)";
@ -69,7 +65,6 @@ public final class Lang extends SubtagSet {
try { try {
return parse(locale.toString()).primary; return parse(locale.toString()).primary;
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.FINE, e.getMessage(), e);
Subtag c = null; Subtag c = null;
Subtag primary = new Subtag(Type.PRIMARY, locale.getLanguage()); Subtag primary = new Subtag(Type.PRIMARY, locale.getLanguage());
String country = locale.getCountry(); String country = locale.getCountry();

View file

@ -116,14 +116,14 @@ public class RdfXContentGenerator<P extends RdfXContentParams> implements RdfCon
return this; return this;
} }
public String string() { public String string() throws IOException {
if (builder != null) { if (builder != null) {
return builder.string(); return builder.string();
} }
return null; return null;
} }
public String get() { public String get() throws IOException {
return string(); return string();
} }

View file

@ -14,8 +14,6 @@ import java.net.MalformedURLException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -24,8 +22,6 @@ import java.util.regex.Pattern;
*/ */
public class IRI implements Comparable<IRI>, Node { public class IRI implements Comparable<IRI>, Node {
private static final Logger logger = Logger.getLogger(IRI.class.getName());
private static final SchemeRegistry registry = SchemeRegistry.getInstance(); private static final SchemeRegistry registry = SchemeRegistry.getInstance();
private static final Pattern IRIPATTERN = private static final Pattern IRIPATTERN =
Pattern.compile("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?"); Pattern.compile("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?");
@ -202,7 +198,7 @@ public class IRI implements Comparable<IRI>, Node {
try { try {
buf.append(PercentEncoders.getMatrixEncoder(StandardCharsets.UTF_8).encode(percentDecoder.decode(segment))); buf.append(PercentEncoders.getMatrixEncoder(StandardCharsets.UTF_8).encode(percentDecoder.decode(segment)));
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.FINE, e.getMessage(), e); //logger.log(Level.FINE, e.getMessage(), e);
} }
} }
} }
@ -431,7 +427,7 @@ public class IRI implements Comparable<IRI>, Node {
try { try {
asciiFragment = PercentEncoders.getFragmentEncoder(StandardCharsets.UTF_8).encode(fragment); asciiFragment = PercentEncoders.getFragmentEncoder(StandardCharsets.UTF_8).encode(fragment);
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.FINE, e.getMessage(), e); //logger.log(Level.FINE, e.getMessage(), e);
} }
} }
return asciiFragment; return asciiFragment;
@ -442,7 +438,7 @@ public class IRI implements Comparable<IRI>, Node {
try { try {
asciiPath = PercentEncoders.getPathEncoder(StandardCharsets.UTF_8).encode(path); asciiPath = PercentEncoders.getPathEncoder(StandardCharsets.UTF_8).encode(path);
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.FINE, e.getMessage(), e); //logger.log(Level.FINE, e.getMessage(), e);
} }
} }
return asciiPath; return asciiPath;
@ -453,7 +449,7 @@ public class IRI implements Comparable<IRI>, Node {
try { try {
asciiQuery = PercentEncoders.getQueryEncoder(StandardCharsets.UTF_8).encode(query); asciiQuery = PercentEncoders.getQueryEncoder(StandardCharsets.UTF_8).encode(query);
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.FINE, e.getMessage(), e); //logger.log(Level.FINE, e.getMessage(), e);
} }
} }
return asciiQuery; return asciiQuery;
@ -464,7 +460,7 @@ public class IRI implements Comparable<IRI>, Node {
try { try {
asciiUserinfo = PercentEncoders.getUnreservedEncoder(StandardCharsets.UTF_8).encode(userinfo); asciiUserinfo = PercentEncoders.getUnreservedEncoder(StandardCharsets.UTF_8).encode(userinfo);
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.FINE, e.getMessage(), e); //logger.log(Level.FINE, e.getMessage(), e);
} }
} }
return asciiUserinfo; return asciiUserinfo;
@ -527,7 +523,7 @@ public class IRI implements Comparable<IRI>, Node {
try { try {
return PercentEncoders.getUnreservedEncoder(StandardCharsets.UTF_8).encode(toString()); return PercentEncoders.getUnreservedEncoder(StandardCharsets.UTF_8).encode(toString());
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.FINE, e.getMessage(), e); //logger.log(Level.FINE, e.getMessage(), e);
return null; return null;
} }
} }

View file

@ -6,16 +6,12 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* *
*/ */
public final class IRINamespaceContext extends XmlNamespaceContext { public final class IRINamespaceContext extends XmlNamespaceContext {
private static final Logger logger = Logger.getLogger(IRINamespaceContext.class.getName());
/** /**
* Share namespace.properties with {@link XmlNamespaceContext}. * Share namespace.properties with {@link XmlNamespaceContext}.
*/ */
@ -49,7 +45,6 @@ public final class IRINamespaceContext extends XmlNamespaceContext {
try { try {
instance = new IRINamespaceContext(ResourceBundle.getBundle(bundleName, locale, classLoader)); instance = new IRINamespaceContext(ResourceBundle.getBundle(bundleName, locale, classLoader));
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
logger.log(Level.FINE, e.getMessage(), e);
instance = new IRINamespaceContext(); instance = new IRINamespaceContext();
} }
} }

View file

@ -9,8 +9,6 @@ import java.util.ResourceBundle;
import java.util.Set; import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.NamespaceContext;
@ -19,8 +17,6 @@ import javax.xml.namespace.NamespaceContext;
*/ */
public class XmlNamespaceContext implements NamespaceContext { public class XmlNamespaceContext implements NamespaceContext {
private static final Logger logger = Logger.getLogger(XmlNamespaceContext.class.getName());
private static final String DEFAULT_RESOURCE = private static final String DEFAULT_RESOURCE =
XmlNamespaceContext.class.getPackage().getName().replace('.', '/') + '/' + "namespace"; XmlNamespaceContext.class.getPackage().getName().replace('.', '/') + '/' + "namespace";
@ -79,7 +75,6 @@ public class XmlNamespaceContext implements NamespaceContext {
try { try {
return new XmlNamespaceContext(ResourceBundle.getBundle(bundleName, locale, classLoader)); return new XmlNamespaceContext(ResourceBundle.getBundle(bundleName, locale, classLoader));
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
logger.log(Level.WARNING, e.getMessage(), e);
return new XmlNamespaceContext(); return new XmlNamespaceContext();
} }
} }

View file

@ -2,15 +2,12 @@ package org.xbib.content.resource.text;
import java.util.Iterator; import java.util.Iterator;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* Provides an iterator over Unicode Codepoints. * Provides an iterator over Unicode Codepoints.
*/ */
public abstract class CodepointIterator implements Iterator<Codepoint> { public abstract class CodepointIterator implements Iterator<Codepoint> {
private static final Logger logger = Logger.getLogger(CodepointIterator.class.getName());
protected int position = -1; protected int position = -1;
protected int limit = -1; protected int limit = -1;
@ -346,7 +343,6 @@ public abstract class CodepointIterator implements Iterator<Codepoint> {
return false; return false;
} }
} catch (InvalidCharacterException e) { } catch (InvalidCharacterException e) {
logger.log(Level.FINE, e.getMessage(), e);
return false; return false;
} }
} }

View file

@ -5,13 +5,11 @@ import org.junit.Test;
import org.xbib.content.XContentBuilder; import org.xbib.content.XContentBuilder;
import org.xbib.content.XContentHelper; import org.xbib.content.XContentHelper;
import org.xbib.content.resource.XmlNamespaceContext; import org.xbib.content.resource.XmlNamespaceContext;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Map; import java.util.Map;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
/** /**

View file

@ -2,11 +2,9 @@ package org.xbib.content.xml;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.junit.Test; import org.junit.Test;
import org.xbib.content.XContentBuilder; import org.xbib.content.XContentBuilder;
import org.xbib.content.resource.XmlNamespaceContext; import org.xbib.content.resource.XmlNamespaceContext;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
/** /**

View file

@ -3,7 +3,6 @@ package org.xbib.content.xml.json;
import org.junit.Test; import org.junit.Test;
import org.xbib.content.resource.XmlNamespaceContext; import org.xbib.content.resource.XmlNamespaceContext;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -13,7 +12,6 @@ import java.io.OutputStreamWriter;
import java.io.Reader; import java.io.Reader;
import java.io.Writer; import java.io.Writer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;

View file

@ -4,12 +4,10 @@ import org.junit.Test;
import org.xbib.content.resource.XmlNamespaceContext; import org.xbib.content.resource.XmlNamespaceContext;
import org.xbib.content.xml.transform.StylesheetTransformer; import org.xbib.content.xml.transform.StylesheetTransformer;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXSource;
@ -20,7 +18,7 @@ public class StylesheetTransformerTest {
private final QName root = new QName("http://example.org", "result", "ex"); private final QName root = new QName("http://example.org", "result", "ex");
private XmlNamespaceContext context = XmlNamespaceContext.newDefaultInstance(); private final XmlNamespaceContext context = XmlNamespaceContext.newDefaultInstance();
@Test @Test
public void testJsonAsXML() throws Exception { public void testJsonAsXML() throws Exception {

View file

@ -3,10 +3,8 @@ package org.xbib.content.xml.util;
import org.junit.Test; import org.junit.Test;
import org.xbib.content.xml.stream.SaxEventConsumer; import org.xbib.content.xml.stream.SaxEventConsumer;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventFactory; import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.events.Attribute; import javax.xml.stream.events.Attribute;

View file

@ -2,7 +2,6 @@ package org.xbib.content.yaml;
import org.xbib.content.XContent; import org.xbib.content.XContent;
import org.xbib.content.settings.AbstractSettingsLoader; import org.xbib.content.settings.AbstractSettingsLoader;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;

View file

@ -7,7 +7,6 @@ import org.xbib.content.XContentBuilder;
import org.xbib.content.XContentGenerator; import org.xbib.content.XContentGenerator;
import org.xbib.content.XContentParser; import org.xbib.content.XContentParser;
import org.xbib.content.io.BytesReference; import org.xbib.content.io.BytesReference;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;

View file

@ -5,7 +5,6 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLParser;
import org.xbib.content.XContent; import org.xbib.content.XContent;
import org.xbib.content.io.BytesReference; import org.xbib.content.io.BytesReference;
import org.xbib.content.json.JsonXContentGenerator; import org.xbib.content.json.JsonXContentGenerator;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;

View file

@ -1,6 +1,6 @@
group = org.xbib group = org.xbib
name = content name = content
version = 2.0.6 version = 2.1.0
xbib-net.version = 2.0.3 xbib-net.version = 2.0.3
jackson.version = 2.9.10 jackson.version = 2.9.10
@ -8,9 +8,9 @@ jackson-databind.version = 2.9.10.1
woodstox.version = 6.0.2 woodstox.version = 6.0.2
# test # test
junit.version = 5.5.2 junit.version = 5.6.2
junit4.version = 4.12 junit4.version = 4.13
hamcrest.version = 2.1 hamcrest.version = 2.2
mockito.version = 3.1.0 mockito.version = 3.1.0
# doc # doc