[Japi-cvs] SF.net SVN: japi:[1331] libs/argparser/trunk/src/prj/net/sf/japi/io/args
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2009-05-23 19:16:13
|
Revision: 1331
http://japi.svn.sourceforge.net/japi/?rev=1331&view=rev
Author: christianhujer
Date: 2009-05-23 19:16:12 +0000 (Sat, 23 May 2009)
Log Message:
-----------
Fix bugs found by findbugs.
Modified Paths:
--------------
libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
libs/argparser/trunk/src/prj/net/sf/japi/io/args/CharsetDisplaynameComparator.java
libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/ConverterRegistry.java
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java 2009-05-23 16:38:35 UTC (rev 1330)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java 2009-05-23 19:16:12 UTC (rev 1331)
@@ -82,6 +82,7 @@
* @throws UnknownOptionException In case an option was specified that's not supported.
* @throws ArgumentFileNotFoundException in case an argument file was not found.
*/
+ @edu.umd.cs.findbugs.annotations.SuppressWarnings("DM_EXIT")
private ArgParser(@NotNull final Command command, @NotNull final String... args) throws TerminalException, RequiredOptionsMissingException, UnknownOptionException, MissingArgumentException, ArgumentFileNotFoundException {
this.command = command;
commandClass = command.getClass();
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/CharsetDisplaynameComparator.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/CharsetDisplaynameComparator.java 2009-05-23 16:38:35 UTC (rev 1330)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/CharsetDisplaynameComparator.java 2009-05-23 19:16:12 UTC (rev 1331)
@@ -22,6 +22,8 @@
import java.util.Comparator;
import java.util.Locale;
import java.text.Collator;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.Serializable;
import org.jetbrains.annotations.NotNull;
@@ -46,7 +48,7 @@
/** The Collator to use for comparing the display name.
* @serial include
*/
- @NotNull private final Collator collator;
+ @NotNull private transient Collator collator;
/** Create a CharsetDisplaynameComparator based on the default locale.
* The default locale is queried when the CharsetDisplaynameComparator is created.
@@ -68,4 +70,10 @@
public int compare(@NotNull final Charset o1, @NotNull final Charset o2) {
return collator.compare(o1.displayName(locale), o2.displayName(locale));
}
+
+ /** {@inheritDoc} */
+ private void readObject(@NotNull final ObjectInputStream in) throws ClassNotFoundException, IOException {
+ in.defaultReadObject();
+ collator = Collator.getInstance(locale);
+ }
}
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/ConverterRegistry.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/ConverterRegistry.java 2009-05-23 16:38:35 UTC (rev 1330)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/ConverterRegistry.java 2009-05-23 19:16:12 UTC (rev 1331)
@@ -97,11 +97,8 @@
*/
@Nullable public <T> Converter<T> getConverter(@NotNull final Class<T> clazz) {
//noinspection unchecked
- @Nullable Converter<T> converter = null;
+ @Nullable Converter<T> converter = (Converter<T>) converters.get(clazz);
if (converter == null) {
- converter = (Converter<T>) converters.get(clazz);
- }
- if (converter == null) {
converter = getConstructorConverter(clazz);
}
if (converter == null && Enum.class.isAssignableFrom(clazz)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|