sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1607728 - /sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
Date Thu, 03 Jul 2014 19:36:51 GMT
Author: desruisseaux
Date: Thu Jul  3 19:36:51 2014
New Revision: 1607728

URL: http://svn.apache.org/r1607728
Log:
Document better why we skip deprecated setter methods.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1607728&r1=1607727&r2=1607728&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
[UTF-8] Thu Jul  3 19:36:51 2014
@@ -1134,7 +1134,20 @@ class PropertyAccessor {
             final Cloner cloner = new Cloner();
             for (int i=0; i<allCount; i++) {
                 final Method setter = setters[i];
-                if (setter != null && !setter.isAnnotationPresent(Deprecated.class))
{
+                if (setter != null) {
+                    if (setter.isAnnotationPresent(Deprecated.class)) {
+                        /*
+                         * We need to skip deprecated setter methods, because those methods
may delegate
+                         * their work to other setter methods in different objects and those
objects may
+                         * have been made unmodifiable by previous iteration in this loop.
 If we do not
+                         * skip them, we get an UnmodifiableMetadataException in the call
to set(…).
+                         *
+                         * Note that in some cases, only the setter method is deprecated,
not the getter.
+                         * This happen when Apache SIS classes represent a more recent ISO
standard than
+                         * the GeoAPI interfaces.
+                         */
+                        continue;
+                    }
                     final Method getter = getters[i];
                     final Object source = get(getter, metadata);
                     final Object target = cloner.clone(source);
@@ -1142,7 +1155,7 @@ class PropertyAccessor {
                         arguments[0] = target;
                         set(setter, metadata, arguments);
                         /*
-                         * We invoke the set(...) method which do not perform type conversion
+                         * We invoke the set(…) method variant that do not perform type
conversion
                          * because we don't want it to replace the immutable collection created
                          * by ModifiableMetadata.unmodifiable(source). Conversion should
not be
                          * required anyway because the getter method should have returned
a value



Mime
View raw message