update to 1.0.2, add sonar, fix execption logging for sonar
This commit is contained in:
parent
0c90731fbc
commit
af0cb88ea6
5 changed files with 23 additions and 8 deletions
|
@ -1,3 +1,6 @@
|
|||
plugins {
|
||||
id "org.sonarqube" version "2.1-rc1"
|
||||
}
|
||||
|
||||
println "Host: " + java.net.InetAddress.getLocalHost()
|
||||
println "Gradle: " + gradle.gradleVersion + " JVM: " + org.gradle.internal.jvm.Jvm.current() + " Groovy: " + GroovySystem.getVersion()
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
group = org.xbib
|
||||
version = 1.0.1
|
||||
version = 1.0.2
|
||||
org.gradle.daemon = true
|
||||
|
|
|
@ -43,6 +43,9 @@ import java.nio.charset.CoderResult;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
/**
|
||||
|
@ -50,6 +53,8 @@ import javax.xml.stream.XMLStreamException;
|
|||
*/
|
||||
public class AnselCharset extends Charset {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AnselCharset.class.getName());
|
||||
|
||||
private static final Map<String, AnselCodeTableParser.CharacterSet> characterSetMap;
|
||||
|
||||
static {
|
||||
|
@ -63,7 +68,8 @@ public class AnselCharset extends Charset {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// sonar wants logging
|
||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +141,8 @@ public class AnselCharset extends Charset {
|
|||
try {
|
||||
w.write(diacritics.toCharArray());
|
||||
} catch (IOException e) {
|
||||
// dummy
|
||||
// sonar wants logging
|
||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
||||
w.flush();
|
||||
}
|
||||
diacritics = new CharArrayWriter();
|
||||
|
|
|
@ -37,6 +37,9 @@ import java.util.Iterator;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
|
@ -49,6 +52,8 @@ import javax.xml.stream.events.XMLEvent;
|
|||
|
||||
class AnselCodeTableParser {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AnselCodeTableParser.class.getName());
|
||||
|
||||
private final List<CodeTable> codeTables;
|
||||
|
||||
private CodeTable codeTable;
|
||||
|
@ -64,8 +69,8 @@ class AnselCodeTableParser {
|
|||
try {
|
||||
codeTables = createCodeTables(inputStream);
|
||||
} catch (XMLStreamException e) {
|
||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
||||
codeTables = null;
|
||||
// ignore
|
||||
}
|
||||
this.codeTables = codeTables;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class BibliographicCharsetProvider extends CharsetProvider {
|
|||
private final String packagePrefix;
|
||||
|
||||
/**
|
||||
* Constructor must be public.
|
||||
* Constructor must be public bevause of ServiceLoader.
|
||||
*/
|
||||
public BibliographicCharsetProvider() {
|
||||
classMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
@ -148,11 +148,11 @@ public class BibliographicCharsetProvider extends CharsetProvider {
|
|||
cache.put(charsetName, new SoftReference<>(charset));
|
||||
return charset;
|
||||
} catch (ClassNotFoundException e1) {
|
||||
logger.log(Level.WARNING, "Class not found: " + packagePrefix + "." + className);
|
||||
logger.log(Level.WARNING, "Class not found: " + packagePrefix + "." + className, e1);
|
||||
} catch (IllegalAccessException e2) {
|
||||
logger.log(Level.WARNING, "Illegal access: " + packagePrefix + "." + className);
|
||||
logger.log(Level.WARNING, "Illegal access: " + packagePrefix + "." + className, e2);
|
||||
} catch (InstantiationException e3) {
|
||||
logger.log(Level.WARNING, "Instantiation failed: " + packagePrefix + "." + className);
|
||||
logger.log(Level.WARNING, "Instantiation failed: " + packagePrefix + "." + className, e3);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue