svn commit: r794976 [2/2] - in /commons/proper/jexl/branches/2.0: ./ src/conf/ src/java/org/apache/commons/jexl/ src/java/org/apache/commons/jexl/util/ src/java/org/apache/commons/jexl/util/introspect

2009-07-17 Thread rahul
Modified: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java?rev=794976r1=794975r2=794976view=diff
==
--- 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java
 (original)
+++ 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java
 Fri Jul 17 06:15:35 2009
@@ -52,7 +52,7 @@
 /*
  * static signature for method(object,object)
  */
-static final Class[] OBJECT_OBJECT = { Object.class, Object.class };
+static final Class?[] OBJECT_OBJECT = { Object.class, Object.class };
 /**
  * Our runtime logger.
  */
@@ -87,35 +87,35 @@
 /**
  * {...@inheritdoc}
  */
-public Iterator getIterator(Object obj, Info i) {
+public Iterator? getIterator(Object obj, Info i) {
 if (obj.getClass().isArray()) {
 return new ArrayIterator(obj);
-} else if (obj instanceof Collection) {
-return ((Collection) obj).iterator();
-} else if (obj instanceof Map) {
-return ((Map) obj).values().iterator();
-} else if (obj instanceof Iterator) {
+} else if (obj instanceof Collection?) {
+return ((Collection?) obj).iterator();
+} else if (obj instanceof Map?,?) {
+return ((Map?,?) obj).values().iterator();
+} else if (obj instanceof Iterator?) {
 rlog.warn(Warning! The iterative  +  is an Iterator in the 
#foreach() loop at [ + i.getLine() + ,
 + i.getColumn() + ] +  in template  + 
i.getTemplateName() + . Because it's not resetable,
 +  if used in more than once, this may lead to +  
unexpected results.);
 
-return ((Iterator) obj);
-} else if (obj instanceof Enumeration) {
+return ((Iterator?) obj);
+} else if (obj instanceof Enumeration?) {
 rlog.warn(Warning! The iterative  +  is an Enumeration in 
the #foreach() loop at [ + i.getLine() + ,
 + i.getColumn() + ] +  in template  + 
i.getTemplateName() + . Because it's not resetable,
 +  if used in more than once, this may lead to +  
unexpected results.);
 
-return new EnumerationIterator((Enumeration) obj);
+return new EnumerationIterator((Enumeration?) obj);
 } else {
 // look for an iterator() method to support the JDK5 Iterable
 // interface or any user tools/DTOs that want to work in
 // foreach without implementing the Collection interface
-Class type = obj.getClass();
+Class? type = obj.getClass();
 try {
-Method iter = type.getMethod(iterator, (Class[]) null);
-Class returns = iter.getReturnType();
+Method iter = type.getMethod(iterator, (Class?[]) null);
+Class? returns = iter.getReturnType();
 if (Iterator.class.isAssignableFrom(returns)) {
-return (Iterator) iter.invoke(obj, (Object[])null);
+return (Iterator?) iter.invoke(obj, (Object[])null);
 } else {
 rlog.error(iterator() method of reference in #foreach 
loop at 
 + i +  does not return a true Iterator.);
@@ -158,8 +158,8 @@
 // before invoking the method
 return new VelMethodImpl(m, true);
 }
-} else if (obj instanceof Class) {
-m = introspector.getMethod((Class) obj, methodName, args);
+} else if (obj instanceof Class?) {
+m = introspector.getMethod((Class?) obj, methodName, args);
 }
 
 return (m == null) ? null : new VelMethodImpl(m);
@@ -171,7 +171,7 @@
 public VelPropertyGet getPropertyGet(Object obj, String identifier, Info 
i) {
 AbstractExecutor executor;
 
-Class claz = obj.getClass();
+Class? claz = obj.getClass();
 
 /*
  * first try for a getFoo() type of property (also getfoo() )
@@ -208,7 +208,7 @@
  * {...@inheritdoc}
  */
 public VelPropertySet getPropertySet(Object obj, String identifier, Object 
arg, Info i) {
-Class claz = obj.getClass();
+Class? claz = obj.getClass();
 
 VelMethod vm = null;
 try {
@@ -296,9 +296,9 @@
  */
 public Object invoke(Object o, Object[] params) throws Exception {
 if (isVarArg()) {
-Class[] formal = method.getParameterTypes();
+Class?[] formal = method.getParameterTypes();
 int index = formal.length - 1;
-Class type = 

svn commit: r795022 - in /commons/sandbox/runtime/trunk/src/main/native: configure os/hpux/os.c os/linux/os.c os/solaris/os.c shared/xdr.c

2009-07-17 Thread mturk
Author: mturk
Date: Fri Jul 17 09:43:03 2009
New Revision: 795022

URL: http://svn.apache.org/viewvc?rev=795022view=rev
Log:
Rename BIG_ENDIAN define

Modified:
commons/sandbox/runtime/trunk/src/main/native/configure
commons/sandbox/runtime/trunk/src/main/native/os/hpux/os.c
commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c
commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c
commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=795022r1=795021r2=795022view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Fri Jul 17 09:43:03 
2009
@@ -537,7 +537,12 @@
 int main() {return 0;}
 EOF
 rc=0
-co=`$cc $ccflags $cppopts $test.c -l$1 -o $test$exe 21`
+if [ .host = .windows ]; then
+ll=$1
+else
+ll=-l$1
+fi
+co=`$cc $ccflags $cppopts $test.c $ll -o $test$exe 21`
 if [ .$co = . ]; then
 rc=1
 else
@@ -789,7 +794,6 @@
 #define HAVE_OPENSSL  $have_openssl
 #define HAVE_ZLIB $have_zlib
 #define HAVE_SELINUX_H$have_selinux
-#define HAS_BIG_ENDIAN$bige
 
 #define HAVE_UNISTD_H `have_include unistd`
 #define HAVE_STRING_H `have_include string`
@@ -833,6 +837,7 @@
 #define CC_SIZEOF_VOIDP   `test_csizeof 'void *'`
 #define CC_SIZEOF_SIZE_T  `test_csizeof size_t`
 #define CC_SIZEOF_OFF64_T $sizeof_off64t
+#define CC_IS_BIG_ENDIAN  $bige
 
 EOF
 
@@ -845,27 +850,9 @@
 EOF
 
 if [ .$host = .windows ]; then
-printf Checking for %-32s bufferoverflowu.lib
-cat  $test.c  EOF
-#include stdlib.h
-#include stdio.h
-int main() {return 0;}
-EOF
-rc=0
-co=`$cc $ccflags $cppopts $test.c bufferoverflowu.lib -o $test$exe 21`
-if [ .$co = . ]; then
-rc=1
-else
-if [ -x $test$exe ]; then
-rc=1
-fi
-fi
-rm -rf $test.* $test *.pdb /dev/null 21 || true
-if [ $rc = 1 ]; then
-echo ok
+ok=`have_library bufferoverflowu.lib`
+if [ .$ok = .1 ]; then
 varadds ldflags bufferoverflowu.lib
-else
-echo not found
 fi
 if [ .$have_fileextd = .1 ]; then
 varadds ldflags fileextd.lib

Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/os.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/os.c?rev=795022r1=795021r2=795022view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/hpux/os.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/os.c Fri Jul 17 
09:43:03 2009
@@ -75,7 +75,7 @@
 /* TODO: Figure out which API to use for that
  * without defines
  */
-#if HAS_BIG_ENDIAN
+#if CC_IS_BIG_ENDIAN
 #if CC_SIZEOF_VOIDP == 8
 return CSTR_TO_JSTRING(pa64);
 #else

Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c?rev=795022r1=795021r2=795022view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c Fri Jul 17 
09:43:03 2009
@@ -78,7 +78,7 @@
 ACR_CopyStrn(string, sys.machine, MAXSIZESYSSTRING);
 ACR_StrLwr(string);
 
-#if HAS_BIG_ENDIAN
+#if CC_IS_BIG_ENDIAN
 /* TODO: Name BE machines (PPC ?) */
 #else
 if (strstr(string, 64)) {

Modified: commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c?rev=795022r1=795021r2=795022view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c Fri Jul 17 
09:43:03 2009
@@ -68,7 +68,7 @@
 
 ACR_JNI_EXPORT_DECLARE(jstring, Os, getProcessor)(ACR_JNISTDARGS)
 {
-#if HAS_BIG_ENDIAN
+#if CC_IS_BIG_ENDIAN
 #if CC_SIZEOF_VOIDP == 8
 return CSTR_TO_JSTRING(sparc64);
 #else

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c?rev=795022r1=795021r2=795022view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/xdr.c Fri Jul 17 
09:43:03 2009
@@ -50,7 +50,7 @@
 (*xdr)-size = len;
 (*xdr)-used = 0;
 

svn commit: r795190 - in /commons/proper/jexl/branches/2.0/src: java/org/apache/commons/jexl/ java/org/apache/commons/jexl/parser/ java/org/apache/commons/jexl/util/ test/org/apache/commons/jexl/

2009-07-17 Thread rahul
Author: rahul
Date: Fri Jul 17 18:40:59 2009
New Revision: 795190

URL: http://svn.apache.org/viewvc?rev=795190view=rev
Log:
UnifiedJEXL improvements:
 - Better names for inner classes
 - More test coverage, and some fixes
 - Factor String parsing utilities in new class (StringParser)
Slightly modified version of patch thanks to Henri Biestro hbiestro at gmail 
dot com.
JEXL-58

Added:

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/StringParser.java
   (with props)
Modified:

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/Parser.jjt

commons/proper/jexl/branches/2.0/src/test/org/apache/commons/jexl/UnifiedJEXLTest.java

Modified: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java?rev=795190r1=795189r2=795190view=diff
==
--- 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java
 (original)
+++ 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java
 Fri Jul 17 18:40:59 2009
@@ -21,6 +21,7 @@
 import java.util.ArrayList;
 import org.apache.commons.jexl.parser.SimpleNode;
 import org.apache.commons.jexl.parser.ParseException;
+import org.apache.commons.jexl.util.StringParser;
 
 /**
  * An evaluator similar to the unified EL evaluator used in JSP/JSF based on 
JEXL.
@@ -173,7 +174,7 @@
 // if only one sub-expr, no need to create a composite
 return (expressions.size() == 1)?
 expressions.get(0) :
-el.new Composite(counts, expressions, source);
+el.new CompositeExpression(counts, expressions, source);
 }
 }
 
@@ -199,21 +200,41 @@
  * The abstract base class for all expressions, immediate '${...}' and 
deferred '#{...}'.
  */
 public abstract class Expression {
-final Expression source;
+protected final Expression source;
 
 Expression(Expression source) {
 this.source = source != null ? source : this;
 }
 
+@Override
+public String toString() {
+StringBuilder strb = new StringBuilder();
+if (source != this) {
+strb.append(source.toString());
+strb.append( /*= );
+}
+asString(strb);
+if (source != this) {
+strb.append( */);
+}
+return strb.toString();
+}
 /**
- * Generate the string corresponding to this expression.
+ * Generates this expression's string representation.
  * @return the string representation
  */
 public String asString() {
-return toString();
+StringBuilder strb = new StringBuilder();
+asString(strb);
+return strb.toString();
 }
 
 /**
+ * Adds this expression's string representation to a StringBuilder.
+ */
+abstract void asString(StringBuilder strb);
+
+/**
  * When the expression is dependant upon immediate and deferred 
sub-expressions,
  * evaluates the immediate sub-expressions with the context passed as 
parameter
  * and returns this expression deferred form.
@@ -294,49 +315,50 @@
 
 
 /** A constant expression. */
-private class Constant extends Expression {
+private class ConstantExpression extends Expression {
 private final Object value;
 
-Constant(Object value, Expression source) {
+ConstantExpression(Object value, Expression source) {
 super(source);
 if (value == null) {
 throw new NullPointerException(constant can not be null);
 }
+if (value instanceof String) {
+value = StringParser.buildString((String) value, false);
+}
 this.value = value;
 }
 
+@Override
+public String asString() {
+StringBuilder strb = new StringBuilder();
+strb.append('');
+asString(strb);
+strb.append('');
+return strb.toString();
+}
+
+@Override
 ExpressionType getType() {
 return ExpressionType.CONSTANT;
 }
 
 @Override
-public String toString() {
+void asString(StringBuilder strb) {
 String str = value.toString();
 if (value instanceof String || value instanceof CharSequence) {
-StringBuilder strb = new StringBuilder(str.length() + 2);
-if (source != this) {
-strb.append(source.toString());
-strb.append( /*= );
- 

svn commit: r795196 - in /commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl: UnifiedJEXL.java parser/StringParser.java util/StringParser.java

2009-07-17 Thread rahul
Author: rahul
Date: Fri Jul 17 19:04:43 2009
New Revision: 795196

URL: http://svn.apache.org/viewvc?rev=795196view=rev
Log:
Moved StringParser class to parser package where it belongs.

Added:

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/StringParser.java
   (contents, props changed)
  - copied, changed from r795190, 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/StringParser.java
Removed:

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/StringParser.java
Modified:

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java

Modified: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java?rev=795196r1=795195r2=795196view=diff
==
--- 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java
 (original)
+++ 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/UnifiedJEXL.java
 Fri Jul 17 19:04:43 2009
@@ -21,7 +21,7 @@
 import java.util.ArrayList;
 import org.apache.commons.jexl.parser.SimpleNode;
 import org.apache.commons.jexl.parser.ParseException;
-import org.apache.commons.jexl.util.StringParser;
+import org.apache.commons.jexl.parser.StringParser;
 
 /**
  * An evaluator similar to the unified EL evaluator used in JSP/JSF based on 
JEXL.

Copied: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/StringParser.java
 (from r795190, 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/StringParser.java)
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/StringParser.java?p2=commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/StringParser.javap1=commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/StringParser.javar1=795190r2=795196rev=795196view=diff
==
--- 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/StringParser.java
 (original)
+++ 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/StringParser.java
 Fri Jul 17 19:04:43 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl.util;
+package org.apache.commons.jexl.parser;
 
 /**
  * Common constant strings utilities.

Propchange: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/StringParser.java
--
svn:eol-style = native

Propchange: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/StringParser.java
--
svn:keywords = Date Author Id Revision HeadURL

Propchange: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/StringParser.java
--
svn:mergeinfo = 




svn commit: r795221 - in /commons/sandbox/runtime/trunk/src/main/native: configure os/unix/uutils.c

2009-07-17 Thread mturk
Author: mturk
Date: Fri Jul 17 20:44:55 2009
New Revision: 795221

URL: http://svn.apache.org/viewvc?rev=795221view=rev
Log:
Use % insted ; for a sed separator. ; is windows path separator

Modified:
commons/sandbox/runtime/trunk/src/main/native/configure
commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=795221r1=795220r2=795221view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Fri Jul 17 20:44:55 
2009
@@ -256,12 +256,12 @@
 
 toupper()
 {
-echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+echo $1 | tr '[a-z]' '[A-Z]'
 }
 
 tolower()
 {
-echo $1 | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
+echo $1 | tr '[A-Z]' '[a-z]'
 }
 
 if [ .$java_home = . ]; then
@@ -861,38 +861,38 @@
 
 for m in $makefiles
 do
-sed -e s;=...@cc@;=$cc;g \
--e s;=...@cpp@;=$cpp;g \
--e s;=...@cxx@;=$cxx;g \
--e s;=...@as@;=$as;g \
--e s;=...@so@;=$so;g \
--e s;=...@lib@;=$lib;g \
--e s;=...@obj@;=$obj;g \
--e s;=...@exe@;=$exe;g \
--e s;=...@ar@;=$ar;g \
--e s;=...@host@;=$host;g \
--e s;=...@mach@;=$mach;g \
--e s;=...@bits@;=$bits;g \
--e s;=...@ranlib@;=$ranlib;g \
--e s;=...@prefix@;=$prefix;g \
--e s;=...@libdir@;=$libdir;g \
--e s;=...@topdir@;=$topdir;g \
--e s;=...@ccflags@;=$ccflags;g \
--e s;=...@cppopts@;=$cppopts;g \
--e s;=...@cxxopts@;=$cxxopts;g \
--e s;=...@ldflags@;=$ldflags;g \
--e s;=...@shflags@;=$shflags;g \
--e s;=...@arflags@;=$arflags;g \
--e s;=...@sslflags@;=$sslflags;g \
--e s;=...@rcflags@;=$rcflags;g \
--e s;=...@includes@;=$includes;g \
--e s;=...@name@;=$name;g \
--e s;=...@vmajor@;=$vmajor;g \
--e s;=...@vminor@;=$vminor;g \
--e s;=...@vpatch@;=$vpatch;g \
--e s;@platform@;$platform;g \
--e s;@testobjs@;$testobjs;g \
--e s;@modules@;$modules;g \
+sed -e s...@cc@%=$cc%g \
+-e s...@cpp@%=$cpp%g \
+-e s...@cxx@%=$cxx%g \
+-e s...@as@%=$as%g \
+-e s...@so@%=$so%g \
+-e s...@lib@%=$lib%g \
+-e s...@obj@%=$obj%g \
+-e s...@exe@%=$exe%g \
+-e s...@ar@%=$ar%g \
+-e s...@host@%=$host%g \
+-e s...@mach@%=$mach%g \
+-e s...@bits@%=$bits%g \
+-e s...@ranlib@%=$ranlib%g \
+-e s...@prefix@%=$prefix%g \
+-e s...@libdir@%=$libdir%g \
+-e s...@topdir@%=$topdir%g \
+-e s...@ccflags@%=$ccflags%g \
+-e s...@cppopts@%=$cppopts%g \
+-e s...@cxxopts@%=$cxxopts%g \
+-e s...@ldflags@%=$ldflags%g \
+-e s...@shflags@%=$shflags%g \
+-e s...@arflags@%=$arflags%g \
+-e s...@sslflags@%=$sslflags%g \
+-e s...@rcflags@%=$rcflags%g \
+-e s...@includes@%=$includes%g \
+-e s...@name@%=$name%g \
+-e s...@vmajor@%=$vmajor%g \
+-e s...@vminor@%=$vminor%g \
+-e s...@vpatch@%=$vpatch%g \
+-e s...@platform@%$platform%g \
+-e s...@testobjs@%$testobjs%g \
+-e s...@modules@%$modules%g \
 $m.in  $m
 done
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c?rev=795221r1=795220r2=795221view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c Fri Jul 17 
20:44:55 2009
@@ -30,7 +30,7 @@
 if (!(f = fopen(name, r)))
 return NULL;
 if ((b = malloc(rd))) {
-size_t i, nr = fread(b, 1, rd - 2, f);
+size_t nr = fread(b, 1, rd - 2, f);
 if (nr == (rd - 2)) {
 /* Try with larger buffer size */
 char *nb = malloc(ACR_MAX_FREAD_LEN);
@@ -45,8 +45,9 @@
 nr = 0;
 }
 if (nr  0) {
+int i;
 /* Remove all trailing zero and space characters */
-for (i = nr - 1; i = 0  (acr_iscntrl(b[i]) ||
+for ((i = (int)(nr - 1); i = 0  (acr_iscntrl(b[i]) ||
  acr_isspace(b[i])); i--)
 ;
 b[i + 1] = '\0';
@@ -61,3 +62,4 @@
 fclose(f);
 return b;
 }
+




svn commit: r795224 - /commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c

2009-07-17 Thread mturk
Author: mturk
Date: Fri Jul 17 20:50:57 2009
New Revision: 795224

URL: http://svn.apache.org/viewvc?rev=795224view=rev
Log:
Fix typo

Modified:
commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c?rev=795224r1=795223r2=795224view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/uutils.c Fri Jul 17 
20:50:57 2009
@@ -47,7 +47,7 @@
 if (nr  0) {
 int i;
 /* Remove all trailing zero and space characters */
-for ((i = (int)(nr - 1); i = 0  (acr_iscntrl(b[i]) ||
+for (i = (int)(nr - 1); i = 0  (acr_iscntrl(b[i]) ||
  acr_isspace(b[i])); i--)
 ;
 b[i + 1] = '\0';




svn commit: r795225 - /commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c

2009-07-17 Thread mturk
Author: mturk
Date: Fri Jul 17 20:56:46 2009
New Revision: 795225

URL: http://svn.apache.org/viewvc?rev=795225view=rev
Log:
Fix compile warnings

Modified:
commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c?rev=795225r1=795224r2=795225view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c Fri Jul 17 
20:56:46 2009
@@ -214,13 +214,15 @@
 ACR_PTR_EXPORT_DECLARE(int, memcmp0)(ACR_JNISTDARGS, jniptr a,
  jniptr b, jniptr n)
 {
+int rv;
 UNREFERENCED_STDARGS;
 ACR_TRY {
-return memcmp(N2P(a, void *), N2P(b, const void *), (size_t)n);
+rv = memcmp(N2P(a, void *), N2P(b, const void *), (size_t)n);
 } ACR_CATCH() {
 ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ERUNTIME, ACR_EFAULT);
-return -1;
+rv -1;
 }
+return rv;
 }
 
 ACR_DECLARE(jobject) ACR_NewPointer(JNIEnv *_E, void *p, size_t len,




svn commit: r795226 - /commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c

2009-07-17 Thread mturk
Author: mturk
Date: Fri Jul 17 20:57:16 2009
New Revision: 795226

URL: http://svn.apache.org/viewvc?rev=795226view=rev
Log:
Fix typo

Modified:
commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c?rev=795226r1=795225r2=795226view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c Fri Jul 17 
20:57:16 2009
@@ -220,7 +220,7 @@
 rv = memcmp(N2P(a, void *), N2P(b, const void *), (size_t)n);
 } ACR_CATCH() {
 ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ERUNTIME, ACR_EFAULT);
-rv -1;
+rv = -1;
 }
 return rv;
 }




svn commit: r795228 - in /commons/proper/codec/trunk/src: java/org/apache/commons/codec/binary/ test/org/apache/commons/codec/binary/

2009-07-17 Thread ggregory
Author: ggregory
Date: Fri Jul 17 21:10:36 2009
New Revision: 795228

URL: http://svn.apache.org/viewvc?rev=795228view=rev
Log:
[CODEC-78] Base64 classes: Improve Code Coverage.

Modified:

commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64InputStream.java

commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64OutputStream.java

commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java

commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java

commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java

commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64TestData.java

Modified: 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64InputStream.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64InputStream.java?rev=795228r1=795227r2=795228view=diff
==
--- 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64InputStream.java
 (original)
+++ 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64InputStream.java
 Fri Jul 17 21:10:36 2009
@@ -126,7 +126,7 @@
 public int read(byte b[], int offset, int len) throws IOException {
 if (b == null) {
 throw new NullPointerException();
-} else if (offset  0 || len  0 || offset + len  0) {
+} else if (offset  0 || len  0) {
 throw new IndexOutOfBoundsException();
 } else if (offset  b.length || offset + len  b.length) {
 throw new IndexOutOfBoundsException();

Modified: 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64OutputStream.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64OutputStream.java?rev=795228r1=795227r2=795228view=diff
==
--- 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64OutputStream.java
 (original)
+++ 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64OutputStream.java
 Fri Jul 17 21:10:36 2009
@@ -115,7 +115,7 @@
 public void write(byte b[], int offset, int len) throws IOException {
 if (b == null) {
 throw new NullPointerException();
-} else if (offset  0 || len  0 || offset + len  0) {
+} else if (offset  0 || len  0) {
 throw new IndexOutOfBoundsException();
 } else if (offset  b.length || offset + len  b.length) {
 throw new IndexOutOfBoundsException();

Modified: 
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java?rev=795228r1=795227r2=795228view=diff
==
--- 
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java
 (original)
+++ 
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64InputStreamTest.java
 Fri Jul 17 21:10:36 2009
@@ -311,10 +311,24 @@
 }
 
 try {
+in.read(buf, 0, -1);
+fail(Expected Base64InputStream.read(buf, 0, -1) to throw 
IndexOutOfBoundsException);
+} catch (IndexOutOfBoundsException e) {
+// Expected
+}
+
+try {
 in.read(buf, buf.length + 1, 0);
 fail(Base64InputStream.read(buf, buf.length + 1, 0) throws 
IndexOutOfBoundsException);
 } catch (IndexOutOfBoundsException e) {
 // Expected
 }
+
+try {
+in.read(buf, buf.length - 1, 2);
+fail(Base64InputStream.read(buf, buf.length - 1, 2) throws 
IndexOutOfBoundsException);
+} catch (IndexOutOfBoundsException e) {
+// Expected
+}
 }
 }

Modified: 
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java?rev=795228r1=795227r2=795228view=diff
==
--- 
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java
 (original)
+++ 
commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64OutputStreamTest.java
 Fri Jul 17 21:10:36 2009
@@ -34,6 +34,10 @@
 
 private final static byte[] LF = {(byte) '\n'};
 
+private static final String STRING_FIXTURE = Hello World;
+
+private static final String UTF_8_NAME = UTF-8;
+
 /**
  * 

svn commit: r795284 - in /commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary: Base64.java Base64InputStream.java Base64OutputStream.java

2009-07-17 Thread ggregory
Author: ggregory
Date: Sat Jul 18 00:36:43 2009
New Revision: 795284

URL: http://svn.apache.org/viewvc?rev=795284view=rev
Log:
[CODEC-58] Character set used by Base64 not documented. Apply modified patch. 
Better Javadocs. Changes to private field buf rename to buffer. Rename 
private method resizeBuf to resizeBuffer

Modified:

commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java

commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64InputStream.java

commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64OutputStream.java

Modified: 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java
URL: 
http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java?rev=795284r1=795283r2=795284view=diff
==
--- 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java 
(original)
+++ 
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java 
Sat Jul 18 00:36:43 2009
@@ -32,6 +32,19 @@
  * This class implements section cite6.8. Base64 
Content-Transfer-Encoding/cite from RFC 2045 citeMultipurpose
  * Internet Mail Extensions (MIME) Part One: Format of Internet Message 
Bodies/cite by Freed and Borenstein.
  * /p
+ * p
+ * The class can be parameterized in the following manner with various 
constructors:
+ * ul
+ * liURL-safe mode: Default off./li
+ * liLine length: Default 76. Line length that aren't multiples of 4 will 
still essentially end up being multiples of 4 in the
+ * encoded data. 
+ * liLine separator: Default is CRLF (\r\n)/li
+ * /ul
+ * /p
+ * p
+ * Since this class operates directly on byte streams, and not character 
streams, it is hard-coded to only encode/decode
+ * character encodings which are compatible with the lower 127 ASCII chart 
(ISO-8859-1, Windows-1252, UTF-8, etc).
+ * /p
  * 
  * @see a href=http://www.ietf.org/rfc/rfc2045.txt;RFC 2045/a
  * @author Apache Software Foundation
@@ -39,6 +52,10 @@
  * @version $Id$
  */
 public class Base64 implements BinaryEncoder, BinaryDecoder {
+private static final int DEFAULT_BUFFER_RESIZE_FACTOR = 2;
+
+private static final int DEFAULT_BUFFER_SIZE = 8192;
+
 /**
  * Chunk size per RFC 2045 section 6.8.
  * 
@@ -56,7 +73,7 @@
  * 
  * @see a href=http://www.ietf.org/rfc/rfc2045.txt;RFC 2045 section 
2.1/a
  */
-static final byte[] CHUNK_SEPARATOR = {'\r','\n'};
+static final byte[] CHUNK_SEPARATOR = {'\r', '\n'};
 
 /**
  * This array is a lookup table that translates 6-bit positive integer
@@ -127,39 +144,39 @@
 // some state be preserved between calls of encode() and decode().
 
 /**
- * Encode table to use:  either STANDARD or URL_SAFE.  Note:  the 
DECODE_TABLE above remains static
- * because it is able to decode both STANDARD and URL_SAFE streams, but 
the encodeTable must be a member
- * variable so we can switch between the two modes.
+ * Encode table to use: either STANDARD or URL_SAFE. Note: the 
DECODE_TABLE above remains static because it is able
+ * to decode both STANDARD and URL_SAFE streams, but the encodeTable must 
be a member variable so we can switch
+ * between the two modes.
  */
 private final byte[] encodeTable;
 
 /**
- * Line length for encoding.  Not used when decoding.  A value of zero or 
less implies
- * no chunking of the base64 encoded data.
+ * Line length for encoding. Not used when decoding. A value of zero or 
less implies no chunking of the base64
+ * encoded data.
  */
 private final int lineLength;
 
 /**
- * Line separator for encoding.  Not used when decoding.  Only used if 
lineLength  0.
+ * Line separator for encoding. Not used when decoding. Only used if 
lineLength  0.
  */
 private final byte[] lineSeparator;
 
 /**
- * Convenience variable to help us determine when our buffer is going to 
run out of
- * room and needs resizing.  codedecodeSize = 3 + 
lineSeparator.length;/code
+ * Convenience variable to help us determine when our buffer is going to 
run out of room and needs resizing.
+ * codedecodeSize = 3 + lineSeparator.length;/code
  */
 private final int decodeSize;
 
 /**
- * Convenience variable to help us determine when our buffer is going to 
run out of
- * room and needs resizing.  codeencodeSize = 4 + 
lineSeparator.length;/code
+ * Convenience variable to help us determine when our buffer is going to 
run out of room and needs resizing.
+ * codeencodeSize = 4 + lineSeparator.length;/code
  */
 private final int encodeSize;
 
 /**
- * Buffer for streaming. 
+ * Buffer for streaming.
  */
-private byte[] buf;
+private byte[] buffer;
 
 /**
  * Position where next character should be written in the buffer.

svn commit: r795308 - in /commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl: ./ parser/ util/introspection/

2009-07-17 Thread rahul
Author: rahul
Date: Sat Jul 18 04:11:49 2009
New Revision: 795308

URL: http://svn.apache.org/viewvc?rev=795308view=rev
Log:
Reduce checkstyle and raw type warnings.
Patch by Henri Biestro hbiestro at gmail dot com.
JEXL-20

Modified:

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/JexlEngine.java

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/Parser.jjt

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/ClassMap.java

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/Introspector.java

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/IntrospectorBase.java

commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java

Modified: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/JexlEngine.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/JexlEngine.java?rev=795308r1=795307r2=795308view=diff
==
--- 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/JexlEngine.java
 (original)
+++ 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/JexlEngine.java
 Sat Jul 18 04:11:49 2009
@@ -32,7 +32,6 @@
 
 import org.apache.commons.jexl.parser.ParseException;
 import org.apache.commons.jexl.parser.Parser;
-import org.apache.commons.jexl.parser.Node;
 import org.apache.commons.jexl.parser.SimpleNode;
 import org.apache.commons.jexl.parser.TokenMgrError;
 import org.apache.commons.jexl.parser.ASTJexlScript;
@@ -500,8 +499,8 @@
 int start = 0;
 int end = str.length();
 if (end  0) {
-for(start = 0; start  end  str.charAt(start) == ' '; 
++start); // trim front spaces
-for(;end  0  str.charAt(end - 1) == ' '; --end); // trim 
ending spaces
+for(start = 0; start  end  str.charAt(start) == ' '; 
++start) {} // trim front spaces
+for(;end  0  str.charAt(end - 1) == ' '; --end) {} // trim 
ending spaces
 return str.subSequence(start, end).toString();
 }
 return ;

Modified: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/Parser.jjt
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/Parser.jjt?rev=795308r1=795307r2=795308view=diff
==
--- 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/Parser.jjt
 (original)
+++ 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/parser/Parser.jjt
 Sat Jul 18 04:11:49 2009
@@ -41,8 +41,6 @@
 import java.io.Reader;
 import java.io.ByteArrayInputStream;
 
-import org.apache.commons.jexl.util.introspection.Uberspect;
-
 public class Parser extends StringParser
 {
 

Modified: 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/ClassMap.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/ClassMap.java?rev=795308r1=795307r2=795308view=diff
==
--- 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/ClassMap.java
 (original)
+++ 
commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/util/introspection/ClassMap.java
 Sat Jul 18 04:11:49 2009
@@ -18,10 +18,7 @@
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -46,7 +43,7 @@
 /**
  * Class passed into the constructor used to as the basis for the Method 
map.
  */
-private final Class clazz;
+private final Class? clazz;
 /** logger. */
 private final Log rlog;
 /** cache of methods. */
@@ -58,7 +55,7 @@
  * @param aClass the class to deconstruct.
  * @param log the logger.
  */
-public ClassMap(Class aClass, Log log) {
+public ClassMap(Class? aClass, Log log) {
 clazz = aClass;
 this.rlog = log;
 methodCache = new MethodCache();
@@ -69,7 +66,7 @@
 /**
  * @return the class object whose methods are cached by this map.
  */
-Class getCachedClass() {
+Class? getCachedClass() {
 return clazz;
 }
 
@@ -106,11 +103,11 @@
 // hit the public elements sooner or later because we reflect all the 
public elements anyway.
 //
 // Ah, the miracles of Java for(;;) ...
-for (Class classToReflect = getCachedClass(); classToReflect != null; 
classToReflect = classToReflect.getSuperclass()) {
+