sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1776609 - in /sis/branches/JDK8: core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metadata/src/main/java/org/apache/sis/metadata/ core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/ core/sis-utility/sr...
Date Fri, 30 Dec 2016 17:00:28 GMT
Author: desruisseaux
Date: Fri Dec 30 17:00:28 2016
New Revision: 1776609

URL: http://svn.apache.org/viewvc?rev=1776609&view=rev
Log:
Replace the boolean argument in DataStoreException subclass by OpenOption[].
Inline some calls to Exception.initCause(...). This would be easier if more exceptions were using return type covariance.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/foreigner/SerializableTableColumn.java
    sis/branches/JDK8/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/IOUtilities.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -381,7 +381,7 @@ final class Element implements Serializa
      * @return the exception to be thrown.
      */
     final ParseException parseFailed(final Exception cause) {
-        return (ParseException) new LocalizedParseException(locale, Errors.Keys.ErrorIn_2,
+        return new LocalizedParseException(locale, Errors.Keys.ErrorIn_2,
                 new String[] {keyword, Exceptions.getLocalizedMessage(cause, locale)}, offset).initCause(cause);
     }
 

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -668,8 +668,8 @@ class GeodeticObjectParser extends MathT
                     warning(parent, element, Errors.formatInternational(Errors.Keys.UnexpectedScaleFactorForUnit_2, verify, factor), null);
                 }
             } catch (IncommensurableException e) {
-                throw (ParseException) new LocalizedParseException(errorLocale,
-                        Errors.Keys.InconsistentUnitsForCS_1, new Object[] {verify}, element.offset).initCause(e);
+                throw new LocalizedParseException(errorLocale, Errors.Keys.InconsistentUnitsForCS_1,
+                        new Object[] {verify}, element.offset).initCause(e);
             }
         }
         return unit;

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -248,8 +248,8 @@ class MathTransformParser extends Abstra
         try {
             return parseUnit(name);
         } catch (ParserException e) {
-            throw (ParseException) new LocalizedParseException(errorLocale,
-                    Errors.Keys.UnknownUnit_1, new Object[] {name}, element.offset).initCause(e);
+            throw new LocalizedParseException(errorLocale, Errors.Keys.UnknownUnit_1,
+                    new Object[] {name}, element.offset).initCause(e);
         }
     }
 
@@ -311,7 +311,7 @@ class MathTransformParser extends Abstra
                 param.close(ignoredElements);
             }
         } catch (ParameterNotFoundException e) {
-            throw (ParseException) new LocalizedParseException(errorLocale, Errors.Keys.UnexpectedParameter_1,
+            throw new LocalizedParseException(errorLocale, Errors.Keys.UnexpectedParameter_1,
                     new String[] {e.getParameterName()}, param.offset).initCause(e);
         } catch (InvalidParameterValueException e) {
             throw (ParseException) new ParseException(e.getLocalizedMessage(), param.offset).initCause(e);

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -1022,10 +1022,8 @@ class PropertyAccessor {
                     }
                     elements[i] = ((ObjectConverter) converter).apply(value);
                 } catch (UnconvertibleObjectException cause) {
-                    final ClassCastException e = new ClassCastException(Errors.format(
-                            Errors.Keys.IllegalClass_2, targetType, sourceType));
-                    e.initCause(cause);
-                    throw e;
+                    throw (ClassCastException) new ClassCastException(Errors.format(
+                            Errors.Keys.IllegalClass_2, targetType, sourceType)).initCause(cause);
                 }
             }
         }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -726,10 +726,8 @@ addURIs:    for (int i=0; ; i++) {
             try {
                 primaryKeys[i] = Integer.parseInt(code);
             } catch (NumberFormatException e) {
-                final NoSuchAuthorityCodeException ne = new NoSuchAuthorityCodeException(error().getString(
-                        Errors.Keys.IllegalIdentifierForCodespace_2, Constants.EPSG, code), Constants.EPSG, code);
-                ne.initCause(e);
-                throw ne;
+                throw (NoSuchAuthorityCodeException) new NoSuchAuthorityCodeException(error().getString(
+                        Errors.Keys.IllegalIdentifierForCodespace_2, Constants.EPSG, code), Constants.EPSG, code).initCause(e);
             }
         }
         return primaryKeys;
@@ -2643,10 +2641,8 @@ next:               while (r.next()) {
                      * Callers can use this information in order to determine if they should try the next coordinate
                      * operation or propagate the exception.
                      */
-                    final NoSuchIdentifierException e = new NoSuchIdentifierException(error()
-                            .getString(Errors.Keys.CanNotSetParameterValue_1, name), name);
-                    e.initCause(exception);
-                    throw e;
+                    throw (NoSuchIdentifierException) new NoSuchIdentifierException(error().getString(
+                            Errors.Keys.CanNotSetParameterValue_1, name), name).initCause(exception);
                 }
                 try {
                     if (reference != null) {

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -51,28 +51,32 @@ public final class LocalizedParseExcepti
     private static final long serialVersionUID = -1467571540435486742L;
 
     /**
-     * The resources key as one of the {@code Errors.Keys} constant.
+     * The resources key as one of the {@link Errors.Keys} constant, or 0 if none.
+     *
+     * <p>This field is not serialized because key values sometime change between different SIS versions.
+     * The deserialized value will be 0, which will cause this {@code LocalizedParseException} to fallback
+     * on {@code super.getMessage()}.</p>
      */
-    private final short key;
+    private transient final short key;
 
     /**
-     * The arguments for the localization message.
+     * The parameters for the localization message.
      */
-    private final Object[] arguments;
+    private transient final Object[] parameters;
 
     /**
-     * Constructs a {@code ParseException} with a message formatted from the given resource key and message arguments.
+     * Constructs a {@code ParseException} with a message formatted from the given resource key and message parameters.
      * This is the most generic constructor.
      *
      * @param  locale       the locale for {@link #getLocalizedMessage()}, or {@code null} for the default.
      * @param  key          the resource key as one of the {@code Errors.Keys} constant.
-     * @param  arguments    the values to be given to {@link Errors#getString(short, Object)}.
+     * @param  parameters   the values to be given to {@link Errors#getString(short, Object)}.
      * @param  errorOffset  the position where the error is found while parsing.
      */
-    public LocalizedParseException(final Locale locale, final short key, final Object[] arguments, final int errorOffset) {
-        super(Errors.getResources(locale).getString(key, arguments), errorOffset);
-        this.arguments = arguments;
-        this.key       = key;
+    public LocalizedParseException(final Locale locale, final short key, final Object[] parameters, final int errorOffset) {
+        super(Errors.getResources(locale).getString(key, parameters), errorOffset);
+        this.parameters = parameters;
+        this.key        = key;
     }
 
     /**
@@ -109,20 +113,20 @@ public final class LocalizedParseExcepti
      * Workaround for RFE #4093999
      * ("Relax constraint on placement of this()/super() call in constructors").
      */
-    @Workaround(library="JDK", version="1.7")
+    @Workaround(library="JDK", version="1.8")
     private LocalizedParseException(final Locale locale, final Class<?> type,
             final CharSequence text, final int offset, final int errorOffset)
     {
-        this(locale, arguments(type, text, offset, Math.max(offset, errorOffset)), errorOffset);
+        this(locale, parameters(type, text, offset, Math.max(offset, errorOffset)), errorOffset);
     }
 
     /**
      * Workaround for RFE #4093999
      * ("Relax constraint on placement of this()/super() call in constructors").
      */
-    @Workaround(library="JDK", version="1.7")
-    private LocalizedParseException(final Locale locale, final Object[] arguments, final int errorOffset) {
-        this(locale, key(arguments), arguments, errorOffset);
+    @Workaround(library="JDK", version="1.8")
+    private LocalizedParseException(final Locale locale, final Object[] parameters, final int errorOffset) {
+        this(locale, key(parameters), parameters, errorOffset);
     }
 
     /**
@@ -133,10 +137,10 @@ public final class LocalizedParseExcepti
      * @param  text         the text that {@code Format} failed to parse.
      * @param  offset       index of the first character to parse in {@code text}.
      * @param  errorOffset  the position where the error is found while parsing.
-     * @return the {@code arguments} value to give to the constructor.
+     * @return the {@code parameters} value to give to the constructor.
      */
-    @Workaround(library="JDK", version="1.7")
-    private static Object[] arguments(final Class<?> type, CharSequence text, final int offset, final int errorOffset) {
+    @Workaround(library="JDK", version="1.8")
+    private static Object[] parameters(final Class<?> type, CharSequence text, final int offset, final int errorOffset) {
         if (errorOffset >= text.length()) {
             return new Object[] {text};
         }
@@ -152,10 +156,10 @@ public final class LocalizedParseExcepti
      * Workaround for RFE #4093999
      * ("Relax constraint on placement of this()/super() call in constructors").
      */
-    @Workaround(library="JDK", version="1.7")
-    private static short key(final Object[] arguments) {
+    @Workaround(library="JDK", version="1.8")
+    private static short key(final Object[] parameters) {
         final short key;
-        switch (arguments.length) {
+        switch (parameters.length) {
             case 1: key = Errors.Keys.UnexpectedEndOfString_1;    break;
             case 2: key = Errors.Keys.UnparsableStringForClass_2; break;
             case 3: key = Errors.Keys.UnparsableStringForClass_3; break;
@@ -171,7 +175,7 @@ public final class LocalizedParseExcepti
      */
     @Override
     public String getMessage() {
-        return Errors.format(key, arguments);
+        return (key != 0) ? Errors.format(key, parameters) : super.getMessage();
     }
 
     /**
@@ -185,12 +189,24 @@ public final class LocalizedParseExcepti
     }
 
     /**
-     * Return the message in various locales.
+     * If this exception is capable to return the message in various locales, returns that message.
+     * Otherwise returns {@code null}.
      *
-     * @return the exception message.
+     * @return the exception message, or {@code null} if this exception can not produce international message.
      */
     @Override
     public InternationalString getInternationalMessage() {
-        return Errors.formatInternational(key, arguments);
+        return (key != 0) ? Errors.formatInternational(key, parameters) : null;
+    }
+
+    /**
+     * Initializes the <i>cause</i> of this throwable to the specified value.
+     *
+     * @param  cause  the cause saved for later retrieval by the {@link #getCause()} method.
+     * @return a reference to this {@code LocalizedParseException} instance.
+     */
+    @Override
+    public LocalizedParseException initCause(final Throwable cause) {
+        return (LocalizedParseException) super.initCause(cause);
     }
 }

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -344,9 +344,7 @@ public final class StandardDateFormat ex
         try {
             return toDate(format.parse(text));
         } catch (DateTimeException | ArithmeticException e) {
-            ParseException p = new ParseException(e.getLocalizedMessage(), getErrorIndex(e, null));
-            p.initCause(e);
-            throw p;
+            throw (ParseException) new ParseException(e.getLocalizedMessage(), getErrorIndex(e, null)).initCause(e);
         }
     }
 

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/DefaultFormat.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -115,9 +115,7 @@ final class DefaultFormat extends Format
         try {
             return valueOf(source);
         } catch (NumberFormatException cause) {
-            ParseException e = new LocalizedParseException(null, type, source, null);
-            e.initCause(cause);
-            throw e;
+            throw new LocalizedParseException(null, type, source, null).initCause(cause);
         }
     }
 

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -121,9 +121,7 @@ public class Angle implements Comparable
              * 'getAngleFormat()' implementation. The getMessage() method uses the system locale,
              * which is what we actually want.
              */
-            NumberFormatException e = new NumberFormatException(exception.getMessage());
-            e.initCause(exception);
-            throw e;
+            throw (NumberFormatException) new NumberFormatException(exception.getMessage()).initCause(exception);
         }
         final Class<?> type = angle.getClass();
         if (type == Angle.class || getClass().isAssignableFrom(type)) {

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -70,9 +70,7 @@ class FormatField extends Format.Field {
         try {
             return type.cast(type.getField(getName()).get(null));
         } catch (Exception cause) {                                 // Many exceptions, including unchecked ones.
-            InvalidObjectException e = new InvalidObjectException(cause.toString());
-            e.initCause(cause);
-            throw e;
+            throw (InvalidObjectException) new InvalidObjectException(cause.toString()).initCause(cause);
         }
     }
 }

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -724,10 +724,8 @@ public class RangeFormat extends Format
             failure = e;
         }
         final int errorIndex = pos.getErrorIndex();
-        final ParseException e = new ParseException(Errors.format(Errors.Keys.UnparsableStringForClass_3,
-                elementType, source, CharSequences.token(source, errorIndex)), errorIndex);
-        e.initCause(failure);
-        throw e;
+        throw (ParseException) new ParseException(Errors.format(Errors.Keys.UnparsableStringForClass_3,
+                elementType, source, CharSequences.token(source, errorIndex)), errorIndex).initCause(failure);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -60,7 +60,7 @@ import org.apache.sis.internal.system.Mo
  *     }
  * }
  *
- * @param <T> The type of option values.
+ * @param  <T>  the type of option values.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -239,9 +239,7 @@ public class TableColumn<V> implements C
             try {
                 return TableColumn.class.getField(field).get(null);
             } catch (ReflectiveOperationException cause) {
-                InvalidObjectException e = new InvalidObjectException(cause.toString());
-                e.initCause(cause);
-                throw e;
+                throw (InvalidObjectException) new InvalidObjectException(cause.toString()).initCause(cause);
             }
         }
     }

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -304,11 +304,9 @@ public class IndexedResourceBundle exten
                         record.setMessage(exception.getMessage());              // For administrator, use system locale.
                         record.setThrown (exception);
                         Logging.log(IndexedResourceBundle.class, methodName, record);
-                        final MissingResourceException error = new MissingResourceException(
+                        throw (MissingResourceException) new MissingResourceException(
                                 Exceptions.getLocalizedMessage(exception, locale),   // For users, use requested locale.
-                                baseName, key);
-                        error.initCause(exception);
-                        throw error;
+                                baseName, key).initCause(exception);
                     }
                     /*
                      * Now, logs the message. This message is provided only in English.

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -116,9 +116,7 @@ final class Loader extends ResourceBundl
         try {
             return (ResourceBundle) classe.getDeclaredConstructor(URL.class).newInstance(resources);
         } catch (NoSuchMethodException | InvocationTargetException e) {
-            InstantiationException exception = new InstantiationException(e.toString());
-            exception.initCause(e);
-            throw exception;
+            throw (InstantiationException) new InstantiationException(e.toString()).initCause(e);
         }
     }
 }

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -169,9 +169,7 @@ public abstract class ResourceInternatio
         try {
             key = getKeyConstants().getKeyValue(in.readUTF());
         } catch (ReflectiveOperationException cause) {
-            InvalidObjectException e = new InvalidObjectException(cause.toString());
-            e.initCause(cause);
-            throw e;
+            throw (InvalidObjectException) new InvalidObjectException(cause.toString()).initCause(cause);
         }
     }
 }

Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/foreigner/SerializableTableColumn.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/foreigner/SerializableTableColumn.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/foreigner/SerializableTableColumn.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/foreigner/SerializableTableColumn.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -53,9 +53,9 @@ public final strictfp class Serializable
     /**
      * Creates a new instance for the given type of values.
      *
-     * @param field  The programmatic name of the static final field holding this constant.
-     * @param type   Base type of all values in the column identified by this instance.
-     * @param header The text to display as column header.
+     * @param  field   the programmatic name of the static final field holding this constant.
+     * @param  type    base type of all values in the column identified by this instance.
+     * @param  header  the text to display as column header.
      */
     private SerializableTableColumn(final String field, final Class<V> type, final CharSequence header) {
         super(type, header);
@@ -65,16 +65,14 @@ public final strictfp class Serializable
     /**
      * Invoked on deserialization for resolving this instance to one of the predefined constants.
      *
-     * @return One of the predefined constants.
-     * @throws InvalidObjectException If this instance can not be resolved.
+     * @return one of the predefined constants.
+     * @throws InvalidObjectException if this instance can not be resolved.
      */
     private Object readResolve() throws ObjectStreamException {
         try {
             return SerializableTableColumn.class.getField(field).get(null);
-        } catch (Exception cause) { // Many exceptions, including unchecked ones.
-            InvalidObjectException e = new InvalidObjectException(cause.toString());
-            e.initCause(cause);
-            throw e;
+        } catch (Exception cause) {                 // Many exceptions, including unchecked ones.
+            throw (InvalidObjectException) new InvalidObjectException(cause.toString()).initCause(cause);
         }
     }
 }

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=1776609&r1=1776608&r2=1776609&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] Fri Dec 30 17:00:28 2016
@@ -27,6 +27,7 @@ import org.apache.sis.storage.DataStoreE
 import org.apache.sis.storage.DataStoreReferencingException;
 import org.apache.sis.storage.UnsupportedStorageException;
 import org.apache.sis.storage.StorageConnector;
+import org.apache.sis.setup.OptionKey;
 import org.apache.sis.util.Debug;
 
 
@@ -94,7 +95,8 @@ public class LandsatStore extends DataSt
         source = connector.getStorageAs(Reader.class);
         connector.closeAllExcept(source);
         if (source == null) {
-            throw new UnsupportedStorageException(super.getLocale(), true, "Landsat", connector.getStorage());
+            throw new UnsupportedStorageException(super.getLocale(), "Landsat",
+                    connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
         }
     }
 

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.nio.charset.Charset;
 import java.util.logging.LogRecord;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.StandardOpenOption;
 import org.opengis.util.FactoryException;
 import org.opengis.metadata.Metadata;
 import org.opengis.metadata.maintenance.ScopeCode;
@@ -80,7 +81,8 @@ public class GeoTiffStore extends DataSt
         this.encoding = (encoding != null) ? encoding : StandardCharsets.US_ASCII;
         final ChannelDataInput input = connector.getStorageAs(ChannelDataInput.class);
         if (input == null) {
-            throw new UnsupportedStorageException(super.getLocale(), false, "TIFF", connector.getStorage());
+            throw new UnsupportedStorageException(super.getLocale(), "TIFF",
+                    connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
         }
         connector.closeAllExcept(input);
         try {
@@ -133,7 +135,7 @@ public class GeoTiffStore extends DataSt
     private Reader reader() throws DataStoreException {
         final Reader r = reader;
         if (r == null) {
-            throw new DataStoreClosedException(getLocale(), false, "GeoTIFF");
+            throw new DataStoreClosedException(getLocale(), "GeoTIFF", StandardOpenOption.READ);
         }
         return r;
     }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -25,6 +25,7 @@ import org.apache.sis.storage.Unsupporte
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.metadata.ModifiableMetadata;
+import org.apache.sis.setup.OptionKey;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.Version;
 import ucar.nc2.constants.CDM;
@@ -87,7 +88,8 @@ public class NetcdfStore extends DataSto
             throw new DataStoreException(e);
         }
         if (decoder == null) {
-            throw new UnsupportedStorageException(super.getLocale(), false, "NetCDF", connector.getStorage());
+            throw new UnsupportedStorageException(super.getLocale(), "NetCDF",
+                    connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
         }
     }
 

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/IOUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/IOUtilities.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/IOUtilities.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/IOUtilities.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -260,10 +260,8 @@ public final class IOUtilities extends S
              * Occurs only if the URL is not compliant with RFC 2396. Otherwise every URL
              * should succeed, so a failure can actually be considered as a malformed URL.
              */
-            final MalformedURLException e = new MalformedURLException(Exceptions.formatChainedMessages(
-                    null, Errors.format(Errors.Keys.IllegalArgumentValue_2, "URL", path), cause));
-            e.initCause(cause);
-            throw e;
+            throw (MalformedURLException) new MalformedURLException(Exceptions.formatChainedMessages(null,
+                    Errors.format(Errors.Keys.IllegalArgumentValue_2, "URL", path), cause)).initCause(cause);
         }
     }
 
@@ -558,6 +556,41 @@ public final class IOUtilities extends S
     }
 
     /**
+     * Returns {@code true} if the given options would open a file mostly for writing.
+     * This method returns {@code true} if the following conditions are true:
+     *
+     * <ul>
+     *   <li>The array contains {@link StandardOpenOption#WRITE}.</li>
+     *   <li>The array does not contain {@link StandardOpenOption#READ}, unless the array contains also
+     *       {@link StandardOpenOption#CREATE_NEW} or {@link StandardOpenOption#TRUNCATE_EXISTING} in which
+     *       case the {@code READ} option is ignored (because the caller would have no data to read).</li>
+     * </ul>
+     *
+     * @param  options  the open options to check, or {@code null} if none.
+     * @return {@code true} if a file opened with the given options would be mostly for write operations.
+     *
+     * @since 0.8
+     */
+    public static boolean isWrite(final OpenOption[] options) {
+        boolean isRead   = false;
+        boolean isWrite  = false;
+        boolean truncate = false;
+        if (options != null) {
+            for (final OpenOption op : options) {
+                if (op instanceof StandardOpenOption) {
+                    switch ((StandardOpenOption) op) {
+                        case READ:              isRead   = true; break;
+                        case WRITE:             isWrite  = true; break;
+                        case CREATE_NEW:
+                        case TRUNCATE_EXISTING: truncate = true; break;
+                    }
+                }
+            }
+        }
+        return isWrite & (!isRead | truncate);
+    }
+
+    /**
      * Returns the {@link Resources.Keys} value together with the parameters given by {@code errorMessageParameters(…)}.
      *
      * @param   parameters  the result of {@code errorMessageParameters(…)} method call.

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreClosedException.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -17,6 +17,8 @@
 package org.apache.sis.storage;
 
 import java.util.Locale;
+import java.nio.file.OpenOption;
+import org.apache.sis.internal.storage.IOUtilities;
 import org.apache.sis.internal.storage.Resources;
 
 
@@ -55,14 +57,17 @@ public class DataStoreClosedException ex
 
     /**
      * Creates a localized exception for a reader or writer which has been closed.
+     * Arguments given to this constructor are hints for building an error message.
      *
-     * @param locale  the locale of the message to be returned by {@link #getLocalizedMessage()}, or {@code null}.
-     * @param writer  {@code false} if a read operation was attempted, or {@code true} if a write operation was attempted.
-     * @param format  short name or abbreviation of the data format (e.g. "CSV", "GML", "WKT", <i>etc</i>).
+     * @param locale   the locale of the message to be returned by {@link #getLocalizedMessage()}, or {@code null}.
+     * @param format   short name or abbreviation of the data format (e.g. "CSV", "GML", "WKT", <i>etc</i>).
+     * @param options  the option used for opening the file, or {@code null} or empty if unknown.
+     *                 This method looks in particular for {@link java.nio.file.StandardOpenOption#READ} and
+     *                 {@code WRITE} options for inferring if the data store was used as a reader or as a writer.
      *
      * @since 0.8
      */
-    public DataStoreClosedException(final Locale locale, final boolean writer, final String format) {
-        super(locale, writer ? Resources.Keys.ClosedWriter_1 : Resources.Keys.ClosedReader_1, format);
+    public DataStoreClosedException(final Locale locale, final String format, final OpenOption... options) {
+        super(locale, IOUtilities.isWrite(options) ? Resources.Keys.ClosedWriter_1 : Resources.Keys.ClosedReader_1, format);
     }
 }

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -49,22 +49,26 @@ public class DataStoreException extends
     private static final long serialVersionUID = -1778987176103191950L;
 
     /**
-     * The resources key as one of the {@code Resources.Keys} constant, or 0 if none.
+     * The resources key as one of the {@link Resources.Keys} constant, or 0 if none.
+     *
+     * <p>This field is not serialized because key values sometime change between different SIS versions.
+     * The deserialized value will be 0, which will cause this {@code DataStoreException} to fallback on
+     * {@code super.getMessage()}.</p>
      */
-    private final short key;
+    private final transient short key;
 
     /**
-     * The arguments for the localization message, or {@code null} if none.
+     * The parameters for the localization message, or {@code null} if none.
      */
-    private final Object[] arguments;
+    private final transient Object[] parameters;
 
     /**
      * Creates an exception with no cause and no details message.
      */
     public DataStoreException() {
         super();
-        key       = 0;
-        arguments = null;
+        key        = 0;
+        parameters = null;
     }
 
     /**
@@ -74,8 +78,8 @@ public class DataStoreException extends
      */
     public DataStoreException(final String message) {
         super(message);
-        key       = 0;
-        arguments = null;
+        key        = 0;
+        parameters = null;
     }
 
     /**
@@ -85,8 +89,8 @@ public class DataStoreException extends
      */
     public DataStoreException(final Throwable cause) {
         super(cause);
-        key       = 0;
-        arguments = null;
+        key        = 0;
+        parameters = null;
     }
 
     /**
@@ -97,8 +101,8 @@ public class DataStoreException extends
      */
     public DataStoreException(final String message, final Throwable cause) {
         super(message, cause);
-        key       = 0;
-        arguments = null;
+        key        = 0;
+        parameters = null;
     }
 
     /**
@@ -138,8 +142,8 @@ public class DataStoreException extends
      */
     DataStoreException(final Locale locale, final short key, final Object... parameters) {
         super(Resources.forLocale(locale).getString(key, parameters));
-        this.key       = key;
-        this.arguments = parameters;
+        this.key        = key;
+        this.parameters = parameters;
     }
 
     /**
@@ -149,7 +153,7 @@ public class DataStoreException extends
      */
     @Override
     public String getMessage() {
-        return (key != 0) ? Resources.format(key, arguments) : super.getMessage();
+        return (key != 0) ? Resources.format(key, parameters) : super.getMessage();
     }
 
     /**
@@ -188,7 +192,7 @@ public class DataStoreException extends
      */
     @Override
     public InternationalString getInternationalMessage() {
-        return (key != 0) ? Resources.formatInternational(key, arguments) : null;
+        return (key != 0) ? Resources.formatInternational(key, parameters) : null;
     }
 
     /**

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -17,8 +17,10 @@
 package org.apache.sis.storage;
 
 import java.util.Locale;
+import java.nio.file.OpenOption;
 import org.apache.sis.util.Classes;
 import org.apache.sis.internal.storage.Resources;
+import org.apache.sis.internal.storage.IOUtilities;
 
 
 /**
@@ -85,17 +87,20 @@ public class UnsupportedStorageException
 
     /**
      * Creates a localized exception for an invalid input or output object given to a data store.
+     * Arguments given to this constructor are hints for building an error message.
      *
      * @param locale   the locale of the message to be returned by {@link #getLocalizedMessage()}, or {@code null}.
-     * @param writer   {@code false} if a read operation was attempted, or {@code true} if a write operation was attempted.
      * @param format   short name or abbreviation of the data format (e.g. "CSV", "GML", "WKT", <i>etc</i>).
      * @param storage  the invalid input or output object.
+     * @param options  the option used for opening the file, or {@code null} or empty if unknown.
+     *                 This method looks in particular for {@link java.nio.file.StandardOpenOption#READ} and
+     *                 {@code WRITE} options for inferring if the data store was to be used as a reader or as a writer.
      *
      * @since 0.8
      */
-    public UnsupportedStorageException(final Locale locale, final boolean writer, final String format, final Object storage) {
-        super(locale, writer ? Resources.Keys.IllegalOutputTypeForWriter_2
-                             : Resources.Keys.IllegalInputTypeForReader_2,
+    public UnsupportedStorageException(final Locale locale, final String format, final Object storage, final OpenOption... options) {
+        super(locale, IOUtilities.isWrite(options) ? Resources.Keys.IllegalOutputTypeForWriter_2
+                                                   : Resources.Keys.IllegalInputTypeForReader_2,
                       format, Classes.getClass(storage));
     }
 }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java?rev=1776609&r1=1776608&r2=1776609&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxDataStore.java [UTF-8] Fri Dec 30 17:00:28 2016
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Path;
 import java.nio.charset.Charset;
+import java.nio.file.StandardOpenOption;
 import javax.xml.stream.Location;
 import javax.xml.stream.XMLReporter;
 import javax.xml.stream.XMLInputFactory;
@@ -356,7 +357,7 @@ public abstract class StaxDataStore exte
     {
         Object input = storage;
         if (input == null) {
-            throw new DataStoreClosedException(getLocale(), false, getFormatName());
+            throw new DataStoreClosedException(getLocale(), getFormatName(), StandardOpenOption.READ);
         }
         /*
          * If the storage given by the user was not one of InputStream, Reader or other type recognized
@@ -367,7 +368,7 @@ public abstract class StaxDataStore exte
         if (type == null) {
             type = InputType.STREAM;
             if ((input = stream) == null) {
-                throw new UnsupportedStorageException(getLocale(), false, getFormatName(), storage);
+                throw new UnsupportedStorageException(getLocale(), getFormatName(), storage, StandardOpenOption.READ);
             }
         }
         /*
@@ -421,7 +422,7 @@ reset:  switch (state) {
     {
         Object output = storage;
         if (output == null) {
-            throw new DataStoreClosedException(getLocale(), true, getFormatName());
+            throw new DataStoreClosedException(getLocale(), getFormatName(), StandardOpenOption.WRITE);
         }
         /*
          * If the storage given by the user was not one of OutputStream, Writer or other type recognized
@@ -431,7 +432,7 @@ reset:  switch (state) {
         OutputType type = storageToWriter;
         if (type == null) {
             // TODO
-            throw new UnsupportedStorageException(getLocale(), true, getFormatName(), storage);
+            throw new UnsupportedStorageException(getLocale(), getFormatName(), storage, StandardOpenOption.WRITE);
         }
         final XMLStreamWriter writer = type.create(this, output);
         target.stream = stream;



Mime
View raw message