sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1698396 - in /sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco: GO_CharacterString.java StringAdapter.java
Date Fri, 28 Aug 2015 19:38:05 GMT
Author: desruisseaux
Date: Fri Aug 28 19:38:05 2015
New Revision: 1698396

URL: http://svn.apache.org/r1698396
Log:
Allow reusing an internal convenience method for marshalling InternationalString as localized
String.

Modified:
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1698396&r1=1698395&r2=1698396&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
[UTF-8] Fri Aug 28 19:38:05 2015
@@ -19,7 +19,6 @@ package org.apache.sis.internal.jaxb.gco
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
-import org.opengis.util.InternationalString;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gmx.Anchor;
@@ -156,19 +155,7 @@ public class GO_CharacterString {
      */
     @XmlElement(name = "CharacterString")
     public final String getCharacterString() {
-        if (type == 0) {
-            final CharSequence text = this.text;
-            if (text != null && !(text instanceof Anchor)) {
-                if (text instanceof InternationalString) {
-                    final Context context = Context.current();
-                    if (context != null) {
-                        return ((InternationalString) text).toString(context.getLocale());
-                    }
-                }
-                return text.toString();
-            }
-        }
-        return null;
+        return (type == 0 && !(text instanceof Anchor)) ? StringAdapter.toString(text)
: null;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java?rev=1698396&r1=1698395&r2=1698396&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
[UTF-8] Fri Aug 28 19:38:05 2015
@@ -53,7 +53,7 @@ public class StringAdapter extends XmlAd
      *
      * @see org.apache.sis.xml.XML#LOCALE
      */
-    static String toString(final CharSequence text) {
+    public static String toString(final CharSequence text) {
         if (text == null) {
             return null;
         }



Mime
View raw message