sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1776531 [4/4] - in /sis/branches/JDK8: application/sis-console/src/main/java/org/apache/sis/console/ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata...
Date Fri, 30 Dec 2016 09:23:26 GMT
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=1776531&r1=1776530&r2=1776531&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 09:23:24 2016
@@ -43,7 +43,6 @@ import org.apache.sis.storage.DataStoreC
 import org.apache.sis.storage.UnsupportedStorageException;
 import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.Classes;
 
 
 /**
@@ -357,7 +356,7 @@ public abstract class StaxDataStore exte
     {
         Object input = storage;
         if (input == null) {
-            throw new DataStoreClosedException(errors().getString(Errors.Keys.ClosedReader_1,
getFormatName()));
+            throw new DataStoreClosedException(getLocale(), false, getFormatName());
         }
         /*
          * If the storage given by the user was not one of InputStream, Reader or other type
recognized
@@ -368,8 +367,7 @@ public abstract class StaxDataStore exte
         if (type == null) {
             type = InputType.STREAM;
             if ((input = stream) == null) {
-                throw new UnsupportedStorageException(errors().getString(Errors.Keys.IllegalInputTypeForReader_2,
-                        getFormatName(), Classes.getClass(storage)));
+                throw new UnsupportedStorageException(getLocale(), false, getFormatName(),
storage);
             }
         }
         /*
@@ -423,7 +421,7 @@ reset:  switch (state) {
     {
         Object output = storage;
         if (output == null) {
-            throw new DataStoreClosedException(errors().getString(Errors.Keys.ClosedWriter_1,
getFormatName()));
+            throw new DataStoreClosedException(getLocale(), true, getFormatName());
         }
         /*
          * If the storage given by the user was not one of OutputStream, Writer or other
type recognized
@@ -433,8 +431,7 @@ reset:  switch (state) {
         OutputType type = storageToWriter;
         if (type == null) {
             // TODO
-            throw new UnsupportedStorageException(errors().getString(Errors.Keys.IllegalOutputTypeForWriter_2,
-                    getFormatName(), Classes.getClass(storage)));
+            throw new UnsupportedStorageException(getLocale(), true, getFormatName(), storage);
         }
         final XMLStreamWriter writer = type.create(this, output);
         target.stream = stream;

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamReader.java?rev=1776531&r1=1776530&r2=1776531&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamReader.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/xml/StaxStreamReader.java
[UTF-8] Fri Dec 30 09:23:24 2016
@@ -27,7 +27,6 @@ import java.io.IOException;
 import java.io.EOFException;
 import java.net.URISyntaxException;
 import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -523,16 +522,8 @@ parse:  switch (value.length()) {
      * @return a localized error message for a file that can not be parsed.
      */
     protected final String canNotParseFile() {
-        final int line, column;
-        if (reader != null) {
-            final Location location = reader.getLocation();
-            line   = location.getLineNumber()   + 1;
-            column = location.getColumnNumber() + 1;
-        } else {
-            line   = 0;
-            column = 0;
-        }
-        return IOUtilities.canNotParseFile(errors(), owner.getFormatName(), owner.name, line,
column);
+        final Object[] parameters = IOUtilities.errorMessageParameters(owner.getFormatName(),
owner.name, reader);
+        return errors().getString(IOUtilities.errorMessageKey(parameters), parameters);
     }
 
     /**



Mime
View raw message