aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2014-01-22 02:49:14 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2014-01-22 02:49:14 +0000
commita478c716e0065f77b1d6206b24c1d34a7deb7823 (patch)
tree486dfbf04de1a713dd2e71b09a15e04546994478 /src/main
parent53be9634366b90d13dd2eb92aa660c46a979734e (diff)
downloadjackcess-a478c716e0065f77b1d6206b24c1d34a7deb7823.tar.gz
jackcess-a478c716e0065f77b1d6206b24c1d34a7deb7823.zip
Fix NullPointerException in RowImpl.toString when value is null.
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@844 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/impl/CustomToStringStyle.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/CustomToStringStyle.java b/src/main/java/com/healthmarketscience/jackcess/impl/CustomToStringStyle.java
index 437f176..f477241 100644
--- a/src/main/java/com/healthmarketscience/jackcess/impl/CustomToStringStyle.java
+++ b/src/main/java/com/healthmarketscience/jackcess/impl/CustomToStringStyle.java
@@ -119,11 +119,11 @@ public class CustomToStringStyle extends StandardToStringStyle
if(isFieldSeparatorAtStart()) {
appendFieldSeparator(sb);
}
- appendInternal(sb, fieldName, iter.next(), true);
+ appendValueDetail(sb, fieldName, iter.next());
}
while(iter.hasNext()) {
sb.append(getArraySeparator());
- appendInternal(sb, fieldName, iter.next(), true);
+ appendValueDetail(sb, fieldName, iter.next());
}
// indent entire list contents another level
@@ -151,13 +151,13 @@ public class CustomToStringStyle extends StandardToStringStyle
}
Map.Entry<?,?> e = iter.next();
sb.append(e.getKey()).append("=");
- appendInternal(sb, fieldName, e.getValue(), true);
+ appendValueDetail(sb, fieldName, e.getValue());
}
while(iter.hasNext()) {
sb.append(getArraySeparator());
Map.Entry<?,?> e = iter.next();
sb.append(e.getKey()).append("=");
- appendInternal(sb, fieldName, e.getValue(), true);
+ appendValueDetail(sb, fieldName, e.getValue());
}
// indent entire map contents another level
@@ -175,6 +175,15 @@ public class CustomToStringStyle extends StandardToStringStyle
appendDetail(buffer, PageChannel.wrap(array));
}
+ private void appendValueDetail(StringBuffer buffer, String fieldName,
+ Object value) {
+ if (value == null) {
+ appendNullText(buffer, fieldName);
+ } else {
+ appendInternal(buffer, fieldName, value, true);
+ }
+ }
+
private static void appendDetail(StringBuffer buffer, ByteBuffer bb) {
int len = bb.remaining();
buffer.append("(").append(len).append(") ");