tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: upgrading jaxb, fixing checkstyle and openejbjar properties sorting
Date Wed, 03 May 2017 20:15:26 GMT
Repository: tomee
Updated Branches:
  refs/heads/master d8d7bc6fd -> 734945cbb


upgrading jaxb, fixing checkstyle and openejbjar properties sorting


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

Branch: refs/heads/master
Commit: 734945cbb78adef477811b6f3d97e246dbedb65d
Parents: d8d7bc6
Author: rmannibucau <rmannibucau@apache.org>
Authored: Wed May 3 22:15:20 2017 +0200
Committer: rmannibucau <rmannibucau@apache.org>
Committed: Wed May 3 22:15:20 2017 +0200

----------------------------------------------------------------------
 .../convert/oej2/simple/openejb-jar.xml         |  4 +-
 .../openejb/jee/oejb3/PropertiesAdapter.java    | 66 ++++++++++++++------
 .../apache/openejb/loader/SystemInstance.java   |  6 --
 pom.xml                                         |  6 +-
 .../server/cxf/transport/util/CxfUtil.java      | 11 ++++
 server/openejb-cxf/pom.xml                      | 14 ++++-
 6 files changed, 76 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/734945cb/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar.xml
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar.xml
b/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar.xml
index 30b77bd..172d4ba 100644
--- a/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar.xml
+++ b/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar.xml
@@ -17,8 +17,8 @@
     </dep:dependencies>
   </dep:environment>
   <properties>
-    module.property.b=valueb
     module.property.a=valuea
+    module.property.b=valueb
   </properties>
   <enterprise-beans>
     <session>
@@ -28,8 +28,8 @@
       <jndi interface="LocalHome" name="loldstyle"/>
       <jndi interface="RemoteHome" name="roldstyle"/>
       <properties>
-        bean.property.b=valueb
         bean.property.a=valuea
+        bean.property.b=valueb
       </properties>
     </session>
   </enterprise-beans>

http://git-wip-us.apache.org/repos/asf/tomee/blob/734945cb/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java
----------------------------------------------------------------------
diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java
b/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java
index 6c40b64..61c7e6a 100644
--- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java
+++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java
@@ -19,7 +19,11 @@ package org.apache.openejb.jee.oejb3;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -30,7 +34,7 @@ import java.util.TreeSet;
  */
 public class PropertiesAdapter extends XmlAdapter<String, Properties> {
     public Properties unmarshal(final String s) throws Exception {
-        final Properties properties = new Properties();
+        final Properties properties = new SortedProperties();
         final ByteArrayInputStream in = new ByteArrayInputStream(s.getBytes());
         properties.load(in);
         return properties;
@@ -40,27 +44,51 @@ public class PropertiesAdapter extends XmlAdapter<String, Properties>
{
         if (properties == null) return null;
 
         final ByteArrayOutputStream out = new ByteArrayOutputStream();
-        new Properties() { // sort entries as before java 9, todo: decide if we want to sort
it like that or if we just stop from being deterministic there
-            {
-                putAll(properties);
-            }
-
-            @Override
-            public Set<Map.Entry<Object, Object>> entrySet() {
-                final Set<Map.Entry<Object, Object>> entrySet = super.entrySet();
-                final Set<Map.Entry<Object, Object>> entries = new TreeSet<>(new
Comparator<Map.Entry<Object, Object>>() {
-                    @Override
-                    public int compare(final Map.Entry<Object, Object> o1, final Map.Entry<Object,
Object> o2) {
-                        return String.valueOf(o1.getKey()).compareTo(String.valueOf(o2.getKey()));
-                    }
-                });
-                entries.addAll(entrySet);
-                return entries;
-            }
-        }.store(out, null);
+        (!SortedProperties.class.isInstance(properties) ? new SortedProperties(properties)
: properties).store(out, null);
 
         // First comment is added by properties.store()
         final String string = new String(out.toByteArray());
         return string.replaceFirst("#.*?" + System.lineSeparator(), "");
     }
+
+    // sort entries as before java 9, todo: decide if we want to sort it like that or if
we just stop from being deterministic there
+    private static class SortedProperties extends Properties {
+        private SortedProperties() {
+            super();
+        }
+
+        private SortedProperties(final Properties copy) {
+            putAll(copy);
+        }
+
+        @Override
+        public Set<String> stringPropertyNames() {
+            return new TreeSet<>(super.stringPropertyNames());
+        }
+
+        @Override
+        public Enumeration<Object> keys() {
+            final List<Object> list = new ArrayList<>(Collections.list(super.keys()));
+            Collections.sort(list, new Comparator<Object>() {
+                @Override
+                public int compare(final Object o1, final Object o2) {
+                    return String.valueOf(o1).compareTo(String.valueOf(o2));
+                }
+            });
+            return Collections.enumeration(list);
+        }
+
+        @Override
+        public Set<Map.Entry<Object, Object>> entrySet() {
+            final Set<Map.Entry<Object, Object>> entrySet = super.entrySet();
+            final Set<Map.Entry<Object, Object>> entries = new TreeSet<>(new
Comparator<Map.Entry<Object, Object>>() {
+                @Override
+                public int compare(final Map.Entry<Object, Object> o1, final Map.Entry<Object,
Object> o2) {
+                    return String.valueOf(o1.getKey()).compareTo(String.valueOf(o2.getKey()));
+                }
+            });
+            entries.addAll(entrySet);
+            return entries;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/tomee/blob/734945cb/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
index ee94e4f..1474c43 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
@@ -21,19 +21,13 @@ import org.apache.openejb.loader.event.ComponentRemoved;
 import org.apache.openejb.loader.provisining.ProvisioningResolver;
 import org.apache.openejb.observer.ObserverManager;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicReference;
 
-import static java.util.Arrays.asList;
-
 /**
  * This class aims to be the one and only static in the entire system
  * A static, singleton, instance of this class can be created with the {@link #init(Properties)}
method

http://git-wip-us.apache.org/repos/asf/tomee/blob/734945cb/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e29831c..1949ee4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1678,17 +1678,17 @@
       <dependency>
         <groupId>javax.xml.bind</groupId>
         <artifactId>jaxb-api</artifactId>
-        <version>2.2.11</version>
+        <version>2.3.0-b170201.1204</version>
       </dependency>
       <dependency>
         <groupId>com.sun.xml.bind</groupId>
         <artifactId>jaxb-impl</artifactId>
-        <version>2.2.11</version>
+        <version>2.3.0-b170127.1453</version>
       </dependency>
       <dependency>
         <groupId>com.sun.xml.bind</groupId>
         <artifactId>jaxb-core</artifactId>
-        <version>2.2.11</version>
+        <version>2.3.0-b170127.1453</version>
       </dependency>
     </dependencies>
   </dependencyManagement>

http://git-wip-us.apache.org/repos/asf/tomee/blob/734945cb/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java
b/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java
index c40f3ed..f7e1d03 100644
--- a/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java
+++ b/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java
@@ -33,6 +33,7 @@ import org.apache.cxf.management.InstrumentationManager;
 import org.apache.cxf.management.counters.CounterRepository;
 import org.apache.cxf.management.jmx.InstrumentationManagerImpl;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.http.CXFAuthenticator;
 import org.apache.cxf.transport.http.HttpDestinationFactory;
 import org.apache.openejb.OpenEJBRuntimeException;
 import org.apache.openejb.assembler.classic.OpenEjbConfiguration;
@@ -124,12 +125,22 @@ public final class CxfUtil {
 
             SystemInstance.get().addObserver(new LifecycleManager());
 
+            initAuthenticators();
+
             return bus; // we keep as internal the real bus and just expose to cxf the client
aware bus to be able to cast it easily
         } finally {
             Thread.currentThread().setContextClassLoader(cl);
         }
     }
 
+    private static void initAuthenticators() { // TODO: drop when we get a fully supporting
java 9 version of CXF
+        try {
+            CXFAuthenticator.addAuthenticator();
+        } catch (final RuntimeException re) {
+            // we swallow it while cxf doesnt support java 9, this workaround is enough to
make most of cases passing
+        }
+    }
+
     public static Bus getBus() {
         Bus bus = DEFAULT_BUS.get();
         if (bus == null) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/734945cb/server/openejb-cxf/pom.xml
----------------------------------------------------------------------
diff --git a/server/openejb-cxf/pom.xml b/server/openejb-cxf/pom.xml
index 6d2ec19..9e9df9f 100644
--- a/server/openejb-cxf/pom.xml
+++ b/server/openejb-cxf/pom.xml
@@ -117,6 +117,18 @@
       <artifactId>slf4j-api</artifactId>
     </dependency>
     <dependency>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jaxb-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.xml.bind</groupId>
+      <artifactId>jaxb-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.xml.bind</groupId>
+      <artifactId>jaxb-core</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-frontend-jaxws</artifactId>
       <version>${cxf.version}</version>
@@ -157,7 +169,7 @@
     <dependency>
       <groupId>com.sun.xml.messaging.saaj</groupId>
       <artifactId>saaj-impl</artifactId>
-      <version>1.3.23</version>
+      <version>1.4.0-b03</version>
     </dependency>
     <!-- This is required on IBM JDKs (and potentially others) because saaj-impl depends
          on Sun's internal copy of Xerces. See OPENEJB-1126. -->


Mime
View raw message