sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1821990 - /sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java
Date Tue, 23 Jan 2018 10:38:24 GMT
Author: desruisseaux
Date: Tue Jan 23 10:38:24 2018
New Revision: 1821990

URL: http://svn.apache.org/viewvc?rev=1821990&view=rev
Log:
Skip commit 6cb8eb04dcdea0ff03a7067bec6ca3cf57c1b913 (Added more convenience methods for marshalling
to XML.java)
The number of convenience methods that could be added is endless; a line has to be drawn somewhere.
The XML.marshal(Object object, Result output, Map<String,?> properties) is there as
a fallback for
cases not handled by other convenience methods.

Adaptation of commit 2c88535a22b2a7d9d33dba55da04b5d9399a10f6 from Image Matter
(added default constructor to DefaultRecord)

Adaptation of commit 09ceca993cca9a1ea0141d4c1df01886ccd855a4 from Image Matter
(Added null checking for getRecordType method to avoid null pointer exception when Record
is initialized with empty record type)

The project at this revision can be built but is known to have test failures.
Tests will pass only after we completed the port of all ISO 19115-3 work.

Modified:
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java?rev=1821990&r1=1821989&r2=1821990&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java
[UTF-8] Tue Jan 23 10:38:24 2018
@@ -54,7 +54,7 @@ import org.apache.sis.internal.util.Abst
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Cullen Rombach (Image Matters)
- * @version 0.8
+ * @version 1.0
  *
  * @see DefaultRecordType
  * @see DefaultRecordSchema
@@ -80,6 +80,14 @@ public class DefaultRecord implements Re
     private final Object values;
 
     /**
+     * Constructs an initially empty record. Used by JAXB.
+     */
+    private DefaultRecord() {
+        definition = null;
+        values = null;
+    }
+
+    /**
      * Creates a new record for the given record type.
      * The initial values are unspecified - they may be null or zero.
      * Callers can assign values by a call to {@link #setAll(Object[])}.
@@ -162,7 +170,8 @@ public class DefaultRecord implements Re
      */
     @Override
     public RecordType getRecordType() {
-        return definition.getRecordType();
+        // Should never be null, unless temporarily during unmarshalling.
+        return (definition != null) ? definition.getRecordType() : null;
     }
 
     /**



Mime
View raw message