You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/12/31 05:53:33 UTC
svn commit: r1776692 - in /sis/branches/JDK8:
core/sis-metadata/src/main/java/org/apache/sis/io/wkt/
core/sis-utility/src/main/java/org/apache/sis/util/logging/
storage/sis-storage/src/main/java/org/apache/sis/storage/
Author: desruisseaux
Date: Sat Dec 31 05:53:32 2016
New Revision: 1776692
URL: http://svn.apache.org/viewvc?rev=1776692&view=rev
Log:
Add a ParseException specialization for failure to parse Well Known Text (WKT) format.
Added:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java
- copied, changed from r1776609, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
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/io/wkt/WKTFormat.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.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
Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java?rev=1776692&r1=1776691&r2=1776692&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java [UTF-8] Sat Dec 31 05:53:32 2016
@@ -34,7 +34,6 @@ import javax.measure.format.ParserExcept
import org.opengis.util.FactoryException;
import org.opengis.util.InternationalString;
import org.apache.sis.internal.system.Loggers;
-import org.apache.sis.internal.util.LocalizedParseException;
import org.apache.sis.internal.util.StandardDateFormat;
import org.apache.sis.measure.Units;
import org.apache.sis.measure.UnitFormat;
@@ -273,7 +272,7 @@ abstract class AbstractParser implements
fragment = fragments.get(id);
if (fragment == null) {
position.setErrorIndex(lower);
- throw new LocalizedParseException(errorLocale, Errors.Keys.NoSuchValue_1, new Object[] {id}, lower);
+ throw new UnparsableObjectException(errorLocale, Errors.Keys.NoSuchValue_1, new Object[] {id}, lower);
}
position.setIndex(upper);
fragment = new Element(fragment);
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=1776692&r1=1776691&r2=1776692&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] Sat Dec 31 05:53:32 2016
@@ -35,7 +35,6 @@ import org.apache.sis.util.resources.Err
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.internal.util.UnmodifiableArrayList;
-import org.apache.sis.internal.util.LocalizedParseException;
import static org.apache.sis.util.CharSequences.skipLeadingWhitespaces;
@@ -232,7 +231,7 @@ final class Element implements Serializa
if (fragment == null) {
position.setIndex(offset);
position.setErrorIndex(lower);
- throw new LocalizedParseException(locale, Errors.Keys.NoSuchValue_1, new Object[] {id}, lower);
+ throw new UnparsableObjectException(locale, Errors.Keys.NoSuchValue_1, new Object[] {id}, lower);
}
if (fragment.list != null) {
fragment = new Element(fragment);
@@ -381,7 +380,7 @@ final class Element implements Serializa
* @return the exception to be thrown.
*/
final ParseException parseFailed(final Exception cause) {
- return new LocalizedParseException(locale, Errors.Keys.ErrorIn_2,
+ return new UnparsableObjectException(locale, Errors.Keys.ErrorIn_2,
new String[] {keyword, Exceptions.getLocalizedMessage(cause, locale)}, offset).initCause(cause);
}
@@ -408,7 +407,7 @@ final class Element implements Serializa
arguments = new CharSequence[] {keyword, CharSequences.token(text, errorIndex)};
}
position.setIndex(offset);
- return new LocalizedParseException(locale, errorKey, arguments, errorIndex);
+ return new UnparsableObjectException(locale, errorKey, arguments, errorIndex);
}
/**
@@ -422,7 +421,7 @@ final class Element implements Serializa
position.setIndex(offset);
position.setErrorIndex(errorIndex);
final StringBuilder buffer = new StringBuilder(2).appendCodePoint(c);
- return new LocalizedParseException(locale, Errors.Keys.MissingCharacterInElement_2,
+ return new UnparsableObjectException(locale, Errors.Keys.MissingCharacterInElement_2,
new CharSequence[] {keyword, buffer}, errorIndex);
}
@@ -436,7 +435,7 @@ final class Element implements Serializa
if (keyword != null) {
error += keyword.length();
}
- return new LocalizedParseException(locale, Errors.Keys.MissingComponentInElement_2,
+ return new UnparsableObjectException(locale, Errors.Keys.MissingComponentInElement_2,
new String[] {keyword, key}, error);
}
@@ -465,7 +464,7 @@ final class Element implements Serializa
res = Errors.Keys.MissingComponentInElement_2;
args = new String[] {keyword, expected};
}
- return new LocalizedParseException(locale, res, args, offset);
+ return new UnparsableObjectException(locale, res, args, offset);
}
/**
@@ -489,7 +488,7 @@ final class Element implements Serializa
key = Errors.Keys.IllegalCoordinateSystem_1;
value = cs.getName().getCode();
}
- return new LocalizedParseException(locale, key, new String[] {value}, offset);
+ return new UnparsableObjectException(locale, key, new String[] {value}, offset);
}
@@ -570,7 +569,7 @@ final class Element implements Serializa
iterator.remove();
final Number number = (Number) object;
if (number instanceof Float || number instanceof Double) {
- throw new LocalizedParseException(locale, Errors.Keys.UnparsableStringForClass_2,
+ throw new UnparsableObjectException(locale, Errors.Keys.UnparsableStringForClass_2,
new Object[] {Integer.class, number}, offset);
}
return number.intValue();
@@ -758,7 +757,7 @@ final class Element implements Serializa
if (value instanceof Element) {
CollectionsExt.addToMultiValuesMap(ignoredElements, ((Element) value).keyword, keyword);
} else {
- throw new LocalizedParseException(locale, Errors.Keys.UnexpectedValueInElement_2,
+ throw new UnparsableObjectException(locale, Errors.Keys.UnexpectedValueInElement_2,
new Object[] {keyword, value}, offset + keyword.length());
}
}
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=1776692&r1=1776691&r2=1776692&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] Sat Dec 31 05:53:32 2016
@@ -70,7 +70,6 @@ import org.apache.sis.internal.metadata.
import org.apache.sis.internal.metadata.VerticalDatumTypes;
import org.apache.sis.internal.metadata.ReferencingServices;
import org.apache.sis.internal.metadata.TransformationAccuracy;
-import org.apache.sis.internal.util.LocalizedParseException;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.util.CharSequences;
@@ -668,7 +667,7 @@ class GeodeticObjectParser extends MathT
warning(parent, element, Errors.formatInternational(Errors.Keys.UnexpectedScaleFactorForUnit_2, verify, factor), null);
}
} catch (IncommensurableException e) {
- throw new LocalizedParseException(errorLocale, Errors.Keys.InconsistentUnitsForCS_1,
+ throw new UnparsableObjectException(errorLocale, Errors.Keys.InconsistentUnitsForCS_1,
new Object[] {verify}, element.offset).initCause(e);
}
}
@@ -736,7 +735,7 @@ class GeodeticObjectParser extends MathT
csProperties = new HashMap<>(parseMetadataAndClose(element, "CS", null));
if (expected != null) {
if (!expected.equalsIgnoreCase(type)) {
- throw new LocalizedParseException(errorLocale, Errors.Keys.UnexpectedValueInElement_2,
+ throw new UnparsableObjectException(errorLocale, Errors.Keys.UnexpectedValueInElement_2,
new String[] {WKTKeywords.CS, type}, element.offset);
}
}
@@ -750,7 +749,7 @@ class GeodeticObjectParser extends MathT
key = Errors.Keys.ExcessiveNumberOfDimensions_1;
args = new Object[] {dimension};
}
- throw new LocalizedParseException(errorLocale, key, args, element.offset);
+ throw new UnparsableObjectException(errorLocale, key, args, element.offset);
}
type = type.equalsIgnoreCase(WKTKeywords.Cartesian) ?
WKTKeywords.Cartesian : type.toLowerCase(symbols.getLocale());
@@ -993,7 +992,7 @@ class GeodeticObjectParser extends MathT
return referencing.createAbstractCS(csProperties, axes);
}
}
- throw new LocalizedParseException(errorLocale, (axes.length > dimension)
+ throw new UnparsableObjectException(errorLocale, (axes.length > dimension)
? Errors.Keys.TooManyOccurrences_2 : Errors.Keys.TooFewOccurrences_2,
new Object[] {dimension, WKTKeywords.Axis}, parent.offset);
}
@@ -1106,7 +1105,7 @@ class GeodeticObjectParser extends MathT
throw element.parseFailed(exception);
}
if (axisOrder.put(axis, n) != null) { // Opportunist check, effective for instances created by SIS factory.
- throw new LocalizedParseException(errorLocale, Errors.Keys.DuplicatedElement_1,
+ throw new UnparsableObjectException(errorLocale, Errors.Keys.DuplicatedElement_1,
new Object[] {WKTKeywords.Axis + "[\u201c" + name + "\u201d]"}, element.offset);
}
return axis;
@@ -2100,7 +2099,7 @@ class GeodeticObjectParser extends MathT
final String name = element.pullString("name");
final SingleCRS geoCRS = parseGeodeticCRS(MANDATORY, element, 2, WKTKeywords.ellipsoidal);
if (!(geoCRS instanceof GeographicCRS)) {
- throw new LocalizedParseException(errorLocale, Errors.Keys.IllegalCRSType_1,
+ throw new UnparsableObjectException(errorLocale, Errors.Keys.IllegalCRSType_1,
new Object[] {geoCRS.getClass()}, element.offset);
}
/*
@@ -2209,7 +2208,7 @@ class GeodeticObjectParser extends MathT
final OperationMethod method = getOperationMethod();
final CoordinateReferenceSystem baseCRS = parseCoordinateReferenceSystem(element, true);
if (!(baseCRS instanceof SingleCRS)) {
- throw new LocalizedParseException(errorLocale, Errors.Keys.UnexpectedValueInElement_2,
+ throw new UnparsableObjectException(errorLocale, Errors.Keys.UnexpectedValueInElement_2,
new Object[] {WKTKeywords.Fitted_CS, baseCRS.getClass()}, element.offset);
}
/*
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=1776692&r1=1776691&r2=1776692&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] Sat Dec 31 05:53:32 2016
@@ -39,7 +39,6 @@ import org.opengis.referencing.operation
import org.opengis.referencing.operation.OperationMethod;
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.metadata.ReferencingServices;
-import org.apache.sis.internal.util.LocalizedParseException;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.measure.Units;
import org.apache.sis.measure.UnitFormat;
@@ -248,7 +247,7 @@ class MathTransformParser extends Abstra
try {
return parseUnit(name);
} catch (ParserException e) {
- throw new LocalizedParseException(errorLocale, Errors.Keys.UnknownUnit_1,
+ throw new UnparsableObjectException(errorLocale, Errors.Keys.UnknownUnit_1,
new Object[] {name}, element.offset).initCause(e);
}
}
@@ -311,7 +310,7 @@ class MathTransformParser extends Abstra
param.close(ignoredElements);
}
} catch (ParameterNotFoundException e) {
- throw new LocalizedParseException(errorLocale, Errors.Keys.UnexpectedParameter_1,
+ throw new UnparsableObjectException(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);
Copied: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java (from r1776609, 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-metadata/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java?p2=sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java&p1=sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java&r1=1776609&r2=1776692&rev=1776692&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-metadata/src/main/java/org/apache/sis/io/wkt/UnparsableObjectException.java [UTF-8] Sat Dec 31 05:53:32 2016
@@ -14,158 +14,76 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.sis.internal.util;
+package org.apache.sis.io.wkt;
import java.util.Locale;
-import java.text.ParsePosition;
import java.text.ParseException;
import org.opengis.util.InternationalString;
-import org.apache.sis.util.Workaround;
-import org.apache.sis.util.CharSequences;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.LocalizedException;
/**
- * A {@link ParseException} in which {@link #getLocalizedMessage()} returns the message in the parser locale.
- * This exception contains the error message in two languages:
+ * Thrown when a <cite>Well Known Text</cite> (WKT) can not be parsed.
+ *
+ * <div class="section">Localization</div>
+ * This exception may contain the error message in two languages:
*
* <ul>
- * <li>{@link ParseException#getMessage()} returns the message in the default locale.</li>
- * <li>{@link ParseException#getLocalizedMessage()} returns the message in the locale given
- * in argument to the constructor.</li>
+ * <li>{@link #getMessage()} returns the message in the default locale.
+ * In a client-server architecture, this is typically the locale on the server side.</li>
+ * <li>{@link #getLocalizedMessage()} returns the message in the locale given in argument to the
+ * {@link WKTFormat#WKTFormat(java.util.Locale, java.util.TimeZone) WKTFormat} constructor.
+ * In a client-server architecture, it is presumably the locale on the client side.</li>
* </ul>
*
- * This locale given to the constructor is usually the {@link java.text.Format} locale,
- * which is presumed to be the end-user locale.
- *
* @author Martin Desruisseaux (Geomatys)
- * @since 0.3
+ * @since 0.8
* @version 0.8
* @module
*/
-public final class LocalizedParseException extends ParseException implements LocalizedException {
+public class UnparsableObjectException extends ParseException implements LocalizedException {
/**
* For cross-version compatibility.
*/
- private static final long serialVersionUID = -1467571540435486742L;
+ private static final long serialVersionUID = 5949195205739826024L;
/**
* 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
+ * The deserialized value will be 0, which will cause this {@code UnparsableObjectException} to fallback
* on {@code super.getMessage()}.</p>
*/
- private transient final short key;
+ private transient short key;
/**
* The parameters for the localization message.
*/
- private transient final Object[] parameters;
+ private transient Object[] parameters;
/**
- * Constructs a {@code ParseException} with a message formatted from the given resource key and message parameters.
- * This is the most generic constructor.
+ * Creates an exception with the specified details message.
*
- * @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 parameters the values to be given to {@link Errors#getString(short, Object)}.
+ * @param message the detail message in the default locale.
* @param errorOffset the position where the error is found while parsing.
*/
- 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;
+ public UnparsableObjectException(final String message, final int errorOffset) {
+ super(message, errorOffset);
}
/**
- * Constructs a {@code ParseException} with a message formatted from the given resource key and unparsable string.
- * This convenience constructor fetches the word starting at the error index,
- * and uses that word as the single argument associated to the resource key.
+ * Creates an exception with a message formatted from the given resource key and message parameters.
*
* @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 text the full text that {@code Format} failed to parse.
- * @param errorOffset the position where the error is found while parsing.
- */
- public LocalizedParseException(final Locale locale, final short key, final CharSequence text, final int errorOffset) {
- this(locale, key, new Object[] {CharSequences.token(text, errorOffset)}, errorOffset);
- }
-
- /**
- * Creates a {@link ParseException} with a localized message built from the given parsing information.
- * This convenience constructor creates a message of the kind <cite>"Can not parse string "text" as an
- * object of type 'type'"</cite>.
- *
- * @param locale the locale for {@link #getLocalizedMessage()}, or {@code null} for the default.
- * @param type the type of objects parsed by the {@link java.text.Format}.
- * @param text the full text that {@code Format} failed to parse.
- * @param pos index of the {@linkplain ParsePosition#getIndex() first parsed character},
- * together with the {@linkplain ParsePosition#getErrorIndex() error index}.
- * Can be {@code null} if index and error index are zero.
- */
- public LocalizedParseException(final Locale locale, final Class<?> type, final CharSequence text, final ParsePosition pos) {
- this(locale, type, text, (pos != null) ? pos.getIndex() : 0, (pos != null) ? pos.getErrorIndex() : 0);
- }
-
- /**
- * Workaround for RFE #4093999
- * ("Relax constraint on placement of this()/super() call in constructors").
- */
- @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, 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.8")
- private LocalizedParseException(final Locale locale, final Object[] parameters, final int errorOffset) {
- this(locale, key(parameters), parameters, errorOffset);
- }
-
- /**
- * Workaround for RFE #4093999
- * ("Relax constraint on placement of this()/super() call in constructors").
- *
- * @param type the type of objects parsed by the {@link java.text.Format}.
- * @param text the text that {@code Format} failed to parse.
- * @param offset index of the first character to parse in {@code text}.
+ * @param key the resource key as one of the {@link Errors.Keys} constant.
+ * @param parameters the values to be given to {@link Errors#getString(short, Object)}.
* @param errorOffset the position where the error is found while parsing.
- * @return the {@code parameters} value to give to the constructor.
*/
- @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};
- }
- text = text.subSequence(offset, text.length());
- final CharSequence erroneous = CharSequences.token(text, errorOffset);
- if (erroneous.length() == 0) {
- return new Object[] {type, text};
- }
- return new Object[] {type, text, erroneous};
- }
-
- /**
- * Workaround for RFE #4093999
- * ("Relax constraint on placement of this()/super() call in constructors").
- */
- @Workaround(library="JDK", version="1.8")
- private static short key(final Object[] parameters) {
- final short key;
- 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;
- default: throw new AssertionError();
- }
- return key;
+ UnparsableObjectException(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;
}
/**
@@ -180,6 +98,10 @@ public final class LocalizedParseExcepti
/**
* Returns a localized version of the exception message, typically for final user.
+ * This is often the same message than the one returned by {@link #getMessage()},
+ * but may in some occasions be in a different language if {@code WKTFormat} has been
+ * {@linkplain WKTFormat#WKTFormat(java.util.Locale, java.util.TimeZone) constructed}
+ * with a different locale.
*
* @return the localized message of this exception.
*/
@@ -203,10 +125,10 @@ public final class LocalizedParseExcepti
* 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.
+ * @return a reference to this {@code UnparsableObjectException} instance.
*/
@Override
- public LocalizedParseException initCause(final Throwable cause) {
- return (LocalizedParseException) super.initCause(cause);
+ public UnparsableObjectException initCause(final Throwable cause) {
+ return (UnparsableObjectException) super.initCause(cause);
}
}
Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1776692&r1=1776691&r2=1776692&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] Sat Dec 31 05:53:32 2016
@@ -45,7 +45,6 @@ import org.apache.sis.util.CharSequences
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.StandardDateFormat;
-import org.apache.sis.internal.util.LocalizedParseException;
/**
@@ -684,7 +683,7 @@ public class WKTFormat extends CompoundF
final Element element = new Element(parser(), wkt, pos, sharedValues);
final int index = CharSequences.skipLeadingWhitespaces(wkt, pos.getIndex(), wkt.length());
if (index < wkt.length()) {
- throw new LocalizedParseException(getLocale(), Errors.Keys.UnexpectedCharactersAfter_2,
+ throw new UnparsableObjectException(getLocale(), Errors.Keys.UnexpectedCharactersAfter_2,
new Object[] {name + " = " + element.keyword + "[\u2026]", CharSequences.token(wkt, index)}, index);
}
// 'fragments' map has been created by 'parser()'.
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java?rev=1776692&r1=1776691&r2=1776692&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8] Sat Dec 31 05:53:32 2016
@@ -363,10 +363,10 @@ public final class Logging extends Stati
*
* The message is fetched using Exception.getMessage() instead than getLocalizedMessage()
* because in a client-server architecture, we want the locale on the server-side instead
- * than the locale on the client side.
+ * than the locale on the client side. See LocalizedException policy.
*/
final StringBuilder buffer = new StringBuilder(256).append(Classes.getShortClassName(error));
- String message = error.getMessage(); // Targeted to system administrators.
+ String message = error.getMessage(); // Targeted to system administrators (see above).
if (message != null) {
buffer.append(": ").append(message);
}
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=1776692&r1=1776691&r2=1776692&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] Sat Dec 31 05:53:32 2016
@@ -55,20 +55,18 @@ public class DataStoreException extends
* The deserialized value will be 0, which will cause this {@code DataStoreException} to fallback on
* {@code super.getMessage()}.</p>
*/
- private final transient short key;
+ private transient short key;
/**
* The parameters for the localization message, or {@code null} if none.
*/
- private final transient Object[] parameters;
+ private transient Object[] parameters;
/**
* Creates an exception with no cause and no details message.
*/
public DataStoreException() {
super();
- key = 0;
- parameters = null;
}
/**
@@ -78,8 +76,6 @@ public class DataStoreException extends
*/
public DataStoreException(final String message) {
super(message);
- key = 0;
- parameters = null;
}
/**
@@ -89,8 +85,6 @@ public class DataStoreException extends
*/
public DataStoreException(final Throwable cause) {
super(cause);
- key = 0;
- parameters = null;
}
/**
@@ -101,8 +95,6 @@ public class DataStoreException extends
*/
public DataStoreException(final String message, final Throwable cause) {
super(message, cause);
- key = 0;
- parameters = null;
}
/**
@@ -110,7 +102,7 @@ public class DataStoreException extends
* Location in the file where the error occurred while be fetched from the given {@code store}
* argument if possible, for example by invoking the {@link java.io.LineNumberReader#getLineNumber()}
* or {@link javax.xml.stream.XMLStreamReader#getLocation()} method.
- * If The given {@code store} argument is not one of the recognized types, then it is ignored.
+ * If the given {@code store} argument is not one of the recognized types, then it is ignored.
*
* @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>).
@@ -200,6 +192,8 @@ public class DataStoreException extends
*
* @param cause the cause saved for later retrieval by the {@link #getCause()} method.
* @return a reference to this {@code DataStoreException} instance.
+ *
+ * @since 0.8
*/
@Override
public DataStoreException initCause(final Throwable cause) {
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=1776692&r1=1776691&r2=1776692&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] Sat Dec 31 05:53:32 2016
@@ -91,10 +91,11 @@ public class UnsupportedStorageException
*
* @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 storage the invalid input or output object.
+ * @param storage the invalid input or output object. This is typically {@link StorageConnector#getStorage()}.
* @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.
+ * Those options can be obtained by {@code StorageConnector.getOption(OptionKey.OPEN_OPTIONS)}.
*
* @since 0.8
*/