sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Minor cleanup related to the "xmlns:gmd" namespace change.
Date Thu, 14 Nov 2019 18:02:38 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 8d6c67f  Minor cleanup related to the "xmlns:gmd" namespace change.
8d6c67f is described below

commit 8d6c67f9de7934f7c62649e713d48f2f94218c3c
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Nov 14 19:01:58 2019 +0100

    Minor cleanup related to the "xmlns:gmd" namespace change.
---
 .../src/main/java/org/apache/sis/xml/Pooled.java             |  6 ++++--
 .../test/java/org/apache/sis/test/xml/PackageVerifier.java   |  6 ++++--
 .../java/org/apache/sis/internal/jaxb/referencing/Code.java  |  2 +-
 .../main/java/org/apache/sis/internal/util/Constants.java    | 12 +++++++++++-
 .../java/org/apache/sis/internal/util/DefinitionURI.java     |  2 +-
 .../org/apache/sis/internal/profile/fra/package-info.java    |  6 ++++--
 6 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java
index a901c30..498c394 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java
@@ -324,7 +324,7 @@ abstract class Pooled {
                             if (schema != null) {
                                 if (!(schema instanceof String)) {
                                     throw new PropertyException(Errors.format(Errors.Keys.IllegalPropertyValueClass_2,
-                                            Strings.bracket(name, key), value.getClass()));
+                                            Strings.bracket(name, key), schema.getClass()));
                                 }
                                 copy.put(key, (String) schema);
                             }
@@ -351,7 +351,9 @@ abstract class Pooled {
                     return;
                 }
                 case XML.LENIENT_UNMARSHAL: {
-                    if ((value instanceof CharSequence) ? Boolean.parseBoolean(value.toString())
: (Boolean) value) {
+                    if (value != null && ((value instanceof CharSequence) ?
+                            Boolean.parseBoolean(value.toString()) : (Boolean) value))
+                    {
                         bitMasks |= Context.LENIENT_UNMARSHAL;
                     } else {
                         bitMasks &= ~Context.LENIENT_UNMARSHAL;
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
index 6c62d47..7150ec3 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
@@ -42,6 +42,7 @@ import org.opengis.geoapi.SchemaException;
 import org.opengis.geoapi.SchemaInformation;
 import org.apache.sis.util.Classes;
 import org.apache.sis.internal.system.Modules;
+import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.xml.LegacyNamespaces;
 import org.apache.sis.xml.Namespaces;
 
@@ -172,8 +173,9 @@ final strictfp class PackageVerifier {
                 String location = schema.location();
                 if (!XmlSchema.NO_LOCATION.equals(location)) {
                     String expected = location;
-                    if (expected.startsWith("https:")) {
-                        expected = "http:" + expected.substring(6);
+                    if (expected.startsWith(Constants.HTTPS)) {
+                        // Replace "https" (used for schema location) by "http" (used for
namespace).
+                        expected = Constants.HTTP + expected.substring(Constants.HTTPS.length());
                     }
                     if (!expected.startsWith(schema.namespace())) {
                         throw new SchemaException("XML schema location inconsistent with
namespace in package " + name);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
b/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
index c461d72..3d51b46 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
@@ -176,7 +176,7 @@ public final class Code {
                     return new Code(identifier);
                 }
                 if (!isHTTP) {
-                    isHTTP = code.regionMatches(true, 0, "http:", 0, 5);
+                    isHTTP = code.regionMatches(true, 0, Constants.HTTP, 0, 5);
                     if (isHTTP) {
                         fallback = identifier;
                     } else if (!isEPSG) {
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
index 3a21884..f46e014 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
@@ -31,7 +31,7 @@ import org.apache.sis.util.Static;
  * creates itself the instance to be tested.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   0.5
  * @module
  */
@@ -53,6 +53,16 @@ public final class Constants extends Static {
     public static final byte DEFAULT_INDENTATION = 2;
 
     /**
+     * The {@value} protocol.
+     */
+    public static final String HTTP = "http:";
+
+    /**
+     * The {@value} protocol.
+     */
+    public static final String HTTPS = "https:";
+
+    /**
      * The {@value} code space.
      */
     public static final String GEOTIFF = "GeoTIFF";
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
b/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
index 064e8d0..9052b9b 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
@@ -695,7 +695,7 @@ public final class DefinitionURI {
         if (isGML) {
             final String path = PATHS.get(type);
             if (path != null) {
-                return "http:" + path + authority + ".xml#" + code;
+                return Constants.HTTP + path + authority + ".xml#" + code;
             }
         }
         final StringBuilder buffer = new StringBuilder(40);
diff --git a/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/package-info.java
b/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/package-info.java
index e94357b..a55a693 100644
--- a/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/package-info.java
+++ b/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/package-info.java
@@ -30,15 +30,17 @@
  * @since 0.4
  * @module
  */
-@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = FrenchProfile.NAMESPACE)
+@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = FrenchProfile.NAMESPACE,
+           xmlns = {@XmlNs(prefix = "fra", namespaceURI = FrenchProfile.NAMESPACE)})
 @XmlAccessorType(XmlAccessType.NONE)
 @XmlJavaTypeAdapters({
     @XmlJavaTypeAdapter(CI_Citation.class)
 })
 package org.apache.sis.internal.profile.fra;
 
-import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlNs;
 import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;


Mime
View raw message