Author: desruisseaux
Date: Wed Feb 24 22:57:20 2016
New Revision: 1732239
URL: http://svn.apache.org/viewvc?rev=1732239&view=rev
Log:
Merge bug fixes from the JDK7 branch: SIS-308 to SIS-313.
Added:
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
- copied, changed from r1732235,
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java
- copied, changed from r1732235,
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/
- copied from r1732235,
sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
- copied, changed from r1732235,
sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
- copied unchanged from r1732235,
sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/
- copied from r1732235,
sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreProviderTest.java
- copied unchanged from r1732235,
sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreProviderTest.java
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java
- copied, changed from r1732235,
sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java
Removed:
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStore.java
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStoreProvider.java
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreProviderTest.java
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java
Modified:
sis/branches/JDK6/ (props changed)
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Command.java
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Option.java
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/package-info.java
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java
sis/branches/JDK6/storage/sis-storage/src/main/resources/META-INF/services/org.apache.sis.storage.DataStoreProvider
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreTest.java
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/storage/DataStoresTest.java
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/storage/StorageConnectorTest.java
sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java
Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 24 22:57:20 2016
@@ -1,4 +1,4 @@
/sis/branches/Android:1430670-1480699
-/sis/branches/JDK7:1394913-1731655
-/sis/branches/JDK8:1584960-1731653
+/sis/branches/JDK7:1394913-1732235
+/sis/branches/JDK8:1584960-1732232
/sis/trunk:1394364-1508466,1519089-1519674
Modified:
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
[UTF-8] (original)
+++
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -68,7 +68,7 @@ final class AboutSC extends SubCommand {
*/
AboutSC(final int commandIndex, final String... args) throws
InvalidOptionException {
super(commandIndex, args, EnumSet.of(Option.LOCALE, Option.TIMEZONE,
Option.ENCODING,
- Option.BRIEF, Option.VERBOSE, Option.HELP));
+ Option.BRIEF, Option.VERBOSE, Option.HELP, Option.DEBUG));
}
/**
Modified:
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Command.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Command.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Command.java
[UTF-8] (original)
+++
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Command.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.sql.SQLException;
import org.opengis.referencing.operation.TransformException;
import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.MonolineFormatter;
@@ -38,6 +39,7 @@ import org.apache.sis.util.logging.Monol
* <tr><td>{@code about} </td><td>Show information about Apache SIS and
system configuration.</td></tr>
* <tr><td>{@code mime-type}</td><td>Show MIME type for the given
file.</td></tr>
* <tr><td>{@code metadata} </td><td>Show metadata information for the given
file.</td></tr>
+ * <tr><td>{@code crs} </td><td>Show Coordinate Reference System
information for the given file or code.</td></tr>
* </table></blockquote>
*
* Each command can accepts an arbitrary amount of the following options:
@@ -50,6 +52,7 @@ import org.apache.sis.util.logging.Monol
* <tr><td>{@code --colors} </td><td>Whether colorized output shall be
enabled.</td></tr>
* <tr><td>{@code --brief} </td><td>Whether the output should contains only
brief information.</td></tr>
* <tr><td>{@code --verbose} </td><td>Whether the output should contains more
detailed information.</td></tr>
+ * <tr><td>{@code --debug} </td><td>Prints full stack trace in case of
failure.</td></tr>
* <tr><td>{@code --help} </td><td>Lists the options available for a
specific command.</td></tr>
* </table></blockquote>
*
@@ -60,11 +63,11 @@ import org.apache.sis.util.logging.Monol
*
* <div class="section">SIS installation on remote machines</div>
* Some sub-commands can operate on SIS installation on remote machines,
provided that remote access has been enabled
- * at the Java Virtual Machine startup time. See {@link
org.apache.sis.console} package javadoc for more information.
+ * at the Java Virtual Machine startup time. See {@linkplain
org.apache.sis.console package javadoc} for more information.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.6
+ * @version 0.7
* @module
*/
public final class Command {
@@ -209,16 +212,28 @@ public final class Command {
/**
* Prints the message of the given exception. This method is invoked only
when the error occurred before
* the {@link SubCommand} has been built, otherwise the {@link
SubCommand#err} printer shall be used.
+ *
+ * @param args The command line arguments, used only for detecting if the
{@code --debug} option was present.
*/
- private static void error(final Exception e) {
+ private static void error(final String[] args, final Exception e) {
+ final boolean debug = ArraysExt.containsIgnoreCase(args, Option.PREFIX
+ "debug");
final Console console = System.console();
if (console != null) {
final PrintWriter err = console.writer();
- err.println(e.getLocalizedMessage());
+ if (debug) {
+ e.printStackTrace(err);
+ } else {
+ err.println(e.getLocalizedMessage());
+ }
err.flush();
} else {
+ @SuppressWarnings("UseOfSystemOutOrSystemErr")
final PrintStream err = System.err;
- err.println(e.getLocalizedMessage());
+ if (debug) {
+ e.printStackTrace(err);
+ } else {
+ err.println(e.getLocalizedMessage());
+ }
err.flush();
}
}
@@ -251,11 +266,11 @@ public final class Command {
try {
c = new Command(args);
} catch (InvalidCommandException e) {
- error(e);
+ error(args, e);
System.exit(INVALID_COMMAND_EXIT_CODE);
return;
} catch (InvalidOptionException e) {
- error(e);
+ error(args, e);
System.exit(INVALID_OPTION_EXIT_CODE);
return;
}
Modified:
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
[UTF-8] (original)
+++
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -56,7 +56,7 @@ final class HelpSC extends SubCommand {
* Creates the {@code "help"} sub-command.
*/
HelpSC(final int commandIndex, final String... args) throws
InvalidOptionException {
- super(commandIndex, args, EnumSet.of(Option.LOCALE, Option.ENCODING,
Option.HELP));
+ super(commandIndex, args, EnumSet.of(Option.LOCALE, Option.ENCODING,
Option.HELP, Option.DEBUG));
}
/**
Modified:
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java
[UTF-8] (original)
+++
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -46,7 +46,7 @@ import org.apache.sis.xml.XML;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.7
* @module
*/
final class MetadataSC extends SubCommand {
@@ -71,7 +71,7 @@ final class MetadataSC extends SubComman
*/
MetadataSC(final boolean isCRS, final int commandIndex, final String...
args) throws InvalidOptionException {
super(commandIndex, args, EnumSet.of(Option.FORMAT, Option.LOCALE,
Option.TIMEZONE, Option.ENCODING,
- Option.COLORS, Option.HELP));
+ Option.COLORS, Option.HELP, Option.DEBUG));
this.isCRS = isCRS;
}
@@ -83,6 +83,7 @@ final class MetadataSC extends SubComman
* @throws IOException Should never happen, since we are appending to a
print writer.
*/
@Override
+ @SuppressWarnings("UseOfSystemOutOrSystemErr")
public int run() throws InvalidOptionException, DataStoreException,
JAXBException, IOException {
/*
* Output format can be either "text" (the default) or "xml".
@@ -112,27 +113,37 @@ final class MetadataSC extends SubComman
}
/*
* Read metadata from the data storage.
- * If we are executing the "crs" sub-command, extract the first CRS.
*/
- if (hasUnexpectedFileCount(1, 1)) {
- return Command.INVALID_ARGUMENT_EXIT_CODE;
- }
- final Metadata metadata;
- final DataStore store = DataStores.open(files.get(0));
- try {
- metadata = store.getMetadata();
- } finally {
- store.close();
+ Object metadata;
+ if (useStandardInput()) {
+ DataStore store = DataStores.open(System.in);
+ try {
+ metadata = store.getMetadata();
+ } finally {
+ store.close();
+ }
+ } else {
+ if (hasUnexpectedFileCount(1, 1)) {
+ return Command.INVALID_ARGUMENT_EXIT_CODE;
+ }
+ DataStore store = DataStores.open(files.get(0));
+ try {
+ metadata = store.getMetadata();
+ } finally {
+ store.close();
+ }
}
if (metadata == null) {
return 0;
}
- Object object = metadata;
- if (isCRS) {
+ /*
+ * If we are executing the "crs" sub-command, extract the first CRS.
+ */
+ if (isCRS && (metadata instanceof Metadata)) {
boolean found = false;
- for (final ReferenceSystem rs : metadata.getReferenceSystemInfo())
{
+ for (final ReferenceSystem rs : ((Metadata)
metadata).getReferenceSystemInfo()) {
if (rs instanceof CoordinateReferenceSystem) {
- object = (CoordinateReferenceSystem) rs;
+ metadata = rs;
found = true;
break;
}
@@ -161,7 +172,7 @@ final class MetadataSC extends SubComman
if (colors) {
f.setColors(Colors.DEFAULT);
}
- f.format(object, out);
+ f.format(metadata, out);
out.println();
break;
}
@@ -172,11 +183,11 @@ final class MetadataSC extends SubComman
marshaller.setProperty(XML.LOCALE, locale);
marshaller.setProperty(XML.TIMEZONE, timezone);
if (isConsole()) {
- marshaller.marshal(object, out);
+ marshaller.marshal(metadata, out);
} else {
out.flush();
marshaller.setProperty(Marshaller.JAXB_ENCODING,
encoding.name());
- marshaller.marshal(object, System.out); // Use
OutputStream instead than Writer.
+ marshaller.marshal(metadata, System.out); //
Intentionally use OutputStream instead than Writer.
System.out.flush();
}
break;
@@ -193,7 +204,7 @@ final class MetadataSC extends SubComman
* {@code Writer} and let the marshaller apply the encoding itself.
*/
private boolean isConsole() {
- if (outputBuffer != null) return true; // Special case for JUnit tests
only.
+ if (outputBuffer != null) return true; // Special
case for JUnit tests only.
final Console console = System.console();
return (console != null) && console.writer() == out;
}
Modified:
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java
[UTF-8] (original)
+++
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/MimeTypeSC.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -48,7 +48,7 @@ final class MimeTypeSC extends SubComman
* Creates the {@code "mime-type"} sub-command.
*/
MimeTypeSC(final int commandIndex, final String... args) throws
InvalidOptionException {
- super(commandIndex, args, EnumSet.of(Option.ENCODING, Option.HELP));
+ super(commandIndex, args, EnumSet.of(Option.ENCODING, Option.HELP,
Option.DEBUG));
}
/**
Modified:
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Option.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Option.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Option.java
[UTF-8] (original)
+++
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/Option.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -25,7 +25,7 @@ import org.apache.sis.util.resources.Err
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.3
+ * @version 0.7
* @module
*/
enum Option {
@@ -67,6 +67,12 @@ enum Option {
VERBOSE(false),
/**
+ * Whether to print the full stack trace in case of error.
+ * This option expects no value.
+ */
+ DEBUG(false),
+
+ /**
* Lists the options accepted by a command.
*/
HELP(false);
Modified:
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
[UTF-8] (original)
+++
sis/branches/JDK6/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -38,7 +38,7 @@ import org.apache.sis.internal.util.X364
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.3
+ * @version 0.7
* @module
*/
abstract class SubCommand {
@@ -88,6 +88,11 @@ abstract class SubCommand {
protected final boolean colors;
/**
+ * {@code true} for printing the full stack trace in case of failure.
+ */
+ protected final boolean debug;
+
+ /**
* Output stream to the console. This output stream uses the encoding
* specified by the {@code "--encoding"} argument, if presents.
*/
@@ -124,6 +129,7 @@ abstract class SubCommand {
this.timezone = parent.timezone;
this.encoding = parent.encoding;
this.colors = parent.colors;
+ this.debug = parent.debug;
this.out = parent.out;
this.err = parent.err;
this.outputBuffer = parent.outputBuffer;
@@ -141,6 +147,7 @@ abstract class SubCommand {
* @param validOptions The command-line options allowed by this
sub-command.
* @throws InvalidOptionException If an illegal option has been provided,
or the option has an illegal value.
*/
+ @SuppressWarnings("UseOfSystemOutOrSystemErr")
protected SubCommand(final int commandIndex, final String[] arguments,
final EnumSet<Option> validOptions)
throws InvalidOptionException
{
@@ -188,6 +195,8 @@ abstract class SubCommand {
final Console console;
final boolean explicitEncoding;
try {
+ debug = options.containsKey(option = Option.DEBUG);
+
value = options.get(option = Option.LOCALE);
locale = (value != null) ? Locales.parse(value) :
Locale.getDefault();
@@ -202,7 +211,7 @@ abstract class SubCommand {
console = System.console();
colors = (value != null) ? Option.COLORS.parseBoolean(value) :
(console != null) && X364.isAnsiSupported();
} catch (RuntimeException e) {
- @SuppressWarnings("null") // 'option' has been assigned in 'get'
argument.
+ @SuppressWarnings("null") //
'option' has been assigned in 'get' argument.
final String name = option.name().toLowerCase(Locale.US);
throw new
InvalidOptionException(Errors.format(Errors.Keys.IllegalOptionValue_2, name,
value), name);
}
@@ -281,6 +290,13 @@ abstract class SubCommand {
}
/**
+ * Returns {@code true} if the command should use the standard input.
+ */
+ final boolean useStandardInput() {
+ return files.isEmpty() && System.console() == null;
+ }
+
+ /**
* Prints the <cite>"Can not open …"</cite> error message followed by the
message in the given exception.
*
* @param fileIndex Index in the {@link #files} list of the file that can
not be opened.
@@ -298,7 +314,11 @@ abstract class SubCommand {
*/
final void error(final String message, final Exception e) {
out.flush();
- err.println(Exceptions.formatChainedMessages(locale, message, e));
+ if (debug) {
+ e.printStackTrace(err);
+ } else {
+ err.println(Exceptions.formatChainedMessages(locale, message, e));
+ }
}
/**
Modified:
sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
[ISO-8859-1] Wed Feb 24 22:57:20 2016
@@ -6,4 +6,5 @@ encoding=The encoding to use for the com
colors=Whether colorized output shall be enabled.
brief=Reduce the output to only brief information.
verbose=Request the output to contain more detailed information.
+debug=Prints full stack trace in case of failure.
help=Lists the options available for a specific command.
Modified:
sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK6/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
[ISO-8859-1] Wed Feb 24 22:57:20 2016
@@ -6,4 +6,5 @@ encoding=L\u2019encodage des caractères
colors=Indique si l\u2019affichage peut être en couleurs.
brief=Indique que la sortie de la commande ne doit contenir que de brèves
informations.
verbose=Indique que la sortie de la commande doit contenir des informations
plus détaillées.
+debug=Affiche la trace complète de l\u2019exception en cas d\u2019échec.
help=Liste les options disponibles pour une commande spécifique.
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -19,6 +19,7 @@ package org.apache.sis.internal.metadata
import java.util.Arrays;
import java.util.Collection;
import java.util.Locale;
+import javax.sql.DataSource;
import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Role;
import org.opengis.metadata.citation.Citation;
@@ -27,12 +28,17 @@ import org.opengis.metadata.citation.Res
import org.apache.sis.internal.simple.CitationConstant;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.MetadataServices;
+import org.apache.sis.internal.metadata.sql.Initializer;
+import org.apache.sis.internal.system.Loggers;
import org.apache.sis.metadata.iso.ImmutableIdentifier;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.metadata.iso.citation.DefaultCitation;
import org.apache.sis.metadata.iso.citation.DefaultOrganisation;
import org.apache.sis.metadata.iso.citation.DefaultResponsibility;
+import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.iso.Types;
+import org.apache.sis.util.Exceptions;
+import org.apache.sis.util.Classes;
import static java.util.Collections.singleton;
@@ -199,6 +205,37 @@ public final class ServicesForUtility ex
*/
@Override
public String getInformation(final String key, final Locale locale) {
+ /* switch (key) */ {
+ if (key.equals("DataSource")) {
+ Object server = null, database = null;
+ try {
+ final DataSource ds = Initializer.getDataSource();
+ if (ds != null) {
+ final Class<?> type = ds.getClass();
+ database = type.getMethod("getDatabaseName", (Class[])
null).invoke(ds, (Object[]) null);
+ server = type.getMethod("getServerName", (Class[])
null).invoke(ds, (Object[]) null);
+ }
+ } catch (NoSuchMethodException e) {
+
Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM),
+ MetadataServices.class, "getInformation", e);
+ } catch (Exception e) {
+ // Leave the message alone if it contains at least 2 words.
+ String message = Exceptions.getLocalizedMessage(e, locale);
+ if (message == null || message.indexOf(' ') < 0) {
+ message = Classes.getShortClassName(e) + ": " +
message;
+ }
+ return message;
+ }
+ if (database != null) {
+ if (server != null) {
+ database = "//" + server + '/' + database;
+ }
+ return database.toString();
+ }
+ return null;
+ }
+ // More cases may be added in future SIS versions.
+ }
return ReferencingServices.getInstance().getInformation(key, locale);
}
}
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -163,6 +163,7 @@ public final class WKTKeywords extends S
* Related to {@link
org.apache.sis.referencing.operation.AbstractCoordinateOperation}.
*/
public static final String
+ BoundCRS = "BoundCRS",
Method = "Method",
Formula = "Formula",
Projection = "Projection",
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -347,7 +347,7 @@ public class ScriptRunner {
}
/**
- * Run the script from the given reader. Lines are read and grouped up to
the
+ * Runs the script from the given reader. Lines are read and grouped up to
the
* terminal {@value #END_OF_STATEMENT} character, then sent to the
database.
*
* @param filename Name of the SQL script being executed. This is used
only for error reporting.
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -36,6 +36,7 @@ import org.opengis.util.InternationalStr
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.util.StandardDateFormat;
import org.apache.sis.measure.Units;
+import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.logging.Logging;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -165,7 +166,7 @@ abstract class AbstractParser implements
this.unitFormat = unitFormat;
this.errorLocale = errorLocale;
if (Symbols.SCIENTIFIC_NOTATION && numberFormat instanceof
DecimalFormat) {
- final DecimalFormat decimalFormat = (DecimalFormat)
((DecimalFormat) numberFormat).clone();
+ final DecimalFormat decimalFormat = (DecimalFormat)
numberFormat.clone();
exponentSymbol =
decimalFormat.getDecimalFormatSymbols().getExponentSeparator();
String pattern = decimalFormat.toPattern();
if (!pattern.contains("E0")) {
@@ -236,6 +237,7 @@ abstract class AbstractParser implements
public Object parseObject(final String text, final ParsePosition position)
throws ParseException {
warnings = null;
ignoredElements.clear();
+ ArgumentChecks.ensureNonEmpty("text", text);
final Element element = new Element("<root>", new Element(this, text,
position, null));
final Object object = parseObject(element);
element.close(ignoredElements);
@@ -292,7 +294,7 @@ abstract class AbstractParser implements
final Unit<?> parseUnit(final String text) throws ParseException {
if (unitFormat == null) {
if (symbols.getLocale() == Locale.ROOT) {
- return Units.valueOf(text); // Most common case, avoid the
convolved code below.
+ return Units.valueOf(text); // Most common case,
avoid the convolved code below.
}
unitFormat = UnitFormat.getInstance(symbols.getLocale());
}
@@ -313,28 +315,17 @@ abstract class AbstractParser implements
/**
* Reports a non-fatal warning that occurred while parsing a WKT.
*
- * @param parent The parent element.
- * @param element The element that we can not parse.
- * @param ex The non-fatal exception that occurred while parsing the
element.
- */
- final void warning(final Element parent, final Element element, final
Exception ex) {
- if (warnings == null) {
- warnings = new Warnings(errorLocale, true, ignoredElements);
- }
- warnings.add(null, ex, new String[] {parent.keyword, element.keyword});
- }
-
- /**
- * Reports a non-fatal warning that occurred while parsing a WKT.
- *
- * @param message The message. Can not be {@code null}.
+ * @param parent The parent element, or {@code null} if unknown.
+ * @param element The element that we can not parse, or {@code null} if
unknown.
+ * @param message The message. Can be {@code null} only if {@code ex} is
non-null.
* @param ex The non-fatal exception that occurred while parsing the
element, or {@code null}.
*/
- final void warning(final InternationalString message, final Exception ex) {
+ final void warning(final Element parent, final Element element, final
InternationalString message, final Exception ex) {
if (warnings == null) {
warnings = new Warnings(errorLocale, true, ignoredElements);
}
- warnings.add(message, ex, null);
+ warnings.add(message, ex, (parent != null && element != null)
+ ? new String[] {parent.keyword, element.keyword} : null);
}
/**
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -179,7 +179,7 @@ final class Element implements Serializa
final int length = text.length();
int lower = skipLeadingWhitespaces(text, offset, length);
{ // This block is for keeping some variables local.
- int c = text.codePointAt(lower);
+ int c = (lower < length) ? text.codePointAt(lower) : 0;
if (!Character.isUnicodeIdentifierStart(c)) {
keyword = text;
position.setErrorIndex(lower);
@@ -637,7 +637,7 @@ final class Element implements Serializa
final Iterator<Object> iterator = list.iterator();
while (iterator.hasNext()) {
final Object object = iterator.next();
- if (object != null) {
+ if (object != null && !(object instanceof Element)) {
iterator.remove();
return object;
}
@@ -723,7 +723,7 @@ final class Element implements Serializa
final Iterator<Object> iterator = list.iterator();
while (iterator.hasNext()) {
final Object object = iterator.next();
- if (type.isInstance(object)) {
+ if (type.isInstance(object) && !(object instanceof Element)) {
iterator.remove();
return (T) object;
}
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -298,7 +298,7 @@ final class GeodeticObjectParser extends
if (ex == null) ex = e;
}
if (verticalElements != null) {
-
warning(Errors.formatInternational(Errors.Keys.CanNotAssignUnitToDimension_2,
+ warning(null, null,
Errors.formatInternational(Errors.Keys.CanNotAssignUnitToDimension_2,
WKTKeywords.VerticalExtent,
verticalElements.unit), ex);
}
}
@@ -410,7 +410,7 @@ final class GeodeticObjectParser extends
* This include elements like {@code "SCOPE"}, {@code "ID"} (WKT 2) or
{@code "AUTHORITY"} (WKT 1).
* This WKT 1 element has the following pattern:
*
- * {@preformat text
+ * {@preformat wkt
* AUTHORITY["<name>", "<code>"]
* }
*
@@ -434,8 +434,8 @@ final class GeodeticObjectParser extends
Element element;
while ((element = parent.pullElement(OPTIONAL, ID_KEYWORDS)) != null) {
final String codeSpace = element.pullString("codeSpace");
- final String code = element.pullObject("code").toString();
// Accepts Integer as well as String.
- final Object version = element.pullOptional(Object.class);
// Accepts Number as well as String.
+ final String code = element.pullObject("code").toString();
// Accepts Integer as well as String.
+ final Object version = element.pullOptional(Object.class);
// Accepts Number as well as String.
final Element citation = element.pullElement(OPTIONAL,
WKTKeywords.Citation);
final String authority;
if (citation != null) {
@@ -504,8 +504,11 @@ final class GeodeticObjectParser extends
while ((element = parent.pullElement(OPTIONAL, WKTKeywords.Area))
!= null) {
final String area = element.pullString("area");
element.close(ignoredElements);
- if (extent == null) extent = new DefaultExtent();
- extent.getGeographicElements().add(new
DefaultGeographicDescription(area));
+ if (extent == null) {
+ extent = new DefaultExtent(area, null, null, null);
+ } else {
+ extent.getGeographicElements().add(new
DefaultGeographicDescription(area));
+ }
}
/*
* Example: BBOX[51.43, 2.54, 55.77, 6.40]
@@ -548,7 +551,7 @@ final class GeodeticObjectParser extends
element.pullString("startTime");
element.pullString("endTime");
element.close(ignoredElements);
-
warning(Errors.formatInternational(Errors.Keys.UnsupportedType_1,
"TimeExtent[String,String]"), null);
+ warning(parent, element,
Errors.formatInternational(Errors.Keys.UnsupportedType_1,
"TimeExtent[String,String]"), null);
} else {
final Date startTime = element.pullDate("startTime");
final Date endTime = element.pullDate("endTime");
@@ -559,10 +562,13 @@ final class GeodeticObjectParser extends
if (extent == null) extent = new DefaultExtent();
extent.getTemporalElements().add(t);
} catch (UnsupportedOperationException e) {
- warning(parent, element, e);
+ warning(parent, element, null, e);
}
}
}
+ if (extent != null) {
+ properties.put(ReferenceSystem.DOMAIN_OF_VALIDITY_KEY, extent);
+ }
/*
* Example: REMARK["Замечание на русском языке"]
*/
@@ -594,7 +600,7 @@ final class GeodeticObjectParser extends
* Parses an optional {@code "UNIT"} element of a known dimension.
* This element has the following pattern:
*
- * {@preformat text
+ * {@preformat wkt
* UNIT["<name>", <conversion factor> {,<authority>}]
* }
*
@@ -626,7 +632,7 @@ final class GeodeticObjectParser extends
if (baseUnit.toSI().equals(unit.toSI())) {
return (Unit<Q>) unit;
} else {
-
warning(Errors.formatInternational(Errors.Keys.IllegalUnitFor_2, keyword,
unit), null);
+ warning(parent, element,
Errors.formatInternational(Errors.Keys.IllegalUnitFor_2, keyword, unit), null);
}
}
return Units.multiply(baseUnit, factor);
@@ -636,7 +642,7 @@ final class GeodeticObjectParser extends
* Parses a {@code "CS"} element followed by all {@code "AXIS"} elements.
* This element has the following pattern (simplified):
*
- * {@preformat text
+ * {@preformat wkt
* CS["<type>", dimension],
* AXIS["<name>", NORTH | SOUTH | EAST | WEST | UP | DOWN | OTHER],
* UNIT["<name>", <conversion factor>],
@@ -932,7 +938,7 @@ final class GeodeticObjectParser extends
return referencing.createAbstractCS(csProperties, axes);
}
else {
- warning(Errors.formatInternational(Errors.Keys.UnknownType_1,
type), null);
+ warning(parent, null,
Errors.formatInternational(Errors.Keys.UnknownType_1, type), null);
return referencing.createAbstractCS(csProperties, axes);
}
}
@@ -945,10 +951,16 @@ final class GeodeticObjectParser extends
* Parses an {@code "AXIS"} element.
* This element has the following pattern (simplified):
*
- * {@preformat text
+ * {@preformat wkt
* AXIS["<name (abbr.)>", NORTH | SOUTH | EAST | WEST | UP | DOWN |
OTHER, ORDER[n], UNIT[…], ID[…]]
* }
*
+ * Abbreviation may be specified between parenthesis. Nested parenthesis
are possible, as for example:
+ *
+ * {@preformat wkt
+ * AXIS["Easting (E(X))", EAST]
+ * }
+ *
* @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link
#MANDATORY}.
* @param parent The parent element.
* @param csType The coordinate system type (Cartesian | ellipsoidal
| vertical | etc…), or null if unknown.
@@ -997,8 +1009,18 @@ final class GeodeticObjectParser extends
* have to guess one since abbreviation is a mandatory part of axis.
*/
String abbreviation;
- final int start, end = name.length() - 1;
+ int start, end = name.length() - 1;
if (end > 1 && name.charAt(end) == ')' && (start =
name.lastIndexOf('(', end-1)) >= 0) {
+ // Abbreviation may have nested parenthesis (e.g. "Easting
(E(X))").
+ for (int np = end; (--np >= 0) && name.charAt(np) == ')';) {
+ final int c = name.lastIndexOf('(', start - 1);
+ if (c < 0) {
+ warning(parent, element, Errors.formatInternational(
+ Errors.Keys.NonEquilibratedParenthesis_2, '(',
name), null);
+ break;
+ }
+ start = c;
+ }
abbreviation = CharSequences.trimWhitespaces(name.substring(start
+ 1, end));
name = CharSequences.trimWhitespaces(name.substring(0, start));
if (name.isEmpty()) {
@@ -1072,7 +1094,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 pattern was:
*
- * {@preformat text
+ * {@preformat wkt
* PRIMEM["<name>", <longitude> {,<authority>}]
* }
*
@@ -1114,7 +1136,7 @@ final class GeodeticObjectParser extends
* Parses an <strong>optional</strong> {@code "TOWGS84"} element.
* This element is specific to WKT 1 and has the following pattern:
*
- * {@preformat text
+ * {@preformat wkt
* TOWGS84[<dx>, <dy>, <dz>, <ex>, <ey>, <ez>, <ppm>]
* }
*
@@ -1146,7 +1168,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 pattern was:
*
- * {@preformat text
+ * {@preformat wkt
* SPHEROID["<name>", <semi-major axis>, <inverse flattening>
{,<authority>}]
* }
*
@@ -1237,7 +1259,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 specification was:
*
- * {@preformat text
+ * {@preformat wkt
* PROJECTION["<name>" {,<authority>}]
* }
*
@@ -1311,7 +1333,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 pattern was:
*
- * {@preformat text
+ * {@preformat wkt
* DATUM["<name>", <spheroid> {,<to wgs84>} {,<authority>}]
* }
*
@@ -1351,7 +1373,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 pattern was:
*
- * {@preformat text
+ * {@preformat wkt
* VERT_DATUM["<name>", <datum type> {,<authority>}]
* }
*
@@ -1389,7 +1411,7 @@ final class GeodeticObjectParser extends
/**
* Parses a {@code "TimeDatum"} element. This element has the following
pattern:
*
- * {@preformat text
+ * {@preformat wkt
* TimeDatum["<name>", TimeOrigin[<time origin>] {,<authority>}]
* }
*
@@ -1420,7 +1442,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 pattern was:
*
- * {@preformat text
+ * {@preformat wkt
* LOCAL_DATUM["<name>", <datum type> {,<authority>}]
* }
*
@@ -1481,7 +1503,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 pattern was:
*
- * {@preformat text
+ * {@preformat wkt
* LOCAL_CS["<name>", <local datum>, <unit>, <axis>, {,<axis>}*
{,<authority>}]
* }
*
@@ -1575,8 +1597,8 @@ final class GeodeticObjectParser extends
try {
cs = parseCoordinateSystem(element, WKTKeywords.Cartesian, 2,
false, unit, datum);
final Map<String,?> properties = parseMetadataAndClose(element,
name, datum);
- if (cs instanceof CartesianCS) {
- return crsFactory.createImageCRS(properties, datum,
(CartesianCS) cs);
+ if (cs instanceof AffineCS) {
+ return crsFactory.createImageCRS(properties, datum, (AffineCS)
cs);
}
} catch (FactoryException exception) {
throw element.parseFailed(exception);
@@ -1590,13 +1612,13 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 specification had two elements for this:
*
- * {@preformat text
+ * {@preformat wkt
* GEOGCS["<name>", <datum>, <prime meridian>, <angular unit> {,<twin
axes>} {,<authority>}]
* }
*
* and
*
- * {@preformat text
+ * {@preformat wkt
* GEOCCS["<name>", <datum>, <prime meridian>, <linear unit> {,<axis>
,<axis> ,<axis>} {,<authority>}]
* }
*
@@ -1759,7 +1781,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 pattern was:
*
- * {@preformat text
+ * {@preformat wkt
* VERT_CS["<name>", <vert datum>, <linear unit>, {<axis>,}
{,<authority>}]
* }
*
@@ -1806,7 +1828,7 @@ final class GeodeticObjectParser extends
baseCRS = parseVerticalCRS(MANDATORY, element, true);
}
}
- if (baseCRS == null) { // The most usual case.
+ if (baseCRS == null) {
// The most usual case.
datum = parseVerticalDatum(MANDATORY, element, isWKT1);
}
final CoordinateSystem cs;
@@ -1910,7 +1932,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 specification was:
*
- * {@preformat text
+ * {@preformat wkt
* PROJCS["<name>", <geographic cs>, <projection>, {<parameter>,}*,
* <linear unit> {,<twin axes>}{,<authority>}]
* }
@@ -1992,7 +2014,7 @@ final class GeodeticObjectParser extends
*
* The legacy WKT 1 specification was:
*
- * {@preformat text
+ * {@preformat wkt
* COMPD_CS["<name>", <head cs>, <tail cs> {,<authority>}]
* }
*
@@ -2024,7 +2046,7 @@ final class GeodeticObjectParser extends
* Parses a {@code "FITTED_CS"} element.
* This element has the following pattern:
*
- * {@preformat text
+ * {@preformat wkt
* FITTED_CS["<name>", <to base>, <base cs>]
* }
*
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -203,7 +203,7 @@ class MathTransformParser extends Abstra
final Element element = parent.pullElement(OPTIONAL, ID_KEYWORDS);
if (element != null) {
final String codeSpace = element.pullString("codeSpace");
- final Object code = element.pullObject("code"); // Accepts
Integer as well as String.
+ final Object code = element.pullObject("code"); //
Accepts Integer as well as String.
element.close(ignoredElements);
if (Constants.EPSG.equalsIgnoreCase(codeSpace)) try {
final int n;
@@ -214,7 +214,7 @@ class MathTransformParser extends Abstra
}
return Units.valueOfEPSG(n);
} catch (NumberFormatException e) {
- warning(parent, element, e);
+ warning(parent, element, null, e);
}
}
return null;
Modified:
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -188,13 +188,13 @@ public final class Warnings implements L
final void add(final InternationalString message, final Exception cause,
final String[] source) {
assert (message != null) || (cause != null);
if (messages == null) {
- messages = new ArrayList<Object>(4); // We expect few items.
+ messages = new ArrayList<Object>(4);
// We expect few items.
}
messages.add(message);
messages.add(cause);
if (cause != null) {
if (exceptionSources == null) {
- exceptionSources = new LinkedHashMap<Exception, String[]>(4);
// We expect few items.
+ exceptionSources = new LinkedHashMap<Exception, String[]>(4);
// We expect few items.
}
exceptionSources.put(cause, source);
}
Modified:
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -54,6 +54,7 @@ import org.apache.sis.io.wkt.Convention;
import org.apache.sis.io.wkt.ElementKind;
import org.apache.sis.io.wkt.Transliterator;
import org.apache.sis.io.wkt.FormattableObject;
+import org.apache.sis.io.wkt.UnformattableObjectException;
import static java.lang.Double.doubleToLongBits;
import static java.lang.Double.NEGATIVE_INFINITY;
@@ -92,7 +93,7 @@ import org.apache.sis.internal.jdk7.Obje
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4
- * @version 0.6
+ * @version 0.7
* @module
*
* @see AbstractCS
@@ -772,9 +773,13 @@ public class DefaultCoordinateSystemAxis
* if the direction is of the kind "South along 90°N" for instance.
*/
DirectionAlongMeridian meridian = null;
- if (!isWKT1 && AxisDirections.isUserDefined(dir)) {
+ if (AxisDirections.isUserDefined(dir)) {
meridian = DirectionAlongMeridian.parse(dir);
if (meridian != null) {
+ if (isWKT1) {
+ throw new UnformattableObjectException(Errors.format(
+ Errors.Keys.CanNotRepresentInFormat_2, "WKT 1",
meridian));
+ }
dir = meridian.baseDirection;
}
}
Modified:
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -60,7 +60,7 @@ import org.opengis.util.Factory;
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.6
- * @version 0.6
+ * @version 0.7
* @module
*/
@DependsOn({
@@ -629,24 +629,16 @@ public final strictfp class GeodeticObje
" DATUM[“Nouvelle Triangulation Française (Paris)”," +
" SPHEROID[“Clarke 1880 (IGN)”, 6378249.2,
293.4660212936269]," +
" TOWGS84[-168,-60,320,0,0,0,0]]," +
- " PRIMEM[“Paris”, 2.5969213, AUTHORITY[“EPSG”,
“8903”]]," + // In grads.
+ " PRIMEM[“Paris”, 2.5969213, AUTHORITY[“EPSG”,
“8903”]]," + // In grades.
" UNIT[“grad”, 0.01570796326794897]]," +
" PROJECTION[“Lambert Conformal Conic (1SP)”]," + //
Intentional swapping of "Conformal" and "Conic".
- " PARAMETER[“latitude_of_origin”, 52.0]," + // In
grads.
+ " PARAMETER[“latitude_of_origin”, 52.0]," + // In
grades.
" PARAMETER[“scale_factor”, 0.99987742]," +
" PARAMETER[“false_easting”, 600.0]," +
" PARAMETER[“false_northing”, 2200.0]," +
- " UNIT[“metre”,1000]]";
+ " UNIT[“km”,1000]]";
- ProjectedCRS crs = parse(ProjectedCRS.class, wkt);
- assertNameAndIdentifierEqual("NTF (Paris) / Lambert zone II", 0, crs);
- verifyProjectedCS(crs.getCoordinateSystem(), SI.KILOMETRE);
- PrimeMeridian pm = verifyNTF(crs.getDatum(), true);
- assertEquals("angularUnit", NonSI.GRADE, pm.getAngularUnit());
- assertEquals("greenwichLongitude", 2.5969213,
pm.getGreenwichLongitude(), STRICT);
- ParameterValue<?> param =
verifyNTF(crs.getConversionFromBase().getParameterValues());
- assertEquals("angularUnit", NonSI.GRADE, param.getUnit());
- assertEquals("latitude_of_origin", 52.0, param.doubleValue(), STRICT);
+ validateParisFranceII(parse(ProjectedCRS.class, wkt), 0, true);
/*
* Parse again using Convention.WKT1_COMMON_UNITS and ignoring AXIS[…]
elements.
* See the comment in 'testGeographicWithParisMeridian' method for a
discussion.
@@ -658,18 +650,69 @@ public final strictfp class GeodeticObje
wkt = wkt.replace("600.0", "600000"); // Convert unit in
“false_easting” parameter.
wkt = wkt.replace("2200.0", "2200000"); // Convert unit in
“false_northing” parameter.
newParser(Convention.WKT1_IGNORE_AXES);
- crs = parse(ProjectedCRS.class, wkt);
+ final ProjectedCRS crs = parse(ProjectedCRS.class, wkt);
assertNameAndIdentifierEqual("NTF (Paris) / Lambert zone II", 0, crs);
verifyProjectedCS(crs.getCoordinateSystem(), SI.KILOMETRE);
- pm = verifyNTF(crs.getDatum(), true);
+ final PrimeMeridian pm = verifyNTF(crs.getDatum(), true);
assertEquals("angularUnit", NonSI.DEGREE_ANGLE, pm.getAngularUnit());
assertEquals("greenwichLongitude", 2.33722917,
pm.getGreenwichLongitude(), STRICT);
- param = verifyNTF(crs.getConversionFromBase().getParameterValues());
+ final ParameterValue<?> param =
verifyNTF(crs.getConversionFromBase().getParameterValues());
assertEquals("angularUnit", NonSI.DEGREE_ANGLE, param.getUnit());
assertEquals("latitude_of_origin", 46.8, param.doubleValue(), STRICT);
}
/**
+ * Tests the same CRS than {@link #testProjectedWithGradUnits()}, but from
a WKT 2 definition
+ * (except for inclusion of accented characters).
+ *
+ * @throws ParseException if the parsing failed.
+ *
+ * @see <a href="https://issues.apache.org/jira/browse/SIS-309">SIS-309</a>
+ * @see <a href="https://issues.apache.org/jira/browse/SIS-310">SIS-310</a>
+ */
+ @Test
+ @DependsOnMethod("testProjectedWithGradUnits")
+ public void testProjectedFromWKT2() throws ParseException {
+ String wkt = "ProjectedCRS[“NTF (Paris) / Lambert zone II”,\n" +
+ " BaseGeodCRS[“NTF (Paris)”,\n" +
+ " Datum[“Nouvelle Triangulation Française (Paris)”,\n"
+
+ " Ellipsoid[“Clarke 1880 (IGN)”, 6378249.2,
293.4660212936269]],\n" +
+ " PrimeMeridian[“Paris”, 2.5969213, Unit[“grade”,
0.015707963267948967], Id[“EPSG”, 8903]],\n" +
+ " AngleUnit[“degree”, 0.017453292519943295]],\n" +
+ " Conversion[“Lambert zone II”,\n" +
+ " Method[“Lambert Conic Conformal (1SP)”],\n" +
+ " Parameter[“Latitude of natural origin”, 52.0,
AngleUnit[“grade”, 0.015707963267948967]],\n" +
+ " Parameter[“Longitude of natural origin”, 0.0],\n" +
+ " Parameter[“Scale factor at natural origin”,
0.99987742],\n" +
+ " Parameter[“False easting”, 600.0],\n" +
+ " Parameter[“False northing”, 2200.0]],\n" +
+ " CS[Cartesian, 2],\n" +
+ " Axis[“Easting (E)”, east],\n" +
+ " Axis[“Northing (N)”, north],\n" +
+ " LengthUnit[“km”, 1000],\n" +
+ " Scope[“Large and medium scale topographic mapping and
engineering survey.”],\n" +
+ " Id[“EPSG”, 27572,
URI[“urn:ogc:def:crs:EPSG::27572”]]]";
+
+ final ProjectedCRS crs = parse(ProjectedCRS.class, wkt);
+ validateParisFranceII(crs, 27572, false);
+ assertNull("Identifier shall not have a version.",
getSingleton(crs.getIdentifiers()).getVersion());
+ }
+
+ /**
+ * Verifies the parameters of a “NTF (Paris) / Lambert zone II” projection.
+ */
+ private static void validateParisFranceII(final ProjectedCRS crs, final
int identifier, final boolean hasToWGS84) {
+ assertNameAndIdentifierEqual("NTF (Paris) / Lambert zone II",
identifier, crs);
+ verifyProjectedCS(crs.getCoordinateSystem(), SI.KILOMETRE);
+ final PrimeMeridian pm = verifyNTF(crs.getDatum(), hasToWGS84);
+ assertEquals("angularUnit", NonSI.GRADE, pm.getAngularUnit());
+ assertEquals("greenwichLongitude", 2.5969213,
pm.getGreenwichLongitude(), STRICT);
+ final ParameterValue<?> param =
verifyNTF(crs.getConversionFromBase().getParameterValues());
+ assertEquals("angularUnit", NonSI.GRADE, param.getUnit());
+ assertEquals("latitude_of_origin", 52.0, param.doubleValue(), STRICT);
+ }
+
+ /**
* Verifies the properties of a datum which is expected to be “Nouvelle
Triangulation Française (Paris)”.
* This is used by the methods in this class which test a CRS using less
frequently used units and prime
* meridian.
Copied:
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
(from r1732235,
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java?p2=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java&p1=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java&r1=1732235&r2=1732239&rev=1732239&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -60,7 +60,7 @@ public final strictfp class ConsistencyT
/**
* Codes to exclude for now.
*/
- private static final Set<String> EXCLUDES = new HashSet<>(Arrays.asList(
+ private static final Set<String> EXCLUDES = new
HashSet<String>(Arrays.asList(
"CRS:1", // Computer display
"EPSG:5819" // EPSG topocentric example A
));
@@ -82,7 +82,10 @@ public final strictfp class ConsistencyT
final CoordinateReferenceSystem crs;
try {
crs = CRS.forCode(code);
- } catch (NoSuchIdentifierException | FactoryDataException e) {
+ } catch (NoSuchIdentifierException e) {
+ print(code, "WARNING", e.getLocalizedMessage());
+ continue;
+ } catch (FactoryDataException e) {
print(code, "WARNING", e.getLocalizedMessage());
continue;
}
Copied:
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java
(from r1732235,
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java?p2=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java&p1=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java&r1=1732235&r2=1732239&rev=1732239&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -87,7 +87,7 @@ import static org.apache.sis.test.Assert
import static org.apache.sis.test.TestUtilities.getSingleton;
// Branch-dependent imports
-import java.nio.charset.StandardCharsets;
+import org.apache.sis.internal.jdk7.StandardCharsets;
/**
Modified:
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -224,8 +224,8 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.builder.LinearTransformBuilderTest.class,
org.apache.sis.internal.referencing.ServicesForMetadataTest.class,
org.apache.sis.test.integration.DatumShiftTest.class,
- org.apache.sis.test.integration.ReferencingInMetadataTest.class,
- org.apache.sis.test.integration.DefaultMetadataTest.class
+ org.apache.sis.test.integration.MetadataTest.class,
+ org.apache.sis.test.integration.ConsistencyTest.class
})
public final strictfp class ReferencingTestSuite extends TestSuite {
/**
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -120,6 +120,7 @@ public class MetadataServices extends Op
* <p>Current keys are:</p>
* <ul>
* <li>{@code "EPSG"}: version of EPSG database.</li>
+ * <li>{@code "DataSource"}: URL to the data source, or error
message.</li>
* </ul>
*
* @param key A key identifying the information to return.
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -591,8 +591,8 @@ public class TableAppender extends Appen
* row with the specified character. The subsequent writing operations
will occur on a new
* row.
*
- * <p>Calling {@code nextLine('-')} from the first column of a row is a
convenient way
- * to fill this row with a line separator.</p>
+ * <p>Calling {@code nextLine('-')} or {@code nextLine('═')} from the
first column of a row
+ * is a convenient way to fill this row with a line separator.</p>
*
* @param fill Character filling the rest of the line (default to
whitespace).
* This character may be use as a row separator.
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -416,19 +416,21 @@ public final class Units extends Static
if (uom.equals("°") ||
equalsIgnorePlural(uom, "decimal_degree")) return NonSI.DEGREE_ANGLE;
if (uom.equalsIgnoreCase("arcsec"))
return NonSI.SECOND_ANGLE;
if (uom.equalsIgnoreCase("rad") ||
equalsIgnorePlural(uom, "radian")) return SI.RADIAN;
- if (equalsIgnorePlural(uom, "kilometer") ||
equalsIgnorePlural(uom, "kilometre")) return SI.KILOMETRE;
if (equalsIgnorePlural(uom, "meter") ||
equalsIgnorePlural(uom, "metre")) return SI.METRE;
- if (equalsIgnorePlural(uom, "week")) return NonSI.WEEK;
- if (equalsIgnorePlural(uom, "day")) return NonSI.DAY;
- if (equalsIgnorePlural(uom, "hour")) return NonSI.HOUR;
- if (equalsIgnorePlural(uom, "minute")) return NonSI.MINUTE;
- if (equalsIgnorePlural(uom, "second")) return SI .SECOND;
- if (equalsIgnorePlural(uom, "pixel")) return NonSI.PIXEL;
- if (isCelsius(uom)) return SI.CELSIUS;
- if (uom.isEmpty()) return Unit.ONE;
- if (uom.equalsIgnoreCase("ppm")) return PPM;
- if (uom.equalsIgnoreCase("psu")) return PSU;
- if (uom.equalsIgnoreCase("sigma")) return SIGMA;
+ if (equalsIgnorePlural(uom, "kilometer") ||
equalsIgnorePlural(uom, "kilometre")) return SI.KILOMETRE;
+ if (equalsIgnorePlural(uom, "week")) return NonSI.WEEK;
+ if (equalsIgnorePlural(uom, "day")) return NonSI.DAY;
+ if (equalsIgnorePlural(uom, "hour")) return NonSI.HOUR;
+ if (equalsIgnorePlural(uom, "minute")) return NonSI.MINUTE;
+ if (equalsIgnorePlural(uom, "second")) return SI .SECOND;
+ if (equalsIgnorePlural(uom, "pixel")) return NonSI.PIXEL;
+ if (equalsIgnorePlural(uom, "grade")) return NonSI.GRADE;
+ if (isCelsius(uom)) return SI.CELSIUS;
+ if (uom.isEmpty()) return Unit.ONE;
+ if (uom.equalsIgnoreCase("US survey foot")) return
NonSI.FOOT_SURVEY_US;
+ if (uom.equalsIgnoreCase("ppm")) return PPM;
+ if (uom.equalsIgnoreCase("psu")) return PSU;
+ if (uom.equalsIgnoreCase("sigma")) return SIGMA;
}
final Unit<?> unit;
try {
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/About.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -368,19 +368,26 @@ fill: for (int i=0; ; i++) {
}
case 14: {
if (sections.contains(PATHS)) {
+ nameKey = Vocabulary.Keys.DataBase;
+ value =
MetadataServices.getInstance().getInformation("DataSource", locale);
+ }
+ break;
+ }
+ case 15: {
+ if (sections.contains(PATHS)) {
nameKey = Vocabulary.Keys.TemporaryFiles;
value = getProperty("java.io.tmpdir");
}
break;
}
- case 15: {
+ case 16: {
if (sections.contains(PATHS)) {
nameKey = Vocabulary.Keys.JavaHome;
value = javaHome = getProperty("java.home");
}
break;
}
- case 16: {
+ case 17: {
newSection = LIBRARIES;
if (sections.contains(LIBRARIES)) {
nameKey = Vocabulary.Keys.JavaExtensions;
@@ -388,7 +395,7 @@ fill: for (int i=0; ; i++) {
}
break;
}
- case 17: {
+ case 18: {
if (sections.contains(LIBRARIES)) {
nameKey = Vocabulary.Keys.Classpath;
value = classpath(getProperty("java.class.path"),
false);
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Version.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -63,8 +63,8 @@ public class Version implements CharSequ
public static final Version SIS = new Version(MAJOR_VERSION + "." +
MINOR_VERSION + "-SNAPSHOT");
/**
- * A few commonly used version numbers. This list is based on SIS needs,
e.g. in {@code DataStore}
- * implementations. New constants are likely to be added in any future SIS
versions.
+ * A few commonly used version numbers. This list is based on SIS needs,
e.g. in {@code DataStore} implementations.
+ * New constants are likely to be added in any future SIS versions.
*
* @see #valueOf(int[])
*/
@@ -127,7 +127,7 @@ public class Version implements CharSequ
final int major = components[0];
if (components.length == 1) {
if (major >= 1 && major <= CONSTANTS.length) {
- return CONSTANTS[major-1];
+ return CONSTANTS[major - 1];
} else {
version = new Version(Integer.toString(major));
}
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -151,6 +151,11 @@ public final class Vocabulary extends In
public static final short CycleOmitted = 12;
/**
+ * Database
+ */
+ public static final short DataBase = 96;
+
+ /**
* Data directory
*/
public static final short DataDirectory = 88;
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] Wed Feb 24 22:57:20 2016
@@ -33,6 +33,7 @@ Correlation = Correlation
CurrentDateTime = Current date and time
CurrentDirectory = Current directory
CycleOmitted = Cycle omitted
+DataBase = Database
DataDirectory = Data directory
DaylightTime = Daylight time
DefaultValue = Default value
Modified:
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] Wed Feb 24 22:57:20 2016
@@ -40,6 +40,7 @@ Correlation = Corr\u00e9lati
CurrentDateTime = Date et heure courantes
CurrentDirectory = R\u00e9pertoire courant
CycleOmitted = Cycle omit
+DataBase = Base de donn\u00e9es
DataDirectory = R\u00e9pertoire des donn\u00e9es
DaylightTime = Heure normale
DefaultValue = Valeur par d\u00e9faut
Modified:
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java?rev=1732239&r1=1732235&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
[UTF-8] (original)
+++
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -107,7 +107,9 @@ final class Store extends DataStore {
in.close();
}
object = CRS.fromWKT(String.valueOf(buffer, 0, length));
- } catch (IOException | FactoryException e) {
+ } catch (IOException e) {
+ throw new
DataStoreException(Errors.format(Errors.Keys.CanNotRead_1, name), e);
+ } catch (FactoryException e) {
throw new
DataStoreException(Errors.format(Errors.Keys.CanNotRead_1, name), e);
}
if (object instanceof ReferenceSystem) {
Modified:
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java?rev=1732239&r1=1732235&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
[UTF-8] (original)
+++
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -64,7 +64,7 @@ public class StoreProvider extends DataS
*/
private static final Set<String> KEYWORDS = keywords();
static Set<String> keywords() {
- final Set<String> s = new HashSet<>(22);
+ final Set<String> s = new HashSet<String>(22);
s.add(WKTKeywords.GeodeticCRS);
s.add(WKTKeywords.GeodCRS);
s.add(WKTKeywords.GeogCS);
Modified:
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java
[UTF-8] (original)
+++
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -273,7 +273,7 @@ abstract class MimeTypeDetector {
if (insufficientBytes) {
return ProbeResult.INSUFFICIENT_BYTES;
}
- mimeType = XMLStoreProvider.MIME_TYPE;
+ mimeType = StoreProvider.MIME_TYPE;
}
return new ProbeResult(true, mimeType, null);
}
Copied:
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
(from r1732235,
sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java?p2=sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java&p1=sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java&r1=1732235&r2=1732239&rev=1732239&view=diff
==============================================================================
---
sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
[UTF-8] (original)
+++
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -151,7 +151,9 @@ final class Store extends DataStore {
} finally {
in.close();
}
- } catch (JAXBException | IOException e) {
+ } catch (JAXBException e) {
+ throw new
DataStoreException(Errors.format(Errors.Keys.CanNotRead_1, name), e);
+ } catch (IOException e) {
throw new
DataStoreException(Errors.format(Errors.Keys.CanNotRead_1, name), e);
}
}
Modified:
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/package-info.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/package-info.java?rev=1732239&r1=1732238&r2=1732239&view=diff
==============================================================================
---
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/package-info.java
[UTF-8] (original)
+++
sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/package-info.java
[UTF-8] Wed Feb 24 22:57:20 2016
@@ -18,11 +18,11 @@
/**
* {@link org.apache.sis.storage.DataStore} implementation for XML files.
* The kind of objects recognized by this package is listed in the
- * {@link org.apache.sis.internal.storage.xml.XMLStore} class.
+ * {@link org.apache.sis.internal.storage.xml.Store} class.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.7
* @module
*/
package org.apache.sis.internal.storage.xml;