sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1551107 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/ sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/ sis-referencing/s...
Date Mon, 16 Dec 2013 03:13:35 GMT
Author: desruisseaux
Date: Mon Dec 16 03:13:34 2013
New Revision: 1551107

URL: http://svn.apache.org/r1551107
Log:
When a warning occurs at (un)marshalling time, leave the 'source' argument to null for now.
The previous attempt to provide a non-null value added more complexity than initially though,
and we had no consistent value. In a future version, the Marshaller or Unmarshaller instance
may be a more appropriate argument than what we had - but for now we wait to see a need for
that.

Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/DateAsLongAdapter.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -134,7 +134,7 @@ public final class PT_Locale extends Xml
             } catch (PropertyException | ClassCastException e) {
                 // Should never happen. But if it happen anyway, just let the
                 // characterEncoding unitialized: it will not be marshalled.
-                Context.warningOccured(Context.current(), marshaller, PT_Locale.class, "beforeMarshal",
e, true);
+                Context.warningOccured(Context.current(), PT_Locale.class, "beforeMarshal",
e, true);
                 return;
             }
             if (encoding != null) {
@@ -180,7 +180,7 @@ public final class PT_Locale extends Xml
         if (value != null) {
             final Wrapper element = value.element;
             if (element != null) {
-                return Country.getLocale(Context.current(), element.languageCode, element.country);
+                return Country.getLocale(Context.current(), element.languageCode, element.country,
PT_Locale.class);
             }
         }
         return null;

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -95,6 +95,8 @@ public class SC_VerticalCRS extends Prop
 
     /**
      * Returns the GeoAPI interface which is bound by this adapter.
+     *
+     * @return {@code VerticalCRS.class}
      */
     @Override
     protected final Class<VerticalCRS> getBoundType() {
@@ -114,7 +116,7 @@ public class SC_VerticalCRS extends Prop
      */
     @XmlAnyElement(lax = true)
     public Object getElement() {
-        Context.warningOccured(Context.current(), metadata, SC_VerticalCRS.class, "getElement",
+        Context.warningOccured(Context.current(), SC_VerticalCRS.class, "getElement",
                 Errors.class, Errors.Keys.MissingRequiredModule_1, "sis-referencing");
         return null;
     }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -118,7 +118,7 @@ public final class TM_Primitive extends 
                      * TemporalPrimitive as the source class, since it is the closest we
can get
                      * to a public API.
                      */
-                    Context.warningOccured(Context.current(), this, TemporalPrimitive.class,
"setTimePeriod",
+                    Context.warningOccured(Context.current(), TemporalPrimitive.class, "setTimePeriod",
                             Errors.class, Errors.Keys.IllegalRange_2, begin, end);
                 } else try {
                     metadata = TemporalUtilities.createPeriod(begin, end);
@@ -162,7 +162,7 @@ public final class TM_Primitive extends 
      * @param method The name of the method to declare in the log record.
      * @param e the exception.
      */
-    private void warningOccured(final String method, final Exception e) {
-        Context.warningOccured(Context.current(), this, TM_Primitive.class, method, e, true);
+    private static void warningOccured(final String method, final Exception e) {
+        Context.warningOccured(Context.current(), TM_Primitive.class, method, e, true);
     }
 }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -88,7 +88,7 @@ public final class TimeInstant extends G
                         return date;
                     }
                 } catch (DatatypeConfigurationException e) {
-                    Context.warningOccured(context, position, TimeInstant.class, "toXML",
e, true);
+                    Context.warningOccured(context, TimeInstant.class, "toXML", e, true);
                 }
             }
         }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gts/TM_PeriodDuration.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -73,6 +73,8 @@ public final class TM_PeriodDuration ext
 
     /**
      * Returns the GeoAPI interface which is bound by this adapter.
+     *
+     * @return {@code PeriodDuration.class}
      */
     @Override
     protected Class<PeriodDuration> getBoundType() {
@@ -175,7 +177,7 @@ public final class TM_PeriodDuration ext
      * @param methodName The method name.
      * @param e The exception.
      */
-    private void warningOccured(final String methodName, final Exception e) {
-        Context.warningOccured(Context.current(), this, TM_PeriodDuration.class, methodName,
e, true);
+    private static void warningOccured(final String methodName, final Exception e) {
+        Context.warningOccured(Context.current(), TM_PeriodDuration.class, methodName, e,
true);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -549,9 +549,9 @@ public class DefaultEllipsoid extends Ab
     /**
      * Emits a warning telling that the given element is repeated twice.
      */
-    private void warnDuplicated(final String element) {
+    private static void warnDuplicated(final String element) {
          // We cheat a bit for the "unmarshal" method name since there is not such method...
-        Context.warningOccured(Context.current(), this, DefaultEllipsoid.class, "unmarshal",
+        Context.warningOccured(Context.current(), DefaultEllipsoid.class, "unmarshal",
                 Errors.class, Errors.Keys.DuplicatedElement_1, element);
     }
 

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -383,19 +383,17 @@ public final class Context extends Marsh
      * if defined, or to the {@code "org.apache.sis.xml"} logger otherwise.
      *
      * @param context The current context, or {@code null} if none.
-     * @param source  The object that emitted a warning. Can not be null.
      * @param warning The warning.
      */
-    @SuppressWarnings("unchecked")
-    public static void warningOccured(final Context context, final Object source, final LogRecord
warning) {
+    public static void warningOccured(final Context context, final LogRecord warning) {
         String logger = warning.getLoggerName();
         if (logger == null) {
             warning.setLoggerName(logger = "org.apache.sis.xml");
         }
         if (context != null) {
             final WarningListener<?> warningListener = context.warningListener;
-            if (warningListener != null && warningListener.getSourceClass().isInstance(source))
{
-                ((WarningListener) warningListener).warningOccured(source, warning);
+            if (warningListener != null) {
+                warningListener.warningOccured(null, warning);
                 return;
             }
         }
@@ -412,14 +410,13 @@ public final class Context extends Marsh
      * resources. The message will be logged at {@link Level#WARNING}.
      *
      * @param context   The current context, or {@code null} if none.
-     * @param source    The object that emitted a warning. Can not be null.
      * @param classe    The class to declare as the warning source.
      * @param method    The name of the method to declare as the warning source.
      * @param resources Either {@code Errors.class} or {@code Messages.class}.
      * @param key       The resource keys as one of the constants defined in the {@code Keys}
inner class.
      * @param arguments The arguments to be given to {@code MessageFormat} for formatting
the log message.
      */
-    public static void warningOccured(final Context context, final Object source, final Class<?>
classe, final String method,
+    public static void warningOccured(final Context context, final Class<?> classe,
final String method,
             final Class<? extends IndexedResourceBundle> resources, final short key,
final Object... arguments)
     {
         final Locale locale = context != null ? context.getLocale() : null;
@@ -434,7 +431,7 @@ public final class Context extends Marsh
         final LogRecord warning = bundle.getLogRecord(Level.WARNING, key, arguments);
         warning.setSourceClassName(classe.getCanonicalName());
         warning.setSourceMethodName(method);
-        warningOccured(context, source, warning);
+        warningOccured(context, warning);
     }
 
     /**
@@ -442,13 +439,12 @@ public final class Context extends Marsh
      * The logger will be {@code "org.apache.sis.xml"}.
      *
      * @param context The current context, or {@code null} if none.
-     * @param source  The object that emitted a warning. Can not be null.
      * @param classe  The class to declare as the warning source.
      * @param method  The name of the method to declare as the warning source.
      * @param cause   The exception which occurred.
      * @param warning {@code true} for {@link Level#WARNING}, or {@code false} for {@link
Level#FILE}.
      */
-    public static void warningOccured(final Context context, final Object source, final Class<?>
classe,
+    public static void warningOccured(final Context context, final Class<?> classe,
             final String method, final Exception cause, final boolean warning)
     {
         final LogRecord record = new LogRecord(warning ? Level.WARNING : Level.FINE,
@@ -456,7 +452,7 @@ public final class Context extends Marsh
         record.setSourceClassName(classe.getCanonicalName());
         record.setSourceMethodName(method);
         record.setThrown(cause);
-        warningOccured(context, source, record);
+        warningOccured(context, record);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -273,7 +273,7 @@ public class IdentifierMapAdapter extend
             }
         }
         if (code != null) {
-            identifiers.add(SpecializedIdentifier.parse(this, authority, code));
+            identifiers.add(SpecializedIdentifier.parse(authority, code));
         }
         return old;
     }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -215,7 +215,7 @@ public final class IdentifierMapWithSpec
                 return (uri != null) ? uri.toString() : old;
             }
         }
-        SpecializedIdentifier.parseFailure(context, this, code, type, exception);
+        SpecializedIdentifier.parseFailure(context, code, type, exception);
         final String old = super.put(authority, code);
         return (old == null && removed != null) ? removed.toString() : old;
     }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -92,13 +92,12 @@ public final class SpecializedIdentifier
      * authorities declared in the {@link IdentifierSpace} interface. Otherwise a
      * plain {@link IdentifierMapEntry} is created.
      *
-     * @param source    The object to declare as the source in case of failure.
      * @param authority The authority, typically as one of the {@link IdentifierSpace} constants.
      * @param code      The identifier code to parse.
      *
      * @see IdentifierMapAdapter#put(Citation, String)
      */
-    static Identifier parse(final IdentifierMap source, final Citation authority, final String
code) {
+    static Identifier parse(final Citation authority, final String code) {
         if (authority instanceof NonMarshalledAuthority) {
             final int ordinal = ((NonMarshalledAuthority) authority).ordinal;
             switch (ordinal) {
@@ -111,7 +110,7 @@ public final class SpecializedIdentifier
                     try {
                         return new SpecializedIdentifier<>(IdentifierSpace.UUID, converter.toUUID(context,
code));
                     } catch (IllegalArgumentException e) {
-                        parseFailure(context, source, code, UUID.class, e);
+                        parseFailure(context, code, UUID.class, e);
                         break;
                     }
                 }
@@ -123,7 +122,7 @@ public final class SpecializedIdentifier
                     try {
                         href = converter.toURI(context, code);
                     } catch (URISyntaxException e) {
-                        parseFailure(context, source, code, URI.class, e);
+                        parseFailure(context, code, URI.class, e);
                         break;
                     }
                     if (ordinal == NonMarshalledAuthority.HREF) {
@@ -147,20 +146,17 @@ public final class SpecializedIdentifier
      * the public API by which this method has been invoked.</p>
      *
      * @param context The marshalling context, or {@code null} if none.
-     * @param source  The object to declare as the source of the warning.
      * @param value   The value that we failed to parse.
      * @param type    The target type of the parsing process.
      * @param cause   The exception that occurred during the parsing process.
      */
-    static void parseFailure(final Context context, final IdentifierMap source,
-            final String value, final Class<?> type, final Exception cause)
-    {
+    static void parseFailure(final Context context, final String value, final Class<?>
type, final Exception cause) {
         final Messages resources = Messages.getResources(context != null ? context.getLocale()
: null);
         final LogRecord record = resources.getLogRecord(Level.WARNING, Messages.Keys.UnparsableValueStoredAsText_2,
type, value);
         record.setSourceClassName(IdentifierMap.class.getCanonicalName());
         record.setSourceMethodName("put");
         record.setThrown(cause);
-        Context.warningOccured(context, source, record);
+        Context.warningOccured(context, record);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/DateAsLongAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/DateAsLongAdapter.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/DateAsLongAdapter.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/DateAsLongAdapter.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -70,7 +70,7 @@ public final class DateAsLongAdapter ext
         if (value != null) {
             final long time = value;
             if (time != Long.MIN_VALUE) {
-                return new GO_DateTime(this, new Date(time), false);
+                return new GO_DateTime(new Date(time), false);
             }
         }
         return new GO_DateTime();

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -138,8 +138,8 @@ public class GO_CharacterString {
                 property  = type;
                 noset     = true;
             }
-            Context.warningOccured(Context.current(), value, getClass(), "setText",
-                    Messages.class, Messages.Keys.DiscardedExclusiveProperty_2, nameOf(discarded),
nameOf(property));
+            Context.warningOccured(Context.current(), getClass(), "setText", Messages.class,
+                    Messages.Keys.DiscardedExclusiveProperty_2, nameOf(discarded), nameOf(property));
             if (noset) {
                 return;
             }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_DateTime.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -61,12 +61,11 @@ public final class GO_DateTime extends X
     /**
      * Builds a wrapper for the given {@link Date}.
      *
-     * @param source The source for reporting errors.
      * @param date The date to marshal. Can not be {@code null}.
      * @param allowTime {@code true} for allowing the usage of {@code "DateTime"} field if
      *        applicable, or {@code false} for using the {@code "Date"} field in every cases.
      */
-    GO_DateTime(final XmlAdapter<GO_DateTime,?> source, final Date date, final boolean
allowTime) {
+    GO_DateTime(final Date date, final boolean allowTime) {
         final Context context = Context.current();
         try {
             final XMLGregorianCalendar gc = XmlUtilities.toXML(context, date);
@@ -76,7 +75,7 @@ public final class GO_DateTime extends X
                 dateTime = gc;
             }
         } catch (DatatypeConfigurationException e) {
-            Context.warningOccured(context, source, XmlAdapter.class, "marshal", e, true);
+            Context.warningOccured(context, XmlAdapter.class, "marshal", e, true);
         }
     }
 
@@ -110,6 +109,6 @@ public final class GO_DateTime extends X
      */
     @Override
     public GO_DateTime marshal(final Date value) {
-        return (value != null) ? new GO_DateTime(this, value, true) : null;
+        return (value != null) ? new GO_DateTime(value, true) : null;
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/Measure.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -182,7 +182,7 @@ public final class Measure {
      */
     public void setUnit(final Unit<?> newUnit) {
         if (unit != null && !unit.equals(newUnit)) {
-            Context.warningOccured(Context.current(), this, getClass(), "setUnit",
+            Context.warningOccured(Context.current(), getClass(), "setUnit",
                     Errors.class, Errors.Keys.IncompatiblePropertyValue_1, unit);
         }
         unit = newUnit;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectReference.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -148,7 +148,7 @@ final class ObjectReference {
         if (value != null) {
             final T previous = map.putSpecialized(authority, value);
             if (previous != null && !previous.equals(value)) {
-                Context.warningOccured(context, map, IdentifierMap.class, "putSpecialized",
+                Context.warningOccured(context, IdentifierMap.class, "putSpecialized",
                         Errors.class, Errors.Keys.InconsistentAttribute_2, authority.getName(),
value);
                 map.putSpecialized(authority, previous);
             }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -164,7 +164,7 @@ public final class CodeListProxy {
                 value = ResourceBundle.getBundle("org.opengis.metadata.CodeLists",
                         locale, CodeList.class.getClassLoader()).getString(key);
             } catch (MissingResourceException e) {
-                Context.warningOccured(context, code, CodeListAdapter.class, "marshal", e,
false);
+                Context.warningOccured(context, CodeListAdapter.class, "marshal", e, false);
             }
         }
         if (value != null) {

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -120,14 +120,17 @@ public final class Country extends GO_Ch
     /**
      * Returns the locale for the given language and country (which may be null), or {@code
null} if none.
      *
-     * @param  context The current (un)marshalling context, or {@code null} if none.
+     * @param  context  The current (un)marshalling context, or {@code null} if none.
      * @param  language The wrapper for the language value.
      * @param  country  The wrapper for the country value.
+     * @param  caller   The class which is invoking this method, used only in case of warning.
      * @return A locale which represents the language and country value.
      *
      * @see LanguageCode#getLocale(Context, LanguageCode, boolean)
      */
-    public static Locale getLocale(final Context context, final LanguageCode language, final
Country country) {
+    public static Locale getLocale(final Context context, final LanguageCode language, final
Country country,
+            final Class<?> caller)
+    {
         String code = null;
         if (language != null) {
             code = language.getLanguage();
@@ -147,7 +150,7 @@ public final class Country extends GO_Ch
                     if (++i == code.length() || code.charAt(i) == '_') {
                         code = new StringBuilder().append(code, 0, i).append(c).append(code,
i, length).toString();
                     } else if (!c.equals(CharSequences.token(code, i))) {
-                        Context.warningOccured(context, null, null, "unmarshal", Errors.class,
+                        Context.warningOccured(context, caller, "unmarshal", Errors.class,
                                 Errors.Keys.IncompatiblePropertyValue_1, "country");
                     }
                 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -104,7 +104,7 @@ public final class CheckedArrayList<E> e
             return false;
         }
         if (element != null) {
-            Context.warningOccured(context, source, source.getClass(), "add",
+            Context.warningOccured(context, source.getClass(), "add",
                     Errors.class, Errors.Keys.IllegalArgumentClass_3, "element", type, element.getClass());
         }
         return true;
@@ -146,8 +146,7 @@ public final class CheckedArrayList<E> e
     private List<E> ensureValidCollection(final Collection<? extends E> collection)
throws IllegalArgumentException {
         int count = 0;
         final Object[] array = collection.toArray();
-        for (int i=0; i<array.length; i++) {
-            final Object element = array[i];
+        for (final Object element : array) {
             if (ensureValid((E) element)) {
                 array[count++] = element;
             }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java?rev=1551107&r1=1551106&r2=1551107&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
[UTF-8] Mon Dec 16 03:13:34 2013
@@ -68,7 +68,7 @@ public interface WarningListener<S> exte
      * Applications do not need to log the warning, since logging will be done automatically
if the emitter has
      * no registered warning listeners.</p>
      *
-     * @param source  The object that emitted a warning.
+     * @param source  The object that emitted a warning, or {@code null} if not available.
      * @param warning The warning message together with programmatic information.
      */
     void warningOccured(S source, LogRecord warning);



Mime
View raw message