svn commit: r1211319 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java

2011-12-06 Thread celestin
Author: celestin
Date: Wed Dec  7 07:39:22 2011
New Revision: 1211319

URL: http://svn.apache.org/viewvc?rev=1211319&view=rev
Log:
Forgot to commit updated unit tests in rev 1211318 (MATH-677).

Modified:

commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java

Modified: 
commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java?rev=1211319&r1=1211318&r2=1211319&view=diff
==
--- 
commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java
 (original)
+++ 
commons/proper/math/trunk/src/test/java/org/apache/commons/math/transform/FastFourierTransformerTest.java
 Wed Dec  7 07:39:22 2011
@@ -37,7 +37,7 @@ public final class FastFourierTransforme
  */
 @Test
 public void testAdHocData() {
-FastFourierTransformer transformer = new FastFourierTransformer();
+FastFourierTransformer transformer = FastFourierTransformer.create();
 Complex result[]; double tolerance = 1E-12;
 
 double x[] = {1.3, 2.4, 1.7, 4.1, 2.9, 1.7, 5.1, 2.7};
@@ -67,13 +67,14 @@ public final class FastFourierTransforme
 FastFourierTransformer.scaleArray(x2, 1.0 / FastMath.sqrt(x2.length));
 Complex y2[] = y;
 
-result = transformer.transform2(y2);
+transformer = FastFourierTransformer.createUnitary();
+result = transformer.transform(y2);
 for (int i = 0; i < result.length; i++) {
 Assert.assertEquals(x2[i], result[i].getReal(), tolerance);
 Assert.assertEquals(0.0, result[i].getImaginary(), tolerance);
 }
 
-result = transformer.inverseTransform2(x2);
+result = transformer.inverseTransform(x2);
 for (int i = 0; i < result.length; i++) {
 Assert.assertEquals(y2[i].getReal(), result[i].getReal(), 
tolerance);
 Assert.assertEquals(y2[i].getImaginary(), 
result[i].getImaginary(), tolerance);
@@ -82,7 +83,46 @@ public final class FastFourierTransforme
 
 @Test
 public void test2DData() {
-FastFourierTransformer transformer = new FastFourierTransformer();
+FastFourierTransformer transformer = FastFourierTransformer.create();
+double tolerance = 1E-12;
+Complex[][] input = new Complex[][] {new Complex[] {new Complex(1, 0),
+new Complex(2, 0)},
+ new Complex[] {new Complex(3, 1),
+new Complex(4, 
2)}};
+Complex[][] goodOutput = new Complex[][] {new Complex[] {new Complex(5,
+1.5), new Complex(-1, -.5)}, new Complex[] {new Complex(-2,
+-1.5), new Complex(0, .5)}};
+for (int i = 0; i < goodOutput.length; i++) {
+FastFourierTransformer.scaleArray(
+goodOutput[i],
+FastMath.sqrt(goodOutput[i].length) *
+FastMath.sqrt(goodOutput.length));
+}
+Complex[][] output = (Complex[][])transformer.mdfft(input, true);
+Complex[][] output2 = (Complex[][])transformer.mdfft(output, false);
+
+Assert.assertEquals(input.length, output.length);
+Assert.assertEquals(input.length, output2.length);
+Assert.assertEquals(input[0].length, output[0].length);
+Assert.assertEquals(input[0].length, output2[0].length);
+Assert.assertEquals(input[1].length, output[1].length);
+Assert.assertEquals(input[1].length, output2[1].length);
+
+for (int i = 0; i < input.length; i++) {
+for (int j = 0; j < input[0].length; j++) {
+Assert.assertEquals(input[i][j].getImaginary(), 
output2[i][j].getImaginary(),
+ tolerance);
+Assert.assertEquals(input[i][j].getReal(), 
output2[i][j].getReal(), tolerance);
+Assert.assertEquals(goodOutput[i][j].getImaginary(), 
output[i][j].getImaginary(),
+ tolerance);
+Assert.assertEquals(goodOutput[i][j].getReal(), 
output[i][j].getReal(), tolerance);
+}
+}
+}
+
+@Test
+public void test2DDataUnitary() {
+FastFourierTransformer transformer = 
FastFourierTransformer.createUnitary();
 double tolerance = 1E-12;
 Complex[][] input = new Complex[][] {new Complex[] {new Complex(1, 0),
 new Complex(2, 0)},
@@ -119,7 +159,7 @@ public final class FastFourierTransforme
 @Test
 public void testSinFunction() {
 UnivariateFunction f = new SinFunction();
-FastFourierTransformer transformer = new

svn commit: r1211318 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform: FastCosineTransformer.java FastFourierTransformer.java FastSineTransformer.java

2011-12-06 Thread celestin
Author: celestin
Date: Wed Dec  7 07:35:09 2011
New Revision: 1211318

URL: http://svn.apache.org/viewvc?rev=1211318&view=rev
Log:
In package transform, replaced FastFourierTransformer.transform2 and 
FastFourierTransformer.inverseTransform2 with a combination of 
transform()/inverseTransform(), combined with appropriate factory methods 
(MATH-677).

Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java

commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java

commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=1211318&r1=1211317&r2=1211318&view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
 Wed Dec  7 07:35:09 2011
@@ -241,7 +241,7 @@ public class FastCosineTransformer imple
 x[n - i] = a + b;
 t1 += c;
 }
-FastFourierTransformer transformer = new FastFourierTransformer();
+FastFourierTransformer transformer = FastFourierTransformer.create();
 Complex[] y = transformer.transform(x);
 
 // reconstruct the FCT result for the original array

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java?rev=1211318&r1=1211317&r2=1211318&view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
 Wed Dec  7 07:35:09 2011
@@ -32,14 +32,17 @@ import org.apache.commons.math.util.Fast
  * chapter 6.
  * 
  * There are several conventions for the definition of FFT and inverse FFT,
- * mainly on different coefficient and exponent. Here the equations are listed
- * in the comments of the corresponding methods.
+ * mainly on different coefficient and exponent. The conventions adopted in the
+ * present implementation are specified in the comments of the two provided
+ * factory methods, {@link #create()} and {@link #createUnitary()}.
+ * 
  * 
  * We require the length of data set to be power of 2, this greatly simplifies
  * and speeds up the code. Users can pad the data with zeros to meet this
  * requirement. There are other flavors of FFT, for reference, see S. Winograd,
- * On computing the discrete Fourier transform, Mathematics of 
Computation,
- * 32 (1978), 175 - 199.
+ * On computing the discrete Fourier transform, Mathematics of
+ * Computation, 32 (1978), 175 - 199.
+ * 
  *
  * @version $Id$
  * @since 1.2
@@ -49,127 +52,137 @@ public class FastFourierTransformer impl
 /** Serializable version identifier. */
 static final long serialVersionUID = 5138259215438106000L;
 
+
+/**
+ * {@code true} if the orthogonal version of the FFT should be used.
+ *
+ * @see #create()
+ * @see #createUnitary()
+ */
+private final boolean unitary;
+
 /** The roots of unity. */
 private RootsOfUnity roots = new RootsOfUnity();
 
 /** Construct a default transformer. */
-public FastFourierTransformer() {
+private FastFourierTransformer() {
 super();
+this.unitary = false;
 }
 
 /**
- * Transform the given real data set.
- * 
- * The formula is $ y_n = \Sigma_{k=0}^{N-1} e^{-2 \pi i nk/N} x_k $
- * 
+ * Creates a new instance of this class, with various normalization
+ * conventions.
  *
- * @param f the real data array to be transformed
- * @return the complex transformed array
- * @throws IllegalArgumentException if any parameters are invalid
+ * @param unitary {@code false} if the direct Fourier transform is
+ * not to be scaled, {@code true} if it is to be scaled so as to
+ * make the transform unitary.
+ * @see #create()
+ * @see #createUnitary()
  */
-public Complex[] transform(double[] f)
-throws IllegalArgumentException {
-return fft(f, false);
+private FastFourierTransformer(final boolean unitary) {
+this.unitary = unitary;
 }
 
 /**
- * Transform the given real function, sampled on the given interval.
  * 
- * The formula is $ y_n = \Sigma_{k=0}^{N-1} e^{-2 \pi 

svn commit: r1211312 - in /commons/proper/sanselan/trunk/src: main/java/org/apache/sanselan/formats/tiff/ test/data/images/tiff/2/

2011-12-06 Thread damjan
Author: damjan
Date: Wed Dec  7 07:24:02 2011
New Revision: 1211312

URL: http://svn.apache.org/viewvc?rev=1211312&view=rev
Log:
Fix another large offset bug in TIFF parsing,
fix the required fields necessary for bilevel images,
and add a test image for these changes and
the last few parsing changes.


Added:
commons/proper/sanselan/trunk/src/test/data/images/tiff/2/

commons/proper/sanselan/trunk/src/test/data/images/tiff/2/bad-offsets-lengths.asm

commons/proper/sanselan/trunk/src/test/data/images/tiff/2/bad-offsets-lengths.tiff
   (with props)
Modified:

commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java

commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffImageParser.java

Modified: 
commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java
URL: 
http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java?rev=1211312&r1=1211311&r2=1211312&view=diff
==
--- 
commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java
 (original)
+++ 
commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffField.java
 Wed Dec  7 07:24:02 2011
@@ -280,6 +280,7 @@ public class TiffField implements TiffCo
 return;
 
 int valueLength = getValueLengthInBytes();
+long valueLengthLong = 0xL & valueLength;
 
 // Debug.debug("fillInValue tag", tag);
 // Debug.debug("fillInValue tagInfo", tagInfo);
@@ -287,7 +288,7 @@ public class TiffField implements TiffCo
 // Debug.debug("fillInValue valueLength", valueLength);
 
 if (valueOffset < 0 ||
-((long)valueOffset) + ((long)valueLength) > 
byteSource.getLength()) {
+((long)valueOffset) + valueLengthLong > byteSource.getLength()) {
 throw new TiffValueOutsideFileBoundsException(
 "Attempt to read byte range starting from " + valueOffset + " 
" +
 "of length " + valueLength + " " +

Modified: 
commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffImageParser.java?rev=1211312&r1=1211311&r2=1211312&view=diff
==
--- 
commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffImageParser.java
 (original)
+++ 
commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/formats/tiff/TiffImageParser.java
 Wed Dec  7 07:24:02 2011
@@ -224,7 +224,7 @@ public class TiffImageParser extends Ima
 TiffField bitsPerSampleField = directory
 .findField(TIFF_TAG_BITS_PER_SAMPLE);
 
-int bitsPerSample = -1;
+int bitsPerSample = 1;
 if ((bitsPerSampleField != null)
 && (bitsPerSampleField.getValue() != null))
 bitsPerSample = bitsPerSampleField.getIntValueOrArraySum();
@@ -460,13 +460,18 @@ public class TiffImageParser extends Ima
 .getIntValue();
 int height = directory.findField(TIFF_TAG_IMAGE_LENGTH, true)
 .getIntValue();
-int samplesPerPixel = directory.findField(TIFF_TAG_SAMPLES_PER_PIXEL,
-true).getIntValue();
-int bitsPerSample[] = directory.findField(TIFF_TAG_BITS_PER_SAMPLE,
-true).getIntArrayValue();
-// TODO: why are we using bits per sample twice? because one is a sum.
-int bitsPerPixel = directory.findField(TIFF_TAG_BITS_PER_SAMPLE, true)
-.getIntValueOrArraySum();
+int samplesPerPixel = 1;
+TiffField samplesPerPixelField = 
directory.findField(TIFF_TAG_SAMPLES_PER_PIXEL);
+if (samplesPerPixelField != null)
+samplesPerPixel = samplesPerPixelField.getIntValue();
+int bitsPerSample[] = { 1 };
+int bitsPerPixel = samplesPerPixel;
+TiffField bitsPerSampleField = 
directory.findField(TIFF_TAG_BITS_PER_SAMPLE);
+if (bitsPerSampleField != null)
+{
+bitsPerSample = bitsPerSampleField.getIntArrayValue();
+bitsPerPixel = bitsPerSampleField.getIntValueOrArraySum();
+}
 
 // int bitsPerPixel = getTagAsValueOrArraySum(entries,
 // TIFF_TAG_BITS_PER_SAMPLE);

Added: 
commons/proper/sanselan/trunk/src/test/data/images/tiff/2/bad-offsets-lengths.asm
URL: 
http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/data/images/tiff/2/bad-offsets-lengths.asm?rev=1211312&view=auto
==
--- 
commons/proper/sanselan/trunk/src/test/data/images/tiff/2/bad-offsets-lengths.asm
 (added)
+++ 
commons/proper/sanselan/trunk/sr

svn commit: r1211131 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java

2011-12-06 Thread oheger
Author: oheger
Date: Tue Dec  6 20:57:37 2011
New Revision: 1211131

URL: http://svn.apache.org/viewvc?rev=1211131&view=rev
Log:
Java 1.5 compatibility: raw types, etc.

Modified:

commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java

Modified: 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java?rev=1211131&r1=1211130&r2=1211131&view=diff
==
--- 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
 (original)
+++ 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
 Tue Dec  6 20:57:37 2011
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.servlet.ServletRequest;
 
@@ -30,7 +31,7 @@ import javax.servlet.ServletRequest;
  * UnsupportedOperationException.
  *
  * @author mailto:ebo...@apache.org";>Emmanuel Bourg
- * @version $Revision$, $Date$
+ * @version $Id$
  * @since 1.1
  */
 public class ServletRequestConfiguration extends BaseWebConfiguration
@@ -63,13 +64,13 @@ public class ServletRequestConfiguration
 else
 {
 // ensure that escape characters in all list elements are removed
-List result = new ArrayList(values.length);
+List result = new ArrayList(values.length);
 for (int i = 0; i < values.length; i++)
 {
 Object val = handleDelimiters(values[i]);
 if (val instanceof Collection)
 {
-result.addAll((Collection) val);
+result.addAll((Collection) val);
 }
 else
 {
@@ -80,8 +81,11 @@ public class ServletRequestConfiguration
 }
 }
 
-public Iterator getKeys()
+public Iterator getKeys()
 {
-return request.getParameterMap().keySet().iterator();
+// According to the documentation of getParameterMap(), keys are 
Strings.
+@SuppressWarnings("unchecked")
+Map parameterMap = request.getParameterMap();
+return parameterMap.keySet().iterator();
 }
 }




svn commit: r1211130 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java

2011-12-06 Thread oheger
Author: oheger
Date: Tue Dec  6 20:57:19 2011
New Revision: 1211130

URL: http://svn.apache.org/viewvc?rev=1211130&view=rev
Log:
Java 1.5 compatibility: raw types, etc.

Modified:

commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java

Modified: 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java?rev=1211130&r1=1211129&r2=1211130&view=diff
==
--- 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
 (original)
+++ 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
 Tue Dec  6 20:57:19 2011
@@ -18,7 +18,9 @@
 package org.apache.commons.configuration.web;
 
 import java.util.Collections;
+import java.util.Enumeration;
 import java.util.Iterator;
+
 import javax.servlet.FilterConfig;
 
 /**
@@ -27,7 +29,7 @@ import javax.servlet.FilterConfig;
  * UnsupportedOperationException.
  *
  * @author mailto:ebo...@apache.org";>Emmanuel Bourg
- * @version $Revision$, $Date$
+ * @version $Id$
  * @since 1.1
  */
 public class ServletFilterConfiguration extends BaseWebConfiguration
@@ -50,8 +52,12 @@ public class ServletFilterConfiguration 
 return handleDelimiters(config.getInitParameter(key));
 }
 
-public Iterator getKeys()
+public Iterator getKeys()
 {
-return Collections.list(config.getInitParameterNames()).iterator();
+// According to the documentation of getInitParameterNames() the
+// enumeration is of type String.
+@SuppressWarnings("unchecked")
+Enumeration en = config.getInitParameterNames();
+return Collections.list(en).iterator();
 }
 }




svn commit: r1211129 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java

2011-12-06 Thread oheger
Author: oheger
Date: Tue Dec  6 20:57:01 2011
New Revision: 1211129

URL: http://svn.apache.org/viewvc?rev=1211129&view=rev
Log:
Java 1.5 compatibility: raw types, etc.

Modified:

commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java

Modified: 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java?rev=1211129&r1=1211128&r2=1211129&view=diff
==
--- 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
 (original)
+++ 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
 Tue Dec  6 20:57:01 2011
@@ -18,7 +18,9 @@
 package org.apache.commons.configuration.web;
 
 import java.util.Collections;
+import java.util.Enumeration;
 import java.util.Iterator;
+
 import javax.servlet.Servlet;
 import javax.servlet.ServletContext;
 
@@ -28,7 +30,7 @@ import javax.servlet.ServletContext;
  * throw an UnsupportedOperationException.
  *
  * @author mailto:ebo...@apache.org";>Emmanuel Bourg
- * @version $Revision$, $Date$
+ * @version $Id$
  * @since 1.1
  */
 public class ServletContextConfiguration extends BaseWebConfiguration
@@ -63,8 +65,12 @@ public class ServletContextConfiguration
 return handleDelimiters(context.getInitParameter(key));
 }
 
-public Iterator getKeys()
+public Iterator getKeys()
 {
-return Collections.list(context.getInitParameterNames()).iterator();
+// According to the documentation of getInitParameterNames() the
+// enumeration is of type String.
+@SuppressWarnings("unchecked")
+Enumeration en = context.getInitParameterNames();
+return Collections.list(en).iterator();
 }
 }




svn commit: r1211128 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java

2011-12-06 Thread oheger
Author: oheger
Date: Tue Dec  6 20:56:41 2011
New Revision: 1211128

URL: http://svn.apache.org/viewvc?rev=1211128&view=rev
Log:
Java 1.5 compatibility: raw types, etc.

Modified:

commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java

Modified: 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java?rev=1211128&r1=1211127&r2=1211128&view=diff
==
--- 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java
 (original)
+++ 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/ServletConfiguration.java
 Tue Dec  6 20:56:41 2011
@@ -18,7 +18,9 @@
 package org.apache.commons.configuration.web;
 
 import java.util.Collections;
+import java.util.Enumeration;
 import java.util.Iterator;
+
 import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
 
@@ -28,12 +30,12 @@ import javax.servlet.ServletConfig;
  * UnsupportedOperationException.
  *
  * @author mailto:ebo...@apache.org";>Emmanuel Bourg
- * @version $Revision$, $Date$
+ * @version $Id$
  * @since 1.1
  */
 public class ServletConfiguration extends BaseWebConfiguration
 {
-/** Stores a reference to the wrapped ServletConfig.*/
+/** Stores a reference to the wrapped {@code ServletConfig}.*/
 protected ServletConfig config;
 
 /**
@@ -62,8 +64,12 @@ public class ServletConfiguration extend
 return handleDelimiters(config.getInitParameter(key));
 }
 
-public Iterator getKeys()
+public Iterator getKeys()
 {
-return Collections.list(config.getInitParameterNames()).iterator();
+// According to the documentation of getInitParameterNames() the
+// enumeration is of type String.
+@SuppressWarnings("unchecked")
+Enumeration en = config.getInitParameterNames();
+return Collections.list(en).iterator();
 }
 }




svn commit: r1211124 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java

2011-12-06 Thread oheger
Author: oheger
Date: Tue Dec  6 20:56:16 2011
New Revision: 1211124

URL: http://svn.apache.org/viewvc?rev=1211124&view=rev
Log:
Java 1.5 compatibility: raw types, etc.

Modified:

commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java

Modified: 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java?rev=1211124&r1=1211123&r2=1211124&view=diff
==
--- 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java
 (original)
+++ 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/AppletConfiguration.java
 Tue Dec  6 20:56:16 2011
@@ -27,7 +27,7 @@ import java.util.Iterator;
  * UnsupportedOperationException.
  *
  * @author mailto:ebo...@apache.org";>Emmanuel Bourg
- * @version $Revision$, $Date$
+ * @version $Id$
  * @since 1.1
  */
 public class AppletConfiguration extends BaseWebConfiguration
@@ -51,7 +51,7 @@ public class AppletConfiguration extends
 return handleDelimiters(applet.getParameter(key));
 }
 
-public Iterator getKeys()
+public Iterator getKeys()
 {
 String[][] paramsInfo = applet.getParameterInfo();
 String[] keys = new String[paramsInfo != null ? paramsInfo.length : 0];




svn commit: r1211122 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/BaseWebConfiguration.java

2011-12-06 Thread oheger
Author: oheger
Date: Tue Dec  6 20:55:45 2011
New Revision: 1211122

URL: http://svn.apache.org/viewvc?rev=1211122&view=rev
Log:
Java 1.5 compatibility: Javadocs, raw types, etc.

Modified:

commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/BaseWebConfiguration.java

Modified: 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/BaseWebConfiguration.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/BaseWebConfiguration.java?rev=1211122&r1=1211121&r2=1211122&view=diff
==
--- 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/BaseWebConfiguration.java
 (original)
+++ 
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/web/BaseWebConfiguration.java
 Tue Dec  6 20:55:45 2011
@@ -28,10 +28,12 @@ import org.apache.commons.configuration.
  * 
  * This class implements common functionality used by all web based
  * configurations. E.g. some methods are not supported by configurations of 
this
- * type, so they throw a UnsupportedOperationException exception.
+ * type, so they throw a {@code UnsupportedOperationException} exception.
  * 
  *
- * @author Oliver Heger
+ * @author http://commons.apache.org/configuration/team-list.html";>Commons
+ * Configuration team
  * @version $Id$
  * @since 1.2
  */
@@ -39,7 +41,7 @@ abstract class BaseWebConfiguration exte
 {
 /**
  * Checks if this configuration is empty. This implementation makes use of
- * the getKeys() method (which must be defined by concrete
+ * the {@code getKeys()} method (which must be defined by concrete
  * sub classes) to find out whether properties exist.
  *
  * @return a flag whether this configuration is empty
@@ -68,6 +70,7 @@ abstract class BaseWebConfiguration exte
  * @throws UnsupportedOperationException because this operation is not
  * allowed
  */
+@Override
 public void clearProperty(String key)
 {
 throw new UnsupportedOperationException("Read only configuration");
@@ -82,6 +85,7 @@ abstract class BaseWebConfiguration exte
  * @throws UnsupportedOperationException because this operation is not
  * allowed
  */
+@Override
 protected void addPropertyDirect(String key, Object obj)
 {
 throw new UnsupportedOperationException("Read only configuration");
@@ -99,7 +103,7 @@ abstract class BaseWebConfiguration exte
 {
 if (!isDelimiterParsingDisabled() && value instanceof String)
 {
-List list = PropertyConverter.split((String) value,
+List list = PropertyConverter.split((String) value,
 getListDelimiter());
 value = list.size() > 1 ? list : list.get(0);
 }




Nexus: Promotion Completed.

2011-12-06 Thread Nexus Repository Manager
Description:Apache Commons Codec 1.6.Details:The following artifacts have been promoted to the Releases repository.archetype-catalog.xmlcommons-codec-1.6.jarcommons-codec-1.6-javadoc.jarcommons-codec-1.6-sources.jarcommons-codec-1.6-tests.jarcommons-codec-1.6.pom.asccommons-codec-1.6-tests.jar.asccommons-codec-1.6.pomcommons-codec-1.6.jar.asccommons-codec-1.6-javadoc.jar.asccommons-codec-1.6-sources.jar.asc

svn commit: r1210927 [7/7] - in /commons/proper/jexl/trunk: ./ src/main/java/org/apache/commons/jexl3/ src/main/java/org/apache/commons/jexl3/internal/ src/main/java/org/apache/commons/jexl3/internal/

2011-12-06 Thread henrib
Modified: 
commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/UnifiedJEXLTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/UnifiedJEXLTest.java?rev=1210927&r1=1210926&r2=1210927&view=diff
==
--- 
commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/UnifiedJEXLTest.java
 (original)
+++ 
commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/UnifiedJEXLTest.java
 Tue Dec  6 14:19:33 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.jexl3;
 
+import org.apache.commons.jexl3.internal.Engine;
+import org.apache.commons.jexl3.internal.TemplateEngine;
 import java.io.PrintWriter;
 import java.io.StringReader;
 import java.io.StringWriter;
@@ -32,15 +34,11 @@ import org.apache.commons.logging.LogFac
  * Test cases for the UnifiedEL.
  */
 public class UnifiedJEXLTest extends JexlTestCase {
-private static final JexlEngine ENGINE = createEngine(false);
+private static final JexlEngine ENGINE = new 
JexlBuilder().silent(false).cache(128).strict(true).create();
 
-static {
-ENGINE.setSilent(false);
-ENGINE.setCache(128);
-}
-private static final UnifiedJEXL EL = new UnifiedJEXL(ENGINE);
-private static final Log LOG = LogFactory.getLog(UnifiedJEXL.class);
-private JexlContext context = null;
+private static final TemplateEngine EL = new 
TemplateEngine((Engine)ENGINE);
+private static final Log LOG = LogFactory.getLog(JxltEngine.class);
+private JexlEvalContext context = null;
 private Map vars = null;
 
 @Override
@@ -48,7 +46,7 @@ public class UnifiedJEXLTest extends Jex
 // ensure jul logging is only error
 
java.util.logging.Logger.getLogger(org.apache.commons.jexl3.JexlEngine.class.getName()).setLevel(java.util.logging.Level.SEVERE);
 vars = new HashMap();
-context = new MapContext(vars);
+context = new JexlEvalContext(vars);
 }
 
 @Override
@@ -101,7 +99,7 @@ public class UnifiedJEXLTest extends Jex
 
 public void testStatement() throws Exception {
 vars.put("froboz", new Froboz(123));
-UnifiedJEXL.Expression check = EL.parse("${froboz.value = 32; 
froboz.plus10(); froboz.value}");
+JxltEngine.UnifiedExpression check = 
EL.createExpression("${froboz.value = 32; froboz.plus10(); froboz.value}");
 Object o = check.evaluate(context);
 assertEquals("Result is not 42", new Integer(42), o);
 Set> evars = check.getVariables();
@@ -109,8 +107,8 @@ public class UnifiedJEXLTest extends Jex
 }
 
 public void testAssign() throws Exception {
-UnifiedJEXL.Expression assign = EL.parse("${froboz.value = 10}");
-UnifiedJEXL.Expression check = EL.parse("${froboz.value}");
+JxltEngine.UnifiedExpression assign = 
EL.createExpression("${froboz.value = 10}");
+JxltEngine.UnifiedExpression check = 
EL.createExpression("${froboz.value}");
 Object o = assign.evaluate(context);
 assertEquals("Result is not 10", new Integer(10), o);
 o = check.evaluate(context);
@@ -119,7 +117,7 @@ public class UnifiedJEXLTest extends Jex
 
 public void testComposite() throws Exception {
 String source = "Dear ${p} ${name};";
-UnifiedJEXL.Expression expr = EL.parse(source);
+JxltEngine.UnifiedExpression expr = EL.createExpression(source);
 vars.put("p", "Mr");
 vars.put("name", "Doe");
 assertTrue("expression should be immediate", expr.isImmediate());
@@ -134,14 +132,14 @@ public class UnifiedJEXLTest extends Jex
 
 public void testPrepareEvaluate() throws Exception {
 final String source = "Dear #{p} ${name};";
-UnifiedJEXL.Expression expr = EL.parse("Dear #{p} ${name};");
+JxltEngine.UnifiedExpression expr = EL.createExpression("Dear #{p} 
${name};");
 assertTrue("expression should be deferred", expr.isDeferred());
 
 Set> evars = expr.getVariables();
 assertEquals(1, evars.size());
 assertTrue(evars.contains(Arrays.asList("name")));
 vars.put("name", "Doe");
-UnifiedJEXL.Expression phase1 = expr.prepare(context);
+JxltEngine.UnifiedExpression phase1 = expr.prepare(context);
 String as = phase1.asString();
 assertEquals("Dear ${p} Doe;", as);
 Set> evars1 = phase1.getVariables();
@@ -159,7 +157,7 @@ public class UnifiedJEXLTest extends Jex
 
 public void testNested() throws Exception {
 final String source = "#{${hi}+'.world'}";
-UnifiedJEXL.Expression expr = EL.parse(source);
+JxltEngine.UnifiedExpression expr = EL.createExpression(source);
 
 Set> evars = expr.getVariables();
 assertEquals(1, evars.size());
@@ -177,8 +175,8 @@ public class UnifiedJEXLTest extends Jex
 public void testImmediate() throws Exception {
 JexlContext none = null;

svn commit: r1210927 [3/7] - in /commons/proper/jexl/trunk: ./ src/main/java/org/apache/commons/jexl3/ src/main/java/org/apache/commons/jexl3/internal/ src/main/java/org/apache/commons/jexl3/internal/

2011-12-06 Thread henrib
Propchange: 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Engine.java
--
svn:eol-style = native

Copied: 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Interpreter.java
 (from r1209060, 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Interpreter.java)
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Interpreter.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Interpreter.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Interpreter.java&r1=1209060&r2=1210927&rev=1210927&view=diff
==
--- 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/Interpreter.java
 (original)
+++ 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/Interpreter.java
 Tue Dec  6 14:19:33 2011
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl3;
+package org.apache.commons.jexl3.internal;
 
 import java.lang.reflect.Array;
 import java.lang.reflect.InvocationTargetException;
@@ -24,14 +24,18 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.jexl3.parser.SimpleNode;
+import org.apache.commons.jexl3.JexlArithmetic;
+import org.apache.commons.jexl3.JexlContext;
+import org.apache.commons.jexl3.JexlEngine;
+import org.apache.commons.jexl3.JexlException;
+import org.apache.commons.jexl3.JexlScript;
+import org.apache.commons.jexl3.NamespaceResolver;
 import org.apache.commons.logging.Log;
 
 import org.apache.commons.jexl3.parser.JexlNode;
 import org.apache.commons.jexl3.parser.ASTAdditiveNode;
 import org.apache.commons.jexl3.parser.ASTAdditiveOperator;
 import org.apache.commons.jexl3.parser.ASTAndNode;
-import org.apache.commons.jexl3.parser.ASTAmbiguous;
 import org.apache.commons.jexl3.parser.ASTArrayAccess;
 import org.apache.commons.jexl3.parser.ASTArrayLiteral;
 import org.apache.commons.jexl3.parser.ASTAssignment;
@@ -79,7 +83,7 @@ import org.apache.commons.jexl3.parser.A
 import org.apache.commons.jexl3.parser.Node;
 import org.apache.commons.jexl3.parser.ParserVisitor;
 
-import org.apache.commons.jexl3.introspection.Uberspect;
+import org.apache.commons.jexl3.introspection.JexlUberspect;
 import org.apache.commons.jexl3.introspection.JexlMethod;
 import org.apache.commons.jexl3.introspection.JexlPropertyGet;
 import org.apache.commons.jexl3.introspection.JexlPropertySet;
@@ -94,7 +98,7 @@ public class Interpreter extends ParserV
 /** The logger. */
 protected final Log logger;
 /** The uberspect. */
-protected final Uberspect uberspect;
+protected final JexlUberspect uberspect;
 /** The arithmetic handler. */
 protected final JexlArithmetic arithmetic;
 /** The map of registered functions. */
@@ -104,15 +108,17 @@ public class Interpreter extends ParserV
 /** The context to store/retrieve variables. */
 protected final JexlContext context;
 /** Strict interpreter flag. */
-protected final boolean strict;
+protected final boolean strictEngine;
+/** Strict interpreter flag. */
+protected final boolean strictArithmetic;
 /** Silent intepreter flag. */
 protected final boolean silent;
 /** Cache executors. */
 protected final boolean cache;
 /** Registers or arguments. */
-protected Object[] registers = null;
+protected final Object[] registers;
 /** Parameter names if any. */
-protected String[] parameters = null;
+protected final String[] parameters;
 /** Cancellation support. */
 protected volatile boolean cancelled = false;
 /** Empty parameters for method matching. */
@@ -122,63 +128,49 @@ public class Interpreter extends ParserV
  * Creates an interpreter.
  * @param jexl the engine creating this interpreter
  * @param aContext the context to evaluate expression
- * @deprecated 
- */
-@Deprecated
-public Interpreter(JexlEngine jexl, JexlContext aContext) {
-this(jexl, aContext, !jexl.isLenient(), jexl.isSilent());
-}
-
-/**
- * Creates an interpreter.
- * @param jexl the engine creating this interpreter
- * @param aContext the context to evaluate expression
- * @param strictFlag whether this interpreter runs in strict mode
- * @param silentFlag whether this interpreter runs in silent mode
+ * @param frame the engine evaluation frame
  */
-public Interpreter(JexlEngine jexl, JexlContext aContext, boolean 
strictFlag, boolean silentFlag) {
+protected Interpreter(Engine jexl, JexlContext aContext, Engine.Frame 
frame) {
 this.logger = jexl.logger;
 this.uberspect = jexl.uberspect;
-