svn commit: r1158533 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/ java/org/apache/commons/runtime/io/ java/org/apache/commons/runtime/util/ java/org/apache/commons/ru
Author: mturk Date: Wed Aug 17 06:06:42 2011 New Revision: 1158533 URL: http://svn.apache.org/viewvc?rev=1158533view=rev Log: Do not use long for Pointer length Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Streamable.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Inflater.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Utils.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Bzip2.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Bzip2Deflater.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Bzip2Impl.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Bzip2Inflater.java commons/sandbox/runtime/trunk/src/main/native/include/acr/pointer.h commons/sandbox/runtime/trunk/src/main/native/shared/bzip2.c commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java?rev=1158533r1=1158532r2=1158533view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java Wed Aug 17 06:06:42 2011 @@ -99,7 +99,6 @@ public abstract class Pointer implements return PLENGTH; } - /** * Check if the pointer is valid * @return true if the internal pointer is not {@code NULL}. Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Streamable.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Streamable.java?rev=1158533r1=1158532r2=1158533view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Streamable.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Streamable.java Wed Aug 17 06:06:42 2011 @@ -27,7 +27,7 @@ public interface Streamable extends Devi { /** - * Test if this stream supports read operations. + * Test whether this stream supports read operations. * * @return {@code true} if the read operations are * supported, {@code false} otherwise. @@ -35,7 +35,7 @@ public interface Streamable extends Devi public boolean canRead(); /** - * Test if this stream supports write operations. + * Test whether this stream supports write operations. * * @return {@code true} if the write operations are * supported, {@code false} otherwise. @@ -43,7 +43,7 @@ public interface Streamable extends Devi public boolean canWrite(); /** - * Test if this stream supports seek operations. + * Test whether this stream supports seek operations. * * @return {@code true} if the seek operations are * supported, {@code false} otherwise. Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java?rev=1158533r1=1158532r2=1158533view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java Wed Aug 17 06:06:42 2011 @@ -176,7 +176,7 @@ public abstract class Deflater implement * @param len the length of the input data * @throws InvalidArgumentException if the provided parameters are invalid */ -public abstract void setInput(Pointer b, long off, long len) +public abstract void setInput(Pointer b, long off, int len) throws InvalidArgumentException; /** @@ -190,9 +190,10 @@ public abstract class Deflater implement public void setInput(Pointer b) throws InvalidArgumentException { -if (b == null) -throw new NullPointerException(); -setInput(b, 0L, b.sizeof()); +int len = Utils.unsignedInteger(b.sizeof()); +if (len 1) +throw new InvalidArgumentException(); +setInput(b, 0L, len); } /** @@ -223,6 +224,8 @@ public abstract class
svn commit: r1158534 - /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FilterStream.java
Author: mturk Date: Wed Aug 17 06:08:54 2011 New Revision: 1158534 URL: http://svn.apache.org/viewvc?rev=1158534view=rev Log: Add base FilterStream class Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FilterStream.java (with props) Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FilterStream.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FilterStream.java?rev=1158534view=auto == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FilterStream.java (added) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FilterStream.java Wed Aug 17 06:08:54 2011 @@ -0,0 +1,170 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.commons.runtime.io; + +import java.io.IOException; +import java.io.SyncFailedException; +import java.nio.ByteBuffer; +import org.apache.commons.runtime.Pointer; + +/** + * Bidirectional Filter Stream. + * p + * This class is combination of the Java FilterInputStream and + * FilterOutputStream minus mark interface. + * /p + */ +public abstract class FilterStream +extends Stream +{ + +/** + * Stream to be filtered. + */ +protected Stream stream; + +/** + * Creates a new object instance. + */ +protected FilterStream(Stream s) +{ +stream = s; +} + +/** + * Returns the number of bytes that are available before this stream will + * block. + * This method simply performs {@code stream.available()}. + * + * @return the number of bytes available before blocking. + * @throws IOException + * if an error occurs in this stream. + * @see Stream#available() + */ +public int available() +throws IOException +{ +return stream.available(); +} + +/** + * Closes the object and release any system resources it holds. If the + * object has already been closed, then invoking this method has no effect. + * This method simply performs {@code stream.close()}. + * + * @throws IOException + * if any error occurs when closing the object. + * @see Stream#close() + */ +public void close() +throws IOException +{ +stream.close(); +} + +/** + * Flush the underlying stream metadata. + * This method simply performs {@code stream.available()}. + * + * @throws SyncFailedException when the object cannot be flushed. + * @throws IOException if an I/O error occurs. + * @see Stream#flush() + */ +public void flush() +throws SyncFailedException, IOException +{ +stream.flush(); +} + +/** + * Sync the underlying stream by writing any buffered data. + * This method simply performs {@code stream.sync()}. + * + * @throws SyncFailedException when the object cannot be flushed. + * @throws IOException if an I/O error occurs. + * @see Stream#sync() + */ +public void sync() +throws SyncFailedException, IOException +{ +stream.sync(); +} + +/** + * Test if {@code this} stream is valid. + * This method simply performs {@code stream.valid()}. + * + * @return {@code true} if the stream represents a valid, + * open file, socket, or other I/O object; {@code false} otherwse. + * + * @see Stream#valid() + */ +public boolean valid() +{ +return stream.valid(); +} + +/** + * Test wather or not every I/O operation on {@code this} stream will + * block until it completes. + * This method simply performs {@code stream.isBlocking()}. + * + * @return {@code true} if, and only if, this stream + * is in blocking mode. + * + * @throws IOException if an I/O error occurs. + * @see Stream#isBlocking() + */ +public boolean isBlocking() +throws IOException +{ +return stream.isBlocking(); +} + +/** + * Skips over {@code count} bytes in this stream. Less than
svn commit: r1158543 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/io/ java/org/apache/commons/runtime/net/ java/org/apache/commons/runtime/util/ java/org/apache/common
Author: mturk Date: Wed Aug 17 06:58:53 2011 New Revision: 1158543 URL: http://svn.apache.org/viewvc?rev=1158543view=rev Log: Axe extra off param to functions expecting native address represented as long Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Reader.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Writer.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/IpcStream.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketStream.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Inflater.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Utils.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Bzip2.java commons/sandbox/runtime/trunk/src/main/native/os/unix/sockstream.c commons/sandbox/runtime/trunk/src/main/native/os/win32/ipcsstream.c commons/sandbox/runtime/trunk/src/main/native/os/win32/sockstream.c commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Reader.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Reader.java?rev=1158543r1=1158542r2=1158543view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Reader.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Reader.java Wed Aug 17 06:58:53 2011 @@ -185,6 +185,38 @@ public interface Reader throws NullPointerException, IndexOutOfBoundsException, IOException; /** + * Reads at most {@code count} bytes from the current position in + * this stream and stores them in the memory pointed by {@code address}. + * Blocks until {@code count} bytes have + * been read, the end of the stream is reached or an exception is thrown. + * + * @param address + * The native address in which to store the bytes read from + * this reader. + * @param count + * The maximum number of bytes to store in {@code address}. + * + * @return The number of bytes actually read or {@code -1} if the end of + * the stream has been reached. + * + * @throws NullPointerException + * If {@code pointer} is {@code null}. + * @throws IndexOutOfBoundsException + * If {@code offset 0}. + * @throws ClosedDescriptorException + * If this file is closed. + * @throws OperationWouldBlockException + * If the stream is in nonblocking mode and the operation + * would block. + * @throws TimeoutException + * If read operation times out. + * @throws IOException + * If some other I/O error occurs. + */ +public int read(long address, int count) +throws NullPointerException, IndexOutOfBoundsException, IOException; + +/** * Reads bytes from the current position in this stream and stores them * in the {@code ByteBuffer} {@code buffer}. The maximum number of bytes * read corresponds to the size of {@code buffer}. Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java?rev=1158543r1=1158542r2=1158543view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java Wed Aug 17 06:58:53 2011 @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.SyncFailedException; import java.nio.ByteBuffer; import org.apache.commons.runtime.Pointer; +import org.apache.commons.runtime.util.Utils; /** * Bidirectional Stream. @@ -184,7 +185,18 @@ public abstract class Stream { if (!canRead()) throw new OperationNotSupportedException(); -return read(pointer, 0L, (int)pointer.sizeof()); +return read(pointer.address(), Utils.toInteger(pointer.sizeof())); +} + +@Override +public final int read(Pointer pointer, long off, int count) +throws IOException +{ +if (!canRead()) +throw new OperationNotSupportedException(); +if (off + count pointer.sizeof()) +throw new IndexOutOfBoundsException(); +
svn commit: r1158657 - in /commons/proper/pool/trunk/src: java/org/apache/commons/pool2/impl/ test/org/apache/commons/pool2/impl/
Author: markt Date: Wed Aug 17 12:34:56 2011 New Revision: 1158657 URL: http://svn.apache.org/viewvc?rev=1158657view=rev Log: Replace WhenExhuastedAction with a boolean since it only has two values Removed: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java 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 commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java?rev=1158657r1=1158656r2=1158657view=diff == --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java (original) +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java Wed Aug 17 12:34:56 2011 @@ -73,10 +73,9 @@ public abstract class BaseObjectPoolConf public static final long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS = -1L; /** - * The default when exhausted action for the pool. + * The default block when exhausted value for the pool. */ -public static final WhenExhaustedAction DEFAULT_WHEN_EXHAUSTED_ACTION = -WhenExhaustedAction.BLOCK; +public static final boolean DEFAULT_BLOCK_WHEN_EXHAUSTED = true; private boolean lifo = DEFAULT_LIFO; @@ -97,8 +96,7 @@ public abstract class BaseObjectPoolConf private long timeBetweenEvictionRunsMillis = DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS; -private WhenExhaustedAction whenExhaustedAction = -DEFAULT_WHEN_EXHAUSTED_ACTION; +private boolean blockWhenExhausted = DEFAULT_BLOCK_WHEN_EXHAUSTED; public boolean getLifo() { return lifo; @@ -164,11 +162,11 @@ public abstract class BaseObjectPoolConf this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; } -public WhenExhaustedAction getWhenExhaustedAction() { -return whenExhaustedAction; +public boolean getBlockWhenExhausted() { +return blockWhenExhausted; } -public void setWhenExhaustedAction(WhenExhaustedAction whenExhaustedAction) { -this.whenExhaustedAction = whenExhaustedAction; +public void setBlockWhenExhausted(boolean blockWhenExhausted) { +this.blockWhenExhausted = blockWhenExhausted; } } 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=1158657r1=1158656r2=1158657view=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 Wed Aug 17 12:34:56 2011 @@ -240,7 +240,7 @@ public class GenericKeyedObjectPoolK,T this._testWhileIdle = config.getTestWhileIdle(); this._timeBetweenEvictionRunsMillis = config.getTimeBetweenEvictionRunsMillis(); -this._whenExhaustedAction = config.getWhenExhaustedAction(); +this.blockWhenExhausted = config.getBlockWhenExhausted(); startEvictor(getMinEvictableIdleTimeMillis()); } @@ -304,8 +304,8 @@ public class GenericKeyedObjectPoolK,T * @return the action to take when exhausted * @see #setWhenExhaustedAction */ -public WhenExhaustedAction getWhenExhaustedAction() { -return _whenExhaustedAction; +public boolean getBlockWhenExhausted() { +return blockWhenExhausted; } /** @@ -316,8 +316,8 @@ public class GenericKeyedObjectPoolK,T * @param whenExhaustedAction the action to take when exhausted * @see #getWhenExhaustedAction */ -public void setWhenExhaustedAction(WhenExhaustedAction whenExhaustedAction) { -_whenExhaustedAction = whenExhaustedAction; +public void setBlockWhenExhausted(boolean whenExhaustedAction) { +blockWhenExhausted = whenExhaustedAction; } @@ -597,7 +597,7 @@ public class GenericKeyedObjectPoolK,T
svn commit: r1158659 - in /commons/proper/dbcp/trunk/src: java/org/apache/commons/dbcp2/ java/org/apache/commons/dbcp2/cpdsadapter/ java/org/apache/commons/dbcp2/datasources/ java/org/apache/commons/d
Author: markt Date: Wed Aug 17 12:37:26 2011 New Revision: 1158659 URL: http://svn.apache.org/viewvc?rev=1158659view=rev Log: Update DBCP 2 after changes in pool 2 Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/SharedPoolDataSource.java commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/managed/PoolableManagedConnectionFactory.java commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp2/TestAbandonedObjectPool.java Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java?rev=1158659r1=1158658r2=1158659view=diff == --- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java (original) +++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolableConnectionFactory.java Wed Aug 17 12:37:26 2011 @@ -27,7 +27,6 @@ import org.apache.commons.pool2.Poolable import org.apache.commons.pool2.ObjectPool; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; -import org.apache.commons.pool2.impl.WhenExhaustedAction; /** * A {@link PoolableObjectFactory} that creates @@ -187,7 +186,7 @@ public class PoolableConnectionFactory GenericKeyedObjectPoolConfigPStmtKey,DelegatingPreparedStatement config = new GenericKeyedObjectPoolConfigPStmtKey,DelegatingPreparedStatement(); config.setMaxTotalPerKey(-1); -config.setWhenExhaustedAction(WhenExhaustedAction.FAIL); +config.setBlockWhenExhausted(false); config.setMaxWait(0); config.setMaxIdlePerKey(1); config.setMaxTotal(maxOpenPreparedStatements); Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java?rev=1158659r1=1158658r2=1158659view=diff == --- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java (original) +++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/DriverAdapterCPDS.java Wed Aug 17 12:37:26 2011 @@ -38,7 +38,6 @@ import org.apache.commons.dbcp2.Poolable import org.apache.commons.pool2.KeyedObjectPool; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; -import org.apache.commons.pool2.impl.WhenExhaustedAction; /** * p @@ -195,7 +194,7 @@ public class DriverAdapterCPDS GenericKeyedObjectPoolConfigPStmtKeyCPDS,PoolablePreparedStatementPStmtKeyCPDS,PoolablePreparedStatementStub config = new GenericKeyedObjectPoolConfigPStmtKeyCPDS,PoolablePreparedStatementPStmtKeyCPDS,PoolablePreparedStatementStub(); config.setMaxTotalPerKey(Integer.MAX_VALUE); -config.setWhenExhaustedAction(WhenExhaustedAction.FAIL); +config.setBlockWhenExhausted(false); config.setMaxWait(0); config.setMaxIdlePerKey(getMaxIdle()); if (getMaxPreparedStatements() = 0) Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java?rev=1158659r1=1158658r2=1158659view=diff == --- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java (original) +++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/PerUserPoolDataSource.java Wed Aug 17 12:37:26 2011 @@ -33,7 +33,6 @@ import javax.sql.ConnectionPoolDataSourc import org.apache.commons.pool2.ObjectPool; import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; -import org.apache.commons.pool2.impl.WhenExhaustedAction; /** * pA pooling codeDataSource/code appropriate for deployment within @@ -529,11 +528,11 @@ public class PerUserPoolDataSource pool.setMaxIdle(maxIdle); pool.setMaxWait(maxWait); if (maxTotal = 0) { -pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL); +
svn commit: r1158660 - in /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime: io/Stream.java util/Deflater.java util/Inflater.java util/bzip2/Bzip2.java util/bzip2/Bzip2Deflater.j
Author: mturk Date: Wed Aug 17 12:37:43 2011 New Revision: 1158660 URL: http://svn.apache.org/viewvc?rev=1158660view=rev Log: Add direct native pointer methods Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Inflater.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Bzip2.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Bzip2Deflater.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/bzip2/Bzip2Inflater.java Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java?rev=1158660r1=1158659r2=1158660view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Stream.java Wed Aug 17 12:37:43 2011 @@ -196,6 +196,8 @@ public abstract class Stream throw new OperationNotSupportedException(); if (off + count pointer.sizeof()) throw new IndexOutOfBoundsException(); +if (pointer.isNull()) +throw new NullPointerException(); return read(pointer.address() + off, count); } @@ -234,6 +236,8 @@ public abstract class Stream throw new OperationNotSupportedException(); if (off + count pointer.sizeof()) throw new IndexOutOfBoundsException(); +if (pointer.isNull()) +throw new NullPointerException(); return write(pointer.address() + off, count); } Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java?rev=1158660r1=1158659r2=1158660view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java Wed Aug 17 12:37:43 2011 @@ -119,7 +119,7 @@ public abstract class Deflater implement */ public abstract void flush() throws IllegalStateException; - + /** * Sets the input buffer the {@code Deflater} will use to extract * uncompressed bytes for later compression. @@ -148,8 +148,6 @@ public abstract class Deflater implement public void setInput(byte[] b) throws InvalidArgumentException { -if (b == null) -throw new NullPointerException(); if (b.length 1) throw new InvalidArgumentException(); setInput(b, 0, b.length); @@ -172,12 +170,33 @@ public abstract class Deflater implement * returns {@code true} indicating that more input data is required. * * @param b pointer to the input data bytes. - * @param off the start offset of the input data * @param len the length of the input data * @throws InvalidArgumentException if the provided parameters are invalid */ -public abstract void setInput(Pointer b, long off, int len) +public abstract void setInput(long b, int len) throws InvalidArgumentException; + +/** + * Set input data for compression. + * This should be called whenever the {@code needsInput()} + * returns {@code true} indicating that more input data is required. + * + * @param b pointer to the input data bytes. + * @param off the start offset of the input data + * @param len the length of the input data + * @throws InvalidArgumentException if the provided parameters are invalid + */ +public void setInput(Pointer b, long off, int len) +throws InvalidArgumentException +{ +if (b.isNull()) +throw new NullPointerException(); +if (len 1) +throw new InvalidArgumentException(); +if (off 0L || off + len b.sizeof()) +throw new IndexOutOfBoundsException(); +setInput(b.address() + off, len); +} /** * Set input data for compression. @@ -190,10 +209,12 @@ public abstract class Deflater implement public void setInput(Pointer b) throws InvalidArgumentException { +if (b.isNull()) +throw new NullPointerException(); int len = Utils.toInteger(b.sizeof()); if (len 1) throw new InvalidArgumentException(); -setInput(b,
svn commit: r1158662 - in /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util: Deflater.java Inflater.java
Author: mturk Date: Wed Aug 17 12:40:19 2011 New Revision: 1158662 URL: http://svn.apache.org/viewvc?rev=1158662view=rev Log: Make derived methods final Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Inflater.java Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java?rev=1158662r1=1158661r2=1158662view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Deflater.java Wed Aug 17 12:40:19 2011 @@ -145,7 +145,7 @@ public abstract class Deflater implement * @param b the input data bytes. * @throws InvalidArgumentException if the provided parameters are invalid */ -public void setInput(byte[] b) +public final void setInput(byte[] b) throws InvalidArgumentException { if (b.length 1) @@ -186,7 +186,7 @@ public abstract class Deflater implement * @param len the length of the input data * @throws InvalidArgumentException if the provided parameters are invalid */ -public void setInput(Pointer b, long off, int len) +public final void setInput(Pointer b, long off, int len) throws InvalidArgumentException { if (b.isNull()) @@ -206,7 +206,7 @@ public abstract class Deflater implement * @param b pointer to the input data bytes. * @throws InvalidArgumentException if the provided parameters are invalid */ -public void setInput(Pointer b) +public final void setInput(Pointer b) throws InvalidArgumentException { if (b.isNull()) @@ -281,7 +281,7 @@ public abstract class Deflater implement * @throws InvalidDataException if the provided data was invalid * @throws OutOfMemoryError if the memory allocation failed */ -public int deflate(byte[] b) +public final int deflate(byte[] b) throws InvalidArgumentException, InvalidDataException, OutOfMemoryError @@ -339,7 +339,7 @@ public abstract class Deflater implement * @throws InvalidDataException if the input data was invalid or corrupt. * @throws OutOfMemoryError if the memory allocation failed */ -public int deflate(Pointer b, long off, int len) +public final int deflate(Pointer b, long off, int len) throws InvalidArgumentException, InvalidDataException, OutOfMemoryError @@ -365,7 +365,7 @@ public abstract class Deflater implement * @throws InvalidDataException if the provided data was invalid * @throws OutOfMemoryError if the memory allocation failed */ -public int deflate(Pointer b) +public final int deflate(Pointer b) throws InvalidArgumentException, InvalidDataException, OutOfMemoryError Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Inflater.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Inflater.java?rev=1158662r1=1158661r2=1158662view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Inflater.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/util/Inflater.java Wed Aug 17 12:40:19 2011 @@ -117,7 +117,7 @@ public abstract class Inflater implement * * @throws InvalidArgumentException if the provided parameters are invalid */ -public void setInput(byte[] b) +public final void setInput(byte[] b) throws InvalidArgumentException { if (b.length 1) @@ -161,7 +161,7 @@ public abstract class Inflater implement * * @throws InvalidArgumentException if the provided parameters are invalid */ -public void setInput(Pointer b, long off, int len) +public final void setInput(Pointer b, long off, int len) throws InvalidArgumentException { if (b.isNull()) @@ -181,7 +181,7 @@ public abstract class Inflater implement * * @throws InvalidArgumentException if the provided parameters are invalid */ -public void setInput(Pointer b) +public final void setInput(Pointer b) throws InvalidArgumentException { if (b.isNull()) @@ -264,7 +264,7 @@ public abstract class Inflater implement * @throws InvalidDataException if the provided data was invalid * @throws OutOfMemoryError if the memory allocation failed */ -
svn commit: r1158665 - /commons/proper/dbcp/trunk/src/changes/changes.xml
Author: markt Date: Wed Aug 17 12:43:31 2011 New Revision: 1158665 URL: http://svn.apache.org/viewvc?rev=1158665view=rev Log: Fix errors Modified: commons/proper/dbcp/trunk/src/changes/changes.xml Modified: commons/proper/dbcp/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/changes/changes.xml?rev=1158665r1=1158664r2=1158665view=diff == --- commons/proper/dbcp/trunk/src/changes/changes.xml (original) +++ commons/proper/dbcp/trunk/src/changes/changes.xml Wed Aug 17 12:43:31 2011 @@ -60,13 +60,13 @@ The action type attribute can be add,u /action /release action dev=markt type=update -Updated source code for Java 1.6 (added @Override @Deprecated +Updated source code for Java 1.6 (added @Override amp; @Deprecated annotations). /action action dev=markt type=update Removed JOCL support. /action - action dev=markt type=update + action dev=markt type=update Remove deprecated SQLNestedException. /action release version=1.4.1 date=TBD description=TBD
svn commit: r1158672 - /commons/proper/dbcp/trunk/pom.xml
Author: sebb Date: Wed Aug 17 12:48:29 2011 New Revision: 1158672 URL: http://svn.apache.org/viewvc?rev=1158672view=rev Log: Might as well use latest version of JUnit now Modified: commons/proper/dbcp/trunk/pom.xml Modified: commons/proper/dbcp/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/pom.xml?rev=1158672r1=1158671r2=1158672view=diff == --- commons/proper/dbcp/trunk/pom.xml (original) +++ commons/proper/dbcp/trunk/pom.xml Wed Aug 17 12:48:29 2011 @@ -155,7 +155,7 @@ dependency groupIdjunit/groupId artifactIdjunit/artifactId - version3.8.2/version + version4.8.2/version scopetest/scope /dependency
svn commit: r1158678 - in /commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2: PoolingConnection.java cpdsadapter/PStmtKeyCPDS.java cpdsadapter/PooledConnectionImpl.java datasources/KeyedCPDS
Author: sebb Date: Wed Aug 17 12:55:44 2011 New Revision: 1158678 URL: http://svn.apache.org/viewvc?rev=1158678view=rev Log: Javadoc fixes Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/datasources/KeyedCPDSConnectionFactory.java Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java?rev=1158678r1=1158677r2=1158678view=diff == --- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java (original) +++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/PoolingConnection.java Wed Aug 17 12:55:44 2011 @@ -275,7 +275,7 @@ public class PoolingConnection extends D * The codestmtType/code field in the key determines whether * a PoolablePreparedStatement or PoolableCallableStatement is created. * - * @param obj the key for the {@link PreparedStatement} to be created + * @param key the key for the {@link PreparedStatement} to be created * @see #createKey(String, int, int, byte) */ @Override @@ -308,7 +308,7 @@ public class PoolingConnection extends D * Closes the underlying statement. * * @param key ignored - * @param obj the pooled statement to be destroyed. + * @param dps the pooled statement to be destroyed. */ @Override public void destroyObject(PStmtKey key, DelegatingPreparedStatement dps) @@ -335,7 +335,7 @@ public class PoolingConnection extends D * pooled statements. * * @param key ignored - * @param obj pooled statement to be activated + * @param dps pooled statement to be activated */ @Override public void activateObject(PStmtKey key, @@ -349,7 +349,7 @@ public class PoolingConnection extends D * Invokes {@link PreparedStatement#clearParameters}. * * @param key ignored - * @param obj a {@link PreparedStatement} + * @param dps a {@link PreparedStatement} */ @Override public void passivateObject(PStmtKey key, Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java?rev=1158678r1=1158677r2=1158678view=diff == --- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java (original) +++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PStmtKeyCPDS.java Wed Aug 17 12:55:44 2011 @@ -21,7 +21,7 @@ import java.util.Arrays; import org.apache.commons.dbcp2.PStmtKey; /** - * A key uniquely identifying {@link PreparedStatement}s. + * A key uniquely identifying a {@link java.sql.PreparedStatement PreparedStatement}. */ public class PStmtKeyCPDS extends PStmtKey { private Integer _autoGeneratedKeys = null; Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java?rev=1158678r1=1158677r2=1158678view=diff == --- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java (original) +++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/cpdsadapter/PooledConnectionImpl.java Wed Aug 17 12:55:44 2011 @@ -424,7 +424,7 @@ class PooledConnectionImpl implements Po /** * My {*link KeyedPoolableObjectFactory} method for creating * {*link PreparedStatement}s. - * @param obj the key for the {*link PreparedStatement} to be created + * @param key the key for the {*link PreparedStatement} to be created */ @Override public PoolablePreparedStatementPStmtKeyCPDS,PoolablePreparedStatementStub makeObject(PStmtKeyCPDS key) throws Exception { @@ -458,7 +458,7 @@ class PooledConnectionImpl implements Po * My {*link KeyedPoolableObjectFactory} method for destroying * {*link PreparedStatement}s. * @param key ignored - * @param obj the {*link PreparedStatement} to be destroyed. + * @param ppss the {*link PreparedStatement} to be destroyed. */ @Override public void destroyObject(PStmtKeyCPDS key, PoolablePreparedStatementPStmtKeyCPDS,PoolablePreparedStatementStub ppss) @@ -470,7 +470,7 @@ class
svn commit: r1158716 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
Author: erans Date: Wed Aug 17 14:00:56 2011 New Revision: 1158716 URL: http://svn.apache.org/viewvc?rev=1158716view=rev Log: MATH-621 Function altmov: All local variables defined at initialization. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java?rev=1158716r1=1158715r2=1158716view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java Wed Aug 17 14:00:56 2011 @@ -1304,40 +1304,17 @@ public class BOBYQAOptimizer final ArrayRealVector work1 = new ArrayRealVector(n); final ArrayRealVector work2 = new ArrayRealVector(n); -double alpha = Double.NaN; -double cauchy = Double.NaN; - -// System generated locals -double d__1, d__2, d__3, d__4; - -// Local variables -double ha, gw, diff; -int ilbd, isbd; -double slbd; -int iubd; -double vlag, subd, temp; -int ksav = 0; -double step = 0, curv = 0; -int iflag; -double scale = 0, csave = 0, tempa = 0, tempb = 0, tempd = 0, const__ = 0, sumin = 0, -ggfree = 0; -int ibdsav = 0; -double dderiv = 0, bigstp = 0, predsq = 0, presav = 0, distsq = 0, stpsav = 0, wfixsq = 0, wsqsav = 0; - - -// Function Body -const__ = ONE + Math.sqrt(2.); for (int k = 0; k npt; k++) { hcol.setEntry(k, ZERO); } for (int j = 0, max = npt - n - 1; j max; j++) { -temp = zmat.getEntry(knew, j); +final double tmp = zmat.getEntry(knew, j); for (int k = 0; k npt; k++) { -hcol.setEntry(k, hcol.getEntry(k) + temp * zmat.getEntry(k, j)); +hcol.setEntry(k, hcol.getEntry(k) + tmp * zmat.getEntry(k, j)); } } -alpha = hcol.getEntry(knew); -ha = HALF * alpha; +final double alpha = hcol.getEntry(knew); +final double ha = HALF * alpha; // Calculate the gradient of the KNEW-th Lagrange function at XOPT. @@ -1345,13 +1322,13 @@ public class BOBYQAOptimizer glag.setEntry(i, bmat.getEntry(knew, i)); } for (int k = 0; k npt; k++) { -temp = ZERO; +double tmp = ZERO; for (int j = 0; j n; j++) { -temp += xpt.getEntry(k, j) * xopt.getEntry(j); +tmp += xpt.getEntry(k, j) * xopt.getEntry(j); } -temp = hcol.getEntry(k) * temp; +tmp *= hcol.getEntry(k); for (int i = 0; i n; i++) { -glag.setEntry(i, glag.getEntry(i) + temp * xpt.getEntry(k, i)); +glag.setEntry(i, glag.getEntry(i) + tmp * xpt.getEntry(k, i)); } } @@ -1361,50 +1338,52 @@ public class BOBYQAOptimizer // set to the square of the predicted denominator for each line. PRESAV // will be set to the largest admissible value of PREDSQ that occurs. -presav = ZERO; +double presav = ZERO; +double step = Double.NaN; +int ksav = 0; +int ibdsav = 0; +double stpsav = 0; for (int k = 0; k npt; k++) { if (k == trustRegionCenterInterpolationPointIndex) { continue; } -dderiv = ZERO; -distsq = ZERO; +double dderiv = ZERO; +double distsq = ZERO; for (int i = 0; i n; i++) { -temp = xpt.getEntry(k, i) - xopt.getEntry(i); -dderiv += glag.getEntry(i) * temp; -distsq += temp * temp; -} -subd = adelt / Math.sqrt(distsq); -slbd = -subd; -ilbd = 0; -iubd = 0; -sumin = Math.min(ONE, subd); +final double tmp = xpt.getEntry(k, i) - xopt.getEntry(i); +dderiv += glag.getEntry(i) * tmp; +distsq += tmp * tmp; +} +double subd = adelt / Math.sqrt(distsq); +double slbd = -subd; +int ilbd = 0; +int iubd = 0; +final double sumin = Math.min(ONE, subd); // Revise SLBD and SUBD if necessary because of the bounds in SL and SU. for (int i = 0; i n; i++) { -temp = xpt.getEntry(k, i) - xopt.getEntry(i); -if (temp ZERO) { -if (slbd * temp sl.getEntry(i) - xopt.getEntry(i)) {
svn commit: r1158720 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java
Author: markt Date: Wed Aug 17 14:02:50 2011 New Revision: 1158720 URL: http://svn.apache.org/viewvc?rev=1158720view=rev Log: Make isClosed public to align with non-keyed pool Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java?rev=1158720r1=1158719r2=1158720view=diff == --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java (original) +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/BaseKeyedObjectPool.java Wed Aug 17 14:02:50 2011 @@ -132,7 +132,7 @@ public abstract class BaseKeyedObjectPoo * @return codetrue/code when this pool has been closed. * @since Pool 1.4 */ -protected final boolean isClosed() { +public final boolean isClosed() { return closed; }
svn commit: r1158723 - in /commons/proper/compress/trunk/src: main/java/org/apache/commons/compress/archivers/dump/ test/java/org/apache/commons/compress/archivers/
Author: bodewig Date: Wed Aug 17 14:07:12 2011 New Revision: 1158723 URL: http://svn.apache.org/viewvc?rev=1158723view=rev Log: make extraction tests pass for dump. COMPRESS-132 Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java?rev=1158723r1=1158722r2=1158723view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java Wed Aug 17 14:07:12 2011 @@ -654,6 +654,13 @@ public class DumpArchiveEntry implements * Returns the size of the entry. */ public long getSize() { +return isDirectory() ? SIZE_UNKNOWN : size; +} + +/** + * Returns the size of the entry as read from the archive. + */ +long getEntrySize() { return size; } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java?rev=1158723r1=1158722r2=1158723view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java Wed Aug 17 14:07:12 2011 @@ -250,7 +250,7 @@ public class DumpArchiveInputStream exte readIdx = active.getHeaderCount(); } else { entryOffset = 0; -entrySize = active.getSize(); +entrySize = active.getEntrySize(); readIdx = 0; } @@ -277,7 +277,7 @@ public class DumpArchiveInputStream exte */ private void readDirectoryEntry(DumpArchiveEntry entry) throws IOException { -long size = entry.getSize(); +long size = entry.getEntrySize(); boolean first = true; while (first || Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java?rev=1158723r1=1158722r2=1158723view=diff == --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java Wed Aug 17 14:07:12 2011 @@ -94,11 +94,11 @@ public final class DumpTestCase extends } } -public void XtestCheckArchive() throws Exception { +public void testCheckArchive() throws Exception { checkDumpArchive(getFile(bla.dump)); } -public void XtestCheckCompressedArchive() throws Exception { +public void testCheckCompressedArchive() throws Exception { checkDumpArchive(getFile(bla.z.dump)); }
svn commit: r1158731 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: BaseObjectPoolConfig.java GenericKeyedObjectPool.java
Author: sebb Date: Wed Aug 17 14:20:50 2011 New Revision: 1158731 URL: http://svn.apache.org/viewvc?rev=1158731view=rev Log: Javadoc fixes Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java?rev=1158731r1=1158730r2=1158731view=diff == --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java (original) +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java Wed Aug 17 14:20:50 2011 @@ -34,8 +34,7 @@ public abstract class BaseObjectPoolConf /** * The default maximum amount of time (in milliseconds) the * {@code borrowObject} method should block before throwing an exception - * when the pool is exhausted and the {@link #getWhenExhaustedAction - * when exhausted action} is {@link WhenExhaustedAction#BLOCK}. + * when the pool is exhausted and {@link #getBlockWhenExhausted} is true. */ public static final long DEFAULT_MAX_WAIT = -1L; 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=1158731r1=1158730r2=1158731view=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 Wed Aug 17 14:20:50 2011 @@ -78,18 +78,18 @@ import org.apache.commons.pool2.PoolUtil *default setting for this parameter is 8. * /li * li - *{@link #setWhenExhaustedAction whenExhaustedAction} specifies the + *{@link #getBlockWhenExhausted} specifies the *behavior of the {@link #borrowObject borrowObject} method when a keyed *pool is exhausted: *ul *li - * When {@link #setWhenExhaustedAction whenExhaustedAction} is - * {@link WhenExhaustedAction#FAIL}, {@link #borrowObject borrowObject} will throw + * When {@link #getBlockWhenExhausted} is false, + * {@link #borrowObject borrowObject} will throw * a {@link NoSuchElementException} */li *li - * When {@link #setWhenExhaustedAction whenExhaustedAction} - * is {@link WhenExhaustedAction#BLOCK}, {@link #borrowObject borrowObject} will block + * When {@link #getBlockWhenExhausted} is true, + * {@link #borrowObject borrowObject} will block * (invoke {@link Object#wait() wait} until a new or idle object is available. * If a positive {@link #setMaxWait maxWait} * value is supplied, the {@link #borrowObject borrowObject} will block for at @@ -98,8 +98,7 @@ import org.apache.commons.pool2.PoolUtil * the {@link #borrowObject borrowObject} method will block indefinitely. */li */ul - *The default codewhenExhaustedAction/code setting is - *{@link WhenExhaustedAction#BLOCK}. + *The default {@link #getBlockWhenExhausted()} setting is true. * /li * li *When {@link #setTestOnBorrow testOnBorrow} is set, the pool will @@ -297,27 +296,27 @@ public class GenericKeyedObjectPoolK,T } /** - * Returns the action to take when the {@link #borrowObject} method + * Returns whether to block when the {@link #borrowObject} method * is invoked when the pool is exhausted (the maximum number * of active objects has been reached). * - * @return the action to take when exhausted - * @see #setWhenExhaustedAction + * @return true if the pool should block + * @see #setBlockWhenExhausted */ public boolean getBlockWhenExhausted() { return blockWhenExhausted; } /** - * Sets the action to take when the {@link #borrowObject} method + * Sets whether to block when the {@link #borrowObject} method * is invoked when the pool is exhausted (the maximum number * of active objects has been reached). * - * @param whenExhaustedAction the action to take when exhausted - * @see #getWhenExhaustedAction + * @param shouldBlock true if the pool should block + * @see #getBlockWhenExhausted */ -public void setBlockWhenExhausted(boolean whenExhaustedAction) { -blockWhenExhausted = whenExhaustedAction; +public void setBlockWhenExhausted(boolean shouldBlock) { +blockWhenExhausted = shouldBlock; } @@ -325,16 +324,14 @@ public class
svn commit: r1158736 - in /commons/proper/pool/trunk/src: changes/ java/org/apache/commons/pool2/impl/
Author: markt Date: Wed Aug 17 14:28:40 2011 New Revision: 1158736 URL: http://svn.apache.org/viewvc?rev=1158736view=rev Log: Expose GOP and GKOP attributes over JMX. Added: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolMBean.java (with props) commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPoolMBean.java (with props) Modified: commons/proper/pool/trunk/src/changes/changes.xml commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java 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/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1158736r1=1158735r2=1158736view=diff == --- commons/proper/pool/trunk/src/changes/changes.xml (original) +++ commons/proper/pool/trunk/src/changes/changes.xml Wed Aug 17 14:28:40 2011 @@ -74,6 +74,9 @@ action dev=markt type=fix issue=POOL-178 Re-factor common code into common base classes. /action +action dev=markt type=update issue=POOL-172 + Expose GOP and GKOP attributes via JMX. +/action /release release version=1.5.6 date=2011-04-03 description=This is a patch release, including bugfixes only. action dev=markt type=fix issue=POOL-179 due-to=Axel Grossmann Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java?rev=1158736r1=1158735r2=1158736view=diff == --- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java (original) +++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java Wed Aug 17 14:28:40 2011 @@ -75,7 +75,15 @@ public abstract class BaseObjectPoolConf * The default block when exhausted value for the pool. */ public static final boolean DEFAULT_BLOCK_WHEN_EXHAUSTED = true; - + +public static final boolean DEFAULT_JMX_ENABLE = true; + +/** + * The default prefix to use for the name component of the JMX object name + * under which the pool will be registered. + */ +public static final String DEFAULT_JMX_NAME_PREFIX = pool; + private boolean lifo = DEFAULT_LIFO; private long maxWait = DEFAULT_MAX_WAIT; @@ -97,6 +105,10 @@ public abstract class BaseObjectPoolConf private boolean blockWhenExhausted = DEFAULT_BLOCK_WHEN_EXHAUSTED; +private boolean jmxEnabled = DEFAULT_JMX_ENABLE; + +private String jmxNamePrefix = DEFAULT_JMX_NAME_PREFIX; + public boolean getLifo() { return lifo; } @@ -168,4 +180,20 @@ public abstract class BaseObjectPoolConf public void setBlockWhenExhausted(boolean blockWhenExhausted) { this.blockWhenExhausted = blockWhenExhausted; } + +public boolean isJmxEnabled() { +return jmxEnabled; +} + +public void setJmxEnabled(boolean jmxEnabled) { +this.jmxEnabled = jmxEnabled; +} + +public String getJmxNamePrefix() { +return jmxNamePrefix; +} + +public void setJmxNamePrefix(String jmxNamePrefix) { +this.jmxNamePrefix = jmxNamePrefix; +} } 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=1158736r1=1158735r2=1158736view=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 Wed Aug 17 14:28:40 2011 @@ -17,7 +17,9 @@ package org.apache.commons.pool2.impl; +import java.lang.management.ManagementFactory; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -33,6 +35,13 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; +import javax.management.InstanceAlreadyExistsException; +import javax.management.MBeanRegistrationException; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.NotCompliantMBeanException; +import javax.management.ObjectName; + import org.apache.commons.pool2.BaseKeyedObjectPool; import
svn commit: r1158746 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: GenericKeyedObjectPool.java GenericObjectPool.java
Author: sebb Date: Wed Aug 17 14:40:51 2011 New Revision: 1158746 URL: http://svn.apache.org/viewvc?rev=1158746view=rev Log: Javadoc fixes 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=1158746r1=1158745r2=1158746view=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 Wed Aug 17 14:40:51 2011 @@ -190,8 +190,8 @@ import org.apache.commons.pool2.PoolUtil * /ul * p * GenericKeyedObjectPool is not usable without a {@link KeyedPoolableObjectFactory}. A - * non-codenull/code factory must be provided either as a constructor argument - * or via a call to {@link #setFactory setFactory} before the pool is used. + * non-codenull/code factory must be provided as a constructor argument + * before the pool is used. * /p * p * Implementation note: To prevent possible deadlocks, care has been taken to @@ -1437,7 +1437,7 @@ public class GenericKeyedObjectPoolK,T * * @param key the key a new instance should be added to * @throws Exception when {@link KeyedPoolableObjectFactory#makeObject} fails. - * @throws IllegalStateException when no {@link #setFactory factory} has been set or after {@link #close} has been + * @throws IllegalStateException when no factory has been set or after {@link #close} has been * called on this pool. */ @Override 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=1158746r1=1158745r2=1158746view=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 Wed Aug 17 14:40:51 2011 @@ -60,14 +60,13 @@ import org.apache.commons.pool2.Poolable * to the number of objects that may be idle at one time. The default setting * for this parameter is 8./li * li - *{@link #setWhenExhaustedAction iwhenExhaustedAction/i} specifies the + *{@link #getBlockWhenExhausted} specifies the * behavior of the {@link #borrowObject} method when the pool is exhausted: * ul - * liWhen {@link #setWhenExhaustedAction iwhenExhaustedAction/i} is - * {@link WhenExhaustedAction#FAIL}, {@link #borrowObject} will throw a - * {@link NoSuchElementException}/li - * liWhen {@link #setWhenExhaustedAction iwhenExhaustedAction/i} is - * {@link WhenExhaustedAction#BLOCK}, {@link #borrowObject} will block (invoke + * liWhen {@link #getBlockWhenExhausted} is false, + * {@link #borrowObject} will throw a {@link NoSuchElementException}/li + * liWhen {@link #getBlockWhenExhausted} is true, + * {@link #borrowObject} will block (invoke * {@link Object#wait()}) until a new or idle object is available. If a positive * {@link #setMaxWait imaxWait/i} value is supplied, then * {@link #borrowObject} will block for at most that many milliseconds, after @@ -75,8 +74,8 @@ import org.apache.commons.pool2.Poolable * imaxWait/i} is non-positive, the {@link #borrowObject} method will block * indefinitely./li * /ul - * The default codewhenExhaustedAction/code setting is - * {@link WhenExhaustedAction#BLOCK} and the default codemaxWait/code setting is + * The default {@link #getBlockWhenExhausted} is true + * and the default codemaxWait/code setting is * -1. By default, therefore, codeborrowObject/code will block indefinitely * until an idle instance becomes available./li * liWhen {@link #setTestOnBorrow itestOnBorrow/i} is set, the pool will @@ -155,8 +154,8 @@ import org.apache.commons.pool2.Poolable * /ul * p * GenericObjectPool is not usable without a {@link PoolableObjectFactory}. A - * non-codenull/code factory must be provided either as a constructor - * argument or via a call to {@link #setFactory} before the pool is used. + * non-codenull/code factory must be provided as a constructor + * argument before the pool is used. * p * Implementation note: To prevent possible deadlocks, care has been taken to * ensure that no call to a factory method will occur within a synchronization @@ -278,24 +277,24 @@ public class GenericObjectPoolT extend } /** - * Returns the action to take when the {@link #borrowObject} method is +
svn commit: r1158752 - in /commons/proper/compress/trunk/src: main/java/org/apache/commons/compress/archivers/dump/ test/java/org/apache/commons/compress/archivers/
Author: bodewig Date: Wed Aug 17 14:49:08 2011 New Revision: 1158752 URL: http://svn.apache.org/viewvc?rev=1158752view=rev Log: make DumpArchiveEntry's getName consistent with other implementations by adding a trailing / for directories. Strip leading . if present. COMPRESS-132 Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java?rev=1158752r1=1158751r2=1158752view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java Wed Aug 17 14:49:08 2011 @@ -195,6 +195,7 @@ public class DumpArchiveEntry implements // this information is available from standard index. private TapeSegmentHeader header = new TapeSegmentHeader(); private String simpleName; +private String originalName; // this information is available from QFA index private int volume; @@ -217,7 +218,7 @@ public class DumpArchiveEntry implements * @param simpleName actual filename. */ public DumpArchiveEntry(String name, String simpleName) { -this.name = name; +setName(name); this.simpleName = simpleName; } @@ -561,9 +562,26 @@ public class DumpArchiveEntry implements } /** + * Returns the unmodified name of the entry. + * @return the name of the entry. + */ +String getOriginalName() { +return originalName; +} + +/** * Sets the name of the entry. */ -public void setName(String name) { +public final void setName(String name) { +this.originalName = name; +if (name != null) { +if (..equals(name) || name.startsWith(./)) { +name = name.substring(1); +} +if (isDirectory() !name.endsWith(/)) { +name += /; +} +} this.name = name; } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java?rev=1158752r1=1158751r2=1158752view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java Wed Aug 17 14:49:08 2011 @@ -109,11 +109,11 @@ public class DumpArchiveInputStream exte queue = new PriorityQueueDumpArchiveEntry(10, new ComparatorDumpArchiveEntry() { public int compare(DumpArchiveEntry p, DumpArchiveEntry q) { -if ((p.getName() == null) || (q.getName() == null)) { +if ((p.getOriginalName() == null) || (q.getOriginalName() == null)) { return Integer.MAX_VALUE; } -return p.getName().compareTo(q.getName()); +return p.getOriginalName().compareTo(q.getOriginalName()); } }); } Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java?rev=1158752r1=1158751r2=1158752view=diff == --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java Wed Aug 17 14:49:08 2011 @@ -104,10 +104,10 @@ public final class DumpTestCase extends private void checkDumpArchive(final File f) throws Exception { ArrayListString expected = new ArrayListString(); -expected.add(.); -expected.add(./lost+found); -expected.add(./test1.xml); -expected.add(./test2.xml); +expected.add(/); +expected.add(/lost+found/);
svn commit: r1158755 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
Author: erans Date: Wed Aug 17 14:54:39 2011 New Revision: 1158755 URL: http://svn.apache.org/viewvc?rev=1158755view=rev Log: MATH-621 Layout. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java?rev=1158755r1=1158754r2=1158755view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java Wed Aug 17 14:54:39 2011 @@ -1470,7 +1470,7 @@ public class BOBYQAOptimizer int iflag = 0; double cauchy = Double.NaN; double csave = ZERO; -L100: for(;;) { +while (true) { double wfixsq = ZERO; double ggfree = ZERO; for (int i = 0; i n; i++) { @@ -1518,7 +1518,8 @@ public class BOBYQAOptimizer ggfree ZERO)) { break L120; } -}} // end L120 +} +} // end L120 // Set the remaining free components of W and all components of XALT, // except that W may be scaled later. @@ -1586,8 +1587,9 @@ public class BOBYQAOptimizer csave = cauchy; iflag = 1; } else { -break L100; -}} // end L100 +break; +} +} if (csave cauchy) { for (int i = 0; i n; i++) { xalt.setEntry(i, work2.getEntry(i));
svn commit: r1158757 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
Author: bodewig Date: Wed Aug 17 14:59:14 2011 New Revision: 1158757 URL: http://svn.apache.org/viewvc?rev=1158757view=rev Log: labeled break is not needed, there is only one loop. COMPRESS-132 Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java?rev=1158757r1=1158756r2=1158757view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java Wed Aug 17 14:59:14 2011 @@ -372,12 +372,10 @@ public class DumpArchiveInputStream exte StackString elements = new StackString(); Dirent dirent = null; -outer: for (int i = entry.getIno();; i = dirent.getParentIno()) { if (!names.containsKey(i)) { elements.clear(); - -break outer; +break; } dirent = names.get(i);
svn commit: r1158810 - /commons/proper/codec/trunk/src/changes/changes.xml
Author: sebb Date: Wed Aug 17 16:30:29 2011 New Revision: 1158810 URL: http://svn.apache.org/viewvc?rev=1158810view=rev Log: Codec-127 Modified: commons/proper/codec/trunk/src/changes/changes.xml Modified: commons/proper/codec/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/changes/changes.xml?rev=1158810r1=1158809r2=1158810view=diff == --- commons/proper/codec/trunk/src/changes/changes.xml (original) +++ commons/proper/codec/trunk/src/changes/changes.xml Wed Aug 17 16:30:29 2011 @@ -23,6 +23,9 @@ /properties body release version=2.0 date=TBA description=Feature and fix release. +action dev=ggregory, sebb type=fix issue=CODEC-127 + Fix various character encoding issues in comments and test cases. +/action action dev=ggregory type=fix issue=CODEC-126 Make org.apache.commons.codec.net.URLCodec charset field final. /action
svn commit: r1158812 - /commons/proper/codec/branches/generics/src/changes/changes.xml
Author: sebb Date: Wed Aug 17 16:31:17 2011 New Revision: 1158812 URL: http://svn.apache.org/viewvc?rev=1158812view=rev Log: Codec-127 Modified: commons/proper/codec/branches/generics/src/changes/changes.xml Modified: commons/proper/codec/branches/generics/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/codec/branches/generics/src/changes/changes.xml?rev=1158812r1=1158811r2=1158812view=diff == --- commons/proper/codec/branches/generics/src/changes/changes.xml (original) +++ commons/proper/codec/branches/generics/src/changes/changes.xml Wed Aug 17 16:31:17 2011 @@ -23,6 +23,9 @@ /properties body release version=2.0 date=TBA description=Feature and fix release. +action dev=ggregory, sebb type=fix issue=CODEC-127 + Fix various character encoding issues in comments and test cases. +/action action dev=ggregory type=fix issue=CODEC-126 Make org.apache.commons.codec.net.URLCodec charset field final. /action
svn commit: r1158831 - in /commons/proper/pool/trunk/src: changes/ java/org/apache/commons/pool2/impl/
Author: markt Date: Wed Aug 17 17:03:35 2011 New Revision: 1158831 URL: http://svn.apache.org/viewvc?rev=1158831view=rev Log: POOL-98. Add additional attributes for moniroting (also available via JMX) Modified: commons/proper/pool/trunk/src/changes/changes.xml commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolMBean.java commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPoolMBean.java commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/PooledObject.java Modified: commons/proper/pool/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1158831r1=1158830r2=1158831view=diff == --- commons/proper/pool/trunk/src/changes/changes.xml (original) +++ commons/proper/pool/trunk/src/changes/changes.xml Wed Aug 17 17:03:35 2011 @@ -77,6 +77,9 @@ action dev=markt type=update issue=POOL-172 Expose GOP and GKOP attributes via JMX. /action +action dev=markt type=update issue=POOL-98 + Add additional attributes (also accessible via JMX) for monitoring. +/action /release release version=1.5.6 date=2011-04-03 description=This is a patch release, including bugfixes only. action dev=markt type=fix issue=POOL-179 due-to=Axel Grossmann 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=1158831r1=1158830r2=1158831view=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 Wed Aug 17 17:03:35 2011 @@ -19,8 +19,10 @@ package org.apache.commons.pool2.impl; import java.lang.management.ManagementFactory; import java.util.ArrayList; +import java.util.Deque; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -253,6 +255,8 @@ public class GenericKeyedObjectPoolK,T startEvictor(getMinEvictableIdleTimeMillis()); +initStats(); + // JMX Registration if (config.isJmxEnabled()) { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); @@ -734,6 +738,7 @@ public class GenericKeyedObjectPoolK,T boolean blockWhenExhausted = this.blockWhenExhausted; boolean create; +long waitTime = 0; ObjectDequeT objectDeque = register(key); try { @@ -751,8 +756,10 @@ public class GenericKeyedObjectPoolK,T if (borrowMaxWait 1) { p = objectDeque.getIdleObjects().takeFirst(); } else { +waitTime = System.currentTimeMillis(); p = objectDeque.getIdleObjects().pollFirst( borrowMaxWait, TimeUnit.MILLISECONDS); +waitTime = System.currentTimeMillis() - waitTime; } } if (p == null) { @@ -806,6 +813,7 @@ public class GenericKeyedObjectPoolK,T if (!validate) { try { destroy(key, p, true); + destroyedByBorrowValidationCount.incrementAndGet(); } catch (Exception e) { // Ignore - validation failure is more important } @@ -823,7 +831,21 @@ public class GenericKeyedObjectPoolK,T } finally { deregister(key); } -return p.getObject(); + +borrowedCount.incrementAndGet(); +synchronized (idleTimes) { +idleTimes.add(Long.valueOf(p.getIdleTimeMillis())); +idleTimes.poll(); +} +synchronized (waitTimes) { +waitTimes.add(Long.valueOf(waitTime)); +waitTimes.poll(); +} +synchronized (maxBorrowWaitTimeMillisLock) { +if (waitTime maxBorrowWaitTimeMillis) { +maxBorrowWaitTimeMillis = waitTime; +} +}return p.getObject(); } @@ -857,6 +879,8 @@ public class GenericKeyedObjectPoolK,T Returned object not currently part of this pool); } + long activeTime =
svn commit: r1158834 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: GenericKeyedObjectPool.java GenericObjectPool.java
Author: markt Date: Wed Aug 17 17:10:25 2011 New Revision: 1158834 URL: http://svn.apache.org/viewvc?rev=1158834view=rev Log: Ensure MBeans are de-registered on pool close. 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=1158834r1=1158833r2=1158834view=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 Wed Aug 17 17:10:25 2011 @@ -268,6 +268,7 @@ public class GenericKeyedObjectPoolK,T ObjectName oname = new ObjectName(ONAME_BASE + jmxNamePrefix + i); mbs.registerMBean(this, oname); +this.oname = oname; registered = true; } catch (MalformedObjectNameException e) { if (GenericObjectPoolConfig.DEFAULT_JMX_NAME_PREFIX.equals( @@ -1098,6 +1099,7 @@ public class GenericKeyedObjectPoolK,T evictionIterator = null; evictionKeyIterator = null; startEvictor(-1L); + ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname); } @@ -1950,6 +1952,8 @@ public class GenericKeyedObjectPoolK,T private Object maxBorrowWaitTimeMillisLock = new Object(); private volatile long maxBorrowWaitTimeMillis = 0; +private ObjectName oname = null; + private static final String ONAME_BASE = org.apache.commoms.pool2:type=GenericKeyedObjectPool,name=; } 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=1158834r1=1158833r2=1158834view=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 Wed Aug 17 17:10:25 2011 @@ -222,6 +222,7 @@ public class GenericObjectPoolT extend ObjectName oname = new ObjectName(ONAME_BASE + jmxNamePrefix + i); mbs.registerMBean(this, oname); +this.oname = oname; registered = true; } catch (MalformedObjectNameException e) { if (GenericObjectPoolConfig.DEFAULT_JMX_NAME_PREFIX.equals( @@ -1005,6 +1006,7 @@ public class GenericObjectPoolT extend super.close(); clear(); startEvictor(-1L); +ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname); } /** @@ -1550,6 +1552,8 @@ public class GenericObjectPoolT extend private Object maxBorrowWaitTimeMillisLock = new Object(); private volatile long maxBorrowWaitTimeMillis = 0; +private ObjectName oname = null; + private static final String ONAME_BASE = org.apache.commoms.pool2:type=GenericObjectPool,name=; }
svn commit: r1158835 - /commons/proper/bsf/trunk/TODO.txt
Author: rony Date: Wed Aug 17 17:10:34 2011 New Revision: 1158835 URL: http://svn.apache.org/viewvc?rev=1158835view=rev Log: 20110817 Testing karma. Modified: commons/proper/bsf/trunk/TODO.txt Modified: commons/proper/bsf/trunk/TODO.txt URL: http://svn.apache.org/viewvc/commons/proper/bsf/trunk/TODO.txt?rev=1158835r1=1158834r2=1158835view=diff == --- commons/proper/bsf/trunk/TODO.txt (original) +++ commons/proper/bsf/trunk/TODO.txt Wed Aug 17 17:10:34 2011 @@ -1,3 +1,11 @@ +For 2011-08-17 (a test whether commiting has become possible as well): + + - incorporate all RFEs for BSF 2.4 + + - possibly create a JSR-223-adapter for BSF 2.4 (there are engines for BSF 2.4 for which no JSR-223 engines exist; in addition it may buy time for deployments that have a mix of BSF 2.4 and JSR-223) + + +-- cut here (from 2006) -- For 2006-09-25 the TODO list would consist at least from the following items: - add new BSF engines for BSF 2.4
svn commit: r1158884 - /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java
Author: oheger Date: Wed Aug 17 19:56:38 2011 New Revision: 1158884 URL: http://svn.apache.org/viewvc?rev=1158884view=rev Log: Javadoc improvements to make Checkstyle happy. Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java?rev=1158884r1=1158883r2=1158884view=diff == --- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java (original) +++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java Wed Aug 17 19:56:38 2011 @@ -19,15 +19,24 @@ package org.apache.commons.configuration import org.apache.commons.configuration.reloading.Reloadable; /** + * pA base class for hierarchical configurations with specific reloading + * requirements./p + * pThis class manages a lock object which can be used for synchronization./p * + * @author a + * href=http://commons.apache.org/configuration/team-list.html;Commons + * Configuration team/a + * @version $Id: $ */ public class HierarchicalReloadableConfiguration extends HierarchicalConfiguration implements Reloadable { -private final Object reloadLock; - +/** Constant for the name used for the lock object. */ private static final String LOCK_NAME = HierarchicalReloadableConfigurationLock; +/** The lock object used by this instance. */ +private final Object reloadLock; + /** * Creates a new instance of codeHierarchicalReloadableConfiguration/code. */ @@ -37,6 +46,13 @@ public class HierarchicalReloadableConfi reloadLock = new Lock(LOCK_NAME); } +/** + * Creates a new instance of + * codeHierarchicalReloadableConfiguration/code and initializes it with + * the given lock object. + * + * @param lock the lock object + */ public HierarchicalReloadableConfiguration(Object lock) { super(); @@ -50,7 +66,6 @@ public class HierarchicalReloadableConfi * * @param c the configuration that is to be copied (if bnull/b, this * constructor will behave like the standard constructor) - * @since 1.4 */ public HierarchicalReloadableConfiguration(HierarchicalConfiguration c) { @@ -58,7 +73,6 @@ public class HierarchicalReloadableConfi reloadLock = new Lock(LOCK_NAME); } - public Object getReloadLock() { return reloadLock;
svn commit: r1158885 - /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java
Author: oheger Date: Wed Aug 17 19:57:01 2011 New Revision: 1158885 URL: http://svn.apache.org/viewvc?rev=1158885view=rev Log: Checkstyle Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java?rev=1158885r1=1158884r2=1158885view=diff == --- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java (original) +++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java Wed Aug 17 19:57:01 2011 @@ -31,19 +31,19 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.configuration.event.ConfigurationErrorEvent; import org.apache.commons.configuration.event.ConfigurationErrorListener; import org.apache.commons.configuration.event.ConfigurationEvent; import org.apache.commons.configuration.event.ConfigurationListener; -import org.apache.commons.configuration.tree.ConfigurationNode; -import org.apache.commons.configuration.tree.ExpressionEngine; +import org.apache.commons.configuration.interpol.ConfigurationInterpolator; import org.apache.commons.configuration.reloading.ReloadingStrategy; import org.apache.commons.configuration.resolver.EntityResolverSupport; -import org.apache.commons.configuration.interpol.ConfigurationInterpolator; -import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.configuration.tree.ConfigurationNode; +import org.apache.commons.configuration.tree.ExpressionEngine; +import org.apache.commons.lang.text.StrSubstitutor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.commons.lang.text.StrSubstitutor; import org.xml.sax.EntityResolver; import org.xml.sax.SAXParseException; @@ -103,6 +103,7 @@ public class MultiFileHierarchicalConfig /** The EntityResolver */ private EntityResolver entityResolver; +/** The internally used helper object for variable substitution. */ private StrSubstitutor localSubst = new StrSubstitutor(new ConfigurationInterpolator()); /**
svn commit: r1158887 - /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java
Author: oheger Date: Wed Aug 17 20:01:14 2011 New Revision: 1158887 URL: http://svn.apache.org/viewvc?rev=1158887view=rev Log: Checkstyle Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java?rev=1158887r1=1158886r2=1158887view=diff == --- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java (original) +++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java Wed Aug 17 20:01:14 2011 @@ -961,6 +961,9 @@ public class PropertiesConfiguration ext */ public static class PropertiesWriter extends FilterWriter { +/** Constant for the initial size when creating a string buffer. */ +private static final int BUF_SIZE = 8; + /** The delimiter for multi-valued properties.*/ private char delimiter; @@ -1193,8 +1196,9 @@ public class PropertiesConfiguration ext * Performs the escaping of backslashes in the specified properties * value. Because a double backslash is used to escape the escape * character of a list delimiter, double backslashes also have to be - * escaped if the property is part of a (single line) list. Then, in all cases each backslash has to be doubled in order to produce a - * valid properties file. + * escaped if the property is part of a (single line) list. Then, in all + * cases each backslash has to be doubled in order to produce a valid + * properties file. * * @param value the value to be escaped * @param inList a flag whether the value is part of a list @@ -1207,7 +1211,7 @@ public class PropertiesConfiguration ext if (inList strValue.indexOf(DOUBLE_ESC) = 0) { char esc = ESCAPE.charAt(0); -StringBuffer buf = new StringBuffer(strValue.length() + 8); +StringBuffer buf = new StringBuffer(strValue.length() + BUF_SIZE); for (int i = 0; i strValue.length(); i++) { if (strValue.charAt(i) == esc i strValue.length() - 1 @@ -1322,7 +1326,7 @@ public class PropertiesConfiguration ext * * @since 1.7 */ -public static interface IOFactory +public interface IOFactory { /** * Creates a codePropertiesReader/code for reading a properties
svn commit: r1158888 - /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java
Author: oheger Date: Wed Aug 17 20:01:31 2011 New Revision: 115 URL: http://svn.apache.org/viewvc?rev=115view=rev Log: Checkstyle Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java?rev=115r1=1158887r2=115view=diff == --- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java (original) +++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SystemConfiguration.java Wed Aug 17 20:01:31 2011 @@ -17,21 +17,23 @@ package org.apache.commons.configuration; +import java.util.Iterator; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.util.Iterator; - /** * A configuration based on the system properties. * * @author Emmanuel Bourg - * @version $Revision$, $Date$ + * @version $Id$ * @since 1.1 */ public class SystemConfiguration extends MapConfiguration { +/** The logger. */ private static Log log = LogFactory.getLog(SystemConfiguration.class); + /** * Create a Configuration based on the system properties. *
svn commit: r1158890 - /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/Reloadable.java
Author: oheger Date: Wed Aug 17 20:08:24 2011 New Revision: 1158890 URL: http://svn.apache.org/viewvc?rev=1158890view=rev Log: Checkstyle Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/Reloadable.java Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/Reloadable.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/Reloadable.java?rev=1158890r1=1158889r2=1158890view=diff == --- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/Reloadable.java (original) +++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/reloading/Reloadable.java Wed Aug 17 20:08:24 2011 @@ -18,6 +18,11 @@ package org.apache.commons.configuration /** * Interface that allows other objects to synchronize on a root lock. + * + * @author a + * href=http://commons.apache.org/configuration/team-list.html;Commons + * Configuration team/a + * @version $Id$ */ public interface Reloadable {
svn commit: r1158891 - /commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/tree/DefaultConfigurationKey.java
Author: oheger Date: Wed Aug 17 20:08:39 2011 New Revision: 1158891 URL: http://svn.apache.org/viewvc?rev=1158891view=rev Log: Checkstyle Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/tree/DefaultConfigurationKey.java Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/tree/DefaultConfigurationKey.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/tree/DefaultConfigurationKey.java?rev=1158891r1=1158890r2=1158891view=diff == --- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/tree/DefaultConfigurationKey.java (original) +++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/tree/DefaultConfigurationKey.java Wed Aug 17 20:08:39 2011 @@ -830,7 +830,7 @@ public class DefaultConfigurationKey { int endidx = key.indexOf(getExpressionEngine().getIndexEnd(), idx); - + if (endidx idx + 1) { indexValue = Integer.parseInt(key.substring(idx + 1, endidx));
svn commit: r1158913 - /commons/proper/math/trunk/src/site/xdoc/changes.xml
Author: erans Date: Wed Aug 17 21:00:04 2011 New Revision: 1158913 URL: http://svn.apache.org/viewvc?rev=1158913view=rev Log: MATH-645 MATH-602 Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1158913r1=1158912r2=1158913view=diff == --- commons/proper/math/trunk/src/site/xdoc/changes.xml (original) +++ commons/proper/math/trunk/src/site/xdoc/changes.xml Wed Aug 17 21:00:04 2011 @@ -52,6 +52,12 @@ The action type attribute can be add,u If the output is not quite correct, check for invisible trailing spaces! -- release version=3.0 date=TBD description=TBD + action dev=erans type=fix issue=MATH-645 + Fixed exceptions generated by ebeMultiply and ebeDivide in OpenMapRealVector. + /action + action dev=erans type=add issue=MATH-602 due-to=Greg Serijevski + In SingularValueDecompositionImpl, added accessor for the inverse of the condition number. + /action action dev=psteitz type=fix issue=MATH-601 due-to=Chris Nix and Greg Serijevski Made pseudo-inverse consistent with rank computation in SingularValueDecompositionImpl. /action
svn commit: r1158920 - /commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Rule.java
Author: sebb Date: Wed Aug 17 21:28:05 2011 New Revision: 1158920 URL: http://svn.apache.org/viewvc?rev=1158920view=rev Log: Rename to avoid name hiding Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Rule.java Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Rule.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Rule.java?rev=1158920r1=1158919r2=1158920view=diff == --- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Rule.java (original) +++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/bm/Rule.java Wed Aug 17 21:28:05 2011 @@ -369,14 +369,14 @@ public class Rule { PhonemeExpr ph = parsePhonemeExpr(stripQuotes(parts[3])); final int cLine = currentLine; Rule r = new Rule(pat, lCon, rCon, ph) { -private final int line = cLine; +private final int myLine = cLine; private final String loc = location; @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(Rule); -sb.append({line=).append(line); +sb.append({line=).append(myLine); sb.append(, loc=').append(loc).append('\''); sb.append('}'); return sb.toString();
svn commit: r1158937 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
Author: erans Date: Wed Aug 17 22:11:43 2011 New Revision: 1158937 URL: http://svn.apache.org/viewvc?rev=1158937view=rev Log: MATH-621 Matrix/vector operators. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java?rev=1158937r1=1158936r2=1158937view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java Wed Aug 17 22:11:43 2011 @@ -31,6 +31,7 @@ import org.apache.commons.math.optimizat import org.apache.commons.math.optimization.MultivariateRealOptimizer; import org.apache.commons.math.optimization.RealPointValuePair; import org.apache.commons.math.util.MathUtils; +import org.apache.commons.math.linear.RealVector; import org.apache.commons.math.linear.ArrayRealVector; import org.apache.commons.math.linear.Array2DRowRealMatrix; @@ -2334,16 +2335,12 @@ public class BOBYQAOptimizer ih++; } } +final RealVector tmp = xpt.operate(s).ebeMultiply(pq); for (int k = 0; k npt; k++) { if (pq.getEntry(k) != ZERO) { -temp = ZERO; -for (int j = 0; j n; j++) { -temp += xpt.getEntry(k, j) * s.getEntry(j); -} -temp *= pq.getEntry(k); for (int i = 0; i n; i++) { -hs.setEntry(i, hs.getEntry(i) + temp * xpt.getEntry(k, i)); -} +hs.setEntry(i, hs.getEntry(i) + tmp.getEntry(k) * xpt.getEntry(k, i)); +} } } if (crvmin != ZERO) {
svn commit: r1158984 - /commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Rule.java
Author: ggregory Date: Thu Aug 18 01:28:58 2011 New Revision: 1158984 URL: http://svn.apache.org/viewvc?rev=1158984view=rev Log: Port change from trunk by Sebb. Modified: commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Rule.java Modified: commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Rule.java URL: http://svn.apache.org/viewvc/commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Rule.java?rev=1158984r1=1158983r2=1158984view=diff == --- commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Rule.java (original) +++ commons/proper/codec/branches/generics/src/java/org/apache/commons/codec/language/bm/Rule.java Thu Aug 18 01:28:58 2011 @@ -369,14 +369,14 @@ public class Rule { PhonemeExpr ph = parsePhonemeExpr(stripQuotes(parts[3])); final int cLine = currentLine; Rule r = new Rule(pat, lCon, rCon, ph) { -private final int line = cLine; +private final int myLine = cLine; private final String loc = location; @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(Rule); -sb.append({line=).append(line); +sb.append({line=).append(myLine); sb.append(, loc=').append(loc).append('\''); sb.append('}'); return sb.toString();
svn commit: r1159018 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/
Author: bayard Date: Thu Aug 18 03:59:16 2011 New Revision: 1159018 URL: http://svn.apache.org/viewvc?rev=1159018view=rev Log: Removing collections tests - far too complex a system for the comparators' needs. Will rewrite as standalone test classes Removed: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/AbstractTestComparator.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/AbstractTestNullComparator.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/AbstractTestObject.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/BulkTest.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/TestComparableComparator.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/TestComparatorChain.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/TestFixedOrderComparator.java commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/TestReverseComparator.java
svn commit: r1159023 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/NullComparatorTest.java
Author: bayard Date: Thu Aug 18 04:13:48 2011 New Revision: 1159023 URL: http://svn.apache.org/viewvc?rev=1159023view=rev Log: Adding a basic NullComparatorTest Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/NullComparatorTest.java (with props) Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/NullComparatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/NullComparatorTest.java?rev=1159023view=auto == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/NullComparatorTest.java (added) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/NullComparatorTest.java Thu Aug 18 04:13:48 2011 @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.compare; + +import static org.junit.Assert.*; + +import java.util.Comparator; + +import org.junit.Before; +import org.junit.Test; + +/** + * p + * Tests the methods in the {@link org.apache.commons.lang3.compare.NullComparator} class. + * /p + * + * @version $Id: RangeTest.java 1147537 2011-07-17 06:10:37Z mbenson $ + */ +public class NullComparatorTest { + +@Before +public void setUp() { +} + +//--- +@Test +public void testNullHigh() { +Comparator c = new NullComparator(true); +assertEquals(Null was not treated as high, -1, c.compare(new Object(), null) ); +assertEquals(Null was not treated as high, 1, c.compare(null, new Object()) ); +} + +@Test +public void testNullLow() { +Comparator c = new NullComparator(false); +assertEquals(Null was not treated as low, 1, c.compare(new Object(), null) ); +assertEquals(Null was not treated as low, -1, c.compare(null, new Object()) ); +} + +} Propchange: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/NullComparatorTest.java -- svn:eol-style = native
svn commit: r1159024 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ReverseComparatorTest.java
Author: bayard Date: Thu Aug 18 04:20:40 2011 New Revision: 1159024 URL: http://svn.apache.org/viewvc?rev=1159024view=rev Log: Adding a basic ReverseComparatorTest Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ReverseComparatorTest.java (with props) Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ReverseComparatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ReverseComparatorTest.java?rev=1159024view=auto == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ReverseComparatorTest.java (added) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ReverseComparatorTest.java Thu Aug 18 04:20:40 2011 @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.compare; + +import static org.junit.Assert.*; + +import java.util.Comparator; + +import org.junit.Before; +import org.junit.Test; + +/** + * p + * Tests the methods in the {@link org.apache.commons.lang3.compare.ReverseComparator} class. + * /p + * + * @version $Id: RangeTest.java 1147537 2011-07-17 06:10:37Z mbenson $ + */ +public class ReverseComparatorTest { + +@Before +public void setUp() { +} + +//--- +@Test +public void testUse() { +ReverseComparator rc = new ReverseComparator(); + +// back to front tests +assertTrue(Comparison wasn't reversed, rc.compare( 2, 1 ) 0 ); +assertTrue(Comparison wasn't reversed, rc.compare( 1, 2 ) 0 ); +assertTrue(Comparison wasn't reversed, rc.compare( baa, aardvark ) 0 ); +assertTrue(Comparison wasn't reversed, rc.compare( aardvark, baa ) 0 ); +} + +} Propchange: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ReverseComparatorTest.java -- svn:eol-style = native
svn commit: r1159025 - /commons/proper/lang/trunk/pom.xml
Author: bayard Date: Thu Aug 18 04:24:44 2011 New Revision: 1159025 URL: http://svn.apache.org/viewvc?rev=1159025view=rev Log: Removing excludes Modified: commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1159025r1=1159024r2=1159025view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Thu Aug 18 04:24:44 2011 @@ -467,10 +467,6 @@ includes include**/*Test.java/include /includes - excludes -exclude**/BulkTest.java/exclude -exclude**/AbstractTestObject.java/exclude - /excludes /configuration /plugin plugin
svn commit: r1159026 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/FixedOrderComparatorTest.java
Author: bayard Date: Thu Aug 18 04:24:57 2011 New Revision: 1159026 URL: http://svn.apache.org/viewvc?rev=1159026view=rev Log: Adding a basic FixedOrderComparatorTest Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/FixedOrderComparatorTest.java (with props) Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/FixedOrderComparatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/FixedOrderComparatorTest.java?rev=1159026view=auto == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/FixedOrderComparatorTest.java (added) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/FixedOrderComparatorTest.java Thu Aug 18 04:24:57 2011 @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.compare; + +import static org.junit.Assert.*; + +import java.util.Comparator; +import java.util.Arrays; + +import org.junit.Before; +import org.junit.Test; + +/** + * p + * Tests the methods in the {@link org.apache.commons.lang3.compare.FixedOrderComparator} class. + * /p + * + * @version $Id: RangeTest.java 1147537 2011-07-17 06:10:37Z mbenson $ + */ +public class FixedOrderComparatorTest { + +@Before +public void setUp() { +} + +//--- +@Test +public void testJavadocExample() { +String[] planets = {Mercury, Venus, Earth, Mars}; +String[] modified = {Mercury, Venus, Earth, Mars}; +Comparator distanceFromSun = new FixedOrderComparator(planets); +Arrays.sort(modified); // Sort to alphabetical order +Arrays.sort(modified, distanceFromSun);// Back to original order +assertArrayEquals(Did not sort to fixed order, planets, modified); +} + +} Propchange: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/FixedOrderComparatorTest.java -- svn:eol-style = native
svn commit: r1159027 - in /commons/proper/compress/trunk/src: main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java test/java/org/apache/commons/compress/archivers/DumpTestCase.ja
Author: bodewig Date: Thu Aug 18 04:27:07 2011 New Revision: 1159027 URL: http://svn.apache.org/viewvc?rev=1159027view=rev Log: I don't think leading slashes is what one would expect from the content of a dump archive. COMPRESS-132 Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java?rev=1159027r1=1159026r2=1159027view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveEntry.java Thu Aug 18 04:27:07 2011 @@ -575,12 +575,12 @@ public class DumpArchiveEntry implements public final void setName(String name) { this.originalName = name; if (name != null) { -if (..equals(name) || name.startsWith(./)) { -name = name.substring(1); -} if (isDirectory() !name.endsWith(/)) { name += /; } +if (name.startsWith(./)) { +name = name.substring(2); +} } this.name = name; } Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java?rev=1159027r1=1159026r2=1159027view=diff == --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/DumpTestCase.java Thu Aug 18 04:27:07 2011 @@ -104,10 +104,10 @@ public final class DumpTestCase extends private void checkDumpArchive(final File f) throws Exception { ArrayListString expected = new ArrayListString(); -expected.add(/); -expected.add(/lost+found/); -expected.add(/test1.xml); -expected.add(/test2.xml); +expected.add(); +expected.add(lost+found/); +expected.add(test1.xml); +expected.add(test2.xml); final InputStream is = new FileInputStream(f); try { checkArchiveContent(new DumpArchiveInputStream(is),
svn commit: r1159028 - in /commons/proper/lang/trunk: ./ src/main/java/org/apache/commons/lang3/compare/
Author: bayard Date: Thu Aug 18 04:27:57 2011 New Revision: 1159028 URL: http://svn.apache.org/viewvc?rev=1159028view=rev Log: Dropped @author notes, moved individuals to the pom.xml contributor list Modified: commons/proper/lang/trunk/pom.xml commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorChain.java commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorUtils.java commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/FixedOrderComparator.java commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/NullComparator.java commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ReverseComparator.java Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1159028r1=1159027r2=1159028view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Thu Aug 18 04:27:57 2011 @@ -231,6 +231,9 @@ nameNorm Deane/name /contributor contributor +nameMorgan Delagrange/name +/contributor +contributor nameRingo De Smet/name /contributor contributor @@ -267,6 +270,9 @@ nameChris Hyzer/name /contributor contributor +namePaul Jack/name +/contributor +contributor nameMarc Johnson/name /contributor contributor @@ -291,6 +297,9 @@ nameRafal Krzewski/name /contributor contributor +nameDavid Leppik/name +/contributor +contributor nameEli Lindsey/name /contributor contributor @@ -375,6 +384,9 @@ nameDavid M. Sledge/name /contributor contributor +nameMichael A. Smith/name +/contributor +contributor nameJan Sorensen/name /contributor contributor Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorChain.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorChain.java?rev=1159028r1=1159027r2=1159028view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorChain.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorChain.java Thu Aug 18 04:27:57 2011 @@ -51,7 +51,6 @@ import java.util.List; * after all the setup operations are complete./p * * @since Commons Collections 2.0 - * @author Morgan Delagrange * @version $Revision$ $Date$ */ public class ComparatorChainE implements ComparatorE, Serializable { Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorUtils.java?rev=1159028r1=1159027r2=1159028view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/ComparatorUtils.java Thu Aug 18 04:27:57 2011 @@ -30,9 +30,6 @@ import java.util.Comparator; * * @since Commons Collections 2.1 * @version $Revision$ $Date$ - * - * @author Paul Jack - * @author Stephen Colebourne */ public class ComparatorUtils { Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/FixedOrderComparator.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/FixedOrderComparator.java?rev=1159028r1=1159027r2=1159028view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/FixedOrderComparator.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/FixedOrderComparator.java Thu Aug 18 04:27:57 2011 @@ -42,10 +42,6 @@ import java.util.Map; * * @since Commons Collections 3.0 * @version $Revision$ $Date$ - * - * @author David Leppik - * @author Stephen Colebourne - * @author Janek Bogucki */ public class FixedOrderComparatorT implements ComparatorT { Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/NullComparator.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/compare/NullComparator.java?rev=1159028r1=1159027r2=1159028view=diff
svn commit: r1159030 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ComparableComparatorTest.java
Author: bayard Date: Thu Aug 18 04:36:12 2011 New Revision: 1159030 URL: http://svn.apache.org/viewvc?rev=1159030view=rev Log: Adding a basic ComparableComparator test Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ComparableComparatorTest.java (with props) Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ComparableComparatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ComparableComparatorTest.java?rev=1159030view=auto == --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ComparableComparatorTest.java (added) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ComparableComparatorTest.java Thu Aug 18 04:36:12 2011 @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.lang3.compare; + +import static org.junit.Assert.*; + +import java.io.File; +import java.util.Comparator; + +import org.junit.Before; +import org.junit.Test; + +/** + * p + * Tests the methods in the {@link org.apache.commons.lang3.compare.ComparableComparator} class. + * /p + * + * @version $Id: RangeTest.java 1147537 2011-07-17 06:10:37Z mbenson $ + */ +public class ComparableComparatorTest { + +@Before +public void setUp() { +} + +//--- +@Test +public void testUse() { +Comparator cc = new ComparableComparator(); + +// ensure same as Comparable +assertEquals( Not same as Integer.compareTo, new Integer(5).compareTo(2), cc.compare(5, 2) ); +assertEquals( Not same as String.compareTo, aardvark.compareTo(green), cc.compare(aardvark, green) ); +assertEquals( Not same as File.compareTo, new File(dir/file).compareTo(new File(dir/file2)), +cc.compare(new File(dir/file), new File(dir/file2)) ); +} + +} Propchange: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/compare/ComparableComparatorTest.java -- svn:eol-style = native