jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r950558 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
Date Wed, 02 Jun 2010 13:27:14 GMT
Author: angela
Date: Wed Jun  2 13:27:14 2010
New Revision: 950558

URL: http://svn.apache.org/viewvc?rev=950558&view=rev
Log:
typo in comments and minor improvements

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java?rev=950558&r1=950557&r2=950558&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
Wed Jun  2 13:27:14 2010
@@ -91,7 +91,7 @@ public class Text {
     /**
      * Digest the plain string using the given algorithm.
      *
-     * @param algorithm The alogrithm for the digest. This algorithm must be
+     * @param algorithm The algorithm for the digest. This algorithm must be
      *                  supported by the MessageDigest class.
      * @param data      the data to digest with the given algorithm
      * @return The digested plain text String represented as Hex digits.
@@ -114,7 +114,7 @@ public class Text {
 
     /**
      * returns an array of strings decomposed of the original string, split at
-     * every occurance of 'ch'. if 2 'ch' follow each other with no intermediate
+     * every occurrence of 'ch'. if 2 'ch' follow each other with no intermediate
      * characters, empty "" entries are avoided.
      *
      * @param str the string to decompose
@@ -139,7 +139,7 @@ public class Text {
             return new String[0];
         }
 
-        ArrayList strings = new ArrayList();
+        ArrayList<String> strings = new ArrayList<String>();
         int pos;
         int lastpos = 0;
 
@@ -157,8 +157,8 @@ public class Text {
             strings.add("");
         }
 
-        // return stringarray
-        return (String[]) strings.toArray(new String[strings.size()]);
+        // return string array
+        return strings.toArray(new String[strings.size()]);
     }
 
     /**
@@ -179,12 +179,12 @@ public class Text {
     }
 
     /**
-     * Replaces all occurences of <code>oldString</code> in <code>text</code>
+     * Replaces all occurrences of <code>oldString</code> in <code>text</code>
      * with <code>newString</code>.
      *
      * @param text
      * @param oldString old substring to be replaced with <code>newString</code>
-     * @param newString new substring to replace occurences of <code>oldString</code>
+     * @param newString new substring to replace occurrences of <code>oldString</code>
      * @return a string
      */
     public static String replace(String text, String oldString, String newString) {
@@ -340,8 +340,8 @@ public class Text {
             BitSet validChars = isPath ? URISaveEx : URISave;
             byte[] bytes = string.getBytes("utf-8");
             StringBuffer out = new StringBuffer(bytes.length);
-            for (int i = 0; i < bytes.length; i++) {
-                int c = bytes[i] & 0xff;
+            for (byte aByte : bytes) {
+                int c = aByte & 0xff;
                 if (validChars.get(c) && c != escape) {
                     out.append((char) c);
                 } else {



Mime
View raw message