You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by li...@apache.org on 2012/04/13 00:39:07 UTC

[1/2] git commit: Renaming and checkstyle

Updated Branches:
  refs/heads/master b2e7b9086 -> d89f26a7b


Renaming and checkstyle


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

Branch: refs/heads/master
Commit: d89f26a7bc5eba5b9c37d9cb3baf439138a5b581
Parents: f21bf91
Author: Jason Porter <li...@apache.org>
Authored: Thu Apr 12 16:38:30 2012 -0600
Committer: Jason Porter <li...@apache.org>
Committed: Thu Apr 12 16:38:30 2012 -0600

----------------------------------------------------------------------
 .../exception/control/DefaultExceptionEvent.java   |  150 ++++++++++++++
 .../impl/exception/control/ExceptionEventImpl.java |  151 ---------------
 .../control/ExceptionHandlerDispatch.java          |   30 ++--
 .../control/OutboundParameterValueRedefiner.java   |    6 +-
 4 files changed, 168 insertions(+), 169 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/d89f26a7/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/DefaultExceptionEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/DefaultExceptionEvent.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/DefaultExceptionEvent.java
new file mode 100644
index 0000000..f117c8d
--- /dev/null
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/DefaultExceptionEvent.java
@@ -0,0 +1,150 @@
+/*
+ * 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.deltaspike.core.impl.exception.control;
+
+import org.apache.deltaspike.core.api.exception.control.ExceptionHandlingFlow;
+import org.apache.deltaspike.core.api.exception.control.ExceptionStack;
+import org.apache.deltaspike.core.spi.exception.control.IntrospectiveExceptionEvent;
+
+import javax.enterprise.inject.Typed;
+
+/**
+ * Payload for an exception to be handled.  This object is not immutable as small pieces of the state may be set by the
+ * handler.
+ *
+ * @param <T> Exception type this event represents
+ */
+@SuppressWarnings({ "unchecked", "CdiManagedBeanInconsistencyInspection" })
+@Typed()
+public class DefaultExceptionEvent<T extends Throwable> implements IntrospectiveExceptionEvent<T>
+{
+    private final T exception;
+    private boolean unmute;
+    private ExceptionHandlingFlow flow;
+    private Throwable throwNewException;
+    private final boolean beforeTraversal;
+    private final boolean markedHandled;
+
+
+    /**
+     * Initial state constructor.
+     *
+     * @param stack           Information about the current exception and cause chain.
+     * @param beforeTraversal flag indicating the direction of the cause chain traversal
+     * @param handled         flag indicating the exception has already been handled by a previous handler
+     * @throws IllegalArgumentException if stack is null
+     */
+    public DefaultExceptionEvent(final ExceptionStack stack, final boolean beforeTraversal, final boolean handled)
+    {
+        if (stack == null)
+        {
+            throw new IllegalArgumentException("null is not valid for stack");
+        }
+
+        this.exception = (T) stack.getCurrent();
+        this.beforeTraversal = beforeTraversal;
+        this.markedHandled = handled;
+        this.flow = ExceptionHandlingFlow.HANDLED_AND_CONTINUE;
+    }
+
+    @Override
+    public T getException()
+    {
+        return this.exception;
+    }
+
+    @Override
+    public void abort()
+    {
+        this.flow = ExceptionHandlingFlow.ABORT;
+    }
+
+    @Override
+    public void throwOriginal()
+    {
+        this.flow = ExceptionHandlingFlow.THROW_ORIGINAL;
+    }
+
+    @Override
+    public void handled()
+    {
+        this.flow = ExceptionHandlingFlow.HANDLED;
+    }
+
+    @Override
+    public void handledAndContinue()
+    {
+        this.flow = ExceptionHandlingFlow.HANDLED_AND_CONTINUE;
+    }
+
+    @Override
+    public void skipCause()
+    {
+        this.flow = ExceptionHandlingFlow.SKIP_CAUSE;
+    }
+
+    @Override
+    public void unmute()
+    {
+        this.unmute = true;
+    }
+
+    @Override
+    public boolean isUnmute()
+    {
+        return this.unmute;
+    }
+
+    /* Later
+    public ExceptionStack getExceptionStack() {
+    }
+    */
+
+    @Override
+    public ExceptionHandlingFlow getCurrentExceptionHandlingFlow()
+    {
+        return this.flow;
+    }
+
+    @Override
+    public boolean isMarkedHandled()
+    {
+        return this.markedHandled;
+    }
+
+    @Override
+    public boolean isBeforeTraversal()
+    {
+        return beforeTraversal;
+    }
+
+    @Override
+    public void rethrow(Throwable t)
+    {
+        this.throwNewException = t;
+        this.flow = ExceptionHandlingFlow.THROW;
+    }
+
+    @Override
+    public Throwable getThrowNewException()
+    {
+        return this.throwNewException;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/d89f26a7/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionEventImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionEventImpl.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionEventImpl.java
deleted file mode 100644
index 5b8a6f9..0000000
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionEventImpl.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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.deltaspike.core.impl.exception.control;
-
-import org.apache.deltaspike.core.api.exception.control.ExceptionHandlingFlow;
-import org.apache.deltaspike.core.api.exception.control.ExceptionStack;
-import org.apache.deltaspike.core.spi.exception.control.IntrospectiveExceptionEvent;
-
-import javax.enterprise.inject.Typed;
-
-/**
- * Payload for an exception to be handled.  This object is not immutable as small pieces of the state may be set by the
- * handler.
- *
- * @param <T> Exception type this event represents
- */
-@SuppressWarnings({"unchecked", "CdiManagedBeanInconsistencyInspection"})
-@Typed()
-//X TODO discuss an interface to avoid internal methods in the api
-public class ExceptionEventImpl<T extends Throwable> implements IntrospectiveExceptionEvent<T>
-{
-    private final T exception;
-    private boolean unmute;
-    private ExceptionHandlingFlow flow;
-    private Throwable throwNewException;
-    private final boolean beforeTraversal;
-    private final boolean markedHandled;
-
-
-    /**
-     * Initial state constructor.
-     *
-     * @param stack           Information about the current exception and cause chain.
-     * @param beforeTraversal flag indicating the direction of the cause chain traversal
-     * @param handled         flag indicating the exception has already been handled by a previous handler
-     * @throws IllegalArgumentException if stack is null
-     */
-    public ExceptionEventImpl(final ExceptionStack stack, final boolean beforeTraversal, final boolean handled)
-    {
-        if (stack == null)
-        {
-            throw new IllegalArgumentException("null is not valid for stack");
-        }
-
-        this.exception = (T) stack.getCurrent();
-        this.beforeTraversal = beforeTraversal;
-        this.markedHandled = handled;
-        this.flow = ExceptionHandlingFlow.HANDLED_AND_CONTINUE;
-    }
-
-    @Override
-    public T getException()
-    {
-        return this.exception;
-    }
-
-    @Override
-    public void abort()
-    {
-        this.flow = ExceptionHandlingFlow.ABORT;
-    }
-
-    @Override
-    public void throwOriginal()
-    {
-        this.flow = ExceptionHandlingFlow.THROW_ORIGINAL;
-    }
-
-    @Override
-    public void handled()
-    {
-        this.flow = ExceptionHandlingFlow.HANDLED;
-    }
-
-    @Override
-    public void handledAndContinue()
-    {
-        this.flow = ExceptionHandlingFlow.HANDLED_AND_CONTINUE;
-    }
-
-    @Override
-    public void skipCause()
-    {
-        this.flow = ExceptionHandlingFlow.SKIP_CAUSE;
-    }
-
-    @Override
-    public void unmute()
-    {
-        this.unmute = true;
-    }
-
-    @Override
-    public boolean isUnmute()
-    {
-        return this.unmute;
-    }
-
-    /* Later
-    public ExceptionStack getExceptionStack() {
-    }
-    */
-
-    @Override
-    public ExceptionHandlingFlow getCurrentExceptionHandlingFlow()
-    {
-        return this.flow;
-    }
-
-    @Override
-    public boolean isMarkedHandled()
-    {
-        return this.markedHandled;
-    }
-
-    @Override
-    public boolean isBeforeTraversal()
-    {
-        return beforeTraversal;
-    }
-
-    @Override
-    public void rethrow(Throwable t)
-    {
-        this.throwNewException = t;
-        this.flow = ExceptionHandlingFlow.THROW;
-    }
-
-    @Override
-    public Throwable getThrowNewException()
-    {
-        return this.throwNewException;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/d89f26a7/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerDispatch.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerDispatch.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerDispatch.java
index 61d1b70..8700571 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerDispatch.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerDispatch.java
@@ -54,7 +54,7 @@ public class ExceptionHandlerDispatch
      * @param beanManager    active bean manager
      * @throws Throwable If a handler requests the exception to be re-thrown.
      */
-    @SuppressWarnings({"unchecked", "MethodWithMultipleLoops", "ThrowableResultOfMethodCallIgnored"})
+    @SuppressWarnings({ "unchecked", "MethodWithMultipleLoops", "ThrowableResultOfMethodCallIgnored" })
     public void executeHandlers(@Observes @Any ExceptionToCatch exceptionEvent,
                                 final BeanManager beanManager) throws Throwable
     {
@@ -77,35 +77,35 @@ public class ExceptionHandlerDispatch
 
             beanManager.fireEvent(stack); // Allow for modifying the exception stack
 
-            inbound_cause:
+        inbound_cause:
             //indentation needed by the current checkstyle rules
             while (stack.getCurrent() != null)
             {
-                final List<HandlerMethod<?>> breadthFirstHandlerMethods = new ArrayList<HandlerMethod<?>>(
+                final List<HandlerMethod<?>> callbackExceptionEvent = new ArrayList<HandlerMethod<?>>(
                         handlerMethodStorage.getHandlersForException(stack.getCurrent().getClass(),
                                 beanManager, exceptionEvent.getQualifiers(), true));
 
-                for (HandlerMethod<?> handler : breadthFirstHandlerMethods)
+                for (HandlerMethod<?> handler : callbackExceptionEvent)
                 {
                     if (!processedHandlers.contains(handler))
                     {
                         LOG.fine(String.format("Notifying handler %s", handler));
 
                         @SuppressWarnings("rawtypes")
-                        final ExceptionEventImpl breadthFirstEvent = new ExceptionEventImpl(stack, true,
+                        final DefaultExceptionEvent callbackEvent = new DefaultExceptionEvent(stack, true,
                                 exceptionEvent.isHandled());
 
-                        handler.notify(breadthFirstEvent);
+                        handler.notify(callbackEvent);
 
                         LOG.fine(String.format("Handler %s returned status %s", handler,
-                                breadthFirstEvent.getCurrentExceptionHandlingFlow().name()));
+                                callbackEvent.getCurrentExceptionHandlingFlow().name()));
 
-                        if (!breadthFirstEvent.isUnmute())
+                        if (!callbackEvent.isUnmute())
                         {
                             processedHandlers.add(handler);
                         }
 
-                        switch (breadthFirstEvent.getCurrentExceptionHandlingFlow())
+                        switch (callbackEvent.getCurrentExceptionHandlingFlow())
                         {
                             case HANDLED:
                                 exceptionEvent.setHandled(true);
@@ -123,11 +123,11 @@ public class ExceptionHandlerDispatch
                                 throwException = exceptionEvent.getException();
                                 break;
                             case THROW:
-                                throwException = breadthFirstEvent.getThrowNewException();
+                                throwException = callbackEvent.getThrowNewException();
                                 break;
                             default:
                                 throw new IllegalStateException(
-                                        "Unexpected enum type " + breadthFirstEvent.getCurrentExceptionHandlingFlow());
+                                        "Unexpected enum type " + callbackEvent.getCurrentExceptionHandlingFlow());
                         }
                     }
                 }
@@ -136,20 +136,20 @@ public class ExceptionHandlerDispatch
                         handlerMethodStorage.getHandlersForException(stack.getCurrent().getClass(),
                                 beanManager, exceptionEvent.getQualifiers(), false);
 
-                final List<HandlerMethod<? extends Throwable>> depthFirstHandlerMethods =
+                final List<HandlerMethod<? extends Throwable>> handlerMethods =
                         new ArrayList<HandlerMethod<? extends Throwable>>(handlersForException);
 
                 // Reverse these so category handlers are last
-                Collections.reverse(depthFirstHandlerMethods);
+                Collections.reverse(handlerMethods);
 
-                for (HandlerMethod<?> handler : depthFirstHandlerMethods)
+                for (HandlerMethod<?> handler : handlerMethods)
                 {
                     if (!processedHandlers.contains(handler))
                     {
                         LOG.fine(String.format("Notifying handler %s", handler));
 
                         @SuppressWarnings("rawtypes")
-                        final ExceptionEventImpl depthFirstEvent = new ExceptionEventImpl(stack, false,
+                        final DefaultExceptionEvent depthFirstEvent = new DefaultExceptionEvent(stack, false,
                                 exceptionEvent.isHandled());
                         handler.notify(depthFirstEvent);
 

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/d89f26a7/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/OutboundParameterValueRedefiner.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/OutboundParameterValueRedefiner.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/OutboundParameterValueRedefiner.java
index 0467ebb..11780e0 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/OutboundParameterValueRedefiner.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/OutboundParameterValueRedefiner.java
@@ -27,8 +27,8 @@ import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
 
 /**
- * Redefiner allowing to inject a non contextual instance of {@link ExceptionEventImpl} into the first parameter. This
- * class is immutable.
+ * Redefiner allowing to inject a non contextual instance of {@link DefaultExceptionEvent} into the first parameter.
+ * This class is immutable.
  */
 class OutboundParameterValueRedefiner implements ParameterValueRedefiner
 {
@@ -39,7 +39,7 @@ class OutboundParameterValueRedefiner implements ParameterValueRedefiner
     /**
      * Sole constructor.
      *
-     * @param event         instance of ExceptionEventImpl to inject.
+     * @param event         instance of DefaultExceptionEvent to inject.
      * @param handlerMethod Handler method this redefiner is for
      */
     OutboundParameterValueRedefiner(final ExceptionEvent<?> event, final HandlerMethodImpl<?> handlerMethod)