sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1760931 - in /sis/branches/JDK8/storage: sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/ sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/ sis-netcdf/src/main/java/org/apache/sis/inte...
Date Thu, 15 Sep 2016 13:54:57 GMT
Author: desruisseaux
Date: Thu Sep 15 13:54:57 2016
New Revision: 1760931

URL: http://svn.apache.org/viewvc?rev=1760931&view=rev
Log:
Refactor the NetCDF data type constants as an enumeration.
Those enumeration values include information about whether the type is signed or unsigned.

Added:
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java   (with props)
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DataTypeTest.java   (with props)
Modified:
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
    sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -218,11 +218,6 @@ final class LandsatReader {
     private final MetadataBuilder metadata;
 
     /**
-     * The locale to use for formatting warning or error messages.
-     */
-    private final Locale locale;
-
-    /**
      * Where to send the warnings.
      */
     private final WarningListeners<?> listeners;
@@ -300,12 +295,10 @@ final class LandsatReader {
      * Creates a new metadata parser.
      *
      * @param  filename   an identifier of the file being read, or {@code null} if unknown.
-     * @param  locale     the locale to use for formatting warning or error messages.
      * @param  listeners  where to sent warnings that may occur during the parsing process.
      */
-    LandsatReader(final String filename, final Locale locale, final WarningListeners<?> listeners) {
+    LandsatReader(final String filename, final WarningListeners<?> listeners) {
         this.filename  = filename;
-        this.locale    = locale;
         this.listeners = listeners;
         this.metadata  = new MetadataBuilder();
         this.bands     = new DefaultBand[BAND_NAMES.length];
@@ -992,7 +985,7 @@ final class LandsatReader {
      * Returns the filename to show in error messages, or a localized "unnamed" word if none.
      */
     private String getFilename() {
-        return (filename != null) ? filename : Vocabulary.getResources(locale).getString(Vocabulary.Keys.Unnamed);
+        return (filename != null) ? filename : Vocabulary.getResources(listeners.getLocale()).getString(Vocabulary.Keys.Unnamed);
     }
 
     /**
@@ -1025,6 +1018,6 @@ final class LandsatReader {
      * Returns the resources to use for formatting error messages.
      */
     private Errors errors() {
-        return Errors.getResources(locale);
+        return Errors.getResources(listeners.getLocale());
     }
 }

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -111,7 +111,7 @@ public class LandsatStore extends DataSt
         if (metadata == null && source != null) try {
             try (BufferedReader reader = (source instanceof BufferedReader) ? (BufferedReader) source : new LineNumberReader(source)) {
                 source = null;      // Will be closed at the end of this try-catch block.
-                final LandsatReader parser = new LandsatReader(name, getLocale(), listeners);
+                final LandsatReader parser = new LandsatReader(name, listeners);
                 parser.read(reader);
                 metadata = parser.getMetadata();
             }

Modified: sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -86,7 +86,7 @@ public class LandsatReaderTest extends T
         try (BufferedReader in = new BufferedReader(new InputStreamReader(
                 LandsatReaderTest.class.getResourceAsStream("LandsatTest.txt"), "UTF-8")))
         {
-            final LandsatReader reader = new LandsatReader("LandsatTest.txt", Locale.ENGLISH,
+            final LandsatReader reader = new LandsatReader("LandsatTest.txt",
                     new EmptyWarningListeners<>(Locale.ENGLISH, Modules.EARTH_OBSERVATION));
             reader.read(in);
             actual = reader.getMetadata();

Added: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java?rev=1760931&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java (added)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.netcdf;
+
+import java.awt.image.DataBuffer;
+import org.apache.sis.util.Numbers;
+
+
+/**
+ * The NetCDF type of data. Number of bits and endianness are same as in the Java language
+ * except {@link #CHAR}, which is defined as an unsigned 8-bits value. This enumeration is
+ * related to the NetCDF standard as below:
+ *
+ * <ul>
+ *   <li>The NetCDF numerical code is the {@link #ordinal()} plus 1.</li>
+ *   <li>The CDL reserved word is the {@link #name()} is lower case.</li>
+ * </ul>
+ *
+ * The unsigned data types are not defined in NetCDF classical version. However those data types
+ * can be inferred from their signed counterpart if the later have a {@code "_Unsigned = true"}
+ * attribute associated to the variable.
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+public enum DataType {
+    /**
+     * 8 bits signed integer (NetCDF type 1).
+     * Can be made unsigned by assigning the “_Unsigned” attribute to a NetCDF variable.
+     */
+    BYTE(Numbers.BYTE, false, (byte) 7, DataBuffer.TYPE_BYTE),
+
+    /**
+     * Character type as unsigned 8 bits (NetCDF type 2).
+     * Encoding can be specified by assigning the “_Encoding” attribute to a NetCDF variable.
+     */
+    CHAR(Numbers.BYTE, true, (byte) 2, DataBuffer.TYPE_UNDEFINED),        // NOT Numbers.CHARACTER
+
+    /**
+     * 16 bits signed integer (NetCDF type 3).
+     */
+    SHORT(Numbers.SHORT, false, (byte) 8, DataBuffer.TYPE_SHORT),
+
+    /**
+     * 32 bits signed integer (NetCDF type 4).
+     * This is also called "long", but that name is deprecated.
+     */
+    INT(Numbers.INTEGER, false, (byte) 9, DataBuffer.TYPE_INT),
+
+    /**
+     * 32 bits floating point number (NetCDF type 5)
+     * This is also called "real".
+     */
+    FLOAT(Numbers.FLOAT, false, (byte) 5, DataBuffer.TYPE_FLOAT),
+
+    /**
+     * 64 bits floating point number (NetCDF type 6).
+     */
+    DOUBLE(Numbers.DOUBLE, false, (byte) 6, DataBuffer.TYPE_DOUBLE),
+
+    /**
+     * 8 bits unsigned integer (NetCDF type 7).
+     * Not available in NetCDF classic format.
+     */
+    UBYTE(Numbers.BYTE, true, (byte) 1, DataBuffer.TYPE_BYTE),
+
+    /**
+     * 16 bits unsigned integer (NetCDF type 8).
+     * Not available in NetCDF classic format.
+     */
+    USHORT(Numbers.SHORT, true, (byte) 3, DataBuffer.TYPE_USHORT),
+
+    /**
+     * 43 bits unsigned integer (NetCDF type 9).
+     * Not available in NetCDF classic format.
+     */
+    UINT(Numbers.INTEGER, true, (byte) 4, DataBuffer.TYPE_INT),
+
+    /**
+     * 64 bits signed integer (NetCDF type 10).
+     * Not available in NetCDF classic format.
+     */
+    INT64(Numbers.LONG, false, (byte) 11, DataBuffer.TYPE_UNDEFINED),
+
+    /**
+     * 64 bits unsigned integer (NetCDF type 11).
+     * Not available in NetCDF classic format.
+     */
+    UINT64(Numbers.LONG, true, (byte) 10, DataBuffer.TYPE_UNDEFINED),
+
+    /**
+     * Character string (NetCDF type 12).
+     * Not available in NetCDF classic format.
+     */
+    STRING(Numbers.OTHER, false, (byte) 12, DataBuffer.TYPE_UNDEFINED);
+
+    /**
+     * Mapping from the NetCDF data type to the enumeration used by our {@link Numbers} class.
+     */
+    public final byte number;
+
+    /**
+     * {@code false} for signed data type (the default), or {@code true} for unsigned data type.
+     * The OGC NetCDF standard version 1.0 does not define unsigned data types. However some data
+     * providers attach an {@code "_Unsigned = true"} attribute to the variable.
+     */
+    public final boolean isUnsigned;
+
+    /**
+     * The NetCDF code of the data type of opposite sign convention.
+     * For example for the {@link #BYTE} data type, this is the NetCDF code of {@link #UBYTE}.
+     */
+    private final byte opposite;
+
+    /**
+     * The {@link DataBuffer} constant which most closely represents the "raw" internal data of the variable.
+     * This is the value to be returned by {@link java.awt.image.SampleModel#getDataType()} for Java2D rasters
+     * created from a variable data. If the variable data type can not be mapped to a Java2D data type, then
+     * the raster data type is {@link DataBuffer#TYPE_UNDEFINED}.
+     */
+    public final int rasterDataType;
+
+    /**
+     * Creates a new enumeration.
+     */
+    private DataType(final byte number, final boolean isUnsigned, final byte opposite, final int rasterDataType) {
+        this.number         = number;
+        this.isUnsigned     = isUnsigned;
+        this.opposite       = opposite;
+        this.rasterDataType = rasterDataType;
+    }
+
+    /**
+     * Returns the signed or unsigned variant of this data type.
+     * If this data type does not have the requested variant, then this method returns {@code this}.
+     *
+     * @param  u {@code true} for the unsigned variant, or {@code false} for the signed variant.
+     * @return the signed or unsigned variant of this data type.
+     */
+    public final DataType unsigned(final boolean u) {
+        return (u == isUnsigned) ? this : valueOf(opposite);
+    }
+
+    /**
+     * An array of all supported NetCDF data types ordered in such a way that
+     * {@code VALUES[codeNetCDF - 1]} is the enumeration value for a given NetCDF code.
+     */
+    private static final DataType[] VALUES = values();
+
+    /**
+     * Returns the enumeration value for the given NetCDF code, or {@code null} if the given code is unknown.
+     *
+     * @param  code  the NetCDF code.
+     * @return enumeration value for the give NetCDF code, or {@code null} if the given code is unknown.
+     */
+    public static DataType valueOf(int code) {
+        return (--code >= 0 && code < VALUES.length) ? VALUES[code] : null;
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/DataType.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -19,7 +19,6 @@ package org.apache.sis.internal.netcdf;
 import java.io.IOException;
 import java.awt.image.DataBuffer;
 import org.apache.sis.storage.DataStoreException;
-import org.apache.sis.util.Classes;
 import org.apache.sis.util.Debug;
 
 
@@ -29,7 +28,7 @@ import org.apache.sis.util.Debug;
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
  * @since   0.3
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public abstract class Variable {
@@ -76,25 +75,22 @@ public abstract class Variable {
     public abstract String getUnitsString();
 
     /**
-     * Returns the variable data type, as a primitive type if possible.
+     * Returns the variable data type.
      *
      * @return the variable data type, or {@code null} if unknown.
      */
-    public abstract Class<?> getDataType();
+    public abstract DataType getDataType();
 
     /**
      * Returns the name of the variable data type as the name of the primitive type
      * followed by the span of each dimension (in unit of grid cells) between brackets.
-     * Example: {@code "short[180][360]"}.
+     * Example: {@code "SHORT[180][360]"}.
      *
      * @return the name of the variable data type.
      */
     public final String getDataTypeName() {
         final StringBuilder buffer = new StringBuilder(20);
-        if (isUnsigned()) {
-            buffer.append("unsigned ");
-        }
-        buffer.append(Classes.getShortName(getDataType()));
+        buffer.append(getDataType().name().toLowerCase());
         final int[] shape = getGridEnvelope();
         for (int i=shape.length; --i>=0;) {
             buffer.append('[').append(Integer.toUnsignedLong(shape[i])).append(']');
@@ -103,35 +99,6 @@ public abstract class Variable {
     }
 
     /**
-     * Returns the {@link DataBuffer} constant which most closely represents the "raw" internal data of the variable.
-     * This is the value to be returned by {@link java.awt.image.SampleModel#getDataType()} for the Java2D rasters
-     * created from this variable data.
-     *
-     * @return the Java2D data type, or {@link DataBuffer#TYPE_UNDEFINED} if this variable data type
-     *         can not be mapped to a Java2D data type.
-     */
-    public final int getRasterDataType() {
-        final Class<?> type = getDataType();
-        if (type == boolean.class || type == byte.class) {
-            return DataBuffer.TYPE_BYTE;
-        }
-        if (type == short .class) return isUnsigned() ? DataBuffer.TYPE_USHORT : DataBuffer.TYPE_SHORT;
-        if (type == int   .class) return DataBuffer.TYPE_INT;
-        if (type == float .class) return DataBuffer.TYPE_FLOAT;
-        if (type == double.class) return DataBuffer.TYPE_DOUBLE;
-        return DataBuffer.TYPE_UNDEFINED;
-    }
-
-    /**
-     * Returns {@code true} if the integer values shall be considered as unsigned. The OGC NetCDF standard version 1.0
-     * does not define unsigned data types. However some data providers attach an {@code "_Unsigned = true"} attribute
-     * to the variable.
-     *
-     * @return {@code false} for signed data type (the default), or {@code true} for unsigned data type.
-     */
-    public abstract boolean isUnsigned();
-
-    /**
      * Returns {@code true} if the given variable can be used for generating an image.
      * This method checks for the following conditions:
      *
@@ -148,7 +115,7 @@ public abstract class Variable {
      *       with images.</li>
      * </ul>
      *
-     * @param  minSpan minimal span (in unit of grid cells) along the dimensions.
+     * @param  minSpan  minimal span (in unit of grid cells) along the dimensions.
      * @return {@code true} if the variable can be considered a coverage.
      */
     public final boolean isCoverage(final int minSpan) {
@@ -158,8 +125,11 @@ public abstract class Variable {
                 numVectors++;
             }
         }
-        if (numVectors >= MIN_DIMENSION && getRasterDataType() != DataBuffer.TYPE_UNDEFINED) {
-            return !isCoordinateSystemAxis();
+        if (numVectors >= MIN_DIMENSION) {
+            final DataType dataType = getDataType();
+            if (dataType != null && dataType.rasterDataType != DataBuffer.TYPE_UNDEFINED) {
+                return !isCoordinateSystemAxis();
+            }
         }
         return false;
     }
@@ -185,7 +155,7 @@ public abstract class Variable {
      * The length of this array shall be equals to the length of the {@link #getGridDimensionNames()} array.
      *
      * <p>In ISO 19123 terminology, this method returns the upper corner of the grid envelope plus one.
-     * The lower corner is always (0,0,…,0).</p>
+     * The lower corner is always (0, 0, …, 0).</p>
      *
      * @return the number of grid cells for each dimension, in NetCDF order (reverse of "natural" order).
      */
@@ -196,7 +166,7 @@ public abstract class Variable {
      * The elements will be of class {@link String} if {@code numeric} is {@code false},
      * or {@link Number} if {@code numeric} is {@code true}.
      *
-     * @param  attributeName The name of the attribute for which to get the values.
+     * @param  attributeName  the name of the attribute for which to get the values.
      * @param  numeric {@code true} if the values are expected to be numeric, or {@code false} for strings.
      * @return The sequence of {@link String} or {@link Number} values for the named attribute.
      */
@@ -238,8 +208,7 @@ public abstract class Variable {
     @Debug
     @Override
     public String toString() {
-        final StringBuilder buffer = new StringBuilder(getName())
-                .append(" : ").append(Classes.getShortName(getDataType()));
+        final StringBuilder buffer = new StringBuilder(getName()).append(" : ").append(getDataType());
         final int[] shape = getGridEnvelope();
         for (int i=shape.length; --i>=0;) {
             buffer.append('[').append(Integer.toUnsignedLong(shape[i])).append(']');

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.netcdf.impl;
 
+import org.apache.sis.internal.netcdf.DataType;
 import java.util.Set;
 import java.util.Map;
 import java.util.LinkedHashSet;
@@ -186,7 +187,16 @@ public final class ChannelDecoder extend
 
     /**
      * Creates a new decoder for the given file.
-     * This constructor parses immediately the header.
+     * This constructor parses immediately the header, which shall have the following structure:
+     *
+     * <ul>
+     *   <li>Magic number:   'C','D','F'</li>
+     *   <li>Version number: 1 or 2</li>
+     *   <li>Number of records</li>
+     *   <li>List of NetCDF dimensions  (see {@link #readDimensions(int)})</li>
+     *   <li>List of global attributes  (see {@link #readAttributes(int)})</li>
+     *   <li>List of variables          (see {@link #readVariables(int, Dimension[])})</li>
+     * </ul>
      *
      * @param  listeners  where to send the warnings.
      * @param  input      the channel and the buffer from where data are read.
@@ -288,31 +298,22 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Makes sure that the buffer contains at least <var>n</var> remaining elements of the given size.
-     * If the buffer does not have enough bytes available, more bytes will be read from the channel.
-     * If the buffer capacity is not sufficient for reading the given amount of data, an exception
-     * is thrown.
-     *
-     * <p>The NetCDF format add padding after bytes, characters and short integers in order to align
-     * the data on multiple of 4 bytes. This method adds such padding to the number of bytes to read.</p>
-     *
-     * @param  n         the number of elements to read.
-     * @param  dataSize  the size of each element, in bytes.
-     * @param  name      the name of the element to read, used only in case of error for formatting the message.
-     * @return the number of bytes to read, rounded to the next multiple of 4.
-     */
-    private int ensureBufferContains(final int n, final int dataSize, String name) throws IOException, DataStoreException {
-        // (n+3) & ~3  is a trick for rounding 'n' to the next multiple of 4.
-        final long size = (Integer.toUnsignedLong(n) * dataSize + 3) & ~3;
-        if (size > input.buffer.capacity()) {
-            name = input.filename + DefaultNameSpace.DEFAULT_SEPARATOR + name;
-            final Errors errors = errors();
-            throw new DataStoreContentException(n < 0 ?
-                    errors.getString(Errors.Keys.NegativeArrayLength_1, name) :
-                    errors.getString(Errors.Keys.ExcessiveListSize_2, name, n));
+     * Aligns position in the stream after reading the given amount of bytes.
+     * This method should be invoked only for {@link DataType#BYTE} and {@link DataType#CHAR}.
+     *
+     * <p>The NetCDF format adds padding after bytes, characters and short integers in order to align the data
+     * on multiple of 4 bytes. This method is used for adding such padding to the number of bytes to read.</p>
+     *
+     * @param  length   number of byte reads.
+     * @throws IOException if an error occurred while skipping bytes.
+     */
+    private void align(int length) throws IOException {
+        length &= 3;
+        if (length != 0) {
+            length = 4 - length;
+            input.ensureBufferContains(length);
+            input.buffer.position(input.buffer.position() + length);
         }
-        input.ensureBufferContains((int) size);
-        return (int) size;
     }
 
     /**
@@ -323,17 +324,18 @@ public final class ChannelDecoder extend
     }
 
     /**
-     * Reads a string from the buffer in the {@value #NAME_ENCODING}. This is suitable for the dimension,
+     * Reads a string from the channel in the {@value #NAME_ENCODING}. This is suitable for the dimension,
      * variable and attribute names in the header. Note that attribute value may have a different encoding.
+     *
+     * @param  length  number of bytes to read. The number of bytes actually read may be greater.
      */
     private String readName() throws IOException, DataStoreException {
         final int length = input.readInt();
         if (length < 0) {
             throw malformedHeader();
         }
-        final int size = ensureBufferContains(length, 1, "<name>");
         final String text = input.readString(length, NAME_ENCODING);
-        input.buffer.position(input.buffer.position() + (size - length));
+        align(length);
         return text;
     }
 
@@ -347,56 +349,61 @@ public final class ChannelDecoder extend
      *
      * @return the value, or {@code null} if it was an empty string or an empty array.
      */
-    private Object readValues(final String name, final int type, final int length) throws IOException, DataStoreException {
+    private Object readValues(final DataType type, final int length) throws IOException, DataStoreException {
         if (length == 0) {
             return null;
         }
-        final ByteBuffer buffer = input.buffer;
-        final int size = ensureBufferContains(length, VariableInfo.sizeOf(type), name);
-        final int position = buffer.position(); // Must be after 'ensureBufferContains'
-        final Object result;
+        if (length < 0 || type == null) {
+            throw malformedHeader();
+        }
         switch (type) {
-            case VariableInfo.CHAR: {
-                final String text = input.readString(length, encoding).trim();
-                result = text.isEmpty() ? null : text;
-                break;
+            case CHAR: {
+                final String text = input.readString(length, encoding);
+                align(length);
+                return text.isEmpty() ? null : text;
             }
-            case VariableInfo.BYTE: {
+            case BYTE:
+            case UBYTE: {
                 final byte[] array = new byte[length];
-                buffer.get(array);
-                result = array;
-                break;
+                input.readFully(array);
+                align(length);
+                return array;
             }
-            case VariableInfo.SHORT: {
+            case SHORT:
+            case USHORT: {
                 final short[] array = new short[length];
-                buffer.asShortBuffer().get(array);
-                result = array;
-                break;
+                input.readFully(array, 0, length);
+                if ((length & 1) != 0) {
+                    input.readShort();      // For byte alignment.
+                }
+                return array;
             }
-            case VariableInfo.INT: {
+            case INT:
+            case UINT: {
                 final int[] array = new int[length];
-                buffer.asIntBuffer().get(array);
-                result = array;
-                break;
+                input.readFully(array, 0, length);
+                return array;
+            }
+            case INT64:
+            case UINT64: {
+                final long[] array = new long[length];
+                input.readFully(array, 0, length);
+                return array;
             }
-            case VariableInfo.FLOAT: {
+            case FLOAT: {
                 final float[] array = new float[length];
-                buffer.asFloatBuffer().get(array);
-                result = array;
-                break;
+                input.readFully(array, 0, length);
+                return array;
             }
-            case VariableInfo.DOUBLE: {
+            case DOUBLE: {
                 final double[] array = new double[length];
-                buffer.asDoubleBuffer().get(array);
-                result = array;
-                break;
+                input.readFully(array, 0, length);
+                return array;
             }
             default: {
                 throw malformedHeader();
             }
         }
-        buffer.position(position + size);
-        return result;
     }
 
     /**
@@ -447,7 +454,7 @@ public final class ChannelDecoder extend
         int count = 0;
         for (int i=0; i<nelems; i++) {
             final String name = readName();
-            final Object value = readValues(name, input.readInt(), input.readInt());
+            final Object value = readValues(DataType.valueOf(input.readInt()), input.readInt());
             if (value != null) {
                 attributes[count++] = new Attribute(name, value);
             }
@@ -512,7 +519,7 @@ public final class ChannelDecoder extend
                 }
             }
             variables[j] = new VariableInfo(input, name, varDims, dimensions,
-                    toMap(attributes, Attribute.NAME_FUNCTION), input.readInt(), input.readInt(), readOffset());
+                    toMap(attributes, Attribute.NAME_FUNCTION), DataType.valueOf(input.readInt()), input.readInt(), readOffset());
         }
         return variables;
     }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -21,6 +21,7 @@ import java.io.IOException;
 import ucar.nc2.constants.CF;
 import ucar.nc2.constants.CDM;
 import ucar.nc2.constants._Coordinate;
+import org.apache.sis.internal.netcdf.DataType;
 import org.apache.sis.internal.netcdf.Variable;
 import org.apache.sis.internal.storage.ChannelDataInput;
 import org.apache.sis.internal.storage.HyperRectangleReader;
@@ -53,52 +54,6 @@ final class VariableInfo extends Variabl
     };
 
     /**
-     * The NetCDF type of data. Number of bits and endianness are same as in the Java language except {@code CHAR},
-     * which is defined as an unsigned 8-bits value.
-     */
-    static final int BYTE=1, CHAR=2, SHORT=3, INT=4, FLOAT=5, DOUBLE=6;
-
-    /**
-     * Mapping from the NetCDF data type to the enumeration used by our {@link Numbers} class.
-     */
-    private static final byte[] NUMBER_TYPES = new byte[] {
-        Numbers.BYTE,
-        Numbers.BYTE,       // NOT Numbers.CHARACTER
-        Numbers.SHORT,
-        Numbers.INTEGER,
-        Numbers.FLOAT,
-        Numbers.DOUBLE,
-    };
-
-    /**
-     * The size in bytes of the above constants.
-     *
-     * @see #sizeOf(int)
-     */
-    private static final byte[] SIZES = new byte[] {
-        Byte   .BYTES,
-        Byte   .BYTES,      // NOT Character.BYTES
-        Short  .BYTES,
-        Integer.BYTES,
-        Float  .BYTES,
-        Double .BYTES,
-    };
-
-    /**
-     * The Java primitive type of the above constants.
-     *
-     * @see #getDataType()
-     */
-    private static final Class<?>[] TYPES = new Class<?>[] {
-       byte  .class,
-       char  .class,
-       short .class,
-       int   .class,
-       float .class,
-       double.class
-    };
-
-    /**
      * Helper class for reading a sub-area with a sub-sampling,
      * or {@code null} if {@code dataType} is not a supported type.
      */
@@ -125,9 +80,9 @@ final class VariableInfo extends Variabl
     private final Map<String,Attribute> attributes;
 
     /**
-     * The type of data, as one of the {@code BYTE}, {@code SHORT} and similar constants defined in this class.
+     * The NetCDF type of data, or {@code null} if unknown.
      */
-    private final int dataType;
+    private final DataType dataType;
 
     /**
      * The grid geometry associated to this variable,
@@ -143,15 +98,19 @@ final class VariableInfo extends Variabl
      * @param  dimensions     the dimensions of this variable.
      * @param  allDimensions  all dimensions in the NetCDF files.
      * @param  attributes     the attributes associates to the variable, or an empty map if none.
-     * @param  dataType       the type of data, as one of the {@code BYTE} and similar constants defined in this class.
+     * @param  dataType       the NetCDF type of data, or {@code null} if unknown.
      * @param  size           the variable size, used for verification purpose only.
      * @param  offset         the offset where the variable data begins in the NetCDF file.
      */
     VariableInfo(final ChannelDataInput input, final String name,
             final Dimension[] dimensions, final Dimension[] allDimensions,
-            final Map<String,Attribute> attributes, int dataType, final int size, final long offset)
+            final Map<String,Attribute> attributes, DataType dataType, final int size, final long offset)
             throws DataStoreException
     {
+        final Attribute attribute = attributes.get(CDM.UNSIGNED);
+        if (attribute != null) {
+            dataType = dataType.unsigned(attribute.booleanValue());
+        }
         this.name          = name;
         this.dimensions    = dimensions;
         this.allDimensions = allDimensions;
@@ -161,8 +120,8 @@ final class VariableInfo extends Variabl
          * The 'size' value is provided in the NetCDF files, but doesn't need to be stored since it
          * is redundant with the dimension lengths and is not large enough for big variables anyway.
          */
-        if (--dataType >= 0 && dataType < NUMBER_TYPES.length) {
-            reader = new HyperRectangleReader(NUMBER_TYPES[dataType], input, offset);
+        if (dataType != null && dataType.number >= Numbers.BYTE && dataType.number <= Numbers.DOUBLE) {
+            reader = new HyperRectangleReader(dataType.number, input, offset);
         } else {
             reader = null;
         }
@@ -205,30 +164,13 @@ final class VariableInfo extends Variabl
     }
 
     /**
-     * Returns the type of data as a Java primitive type if possible,
-     * or {@code null} if the data type is unknown to this method.
-     */
-    @Override
-    public Class<?> getDataType() {
-        final int i = dataType - 1;
-        return (i >= 0 && i < TYPES.length) ? TYPES[i] : null;
-    }
-
-    /**
-     * Returns the size of the given data type, or 0 if unknown.
-     */
-    static int sizeOf(int datatype) {
-        return (--datatype >= 0 && datatype < SIZES.length) ? SIZES[datatype] : 0;
-    }
-
-    /**
-     * Returns {@code true} if the integer values shall be considered as unsigned.
-     * Current implementation searches for an {@code "_Unsigned = true"} attribute.
+     * Returns the type of data, or {@code null} if the data type is unknown to this method.
+     * If this variable has a {@code "_Unsigned = true"} attribute, then the returned data type
+     * will be a unsigned variant.
      */
     @Override
-    public boolean isUnsigned() {
-        final Attribute attribute = attributes.get(CDM.UNSIGNED);
-        return (attribute != null) && attribute.booleanValue();
+    public DataType getDataType() {
+        return dataType;
     }
 
     /**

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -24,6 +24,7 @@ import ucar.ma2.InvalidRangeException;
 import ucar.nc2.Attribute;
 import ucar.nc2.Dimension;
 import ucar.nc2.VariableIF;
+import org.apache.sis.internal.netcdf.DataType;
 import org.apache.sis.internal.netcdf.Variable;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreContentException;
@@ -82,20 +83,24 @@ final class VariableWrapper extends Vari
     }
 
     /**
-     * Returns the variable data type, as a primitive type if possible.
-     * This method may return {@code null} (UCAR code seems to allow that).
+     * Returns the variable data type.
+     * This method may return {@code null} if the datatype is unknown.
      */
     @Override
-    public Class<?> getDataType() {
-        return variable.getDataType().getPrimitiveClassType();
-    }
-
-    /**
-     * Returns {@code true} if the integer values shall be considered as unsigned.
-     */
-    @Override
-    public boolean isUnsigned() {
-        return variable.isUnsigned();
+    public DataType getDataType() {
+        final DataType type;
+        switch (variable.getDataType()) {
+            case STRING: type = DataType.STRING; break;
+            case CHAR:   type = DataType.CHAR;   break;
+            case BYTE:   type = DataType.BYTE;   break;
+            case SHORT:  type = DataType.SHORT;  break;
+            case INT:    type = DataType.INT;    break;
+            case LONG:   type = DataType.INT64;  break;
+            case FLOAT:  type = DataType.FLOAT;  break;
+            case DOUBLE: type = DataType.DOUBLE; break;
+            default: return null;
+        }
+        return type.unsigned(variable.isUnsigned());
     }
 
     /**

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -854,7 +854,8 @@ final class MetadataReader {
         String name = variable.getName();
         if (name != null && !(name = name.trim()).isEmpty()) {
             if (nameFactory == null) {
-                nameFactory = DefaultFactories.forBuildin(NameFactory.class); // Real dependency injection to be used in a future version.
+                nameFactory = DefaultFactories.forBuildin(NameFactory.class);
+                // Real dependency injection to be used in a future version.
             }
             band.setSequenceIdentifier(nameFactory.createMemberName(null, name,
                     nameFactory.createTypeName(null, variable.getDataTypeName())));

Added: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DataTypeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DataTypeTest.java?rev=1760931&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DataTypeTest.java (added)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DataTypeTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.netcdf;
+
+import org.junit.Test;
+import org.apache.sis.test.TestCase;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests {@link DataType} enumeration values.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.8
+ * @version 0.8
+ * @module
+ */
+public final strictfp class DataTypeTest extends TestCase {
+    /**
+     * Verifies the relationship between the enumeration ordinal value and the NetCDF numerical code.
+     */
+    @Test
+    public void testOrdinalValues() {
+        verifyOrdinal( 1, DataType.BYTE);
+        verifyOrdinal( 2, DataType.CHAR);
+        verifyOrdinal( 3, DataType.SHORT);
+        verifyOrdinal( 4, DataType.INT);
+        verifyOrdinal( 5, DataType.FLOAT);
+        verifyOrdinal( 6, DataType.DOUBLE);
+        verifyOrdinal( 7, DataType.UBYTE);
+        verifyOrdinal( 8, DataType.USHORT);
+        verifyOrdinal( 9, DataType.UINT);
+        verifyOrdinal(10, DataType.INT64);
+        verifyOrdinal(11, DataType.UINT64);
+        verifyOrdinal(12, DataType.STRING);
+    }
+
+    /**
+     * Verifies the ordinal value of the given data type.
+     */
+    private static void verifyOrdinal(final int codeNetCDF, final DataType type) {
+        assertEquals(type.name(), codeNetCDF, type.ordinal() + 1);
+        assertSame("DataType.valueOf(int)", type, DataType.valueOf(codeNetCDF));
+    }
+
+    /**
+     * Tests {@link DataType#unsigned(boolean)}.
+     */
+    @Test
+    public void testUnsigned() {
+        verifyUnsigned(DataType.BYTE,   DataType.UBYTE);
+        verifyUnsigned(DataType.SHORT,  DataType.USHORT);
+        verifyUnsigned(DataType.INT,    DataType.UINT);
+        verifyUnsigned(DataType.INT64,  DataType.UINT64);
+        verifyUnsigned(DataType.FLOAT,  DataType.FLOAT);
+        verifyUnsigned(DataType.DOUBLE, DataType.DOUBLE);
+        verifyUnsigned(DataType.STRING, DataType.STRING);
+        verifyUnsigned(DataType.CHAR,   DataType.CHAR);
+    }
+
+    /**
+     * Verifies the relationship between signed and unsigned data types.
+     */
+    private static void verifyUnsigned(final DataType signed, final DataType unsigned) {
+        assertSame(  "signed",   signed,   signed.unsigned(false));
+        assertSame(  "signed",   signed, unsigned.unsigned(false));
+        assertSame("unsigned", unsigned, unsigned.unsigned(true));
+        assertSame("unsigned", unsigned,   signed.unsigned(true));
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DataTypeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DataTypeTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -46,8 +46,8 @@ public strictfp class GridGeometryTest e
      * {@code GridGeometryInfoTest} in order to ignore one-dimensional coordinate systems created
      * by {@code GridGeometry} but not by the UCAR library.
      *
-     * @param  geometries The grid geometries created by {@link Decoder}.
-     * @return The grid geometries to test.
+     * @param  geometries  the grid geometries created by {@link Decoder}.
+     * @return the grid geometries to test.
      */
     protected GridGeometry[] filter(final GridGeometry[] geometries) {
         return geometries;

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -78,7 +78,7 @@ public abstract strictfp class TestCase
      * supplemental formats tested in this suite. Subclasses working only with the NetCDF
      * classic or 64-bits format can unconditionally returns {@code false}.
      *
-     * @param  format Either {@code "THREDDS"} or {@code "HDF5"}.
+     * @param  format  either {@code "THREDDS"} or {@code "HDF5"}.
      * @return {@code true} if the given supplemental format is supported.
      */
     protected boolean isSupplementalFormatSupported(final String format) {
@@ -101,8 +101,8 @@ public abstract strictfp class TestCase
      * reference implementation. However subclasses can override if they want to test a different
      * library.
      *
-     * @param  name The file name as one of the above-cited constants.
-     * @return The decoder for the given name.
+     * @param  name  the file name as one of the above-cited constants.
+     * @return the decoder for the given name.
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */
@@ -118,8 +118,8 @@ public abstract strictfp class TestCase
      * <p>The {@linkplain Decoder#setSearchPath(String[]) search path} of the returned decoder
      * is initialized to the global attributes only.</p>
      *
-     * @param  name The file name as one of the constants enumerated in the {@link #createDecoder(String)} method.
-     * @return The decoder for the given name.
+     * @param  name  the file name as one of the constants enumerated in the {@link #createDecoder(String)} method.
+     * @return the decoder for the given name.
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */
@@ -184,9 +184,9 @@ public abstract strictfp class TestCase
      * Asserts that the textual value of the named attribute is equals to the expected value.
      * The {@link #selectDataset(String)} method must be invoked at least once before this method.
      *
-     * @param  expected      The expected attribute value.
-     * @param  attributeName The name of the attribute to test.
-     * @throws IOException   if an error occurred while reading the NetCDF file.
+     * @param  expected       the expected attribute value.
+     * @param  attributeName  the name of the attribute to test.
+     * @throws IOException if an error occurred while reading the NetCDF file.
      */
     protected final void assertAttributeEquals(final String expected, final String attributeName) throws IOException {
         assertEquals(attributeName, expected, decoder.stringValue(attributeName));
@@ -196,9 +196,9 @@ public abstract strictfp class TestCase
      * Asserts that the numeric value of the named attribute is equals to the expected value.
      * The {@link #selectDataset(String)} method must be invoked at least once before this method.
      *
-     * @param  expected      The expected attribute value.
-     * @param  attributeName The name of the attribute to test.
-     * @throws IOException   If an error occurred while reading the NetCDF file.
+     * @param  expected       the expected attribute value.
+     * @param  attributeName  the name of the attribute to test.
+     * @throws IOException if an error occurred while reading the NetCDF file.
      */
     protected final void assertAttributeEquals(final Number expected, final String attributeName) throws IOException {
         assertEquals(attributeName, expected, decoder.numericValue(attributeName));
@@ -208,9 +208,9 @@ public abstract strictfp class TestCase
      * Asserts that the temporal value of the named attribute is equals to the expected value.
      * The {@link #selectDataset(String)} method must be invoked at least once before this method.
      *
-     * @param  expected      The expected attribute value.
-     * @param  attributeName The name of the attribute to test.
-     * @throws IOException   If an error occurred while reading the NetCDF file.
+     * @param  expected       the expected attribute value.
+     * @param  attributeName  the name of the attribute to test.
+     * @throws IOException if an error occurred while reading the NetCDF file.
      */
     protected final void assertAttributeEquals(final Date expected, final String attributeName) throws IOException {
         assertEquals(attributeName, expected, decoder.dateValue(attributeName));

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -32,7 +32,7 @@ import static org.opengis.test.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.8
  * @module
  */
 @DependsOn(DecoderTest.class)
@@ -54,7 +54,6 @@ public strictfp class VariableTest exten
      *   <li>{@link Variable#getGridEnvelope()} length</li>
      *   <li>{@link Variable#isCoordinateSystemAxis()}</li>
      *   <li>{@link Variable#isCoverage(int)}</li>
-     *   <li>{@link Variable#isUnsigned()}</li>
      * </ul>
      *
      * @throws IOException if an I/O error occurred while opening the file.
@@ -63,56 +62,55 @@ public strictfp class VariableTest exten
     @Test
     public void testBasicProperties() throws IOException, DataStoreException {
         assertBasicPropertiesEqual(new Object[] {
-        // __name______________description_________________________________datatype____dim__axis?__raster?
-            "reftime",        "reference time",                            double.class, 1, false, false,
-            "datetime",       "reference date and time",                   char  .class, 2, false, false,
-            "forecasttime",   "forecast date and time",                    char  .class, 2, false, false,
-            "model_id",       "generating process ID number",              int   .class, 1, false, false,
-            "nav_model",      "navigation model name",                     char  .class, 2, false, false,
-            "grid_type_code", "GRIB-1 GDS data representation type",       int   .class, 1, false, false,
-            "grid_type",      "GRIB-1 grid type",                          char  .class, 2, false, false,
-            "grid_name",      "grid name",                                 char  .class, 2, false, false,
-            "grid_center",    "GRIB-1 originating center ID",              int   .class, 1, false, false,
-            "grid_number",    "GRIB-1 catalogued grid numbers",            int   .class, 2, false, false,
-            "i_dim",          "longitude dimension name",                  char  .class, 2, false, false,
-            "j_dim",          "latitude dimension name",                   char  .class, 2, false, false,
-            "Ni",             "number of points along a latitude circle",  int   .class, 1, false, false,
-            "Nj",             "number of points along a longitude circle", int   .class, 1, false, false,
-            "La1",            "latitude of first grid point",              float .class, 1, false, false,
-            "Lo1",            "longitude of first grid point",             float .class, 1, false, false,
-            "La2",            "latitude of last grid point",               float .class, 1, false, false,
-            "Lo2",            "longitude of last grid point",              float .class, 1, false, false,
-            "Di",             "longitudinal direction increment",          float .class, 1, false, false,
-            "Dj",             "latitudinal direction increment",           float .class, 1, false, false,
-            "ResCompFlag",    "resolution and component flags",            byte  .class, 1, false, false,
-            "SST",            "Sea temperature",                           float .class, 3, false, true,
-            "valtime",        "valid time",                                double.class, 1, true,  false,
-            "valtime_offset", "hours from reference time",                 double.class, 1, true,  false,
-            "lat",            "latitude",                                  float .class, 1, true,  false,
-            "lon",            "longitude",                                 float .class, 1, true,  false
+        // __name______________description_________________________________datatype_______dim__axis?__raster?
+            "reftime",        "reference time",                            DataType.DOUBLE, 1, false, false,
+            "datetime",       "reference date and time",                   DataType.CHAR,   2, false, false,
+            "forecasttime",   "forecast date and time",                    DataType.CHAR,   2, false, false,
+            "model_id",       "generating process ID number",              DataType.INT,    1, false, false,
+            "nav_model",      "navigation model name",                     DataType.CHAR,   2, false, false,
+            "grid_type_code", "GRIB-1 GDS data representation type",       DataType.INT,    1, false, false,
+            "grid_type",      "GRIB-1 grid type",                          DataType.CHAR,   2, false, false,
+            "grid_name",      "grid name",                                 DataType.CHAR,   2, false, false,
+            "grid_center",    "GRIB-1 originating center ID",              DataType.INT,    1, false, false,
+            "grid_number",    "GRIB-1 catalogued grid numbers",            DataType.INT,    2, false, false,
+            "i_dim",          "longitude dimension name",                  DataType.CHAR,   2, false, false,
+            "j_dim",          "latitude dimension name",                   DataType.CHAR,   2, false, false,
+            "Ni",             "number of points along a latitude circle",  DataType.INT,    1, false, false,
+            "Nj",             "number of points along a longitude circle", DataType.INT,    1, false, false,
+            "La1",            "latitude of first grid point",              DataType.FLOAT,  1, false, false,
+            "Lo1",            "longitude of first grid point",             DataType.FLOAT,  1, false, false,
+            "La2",            "latitude of last grid point",               DataType.FLOAT,  1, false, false,
+            "Lo2",            "longitude of last grid point",              DataType.FLOAT,  1, false, false,
+            "Di",             "longitudinal direction increment",          DataType.FLOAT,  1, false, false,
+            "Dj",             "latitudinal direction increment",           DataType.FLOAT,  1, false, false,
+            "ResCompFlag",    "resolution and component flags",            DataType.BYTE,   1, false, false,
+            "SST",            "Sea temperature",                           DataType.FLOAT,  3, false, true,
+            "valtime",        "valid time",                                DataType.DOUBLE, 1, true,  false,
+            "valtime_offset", "hours from reference time",                 DataType.DOUBLE, 1, true,  false,
+            "lat",            "latitude",                                  DataType.FLOAT,  1, true,  false,
+            "lon",            "longitude",                                 DataType.FLOAT,  1, true,  false
         }, selectDataset(NCEP).getVariables());
     }
 
     /**
      * Compares the basic properties of the given variables.
      *
-     * @param expected  The expected property values.
-     * @param variables The variable for which to test properties.
+     * @param expected  the expected property values.
+     * @param variables the variable for which to test properties.
      */
     private static void assertBasicPropertiesEqual(final Object[] expected, final Variable[] variables) {
         int propertyIndex = 0;
         for (final Variable variable : variables) {
+            final String name = variable.getName();
+            final DataType dataType = variable.getDataType();
             assertFalse("Too many variables.", propertyIndex == expected.length);
-            assertEquals("getName()",                expected[propertyIndex++], variable.getName());
-            assertEquals("getDescription()",         expected[propertyIndex++], variable.getDescription());
-            assertEquals("getDataType()",            expected[propertyIndex++], variable.getDataType());
-            assertEquals("getDimensionLengths()",    expected[propertyIndex++], variable.getGridEnvelope().length);
-            assertEquals("isCoordinateSystemAxis()", expected[propertyIndex++], variable.isCoordinateSystemAxis());
-            assertEquals("isCoverage(2)",            expected[propertyIndex++], variable.isCoverage(2));
-            assertEquals(0, propertyIndex % NUM_BASIC_PROPERTY_COLUMNS); // Sanity check for VariableTest itself.
-
-            // All variable in our current test dataset are unsigned.
-            assertFalse("isUnsigned()", variable.isUnsigned());
+            assertEquals(name, expected[propertyIndex++], name);
+            assertEquals(name, expected[propertyIndex++], variable.getDescription());
+            assertEquals(name, expected[propertyIndex++], dataType);
+            assertEquals(name, expected[propertyIndex++], variable.getGridEnvelope().length);
+            assertEquals(name, expected[propertyIndex++], variable.isCoordinateSystemAxis());
+            assertEquals(name, expected[propertyIndex++], variable.isCoverage(2));
+            assertEquals(0, propertyIndex % NUM_BASIC_PROPERTY_COLUMNS);            // Sanity check for VariableTest itself.
         }
         assertEquals("Expected more variables.",
                 expected.length / NUM_BASIC_PROPERTY_COLUMNS,
@@ -165,8 +163,8 @@ public strictfp class VariableTest exten
     /**
      * Tests {@link Variable#read()} on a one-dimensional variable.
      *
-     * @throws IOException If an error occurred while reading the NetCDF file.
-     * @throws DataStoreException Should never happen.
+     * @throws IOException if an error occurred while reading the NetCDF file.
+     * @throws DataStoreException if a logical error occurred.
      */
     @Test
     public void testRead1D() throws IOException, DataStoreException {

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -45,7 +45,7 @@ public final strictfp class ChannelDecod
     /**
      * Creates a new decoder for dataset of the given name.
      *
-     * @return The decoder for the given name.
+     * @return the decoder for the given name.
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */
@@ -65,8 +65,8 @@ public final strictfp class ChannelDecod
      *   <li>{@link #LANDSAT} for a NetCDF binary file.</li>
      * </ul>
      *
-     * @param  name The file name as one of the above-cited constants.
-     * @return The decoder for the given name.
+     * @param  name  the file name as one of the above-cited constants.
+     * @return the decoder for the given name.
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -40,7 +40,7 @@ public final strictfp class GridGeometry
     /**
      * Creates a new decoder for dataset of the given name.
      *
-     * @return The decoder for the given name.
+     * @return the decoder for the given name.
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */
@@ -64,7 +64,7 @@ public final strictfp class GridGeometry
      * Filters out the one-dimensional coordinate systems created by {@code GridGeometry}
      * but not by the UCAR library.
      *
-     * @return The filtered grid geometries to test.
+     * @return the filtered grid geometries to test.
      */
     @Override
     protected GridGeometry[] filter(final GridGeometry[] geometries) {

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -38,7 +38,7 @@ public final strictfp class VariableInfo
     /**
      * Creates a new decoder for dataset of the given name.
      *
-     * @return The decoder for the given dataset.
+     * @return the decoder for the given dataset.
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -59,9 +59,9 @@ public final strictfp class ConformanceT
      * {@code NetcdfFile.findAttribute(String)} method calls. However in SIS implementation, the metadata
      * object is fully created right at this method invocation time.</div>
      *
-     * @param  file The NetCDF file to wrap.
-     * @return A metadata implementation created from the attributes found in the given file.
-     * @throws IOException If an error occurred while reading the given NetCDF file.
+     * @param  file the NetCDF file to wrap.
+     * @return a metadata implementation created from the attributes found in the given file.
+     * @throws IOException if an error occurred while reading the given NetCDF file.
      */
     @Override
     protected Metadata wrap(final NetcdfFile file) throws IOException {
@@ -83,7 +83,7 @@ public final strictfp class ConformanceT
     /**
      * Adds a set of common property values expected by every tests in this class.
      *
-     * @param expected   The map where to add additional attributes expected by the test.
+     * @param expected   the map where to add additional attributes expected by the test.
      * @param hasContact {@code true} for adding contact information.
      */
     private static void addCommonProperties(final Map<String,Object> expected, final boolean hasContact) {
@@ -99,7 +99,7 @@ public final strictfp class ConformanceT
      * Tests a file that contains THREDDS metadata. This method inherits the tests defined in GeoAPI,
      * and adds some additional tests for attributes parsed by SIS but not by GeoAPI.
      *
-     * @throws IOException If the test file can not be read.
+     * @throws IOException if the test file can not be read.
      */
     @Test
     @Override
@@ -133,7 +133,7 @@ public final strictfp class ConformanceT
      * Tests a NetCDF binary file. This method inherits the tests defined in GeoAPI,
      * and adds some additional tests for attributes parsed by SIS but not GeoAPI.
      *
-     * @throws IOException If the test file can not be read.
+     * @throws IOException if the test file can not be read.
      */
     @Test
     @Override
@@ -161,7 +161,7 @@ public final strictfp class ConformanceT
     /**
      * Tests the Landsat file (binary format).
      *
-     * @throws IOException If the test file can not be read.
+     * @throws IOException if the test file can not be read.
      */
     @Test
     @Override
@@ -177,7 +177,7 @@ public final strictfp class ConformanceT
     /**
      * Tests the "Current Icing Product" file (binary format).
      *
-     * @throws IOException If the test file can not be read.
+     * @throws IOException if the test file can not be read.
      */
     @Test
     @Override

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -67,7 +67,7 @@ public final strictfp class MetadataRead
      * Reads the metadata using the UCAR library and compares
      * its string representation with the expected one.
      *
-     * @throws IOException Should never happen.
+     * @throws IOException if an I/O error occurred.
      */
     @Test
     public void testUCAR() throws IOException {

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -50,7 +50,7 @@ public final strictfp class NetcdfStoreP
      * Tests {@link NetcdfStoreProvider#probeContent(StorageConnector)} for an input stream which shall
      * be recognized as a classic NetCDF file.
      *
-     * @throws DataStoreException Should never happen.
+     * @throws DataStoreException if a logical error occurred.
      */
     @Test
     public void testProbeContentFromStream() throws DataStoreException {
@@ -66,48 +66,48 @@ public final strictfp class NetcdfStoreP
     /**
      * Tests {@link NetcdfStoreProvider#probeContent(StorageConnector)} for a UCAR {@link NetcdfFile} object.
      *
-     * @throws IOException If an error occurred while opening the NetCDF file.
-     * @throws DataStoreException Should never happen.
+     * @throws IOException if an error occurred while opening the NetCDF file.
+     * @throws DataStoreException if a logical error occurred.
      */
     @Test
     public void testProbeContentFromUCAR() throws IOException, DataStoreException {
-        final NetcdfFile file = open(NCEP);
-        final StorageConnector c = new StorageConnector(file);
-        final NetcdfStoreProvider provider = new NetcdfStoreProvider();
-        final ProbeResult probe = provider.probeContent(c);
-        assertTrue  ("isSupported", probe.isSupported());
-        assertEquals("getMimeType", NetcdfStoreProvider.MIME_TYPE, probe.getMimeType());
-        assertNull  ("getVersion",  probe.getVersion());
-        file.close();
+        try (NetcdfFile file = open(NCEP)) {
+            final StorageConnector c = new StorageConnector(file);
+            final NetcdfStoreProvider provider = new NetcdfStoreProvider();
+            final ProbeResult probe = provider.probeContent(c);
+            assertTrue  ("isSupported", probe.isSupported());
+            assertEquals("getMimeType", NetcdfStoreProvider.MIME_TYPE, probe.getMimeType());
+            assertNull  ("getVersion",  probe.getVersion());
+        }
     }
 
     /**
      * Tests {@link NetcdfStoreProvider#decoder(WarningListeners, StorageConnector)} for an input stream which
      * shall be recognized as a classic NetCDF file. The provider shall instantiate a {@link ChannelDecoder}.
      *
-     * @throws IOException If an error occurred while opening the NetCDF file.
-     * @throws DataStoreException Should never happen.
+     * @throws IOException if an error occurred while opening the NetCDF file.
+     * @throws DataStoreException if a logical error occurred.
      */
     @Test
     public void testDecoderFromStream() throws IOException, DataStoreException {
         final StorageConnector c = new StorageConnector(IOTestCase.class.getResourceAsStream(NCEP));
-        final Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c);
-        assertInstanceOf(NCEP, ChannelDecoder.class, decoder);
-        decoder.close();
+        try (Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c)) {
+            assertInstanceOf(NCEP, ChannelDecoder.class, decoder);
+        }
     }
 
     /**
      * Tests {@link NetcdfStoreProvider#decoder(WarningListeners, StorageConnector)} for a UCAR
      * {@link NetcdfFile} object. The provider shall instantiate a {@link DecoderWrapper}.
      *
-     * @throws IOException If an error occurred while opening the NetCDF file.
-     * @throws DataStoreException Should never happen.
+     * @throws IOException if an error occurred while opening the NetCDF file.
+     * @throws DataStoreException if a logical error occurred.
      */
     @Test
     public void testDecoderFromUCAR() throws IOException, DataStoreException {
         final StorageConnector c = new StorageConnector(open(NCEP));
-        final Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c);
-        assertInstanceOf(NCEP, DecoderWrapper.class, decoder);
-        decoder.close();
+        try (Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c)) {
+            assertInstanceOf(NCEP, DecoderWrapper.class, decoder);
+        }
     }
 }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -42,8 +42,8 @@ public final strictfp class NetcdfStoreT
     /**
      * Returns a new NetCDF store to test.
      *
-     * @param  dataset The name of the datastore to load.
-     * @throws DataStoreException If an error occurred while reading the NetCDF file.
+     * @param  dataset the name of the datastore to load.
+     * @throws DataStoreException if an error occurred while reading the NetCDF file.
      */
     private static NetcdfStore create(final String dataset) throws DataStoreException {
         return new NetcdfStore(new StorageConnector(IOTestCase.class.getResource(dataset)));
@@ -52,14 +52,15 @@ public final strictfp class NetcdfStoreT
     /**
      * Tests {@link NetcdfStore#getMetadata()}.
      *
-     * @throws DataStoreException If an error occurred while reading the NetCDF file.
+     * @throws DataStoreException if an error occurred while reading the NetCDF file.
      */
     @Test
     public void testGetMetadata() throws DataStoreException {
-        final NetcdfStore store = create(NCEP);
-        final Metadata metadata = store.getMetadata();
-        assertSame("Should be cached.", metadata, store.getMetadata());
-        store.close();
+        final Metadata metadata;
+        try (NetcdfStore store = create(NCEP)) {
+            metadata = store.getMetadata();
+            assertSame("Should be cached.", metadata, store.getMetadata());
+        }
         MetadataReaderTest.compareToExpected(metadata);
     }
 }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -28,10 +28,11 @@ import org.junit.BeforeClass;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.8
  * @module
  */
 @Suite.SuiteClasses({
+    org.apache.sis.internal.netcdf.DataTypeTest.class,
     org.apache.sis.internal.netcdf.DecoderTest.class,
     org.apache.sis.internal.netcdf.VariableTest.class,
     org.apache.sis.internal.netcdf.GridGeometryTest.class,

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java?rev=1760931&r1=1760930&r2=1760931&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] Thu Sep 15 13:54:57 2016
@@ -52,6 +52,7 @@ import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.storage.StorageConnector;
+import org.apache.sis.setup.OptionKey;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ObjectConverter;
@@ -71,7 +72,6 @@ import org.opengis.feature.Feature;
 import org.opengis.feature.FeatureType;
 import org.opengis.feature.PropertyType;
 import org.opengis.feature.AttributeType;
-import org.apache.sis.setup.OptionKey;
 
 
 /**



Mime
View raw message