mirror of https://github.com/apache/nifi.git
NIFI-9968 Added null check before System.setProperty() in test methods
- Resolves build failures on Java 17 where the original user.timezone property returns null from System.getProperty() Signed-off-by: Matthew Burgess <mattyb149@apache.org> This closes #6000
This commit is contained in:
parent
8b08795e18
commit
ac2d7d1e54
|
@ -79,7 +79,9 @@ public class TestRecordPath {
|
|||
|
||||
@AfterAll
|
||||
public static void setSystemTimezone() {
|
||||
System.setProperty(USER_TIMEZONE_PROPERTY, SYSTEM_TIMEZONE);
|
||||
if (SYSTEM_TIMEZONE != null) {
|
||||
System.setProperty(USER_TIMEZONE_PROPERTY, SYSTEM_TIMEZONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -405,7 +405,9 @@ public class TestConvertRecord {
|
|||
assertTrue(avroStream.hasNext());
|
||||
assertEquals(1, avroStream.next().get("date")); // see https://avro.apache.org/docs/1.10.0/spec.html#Date
|
||||
} finally {
|
||||
System.setProperty("user.timezone", timezone);
|
||||
if (timezone != null) {
|
||||
System.setProperty("user.timezone", timezone);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue