You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/03/11 21:55:35 UTC

svn commit: r385164 [23/32] - in /jakarta/tapestry/trunk: ./ .settings/ annotations/src/java/org/apache/tapestry/annotations/ annotations/src/test/org/apache/tapestry/annotations/ config/ contrib/src/documentation/content/xdocs/tapestry-contrib/Compone...

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/IdAllocator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/IdAllocator.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/IdAllocator.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/IdAllocator.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -35,7 +35,6 @@
 
     private final String _namespace;
 
-    /** Generates unique names with a particular prefix. */
     private static class NameGenerator
     {
         private final String _baseId;

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java Sat Mar 11 12:54:27 2006
@@ -185,9 +185,9 @@
     /**
      * Writes a single large JavaScript block containing:
      * <ul>
-     * <li>Any image initializations (via {@link #getPreloadedImageReference(String)})
-     * <li>Any included scripts (via {@link #addExternalScript(Resource)})
-     * <li>Any contributions (via {@link #addBodyScript(String)})
+     * <li>Any image initializations (via {@link #getPreloadedImageReference(String)}).
+     * <li>Any included scripts (via {@link #addExternalScript(Resource)}).
+     * <li>Any contributions (via {@link #addBodyScript(String)}).
      * </ul>
      * 
      * @see #writeInitializationScript(IMarkupWriter)
@@ -250,4 +250,4 @@
     {
         return buffer != null && buffer.length() > 0;
     }
-}
\ No newline at end of file
+}

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/UtilMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/UtilMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/UtilMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/UtilMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,30 +14,23 @@
 
 package org.apache.tapestry.util;
 
-import org.apache.hivemind.Messages;
 import org.apache.hivemind.impl.MessageFormatter;
 
 /**
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-final class UtilMessages
+class UtilMessages
 {
-
-    private static final Messages MESSAGES = new MessageFormatter(UtilMessages.class);
-
-    /** @since 4.1 */
-    private UtilMessages()
-    {
-    }
+    private static final MessageFormatter _formatter = new MessageFormatter(UtilMessages.class);
 
     static String valueNotFound(Object value)
     {
-        return MESSAGES.format("value-not-found", value);
+        return _formatter.format("value-not-found", value);
     }
 
     static String keyAlreadyExists(Object key)
     {
-        return MESSAGES.format("key-already-exists", key);
+        return _formatter.format("key-already-exists", key);
     }
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/exception/ExceptionAnalyzer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/exception/ExceptionAnalyzer.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/exception/ExceptionAnalyzer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/exception/ExceptionAnalyzer.java Sat Mar 11 12:54:27 2006
@@ -29,15 +29,13 @@
 import java.util.List;
 
 /**
- * Analyzes an exception, creating one or more {@link ExceptionDescription}s
- * from it.
+ * Analyzes an exception, creating one or more {@link ExceptionDescription}s from it.
  * 
  * @author Howard Lewis Ship
  */
 
 public class ExceptionAnalyzer
 {
-
     private final List exceptionDescriptions = new ArrayList();
 
     private final List propertyDescriptions = new ArrayList();
@@ -47,8 +45,8 @@
     private boolean exhaustive = false;
 
     /**
-     * If true, then stack trace is extracted for each exception. If false, the
-     * default, then stack trace is extracted for only the deepest exception.
+     * If true, then stack trace is extracted for each exception. If false, the default, then stack
+     * trace is extracted for only the deepest exception.
      */
 
     public boolean isExhaustive()
@@ -62,21 +60,20 @@
     }
 
     /**
-     * Analyzes the exceptions. This builds an {@link ExceptionDescription}for
-     * the exception. It also looks for a non-null {@link Throwable}property.
-     * If one exists, then a second {@link ExceptionDescription}is created.
-     * This continues until no more nested exceptions can be found.
+     * Analyzes the exceptions. This builds an {@link ExceptionDescription}for the exception. It
+     * also looks for a non-null {@link Throwable}property. If one exists, then a second
+     * {@link ExceptionDescription}is created. This continues until no more nested exceptions can
+     * be found.
      * <p>
-     * The description includes a set of name/value properties (as
-     * {@link ExceptionProperty}) object. This list contains all non-null
-     * properties that are not, themselves, {@link Throwable}.
+     * The description includes a set of name/value properties (as {@link ExceptionProperty})
+     * object. This list contains all non-null properties that are not, themselves,
+     * {@link Throwable}.
      * <p>
-     * The name is the display name (not the logical name) of the property. The
-     * value is the <code>toString()</code> value of the property. Only
-     * properties defined in subclasses of {@link Throwable}are included.
+     * The name is the display name (not the logical name) of the property. The value is the
+     * <code>toString()</code> value of the property. Only properties defined in subclasses of
+     * {@link Throwable}are included.
      * <p>
-     * A future enhancement will be to alphabetically sort the properties by
-     * name.
+     * A future enhancement will be to alphabetically sort the properties by name.
      */
 
     public ExceptionDescription[] analyze(Throwable exception)
@@ -84,14 +81,14 @@
         try
         {
 
-            while(exception != null)
+            while (exception != null)
             {
                 exception = buildDescription(exception);
             }
 
             ExceptionDescription[] result = new ExceptionDescription[exceptionDescriptions.size()];
 
-            return (ExceptionDescription[])exceptionDescriptions.toArray(result);
+            return (ExceptionDescription[]) exceptionDescriptions.toArray(result);
         }
         finally
         {
@@ -138,12 +135,13 @@
 
         descriptors = info.getPropertyDescriptors();
 
-        for(i = 0; i < descriptors.length; i++)
+        for (i = 0; i < descriptors.length; i++)
         {
             descriptor = descriptors[i];
 
             method = descriptor.getReadMethod();
-            if (method == null) continue;
+            if (method == null)
+                continue;
 
             try
             {
@@ -154,12 +152,14 @@
                 continue;
             }
 
-            if (value == null) continue;
+            if (value == null)
+                continue;
 
             // Some annoying exceptions duplicate the message property
             // (I'm talking to YOU SAXParseException), so just edit that out.
 
-            if (message != null && message.equals(value)) continue;
+            if (message != null && message.equals(value))
+                continue;
 
             // Skip Throwables ... but the first non-null
             // found is the next exception. We kind of count
@@ -168,14 +168,16 @@
 
             if (value instanceof Throwable)
             {
-                if (next == null) next = (Throwable)value;
+                if (next == null)
+                    next = (Throwable) value;
 
                 continue;
             }
 
             stringValue = value.toString().trim();
 
-            if (stringValue.length() == 0) continue;
+            if (stringValue.length() == 0)
+                continue;
 
             property = new ExceptionProperty(descriptor.getDisplayName(), value);
 
@@ -185,15 +187,18 @@
         // If exhaustive, or in the deepest exception (where there's no next)
         // the extract the stack trace.
 
-        if (next == null || exhaustive) stackTrace = getStackTrace(exception);
+        if (next == null || exhaustive)
+            stackTrace = getStackTrace(exception);
 
         // Would be nice to sort the properties here.
 
         properties = new ExceptionProperty[propertyDescriptions.size()];
 
-        ExceptionProperty[] propArray = (ExceptionProperty[])propertyDescriptions.toArray(properties);
+        ExceptionProperty[] propArray = (ExceptionProperty[]) propertyDescriptions
+                .toArray(properties);
 
-        description = new ExceptionDescription(exceptionClass.getName(), message, propArray, stackTrace);
+        description = new ExceptionDescription(exceptionClass.getName(), message, propArray,
+                stackTrace);
 
         exceptionDescriptions.add(description);
 
@@ -201,19 +206,16 @@
     }
 
     /**
-     * Gets the stack trace for the exception, and converts it into an array of
-     * strings.
+     * Gets the stack trace for the exception, and converts it into an array of strings.
      * <p>
      * This involves parsing the string generated indirectly from
-     * <code>Throwable.printStackTrace(PrintWriter)</code>. This method can
-     * get confused if the message (presumably, the first line emitted by
-     * printStackTrace()) spans multiple lines.
+     * <code>Throwable.printStackTrace(PrintWriter)</code>. This method can get confused if the
+     * message (presumably, the first line emitted by printStackTrace()) spans multiple lines.
      * <p>
      * Different JVMs format the exception in different ways.
      * <p>
-     * A possible expansion would be more flexibility in defining the pattern
-     * used. Hopefully all 'mainstream' JVMs are close enough for this to
-     * continue working.
+     * A possible expansion would be more flexibility in defining the pattern used. Hopefully all
+     * 'mainstream' JVMs are close enough for this to continue working.
      */
 
     protected String[] getStackTrace(Throwable exception)
@@ -230,8 +232,7 @@
 
         writer.reset();
 
-        // OK, the trick is to convert the full trace into an array of stack
-        // frames.
+        // OK, the trick is to convert the full trace into an array of stack frames.
 
         StringReader stringReader = new StringReader(fullTrace);
         LineNumberReader lineReader = new LineNumberReader(stringReader);
@@ -240,15 +241,17 @@
 
         try
         {
-            while(true)
+            while (true)
             {
                 String line = lineReader.readLine();
 
-                if (line == null) break;
+                if (line == null)
+                    break;
 
                 // Always ignore the first line.
 
-                if (++lineNumber == 1) continue;
+                if (++lineNumber == 1)
+                    continue;
 
                 frames.add(stripFrame(line));
             }
@@ -263,7 +266,7 @@
 
         String result[] = new String[frames.size()];
 
-        return (String[])frames.toArray(result);
+        return (String[]) frames.toArray(result);
     }
 
     private static final int SKIP_LEADING_WHITESPACE = 0;
@@ -273,8 +276,8 @@
     private static final int SKIP_OTHER_WHITESPACE = 2;
 
     /**
-     * Sun's JVM prefixes each line in the stack trace with " <tab>at ", other
-     * JVMs don't. This method looks for and strips such stuff.
+     * Sun's JVM prefixes each line in the stack trace with " <tab>at ", other JVMs don't. This
+     * method looks for and strips such stuff.
      */
 
     private String stripFrame(String frame)
@@ -285,76 +288,76 @@
         int state = SKIP_LEADING_WHITESPACE;
         boolean more = true;
 
-        while(more)
+        while (more)
         {
             // Ran out of characters to skip? Return the empty string.
 
-            if (i == array.length) return "";
+            if (i == array.length)
+                return "";
 
             char ch = array[i];
 
-            switch(state)
+            switch (state)
             {
-            // Ignore whitespace at the start of the line.
+                // Ignore whitespace at the start of the line.
 
-            case SKIP_LEADING_WHITESPACE:
+                case SKIP_LEADING_WHITESPACE:
 
-                if (Character.isWhitespace(ch))
-                {
-                    i++;
-                    continue;
-                }
+                    if (Character.isWhitespace(ch))
+                    {
+                        i++;
+                        continue;
+                    }
 
-                if (ch == 'a')
-                {
-                    state = SKIP_T;
-                    i++;
-                    continue;
-                }
+                    if (ch == 'a')
+                    {
+                        state = SKIP_T;
+                        i++;
+                        continue;
+                    }
 
-                // Found non-whitespace, not 'a'
-                more = false;
-                break;
+                    // Found non-whitespace, not 'a'
+                    more = false;
+                    break;
 
-            // Skip over the 't' after an 'a'
+                // Skip over the 't' after an 'a'
 
-            case SKIP_T:
+                case SKIP_T:
 
-                if (ch == 't')
-                {
-                    state = SKIP_OTHER_WHITESPACE;
-                    i++;
-                    continue;
-                }
+                    if (ch == 't')
+                    {
+                        state = SKIP_OTHER_WHITESPACE;
+                        i++;
+                        continue;
+                    }
 
-                // Back out the skipped-over 'a'
+                    // Back out the skipped-over 'a'
 
-                i--;
-                more = false;
-                break;
+                    i--;
+                    more = false;
+                    break;
 
-            // Skip whitespace between 'at' and the name of the class
+                // Skip whitespace between 'at' and the name of the class
 
-            case SKIP_OTHER_WHITESPACE:
-
-                if (Character.isWhitespace(ch))
-                {
-                    i++;
-                    continue;
-                }
+                case SKIP_OTHER_WHITESPACE:
 
-                // Not whitespace
-                more = false;
+                    if (Character.isWhitespace(ch))
+                    {
+                        i++;
+                        continue;
+                    }
 
-            default:
-                break;
+                    // Not whitespace
+                    more = false;
+                    break;
             }
 
         }
 
         // Found nothing to strip out.
 
-        if (i == 0) return frame;
+        if (i == 0)
+            return frame;
 
         return frame.substring(i);
     }
@@ -374,17 +377,19 @@
 
         descriptions = analyze(exception);
 
-        for(i = 0; i < descriptions.length; i++)
+        for (i = 0; i < descriptions.length; i++)
         {
             message = descriptions[i].getMessage();
 
             if (message == null)
                 stream.println(descriptions[i].getExceptionClassName());
-            else stream.println(descriptions[i].getExceptionClassName() + ": " + descriptions[i].getMessage());
+            else
+                stream.println(descriptions[i].getExceptionClassName() + ": "
+                        + descriptions[i].getMessage());
 
             properties = descriptions[i].getProperties();
 
-            for(j = 0; j < properties.length; j++)
+            for (j = 0; j < properties.length; j++)
                 stream.println("   " + properties[j].getName() + ": " + properties[j].getValue());
 
             // Just show the stack trace on the deepest exception.
@@ -393,11 +398,12 @@
             {
                 stackTrace = descriptions[i].getStackTrace();
 
-                for(j = 0; j < stackTrace.length; j++)
+                for (j = 0; j < stackTrace.length; j++)
                     stream.println(stackTrace[j]);
             }
-            else stream.println();
+            else
+                stream.println();
         }
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/BinaryDumpOutputStream.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/BinaryDumpOutputStream.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/BinaryDumpOutputStream.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/BinaryDumpOutputStream.java Sat Mar 11 12:54:27 2006
@@ -30,18 +30,15 @@
 
 public class BinaryDumpOutputStream extends OutputStream
 {
-    private static final char[] HEX =
-    { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
-    
-    private PrintWriter _out;
+    private PrintWriter out;
 
     private boolean locked = false;
 
-    private boolean _showOffset = true;
+    private boolean showOffset = true;
 
     private int bytesPerLine = 16;
 
-    private int _spacingInterval = 4;
+    private int spacingInterval = 4;
 
     private char substituteChar = '.';
 
@@ -61,6 +58,9 @@
 
     private String asciiEnd = "|";
 
+    private static final char[] HEX =
+    { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
     /**
      * Creates a <code>PrintWriter</code> for <code>System.out</code>.
      */
@@ -72,25 +72,25 @@
 
     public BinaryDumpOutputStream(PrintWriter out)
     {
-        this._out = out;
+        this.out = out;
     }
 
     public BinaryDumpOutputStream(Writer out)
     {
-        this._out = new PrintWriter(out);
+        this.out = new PrintWriter(out);
     }
 
     public void close() throws IOException
     {
-        if (_out != null)
+        if (out != null)
         {
             if (lineCount > 0)
                 finishFinalLine();
 
-            _out.close();
+            out.close();
         }
 
-        _out = null;
+        out = null;
     }
 
     private void finishFinalLine()
@@ -103,15 +103,15 @@
         {
             // After every <n> bytes, emit a space.
 
-            if (_spacingInterval > 0 && bytesSinceSpace == _spacingInterval)
+            if (spacingInterval > 0 && bytesSinceSpace == spacingInterval)
             {
-                _out.print(' ');
+                out.print(' ');
                 bytesSinceSpace = 0;
             }
 
             // Two spaces to substitute for the two hex digits.
 
-            _out.print("  ");
+            out.print("  ");
 
             if (showAscii)
                 ascii[lineCount] = ' ';
@@ -122,12 +122,12 @@
 
         if (showAscii)
         {
-            _out.print(asciiBegin);
-            _out.print(ascii);
-            _out.print(asciiEnd);
+            out.print(asciiBegin);
+            out.print(ascii);
+            out.print(asciiEnd);
         }
 
-        _out.println();
+        out.println();
     }
 
     /**
@@ -136,7 +136,7 @@
 
     public void flush() throws IOException
     {
-        _out.flush();
+        out.flush();
     }
 
     public String getAsciiBegin()
@@ -239,29 +239,29 @@
         {
             if (showAscii)
             {
-                _out.print(asciiBegin);
-                _out.print(ascii);
-                _out.print(asciiEnd);
+                out.print(asciiBegin);
+                out.print(ascii);
+                out.print(asciiEnd);
             }
 
-            _out.println();
+            out.println();
 
             bytesSinceSpace = 0;
             lineCount = 0;
             offset += bytesPerLine;
         }
 
-        if (lineCount == 0 && _showOffset)
+        if (lineCount == 0 && showOffset)
         {
             writeHex(offset, 4);
-            _out.print(offsetSeperator);
+            out.print(offsetSeperator);
         }
 
         // After every <n> bytes, emit a space.
 
-        if (_spacingInterval > 0 && bytesSinceSpace == _spacingInterval)
+        if (spacingInterval > 0 && bytesSinceSpace == spacingInterval)
         {
-            _out.print(' ');
+            out.print(' ');
             bytesSinceSpace = 0;
         }
 
@@ -290,27 +290,27 @@
         {
             nybble = (value >> 4 * (digits - i - 1)) & 0x0f;
 
-            _out.print(HEX[nybble]);
+            out.print(HEX[nybble]);
         }
     }
 
     public void setSpacingInterval(int spacingInterval)
     {
-        this._spacingInterval = spacingInterval;
+        this.spacingInterval = spacingInterval;
     }
 
     public boolean isShowOffset()
     {
-        return _showOffset;
+        return showOffset;
     }
 
     public void setShowOffset(boolean showOffset)
     {
-        this._showOffset = showOffset;
+        this.showOffset = showOffset;
     }
 
     public int getSpacingInterval()
     {
-        return _spacingInterval;
+        return spacingInterval;
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/BooleanAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/BooleanAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/BooleanAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/BooleanAdaptor.java Sat Mar 11 12:54:27 2006
@@ -62,4 +62,4 @@
         return Boolean.FALSE;
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ByteAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ByteAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ByteAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ByteAdaptor.java Sat Mar 11 12:54:27 2006
@@ -55,4 +55,4 @@
         return new Byte(string.substring(1));
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ComponentAddressAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ComponentAddressAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ComponentAddressAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ComponentAddressAdaptor.java Sat Mar 11 12:54:27 2006
@@ -69,4 +69,4 @@
         return new ComponentAddress(pageName, idPath);
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DataSqueezerImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DataSqueezerImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DataSqueezerImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DataSqueezerImpl.java Sat Mar 11 12:54:27 2006
@@ -212,4 +212,4 @@
 
         return buffer.toString();
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DataSqueezerUtil.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DataSqueezerUtil.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DataSqueezerUtil.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DataSqueezerUtil.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -24,17 +24,11 @@
  * @author Howard Lewis Ship
  * @since 4.0
  */
-public final class DataSqueezerUtil
+public class DataSqueezerUtil
 {
 
-    /** @since 4.1 */
-    private DataSqueezerUtil()
-    {
-    }
-
     /**
-     * Returns a data squeezer with a set of basic adaptors, ready to be used by
-     * JUnit-tests.
+     * Returns a data squeezer with a set of basic adaptors, ready to be used by JUnit-tests.
      */
     public static DataSqueezerImpl createUnitTestSqueezer(ClassResolver resolver)
     {
@@ -60,8 +54,7 @@
     }
 
     /**
-     * Returns a data squeezer with a set of basic adaptors, ready to be used by
-     * JUnit-tests.
+     * Returns a data squeezer with a set of basic adaptors, ready to be used by JUnit-tests.
      */
 
     public static DataSqueezerImpl createUnitTestSqueezer()

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DoubleAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DoubleAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DoubleAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/DoubleAdaptor.java Sat Mar 11 12:54:27 2006
@@ -55,4 +55,4 @@
         return new Double(string.substring(1));
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/FloatAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/FloatAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/FloatAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/FloatAdaptor.java Sat Mar 11 12:54:27 2006
@@ -55,4 +55,4 @@
         return new Float(string.substring(1));
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IntegerAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IntegerAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IntegerAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IntegerAdaptor.java Sat Mar 11 12:54:27 2006
@@ -54,4 +54,4 @@
         return new Integer(string);
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IoMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IoMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IoMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IoMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,32 +14,19 @@
 
 package org.apache.tapestry.util.io;
 
-import org.apache.hivemind.Messages;
 import org.apache.hivemind.impl.MessageFormatter;
 
-/**
- * Messages for this package.
- * 
- * @author Howard M. Lewis Ship
- * @since 4.0
- */
-final class IoMessages
+class IoMessages
 {
-
-    private static final Messages MESSAGES = new MessageFormatter(IoMessages.class);
-
-    /** @since 4.1 */
-    private IoMessages()
-    {
-    }
+    private static final MessageFormatter _formatter = new MessageFormatter(IoMessages.class);
 
     static String encodeFailure(Object object, Throwable cause)
     {
-        return MESSAGES.format("encode-failure", object, cause);
+        return _formatter.format("encode-failure", object, cause);
     }
 
     static String decodeFailure(Throwable cause)
     {
-        return MESSAGES.format("decode-failure", cause);
+        return _formatter.format("decode-failure", cause);
     }
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IoStrings.properties
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IoStrings.properties?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IoStrings.properties (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/IoStrings.properties Sat Mar 11 12:54:27 2006
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-encode-failure=Unable to encode object {0}: {1}
+encode-failure=Unable to encode object {0}: {1}. This is sometimes caused when classes being \
+serialized to a stream don't implement java.io.Serializable.
 decode-failure=Unable to decode stream: {0}

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/LongAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/LongAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/LongAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/LongAdaptor.java Sat Mar 11 12:54:27 2006
@@ -55,4 +55,4 @@
         return new Long(string.substring(1));
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ResolvingObjectInputStream.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ResolvingObjectInputStream.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ResolvingObjectInputStream.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ResolvingObjectInputStream.java Sat Mar 11 12:54:27 2006
@@ -52,4 +52,4 @@
     {
         return _resolver.findClass(v.getName());
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/SerializableAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/SerializableAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/SerializableAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/SerializableAdaptor.java Sat Mar 11 12:54:27 2006
@@ -40,6 +40,8 @@
 
 public class SerializableAdaptor implements SqueezeAdaptor
 {
+    private ClassResolver _resolver;
+
     private static final char BYTESTREAM_PREFIX = 'O';
 
     private static final char GZIP_BYTESTREAM_PREFIX = 'Z';
@@ -49,8 +51,6 @@
 
     private static final String PREFIX = "OZ";
 
-    private ClassResolver _resolver;
-    
     public String getPrefix()
     {
         return PREFIX;
@@ -133,4 +133,4 @@
         _resolver = resolver;
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ShortAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ShortAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ShortAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/ShortAdaptor.java Sat Mar 11 12:54:27 2006
@@ -55,4 +55,4 @@
         return new Short(string.substring(1));
     }
 
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/SqueezeAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/SqueezeAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/SqueezeAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/SqueezeAdaptor.java Sat Mar 11 12:54:27 2006
@@ -32,13 +32,13 @@
      * Returns one or more characters, each of which will be a prefix for this adaptor.
      */
 
-    String getPrefix();
+    public String getPrefix();
 
     /**
      * Returns the class (or interface) which can be encoded by this adaptor.
      */
 
-    Class getDataClass();
+    public Class getDataClass();
 
     /**
      * Converts the data object into a String.
@@ -47,7 +47,7 @@
      *             if the object can't be converted.
      */
 
-    String squeeze(DataSqueezer squeezer, Object data);
+    public String squeeze(DataSqueezer squeezer, Object data);
 
     /**
      * Converts a String back into an appropriate object.
@@ -56,5 +56,5 @@
      *             if the String can't be converted.
      */
 
-    Object unsqueeze(DataSqueezer squeezer, String string);
+    public Object unsqueeze(DataSqueezer squeezer, String string);
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/StringAdaptor.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/StringAdaptor.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/StringAdaptor.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/StringAdaptor.java Sat Mar 11 12:54:27 2006
@@ -55,4 +55,4 @@
 
         return string.substring(1);
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/TeeOutputStream.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/TeeOutputStream.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/TeeOutputStream.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/io/TeeOutputStream.java Sat Mar 11 12:54:27 2006
@@ -69,4 +69,4 @@
         _os1.write(b);
         _os2.write(b);
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/AsciiCharacterTranslator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/AsciiCharacterTranslator.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/AsciiCharacterTranslator.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/AsciiCharacterTranslator.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -22,44 +22,43 @@
  */
 public class AsciiCharacterTranslator implements ICharacterTranslator
 {
-
-    private String[] _charMap;
-
-    /**
-     * Creates and initializes a new translator that translates the provided
-     * ASCII characters into strings. All other characters will be translated to
-     * null.
-     * 
-     * @param characterMap
-     *            an array of pairs of strings. Each pair consists of a key that
-     *            must be a single ASCII character, and a value that is its
-     *            equivalent string.
-     */
-    public AsciiCharacterTranslator(String[][] characterMap)
-    {
-        _charMap = new String[128];
-
-        int pairCount = characterMap.length;
-        for(int i = 0; i < pairCount; i++)
-        {
-            String[] pair = characterMap[i];
-            if (pair.length != 2) continue;
-            String key = pair[0];
-            String value = pair[1];
-            if (key.length() != 1) continue;
-            char ch = key.charAt(0);
-            if (ch >= 128) continue;
-
-            _charMap[ch] = value;
-        }
-    }
-
-    /**
-     * @see org.apache.tapestry.util.text.ICharacterTranslator#translate(char)
-     */
-    public String translate(char ch)
-    {
-        if (ch >= 128) return null;
-        return _charMap[ch];
-    }
+	private String[] _charMap;
+	
+	/**
+	 * Creates and initializes a new translator that translates the provided 
+	 * ASCII characters into strings. All other characters will be translated to null.
+	 * 
+	 * @param characterMap an array of pairs of strings. 
+	 *        Each pair consists of a key that must be a single ASCII character, 
+	 *        and a value that is its equivalent string. 
+	 */
+	public AsciiCharacterTranslator(String[][] characterMap)
+	{
+		_charMap = new String[128];
+		
+		int pairCount = characterMap.length;
+		for (int i = 0; i < pairCount; i++) {
+			String[] pair = characterMap[i];
+			if (pair.length != 2)
+				continue;
+			String key = pair[0];
+			String value = pair[1];
+			if (key.length() != 1)
+				continue;
+			char ch = key.charAt(0);
+			if (ch >= 128)
+				continue;
+			
+			_charMap[ch] = value;
+		}
+	}
+	
+	/**
+	 * @see org.apache.tapestry.util.text.ICharacterTranslator#translate(char)
+	 */
+	public String translate(char ch) {
+		if (ch >= 128)
+			return null;
+		return _charMap[ch];
+	}
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/DefaultCharacterTranslatorSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/DefaultCharacterTranslatorSource.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/DefaultCharacterTranslatorSource.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/DefaultCharacterTranslatorSource.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -18,55 +18,51 @@
 import java.util.Map;
 
 /**
- * The default implementation of a character translator source. Returns a
- * standard HTML translator that encodes everything that is non-safe or an HTML
- * translator that encodes only non-safe ASCII symbols if the encoding is a
- * unicode one.
+ * The default implementation of a character translator source.
+ * Returns a standard HTML translator that encodes everything that is non-safe
+ * or an HTML translator that encodes only non-safe ASCII symbols 
+ * if the encoding is a unicode one. 
  * 
  * @author mb
  * @since 4.0
  */
 public class DefaultCharacterTranslatorSource implements ICharacterTranslatorSource
 {
+	private static final ICharacterTranslator DEFAULT_TRANSLATOR = new MarkupCharacterTranslator();
+	private static final ICharacterTranslator UNICODE_TRANSLATOR = new MarkupCharacterTranslator(false);
 
-    private static final ICharacterTranslator DEFAULT_TRANSLATOR = new MarkupCharacterTranslator();
-    private static final ICharacterTranslator UNICODE_TRANSLATOR = new MarkupCharacterTranslator(false);
-
-    private final static Map _translators;
-
-    static
-    {
-        _translators = new HashMap();
-        _translators.put("UTF-8", UNICODE_TRANSLATOR);
-        _translators.put("UTF-7", UNICODE_TRANSLATOR);
-        _translators.put("UTF-16", UNICODE_TRANSLATOR);
-        _translators.put("UTF-16BE", UNICODE_TRANSLATOR);
-        _translators.put("UTF-16LE", UNICODE_TRANSLATOR);
-    }
-
-    /**
-     * Returns a translator that encodes all non-safe characters into their HTML
-     * equivalents.
-     * 
-     * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getDefaultTranslator()
-     */
-    public ICharacterTranslator getDefaultTranslator()
-    {
-        return DEFAULT_TRANSLATOR;
-    }
-
-    /**
-     * If the encoding is a Unicode one, returns a translator that encodes only
-     * the non-safe ASCII characters and leaves the others untouched. Otherwise,
-     * returns the default translator.
-     * 
-     * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getTranslator(java.lang.String)
-     */
-    public ICharacterTranslator getTranslator(String encoding)
-    {
-        ICharacterTranslator translator = (ICharacterTranslator)_translators.get(encoding.toUpperCase());
-        if (translator != null) return translator;
-        return getDefaultTranslator();
-    }
-
+	private final static Map _translators;
+	
+	static {
+		_translators = new HashMap();
+		_translators.put("UTF-8", UNICODE_TRANSLATOR);
+		_translators.put("UTF-7", UNICODE_TRANSLATOR);
+		_translators.put("UTF-16", UNICODE_TRANSLATOR);
+		_translators.put("UTF-16BE", UNICODE_TRANSLATOR);
+		_translators.put("UTF-16LE", UNICODE_TRANSLATOR);
+	}
+	
+	/**
+	 * Returns a translator that encodes all non-safe characters into their HTML equivalents.
+	 * 
+	 * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getDefaultTranslator()
+	 */
+	public ICharacterTranslator getDefaultTranslator() {
+		return DEFAULT_TRANSLATOR;
+	}
+
+	/**
+	 * If the encoding is a Unicode one, returns a translator that encodes only the 
+	 * non-safe ASCII characters and leaves the others untouched.
+	 * Otherwise, returns the default translator.
+	 * 
+	 * @see org.apache.tapestry.util.text.ICharacterTranslatorSource#getTranslator(java.lang.String)
+	 */
+	public ICharacterTranslator getTranslator(String encoding) {
+		ICharacterTranslator translator = (ICharacterTranslator) _translators.get(encoding.toUpperCase());
+		if (translator != null)
+			return translator;
+		return getDefaultTranslator();
+	}
+	
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/ICharacterTranslator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/ICharacterTranslator.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/ICharacterTranslator.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/ICharacterTranslator.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -20,17 +20,15 @@
  * @author mb
  * @since 4.0
  */
-public interface ICharacterTranslator
+public interface ICharacterTranslator 
 {
-
-    /**
-     * Translates the provided character into a string
-     * 
-     * @param ch
-     *            the character to be translated
-     * @return null if the character is not to be translated, an empty string if
-     *         the character is to be ignored, or another string to represent
-     *         the character translation
-     */
-    String translate(char ch);
+	/**
+	 * Translates the provided character into a string 
+	 * 
+	 * @param ch the character to be translated
+	 * @return null if the character is not to be translated,
+	 * an empty string if the character is to be ignored, 
+	 * or another string to represent the character translation
+	 */
+	String translate(char ch);
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/ICharacterTranslatorSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/ICharacterTranslatorSource.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/ICharacterTranslatorSource.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/ICharacterTranslatorSource.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -20,10 +20,8 @@
  * @author mb
  * @since 4.0
  */
-public interface ICharacterTranslatorSource
+public interface ICharacterTranslatorSource 
 {
-
-    ICharacterTranslator getDefaultTranslator();
-
-    ICharacterTranslator getTranslator(String encoding);
+	ICharacterTranslator getDefaultTranslator();
+	ICharacterTranslator getTranslator(String encoding);
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/LocalizedProperties.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/LocalizedProperties.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/LocalizedProperties.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/LocalizedProperties.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -23,22 +23,22 @@
 
 /**
  * A version of java.util.Properties that can read the properties from files
- * using an encoding other than ISO-8859-1. All non-latin characters are read
- * correctly using the given encoding and no longer need to be quoted using
- * native2ascii. In addition, the properties may be stored in an arbitrary map,
- * rather than only in Properties. For example, using LinkedHashMap will
- * preserve the order of the properties as defined in the file.
+ * using an encoding other than ISO-8859-1. All non-latin characters are read 
+ * correctly using the given encoding and no longer need to be quoted using native2ascii.
+ * 
+ * In addition, the properties may be stored in an arbitrary map, rather than
+ * only in Properties. For example, using LinkedHashMap will preserve the order
+ * of the properties as defined in the file. 
  * 
  * @author mb
  * @since 4.0
  */
 public class LocalizedProperties
 {
-
     private Map _propertyMap;
-
+    
     /**
-     * Create a new object with an empty property storage
+     * Create a new object with an empty property storage 
      */
     public LocalizedProperties()
     {
@@ -46,70 +46,63 @@
     }
 
     /**
-     * Use the provided argument as the storage location for the properties
-     * managed by this object. This allows different types of Map
-     * implementations to be used, such as a LinkedHashMap to preserve the order
-     * of the keys, for example. The provided map may contain the default
-     * property values as well.
+     * Use the provided argument as the storage location for the properties managed
+     * by this object. This allows different types of Map implementations to be used,
+     * such as a LinkedHashMap to preserve the order of the keys, for example.
+     * The provided map may contain the default property values as well.
      * 
-     * @param propertyMap
-     *            the map where properties are to be stored
+     * @param propertyMap the map where properties are to be stored
      */
     public LocalizedProperties(Map propertyMap)
     {
         _propertyMap = propertyMap;
     }
-
+    
     /**
-     * Returns the property value corresponding the provided key. If there is no
-     * such property, or the value in the provided map is not of type String,
-     * null is returned.
+     * Returns the property value corresponding the provided key. If there is no such property,
+     * or the value in the provided map is not of type String, null is returned.
      * 
-     * @param key
-     *            the property key
+     * @param key the property key
      * @return the value of the property, or null if there is no such property
      */
     public String getProperty(String key)
     {
-        Object value = _propertyMap.get(key);
-        if (value instanceof String) return (String)value;
-        return null;
-    }
-
-    /**
-     * Returns the property value corresponding to the provided key, or the
-     * provided default value if no such property exists.
-     * 
-     * @param key
-     *            the property key
-     * @param defaultValue
-     *            the default value of the property
-     * @return the value of the property, or the default value if there is no
-     *         such property
+       Object value = _propertyMap.get(key);
+       if (value instanceof String)
+           return (String) value;
+       return null;
+    }
+    
+    /**
+     * Returns the property value corresponding to the provided key, 
+     * or the provided default value if no such property exists.
+     * 
+     * @param key the property key
+     * @param defaultValue the default value of the property
+     * @return the value of the property, or the default value if there is no such property
      */
     public String getProperty(String key, String defaultValue)
     {
         String value = getProperty(key);
-        if (value != null) return value;
+        if (value != null)
+            return value;
         return defaultValue;
     }
-
+    
     /**
      * Stores a property value
      * 
-     * @param key
-     *            the property key
-     * @param value
-     *            the property value
+     * @param key the property key
+     * @param value the property value
      */
     public void setProperty(String key, String value)
     {
         _propertyMap.put(key, value);
     }
-
+    
     /**
-     * Returns the map containing all properties. The map can be used to
-     * enumerate the properties or their keys.
+     * Returns the map containing all properties. The map can be used to enumerate the 
+     * properties or their keys. 
      * 
      * @return a map containing the properties
      */
@@ -117,54 +110,47 @@
     {
         return _propertyMap;
     }
-
+    
     /**
-     * Loads the properties from the given stream using the default character
-     * encoding. This method operates in the same way as the equivalent method
-     * in {@link java.util.Properties}, but it also handles non-ascii symbols.
+     * Loads the properties from the given stream using the default character encoding.
+     * This method operates in the same way as the equivalent method in {@link java.util.Properties},
+     * but it also handles non-ascii symbols. 
      * 
-     * @param ins
-     *            the stream to load the properties from
+     * @param ins the stream to load the properties from
      * @throws IOException
      */
-    public void load(InputStream ins)
-        throws IOException
+    public void load(InputStream ins) throws IOException
     {
-        LocalizedPropertiesLoader loader = new LocalizedPropertiesLoader(ins);
+    	LocalizedPropertiesLoader loader = new LocalizedPropertiesLoader(ins);
         loader.load(_propertyMap);
     }
-
+    
     /**
-     * Loads the properties from the given stream using the provided character
-     * encoding. This method operates in the same way as the equivalent method
-     * in {@link java.util.Properties}, but it also handles non-ascii symbols.
-     * 
-     * @param ins
-     *            the stream to load the properties from
-     * @param encoding
-     *            the encoding the use when parsing the stream
+     * Loads the properties from the given stream using the provided character encoding.
+     * This method operates in the same way as the equivalent method in {@link java.util.Properties},
+     * but it also handles non-ascii symbols. 
+     * 
+     * @param ins the stream to load the properties from
+     * @param encoding the encoding the use when parsing the stream
      * @throws IOException
      */
-    public void load(InputStream ins, String encoding)
-        throws UnsupportedEncodingException, IOException
+    public void load(InputStream ins, String encoding) throws UnsupportedEncodingException, IOException
     {
-        LocalizedPropertiesLoader loader = new LocalizedPropertiesLoader(ins, encoding);
+    	LocalizedPropertiesLoader loader = new LocalizedPropertiesLoader(ins, encoding);
         loader.load(_propertyMap);
     }
-
+    
     /**
-     * Loads the properties from the given reader. This method operates in the
-     * same way as the equivalent method in {@link java.util.Properties}, but
-     * it also handles non-ascii symbols.
+     * Loads the properties from the given reader.
+     * This method operates in the same way as the equivalent method in {@link java.util.Properties},
+     * but it also handles non-ascii symbols. 
      * 
-     * @param reader
-     *            the reader to load the properties from
+     * @param reader the reader to load the properties from
      * @throws IOException
      */
-    public void load(Reader reader)
-        throws IOException
+    public void load(Reader reader) throws IOException
     {
-        LocalizedPropertiesLoader loader = new LocalizedPropertiesLoader(reader);
+    	LocalizedPropertiesLoader loader = new LocalizedPropertiesLoader(reader);
         loader.load(_propertyMap);
     }
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/LocalizedPropertiesLoader.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/LocalizedPropertiesLoader.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/LocalizedPropertiesLoader.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/LocalizedPropertiesLoader.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -23,222 +23,198 @@
 import java.util.Map;
 
 /**
- * An object that loads a properties file from the provided input stream or
- * reader. This class reads the property file exactly like java.util.Properties,
+ * An object that loads a properties file from the provided input stream or reader.
+ * This class reads the property file exactly like java.util.Properties,
  * except that it also allows the files to use an encoding other than ISO-8859-1
- * and all non-ASCII characters are read correctly using the given encoding. In
- * short, non-latin characters no longer need to be quoted using native2ascii.
+ * and all non-ASCII characters are read correctly using the given encoding.
+ * In short, non-latin characters no longer need to be quoted using native2ascii.
  * 
  * @author mb
  * @since 4.0
  */
 public class LocalizedPropertiesLoader
 {
-
     private static final String HEX_DIGITS = "0123456789ABCDEF";
-
+    
     private static final ICharacterMatcher WHITESPACE = new WhitespaceMatcher(false);
     private static final ICharacterMatcher LINE_SEPARATOR = new AsciiCharacterMatcher("\n\r");
     private static final ICharacterMatcher NOT_LINE_SEPARATOR = new InverseMatcher(LINE_SEPARATOR);
     private static final ICharacterMatcher KEY_VALUE_SEPARATOR = new AsciiCharacterMatcher("=:");
     private static final ICharacterMatcher SEPARATOR = new AsciiCharacterMatcher("=:\r\n");
     private static final ICharacterMatcher COMMENT = new AsciiCharacterMatcher("#!");
-    private static final ICharacterMatcher WHITESPACE_OR_SEPARATOR = new CompoundMatcher(new ICharacterMatcher[] {
-            WHITESPACE, SEPARATOR });
+    private static final ICharacterMatcher WHITESPACE_OR_SEPARATOR = 
+        new CompoundMatcher(new ICharacterMatcher[] { WHITESPACE, SEPARATOR });
 
     private ExtendedReader _extendedReader;
-
+    
     /**
-     * Creates a new loader that will load the properties from the given input
-     * stream using the default character encoding
+     * Creates a new loader that will load the properties from the given input stream
+     * using the default character encoding
      * 
-     * @param ins
-     *            the input stream to load the properties from
+     * @param ins the input stream to load the properties from
      */
     public LocalizedPropertiesLoader(InputStream ins)
     {
         this(new InputStreamReader(ins));
     }
-
+    
     /**
-     * Creates a new loader that will load the properties from the given input
-     * stream using the provided character encoding
+     * Creates a new loader that will load the properties from the given input stream
+     * using the provided character encoding
      * 
-     * @param ins
-     *            the input stream to load the properties from
-     * @param encoding
-     *            the character encoding the be used when reading from the
-     *            stream
-     * @throws UnsupportedEncodingException
-     *             if the name of the encoding cannot be recognized
+     * @param ins the input stream to load the properties from
+     * @param encoding the character encoding the be used when reading from the stream
+     * @throws UnsupportedEncodingException if the name of the encoding cannot be recognized
      */
-    public LocalizedPropertiesLoader(InputStream ins, String encoding)
-        throws UnsupportedEncodingException
+    public LocalizedPropertiesLoader(InputStream ins, String encoding) throws UnsupportedEncodingException
     {
         this(new InputStreamReader(ins, encoding));
     }
-
+    
     /**
      * Creates a new loader that will load the properties from the given reader
      * 
-     * @param reader
-     *            the Reader to load the properties from
+     * @param reader the Reader to load the properties from
      */
     public LocalizedPropertiesLoader(Reader reader)
     {
         _extendedReader = new ExtendedReader(new BufferedReader(reader));
     }
-
+    
     /**
-     * Read the properties from the provided stream and store them into the
-     * given map
+     * Read the properties from the provided stream and store them into the given map
      * 
-     * @param properties
-     *            the map where the properties will be stored
-     * @throws IOException
-     *             if an error occurs
+     * @param properties the map where the properties will be stored
+     * @throws IOException if an error occurs
      */
-    public void load(Map properties)
-        throws IOException
+    public void load(Map properties) throws IOException
     {
-        while(!isAtEndOfStream())
-        {
-            // we are at the beginning of a line.
-            // check whether it is a comment and if it is, skip it
+        while (!isAtEndOfStream()) {
+        	// we are at the beginning of a line.
+        	// check whether it is a comment and if it is, skip it
             int nextChar = _extendedReader.peek();
-            if (COMMENT.matches((char)nextChar))
-            {
+            if (COMMENT.matches((char) nextChar)) {
                 _extendedReader.skipCharacters(NOT_LINE_SEPARATOR);
                 continue;
             }
-
+            
             _extendedReader.skipCharacters(WHITESPACE);
-            if (!isAtEndOfLine())
-            {
-                // this line does not consist only of whitespace. the next word
-                // is the key
+            if (!isAtEndOfLine()) {
+            	// this line does not consist only of whitespace. the next word is the key
                 String key = readQuotedLine(WHITESPACE_OR_SEPARATOR);
                 _extendedReader.skipCharacters(WHITESPACE);
-
-                // if the next char is a key-value separator, read it and skip
-                // the following spaces
+                
+                // if the next char is a key-value separator, read it and skip the following spaces
                 nextChar = _extendedReader.peek();
-                if (nextChar > 0 && KEY_VALUE_SEPARATOR.matches((char)nextChar))
-                {
+                if (nextChar > 0 && KEY_VALUE_SEPARATOR.matches((char) nextChar)) {
                     _extendedReader.read();
                     _extendedReader.skipCharacters(WHITESPACE);
                 }
 
                 // finally, read the value
                 String value = readQuotedLine(LINE_SEPARATOR);
-
+                
                 properties.put(key, value);
             }
             _extendedReader.skipCharacters(LINE_SEPARATOR);
         }
     }
-
-    private boolean isAtEndOfStream()
-        throws IOException
+    
+    
+    private boolean isAtEndOfStream() throws IOException
     {
         int nextChar = _extendedReader.peek();
         return (nextChar < 0);
     }
-
-    private boolean isAtEndOfLine()
-        throws IOException
+    
+    
+    private boolean isAtEndOfLine() throws IOException
     {
         int nextChar = _extendedReader.peek();
-        if (nextChar < 0) return true;
-        return LINE_SEPARATOR.matches((char)nextChar);
-    }
-
-    private String readQuotedLine(ICharacterMatcher terminators)
-        throws IOException
+        if (nextChar < 0)
+            return true;
+        return LINE_SEPARATOR.matches((char) nextChar);
+    }
+    
+    
+    private String readQuotedLine(ICharacterMatcher terminators) throws IOException
     {
         StringBuffer buf = new StringBuffer();
-
-        while(true)
-        {
+        
+        while (true) {
             // see what the next char is
             int nextChar = _extendedReader.peek();
-
+            
             // if at end of stream or the char is one of the terminators, stop
-            if (nextChar < 0 || terminators.matches((char)nextChar)) break;
+            if (nextChar < 0 || terminators.matches((char) nextChar))
+                break;
 
-            try
-            {
+            try {
                 // read the char (and possibly unquote it)
                 char ch = readQuotedChar();
                 buf.append(ch);
-            }
-            catch (IgnoreCharacterException e)
-            {
+            } catch (IgnoreCharacterException e) {
                 // simply ignore -- no character was read
             }
         }
-
+        
         return buf.toString();
     }
+    
 
-    private char readQuotedChar()
-        throws IOException, IgnoreCharacterException
+    private char readQuotedChar() throws IOException, IgnoreCharacterException
     {
         int nextChar = _extendedReader.read();
-        if (nextChar < 0) throw new IgnoreCharacterException();
-        char ch = (char)nextChar;
-
+        if (nextChar < 0)
+            throw new IgnoreCharacterException();
+        char ch = (char) nextChar;
+        
         // if the char is not the quotation char, simply return it
-        if (ch != '\\') return ch;
+        if (ch != '\\') 
+            return ch;
 
         // the character is a quotation character. unquote it
         nextChar = _extendedReader.read();
 
         // if at the end of the stream, stop
-        if (nextChar < 0) throw new IgnoreCharacterException();
-
-        ch = (char)nextChar;
-        switch(ch)
-        {
-        case 'u':
-            char res = 0;
-            for(int i = 0; i < 4; i++)
-            {
-                nextChar = _extendedReader.read();
-                if (nextChar < 0) throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
-                char digitChar = (char)nextChar;
-                int digit = HEX_DIGITS.indexOf(Character.toUpperCase(digitChar));
-                if (digit < 0) throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
-                res = (char)(res * 16 + digit);
-            }
-            return res;
-
-        case '\r':
-            // if the next char is \n, read it and fall through
-            nextChar = _extendedReader.peek();
-            if (nextChar == '\n') _extendedReader.read();
-        case '\n':
-            _extendedReader.skipCharacters(WHITESPACE);
+        if (nextChar < 0)
             throw new IgnoreCharacterException();
+        
+        ch = (char) nextChar;
+        switch (ch) {
+            case 'u' :
+                char res = 0;
+                for (int i = 0; i < 4; i++) {
+                    nextChar = _extendedReader.read();
+                    if (nextChar < 0)
+                        throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
+                    char digitChar = (char) nextChar;
+                    int digit = HEX_DIGITS.indexOf(Character.toUpperCase(digitChar));
+                    if (digit < 0)
+                        throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
+                    res = (char) (res * 16 + digit);
+                }
+                return res;
 
-        case 't':
-            return '\t';
-        case 'n':
-            return '\n';
-        case 'r':
-            return '\r';
-        default:
-            return ch;
+            case '\r' :
+                // if the next char is \n, read it and fall through
+                nextChar = _extendedReader.peek();
+                if (nextChar == '\n')
+                    _extendedReader.read();
+            case '\n' :
+                _extendedReader.skipCharacters(WHITESPACE);
+                throw new IgnoreCharacterException();
+                
+            case 't' :  return '\t';
+            case 'n' :  return '\n';
+            case 'r' :  return '\r';
+            default:    return ch;
         }
     }
+    
 
-    /**
-     * Exception thrown (blech) as a control flow mechanism when an ignorable
-     * character is found.
-     */
-    private static class IgnoreCharacterException extends Exception
+    private static class IgnoreCharacterException extends Exception 
     {
-
-        private static final long serialVersionUID = 8366308710256427596L;
-    }
+		private static final long serialVersionUID = 8366308710256427596L;
+    }    
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/MarkupCharacterTranslator.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/MarkupCharacterTranslator.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/MarkupCharacterTranslator.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/MarkupCharacterTranslator.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -15,69 +15,77 @@
 package org.apache.tapestry.util.text;
 
 /**
- * An object that encodes a character according to rules of the HTML
- * specification, so that it will be properly parsed by a browser irrespectively
- * of the character encoding used in the HTML output.
+ * An object that encodes a character according to rules of the HTML specification, 
+ * so that it will be properly parsed by a browser irrespectively of the character
+ * encoding used in the HTML output.
  * 
  * @author mb
  * @since 4.0
  */
 public class MarkupCharacterTranslator implements ICharacterTranslator
 {
-
-    private static final String SAFE_CHARACTERS = "01234567890abcdefghijklmnopqrstuvwxyz"
-            + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "\t\n\r !#$%'()*+,-./:;=?@[\\]^_`{|}~";
-
-    private static final String[][] ENTITIES = { { "\"", "&quot;" }, { "<", "&lt;" }, { ">", "&gt;" }, { "&", "&amp;" } };
-
+    private static final String SAFE_CHARACTERS =
+        "01234567890"
+            + "abcdefghijklmnopqrstuvwxyz"
+            + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+            + "\t\n\r !#$%'()*+,-./:;=?@[\\]^_`{|}~";
+
+    private static final String[][] ENTITIES = {
+    	{ "\"", "&quot;" }, 
+		{ "<", "&lt;" },
+		{ ">", "&gt;" },
+		{ "&", "&amp;" }
+    };
+    
     private static final ICharacterMatcher SAFE_MATCHER = new AsciiCharacterMatcher(SAFE_CHARACTERS);
     private static final ICharacterTranslator ENTITY_TRANSLATOR = new AsciiCharacterTranslator(ENTITIES);
-
+    
     private boolean _encodeNonAscii;
     private ICharacterMatcher _safeMatcher;
     private ICharacterTranslator _entityTranslator;
-
+	
     public MarkupCharacterTranslator()
     {
-        this(true);
+    	this(true);
     }
-
+    
     public MarkupCharacterTranslator(boolean encodeNonAscii)
     {
-        this(encodeNonAscii, SAFE_MATCHER, ENTITY_TRANSLATOR);
+    	this(encodeNonAscii, SAFE_MATCHER, ENTITY_TRANSLATOR);
     }
-
-    public MarkupCharacterTranslator(boolean encodeNonAscii, ICharacterMatcher safeMatcher,
-            ICharacterTranslator entityTranslator)
+    
+    public MarkupCharacterTranslator(boolean encodeNonAscii, ICharacterMatcher safeMatcher, ICharacterTranslator entityTranslator)
     {
-        _encodeNonAscii = encodeNonAscii;
-        _safeMatcher = safeMatcher;
-        _entityTranslator = entityTranslator;
+    	_encodeNonAscii = encodeNonAscii;
+    	_safeMatcher = safeMatcher;
+    	_entityTranslator = entityTranslator;
     }
 
     public MarkupCharacterTranslator(boolean encodeNonAscii, String safeCharacters, String[][] entities)
     {
-        _encodeNonAscii = encodeNonAscii;
-        _safeMatcher = new AsciiCharacterMatcher(safeCharacters);
-        _entityTranslator = new AsciiCharacterTranslator(entities);
-    }
-
-    /**
-     * @see org.apache.tapestry.util.text.IMarkupCharacterTranslator#translateAttribute(char)
-     */
-    public String translate(char ch)
-    {
-        // IE and Firefox do not handle characters between 128 and 159 well,
-        // so they have to be quoted as well
-        if (ch >= 160 && !_encodeNonAscii) return null;
-
-        if (_safeMatcher.matches(ch)) return null;
-
-        String entity = _entityTranslator.translate(ch);
-        if (entity != null) return entity;
-
-        // needs to use a NumberFormat here to be fully compliant,
-        // but this is accepted fine by the browsers
-        return "&#" + (int)ch + ";";
+    	_encodeNonAscii = encodeNonAscii;
+    	_safeMatcher = new AsciiCharacterMatcher(safeCharacters);
+    	_entityTranslator = new AsciiCharacterTranslator(entities);
     }
+    
+	/**
+	 * @see org.apache.tapestry.util.text.IMarkupCharacterTranslator#translateAttribute(char)
+	 */
+	public String translate(char ch) {
+		// IE and Firefox do not handle characters between 128 and 159 well, 
+		// so they have to be quoted as well 
+		if (ch >= 160 && !_encodeNonAscii) 
+			return null;
+		
+		if (_safeMatcher.matches(ch))
+			return null;
+
+		String entity = _entityTranslator.translate(ch);
+		if (entity != null)
+			return entity;
+		
+		// needs to use a NumberFormat here to be fully compliant, 
+		// but this is accepted fine by the browsers
+		return "&#" + (int) ch + ";";
+	}
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/WhitespaceMatcher.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/WhitespaceMatcher.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/WhitespaceMatcher.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/text/WhitespaceMatcher.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -20,42 +20,41 @@
  * @author mb
  * @since 4.0
  */
-public class WhitespaceMatcher implements ICharacterMatcher
+public class WhitespaceMatcher implements ICharacterMatcher 
 {
-
     private boolean _matchEndLines;
-
+    
     /**
-     * Creates an object that matches all whitespace characters, line
-     * terminators included.
+     * Creates an object that matches all whitespace characters, line terminators included
      */
     public WhitespaceMatcher()
     {
         this(true);
     }
-
+    
     /**
-     * Creates an object that matches whitespace characters. Line terminators
-     * are included only if this is specified.
+     * Creates an object that matches whitespace characters. 
+     * Line terminators are included only if this is specified.
      * 
-     * @param matchEndLines
-     *            match line terminators as well
+     * @param matchEndLines match line terminators as well
      */
     public WhitespaceMatcher(boolean matchEndLines)
     {
         _matchEndLines = matchEndLines;
     }
-
+    
     /**
-     * Matches whitespace characters. Line terminators may be matched depending
-     * on the constructor used to create the object.
+     * Matches whitespace characters. Line terminators may be matched 
+     * depending on the constructor used to create the object.
      * 
      * @see org.apache.tapestry.util.text.ICharacterMatcher#matches(char)
      */
     public boolean matches(char ch)
     {
-        if (!_matchEndLines) if (ch == '\n' || ch == '\r') return false;
-
+        if (!_matchEndLines)
+            if (ch == '\n' || ch == '\r')
+                return false;
+        
         return Character.isWhitespace(ch);
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/DocumentParseException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/DocumentParseException.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/DocumentParseException.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/DocumentParseException.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -30,12 +30,11 @@
 
 public class DocumentParseException extends ApplicationRuntimeException
 {
-
     private static final long serialVersionUID = 4630222650675402789L;
 
-    public DocumentParseException(String message)
+	public DocumentParseException(String message)
     {
-        this(message, (Resource)null);
+        this(message, (Resource) null);
     }
 
     public DocumentParseException(String message, Throwable rootCause)
@@ -55,17 +54,17 @@
 
     public DocumentParseException(String message, Resource resource, SAXParseException rootCause)
     {
-        this(message, resource == null ? null : new LocationImpl(resource, rootCause.getLineNumber(), rootCause
-                .getColumnNumber()), rootCause);
+        this(message, resource == null ? null : new LocationImpl(resource, rootCause
+                .getLineNumber(), rootCause.getColumnNumber()), rootCause);
     }
 
     public DocumentParseException(String message, Resource resource)
     {
-        this(message, resource, (Throwable)null);
+        this(message, resource, (Throwable) null);
     }
 
     public DocumentParseException(String message, Resource resource, Throwable rootCause)
     {
         this(message, resource == null ? null : new LocationImpl(resource), rootCause);
     }
-}
+}
\ No newline at end of file

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/IRule.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/IRule.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/IRule.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/IRule.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -17,42 +17,39 @@
 import org.xml.sax.Attributes;
 
 /**
- * A rule that may be pushed onto the
- * {@link org.apache.tapestry.util.xml.RuleDirectedParser}'s rule stack. A rule
- * is associated with an XML element. It is pushed onto the stack when the open
- * tag for the rule is encountered. It is is popped off the stack after the
- * end-tag is encountered. It is notified about any text it directly wraps
- * around.
- * <p>
- * Rules should be stateless, because a rule instance may appear multiple times
- * in the rule stack (if elements can be recusively nested).
+ * A rule that may be pushed onto the {@link org.apache.tapestry.util.xml.RuleDirectedParser}'s
+ * rule stack.  A rule is associated with an XML element.  It is pushed onto the stack when the
+ * open tag for the rule is encountered.  It is is popped off the stack after the end-tag is
+ * encountered.  It is notified about any text it directly wraps around.
  * 
+ * <p>Rules should be stateless, because a rule instance may appear multiple times in the
+ * rule stack (if elements can be recusively nested).
+ *
  * @author Howard Lewis Ship
  * @since 3.0
- */
+ **/
 
 public interface IRule
 {
-
-    /**
-     * Invoked just after the rule is pushed onto the rule stack. Typically, a
-     * Rule will use the information to create a new object and push it onto the
-     * object stack. If the rule needs to know about the element (rather than
-     * the attributes), it may obtain the URI, localName and qName from the
-     * parser.
-     */
-    public void startElement(RuleDirectedParser parser, Attributes attributes);
-
-    /**
-     * Invoked just after the rule is popped off the rule stack.
-     */
-    public void endElement(RuleDirectedParser parser);
-
-    /**
-     * Invoked when real content is found. The parser is responsible for
-     * aggregating all content provided by the underlying SAX parser into a
-     * single string.
-     */
-
-    public void content(RuleDirectedParser parser, String content);
+	/**
+	 * Invoked just after the rule is pushed onto the rule stack.  Typically, a Rule will
+	 *  use the information to create a new object and push it onto the object stack.
+	 *  If the rule needs to know about the element (rather than the attributes), it
+	 *  may obtain the URI, localName and qName from the parser.
+	 * 
+	 */
+	public void startElement(RuleDirectedParser parser, Attributes attributes);
+	
+	/**
+	 * Invoked just after the rule is popped off the rule stack.
+	 */
+	public void endElement(RuleDirectedParser parser);
+	
+	
+	/**
+	 * Invoked when real content is found.  The parser is responsible for aggregating
+	 * all content provided by the underlying SAX parser into a single string.
+	 */
+	
+	public void content(RuleDirectedParser parser, String content);
 }

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/InvalidStringException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/InvalidStringException.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/InvalidStringException.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/xml/InvalidStringException.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -18,8 +18,7 @@
 import org.apache.hivemind.Location;
 
 /**
- * Exception thrown if there is any kind of error validating a string during
- * document parsing
+ * Exception thrown if there is any kind of error validating a string during document parsing
  * 
  * @author Geoffrey Longman
  * @since 2.2
@@ -27,10 +26,9 @@
 
 public class InvalidStringException extends DocumentParseException implements Locatable
 {
-
     private static final long serialVersionUID = 8199998733585358584L;
-
-    private String _invalidString;
+    
+	private String _invalidString;
 
     public InvalidStringException(String message, String invalidString, Location location)
     {
@@ -43,4 +41,4 @@
     {
         return _invalidString;
     }
-}
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org