You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2015/11/05 19:39:11 UTC

tomee git commit: Avoid NP

Repository: tomee
Updated Branches:
  refs/heads/master 94a5aeee2 -> eec7ca53e


Avoid NP


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

Branch: refs/heads/master
Commit: eec7ca53e707919532e92eb2af2e18f69fa15a26
Parents: 94a5aee
Author: andygumbrecht@apache.org <an...@gmx.de>
Authored: Thu Nov 5 19:38:48 2015 +0100
Committer: andygumbrecht@apache.org <an...@gmx.de>
Committed: Thu Nov 5 19:38:48 2015 +0100

----------------------------------------------------------------------
 .../openejb/maven/plugin/runner/ExecRunner.java |   2 +-
 .../apache/openejb/server/ejbd/EjbServer.java   | 270 ++++++++++---------
 2 files changed, 145 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/eec7ca53/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java
----------------------------------------------------------------------
diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java
index 92aad49..52132df 100644
--- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java
+++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/runner/ExecRunner.java
@@ -63,7 +63,7 @@ public class ExecRunner {
         final String distrib = config.getProperty("distribution");
         final String workingDir = config.getProperty("workingDir");
         final InputStream distribIs = contextClassLoader.getResourceAsStream(distrib);
-        File distribOutput = new File(workingDir);
+        final File distribOutput = new File(workingDir);
         final File timestampFile = new File(distribOutput, "timestamp.txt");
         final boolean forceDelete = Boolean.getBoolean("tomee.runner.force-delete");
         if (forceDelete

http://git-wip-us.apache.org/repos/asf/tomee/blob/eec7ca53/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
----------------------------------------------------------------------
diff --git a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
index f39319b..da49618 100644
--- a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
+++ b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
@@ -1,126 +1,144 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.openejb.server.ejbd;
-
-import org.apache.openejb.ProxyInfo;
-import org.apache.openejb.core.ServerFederation;
-import org.apache.openejb.server.ServiceException;
-
-import javax.ejb.EJBHome;
-import javax.ejb.EJBMetaData;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.HomeHandle;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.util.Properties;
-
-public class EjbServer implements org.apache.openejb.server.ServerService, org.apache.openejb.spi.ApplicationServer {
-
-    protected KeepAliveServer keepAlive;
-    protected EjbDaemon server;
-
-    public EjbServer() {
-
-    }
-
-    @Override
-    public void init(final Properties props) throws Exception {
-        server = new EjbDaemon();
-        if (props.getProperty("name") == null) { // to let server be component aware
-            props.setProperty("name", getName());
-        }
-        server.init(props);
-        keepAlive = new KeepAliveServer(this, server.isGzip());
-    }
-
-    @Override
-    public void start() throws ServiceException {
-        keepAlive.start();
-    }
-
-    @Override
-    public void stop() throws ServiceException {
-        keepAlive.stop();
-    }
-
-    @Override
-    public String getName() {
-        return "ejbd";
-    }
-
-    @Override
-    public int getPort() {
-        return 0;
-    }
-
-    @Override
-    public void service(final Socket socket) throws ServiceException, IOException {
-        keepAlive.service(socket);
-    }
-
-    @Override
-    public void service(final InputStream inputStream, final OutputStream outputStream) throws ServiceException, IOException {
-
-        ServerFederation.setApplicationServer(server);
-        final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
-
-        try {
-            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-            server.service(inputStream, outputStream);
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldCl);
-        }
-    }
-
-    @Override
-    public String getIP() {
-        return "";
-    }
-
-    @Override
-    public EJBMetaData getEJBMetaData(final ProxyInfo info) {
-        return server.getEJBMetaData(info);
-    }
-
-    @Override
-    public Handle getHandle(final ProxyInfo info) {
-        return server.getHandle(info);
-    }
-
-    @Override
-    public HomeHandle getHomeHandle(final ProxyInfo info) {
-        return server.getHomeHandle(info);
-    }
-
-    @Override
-    public EJBObject getEJBObject(final ProxyInfo info) {
-        return server.getEJBObject(info);
-    }
-
-    @Override
-    public Object getBusinessObject(final ProxyInfo info) {
-        return server.getBusinessObject(info);
-    }
-
-    @Override
-    public EJBHome getEJBHome(final ProxyInfo info) {
-        return server.getEJBHome(info);
-    }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.server.ejbd;
+
+import org.apache.openejb.ProxyInfo;
+import org.apache.openejb.core.ServerFederation;
+import org.apache.openejb.server.ServiceException;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBMetaData;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class EjbServer implements org.apache.openejb.server.ServerService, org.apache.openejb.spi.ApplicationServer {
+
+    protected KeepAliveServer keepAlive;
+    protected EjbDaemon server;
+
+    public EjbServer() {
+
+    }
+
+    @Override
+    public void init(final Properties props) throws Exception {
+        server = new EjbDaemon();
+        if (props.getProperty("name") == null) { // to let server be component aware
+            props.setProperty("name", getName());
+        }
+        server.init(props);
+        keepAlive = new KeepAliveServer(this, server.isGzip());
+    }
+
+    @Override
+    public void start() throws ServiceException {
+        if (null != keepAlive) {
+            keepAlive.start();
+        } else {
+            logNotInitialized();
+        }
+    }
+
+    private void logNotInitialized() {
+        Logger.getLogger(EjbServer.class.getName()).log(Level.WARNING, "EjbServer was not initialized");
+    }
+
+    @Override
+    public void stop() throws ServiceException {
+        if (null != keepAlive) {
+            keepAlive.stop();
+        } else {
+            logNotInitialized();
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "ejbd";
+    }
+
+    @Override
+    public int getPort() {
+        return 0;
+    }
+
+    @Override
+    public void service(final Socket socket) throws ServiceException, IOException {
+        if (null != keepAlive) {
+            keepAlive.service(socket);
+        } else {
+            logNotInitialized();
+        }
+    }
+
+    @Override
+    public void service(final InputStream inputStream, final OutputStream outputStream) throws ServiceException, IOException {
+
+        ServerFederation.setApplicationServer(server);
+        final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+
+        try {
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+            server.service(inputStream, outputStream);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldCl);
+        }
+    }
+
+    @Override
+    public String getIP() {
+        return "";
+    }
+
+    @Override
+    public EJBMetaData getEJBMetaData(final ProxyInfo info) {
+        return server.getEJBMetaData(info);
+    }
+
+    @Override
+    public Handle getHandle(final ProxyInfo info) {
+        return server.getHandle(info);
+    }
+
+    @Override
+    public HomeHandle getHomeHandle(final ProxyInfo info) {
+        return server.getHomeHandle(info);
+    }
+
+    @Override
+    public EJBObject getEJBObject(final ProxyInfo info) {
+        return server.getEJBObject(info);
+    }
+
+    @Override
+    public Object getBusinessObject(final ProxyInfo info) {
+        return server.getBusinessObject(info);
+    }
+
+    @Override
+    public EJBHome getEJBHome(final ProxyInfo info) {
+        return server.getEJBHome(info);
+    }
+}