svn commit: r1222196 - in /commons/proper/sanselan/trunk: ./ src/main/java/org/apache/commons/sanselan/common/ src/main/java/org/apache/commons/sanselan/common/itu_t4/ src/main/java/org/apache/commons
Author: damjan Date: Thu Dec 22 12:12:59 2011 New Revision: 1222196 URL: http://svn.apache.org/viewvc?rev=1222196view=rev Log: Added support for writing all CCITT Group 3 and Group 4 compression types for TIFF, and added exhaustive tests for this. Fixed some row aligned bugs when writing Modified Huffman TIFFs, fixed parsing with TIFFs that use tiles intead of strips, and generally brought the CCITT compression implementation to production quality standards. Added: commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/tiff/TiffCcittTest.java (with props) Modified: commons/proper/sanselan/trunk/RELEASE_NOTES commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BitArrayOutputStream.java commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/itu_t4/T4AndT6Compression.java commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/itu_t4/T4_T6_Tables.java commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/constants/TiffConstants.java commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReader.java commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderStrips.java commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/datareaders/DataReaderTiled.java commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffImageWriterBase.java commons/proper/sanselan/trunk/src/site/xdoc/formatsupport.xml Modified: commons/proper/sanselan/trunk/RELEASE_NOTES URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/RELEASE_NOTES?rev=1222196r1=1222195r2=1222196view=diff == --- commons/proper/sanselan/trunk/RELEASE_NOTES (original) +++ commons/proper/sanselan/trunk/RELEASE_NOTES Thu Dec 22 12:12:59 2011 @@ -42,8 +42,7 @@ Release 0.98 * SANSELAN-46 - allowed all Sanselan tests to pass. * SANSELAN-59 - deleted confusing redefinition of some constants. * Altered TIFF tag searching to do an exact directory match when possible. - * SANSELAN-48 - added support for reading CCITT Modified Huffman, T.4 and T.6 images, -and writing CCITT Modified Huffman images. + * SANSELAN-48 - added support for reading and writing CCITT Modified Huffman, Group 3 and Group 4 images. Release 0.97 Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BitArrayOutputStream.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BitArrayOutputStream.java?rev=1222196r1=1222195r2=1222196view=diff == --- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BitArrayOutputStream.java (original) +++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/BitArrayOutputStream.java Thu Dec 22 12:12:59 2011 @@ -71,6 +71,14 @@ public class BitArrayOutputStream { } } +public int getBitsAvailableInCurrentByte() { +int count = 0; +for (int mask = cacheMask; mask != 0; mask = 1) { +++count; +} +return count; +} + private void writeByte(int b) { if (bytesWritten = buffer.length) { byte[] bigger = new byte[buffer.length * 2]; Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/itu_t4/T4AndT6Compression.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/itu_t4/T4AndT6Compression.java?rev=1222196r1=1222195r2=1222196view=diff == --- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/itu_t4/T4AndT6Compression.java (original) +++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/itu_t4/T4AndT6Compression.java Thu Dec 22 12:12:59 2011 @@ -18,6 +18,7 @@ package org.apache.commons.sanselan.comm import java.io.ByteArrayInputStream; import java.io.IOException; +import java.util.Arrays; import org.apache.commons.sanselan.ImageReadException; import org.apache.commons.sanselan.ImageWriteException; @@ -77,6 +78,30 @@ public class T4AndT6Compression { } } +private static void compress1DLine(BitInputStreamFlexible inputStream, BitArrayOutputStream outputStream, +int[] referenceLine, int width) throws ImageWriteException { +int color = WHITE; +int runLength = 0; +for (int x = 0; x width; x++) { +try { +int nextColor = inputStream.readBits(1); +if
svn commit: r1222297 - /commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/tiff/TiffCcittTest.java
Author: damjan Date: Thu Dec 22 15:57:26 2011 New Revision: 197 URL: http://svn.apache.org/viewvc?rev=197view=rev Log: Take out some test code commmitted by accident. Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/tiff/TiffCcittTest.java Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/tiff/TiffCcittTest.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/tiff/TiffCcittTest.java?rev=197r1=196r2=197view=diff == --- commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/tiff/TiffCcittTest.java (original) +++ commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/tiff/TiffCcittTest.java Thu Dec 22 15:57:26 2011 @@ -18,7 +18,6 @@ package org.apache.commons.sanselan.formats.tiff; import java.awt.image.BufferedImage; -import java.io.FileOutputStream; import java.io.IOException; import java.util.HashMap; @@ -198,10 +197,6 @@ public class TiffCcittTest extends TiffB params.put(SanselanConstants.PARAM_KEY_COMPRESSION, TiffConstants.TIFF_COMPRESSION_CCITT_GROUP_3); params.put(TiffConstants.PARAM_KEY_T4_OPTIONS, 4); byte[] compressed = Sanselan.writeImageToBytes(image, ImageFormat.IMAGE_FORMAT_TIFF, params); -FileOutputStream fos = new FileOutputStream(/tmp/test.tiff); -fos.write(compressed); -fos.close(); - BufferedImage result = Sanselan.getBufferedImage(compressed); compareImages(image, result); } catch (ImageWriteException ex) {
svn commit: r1222360 - in /commons/proper/compress/trunk/src: changes/changes.xml main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Author: bodewig Date: Thu Dec 22 17:22:19 2011 New Revision: 1222360 URL: http://svn.apache.org/viewvc?rev=1222360view=rev Log: throw an IOException rather than a RuntimeException for a certain type of corrupted ZIPs. COMPRESS-169 Modified: commons/proper/compress/trunk/src/changes/changes.xml commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java Modified: commons/proper/compress/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1222360r1=1222359r2=1222360view=diff == --- commons/proper/compress/trunk/src/changes/changes.xml (original) +++ commons/proper/compress/trunk/src/changes/changes.xml Thu Dec 22 17:22:19 2011 @@ -75,6 +75,11 @@ The action type attribute can be add,u The tar package can now use the POSIX/PAX variant for writing entries with names longer than 100 characters. /action + action issue=COMPRESS-169 type=fix date=2011-12-22 +For corrupt archives ZipFile would throw a RuntimeException in +some cases and an IOException in others. It will now +consistently throw an IOException. + /action /release release version=1.3 date=2011-11-01 description=Release 1.3 - API compatible to 1.2 but requires Java5 at runtime Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java?rev=1222360r1=1222359r2=1222360view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java Thu Dec 22 17:22:19 2011 @@ -821,8 +821,8 @@ public class ZipFile { while (lenToSkip 0) { int skipped = archive.skipBytes(lenToSkip); if (skipped = 0) { -throw new RuntimeException(failed to skip file name in - + local file header); +throw new IOException(failed to skip file name in + + local file header); } lenToSkip -= skipped; }
svn commit: r1222388 - in /commons/proper/pool/branches/POOL_1_X: ./ src/java/org/apache/commons/pool/ src/java/org/apache/commons/pool/impl/
Author: ggregory Date: Thu Dec 22 18:28:27 2011 New Revision: 1222388 URL: http://svn.apache.org/viewvc?rev=1222388view=rev Log: Javadoc for generics. Modified: commons/proper/pool/branches/POOL_1_X/pom.xml commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/BaseKeyedObjectPool.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/BaseKeyedPoolableObjectFactory.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/BaseObjectPool.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/BasePoolableObjectFactory.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/KeyedObjectPool.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/KeyedObjectPoolFactory.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/KeyedPoolableObjectFactory.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/ObjectPool.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/ObjectPoolFactory.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/PoolUtils.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/PoolableObjectFactory.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPoolFactory.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericObjectPool.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/GenericObjectPoolFactory.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/StackKeyedObjectPoolFactory.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/StackObjectPool.java commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/impl/StackObjectPoolFactory.java Modified: commons/proper/pool/branches/POOL_1_X/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/POOL_1_X/pom.xml?rev=1222388r1=1222387r2=1222388view=diff == --- commons/proper/pool/branches/POOL_1_X/pom.xml (original) +++ commons/proper/pool/branches/POOL_1_X/pom.xml Thu Dec 22 18:28:27 2011 @@ -22,7 +22,7 @@ parent groupIdorg.apache.commons/groupId artifactIdcommons-parent/artifactId -version20/version +version22/version /parent modelVersion4.0.0/modelVersion groupIdcommons-pool/groupId @@ -124,15 +124,6 @@ /dependency /dependencies - distributionManagement -!-- Cannot define in parent ATM, see COMMONSSITE-26 -- -site - idapache.website/id - nameApache Commons Site/name - url${commons.deployment.protocol}://people.apache.org/www/commons.apache.org/pool/url -/site - /distributionManagement - properties project.build.sourceEncodingUTF-8/project.build.sourceEncoding project.reporting.outputEncodingUTF-8/project.reporting.outputEncoding @@ -144,21 +135,16 @@ commons.jira.pid12310488/commons.jira.pid /properties + distributionManagement +!-- Cannot define in parent ATM, see COMMONSSITE-26 -- +site + idapache.website/id + nameApache Commons Site/name + url${commons.deployment.protocol}://people.apache.org/www/commons.apache.org/${commons.componentid}/url +/site + /distributionManagement + build -pluginManagement - plugins -plugin - !-- Override plugin versions in parent Pom, which are too old to support manifests -- - groupIdorg.apache.maven.plugins/groupId - artifactIdmaven-source-plugin/artifactId - version2.1.2/version -/plugin -plugin - artifactIdmaven-assembly-plugin/artifactId - version2.2.2/version -/plugin - /plugins -/pluginManagement sourceDirectorysrc/java/sourceDirectory testSourceDirectorysrc/test/testSourceDirectory plugins Modified: commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/BaseKeyedObjectPool.java URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/BaseKeyedObjectPool.java?rev=1222388r1=1222387r2=1222388view=diff == --- commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/BaseKeyedObjectPool.java (original) +++ commons/proper/pool/branches/POOL_1_X/src/java/org/apache/commons/pool/BaseKeyedObjectPool.java
svn commit: r1222393 - /commons/proper/pool/branches/POOL_1_X/pom.xml
Author: psteitz Date: Thu Dec 22 18:41:10 2011 New Revision: 1222393 URL: http://svn.apache.org/viewvc?rev=1222393view=rev Log: Removed self from team list. Modified: commons/proper/pool/branches/POOL_1_X/pom.xml Modified: commons/proper/pool/branches/POOL_1_X/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/POOL_1_X/pom.xml?rev=1222393r1=1222392r2=1222393view=diff == --- commons/proper/pool/branches/POOL_1_X/pom.xml (original) +++ commons/proper/pool/branches/POOL_1_X/pom.xml Thu Dec 22 18:41:10 2011 @@ -96,12 +96,6 @@ organizationApache Software Foundation/organization /developer developer - namePhil Steitz/name - idpsteitz/id - email/email - organizationApache Software Foundation/organization -/developer -developer nameGary Gregory/name idggregory/id email/email
svn commit: r1222396 [2/2] - in /commons/proper/pool/branches/POOL_1_X/src: java/org/apache/commons/pool/ java/org/apache/commons/pool/impl/ test/org/apache/commons/pool/ test/org/apache/commons/pool/
Modified: commons/proper/pool/branches/POOL_1_X/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/POOL_1_X/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java?rev=1222396r1=1222395r2=1222396view=diff == --- commons/proper/pool/branches/POOL_1_X/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java (original) +++ commons/proper/pool/branches/POOL_1_X/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java Thu Dec 22 19:02:25 2011 @@ -37,14 +37,17 @@ public class TestStackObjectPool extends super(testName); } +@Override protected ObjectPoolString makeEmptyPool(int mincap) { return new StackObjectPoolString(new SimpleFactory()); } +@Override protected ObjectPoolInteger makeEmptyPool(final PoolableObjectFactoryInteger factory) { return new StackObjectPoolInteger(factory); } +@Override protected String getNthObject(int n) { return String.valueOf(n); } @@ -67,6 +70,7 @@ public class TestStackObjectPool extends /** * @deprecated - to be removed in pool 2.0 */ +@Deprecated public void testPoolWithNullFactory() throws Exception { ObjectPoolInteger pool = new StackObjectPoolInteger(10); for(int i=0;i10;i++) { @@ -93,6 +97,7 @@ public class TestStackObjectPool extends /** * @deprecated - to be removed in pool 2.0 */ +@Deprecated public void testBorrowFromEmptyPoolWithNullFactory() throws Exception { ObjectPoolObject pool = new StackObjectPoolObject(); try { @@ -106,6 +111,8 @@ public class TestStackObjectPool extends /** * @deprecated - to be removed in pool 2.0 */ +@Deprecated +@Override public void testSetFactory() throws Exception { ObjectPoolString pool = new StackObjectPoolString(); try { @@ -123,6 +130,7 @@ public class TestStackObjectPool extends /** * @deprecated - to be removed in pool 2.0 */ +@Deprecated public void testCantResetFactoryWithActiveObjects() throws Exception { ObjectPoolString pool = new StackObjectPoolString(); pool.setFactory(new SimpleFactory()); @@ -140,6 +148,7 @@ public class TestStackObjectPool extends /** * @deprecated - to be removed in pool 2.0 */ +@Deprecated public void testCanResetFactoryWithoutActiveObjects() throws Exception { ObjectPoolString pool = new StackObjectPoolString(); { @@ -460,6 +469,7 @@ public class TestStackObjectPool extends * Verifies close contract - idle instances are destroyed, returning instances * are destroyed, add/borrowObject throw IllegalStateException. */ +@Override public void testClose() throws Exception { SelectiveFactory factory = new SelectiveFactory(); ObjectPoolInteger pool = new StackObjectPoolInteger(factory); @@ -611,10 +621,12 @@ public class TestStackObjectPool extends } } +@Override protected boolean isLifo() { return true; } +@Override protected boolean isFifo() { return false; } Modified: commons/proper/pool/branches/POOL_1_X/src/test/org/apache/commons/pool/impl/TestStackObjectPoolFactory.java URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/POOL_1_X/src/test/org/apache/commons/pool/impl/TestStackObjectPoolFactory.java?rev=1222396r1=1222395r2=1222396view=diff == --- commons/proper/pool/branches/POOL_1_X/src/test/org/apache/commons/pool/impl/TestStackObjectPoolFactory.java (original) +++ commons/proper/pool/branches/POOL_1_X/src/test/org/apache/commons/pool/impl/TestStackObjectPoolFactory.java Thu Dec 22 19:02:25 2011 @@ -33,6 +33,7 @@ public class TestStackObjectPoolFactory super(name); } +@Override protected ObjectPoolFactoryInteger makeFactory(final PoolableObjectFactoryInteger objectFactory) throws UnsupportedOperationException { return new StackObjectPoolFactoryInteger(objectFactory); }
svn commit: r1222445 - in /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration: BaseNonStringProperties.java NonStringTestHolder.java TestCompositeConfigurationNonStringP
Author: oheger Date: Thu Dec 22 20:53:47 2011 New Revision: 1222445 URL: http://svn.apache.org/viewvc?rev=1222445view=rev Log: Converted tests to junit 4, fixed warnings. Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonStringTestHolder.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCompositeConfigurationNonStringProperties.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestNonStringProperties.java Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java?rev=1222445r1=1222444r2=1222445view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java Thu Dec 22 20:53:47 2011 @@ -1,5 +1,3 @@ -package org.apache.commons.configuration; - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -16,32 +14,37 @@ package org.apache.commons.configuration * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.commons.configuration; + +import static org.junit.Assert.assertEquals; -import junit.framework.TestCase; +import org.junit.Test; /** * Test if non-string properties are handled correctly. * * @version $Id$ */ -public abstract class BaseNonStringProperties extends TestCase +public abstract class BaseNonStringProperties { protected NonStringTestHolder nonStringTestHolder = new NonStringTestHolder(); -public abstract void setUp() throws Exception; -public Configuration conf = null; +protected Configuration conf; +@Test public void testBoolean() throws Exception { nonStringTestHolder.testBoolean(); } +@Test public void testBooleanDefaultValue() throws Exception { nonStringTestHolder.testBooleanDefaultValue(); } +@Test public void testBooleanArrayValue() throws Exception { boolean booleanValue = conf.getBoolean(test.boolean); @@ -49,11 +52,13 @@ public abstract class BaseNonStringPrope assertEquals(2, conf.getList(test.boolean.array).size()); } +@Test public void testByte() throws Exception { nonStringTestHolder.testByte(); } +@Test public void testByteArrayValue() throws Exception { byte testValue = 10; @@ -62,16 +67,19 @@ public abstract class BaseNonStringPrope assertEquals(2, conf.getList(test.byte.array).size()); } +@Test public void testDouble() throws Exception { nonStringTestHolder.testDouble(); } +@Test public void testDoubleDefaultValue() throws Exception { nonStringTestHolder.testDoubleDefaultValue(); } +@Test public void testDoubleArrayValue() throws Exception { double testValue = 10.25; @@ -80,17 +88,20 @@ public abstract class BaseNonStringPrope assertEquals(2, conf.getList(test.double.array).size()); } +@Test public void testFloat() throws Exception { nonStringTestHolder.testFloat(); } +@Test public void testFloatDefaultValue() throws Exception { nonStringTestHolder.testFloatDefaultValue(); } +@Test public void testFloatArrayValue() throws Exception { float testValue = (float) 20.25; @@ -99,16 +110,19 @@ public abstract class BaseNonStringPrope assertEquals(2, conf.getList(test.float.array).size()); } +@Test public void testInteger() throws Exception { nonStringTestHolder.testInteger(); } +@Test public void testIntegerDefaultValue() throws Exception { nonStringTestHolder.testIntegerDefaultValue(); } +@Test public void testIntegerArrayValue() throws Exception { int intValue = conf.getInt(test.integer); @@ -116,14 +130,19 @@ public abstract class BaseNonStringPrope assertEquals(2, conf.getList(test.integer.array).size()); } +@Test public void testLong() throws Exception { nonStringTestHolder.testLong(); } + +@Test public void testLongDefaultValue() throws Exception { nonStringTestHolder.testLongDefaultValue(); } + +@Test public void
svn commit: r1222446 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/ConfigurationErrorListenerImpl.java
Author: oheger Date: Thu Dec 22 20:57:32 2011 New Revision: 1222446 URL: http://svn.apache.org/viewvc?rev=1222446view=rev Log: Replaced author tag. Now using new JUnit 4 asserts. Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/ConfigurationErrorListenerImpl.java Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/ConfigurationErrorListenerImpl.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/ConfigurationErrorListenerImpl.java?rev=1222446r1=1222445r2=1222446view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/ConfigurationErrorListenerImpl.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/ConfigurationErrorListenerImpl.java Thu Dec 22 20:57:32 2011 @@ -16,17 +16,20 @@ */ package org.apache.commons.configuration; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import org.apache.commons.configuration.event.ConfigurationErrorEvent; import org.apache.commons.configuration.event.ConfigurationErrorListener; /** - * An implementation of the codeConfigurationErrorListener/code interface + * An implementation of the {@code ConfigurationErrorListener} interface * that can be used in unit tests. This implementation just records received * events and allows to test whether expected errors occurred. * - * @author Oliver Heger + * @author a + * href=http://commons.apache.org/configuration/team-list.html;Commons + * Configuration team/a * @version $Id$ */ public class ConfigurationErrorListenerImpl implements @@ -75,7 +78,7 @@ public class ConfigurationErrorListenerI */ public void verify() { -Assert.assertEquals(Error events received, 0, errorCount); +assertEquals(Error events received, 0, errorCount); } /** @@ -89,12 +92,12 @@ public class ConfigurationErrorListenerI */ public void verify(int type, String propName, Object propValue) { -Assert.assertEquals(Wrong number of error events, 1, errorCount); -Assert.assertEquals(Wrong event type, type, event.getType()); -Assert.assertTrue(Wrong property name, (propName == null) ? event +assertEquals(Wrong number of error events, 1, errorCount); +assertEquals(Wrong event type, type, event.getType()); +assertTrue(Wrong property name, (propName == null) ? event .getPropertyName() == null : propName.equals(event .getPropertyName())); -Assert.assertTrue(Wrong property value, (propValue == null) ? event +assertTrue(Wrong property value, (propValue == null) ? event .getPropertyValue() == null : propValue.equals(event .getPropertyValue())); }
svn commit: r1222447 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/DatabaseConfigurationTestHelper.java
Author: oheger Date: Thu Dec 22 20:59:44 2011 New Revision: 1222447 URL: http://svn.apache.org/viewvc?rev=1222447view=rev Log: Javadoc Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/DatabaseConfigurationTestHelper.java Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/DatabaseConfigurationTestHelper.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/DatabaseConfigurationTestHelper.java?rev=1222447r1=1222446r2=1222447view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/DatabaseConfigurationTestHelper.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/DatabaseConfigurationTestHelper.java Thu Dec 22 20:59:44 2011 @@ -106,7 +106,7 @@ public class DatabaseConfigurationTestHe /** * Initializes this helper object. This method can be called from a - * codesetUp()/code method of a unit test class. It creates the database + * {@code setUp()} method of a unit test class. It creates the database * instance if necessary. * * @throws Exception if an error occurs @@ -119,7 +119,7 @@ public class DatabaseConfigurationTestHe /** * Frees the resources used by this helper class. This method can be called - * by a codetearDown()/code method of a unit test class. + * by a {@code tearDown()} method of a unit test class. * * @throws Exception if an error occurs */ @@ -168,10 +168,10 @@ public class DatabaseConfigurationTestHe } /** - * Returns the codeDataSource/code managed by this class. The data + * Returns the {@code DataSource} managed by this class. The data * source is created on first access. * - * @return the codeDataSource/code + * @return the {@code DataSource} */ public DataSource getDatasource() {
svn commit: r1222450 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/FileURLStreamHandler.java
Author: oheger Date: Thu Dec 22 21:01:33 2011 New Revision: 1222450 URL: http://svn.apache.org/viewvc?rev=1222450view=rev Log: Replaced SVN tags, added @Override annotations. Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/FileURLStreamHandler.java Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/FileURLStreamHandler.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/FileURLStreamHandler.java?rev=1222450r1=1222449r2=1222450view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/FileURLStreamHandler.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/FileURLStreamHandler.java Thu Dec 22 21:01:33 2011 @@ -32,25 +32,29 @@ import java.net.URLStreamHandler; * standard URLs. This handler acts like a file handler with write support. * * @author Emmanuel Bourg - * @version $Revision$, $Date$ + * @version $Id$ */ public class FileURLStreamHandler extends URLStreamHandler { +@Override protected URLConnection openConnection(URL u) throws IOException { final File file = new File(u.getFile()); return new URLConnection(u) { +@Override public void connect() throws IOException { } +@Override public InputStream getInputStream() throws IOException { return new FileInputStream(file); } +@Override public OutputStream getOutputStream() throws IOException { return new FileOutputStream(file);
svn commit: r1222452 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/InterpolationTestHelper.java
Author: oheger Date: Thu Dec 22 21:06:17 2011 New Revision: 1222452 URL: http://svn.apache.org/viewvc?rev=1222452view=rev Log: Now using new JUnit 4 asserts. Fixed warnings. Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/InterpolationTestHelper.java Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/InterpolationTestHelper.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/InterpolationTestHelper.java?rev=1222452r1=1222451r2=1222452view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/InterpolationTestHelper.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/InterpolationTestHelper.java Thu Dec 22 21:06:17 2011 @@ -16,11 +16,12 @@ */ package org.apache.commons.configuration; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import java.awt.event.KeyEvent; import java.util.List; -import junit.framework.Assert; - import org.apache.commons.configuration.interpol.ConfigurationInterpolator; import org.apache.commons.lang.text.StrLookup; @@ -29,7 +30,9 @@ import org.apache.commons.lang.text.StrL * interpolation. It can be used for running these tests on different * configuration implementations. * - * @author Oliver Heger + * @author a + * href=http://commons.apache.org/configuration/team-list.html;Commons + * Configuration team/a * @version $Id$ */ public class InterpolationTestHelper @@ -47,19 +50,19 @@ public class InterpolationTestHelper config.setProperty(dbFailedInterpolate, unInterpolatedValue); String dbProp = /home/applicationRoot/db/hypersonic; -Assert.assertEquals(Checking interpolated variable, dbProp, config +assertEquals(Checking interpolated variable, dbProp, config .getString(db)); -Assert.assertEquals(lookup fails, leave variable as is, config +assertEquals(lookup fails, leave variable as is, config .getString(dbFailedInterpolate), unInterpolatedValue); config.setProperty(arrayInt, ${applicationRoot}/1); String[] arrayInt = config.getStringArray(arrayInt); -Assert.assertEquals(check first entry was interpolated, +assertEquals(check first entry was interpolated, /home/applicationRoot/1, arrayInt[0]); config.addProperty(path, /temp,C:\\Temp,/usr/local/tmp); config.setProperty(path.current, ${path}); -Assert.assertEquals(Interpolation with multi-valued property, +assertEquals(Interpolation with multi-valued property, /temp, config.getString(path.current)); } @@ -82,8 +85,7 @@ public class InterpolationTestHelper String expectedValue = /base-level/first-level/second-level/third-level; -Assert -.assertEquals(config.getString(test.third-level), +assertEquals(config.getString(test.third-level), expectedValue); } @@ -101,8 +103,7 @@ public class InterpolationTestHelper try { config.getString(test.a); -Assert -.fail(IllegalStateException should have been thrown for looped property references); +fail(IllegalStateException should have been thrown for looped property references); } catch (IllegalStateException e) { @@ -120,12 +121,12 @@ public class InterpolationTestHelper { config.addProperty(test.a, new Integer(42)); config.addProperty(test.b, ${test.a}); -Assert.assertEquals(Wrong interpolated value, 42, config +assertEquals(Wrong interpolated value, 42, config .getInt(test.b)); Configuration subset = config.subset(test); -Assert.assertEquals(Wrong string property, 42, subset +assertEquals(Wrong string property, 42, subset .getString(b)); -Assert.assertEquals(Wrong int property, 42, subset.getInt(b)); +assertEquals(Wrong int property, 42, subset.getInt(b)); } /** @@ -136,7 +137,7 @@ public class InterpolationTestHelper public static void testInterpolationUnknownProperty(Configuration config) { config.addProperty(test.interpol, ${unknown.property}); -Assert.assertEquals(Wrong interpolated unknown property, +assertEquals(Wrong interpolated unknown property, ${unknown.property}, config.getString(test.interpol)); } @@ -156,7 +157,7 @@ public class InterpolationTestHelper for (int i = 0; i sysProperties.length; i++) { -Assert.assertEquals(Wrong value for system property +assertEquals(Wrong value for system
svn commit: r1222455 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java
Author: oheger Date: Thu Dec 22 21:10:10 2011 New Revision: 1222455 URL: http://svn.apache.org/viewvc?rev=1222455view=rev Log: Javadoc. Fixed warning. Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java?rev=1222455r1=1222454r2=1222455view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/MockInitialContextFactory.java Thu Dec 22 21:10:10 2011 @@ -29,7 +29,7 @@ import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; /** - * A mock implementation of the codeInitialContextFactory/code interface. + * A mock implementation of the {@code InitialContextFactory} interface. * This implementation will return a mock context that contains some test data. * * @author a @@ -75,14 +75,14 @@ public class MockInitialContextFactory i { missing/list, test/imaginarykey, foo/bar }; /** - * Creates a codeContext/code object that is backed by a mock object. + * Creates a {@code Context} object that is backed by a mock object. * The mock context can be queried for the values of certain test * properties. It also supports listing the contained (sub) properties. * * @param env the environment * @return the context mock */ -public Context getInitialContext(Hashtable env) throws NamingException +public Context getInitialContext(@SuppressWarnings(rawtypes) Hashtable env) throws NamingException { boolean useCycles = env.containsKey(PROP_CYCLES); @@ -146,7 +146,7 @@ public class MockInitialContextFactory i bindError(mockCtx, MISSING_NAMES[i]); } mockCtx.matchAndReturn(hashCode, System.identityHashCode(mockCtx.proxy())); - + return mockCtx; }
svn commit: r1222456 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonCloneableConfiguration.java
Author: oheger Date: Thu Dec 22 21:11:39 2011 New Revision: 1222456 URL: http://svn.apache.org/viewvc?rev=1222456view=rev Log: Raw types. Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonCloneableConfiguration.java Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonCloneableConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonCloneableConfiguration.java?rev=1222456r1=1222455r2=1222456view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonCloneableConfiguration.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonCloneableConfiguration.java Thu Dec 22 21:11:39 2011 @@ -31,6 +31,7 @@ public class NonCloneableConfiguration e /** * Dummy implementation of this method. */ +@Override protected void addPropertyDirect(String key, Object value) { } @@ -54,7 +55,7 @@ public class NonCloneableConfiguration e /** * Dummy implementation of this method. */ -public Iterator getKeys() +public IteratorString getKeys() { return null; }
svn commit: r1222465 - in /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration: ./ web/
Author: oheger Date: Thu Dec 22 21:32:56 2011 New Revision: 1222465 URL: http://svn.apache.org/viewvc?rev=1222465view=rev Log: Converted tests to JUnit 4, fixed warnings. Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestMapConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestAppletConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestServletConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestServletContextConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestServletFilterConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/web/TestServletRequestConfiguration.java Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfiguration.java?rev=1222465r1=1222464r2=1222465view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfiguration.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfiguration.java Thu Dec 22 21:32:56 2011 @@ -17,23 +17,31 @@ package org.apache.commons.configuration; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import junit.framework.TestCase; import junitx.framework.ListAssert; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.Test; /** * Abstract TestCase for implementations of {@link AbstractConfiguration}. * * @author Emmanuel Bourg - * @version $Revision$, $Date$ + * @version $Id$ */ -public abstract class TestAbstractConfiguration extends TestCase +public abstract class TestAbstractConfiguration { /** * Return an abstract configuration with the following data:br @@ -51,6 +59,7 @@ public abstract class TestAbstractConfig */ protected abstract AbstractConfiguration getEmptyConfiguration(); +@Test public void testGetProperty() { Configuration config = getConfiguration(); @@ -59,11 +68,12 @@ public abstract class TestAbstractConfig assertNull(key3, config.getProperty(key3)); } +@Test public void testList() { Configuration config = getConfiguration(); -List list = config.getList(list); +List? list = config.getList(list); assertNotNull(list not found, config.getProperty(list)); assertEquals(list size, 2, list.size()); assertTrue('value1' is not in the list, list.contains(value1)); @@ -74,12 +84,14 @@ public abstract class TestAbstractConfig * Tests whether the escape character for list delimiters is recocknized and * removed. */ +@Test public void testListEscaped() { assertEquals(Wrong value for escaped list, value1,value2, getConfiguration().getString(listesc)); } +@Test public void testAddPropertyDirect() { AbstractConfiguration config = getConfiguration(); @@ -88,10 +100,10 @@ public abstract class TestAbstractConfig config.addPropertyDirect(key3, value4); config.addPropertyDirect(key3, value5); -List list = config.getList(key3); +ListObject list = config.getList(key3); assertNotNull(no list found for the 'key3' property, list); -List expected = new ArrayList(); +ListObject expected = new ArrayListObject(); expected.add(value3); expected.add(value4); expected.add(value5); @@ -99,6 +111,7 @@ public abstract class TestAbstractConfig ListAssert.assertEquals(values for the 'key3' property, expected, list); } +@Test public void testIsEmpty() { Configuration config = getConfiguration(); @@ -106,6 +119,7 @@ public abstract class TestAbstractConfig assertTrue(the configuration is not empty, getEmptyConfiguration().isEmpty()); } +@Test public void testContainsKey() { Configuration config = getConfiguration(); @@ -113,6 +127,7 @@ public
svn propchange: r1221490 - svn:log
Author: psteitz Revision: 1221490 Modified property: svn:log Modified: svn:log at Fri Dec 23 03:22:28 2011 -- --- svn:log (original) +++ svn:log Fri Dec 23 03:22:28 2011 @@ -4,5 +4,6 @@ for extreme values and changed its contr are infinite or NaN. JIRA: MATH-724 -Reported and patched by Dennis Hendricks +Reported and patched by Dennis Hendriks +
svn propchange: r1213130 - svn:log
Author: psteitz Revision: 1213130 Modified property: svn:log Modified: svn:log at Fri Dec 23 03:27:58 2011 -- --- svn:log (original) +++ svn:log Fri Dec 23 03:27:58 2011 @@ -1 +1 @@ -Made RandomDataImpl consistently use a Well generator as the default random generator. This completes the fix for JIRA: MATH-701. The inconsistency was reported by Dennis Hendricks in JIRA: MATH-720. +Made RandomDataImpl consistently use a Well generator as the default random generator. This completes the fix for JIRA: MATH-701. The inconsistency was reported by Dennis Hendriks in JIRA: MATH-720.
svn commit: r1222588 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: GenericKeyedObjectPool.java GenericObjectPool.java
Author: psteitz Date: Fri Dec 23 07:17:03 2011 New Revision: 1222588 URL: http://svn.apache.org/viewvc?rev=1222588view=rev Log: Javadoc. Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1222588r1=1222587r2=1222588view=diff == --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java (original) +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java Fri Dec 23 07:17:03 2011 @@ -763,7 +763,7 @@ public class GenericKeyedObjectPoolK,T * {@link #getBlockWhenExhausted()} is true./p * * @param key pool key - * @param borrowMaxWait + * @param borrowMaxWait maximum amount of time to wait (in milliseconds) * @return object instance from the keyed pool * @throws NoSuchElementException if a keyed object instance cannot be returned. */ @@ -993,6 +993,8 @@ public class GenericKeyedObjectPoolK,T * @param key pool key * @param obj instance to invalidate * @throws Exception if an exception occurs destroying the object + * @throws IllegalStateException if obj does not belong to the pool + * under the given key */ public void invalidateObject(K key, T obj) throws Exception { Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1222588r1=1222587r2=1222588view=diff == --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java (original) +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java Fri Dec 23 07:17:03 2011 @@ -919,9 +919,9 @@ public class GenericObjectPoolT extend * destroy the instance. * /p * - * @throws Exception - * if the configured {@link PoolableObjectFactory} throws an - * exception destroying obj + * @throws Exception if the configured {@link PoolableObjectFactory} throws an + * exception destroying obj + * @throws IllegalStateException if obj does not belong to this pool */ @Override public void invalidateObject(T obj) throws Exception {