svn commit: r1488866 - in /commons/proper/math/trunk/src: changes/ main/java/org/apache/commons/math3/geometry/euclidean/threed/ main/java/org/apache/commons/math3/geometry/euclidean/twod/ test/java/o
Author: luc Date: Mon Jun 3 07:15:00 2013 New Revision: 1488866 URL: http://svn.apache.org/r1488866 Log: Fixed NullPointerException in 2D and 3D sub-line intersections. Patch contributed by Andeas Huber. JIRA: MATH-988 Modified: commons/proper/math/trunk/src/changes/changes.xml commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/SubLineTest.java Modified: commons/proper/math/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1488866r1=1488865r2=1488866view=diff == --- commons/proper/math/trunk/src/changes/changes.xml (original) +++ commons/proper/math/trunk/src/changes/changes.xml Mon Jun 3 07:15:00 2013 @@ -51,6 +51,9 @@ If the output is not quite correct, chec /properties body release version=x.y date=TBD description=TBD + action dev=luc type=fix issue=MATH-988 due-to=Andreas Huber +Fixed NullPointerException in 2D and 3D sub-line intersections. + /action action dev=psteitz type=update issue=MATH-987 due-to=Ajo Fod Added append method to SimpleRegression, making this class map/reducible. /action Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java?rev=1488866r1=1488865r2=1488866view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java Mon Jun 3 07:15:00 2013 @@ -111,6 +111,9 @@ public class SubLine { // compute the intersection on infinite line Vector3D v1D = line.intersection(subLine.line); +if (v1D == null) { +return null; +} // check location of point with respect to first sub-line Location loc1 = remainingRegion.checkPoint(line.toSubSpace(v1D)); Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java?rev=1488866r1=1488865r2=1488866view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java Mon Jun 3 07:15:00 2013 @@ -115,6 +115,9 @@ public class SubLine extends AbstractSub // compute the intersection on infinite line Vector2D v2D = line1.intersection(line2); +if (v2D == null) { +return null; +} // check location of point with respect to first sub-line Location loc1 = getRemainingRegion().checkPoint(line1.toSubSpace(v2D)); Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java?rev=1488866r1=1488865r2=1488866view=diff == --- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java Mon Jun 3 07:15:00 2013 @@ -152,5 +152,13 @@ public class SubLineTest { Assert.assertNull(sub1.intersection(sub2, true)); Assert.assertNull(sub1.intersection(sub2, false)); } + +@Test +public void testIntersectionNotIntersecting() throws MathIllegalArgumentException { +SubLine sub1 = new SubLine(new Vector3D(1, 1, 1), new Vector3D(1.5, 1, 1)); +SubLine sub2 = new SubLine(new Vector3D(2, 3, 0), new Vector3D(2, 3, 0.5)); +Assert.assertNull(sub1.intersection(sub2, true)); +Assert.assertNull(sub1.intersection(sub2, false)); +} } Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/SubLineTest.java URL:
svn commit: r1488914 - in /commons/proper/math/trunk: ./ src/changes/ src/main/java/org/apache/commons/math3/analysis/integration/ src/test/java/org/apache/commons/math3/analysis/integration/
Author: luc Date: Mon Jun 3 09:04:40 2013 New Revision: 1488914 URL: http://svn.apache.org/r1488914 Log: Added midpoint integration method. Patch contributed by Oleksandr Kornieiev. JIRA: MATH-967 Added: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java (with props) commons/proper/math/trunk/src/test/java/org/apache/commons/math3/analysis/integration/MidPointIntegratorTest.java (with props) Modified: commons/proper/math/trunk/pom.xml commons/proper/math/trunk/src/changes/changes.xml Modified: commons/proper/math/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/pom.xml?rev=1488914r1=1488913r2=1488914view=diff == --- commons/proper/math/trunk/pom.xml (original) +++ commons/proper/math/trunk/pom.xml Mon Jun 3 09:04:40 2013 @@ -217,6 +217,9 @@ nameEugene Kirpichov/name /contributor contributor + nameOleksandr Kornieiev/name +/contributor +contributor namePiotr Kochanski/name /contributor contributor Modified: commons/proper/math/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1488914r1=1488913r2=1488914view=diff == --- commons/proper/math/trunk/src/changes/changes.xml (original) +++ commons/proper/math/trunk/src/changes/changes.xml Mon Jun 3 09:04:40 2013 @@ -51,6 +51,9 @@ If the output is not quite correct, chec /properties body release version=x.y date=TBD description=TBD + action dev=luc type=add issue=MATH-967 due-to=Oleksandr Kornieiev +Added midpoint integration method. + /action action dev=luc type=fix issue=MATH-988 due-to=Andreas Huber Fixed NullPointerException in 2D and 3D sub-line intersections. /action Added: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java?rev=1488914view=auto == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java (added) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java Mon Jun 3 09:04:40 2013 @@ -0,0 +1,165 @@ +/* + * 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.math3.analysis.integration; + +import org.apache.commons.math3.exception.MathIllegalArgumentException; +import org.apache.commons.math3.exception.MaxCountExceededException; +import org.apache.commons.math3.exception.NotStrictlyPositiveException; +import org.apache.commons.math3.exception.NumberIsTooLargeException; +import org.apache.commons.math3.exception.NumberIsTooSmallException; +import org.apache.commons.math3.exception.TooManyEvaluationsException; +import org.apache.commons.math3.util.FastMath; + +/** + * Implements the a href=http://en.wikipedia.org/wiki/Midpoint_method; + * Midpoint Rule/a for integration of real univariate functions. For + * reference, see bNumerical Mathematics/b, ISBN 0387989595, + * chapter 9.2. + * p + * The function should be integrable./p + * + * @version $Id$ + * @since 3.3 + */ +public class MidPointIntegrator extends BaseAbstractUnivariateIntegrator { + +/** Maximum number of iterations for midpoint. */ +public static final int MIDPOINT_MAX_ITERATIONS_COUNT = 64; + +/** Intermediate result. */ +private double s; + +/** + * Build a midpoint integrator with given accuracies and iterations counts. + * @param relativeAccuracy relative accuracy of the result + * @param absoluteAccuracy absolute accuracy of the result + * @param minimalIterationCount minimum number of iterations + * @param maximalIterationCount maximum number of iterations + * (must be less than or equal to {@link #MIDPOINT_MAX_ITERATIONS_COUNT} + * @exception
svn commit: r1488935 - in /commons/proper/compress/trunk/src: changes/ main/java/org/apache/commons/compress/archivers/tar/ test/java/org/apache/commons/compress/archivers/ test/resources/longsymlink/
Author: bodewig Date: Mon Jun 3 09:20:30 2013 New Revision: 1488935 URL: http://svn.apache.org/r1488935 Log: COMPRESS-229 properly parse GNU_LONGLNK entries, patch by Christoph Gysin Added: commons/proper/compress/trunk/src/test/resources/longsymlink/ commons/proper/compress/trunk/src/test/resources/longsymlink/files.txt (with props) commons/proper/compress/trunk/src/test/resources/longsymlink/gnu.tar (with props) Modified: commons/proper/compress/trunk/src/changes/changes.xml commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/LongPathTest.java Modified: commons/proper/compress/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1488935r1=1488934r2=1488935view=diff == --- commons/proper/compress/trunk/src/changes/changes.xml (original) +++ commons/proper/compress/trunk/src/changes/changes.xml Mon Jun 3 09:20:30 2013 @@ -54,6 +54,12 @@ The action type attribute can be add,u to be able to read archives created by DotNetZip and maybe other archivers as well. /action + action type=fix date=2013-06-03 issue=COMPRESS-229 + due-to=Christoph Gysin +TAR will now properly read the names of symbolic links with +long names that use the GNU variant to specify the long file +name. + /action /release release version=1.5 date=2013-03-14 description=Release 1.5 Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java?rev=1488935r1=1488934r2=1488935view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java Mon Jun 3 09:20:30 2013 @@ -676,6 +676,16 @@ public class TarArchiveEntry implements } /** + * Indicate if this entry is a GNU long linkname block + * + * @return true if this is a long name extension provided by GNU tar + */ +public boolean isGNULongLinkEntry() { +return linkFlag == LF_GNUTYPE_LONGLINK + name.equals(GNU_LONGLINK); +} + +/** * Indicate if this entry is a GNU long name block * * @return true if this is a long name extension provided by GNU tar Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java?rev=1488935r1=1488934r2=1488935view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java Mon Jun 3 09:20:30 2013 @@ -248,31 +248,13 @@ public class TarArchiveInputStream exten entryOffset = 0; entrySize = currEntry.getSize(); -if (currEntry.isGNULongNameEntry()) { -// read in the name -ByteArrayOutputStream longName = new ByteArrayOutputStream(); -int length = 0; -while ((length = read(SMALL_BUF)) = 0) { -longName.write(SMALL_BUF, 0, length); -} -getNextEntry(); -if (currEntry == null) { -// Bugzilla: 40334 -// Malformed tar file - long entry name not followed by entry -return null; -} -byte[] longNameData = longName.toByteArray(); -// remove trailing null terminator(s) -length = longNameData.length; -while (length 0 longNameData[length - 1] == 0) { ---length; -} -if (length != longNameData.length) { -byte[] l = new byte[length]; -System.arraycopy(longNameData, 0, l, 0, length); -longNameData = l; -} +if (currEntry.isGNULongLinkEntry()) { +byte[] longLinkData = getLongNameData(); +
svn commit: r1488937 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java
Author: erans Date: Mon Jun 3 09:33:39 2013 New Revision: 1488937 URL: http://svn.apache.org/r1488937 Log: Avoid unnecessary instance variable. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java?rev=1488937r1=1488936r2=1488937view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java Mon Jun 3 09:33:39 2013 @@ -32,6 +32,8 @@ import org.apache.commons.math3.util.Fas * p * The function should be integrable./p * + * Class is immutable. + * * @version $Id$ * @since 3.3 */ @@ -40,9 +42,6 @@ public class MidPointIntegrator extends /** Maximum number of iterations for midpoint. */ public static final int MIDPOINT_MAX_ITERATIONS_COUNT = 64; -/** Intermediate result. */ -private double s; - /** * Build a midpoint integrator with given accuracies and iterations counts. * @param relativeAccuracy relative accuracy of the result @@ -109,11 +108,14 @@ public class MidPointIntegrator extends * already computed values./p * * @param n the stage of 1/2 refinement, n = 0 is no refinement + * @param previousStageResult Result from the previous call to the {@code stage} + * method. It is unused in the first stage (when {@code n} is equal to 0). * @return the value of n-th stage integral * @throws TooManyEvaluationsException if the maximal number of evaluations * is exceeded. */ -private double stage(final int n) +private double stage(final int n, + double previousStageResult) throws TooManyEvaluationsException { final double max = getMax(); @@ -121,8 +123,7 @@ public class MidPointIntegrator extends if (n == 0) { final double midPoint = 0.5 * (max - min); -s = (max - min) * computeObjectiveValue(midPoint); -return s; +return (max - min) * computeObjectiveValue(midPoint); } else { final long np = 1L (n - 1); // number of new points in this stage double sum = 0; @@ -134,8 +135,7 @@ public class MidPointIntegrator extends x += spacing; } // add the new sum to previously calculated result -s = 0.5 * (s + sum * spacing); -return s; +return 0.5 * (previousStageResult + sum * spacing); } } @@ -143,11 +143,11 @@ public class MidPointIntegrator extends protected double doIntegrate() throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException { -double oldt = stage(0); +double oldt = stage(0, 0d); iterations.incrementCount(); while (true) { final int i = iterations.getCount(); -final double t = stage(i); +final double t = stage(i, oldt); if (i = getMinimalIterationCount()) { final double delta = FastMath.abs(t - oldt); final double rLimit =
svn commit: r1488942 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java
Author: erans Date: Mon Jun 3 09:47:40 2013 New Revision: 1488942 URL: http://svn.apache.org/r1488942 Log: Multiple computations of the same value. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java?rev=1488942r1=1488941r2=1488942view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java Mon Jun 3 09:47:40 2013 @@ -116,17 +116,17 @@ public class MidPointIntegrator extends double previousStageResult) throws TooManyEvaluationsException { -final double max = getMax(); final double min = getMin(); +final double diff = getMax() - min; if (n == 0) { -final double midPoint = 0.5 * (max - min); -return (max - min) * computeObjectiveValue(midPoint); +final double midPoint = 0.5 * diff; +return diff * computeObjectiveValue(midPoint); } else { final long np = 1L (n - 1); // number of new points in this stage double sum = 0; // spacing between adjacent new points -final double spacing = (max - min) / np; +final double spacing = diff / np; double x = min + 0.5 * spacing;// the first new point for (long i = 0; i np; i++) { sum += computeObjectiveValue(x);
svn commit: r1488947 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
Author: bodewig Date: Mon Jun 3 09:58:27 2013 New Revision: 1488947 URL: http://svn.apache.org/r1488947 Log: COMPRESS-229 aftermaths, properly deal with broken archives that end with an incomplete entry. Unfortunately we don't have a test for this Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java?rev=1488947r1=1488946r2=1488947view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java Mon Jun 3 09:58:27 2013 @@ -250,11 +250,23 @@ public class TarArchiveInputStream exten if (currEntry.isGNULongLinkEntry()) { byte[] longLinkData = getLongNameData(); +if (longLinkData == null) { +// Bugzilla: 40334 +// Malformed tar file - long link entry name not followed by +// entry +return null; +} currEntry.setLinkName(encoding.decode(longLinkData)); } if (currEntry.isGNULongNameEntry()) { byte[] longNameData = getLongNameData(); +if (longNameData == null) { +// Bugzilla: 40334 +// Malformed tar file - long entry name not followed by +// entry +return null; +} currEntry.setName(encoding.decode(longNameData)); }
svn commit: r1488992 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java
Author: erans Date: Mon Jun 3 13:48:23 2013 New Revision: 1488992 URL: http://svn.apache.org/r1488992 Log: Removed branching. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java?rev=1488992r1=1488991r2=1488992view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java Mon Jun 3 13:48:23 2013 @@ -105,47 +105,54 @@ public class MidPointIntegrator extends * arbitrary m sections because this configuration can best utilize the * already computed values./p * - * @param n the stage of 1/2 refinement, n = 0 is no refinement - * @param previousStageResult Result from the previous call to the {@code stage} - * method. It is unused in the first stage (when {@code n} is equal to 0). + * @param n the stage of 1/2 refinement. Must be larger than 0. + * @param previousStageResult Result from the previous call to the + * {@code stage} method. + * @param min Lower bound of the integration interval. + * @param diffMaxMin Difference between the lower bound and upper bound + * of the integration interval. * @return the value of n-th stage integral * @throws TooManyEvaluationsException if the maximal number of evaluations * is exceeded. */ private double stage(final int n, - double previousStageResult) + double previousStageResult, + double min, + double diffMaxMin) throws TooManyEvaluationsException { -final double min = getMin(); -final double diff = getMax() - min; - -if (n == 0) { -final double midPoint = min + 0.5 * diff; -return diff * computeObjectiveValue(midPoint); -} else { -final long np = 1L (n - 1); // number of new points in this stage -double sum = 0; -// spacing between adjacent new points -final double spacing = diff / np; -double x = min + 0.5 * spacing;// the first new point -for (long i = 0; i np; i++) { -sum += computeObjectiveValue(x); -x += spacing; -} -// add the new sum to previously calculated result -return 0.5 * (previousStageResult + sum * spacing); +// number of new points in this stage +final long np = 1L (n - 1); +double sum = 0; + +// spacing between adjacent new points +final double spacing = diffMaxMin / np; + +// the first new point +double x = min + 0.5 * spacing; +for (long i = 0; i np; i++) { +sum += computeObjectiveValue(x); +x += spacing; } +// add the new sum to previously calculated result +return 0.5 * (previousStageResult + sum * spacing); } + /** {@inheritDoc} */ protected double doIntegrate() throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException { -double oldt = stage(0, 0d); -iterations.incrementCount(); +final double min = getMin(); +final double diff = getMax() - min; +final double midPoint = min + 0.5 * diff; + +double oldt = diff * computeObjectiveValue(midPoint); + while (true) { +iterations.incrementCount(); final int i = iterations.getCount(); -final double t = stage(i, oldt); +final double t = stage(i, oldt, min, diff); if (i = getMinimalIterationCount()) { final double delta = FastMath.abs(t - oldt); final double rLimit = @@ -155,7 +162,6 @@ public class MidPointIntegrator extends } } oldt = t; -iterations.incrementCount(); } }
svn commit: r1489111 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
Author: damjan Date: Mon Jun 3 19:13:57 2013 New Revision: 1489111 URL: http://svn.apache.org/r1489111 Log: Fix support for 7z files that are 2 GB. Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java?rev=1489111r1=1489110r2=1489111view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java Mon Jun 3 19:13:57 2013 @@ -915,12 +915,12 @@ public class SevenZFile { private static long readUint64(final DataInput in) throws IOException { int firstByte = in.readUnsignedByte(); int mask = 0x80; -int value = 0; +long value = 0; for (int i = 0; i 8; i++) { if ((firstByte mask) == 0) { return value | ((firstByte (mask - 1)) (8 * i)); } -int nextByte = in.readUnsignedByte(); +long nextByte = in.readUnsignedByte(); value |= (nextByte (8 * i)); mask = 1; }
svn commit: r1489119 - /commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
Author: sebb Date: Mon Jun 3 19:32:53 2013 New Revision: 1489119 URL: http://svn.apache.org/r1489119 Log: Document possible exception when file is truncated during copying Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1489119r1=1489118r2=1489119view=diff == --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java (original) +++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Mon Jun 3 19:32:53 2013 @@ -1123,13 +1123,16 @@ public class FileUtils { * Internal copy file method. * This caches the original file length, and throws an IOException * if the output file length is different from the current input file length. - * So it may fail if the file changes size. + * So it may fail if the file changes size. + * It may also fail with IllegalArgumentException: Negative size if the input file is truncated part way + * through copying the data and the new file size is less than the current position. * * @param srcFile the validated source file, must not be {@code null} * @param destFile the validated destination file, must not be {@code null} * @param preserveFileDate whether to preserve the file date * @throws IOException if an error occurs * @throws IOException if the output file length is not the same as the input file length after the copy completes + * @throws IllegalArgumentException Negative size if the file is truncated so that the size is less than the position */ private static void doCopyFile(final File srcFile, final File destFile, final boolean preserveFileDate) throws IOException { if (destFile.exists() destFile.isDirectory()) {
svn commit: r1489144 - in /commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide: ClusterAlgorithmComparison.java ExampleUtils.java LowDiscrepancyGeneratorComparison.java
Author: tn Date: Mon Jun 3 20:12:20 2013 New Revision: 1489144 URL: http://svn.apache.org/r1489144 Log: Small improvements to the examples. Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ClusterAlgorithmComparison.java commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ExampleUtils.java commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/LowDiscrepancyGeneratorComparison.java Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ClusterAlgorithmComparison.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ClusterAlgorithmComparison.java?rev=1489144r1=1489143r2=1489144view=diff == --- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ClusterAlgorithmComparison.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ClusterAlgorithmComparison.java Mon Jun 3 20:12:20 2013 @@ -32,7 +32,6 @@ import java.util.Collections; import java.util.List; import javax.swing.JComponent; -import javax.swing.JFrame; import javax.swing.JLabel; import org.apache.commons.math3.distribution.NormalDistribution; @@ -49,6 +48,7 @@ import org.apache.commons.math3.random.R import org.apache.commons.math3.random.RandomGenerator; import org.apache.commons.math3.random.SobolSequenceGenerator; import org.apache.commons.math3.random.Well19937c; +import org.apache.commons.math3.userguide.ExampleUtils.ExampleFrame; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.Pair; @@ -180,10 +180,10 @@ public class ClusterAlgorithmComparison } @SuppressWarnings(serial) -public static class Display extends JFrame { +public static class Display extends ExampleFrame { public Display() { -setTitle(Clustering examples); +setTitle(Commons-Math: Cluster algorithm comparison); setSize(800, 800); setLayout(new GridBagLayout()); @@ -231,6 +231,7 @@ public class ClusterAlgorithmComparison c.gridy++; } } + } @SuppressWarnings(serial) Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ExampleUtils.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ExampleUtils.java?rev=1489144r1=1489143r2=1489144view=diff == --- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ExampleUtils.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/userguide/ExampleUtils.java Mon Jun 3 20:12:20 2013 @@ -35,7 +35,23 @@ import javax.swing.SwingUtilities; public class ExampleUtils { -public static void showExampleFrame(final JFrame frame) { +@SuppressWarnings(serial) +public static class ExampleFrame extends JFrame { + +/** + * Returns the main panel which should be printed by the screenshot action. + * p + * By default, it returns the content pane of this frame, but can be overriden + * in case the frame has a global scroll pane which would cut off any offscreen content. + * + * @return the main panel to print + */ +public Component getMainPanel() { +return getContentPane(); +} +} + +public static void showExampleFrame(final ExampleFrame frame) { Runnable r = new Runnable() { public void run() { JMenuItem screenshot = new JMenuItem(Screenshot (png)); @@ -45,7 +61,7 @@ public class ExampleUtils { JFileChooser fileChooser = new JFileChooser(System.getProperty(user.dir)); if (fileChooser.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); - BufferedImage img = getScreenShot(frame.getContentPane()); + BufferedImage img = getScreenShot(frame.getMainPanel()); try { // write the image as a PNG ImageIO.write(img, png, file); @@ -55,8 +71,17 @@ public class ExampleUtils { } } }); + +JMenuItem exit = new JMenuItem(Exit); +exit.addActionListener(new ActionListener() { +public void actionPerformed(ActionEvent e) { +System.exit(0); +} +}); + JMenu menu = new
svn commit: r1489152 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java
Author: oheger Date: Mon Jun 3 20:25:05 2013 New Revision: 1489152 URL: http://svn.apache.org/r1489152 Log: Removed HierarchicalReloadableConfiguration class. Reloading is now handled differently, therefore this base class is no longer needed. Removed: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java
svn commit: r1489154 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java
Author: oheger Date: Mon Jun 3 20:25:28 2013 New Revision: 1489154 URL: http://svn.apache.org/r1489154 Log: Removed getReadLock() method. This method was part of the old reloading implementation. Reloading has been completely redesigned, therefore this method is no longer needed. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java?rev=1489154r1=1489153r2=1489154view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/BaseHierarchicalConfiguration.java Mon Jun 3 20:25:28 2013 @@ -223,17 +223,6 @@ public class BaseHierarchicalConfigurati } /** - * Returns the object to synchronize on a reload. This class is not - * reloadable so this object isn't important - * - * @return the lock object - */ -public Object getReloadLock() -{ -return this; -} - -/** * Performs special initialization of this configuration. This * implementation ensures that internal data structures for managing * {@code SubnodeConfiguration} objects are initialized. If this is done
svn commit: r1489155 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/ site/xdoc/userguide/ test/java/org/apache/commons/configuration/
Author: oheger Date: Mon Jun 3 20:26:18 2013 New Revision: 1489155 URL: http://svn.apache.org/r1489155 Log: Fixed another race condition with DynamicCombinedConfiguration. Now all child configurations share a single Synchronizer with the parent configuration. This ensures proper synchronization. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/SynchronizerTestImpl.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDynamicCombinedConfiguration.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java?rev=1489155r1=1489154r2=1489155view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DynamicCombinedConfiguration.java Mon Jun 3 20:26:18 2013 @@ -899,7 +899,8 @@ public class DynamicCombinedConfiguratio endWrite(); } -super.beginRead(optimize); +// This actually uses our own synchronizer +cch.getCurrentConfiguration().beginRead(optimize); } /** @@ -929,7 +930,7 @@ public class DynamicCombinedConfiguratio @Override protected void endRead() { -super.endRead(); +currentConfig.get().getCurrentConfiguration().endRead(); releaseLock(); } @@ -1032,7 +1033,7 @@ public class DynamicCombinedConfiguratio config.addConfiguration(data.getConfiguration(), data.getName(), data.getAt()); } - config.setSynchronizer(ConfigurationUtils.cloneSynchronizer(getSynchronizer())); +config.setSynchronizer(getSynchronizer()); } /** Modified: commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml?rev=1489155r1=1489154r2=1489155view=diff == --- commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml (original) +++ commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_concurrency.xml Mon Jun 3 20:26:18 2013 @@ -252,11 +252,11 @@ finally which has not been encountered before, a new codeCombinedConfiguration/code object is created. Here again it turns out that even a read access to a codeDynamicCombinedConfiguration/code may cause internal state -changes which require a write lock to be held. The codeSynchronizer/code -objects used by the child combined configurations are not under the -control of client code. The codeDynamicCombinedConfiguration/code -initializes each child configuration with a new codeSynchronizer/code -that is a clone from its own./li +changes which require a write lock to be held. When creating a new +child combined configuration it is passed the codeSynchronizer/code +of the owning codeDynamicCombinedConfiguration/code; so there is +actually only a single codeSynchronizer/code controlling the +access to all involved configurations./li /ul /p /subsection Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/SynchronizerTestImpl.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/SynchronizerTestImpl.java?rev=1489155r1=1489154r2=1489155view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/SynchronizerTestImpl.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/SynchronizerTestImpl.java Mon Jun 3 20:26:18 2013 @@ -112,6 +112,14 @@ public class SynchronizerTestImpl implem } /** + * Clears the methods recorded so far. + */ +public void clear() +{ +methods.setLength(0); +} + +/** * Generates a string with expected methods from the given array. * * @param expMethods the array with expected methods Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDynamicCombinedConfiguration.java URL:
svn commit: r1489156 - /commons/proper/configuration/trunk/src/changes/changes.xml
Author: oheger Date: Mon Jun 3 20:26:33 2013 New Revision: 1489156 URL: http://svn.apache.org/r1489156 Log: Updated changes.xml. Modified: commons/proper/configuration/trunk/src/changes/changes.xml Modified: commons/proper/configuration/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/changes/changes.xml?rev=1489156r1=1489155r2=1489156view=diff == --- commons/proper/configuration/trunk/src/changes/changes.xml (original) +++ commons/proper/configuration/trunk/src/changes/changes.xml Mon Jun 3 20:26:33 2013 @@ -27,6 +27,12 @@ body release version=2.0 date=in SVN description=TBD + action dev=oheger type=update issue=CONFIGURATION-542 +The mechanism for synchronizing configurations has been completely +redesigned. It is now based on Synchronizer objects which can be +configured by client code. A new chapter was added to the user's guide +regarding thread-safety of configurations. + /action action dev=oheger type=update issue=CONFIGURATION-540 MapConfiguration now directly uses a Properties object passed to its constructor as data store rather than copying it. This allows @@ -62,6 +68,12 @@ DatabaseConfiguration now automatically converts CLOBs to strings if they appear in property values. /action + action dev=oheger type=update issue=CONFIGURATION-530 +Concurrent access to configurations and reloading have been completely +redesigned. Because reloading is now handled by configuration builders +there is no need to acquire a lock in order to protected against a +reload operations. + /action action dev=oheger type=update issue=CONFIGURATION-527 due-to=Matthias Richter AbstractConfiguration.clearPropertyDirect() is now abstract. /action @@ -134,10 +146,17 @@ XMLConfiguration now adds attributes of elements defining a list to all list nodes. /action + action dev=oheger type=update issue=CONFIGURATION-496 +Concurrent access to configurations and reloading have been completely +redesigned. This should reduce the amount of synchronization. + /action action dev=oheger type=update issue=CONFIGURATION-419 EventSource is now an interface. With BaseEventSource there is a default implementation. /action + action dev=oheger type=update issue=CONFIGURATION-330 +Concurrent access to configurations has been reworked. + /action /release release version=1.9 date=2012-08-22
svn commit: r1489171 - in /commons/proper/io/trunk/src: changes/changes.xml main/java/org/apache/commons/io/FileUtils.java
Author: sebb Date: Mon Jun 3 20:59:05 2013 New Revision: 1489171 URL: http://svn.apache.org/r1489171 Log: IO-385 FileUtils.doCopyFile can potentially loop for ever Modified: commons/proper/io/trunk/src/changes/changes.xml commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Modified: commons/proper/io/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/changes/changes.xml?rev=1489171r1=1489170r2=1489171view=diff == --- commons/proper/io/trunk/src/changes/changes.xml (original) +++ commons/proper/io/trunk/src/changes/changes.xml Mon Jun 3 20:59:05 2013 @@ -47,6 +47,10 @@ The action type attribute can be add,u body !-- The release date is the date RC is cut -- release version=2.5 date=2013-??-?? description=New features and bug fixes. + action issue=IO-385 dev=sebb type=fix + FileUtils.doCopyFile can potentially loop for ever + Exit loop if no data to copy + /action action issue=IO-383 dev=sebb type=fix FileUtils.doCopyFile caches the file size; needs to be documented Added Javadoc; show file lengths in exception message Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1489171r1=1489170r2=1489171view=diff == --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java (original) +++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Mon Jun 3 20:59:05 2013 @@ -1152,8 +1152,13 @@ public class FileUtils { long pos = 0; long count = 0; while (pos size) { -count = size - pos FILE_COPY_BUFFER_SIZE ? FILE_COPY_BUFFER_SIZE : size - pos; -pos += output.transferFrom(input, pos, count); +final long remain = size - pos; +count = remain FILE_COPY_BUFFER_SIZE ? FILE_COPY_BUFFER_SIZE : remain; +final long bytesCopied = output.transferFrom(input, pos, count); +if (bytesCopied == 0) { // IO-385 - can happen if file is truncated after caching the size +break; // ensure we don't loop forever +} +pos += bytesCopied; } } finally { IOUtils.closeQuietly(output);
svn commit: r1489172 - /commons/proper/io/trunk/pom.xml
Author: sebb Date: Mon Jun 3 21:01:01 2013 New Revision: 1489172 URL: http://svn.apache.org/r1489172 Log: No need for JaCoCo overrides now Modified: commons/proper/io/trunk/pom.xml Modified: commons/proper/io/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/pom.xml?rev=1489172r1=1489171r2=1489172view=diff == --- commons/proper/io/trunk/pom.xml (original) +++ commons/proper/io/trunk/pom.xml Mon Jun 3 21:01:01 2013 @@ -251,8 +251,6 @@ file comparators, endian transformation /commons.osgi.export commons.scmPubCheckoutDirectorysite-content/commons.scmPubCheckoutDirectory -!-- Suppress JaCoCo -- -jacoco.skiptrue/jacoco.skip /properties build @@ -320,7 +318,6 @@ file comparators, endian transformation reporting plugins - !-- JaCoCo is useless but it is defined in commons-parent-29 -- plugin groupIdorg.codehaus.mojo/groupId artifactIdcobertura-maven-plugin/artifactId
svn commit: r1489238 - in /commons/proper/io/trunk/src: changes/changes.xml main/java/org/apache/commons/io/IOUtils.java main/java/org/apache/commons/io/output/ChunkedOutputStream.java main/java/org/a
Author: sebb Date: Tue Jun 4 00:03:06 2013 New Revision: 1489238 URL: http://svn.apache.org/r1489238 Log: IO-382 Chunked IO for large arrays Added: commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ChunkedOutputStream.java (with props) commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ChunkedWriter.java (with props) Modified: commons/proper/io/trunk/src/changes/changes.xml commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java Modified: commons/proper/io/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/changes/changes.xml?rev=1489238r1=1489237r2=1489238view=diff == --- commons/proper/io/trunk/src/changes/changes.xml (original) +++ commons/proper/io/trunk/src/changes/changes.xml Tue Jun 4 00:03:06 2013 @@ -47,6 +47,11 @@ The action type attribute can be add,u body !-- The release date is the date RC is cut -- release version=2.5 date=2013-??-?? description=New features and bug fixes. + action issue=IO-382 dev=sebb type=add + Chunked IO for large arrays. + Added writeChunked(byte[], OutputStream) and writeChunked(char[] Writer) + Added ChunkedOutputStream, ChunkedWriter + /action action issue=IO-385 dev=sebb type=fix FileUtils.doCopyFile can potentially loop for ever Exit loop if no data to copy Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java?rev=1489238r1=1489237r2=1489238view=diff == --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java (original) +++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java Tue Jun 4 00:03:06 2013 @@ -1340,6 +1340,32 @@ public class IOUtils { } /** + * Writes bytes from a codebyte[]/code to an codeOutputStream/code using chunked writes. + * This is intended for writing very large byte arrays which might otherwise cause excessive + * memory usage if the native code has to allocate a copy. + * + * @param data the byte array to write, do not modify during output, + * null ignored + * @param output the codeOutputStream/code to write to + * @throws NullPointerException if output is null + * @throws IOException if an I/O error occurs + * @since 2.5 + */ +public static void writeChunked(final byte[] data, final OutputStream output) +throws IOException { +if (data != null) { +int bytes = data.length; +int offset = 0; +while(bytes 0) { +int chunk = Math.min(bytes, DEFAULT_BUFFER_SIZE); +output.write(data, offset, chunk); +bytes -= chunk; +offset += chunk; +} +} +} + +/** * Writes bytes from a codebyte[]/code to chars on a codeWriter/code * using the default character encoding of the platform. * p @@ -1421,6 +1447,31 @@ public class IOUtils { } /** + * Writes chars from a codechar[]/code to a codeWriter/code using chunked writes. + * This is intended for writing very large byte arrays which might otherwise cause excessive + * memory usage if the native code has to allocate a copy. + * + * @param data the char array to write, do not modify during output, + * null ignored + * @param output the codeWriter/code to write to + * @throws NullPointerException if output is null + * @throws IOException if an I/O error occurs + * @since 2.5 + */ +public static void writeChunked(final char[] data, final Writer output) throws IOException { +if (data != null) { +int bytes = data.length; +int offset = 0; +while(bytes 0) { +int chunk = Math.min(bytes, DEFAULT_BUFFER_SIZE); +output.write(data, offset, chunk); +bytes -= chunk; +offset += chunk; +} +} +} + +/** * Writes chars from a codechar[]/code to bytes on an * codeOutputStream/code. * p @@ -2825,4 +2876,5 @@ public class IOUtils { throw new EOFException(Length to read: + expected + actual: + actual); } } + } Added: commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ChunkedOutputStream.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ChunkedOutputStream.java?rev=1489238view=auto == --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ChunkedOutputStream.java
svn commit: r1489244 - in /commons/proper/dbutils/trunk: ./ src/changes/ src/main/java/org/apache/commons/dbutils/
Author: wspeirs Date: Tue Jun 4 00:21:37 2013 New Revision: 1489244 URL: http://svn.apache.org/r1489244 Log: Minor edits to prep for 1.6-RC1 Modified: commons/proper/dbutils/trunk/NOTICE.txt commons/proper/dbutils/trunk/doap_dbutils.rdf commons/proper/dbutils/trunk/src/changes/changes.xml commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/GenerousBeanProcessor.java commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java Modified: commons/proper/dbutils/trunk/NOTICE.txt URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/NOTICE.txt?rev=1489244r1=1489243r2=1489244view=diff == --- commons/proper/dbutils/trunk/NOTICE.txt (original) +++ commons/proper/dbutils/trunk/NOTICE.txt Tue Jun 4 00:21:37 2013 @@ -1,5 +1,5 @@ Apache Commons DbUtils -Copyright 2002-2012 The Apache Software Foundation +Copyright 2002-2013 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Modified: commons/proper/dbutils/trunk/doap_dbutils.rdf URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/doap_dbutils.rdf?rev=1489244r1=1489243r2=1489244view=diff == --- commons/proper/dbutils/trunk/doap_dbutils.rdf (original) +++ commons/proper/dbutils/trunk/doap_dbutils.rdf Tue Jun 4 00:21:37 2013 @@ -37,6 +37,16 @@ !-- Dates for 1.1-1.3 taken from http://archive.apache.org/dist/commons/dbutils/binaries/ -- Version namecommons-dbutils/name +created2013-06-03/created +revision1.6/revision + /Version + Version +namecommons-dbutils/name +created2012-07-20/created +revision1.5/revision + /Version + Version +namecommons-dbutils/name created2011-10-23/created revision1.4/revision /Version Modified: commons/proper/dbutils/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/changes/changes.xml?rev=1489244r1=1489243r2=1489244view=diff == --- commons/proper/dbutils/trunk/src/changes/changes.xml (original) +++ commons/proper/dbutils/trunk/src/changes/changes.xml Tue Jun 4 00:21:37 2013 @@ -43,7 +43,7 @@ The action type attribute can be add,u titleRelease Notes/title /properties body -release version=1.6 date=201?-??-?? description=Bugfixes and addition of insert methods +release version=1.6 date=2013-06-03 description=Bugfixes and addition of insert methods action dev=sebb type=update issue=DBUTILS-85 In BeanProcessor#isCompatibleType, can Integer.class.isInstance(value) be replaced by value instanceof Integer (etc)? Simplified code by using instanceof. Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java?rev=1489244r1=1489243r2=1489244view=diff == --- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java (original) +++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java Tue Jun 4 00:21:37 2013 @@ -149,11 +149,11 @@ public abstract class AbstractQueryRunne * if a database access error occurs */ protected PreparedStatement prepareStatement(Connection conn, String sql) -throws SQLException { +throws SQLException { return conn.prepareStatement(sql); } - + /** * Factory method that creates and initializes a * codePreparedStatement/code object for the given SQL. @@ -171,13 +171,13 @@ public abstract class AbstractQueryRunne *The SQL statement to prepare. * @param returnedKeys *Flag indicating whether to return generated keys or not. - * + * * @return An initialized codePreparedStatement/code. * @throws SQLException * if a database access error occurs */ protected PreparedStatement prepareStatement(Connection conn, String sql, int returnedKeys) -throws SQLException { +throws SQLException { return conn.prepareStatement(sql, returnedKeys); } @@ -198,7 +198,7 @@ public abstract class AbstractQueryRunne if (this.getDataSource() == null) { throw new SQLException(
svn commit: r1489259 - in /commons/proper/dbutils/trunk: RELEASE-NOTES.txt pom.xml
Author: wspeirs Date: Tue Jun 4 00:37:57 2013 New Revision: 1489259 URL: http://svn.apache.org/r1489259 Log: More changes for 1.6-RC1 Modified: commons/proper/dbutils/trunk/RELEASE-NOTES.txt commons/proper/dbutils/trunk/pom.xml Modified: commons/proper/dbutils/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/RELEASE-NOTES.txt?rev=1489259r1=1489258r2=1489259view=diff == --- commons/proper/dbutils/trunk/RELEASE-NOTES.txt (original) +++ commons/proper/dbutils/trunk/RELEASE-NOTES.txt Tue Jun 4 00:37:57 2013 @@ -1,31 +1,32 @@ Apache Commons DbUtils - Version 1.5 + Version 1.6 RELEASE NOTES -The Commons DbUtils team is pleased to announce the release of Commons DbUtils 1.5 +The Commons DbUtils team is pleased to announce the release of Commons DbUtils 1.6 The Apache Commons-DbUtils package is a set of Java utility classes for easing JDBC development. -Bugfixes and addition of BeanMapHandler - Changes in this version include: New features: -o DBUTILS-67: Added BeanMapHandler Thanks to Michael Osipov. +o Create functionality to return auto-generated keys in batches of SQL inserts Issue: DBUTILS-108. Thanks to Micah Huff. +o Patch QueryLoader to also load from XML properties files Issue: DBUTILS-107. Thanks to PB. +o Add missing JavaDoc to QueryRunner#insert Issue: DBUTILS-98. Thanks to Moandji Ezana. +o Add an Abstract ResultSetHandler implementation in order to reduce redundant 'resultSet' variable invocation Issue: DBUTILS-97. +o Added insert methods to QueryRunner and AsyncQueryRunner that return the generated key. Issue: DBUTILS-87. Thanks to Moandji Ezana. Fixed Bugs: -o DBUTILS-93: Source assembly artifact fails to build a site because of missing pmd-ruleset.xml Thanks to Stevo Slavic. -o DBUTILS-84: BeanProcessor method processColumn should take SQLXML in consideration Thanks to Tiago Cavaleiro. -o DBUTILS-73: Added a fixed Locale (Locale.ENGLISH) to all toLowerCase calls in BasicRowProcessor Thanks to Sebb. +o DBUtils can't build using JDK 1.7 - DriverProxy needs to implement getParentLogger() +Add dynamic invocation. Issue: DBUTILS-106. Thanks to Niall Pemberton. +o Updated the use of getColumnName to try getColumnLabel first Issue: DBUTILS-100. Thanks to xiaofei.xu. +o DbUtils#loadDriver(ClassLoader,String) makes DriverManager throwing No suitable driver found for jdbc +if ClassLoader is not the System's one Issue: DBUTILS-96. Thanks to yuyf. Changes: -o DBUTILS-94: Provide test coverage for org.apache.commons.dbutils.DbUtils Thanks to Benedikt Ritter. -o DBUTILS-91: Enhance BasicRowProcessor to have row mapping easier to configure Thanks to Stevo Slavic. -o Updated pom.xml: Java 1.6 now required, clirr and compiler plugin removed Thanks to wspeirs. -o DBUTILS-77: Updated documentation to better reflect the use of pmdKnownBroken -o DBUTILS-66: Added generics to ScalarHandler, ColumnHandler, and KeyedHandler Thanks to Michael Osipov. +o In BeanProcessor#isCompatibleType, can Integer.class.isInstance(value) be replaced by value instanceof Integer (etc)? +Simplified code by using instanceof. Issue: DBUTILS-85. For complete information on Commons DbUtils, including instructions on how to submit bug reports, Modified: commons/proper/dbutils/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/pom.xml?rev=1489259r1=1489258r2=1489259view=diff == --- commons/proper/dbutils/trunk/pom.xml [utf-8] (original) +++ commons/proper/dbutils/trunk/pom.xml [utf-8] Tue Jun 4 00:37:57 2013 @@ -24,7 +24,7 @@ modelVersion4.0.0/modelVersion groupIdcommons-dbutils/groupId artifactIdcommons-dbutils/artifactId - version1.6-SNAPSHOT/version + version1.6/version nameCommons DbUtils/name inceptionYear2002/inceptionYear
svn commit: r1489260 - /commons/proper/dbutils/tags/DBUTILS_1_6_RC1/
Author: wspeirs Date: Tue Jun 4 00:41:18 2013 New Revision: 1489260 URL: http://svn.apache.org/r1489260 Log: Creating commons-dbutils-1.6-RC1 tag Added: commons/proper/dbutils/tags/DBUTILS_1_6_RC1/ (props changed) - copied from r1489259, commons/proper/dbutils/trunk/ Propchange: commons/proper/dbutils/tags/DBUTILS_1_6_RC1/ -- --- svn:ignore (added) +++ svn:ignore Tue Jun 4 00:41:18 2013 @@ -0,0 +1,8 @@ +target +maven.log +.classpath +.project +*.log +.settings +.externalToolBuilders +maven-eclipse.xml Propchange: commons/proper/dbutils/tags/DBUTILS_1_6_RC1/ -- --- svn:mergeinfo (added) +++ svn:mergeinfo Tue Jun 4 00:41:18 2013 @@ -0,0 +1,2 @@ +/commons/sandbox/dbutils/bugfixing:741987-747450 +/commons/sandbox/dbutils/java5:741988-832184
svn commit: r1489266 - /commons/proper/dbutils/trunk/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java
Author: sebb Date: Tue Jun 4 01:10:29 2013 New Revision: 1489266 URL: http://svn.apache.org/r1489266 Log: Missing @Override Modified: commons/proper/dbutils/trunk/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java Modified: commons/proper/dbutils/trunk/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java?rev=1489266r1=1489265r2=1489266view=diff == --- commons/proper/dbutils/trunk/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java (original) +++ commons/proper/dbutils/trunk/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java Tue Jun 4 01:10:29 2013 @@ -435,6 +435,7 @@ public class QueryRunnerTest { ResultSetHandlerListObject handler = new ResultSetHandlerListObject() { +@Override public ListObject handle(ResultSet rs) throws SQLException { ListObject objects = new ArrayListObject();
svn commit: r1489284 - in /commons/proper/compress/trunk/src: main/java/org/apache/commons/compress/archivers/zip/ZipFile.java test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
Author: bodewig Date: Tue Jun 4 04:22:05 2013 New Revision: 1489284 URL: http://svn.apache.org/r1489284 Log: COMPRESS-227 return Iterable rather than Iterator in new methods Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java?rev=1489284r1=1489283r2=1489284view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java Tue Jun 4 04:22:05 2013 @@ -316,14 +316,14 @@ public class ZipFile { * the archive's central directory. * * @param name name of the entry. - * @return the IteratorZipArchiveEntry corresponding to the + * @return the IterableZipArchiveEntry corresponding to the * given name * @since 1.6 */ -public IteratorZipArchiveEntry getEntries(String name) { +public IterableZipArchiveEntry getEntries(String name) { ListZipArchiveEntry entriesOfThatName = nameMap.get(name); -return entriesOfThatName != null ? entriesOfThatName.iterator() -: Collections.ZipArchiveEntryemptyList().iterator(); +return entriesOfThatName != null ? entriesOfThatName +: Collections.ZipArchiveEntryemptyList(); } /** @@ -331,17 +331,17 @@ public class ZipFile { * appear within the archive. * * @param name name of the entry. - * @return the IteratorZipArchiveEntry corresponding to the + * @return the IterableZipArchiveEntry corresponding to the * given name * @since 1.6 */ -public IteratorZipArchiveEntry getEntriesInPhysicalOrder(String name) { +public IterableZipArchiveEntry getEntriesInPhysicalOrder(String name) { ZipArchiveEntry[] entriesOfThatName = new ZipArchiveEntry[0]; if (nameMap.containsKey(name)) { entriesOfThatName = nameMap.get(name).toArray(entriesOfThatName); Arrays.sort(entriesOfThatName, OFFSET_COMPARATOR); } -return Arrays.asList(entriesOfThatName).iterator(); +return Arrays.asList(entriesOfThatName); } /** Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java?rev=1489284r1=1489283r2=1489284view=diff == --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java Tue Jun 4 04:22:05 2013 @@ -217,11 +217,9 @@ public class ZipFileTest extends TestCas assertNotNull(zf.getInputStream(ze)); int numberOfEntries = 0; -for (IteratorZipArchiveEntry it = zf.getEntries(test1.txt); - it.hasNext(); ) { +for (ZipArchiveEntry entry : zf.getEntries(test1.txt)) { numberOfEntries++; -ze = it.next(); -assertNotNull(zf.getInputStream(ze)); +assertNotNull(zf.getInputStream(entry)); } assertEquals(2, numberOfEntries); }
svn commit: r1489285 - /commons/proper/compress/trunk/src/changes/changes.xml
Author: bodewig Date: Tue Jun 4 04:26:51 2013 New Revision: 1489285 URL: http://svn.apache.org/r1489285 Log: keep track of changes Modified: commons/proper/compress/trunk/src/changes/changes.xml Modified: commons/proper/compress/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1489285r1=1489284r2=1489285view=diff == --- commons/proper/compress/trunk/src/changes/changes.xml (original) +++ commons/proper/compress/trunk/src/changes/changes.xml Tue Jun 4 04:26:51 2013 @@ -49,6 +49,16 @@ The action type attribute can be add,u TarBuffer.tryToConsumeSecondEOFRecord could throw a NullPointerException /action + action type=add date=2013-05-07 issue=COMPRESS-54 + due-to=Damjan Jovanovic +Added read-only support for 7z archives that don't use +LZMA compression. + /action + action type=add date=2013-05-19 issue=COMPRESS-226 + due-to=Damjan Jovanovic +Added read-only support for ARJ archives that don't use +compression. + /action action type=fix date=2013-05-26 issue=COMPRESS-228 Parsing of zip64 extra fields has become more lenient in order to be able to read archives created by DotNetZip and maybe @@ -60,6 +70,12 @@ The action type attribute can be add,u long names that use the GNU variant to specify the long file name. /action + action type=fix date=2013-06-04 issue=COMPRESS-227 +ZipFile#getInoutStream could return null if the archive +contained duplicate entries. +The class now also provides two new methods to obtain all +entries of a given name rather than just the first one. + /action /release release version=1.5 date=2013-03-14 description=Release 1.5