Author: desruisseaux
Date: Thu Aug 8 10:14:23 2013
New Revision: 1511668
URL: http://svn.apache.org/r1511668
Log:
Merge the fix for timezone problems.
Modified:
sis/branches/0.3/ (props changed)
sis/branches/0.3/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
sis/branches/0.3/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
sis/branches/0.3/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
Propchange: sis/branches/0.3/
------------------------------------------------------------------------------
Merged /sis/branches/JDK7:r1511661,1511665
Modified:
sis/branches/0.3/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
URL:
http://svn.apache.org/viewvc/sis/branches/0.3/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java?rev=1511668&r1=1511667&r2=1511668&view=diff
==============================================================================
---
sis/branches/0.3/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
[UTF-8] (original)
+++
sis/branches/0.3/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
[UTF-8] Thu Aug 8 10:14:23 2013
@@ -69,7 +69,7 @@ abstract class SubCommand {
/**
* The locale specified by the {@code "--timezone"} option. If no such
option was provided,
- * then this field is left to {@code null}.
+ * then this field is set to the {@linkplain TimeZone#getDefault() default
timezone}.
*/
protected final TimeZone timezone;
@@ -191,7 +191,7 @@ abstract class SubCommand {
locale = (value != null) ? Locales.parse(value) :
Locale.getDefault();
value = options.get(option = Option.TIMEZONE);
- timezone = (value != null) ? TimeZone.getTimeZone(value) : null;
+ timezone = (value != null) ? TimeZone.getTimeZone(value) :
TimeZone.getDefault();
value = options.get(option = Option.ENCODING);
explicitEncoding = (value != null);
Modified:
sis/branches/0.3/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL:
http://svn.apache.org/viewvc/sis/branches/0.3/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1511668&r1=1511667&r2=1511668&view=diff
==============================================================================
---
sis/branches/0.3/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
[UTF-8] (original)
+++
sis/branches/0.3/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
[UTF-8] Thu Aug 8 10:14:23 2013
@@ -604,10 +604,10 @@ public class TreeTableFormat extends Tab
/**
* Appends a textual representation of the given value.
*
- * @param format The format to use.
+ * @param format The format to use for the column as a whole, or
{@code null} if unknown.
* @param value The value to format (may be {@code null}).
*/
- private void formatValue(final Format format, final Object value)
throws IOException {
+ private void formatValue(Format format, final Object value) throws
IOException {
final CharSequence text;
if (value == null) {
text = " "; // String for missing value.
@@ -619,12 +619,21 @@ public class TreeTableFormat extends Tab
text = format.format(value);
} else if (value instanceof InternationalString) {
text = ((InternationalString) value).toString(getLocale());
+ } else if (value instanceof CharSequence) {
+ text = value.toString();
} else if (value instanceof CodeList<?>) {
text = Types.getCodeTitle((CodeList<?>)
value).toString(getLocale());
} else if (value instanceof Enum<?>) {
text = CharSequences.upperCaseToSentence(((Enum<?>)
value).name());
} else {
- text = String.valueOf(value);
+ /*
+ * Check for a value-by-value format only as last resort.
+ * If a column-wide format was given in argument to this
method,
+ * that format should have been used by above code in order to
+ * produce a more uniform formatting.
+ */
+ format = getFormat(value.getClass());
+ text = (format != null) ? format.format(value) :
value.toString();
}
append(text);
}
Modified:
sis/branches/0.3/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/0.3/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java?rev=1511668&r1=1511667&r2=1511668&view=diff
==============================================================================
---
sis/branches/0.3/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
[UTF-8] (original)
+++
sis/branches/0.3/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
[UTF-8] Thu Aug 8 10:14:23 2013
@@ -125,7 +125,7 @@ public final strictfp class MetadataRead
" │ ├─Citation\n" +
" │ │ ├─Title……………………………………………………………………………… Sea Surface
Temperature Analysis Model\n" +
" │ │ ├─Date\n" +
- " │ │ │ ├─Date……………………………………………………………………… Thu Sep 22
02:00:00 CEST 2005\n" +
+ " │ │ │ ├─Date……………………………………………………………………… 2005/09/22
00:00:00\n" +
" │ │ │ └─Date type………………………………………………………… Creation\n" +
" │ │ ├─Identifier\n" +
" │ │ │ ├─Code………………………………………………………………………
NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc\n" +