sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1733301 - in /sis/branches/JDK8: application/sis-console/src/main/java/org/apache/sis/console/ application/sis-console/src/main/resources/org/apache/sis/console/ core/sis-referencing/src/main/java/org/apache/sis/referencing/ core/sis-refer...
Date Wed, 02 Mar 2016 14:25:53 GMT
Author: desruisseaux
Date: Wed Mar  2 14:25:52 2016
New Revision: 1733301

URL: http://svn.apache.org/viewvc?rev=1733301&view=rev
Log:
Adjust messages and logging.

Modified:
    sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/ResourcesDownloader.java
    sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages.properties
    sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages_fr.properties
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties

Modified: sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/ResourcesDownloader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/ResourcesDownloader.java?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/ResourcesDownloader.java
[UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/ResourcesDownloader.java
[UTF-8] Wed Mar  2 14:25:52 2016
@@ -172,14 +172,15 @@ public class ResourcesDownloader extends
             for (final String r : resources.getString("yes").split("\\|")) answers.put(r,
Boolean.TRUE);
             for (final String r : resources.getString("no" ).split("\\|")) answers.put(r,
Boolean.FALSE);
         }
-        final String textColor, infoColor, actionColor, resetColor;
+        final String textColor, linkColor, linkOff, actionColor, resetColor;
         if (colors) {
             textColor   = X364.FOREGROUND_YELLOW .sequence();
-            infoColor   = X364.FOREGROUND_GRAY   .sequence();
+            linkColor   = X364.UNDERLINE         .sequence();
+            linkOff     = X364.NO_UNDERLINE      .sequence();
             actionColor = X364.FOREGROUND_GREEN  .sequence();
             resetColor  = X364.FOREGROUND_DEFAULT.sequence();
         } else {
-            textColor = infoColor = actionColor = resetColor = "";
+            textColor = linkColor = linkOff = actionColor = resetColor = "";
         }
         /*
          * Start the download if the user accepts. We need to begin the download in order
to get the
@@ -189,7 +190,7 @@ public class ResourcesDownloader extends
             if (console == null) {
                 throw new IllegalStateException();
             }
-            console.format(resources.getString("install"), textColor, DATABASE_SIZE, infoColor,
directory, textColor, resetColor);
+            console.format(resources.getString("install"), textColor, DATABASE_SIZE, linkColor,
directory, linkOff, resetColor);
             if (!accept(resources.getString("download"), textColor, resetColor)) {
                 console.format("%n");
                 throw new AccessDeniedException(null);

Modified: sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages.properties?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages.properties
[ISO-8859-1] Wed Mar  2 14:25:52 2016
@@ -2,7 +2,7 @@
 
 install=%n%s\
 Installation of EPSG geodetic dataset is recommended for this operation.%n\
-This would use about %d Mb in the %s"%s"%s directory.%s%n
+This would use about %d Mb in the "%s%s%s" directory.%s%n
 
 download=%s\
 Download and install now? (Yes/No) %s

Modified: sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages_fr.properties?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/resources/org/apache/sis/console/Messages_fr.properties
[ISO-8859-1] Wed Mar  2 14:25:52 2016
@@ -1,17 +1,17 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 
 install=%n%s\
-L'installation de la base de donn\u00e9es g\u00e9od\u00e9sique EPSG est recommand\u00e9e
pour cette op\u00e9ration.%n\
-Elle n\u00e9cessite environ %d Mo dans le r\u00e9pertoire %s"%s"%s.%s%n
+L'installation de la base de données géodésique EPSG est recommandée pour cette opération.%n\
+Elle nécessite environ %d Mo dans le répertoire "%s%s%s".%s%n
 
 download=%s\
-T\u00e9l\u00e9charger et installer maintenant? (Oui/Non) %s
+Télécharger et installer maintenant? (Oui/Non) %s
 
 downloading=%s\
-T\u00e9l\u00e9chargement en cours...%s%n
+Téléchargement en cours...%s%n
 
 installing=%s\
-Installation de la base de donn\u00e9es g\u00e9od\u00e9sique EPSG...%s%n
+Installation de la base de données géodésique EPSG...%s%n
 
 accept=%s\
 Acceptez-vous ces conditions d'utilisation? (Oui/Non) %s

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
[UTF-8] Wed Mar  2 14:25:52 2016
@@ -110,7 +110,7 @@ final class AuthorityFactories<T extends
             if (factory == null) try {
                 factory = new EPSGFactory(null);
             } catch (FactoryException e) {
-                log(Level.CONFIG, e, false);
+                log(Level.CONFIG, e);
                 factory = EPSGFactoryFallback.INSTANCE;
             }
             EPSG[0] = factory;
@@ -137,12 +137,7 @@ final class AuthorityFactories<T extends
                 EPSG[0] = factory;
             }
         }
-        /*
-         * We do not log at Level.WARNING because the UnavailableFactoryException message
is usually
-         * not very informative, and a more informative warning has already been logged by
EPSGFactory.
-         * However the stack trace may have some interest.
-         */
-        log(Level.FINE, e, true);
+        log(Level.WARNING, e);
         return factory;
     }
 
@@ -166,14 +161,13 @@ final class AuthorityFactories<T extends
      * Logs the given exception at the given level. This method pretends that the logging
come from
      * {@link CRS#getAuthorityFactory(String)}, which is the public facade for {@link #EPSG()}.
      */
-    private static void log(final Level level, final Exception e, final boolean trace) {
+    private static void log(final Level level, final Exception e) {
         String message = e.getLocalizedMessage();
         if (message == null) {
             message = e.toString();
         }
         final LogRecord record = new LogRecord(level, message);
         record.setLoggerName(Loggers.CRS_FACTORY);
-        if (trace) record.setThrown(e);
         Logging.log(CRS.class, "getAuthorityFactory", record);
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java
[UTF-8] Wed Mar  2 14:25:52 2016
@@ -43,7 +43,10 @@ import org.apache.sis.internal.util.Cons
 import org.apache.sis.referencing.factory.ConcurrentAuthorityFactory;
 import org.apache.sis.referencing.factory.UnavailableFactoryException;
 import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.Classes;
+import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.Localized;
+import org.apache.sis.util.resources.Errors;
 
 
 /**
@@ -262,7 +265,7 @@ public class EPSGFactory extends Concurr
                 throw new UnavailableFactoryException(Initializer.unspecified(locale));
             }
         } catch (Exception e) {
-            throw new UnavailableFactoryException(e.getLocalizedMessage(), e);
+            throw new UnavailableFactoryException(message(e), e);
         }
         dataSource   = ds;
         nameFactory  = factory(NameFactory.class,                "nameFactory",  properties);
@@ -283,6 +286,17 @@ public class EPSGFactory extends Concurr
     }
 
     /**
+     * Returns the message to put in an {@link UnavailableFactoryException} having the given
exception as its cause.
+     */
+    private String message(final Exception e) {
+        String message = Exceptions.getLocalizedMessage(e, locale);
+        if (message == null) {
+            message = Classes.getShortClassName(e);
+        }
+        return Errors.getResources(locale).getString(Errors.Keys.CanNotUseGeodeticParameters_2,
Constants.EPSG, message);
+    }
+
+    /**
      * Returns the namespace of EPSG codes.
      *
      * @return The {@code "EPSG"} string in a singleton map.
@@ -438,7 +452,7 @@ public class EPSGFactory extends Concurr
             } catch (SQLException e2) {
                 e.addSuppressed(e2);
             }
-            exception = new UnavailableFactoryException(e.getLocalizedMessage(), e);
+            exception = new UnavailableFactoryException(message(e), e);
         }
         exception.setUnavailableFactory(this);
         throw exception;

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
[UTF-8] Wed Mar  2 14:25:52 2016
@@ -281,7 +281,10 @@ final class EPSGInstaller extends Script
     }
 
     /**
-     * Logs a message reporting the failure to create EPSG database.
+     * Logs a message reporting the failure to create EPSG database. This method is invoked
when {@link EPSGFactory}
+     * caught an exception. This log completes rather than replaces the exception message
since {@code EPSGFactory}
+     * lets the exception propagate. Another code (for example {@link org.apache.sis.referencing.CRS#forCode(String)})
+     * may catch that exception and log another record with the exception message.
      */
     final void logFailure(final Locale locale) {
         String message = Messages.getResources(locale).getString(Messages.Keys.CanNotCreateSchema_1,
EPSG);

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/X364.java
[UTF-8] Wed Mar  2 14:25:52 2016
@@ -33,7 +33,7 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  *
  * @see <a href="http://en.wikipedia.org/wiki/ANSI_escape_code">Wikipedia: ANSI escape
codes</a>
@@ -44,6 +44,8 @@ public enum X364 {
     /** Normal intensity (not {@link #BOLD}).        */ NORMAL              ((byte) 22, null),
     /** Bold intensity.                              */ BOLD                ((byte)  1, null),
     /** Faint intensity.                             */ FAINT               ((byte)  2, null),
+    /** Single underline.                            */ UNDERLINE           ((byte)  4, null),
+    /** No underline.                                */ NO_UNDERLINE        ((byte) 24, null),
     /** Red foreground color, normal intensity.      */ FOREGROUND_RED      ((byte) 31, "red"),
     /** Green foreground color, normal intensity.    */ FOREGROUND_GREEN    ((byte) 32, "green"),
     /** Yellow foreground color, normal intensity.   */ FOREGROUND_YELLOW   ((byte) 33, "yellow"),
@@ -69,7 +71,7 @@ public enum X364 {
      */
     private static final X364[] NAMED;
     static {
-        NAMED = Arrays.copyOfRange(values(), 4, 11);
+        NAMED = Arrays.copyOfRange(values(), 6, 13);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] Wed Mar  2 14:25:52 2016
@@ -181,6 +181,11 @@ public final class Errors extends Indexe
         public static final short CanNotTransformEnvelopeToGeodetic = 174;
 
         /**
+         * Can not use the {0} geodetic parameters: {1}
+         */
+        public static final short CanNotUseGeodeticParameters_2 = 218;
+
+        /**
          * Circular reference.
          */
         public static final short CircularReference = 52;

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] Wed Mar  2 14:25:52 2016
@@ -47,6 +47,7 @@ CanNotSetParameterValue_1         = Can
 CanNotSetPropertyValue_1          = Can not set a value for property \u201c{0}\u201d.
 CanNotTransformEnvelope           = Can not transform envelope.
 CanNotTransformEnvelopeToGeodetic = Can not transform envelope to a geodetic CRS.
+CanNotUseGeodeticParameters_2     = Can not use the {0} geodetic parameters: {1}
 CircularReference                 = Circular reference.
 ClassNotFinal_1                   = Class \u2018{0}\u2019 is not final.
 CloneNotSupported_1               = Can not clone an object of type \u2018{0}\u2019.

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1733301&r1=1733300&r2=1733301&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Wed Mar  2 14:25:52 2016
@@ -44,6 +44,7 @@ CanNotSetParameterValue_1         = Ne p
 CanNotSetPropertyValue_1          = Ne peut pas d\u00e9finir une valeur pour la propri\u00e9t\u00e9
\u00ab\u202f{0}\u202f\u00bb.
 CanNotTransformEnvelope           = Ne peut pas transformer l\u2019enveloppe.
 CanNotTransformEnvelopeToGeodetic = Ne peut pas transformer l\u2019enveloppe vers un syst\u00e8me
g\u00e9od\u00e9sique.
+CanNotUseGeodeticParameters_2     = Ne peut pas utiliser les param\u00e8tres g\u00e9od\u00e9siques
{0}\u202f: {1}
 CircularReference                 = R\u00e9f\u00e9rence circulaire.
 ClassNotFinal_1                   = La classe \u2018{0}\u2019 n\u2019est pas finale.
 CloneNotSupported_1               = Un objet de type \u2018{0}\u2019 ne peut pas \u00eatre
clon\u00e9.



Mime
View raw message