[nobug] fix jpa failures on jdk9
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/IsolatedHashMapTest.java b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/IsolatedHashMapTest.java
index d954e80..cdf5d09 100644
--- a/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/IsolatedHashMapTest.java
+++ b/jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/IsolatedHashMapTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates.
+ * Copyright (c) 2015, 2017 Oracle and/or its affiliates.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -23,9 +23,7 @@
import javax.persistence.spi.PersistenceUnitInfo;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
+import org.eclipse.persistence.exceptions.ServerPlatformException;
import org.eclipse.persistence.internal.databaseaccess.Accessor;
import org.eclipse.persistence.internal.helper.JPAClassLoaderHolder;
import org.eclipse.persistence.internal.jpa.IsolatedHashMap;
@@ -38,6 +36,9 @@
import org.eclipse.persistence.testing.framework.ReflectionHelper;
import org.eclipse.persistence.testing.framework.junit.JUnitTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
/**
* Tests partition isolated {@link HashMap}.
*/
@@ -231,9 +232,17 @@
/** Class initialization code. */
static {
- serverPlatform = ServerPlatformUtils.createServerPlatform(
- null, ServerPlatformUtils.detectServerPlatform(null), SessionManager.class.getClassLoader());
- // False value also handles case when serverPlatform is null to avoid NPE.
+ String platformClass = ServerPlatformUtils.detectServerPlatform(null);
+ ServerPlatform sp = null;
+ try {
+ sp = platformClass != null
+ ? ServerPlatformUtils.createServerPlatform(null, platformClass, SessionManager.class.getClassLoader())
+ : null;
+ } catch (ServerPlatformException e) {
+ }
+ serverPlatform = sp;
+ // False value also handles case when serverPlatform is null to avoid
+ // NPE.
supportPartitions = serverPlatform != null ? serverPlatform.usesPartitions() : false;
}