sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1723641 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
Date Thu, 07 Jan 2016 23:29:30 GMT
Author: desruisseaux
Date: Thu Jan  7 23:29:30 2016
New Revision: 1723641

URL: http://svn.apache.org/viewvc?rev=1723641&view=rev
Log:
Remove the trailing line separator in the warning emitted by the WKT parser.
This is for consistency with other log messages.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java?rev=1723641&r1=1723640&r2=1723641&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Warnings.java
[UTF-8] Thu Jan  7 23:29:30 2016
@@ -349,7 +349,7 @@ public final class Warnings implements L
         final String lineSeparator = System.lineSeparator();
         final Messages resources   = Messages.getResources(locale);
         buffer.append(resources.getString(isParsing ? Messages.Keys.IncompleteParsing_1
-                : Messages.Keys.NonConformFormatting_1, root)).append(lineSeparator);
+                                                    : Messages.Keys.NonConformFormatting_1,
root));
         if (messages != null) {
             for (final Iterator<?> it = messages.iterator(); it.hasNext();) {
                 final InternationalString i18n = (InternationalString) it.next();
@@ -370,13 +370,13 @@ public final class Warnings implements L
                         cause = null;
                     }
                 }
-                buffer.append(" • ").append(message).append(lineSeparator);
+                buffer.append(lineSeparator).append(" • ").append(message);
                 if (cause != null) {
                     String details = Exceptions.getLocalizedMessage(cause, locale);
                     if (details == null) {
                         details = cause.toString();
                     }
-                    buffer.append("   ").append(details).append(lineSeparator);
+                    buffer.append(lineSeparator).append("   ").append(details);
                 }
             }
         }
@@ -385,17 +385,22 @@ public final class Warnings implements L
          */
         if (!ignoredElements.isEmpty()) {
             final Vocabulary vocabulary = Vocabulary.getResources(locale);
-            buffer.append(" • ").append(resources.getString(Messages.Keys.UnknownElementsInText)).append(lineSeparator);
+            buffer.append(lineSeparator).append(" • ").append(resources.getString(Messages.Keys.UnknownElementsInText));
             for (final Map.Entry<String, List<String>> entry : ignoredElements.entrySet())
{
-                buffer.append("    ‣ ").append(vocabulary.getString(Vocabulary.Keys.Quoted_1,
entry.getKey()));
+                buffer.append(lineSeparator).append("    ‣ ").append(vocabulary.getString(Vocabulary.Keys.Quoted_1,
entry.getKey()));
                 String separator = vocabulary.getString(Vocabulary.Keys.InBetweenWords);
                 for (final String p : entry.getValue()) {
                     buffer.append(separator).append(p);
                     separator = ", ";
                 }
-                buffer.append('.').append(lineSeparator);
+                buffer.append('.');
             }
         }
+        /*
+         * There is intentionally line separator at the end of the last line, because the
string returned by
+         * this method is typically written or logged by a call to System.out.println(…)
or something equivalent.
+         * A trailing line separator cause a visual disruption in log records for instance.
+         */
         return buffer.toString();
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java?rev=1723641&r1=1723640&r2=1723641&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
[UTF-8] Thu Jan  7 23:29:30 2016
@@ -1001,12 +1001,12 @@ public final strictfp class GeodeticObje
                                " • The text contains unknown elements:\n" +
                                "    ‣ “Intruder” in PRIMEM, GEOGCS.\n" +
                                "    ‣ “Ext1” in SPHEROID.\n" +
-                               "    ‣ “Ext2” in SPHEROID.\n", warnings.toString(Locale.US));
+                               "    ‣ “Ext2” in SPHEROID.", warnings.toString(Locale.US));
 
         assertMultilinesEquals("La lecture de « WGS 84 » a été faite, mais en ignorant
certains éléments.\n" +
                                " • Le texte contient des éléments inconnus :\n" +
                                "    ‣ « Intruder » dans PRIMEM, GEOGCS.\n"
+
                                "    ‣ « Ext1 » dans SPHEROID.\n" +
-                               "    ‣ « Ext2 » dans SPHEROID.\n", warnings.toString(Locale.FRANCE));
+                               "    ‣ « Ext2 » dans SPHEROID.", warnings.toString(Locale.FRANCE));
     }
 }



Mime
View raw message