fixing findbug error, pom descriptor

This commit is contained in:
Jörg Prante 2016-08-19 11:04:46 +02:00
parent 96857df03e
commit 3e7476f0c2
6 changed files with 59 additions and 27 deletions

View file

@ -3,6 +3,7 @@ println "Host: " + java.net.InetAddress.getLocalHost()
println "Gradle: " + gradle.gradleVersion + " JVM: " + org.gradle.internal.jvm.Jvm.current() + " Groovy: " + GroovySystem.getVersion()
println "Build: group: '${project.group}', name: '${project.name}', version: '${project.version}'"
apply from: 'gradle/ext.gradle'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'

View file

@ -1,9 +1,3 @@
group = org.xbib
version = 1.0.0
version = 1.0.1
org.gradle.daemon = true
name = 'bibliographic-character-sets'
description = 'Bibliographic character sets'
user = 'xbib'
scmUrl = 'https://github.com/' + user + '/' + name
scmConnection = 'scm:git:git://github.com/' + user + '/' + name + '.git'
scmDeveloperConnection = 'scm:git:git://github.com/' + user + '/' + name + '.git'

8
gradle/ext.gradle Normal file
View file

@ -0,0 +1,8 @@
ext {
user = 'xbib'
projectName = 'bibliographic-character-sets'
projectDescription = 'Bibliographic character sets'
scmUrl = 'https://github.com/xbib/bibliographic-character-sets'
scmConnection = 'scm:git:git://github.com/xbib/bibliographic-character-sets.git'
scmDeveloperConnection = 'scm:git:git://github.com/xbib/bibliographic-character-sets.git'
}

View file

@ -8,6 +8,40 @@ task xbibUpload(type: Upload) {
repository(url: uri('scpexe://xbib.org/repository')) {
authentication(userName: xbibUsername, privateKey: xbibPrivateKey)
}
snapshotRepository(url: uri('scpexe://xbib.org/repository/snapshots')) {
authentication(userName: xbibUsername, privateKey: xbibPrivateKey)
}
pom.project {
name projectName
description projectDescription
packaging 'jar'
inceptionYear '2016'
url scmUrl
organization {
name 'xbib'
url 'http://xbib.org'
}
developers {
developer {
id user
name 'Jörg Prante'
email 'joergprante@gmail.com'
url 'https://github.com/jprante'
}
}
scm {
url scmUrl
connection scmConnection
developerConnection scmDeveloperConnection
}
licenses {
license {
name 'Affero GNU Public License Version 3'
url 'http://www.gnu.org/licenses/agpl-3.0.html'
}
}
}
}
}
}
@ -27,8 +61,8 @@ task mavenCentralUpload(type: Upload) {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name name
description description
name projectName
description projectDescription
packaging 'jar'
inceptionYear '2016'
url scmUrl

View file

@ -52,7 +52,7 @@ public class BibliographicCharsetProvider extends CharsetProvider {
* If there are no remaining references to this instance,
* the character set will be removed by the garbage collector.
*/
private static volatile SoftReference<BibliographicCharsetProvider> instance = null;
private static volatile BibliographicCharsetProvider instance = new BibliographicCharsetProvider();
private final Map<String, String> classMap;
private final Map<String, String> aliasMap;
private final Map<String, String[]> aliasNameMap;
@ -77,26 +77,16 @@ public class BibliographicCharsetProvider extends CharsetProvider {
charset("PICA", "Pica", new String[]{"Pica", "pica"});
charset("x-PICA", "PicaCharset", new String[]{"x-pica"});
charset("SIMPLE_ANSEL", "SimpleAnselCharset", new String[]{});
instance = new SoftReference<>(this);
}
/**
* List all aliases defined for a character set.
*
* @param s the name of the character set
* @param charsetName the name of the character set
* @return an alias string array
*/
static String[] aliasesFor(String s) {
SoftReference<BibliographicCharsetProvider> softreference = instance;
BibliographicCharsetProvider charsets = null;
if (softreference != null) {
charsets = softreference.get();
}
if (charsets == null) {
charsets = new BibliographicCharsetProvider();
instance = new SoftReference<>(charsets);
}
return charsets.aliases(s);
static String[] aliasesFor(String charsetName) {
return instance.aliasNameMap.get(charsetName);
}
@Override
@ -166,8 +156,4 @@ public class BibliographicCharsetProvider extends CharsetProvider {
}
return null;
}
private String[] aliases(String s) {
return (String[]) aliasNameMap.get(s);
}
}

View file

@ -31,9 +31,12 @@
*/
package org.xbib.charset;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
/**
*
@ -43,10 +46,16 @@ public class BibliographicCharsetsTest {
@Test
public void testAvailability() {
Charset charset = BibliographicCharsets.ANSEL;
assertEquals("hello", new String("hello".getBytes(StandardCharsets.US_ASCII), charset));
charset = BibliographicCharsets.ISO5426;
assertEquals("hello", new String("hello".getBytes(StandardCharsets.US_ASCII), charset));
charset = BibliographicCharsets.ISO5428;
assertEquals("hello", new String("hello".getBytes(StandardCharsets.US_ASCII), charset));
charset = BibliographicCharsets.MAB;
assertEquals("hello", new String("hello".getBytes(StandardCharsets.US_ASCII), charset));
charset = BibliographicCharsets.MAB_DISKETTE;
assertEquals("hello", new String("hello".getBytes(StandardCharsets.US_ASCII), charset));
charset = BibliographicCharsets.PICA;
assertEquals("hello", new String("hello".getBytes(StandardCharsets.US_ASCII), charset));
}
}