tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: dropping few more sun.net.util.IPAddressUtil and upgrading mockito for ejbd module
Date Wed, 03 May 2017 17:11:48 GMT
Repository: tomee
Updated Branches:
  refs/heads/master 09ace0868 -> 703e97708


dropping few more sun.net.util.IPAddressUtil and upgrading mockito for ejbd module


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/703e9770
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/703e9770
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/703e9770

Branch: refs/heads/master
Commit: 703e977089828912f9bae17ccc59d5a860eec996
Parents: 09ace08
Author: rmannibucau <rmannibucau@apache.org>
Authored: Wed May 3 19:11:42 2017 +0200
Committer: rmannibucau <rmannibucau@apache.org>
Committed: Wed May 3 19:11:42 2017 +0200

----------------------------------------------------------------------
 server/openejb-ejbd/pom.xml                     | 11 ++++++++
 .../apache/openejb/AuthentWithRequestTest.java  |  7 ++++-
 .../server/discovery/MulticastPulseAgent.java   | 27 ++++++++++++++++----
 .../discovery/MulticastPulseAgentTest.java      | 27 ++++++++++++++++----
 4 files changed, 61 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/703e9770/server/openejb-ejbd/pom.xml
----------------------------------------------------------------------
diff --git a/server/openejb-ejbd/pom.xml b/server/openejb-ejbd/pom.xml
index 17ee173..6e19f10 100644
--- a/server/openejb-ejbd/pom.xml
+++ b/server/openejb-ejbd/pom.xml
@@ -140,6 +140,17 @@
       <groupId>com.agical.rmock</groupId>
       <artifactId>rmock</artifactId>
       <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>cglib</groupId>
+          <artifactId>cglib-nodep</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>cglib</groupId>
+      <artifactId>cglib</artifactId>
+      <version>3.2.5</version>
     </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/tomee/blob/703e9770/server/openejb-ejbd/src/test/java/org/apache/openejb/AuthentWithRequestTest.java
----------------------------------------------------------------------
diff --git a/server/openejb-ejbd/src/test/java/org/apache/openejb/AuthentWithRequestTest.java
b/server/openejb-ejbd/src/test/java/org/apache/openejb/AuthentWithRequestTest.java
index 4d282f7..c0400bb 100644
--- a/server/openejb-ejbd/src/test/java/org/apache/openejb/AuthentWithRequestTest.java
+++ b/server/openejb-ejbd/src/test/java/org/apache/openejb/AuthentWithRequestTest.java
@@ -112,6 +112,9 @@ public class AuthentWithRequestTest {
                 try {
                     client.call();
                 } catch (final EJBException e) {
+                    if (!LoginException.class.isInstance(e.getCause())) {
+                        e.printStackTrace();
+                    }
                     assertTrue(LoginException.class.isInstance(e.getCause()));
                 }
             }
@@ -157,7 +160,9 @@ public class AuthentWithRequestTest {
             } catch (final Exception e) {
                 throw new LoginException(e.getMessage());
             }
-            assertEquals("foo", nameCallback.getName());
+            if (!"foo".equals(nameCallback.getName())) {
+                throw new IllegalArgumentException("Not an Error/assert cause in java 9 jaas
doesnt capture it anymore");
+            }
             RemoteWithSecurity.name.set(nameCallback.getName());
             return true;
         }

http://git-wip-us.apache.org/repos/asf/tomee/blob/703e9770/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java
----------------------------------------------------------------------
diff --git a/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java
b/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java
index d1d7c4c..af30214 100644
--- a/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java
+++ b/server/openejb-multicast/src/main/java/org/apache/openejb/server/discovery/MulticastPulseAgent.java
@@ -10,12 +10,13 @@ import org.apache.openejb.util.DaemonThreadFactory;
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
 import org.apache.openejb.util.OptionsLog;
-import sun.net.util.IPAddressUtil;
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.DatagramPacket;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.MulticastSocket;
@@ -631,6 +632,13 @@ public class MulticastPulseAgent implements DiscoveryAgent, ServerService,
SelfM
     private static String getHosts(final Set<String> ignore) {
 
         final Set<String> hosts = new TreeSet<String>(new Comparator<String>()
{
+            private boolean isIPv4LiteralAddress(final InetAddress val) {
+                return Inet4Address.class.isInstance(val);
+            }
+
+            private boolean isIPv6LiteralAddress(final InetAddress val) {
+                return Inet6Address.class.isInstance(val);
+            }
 
             @Override
             public int compare(final String h1, final String h2) {
@@ -638,12 +646,21 @@ public class MulticastPulseAgent implements DiscoveryAgent, ServerService,
SelfM
                 //Sort by hostname, IPv4, IPv6
 
                 try {
-                    if (IPAddressUtil.isIPv4LiteralAddress(h1)) {
-                        if (IPAddressUtil.isIPv6LiteralAddress(h2.replace("[", "").replace("]",
""))) {
+                    InetAddress address1 = null;
+                    InetAddress address2 = null;
+                    try {
+                        address1 = InetAddress.getByName(h1);
+                        address2 = InetAddress.getByName(h2);
+                    } catch(final UnknownHostException e) {
+                        // no-op
+                    }
+
+                    if (isIPv4LiteralAddress(address1)) {
+                        if (isIPv6LiteralAddress(address2)) {
                             return -1;
                         }
-                    } else if (IPAddressUtil.isIPv6LiteralAddress(h1.replace("[", "").replace("]",
""))) {
-                        if (IPAddressUtil.isIPv4LiteralAddress(h2)) {
+                    } else if (isIPv6LiteralAddress(address1)) {
+                        if (isIPv4LiteralAddress(address2)) {
                             return 1;
                         }
                     } else if (0 != h1.compareTo(h2)) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/703e9770/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java
----------------------------------------------------------------------
diff --git a/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java
b/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java
index 92147ed..a7ab200 100644
--- a/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java
+++ b/server/openejb-multicast/src/test/java/org/apache/openejb/server/discovery/MulticastPulseAgentTest.java
@@ -21,9 +21,9 @@ import org.apache.openejb.util.NetworkUtil;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import sun.net.util.IPAddressUtil;
 
 import java.net.DatagramPacket;
+import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
@@ -149,17 +149,34 @@ public class MulticastPulseAgentTest {
                 return i;
             }
 
+            private boolean isIPv4LiteralAddress(final InetAddress val) {
+                return Inet4Address.class.isInstance(val);
+            }
+
+            private boolean isIPv6LiteralAddress(final InetAddress val) {
+                return Inet6Address.class.isInstance(val);
+            }
+
             private int compare(final String h1, final String h2) {
 
                 //Sort by hostname, IPv4, IPv6
 
                 try {
-                    if (IPAddressUtil.isIPv4LiteralAddress(h1)) {
-                        if (IPAddressUtil.isIPv6LiteralAddress(h2.replace("[", "").replace("]",
""))) {
+                    InetAddress address1 = null;
+                    InetAddress address2 = null;
+                    try {
+                        address1 = InetAddress.getByName(h1);
+                        address2 = InetAddress.getByName(h2);
+                    } catch(final UnknownHostException e) {
+                        // no-op
+                    }
+
+                    if (isIPv4LiteralAddress(address1)) {
+                        if (isIPv6LiteralAddress(address2)) {
                             return -1;
                         }
-                    } else if (IPAddressUtil.isIPv6LiteralAddress(h1.replace("[", "").replace("]",
""))) {
-                        if (IPAddressUtil.isIPv4LiteralAddress(h2)) {
+                    } else if (isIPv6LiteralAddress(address1)) {
+                        if (isIPv4LiteralAddress(address2)) {
                             return 1;
                         }
                     } else if (0 != h1.compareTo(h2)) {


Mime
View raw message