You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2007/12/20 16:25:39 UTC

svn commit: r605965 - in /tiles/framework/trunk/tiles-core/src: main/java/org/apache/tiles/portlet/context/ main/java/org/apache/tiles/servlet/context/ main/java/org/apache/tiles/util/ test/java/org/apache/tiles/util/

Author: apetrelli
Date: Thu Dec 20 07:25:38 2007
New Revision: 605965

URL: http://svn.apache.org/viewvc?rev=605965&view=rev
Log:
TILES-230
Recovered compatibility with Java 5.

Added:
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/util/TilesIOException.java   (with props)
    tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/TilesIOExceptionTest.java   (with props)
Modified:
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContext.java
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContext.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContext.java?rev=605965&r1=605964&r2=605965&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContext.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContext.java Thu Dec 20 07:25:38 2007
@@ -33,6 +33,7 @@
 import javax.portlet.RenderResponse;
 
 import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.util.TilesIOException;
 
 /**
  * Portlet-based TilesApplicationContext implementation.
@@ -238,8 +239,9 @@
                 context.getRequestDispatcher(path).include((RenderRequest) request,
                     (RenderResponse) response);
             } catch (PortletException e) {
-                throw new IOException("PortletException while including path '"
-                        + path + "'.", e);
+                throw new TilesIOException(
+                        "PortletException while including path '" + path + "'.",
+                        e);
             }
         }
     }

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java?rev=605965&r1=605964&r2=605965&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContext.java Thu Dec 20 07:25:38 2007
@@ -31,6 +31,7 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.util.TilesIOException;
 
 /**
  * Servlet-based implementation of the TilesApplicationContext interface.
@@ -281,9 +282,9 @@
         if (rootCause != null) {
             // Replace the ServletException with an IOException, with the root
             // cause of the first as the cause of the latter.
-            retValue = new IOException(message, rootCause);
+            retValue = new TilesIOException(message, rootCause);
         } else {
-            retValue = new IOException(message, ex);
+            retValue = new TilesIOException(message, ex);
         }
 
         return retValue;

Added: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/util/TilesIOException.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/util/TilesIOException.java?rev=605965&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/util/TilesIOException.java (added)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/util/TilesIOException.java Thu Dec 20 07:25:38 2007
@@ -0,0 +1,68 @@
+/*
+ * $Id$
+ *
+ * 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.tiles.util;
+
+import java.io.IOException;
+
+/**
+ * This exception mimics the {@link IOException} class that is present in Java 6
+ * but not in Java 5. It contains the same number of constructors.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TilesIOException extends IOException {
+
+    /**
+     * Default constructor.
+     */
+    public TilesIOException() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param message Message of the exception.
+     */
+    public TilesIOException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cause The cause of the exception.
+     */
+    public TilesIOException(Throwable cause) {
+        super();
+        this.initCause(cause);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param message Message of the exception.
+     * @param cause The cause of the exception.
+     */
+    public TilesIOException(String message, Throwable cause) {
+        super(message);
+        this.initCause(cause);
+    }
+}

Propchange: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/util/TilesIOException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/util/TilesIOException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/TilesIOExceptionTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/TilesIOExceptionTest.java?rev=605965&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/TilesIOExceptionTest.java (added)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/TilesIOExceptionTest.java Thu Dec 20 07:25:38 2007
@@ -0,0 +1,40 @@
+/*
+ * $Id$
+ *
+ * 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.tiles.util;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the {@link TilesIOException} class.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TilesIOExceptionTest extends TestCase {
+
+    /**
+     * Tests the constructor with the cause.
+     */
+    public void testTilesIOExceptionThrowable() {
+        Exception cause = new Exception("This is the cause");
+        new TilesIOException(cause);
+        // If the test arrives here the test is passed.
+    }
+}

Propchange: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/TilesIOExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/util/TilesIOExceptionTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL