sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1707462 - /sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java
Date Thu, 08 Oct 2015 09:25:32 GMT
Author: desruisseaux
Date: Thu Oct  8 09:25:32 2015
New Revision: 1707462

URL: http://svn.apache.org/viewvc?rev=1707462&view=rev
Log:
Fixed a NullPointerException when viewing a RecordType which has been read from a GML document.

Modified:
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java?rev=1707462&r1=1707461&r2=1707462&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java
[UTF-8] Thu Oct  8 09:25:32 2015
@@ -184,6 +184,7 @@ abstract class RecordDefinition { // Int
     /**
      * Read-only access to the map of member indices.
      */
+    @SuppressWarnings("ReturnOfCollectionOrArrayField")
     final Map<MemberName,Integer> memberIndices() {
         return memberIndices;
     }
@@ -192,7 +193,8 @@ abstract class RecordDefinition { // Int
      * Returns the number of elements in records.
      */
     final int size() {
-        return members.length;
+        // 'members' should not be null, but let be safe.
+        return (members != null) ? members.length : 0;
     }
 
     /**
@@ -238,7 +240,7 @@ abstract class RecordDefinition { // Int
     final String toString(final String head, final Object values) {
         final StringBuilder buffer = new StringBuilder(250);
         final String lineSeparator = System.lineSeparator();
-        final String[] names = new String[members.length];
+        final String[] names = new String[size()];
         int width = 0;
         buffer.append(head).append("[“").append(getRecordType().getTypeName()).append("”]
{").append(lineSeparator);
         for (int i=0; i<names.length; i++) {



Mime
View raw message