cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r446917 - in /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location: Locatable.java LocatableException.java LocatedException.java LocatedRuntimeException.java Location.java LocationImpl.java MultiLocatable.java
Date Sat, 16 Sep 2006 19:10:41 GMT
Author: vgritsenko
Date: Sat Sep 16 12:10:40 2006
New Revision: 446917

URL: http://svn.apache.org/viewvc?view=rev&rev=446917
Log:
whitespace

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Locatable.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatableException.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedException.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedRuntimeException.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Location.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocationImpl.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/MultiLocatable.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Locatable.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Locatable.java?view=diff&rev=446917&r1=446916&r2=446917
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Locatable.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Locatable.java Sat
Sep 16 12:10:40 2006
@@ -5,9 +5,9 @@
  * 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.
@@ -19,14 +19,15 @@
 /**
  * A interface that should be implemented by objects knowning their location (i.e. where
they
  * have been created from).
- * 
+ *
  * @since 2.1.8
  * @version $Id$
  */
 public interface Locatable {
+
     /**
      * Get the location of this object
-     * 
+     *
      * @return the location
      */
     Location getLocation();

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatableException.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatableException.java?view=diff&rev=446917&r1=446916&r2=446917
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatableException.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatableException.java
Sat Sep 16 12:10:40 2006
@@ -5,9 +5,9 @@
  * 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.
@@ -26,17 +26,17 @@
  * and location separately. This interface gives access to the raw message.
  * <p>
  * <strong>Note:</strong> care should be taken for locatable exceptions to use
only immutable and
- * serializable implementations of {@link Location} 
+ * serializable implementations of {@link Location}
  * @see org.apache.cocoon.util.location.LocationImpl#get(Location)
- * 
+ *
  * @since 2.1.8
  * @version $Id$
  */
 public interface LocatableException extends Locatable {
-    
+
     /**
      * Get the raw message of the exception (the one used in the constructor)
-     * 
+     *
      * @return the raw message
      */
     public String getRawMessage();

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedException.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedException.java?view=diff&rev=446917&r1=446916&r2=446917
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedException.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedException.java
Sat Sep 16 12:10:40 2006
@@ -70,8 +70,9 @@
      * used to print stacktraces.
      */
     public static void ensureCauseChainIsSet(Throwable thr) {
-        if (INIT_CAUSE_METHOD == null)
+        if (INIT_CAUSE_METHOD == null) {
             return;
+        }
 
         // Loop either until null or encountering exceptions that use this method.
         while (thr != null && !(thr instanceof LocatedRuntimeException) &&
!(thr instanceof LocatedException)) {
@@ -106,6 +107,7 @@
             // Locatable handles its location itself
             return;
         }
+
         // Add parent location first
         addCauseLocations(self, ExceptionUtils.getCause(cause));
         // then ourselve's
@@ -123,7 +125,7 @@
     }
 
     public Location getLocation() {
-        return locations == null ? null : (Location)locations.get(0);
+        return locations == null ? null : (Location) locations.get(0);
     }
 
     public List getLocations() {
@@ -161,8 +163,9 @@
     }
 
     public void addLocation(Location loc) {
-        if (LocationUtils.isUnknown(loc))
+        if (LocationUtils.isUnknown(loc)) {
             return;
+        }
 
         if (locations == null) {
             this.locations = new ArrayList(1); // Start small

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedRuntimeException.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedRuntimeException.java?view=diff&rev=446917&r1=446916&r2=446917
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedRuntimeException.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocatedRuntimeException.java
Sat Sep 16 12:10:40 2006
@@ -5,9 +5,9 @@
  * 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.
@@ -30,32 +30,35 @@
  * <code>LocatedRuntimeException</code>, then the default behavior is to add
the location to the cause
  * exception and immediately rethrow the cause. This avoids exception nesting and builds
a location
  * stack.
- * 
+ *
  * @since 2.1.8
  * @version $Id$
  */
-public class LocatedRuntimeException extends NestableRuntimeException implements LocatableException,
MultiLocatable {
-    
+public class LocatedRuntimeException extends NestableRuntimeException
+                                     implements LocatableException, MultiLocatable {
+
     private List locations;
 
     public LocatedRuntimeException(String message) {
         this(message, null, null, true);
     }
-    
-    public LocatedRuntimeException(String message, Throwable cause) throws LocatedRuntimeException
{
+
+    public LocatedRuntimeException(String message, Throwable cause)
+    throws LocatedRuntimeException {
         this(message, cause, null, true);
     }
-    
+
     public LocatedRuntimeException(String message, Location location) {
         this(message, null, location, true);
     }
-    
-    public LocatedRuntimeException(String message, Throwable cause, Location location) throws
LocatedRuntimeException {
+
+    public LocatedRuntimeException(String message, Throwable cause, Location location)
+    throws LocatedRuntimeException {
         this(message, cause, location, true);
     }
 
     public LocatedRuntimeException(String message, Throwable cause, Location location, boolean
rethrowLocated)
-        throws LocatedRuntimeException {
+    throws LocatedRuntimeException {
         super(message, cause);
         if (rethrowLocated && cause instanceof LocatedRuntimeException) {
             LocatedRuntimeException lreCause = (LocatedRuntimeException)cause;
@@ -70,7 +73,7 @@
     }
 
     public Location getLocation() {
-        return locations == null ? null : (Location)locations.get(0);
+        return locations == null ? null : (Location) locations.get(0);
     }
 
     public List getLocations() {
@@ -84,10 +87,11 @@
     public String getMessage() {
         return LocatedException.getMessage(super.getMessage(), locations);
     }
-    
+
     public void addLocation(Location loc) {
-        if (LocationUtils.isUnknown(loc))
+        if (LocationUtils.isUnknown(loc)) {
             return;
+        }
 
         if (locations == null) {
             this.locations = new ArrayList(1); // Start small

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Location.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Location.java?view=diff&rev=446917&r1=446916&r2=446917
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Location.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/Location.java Sat
Sep 16 12:10:40 2006
@@ -5,9 +5,9 @@
  * 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.
@@ -18,44 +18,44 @@
 
 
 /**
- * A location in a resource. The location is composed of the URI of the resource, and 
+ * A location in a resource. The location is composed of the URI of the resource, and
  * the line and column numbers within that resource (when available), along with a description.
  * <p>
  * Locations are mostly provided by {@link Locatable}s objects.
- * 
+ *
  * @since 2.1.8
  * @version $Id$
  */
 public interface Location {
-    
+
     /**
      * Constant for unknown locations.
      */
     public static final Location UNKNOWN = LocationImpl.UNKNOWN;
-    
+
     /**
      * Get the description of this location
-     * 
+     *
      * @return the description (can be <code>null</code>)
      */
     public String getDescription();
-    
+
     /**
      * Get the URI of this location
-     * 
+     *
      * @return the URI (<code>null</code> if unknown).
      */
     public String getURI();
     /**
      * Get the line number of this location
-     * 
+     *
      * @return the line number (<code>-1</code> if unknown)
      */
     public int getLineNumber();
-    
+
     /**
      * Get the column number of this location
-     * 
+     *
      * @return the column number (<code>-1</code> if unknown)
      */
     public int getColumnNumber();

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocationImpl.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocationImpl.java?view=diff&rev=446917&r1=446916&r2=446917
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocationImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/LocationImpl.java
Sat Sep 16 12:10:40 2006
@@ -5,9 +5,9 @@
  * 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.
@@ -22,22 +22,23 @@
 
 /**
  * A simple immutable and serializable implementation of {@link Location}.
- * 
+ *
  * @since 2.1.8
  * @version $Id$
  */
 public class LocationImpl implements Location, Serializable {
+
+    // Package private: outside this package, use Location.UNKNOWN.
+    static final LocationImpl UNKNOWN = new LocationImpl(null, null, -1, -1);
+
     private final String uri;
     private final int line;
     private final int column;
     private final String description;
-    
-    // Package private: outside this package, use Location.UNKNOWN.
-    static final LocationImpl UNKNOWN = new LocationImpl(null, null, -1, -1);
 
     /**
      * Build a location for a given URI, with unknown line and column numbers.
-     * 
+     *
      * @param uri the resource URI
      */
     public LocationImpl(String description, String uri) {
@@ -46,7 +47,7 @@
 
     /**
      * Build a location for a given URI and line and columb numbers.
-     * 
+     *
      * @param uri the resource URI
      * @param line the line number (starts at 1)
      * @param column the column number (starts at 1)
@@ -61,36 +62,36 @@
             this.line = line;
             this.column = column;
         }
-        
+
         if (description != null && description.length() == 0) {
             description = null;
         }
         this.description = description;
     }
-    
+
     /**
      * Copy constructor.
-     * 
+     *
      * @param location the location to be copied
      */
     public LocationImpl(Location location) {
         this(location.getDescription(), location.getURI(), location.getLineNumber(), location.getColumnNumber());
     }
-    
+
     /**
      * Create a location from an existing one, but with a different description
      */
     public LocationImpl(String description, Location location) {
         this(description, location.getURI(), location.getLineNumber(), location.getColumnNumber());
     }
-    
+
     /**
      * Obtain a <code>LocationImpl</code> from a {@link Location}. If <code>location</code>
is
      * already a <code>LocationImpl</code>, it is returned, otherwise it is copied.
      * <p>
      * This method is useful when an immutable and serializable location is needed, such
as in locatable
      * exceptions.
-     * 
+     *
      * @param location the location
      * @return an immutable and serializable version of <code>location</code>
      */
@@ -103,19 +104,19 @@
             return new LocationImpl(location);
         }
     }
-    
+
     /**
      * Get the description of this location
-     * 
+     *
      * @return the description (can be <code>null</code>)
      */
     public String getDescription() {
         return this.description;
     }
-    
+
     /**
      * Get the URI of this location
-     * 
+     *
      * @return the URI (<code>null</code> if unknown).
      */
     public String getURI() {
@@ -124,16 +125,16 @@
 
     /**
      * Get the line number of this location
-     * 
+     *
      * @return the line number (<code>-1</code> if unknown)
      */
     public int getLineNumber() {
         return this.line;
     }
-    
+
     /**
      * Get the column number of this location
-     * 
+     *
      * @return the column number (<code>-1</code> if unknown)
      */
     public int getColumnNumber() {
@@ -146,27 +147,28 @@
         }
 
         if (obj instanceof Location) {
-            Location other = (Location)obj;
-            return this.line == other.getLineNumber() && this.column == other.getColumnNumber()
-                   && ObjectUtils.equals(this.uri, other.getURI())
-                   && ObjectUtils.equals(this.description, other.getDescription());
+            Location other = (Location) obj;
+            return this.line == other.getLineNumber() &&
+                    this.column == other.getColumnNumber() &&
+                    ObjectUtils.equals(this.uri, other.getURI()) &&
+                    ObjectUtils.equals(this.description, other.getDescription());
         }
-        
+
         return false;
     }
-    
+
     public int hashCode() {
         int hash = line ^ column;
         if (uri != null) hash ^= uri.hashCode();
         if (description != null) hash ^= description.hashCode();
-        
+
         return hash;
     }
-    
+
     public String toString() {
         return LocationUtils.toString(this);
     }
-    
+
     /**
      * Ensure serialized unknown location resolve to {@link Location#UNKNOWN}.
      */

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/MultiLocatable.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/MultiLocatable.java?view=diff&rev=446917&r1=446916&r2=446917
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/MultiLocatable.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/util/location/MultiLocatable.java
Sat Sep 16 12:10:40 2006
@@ -28,26 +28,26 @@
  * If the list of locations designates a call stack, then its first element should be the
deepmost
  * location of this stack. This is consistent with the need for <code>getLocation()</code>
to
  * return the most precise location.
- * 
+ *
  * @since 2.1.8
  * @version $Id$
  */
 public interface MultiLocatable extends Locatable {
-    
+
     /**
      * Return the list of locations.
-     * 
+     *
      * @return a list of locations, possibly empty but never null.
      */
     public List getLocations();
-    
+
     /**
      * Add a location to the current list of locations.
      * <p>
      * Implementations are free to filter locations that can be added (e.g. {@link Location#UNKNOWN}),
      * and there is therefore no guarantee that the given location will actually be added
to the list.
      * Filtered locations are silently ignored.
-     * 
+     *
      * @param location the location to be added.
      */
     public void addLocation(Location location);



Mime
View raw message