sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1401265 - in /sis/branches/JDK7: ./ sis-utility/src/main/java/org/apache/sis/measure/ sis-utility/src/main/java/org/apache/sis/util/ sis-utility/src/main/java/org/apache/sis/util/resources/
Date Tue, 23 Oct 2012 12:18:53 GMT
Author: desruisseaux
Date: Tue Oct 23 12:18:52 2012
New Revision: 1401265

URL: http://svn.apache.org/viewvc?rev=1401265&view=rev
Log:
Renamed getMessage(Locale) as getLocalizedMessage(Locale) for clarity and consistency with
Throwable.getLocalizedMessage().
Minor javadoc fixes, and added the missing AngleFormat.clone() method.

Modified:
    sis/branches/JDK7/pom.xml
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedException.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedParseException.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java

Modified: sis/branches/JDK7/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/pom.xml?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/pom.xml (original)
+++ sis/branches/JDK7/pom.xml Tue Oct 23 12:18:52 2012
@@ -479,7 +479,7 @@ Apache SIS is a toolkit for describing l
             </group>
             <group>
               <title>Utilities</title>
-              <packages>org.apache.sis.math*:org.apache.sis.util*:org.apache.sis.io*:org.apache.sis.xml*</packages>
+              <packages>org.apache.sis.math*:org.apache.sis.measure*:org.apache.sis.util*:org.apache.sis.io*:org.apache.sis.xml*</packages>
             </group>
           </groups>
 

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java Tue Oct
23 12:18:52 2012
@@ -169,7 +169,7 @@ public class Angle implements Comparable
      * Developers should consider using {@link AngleFormat} for end-user applications
instead
      * than this method.
      *
-     * @see AngleFormat#format(Angle)
+     * @see AngleFormat#format(double)
      */
     @Override
     public String toString() {

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java Tue
Oct 23 12:18:52 2012
@@ -48,7 +48,8 @@ import java.util.Objects;
  * Parses and formats angles according a specified pattern. The pattern is a string
  * containing any characters, with a special meaning for the following characters:
  *
- * <blockquote><table class="compact">
+ * <blockquote><table class="sis">
+ *   <tr><th>Symbol</th><th>Meaning</th></tr>
  *   <tr><td>{@code D}</td><td>The integer part of degrees</td></tr>
  *   <tr><td>{@code d}</td><td>The fractional part of degrees</td></tr>
  *   <tr><td>{@code M}</td><td>The integer part of minutes</td></tr>
@@ -82,7 +83,7 @@ import java.util.Objects;
  *
  * <p>The following table gives some pattern examples:</p>
  *
- * <blockquote><table class="compact">
+ * <blockquote><table class="sis">
  *   <tr><th>Pattern           </th>  <th>Example   </th></tr>
  *   <tr><td>{@code DD°MM′SS″ }</td>  <td>48°30′00″
</td></tr>
  *   <tr><td>{@code DD°MM′    }</td>  <td>48°30′
   </td></tr>
@@ -195,8 +196,10 @@ public class AngleFormat extends Format 
      * Formats to use for writing numbers (degrees, minutes or seconds) when formatting an
angle.
      * The pattern given to this {@code DecimalFormat} shall NOT accept exponential notation,
      * because "E" of "Exponent" would be confused with "E" of "East".
+     *
+     * <p>Consider this field as final. It is modified only by the {@link #clone()}
method.</p>
      */
-    private final DecimalFormat numberFormat;
+    private DecimalFormat numberFormat;
 
     /**
      * Object to give to {@code DecimalFormat.format} methods,
@@ -1253,6 +1256,17 @@ BigBoss:    switch (skipSuffix(source, p
     }
 
     /**
+     * Returns a clone of this {@code AngleFormat}.
+     */
+    @Override
+    public AngleFormat clone() {
+        final AngleFormat clone = (AngleFormat) super.clone();
+        clone.numberFormat = (DecimalFormat) numberFormat.clone();
+        clone.dummy = null;
+        return clone;
+    }
+
+    /**
      * Returns a "hash value" for this object.
      */
     @Override

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java Tue Oct
23 12:18:52 2012
@@ -55,10 +55,10 @@ public final class Latitude extends Angl
     /**
      * Construct a new latitude with the specified angular value.
      *
-     * @param θ Angle in decimal degrees.
+     * @param φ Latitude value in decimal degrees.
      */
-    public Latitude(final double θ) {
-        super(θ);
+    public Latitude(final double φ) {
+        super(φ);
     }
 
     /**

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java Tue
Oct 23 12:18:52 2012
@@ -55,10 +55,10 @@ public final class Longitude extends Ang
     /**
      * Construct a new longitude with the specified angular value.
      *
-     * @param θ Angle in decimal degrees.
+     * @param λ Longitude value in decimal degrees.
      */
-    public Longitude(final double θ) {
-        super(θ);
+    public Longitude(final double λ) {
+        super(λ);
     }
 
     /**

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java Tue Oct
23 12:18:52 2012
@@ -46,9 +46,9 @@ public final class Exceptions extends St
      *
      * <ul>
      *   <li>{@link ParseException#getMessage()} returns the message in the default
locale.</li>
-     *   <li>{@link ParseException#getLocalizedMessage() getLocalizedMessage()} returns
the
-     *       message in the locale given in argument to this method. This is usually the
-     *       {@link java.text.Format} locale, which is presumed to be the end-user locale.</li>
+     *   <li>{@link ParseException#getLocalizedMessage()} returns the message in the
locale given
+     *       in argument to this method. This is usually the {@link java.text.Format} locale,
+     *       which is presumed to be the end-user locale.</li>
      * </ul>
      *
      * @param  locale The locale for {@link ParseException#getLocalizedMessage()}.
@@ -79,12 +79,12 @@ public final class Exceptions extends St
      * @return The message in the given locale if possible, or {@code null} if the {@code
exception}
      *         argument was {@code null} or the exception does not contain a message.
      */
-    public static String getMessage(final Throwable exception, final Locale locale) {
+    public static String getLocalizedMessage(final Throwable exception, final Locale locale)
{
         if (exception == null) {
             return null;
         }
         if (locale != null && exception instanceof LocalizedException) {
-            return ((LocalizedException) exception).getMessage(locale);
+            return ((LocalizedException) exception).getLocalizedMessage(locale);
         }
         return exception.getLocalizedMessage();
     }
@@ -155,7 +155,7 @@ public final class Exceptions extends St
         String lineSeparator = null;
         StringBuilder buffer = null;
         while (cause != null) {
-            String message = getMessage(cause, locale);
+            String message = getLocalizedMessage(cause, locale);
             if (message != null && !(message = message.trim()).isEmpty()) {
                 if (buffer == null) {
                     done = new HashSet<>();

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java Tue Oct
23 12:18:52 2012
@@ -20,7 +20,7 @@ import java.util.Locale;
 
 
 /**
- * Interface of localized services (parser, formatter, codes, <i>etc.</i>).
+ * Interface of localized services (parser, formatter, codes, …).
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.05)

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedException.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedException.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedException.java
Tue Oct 23 12:18:52 2012
@@ -29,7 +29,7 @@ import java.util.Locale;
  *   <li>{@link Throwable#getLocalizedMessage()} returns the message in the locale
returned by the
  *       {@link #getLocale()} method. This is often the locale used by a {@link java.text.Format}
  *       object for example, and can be presumed to be the locale on the client side.</li>
- *   <li>{@link #getMessage(Locale)} returns the message in the given locale.
+ *   <li>{@link #getLocalizedMessage(Locale)} returns the message in the given locale.
  *       This method is specific to Apache SIS however.</li>
  * </ul>
  *
@@ -38,7 +38,7 @@ import java.util.Locale;
  * @version 0.3
  * @module
  *
- * @see Exceptions#getMessage(Throwable, Locale)
+ * @see Exceptions#getLocalizedMessage(Throwable, Locale)
  */
 interface LocalizedException extends Localized {
     /**
@@ -69,5 +69,5 @@ interface LocalizedException extends Loc
      * @param  locale The locale of the message to produce, or {@code null} for the default
locale.
      * @return The exception message in the given locale.
      */
-    String getMessage(Locale locale);
+    String getLocalizedMessage(Locale locale);
 }

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedParseException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedParseException.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedParseException.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/LocalizedParseException.java
Tue Oct 23 12:18:52 2012
@@ -124,7 +124,7 @@ final class LocalizedParseException exte
      * {@inheritDoc}
      */
     @Override
-    public String getMessage(final Locale locale) {
+    public String getLocalizedMessage(final Locale locale) {
         return message(locale, arguments);
     }
 }

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
Tue Oct 23 12:18:52 2012
@@ -394,7 +394,7 @@ public class IndexedResourceBundle exten
             record.setThrown (exception);
             Logging.log(IndexedResourceBundle.class, methodName, record);
             final MissingResourceException error = new MissingResourceException(
-                    Exceptions.getMessage(exception, getLocale()), // For users, use requested
locale.
+                    Exceptions.getLocalizedMessage(exception, getLocale()), // For users,
use requested locale.
                     getClass().getCanonicalName(), key);
             error.initCause(exception);
             throw error;
@@ -465,7 +465,7 @@ public class IndexedResourceBundle exten
                 }
                 replacement = CharSequences.shortSentence(text, MAX_STRING_LENGTH);
             } else if (element instanceof Throwable) {
-                String message = Exceptions.getMessage((Throwable) element, getFormatLocale());
+                String message = Exceptions.getLocalizedMessage((Throwable) element, getFormatLocale());
                 if (message == null) {
                     message = Classes.getShortClassName(element);
                 }

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java?rev=1401265&r1=1401264&r2=1401265&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java
Tue Oct 23 12:18:52 2012
@@ -127,7 +127,7 @@ final class Loader extends ResourceBundl
         try {
             return (ResourceBundle) classe.getDeclaredConstructor(String.class).newInstance(filename);
         } catch (NoSuchMethodException | InvocationTargetException e) {
-            InstantiationException exception = new InstantiationException(Exceptions.getMessage(e,
locale));
+            InstantiationException exception = new InstantiationException(Exceptions.getLocalizedMessage(e,
locale));
             exception.initCause(e);
             throw exception;
         }



Mime
View raw message