From 293f51206886465e26e092faecfbb5319a86d20c Mon Sep 17 00:00:00 2001 From: Moandji Ezana Date: Sat, 5 Aug 2017 15:12:28 +0200 Subject: [PATCH] Fix https://github.com/mwanji/toml4j/issues/46 --- CHANGELOG.md | 6 ++++++ README.md | 2 +- src/main/java/com/moandjiezana/toml/ValueWriters.java | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a7311..7752d84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # toml4j Changelog +## 0.7.2 / 2017-08-05 + +## Fixed + +* [tomlWriter.write NullPointerException in JDK9](https://github.com/mwanji/toml4j/issues/46) (thanks to __[iwangxiaodong](https://github.com/iwangxiaodong)__) + ## 0.7.1 / 2016-07-27 * [Support literal strings in table names](https://github.com/mwanji/toml4j/issues/36) (thanks to __[bruno-medeiros](https://github.com/bruno-medeiros)__) diff --git a/README.md b/README.md index c285731..5b9b685 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Add the following dependency to your POM (or equivalent for other dependency man com.moandjiezana.toml toml4j - 0.7.1 + 0.7.2 ``` diff --git a/src/main/java/com/moandjiezana/toml/ValueWriters.java b/src/main/java/com/moandjiezana/toml/ValueWriters.java index be1b0db..51052fa 100644 --- a/src/main/java/com/moandjiezana/toml/ValueWriters.java +++ b/src/main/java/com/moandjiezana/toml/ValueWriters.java @@ -1,8 +1,8 @@ package com.moandjiezana.toml; import static com.moandjiezana.toml.BooleanValueReaderWriter.BOOLEAN_VALUE_READER_WRITER; -import static com.moandjiezana.toml.DateValueReaderWriter.DATE_VALUE_READER_WRITER; import static com.moandjiezana.toml.DateValueReaderWriter.DATE_PARSER_JDK_6; +import static com.moandjiezana.toml.DateValueReaderWriter.DATE_VALUE_READER_WRITER; import static com.moandjiezana.toml.MapValueWriter.MAP_VALUE_WRITER; import static com.moandjiezana.toml.NumberValueReaderWriter.NUMBER_VALUE_READER_WRITER; import static com.moandjiezana.toml.ObjectValueWriter.OBJECT_VALUE_WRITER; @@ -27,7 +27,8 @@ class ValueWriters { private ValueWriters() {} private static DateValueReaderWriter getPlatformSpecificDateConverter() { - return Runtime.class.getPackage().getSpecificationVersion().startsWith("1.6") ? DATE_PARSER_JDK_6 : DATE_VALUE_READER_WRITER; + String specificationVersion = Runtime.class.getPackage().getSpecificationVersion(); + return specificationVersion != null && specificationVersion.startsWith("1.6") ? DATE_PARSER_JDK_6 : DATE_VALUE_READER_WRITER; } private static final ValueWriter[] VALUE_WRITERS = {