svn commit: r874057 [31/31] - in /websites/production/commons/content/sandbox/commons-openpgp: ./ apidocs/ apidocs/org/apache/commons/openpgp/ apidocs/org/apache/commons/openpgp/ant/ apidocs/org/apach
Added: websites/production/commons/content/sandbox/commons-openpgp/xref/org/apache/commons/openpgp/ant/OpenPgpVerifierTask.html == --- websites/production/commons/content/sandbox/commons-openpgp/xref/org/apache/commons/openpgp/ant/OpenPgpVerifierTask.html (added) +++ websites/production/commons/content/sandbox/commons-openpgp/xref/org/apache/commons/openpgp/ant/OpenPgpVerifierTask.html Sat Aug 10 22:25:17 2013 @@ -0,0 +1,222 @@ +http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> +http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> + + +OpenPgpVerifierTask xref + + + +View Javadoc + +1 /* +2 * Licensed to the Apache Software Foundation (ASF) under one or more +3 * contributor license agreements. See the NOTICE file distributed with +4 * this work for additional information regarding copyright ownership. +5 * The ASF licenses this file to You under the Apache License, Version 2.0 +6 * (the "License"); you may not use this file except in compliance with +7 * the License. You may obtain a copy of the License at +8 * +9 * http://www.apache.org/licenses/LICENSE-2.0"; target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0 +10 * +11 * Unless required by applicable law or agreed to in writing, software +12 * distributed under the License is distributed on an "AS IS" BASIS, +13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +14 * See the License for the specific language governing permissions and +15 * limitations under the License. +16 */ +17 package org.apache.commons.openpgp.ant; +18 +19 import java.io.File; +20 import java.io.FileInputStream; +21 import java.io.FileNotFoundException; +22 import java.io.IOException; +23 import org.apache.commons.openpgp.BouncyCastleKeyRing; +24 import org.apache.commons.openpgp.BouncyCastleOpenPgpSignatureVerifier; +25 import org.apache.commons.openpgp.KeyRing; +26 import org.apache.commons.openpgp.OpenPgpException; +27 import org.apache.commons.openpgp.OpenPgpSignatureVerifier; +28 import org.apache.commons.openpgp.SignatureStatus; +29 import org.apache.tools.ant.BuildException; +30 import org.apache.tools.ant.Task; +31 import org.apache.tools.ant.types.Mapper; +32 import org.apache.tools.ant.util.FileNameMapper; +33 import org.apache.tools.ant.util.FileUtils; +34 import org.apache.tools.ant.util.GlobPatternMapper; +35 import org.bouncycastle.openpgp.PGPException; +36 +37 /** +38 * Verify a signature using the Bouncy Castle OpenPGP provider. +39 * +40 * @author mailto:denn...@apache.org">Dennis Lundberg +41 */ +42 public class OpenPgpVerifierTask extends Task { +43 private File secring; +44 private File pubring; +45 private String password; +46 private File artefact; +47 private boolean asciiarmor = true; +48 private Mapper mapperElement; +49 private String verifyproperty; +50 +51 /** +52 * Set the secret keyring. +53 * @param secring secret keyring file +54 */ +55 public void setSecring(File secring) { +56 this.secring = secring; +57 } +58 +59 /** +60 * Set the public keyring. +61 * @param pubring public keyring file +62 */ +63 public void setPubring(File pubring) { +64 this.pubring = pubring; +65 } +66 +67 /** +68 * Use ASCII armored signature files? +69 * @param asciiarmor ascii armored signatures? +70 */ +71 public void setAsciiarmor(boolean asciiarmor) { +72 this.asciiarmor = asciiarmor; +73 } +74 +75 /** +76 * Set the value of the password. +77 * @param password value of the password +78 */ +79 public void setPassword(String password) { +80 this.password = password; +81 } +82 +83 /** +84 * Set the artefact to be handled. +85 * @param artefact artefact to be handled +86 */ +87 public void setArtefact(File artefact) { +88 this.artefact = artefact; +89 } +90 +91 /** +92 * Set the name of the property that contains the result of the verification. +93 * @param verifyproperty name of the property +94 */ +95 public void setVerifyproperty(String verifyproperty) { +96 this.verifyproperty = verifyproperty; +97 } +98 +99 /** +100 * Define the mapper to map source to destination files. +101 * @return a mapper to be configured. +102 * @exception org.apache.tools.ant.BuildException if more than one mapper is defined. +103 */ +104 public Mapper createMapper() throws BuildException { +105 if (mapperElement != null) { +106 throw new BuildException("Cannot define more than one mapper", +107 getLocation()); +108 }
svn commit: r874057 [14/31] - in /websites/production/commons/content/sandbox/commons-openpgp: ./ apidocs/ apidocs/org/apache/commons/openpgp/ apidocs/org/apache/commons/openpgp/ant/ apidocs/org/apach
Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/org.apache.commons.openpgp.SignatureStatus.html == --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/org.apache.commons.openpgp.SignatureStatus.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/org.apache.commons.openpgp.SignatureStatus.html Sat Aug 10 22:25:17 2013 @@ -12,154 +12,154 @@ Classes in this File Line Coverage Branch Coverage Complexity - SignatureStatus89%8/9N/AN/A1.0;1 + SignatureStatus88%8/9N/AN/A1.0;1 - - 1 - package org.apache.commons.openpgp; - 2 - - 3 - /* - 4 - * Licensed to the Apache Software Foundation (ASF) under one or more - 5 - * contributor license agreements. See the NOTICE file distributed with - 6 - * this work for additional information regarding copyright ownership. - 7 - * The ASF licenses this file to You under the Apache License, Version 2.0 - 8 - * (the "License"); you may not use this file except in compliance with - 9 - * the License. You may obtain a copy of the License at - 10 - * - 11 - * http://www.apache.org/licenses/LICENSE-2.0 - 12 - * - 13 - * Unless required by applicable law or agreed to in writing, software - 14 - * distributed under the License is distributed on an "AS IS" BASIS, - 15 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - 16 - * See the License for the specific language governing permissions and - 17 - * limitations under the License. - 18 - */ - 19 - - 20 - /** - 21 - * Enumerated type indicating the status of data that was signed. - 22 - * - 23 - * Values: - 24 - *- 25 - *
- 29 - * - 30 - * @author Brett Porter - 31 - * @todo incorporate levels of trust - 32 - */ - 33 - public class SignatureStatus - 34 - { - 35 - /** - 36 - * Status that indicates the signature is valid, and from a trusted source. - 37 - */ - 38 1 public static SignatureStatus VALID_TRUSTED = new SignatureStatus( true, true ); - 39 - - 40 - /** - 41 - * Status that indicates the signature is valid, but from an unknown or untrusted source. - 42 - */ - 43 1 public static SignatureStatus VALID_UNTRUSTED = new SignatureStatus( true, false ); - 44 - - 45 - /** - 46 - * Status that indicates the signature is invalid. - 47 - */ - 48 1 public static SignatureStatus INVALID = new SignatureStatus( false, false ); - 49 - - 50 - /** - 51 - * Whether the signature is valid. - 52 - */ - 53 - private final boolean valid; - 54 - - 55 - /** - 56 - * Whether the signature is trusted. - 57 - */ - 58 - private final boolean trusted; - 59 - - 60 - private SignatureStatus( boolean valid, boolean trusted ) - 61 3 { - 62 3 this.valid = valid; - 63 3 this.trusted = trusted; - 64 3 } - 65 - - 66 - public boolean isValid() - 67 - { - 68 2 return valid; - 69 - } - 70 - - 71 - public boolean isTrusted() - 72 - { - 73 0 return trusted; - 74 - } - 75 - } - + + 1 + package org.apache.commons.openpgp; + 2 + + 3 + /* + 4 + * Licensed to the Apache Software Foundation (ASF) under one or more + 5 + * contributor license agreements. See the NOTICE file distributed with + 6 + * this work for additional information regarding copyright ownership. + 7 + * The ASF licenses this file to You under the Apache License, Version 2.0 + 8 + * (the "License"); you may not use this file except in compliance with + 9 + * the License. You may obtain a copy of the License at + 10 + * + 11 + * http://www.apache.org/licenses/LICENSE-2.0 + 12 + * + 13 + * Unless required by applicable law or agreed to in writing, software + 14 + * distributed under the License is distributed on an "AS IS" BASIS, + 15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + 16 + * See the License for the specific language governing permissions and + 17 +- - 26 - *
VALID_TRUSTED
- - 27 - *
VALID_UNTRUSTED
- - 28 - *
INVALID
svn commit: r874057 [9/31] - in /websites/production/commons/content/sandbox/commons-openpgp: ./ apidocs/ apidocs/org/apache/commons/openpgp/ apidocs/org/apache/commons/openpgp/ant/ apidocs/org/apache
Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/org.apache.commons.openpgp.BouncyCastleOpenPgpSigner.html == --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/org.apache.commons.openpgp.BouncyCastleOpenPgpSigner.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/org.apache.commons.openpgp.BouncyCastleOpenPgpSigner.html Sat Aug 10 22:25:17 2013 @@ -12,127 +12,127 @@ Classes in this File Line Coverage Branch Coverage Complexity - BouncyCastleOpenPgpSigner90%9/10100%4/42.0;2 + BouncyCastleOpenPgpSigner90%9/10100%4/42.0;2 - - 1 - package org.apache.commons.openpgp; - 2 - - 3 - /* - 4 - * Licensed to the Apache Software Foundation (ASF) under one or more - 5 - * contributor license agreements. See the NOTICE file distributed with - 6 - * this work for additional information regarding copyright ownership. - 7 - * The ASF licenses this file to You under the Apache License, Version 2.0 - 8 - * (the "License"); you may not use this file except in compliance with - 9 - * the License. You may obtain a copy of the License at - 10 - * - 11 - * http://www.apache.org/licenses/LICENSE-2.0 - 12 - * - 13 - * Unless required by applicable law or agreed to in writing, software - 14 - * distributed under the License is distributed on an "AS IS" BASIS, - 15 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - 16 - * See the License for the specific language governing permissions and - 17 - * limitations under the License. - 18 - */ - 19 - - 20 - import java.io.IOException; - 21 - import java.io.InputStream; - 22 - import java.io.OutputStream; - 23 - - 24 - /** - 25 - * Bouncy Castle implementation of the OpenPGP signer. - 26 - * - 27 - * @author Brett Porter - 28 - */ - 29 2 public class BouncyCastleOpenPgpSigner - 30 - implements OpenPgpSigner - 31 - { - 32 - private static final int BUFFER_SIZE = 1024; - 33 - - 34 - public void sign( InputStream data, OutputStream signedOutput, String keyId, KeyRing keyRing, boolean asciiArmor ) - 35 - throws OpenPgpException - 36 - { - 37 - // TODO - 38 0 } - 39 - - 40 - public void detachedSign( InputStream data, OutputStream signature, String keyId, KeyRing keyRing, - 41 - boolean asciiArmor ) - 42 - throws OpenPgpException, IOException - 43 - { - 44 1 OpenPgpStreamingSigner updater = - 45 - new BouncyCastleOpenPgpStreamingSigner( signature, keyId, keyRing, asciiArmor ); - 46 - - 47 1 byte[] buf = new byte[BUFFER_SIZE]; - 48 - - 49 - int len; - 50 - do - 51 - { - 52 2 len = data.read( buf ); - 53 2 if ( len > 0 ) - 54 - { - 55 1 updater.update( buf, 0, len ); - 56 - } - 57 - } - 58 2 while ( len >= 0 ); - 59 - - 60 1 updater.finish(); - 61 1 } - 62 - } - + + 1 + package org.apache.commons.openpgp; + 2 + + 3 + /* + 4 + * Licensed to the Apache Software Foundation (ASF) under one or more + 5 + * contributor license agreements. See the NOTICE file distributed with + 6 + * this work for additional information regarding copyright ownership. + 7 + * The ASF licenses this file to You under the Apache License, Version 2.0 + 8 + * (the "License"); you may not use this file except in compliance with + 9 + * the License. You may obtain a copy of the License at + 10 + * + 11 + * http://www.apache.org/licenses/LICENSE-2.0 + 12 + * + 13 + * Unless required by applicable law or agreed to in writing, software + 14 + * distributed under the License is distributed on an "AS IS" BASIS, + 15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + 16 + * See the License for the specific language governing permissions and + 17 + * limitations under the License. + 18 + */ + 19 + + 20 + import java.io.IOException; + 21 + import java.io.InputStream; + 22 + import java.io.OutputStream; + 23 + + 24 + /** + 25 + * Bouncy Castle implementation of the OpenPGP signer. + 26 + * + 27 + * @au
svn commit: r1512831 - /commons/sandbox/openpgp/trunk/src/site/apt/index.apt
Author: dennisl Date: Sat Aug 10 22:15:53 2013 New Revision: 1512831 URL: http://svn.apache.org/r1512831 Log: Fix ambiguous link. Modified: commons/sandbox/openpgp/trunk/src/site/apt/index.apt Modified: commons/sandbox/openpgp/trunk/src/site/apt/index.apt URL: http://svn.apache.org/viewvc/commons/sandbox/openpgp/trunk/src/site/apt/index.apt?rev=1512831&r1=1512830&r2=1512831&view=diff == --- commons/sandbox/openpgp/trunk/src/site/apt/index.apt (original) +++ commons/sandbox/openpgp/trunk/src/site/apt/index.apt Sat Aug 10 22:15:53 2013 @@ -23,5 +23,5 @@ Commons OpenPGP * Using the Library - * {{{usage.html} Usage Instructions}} + * {{{./usage.html} Usage Instructions}}
svn commit: r1512830 - /commons/sandbox/openpgp/trunk/pom.xml
Author: dennisl Date: Sat Aug 10 22:13:28 2013 New Revision: 1512830 URL: http://svn.apache.org/r1512830 Log: Add myself as a developer. Modified: commons/sandbox/openpgp/trunk/pom.xml Modified: commons/sandbox/openpgp/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/sandbox/openpgp/trunk/pom.xml?rev=1512830&r1=1512829&r2=1512830&view=diff == --- commons/sandbox/openpgp/trunk/pom.xml (original) +++ commons/sandbox/openpgp/trunk/pom.xml Sat Aug 10 22:13:28 2013 @@ -69,6 +69,13 @@ Apache +1 + + dennisl + Dennis Lundberg + dennisl AT apache DOT org + Apache + +1 +
svn commit: r1512829 - in /commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp: BouncyCastleKeyRing.java KeyRing.java
Author: dennisl Date: Sat Aug 10 22:11:32 2013 New Revision: 1512829 URL: http://svn.apache.org/r1512829 Log: Add a method that allows you to access the key ID of the first key in the secret keyring. By default this is the key that is used when signing, unless it has been configured otherwise. I'm working on a pure Java signing implementation for Maven GPG Plugin and need to get hold of this ID. Modified: commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/BouncyCastleKeyRing.java commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/KeyRing.java Modified: commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/BouncyCastleKeyRing.java URL: http://svn.apache.org/viewvc/commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/BouncyCastleKeyRing.java?rev=1512829&r1=1512828&r2=1512829&view=diff == --- commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/BouncyCastleKeyRing.java (original) +++ commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/BouncyCastleKeyRing.java Sat Aug 10 22:11:32 2013 @@ -38,6 +38,8 @@ import org.bouncycastle.openpgp.PGPUtil; */ public class BouncyCastleKeyRing implements KeyRing { +private String firstKeyId; + private final Map pgpSec = new HashMap(); private char[] password; @@ -93,6 +95,11 @@ public class BouncyCastleKeyRing impleme PGPSecretKeyRing pgpSecret = (PGPSecretKeyRing) obj; long key = pgpSecret.getSecretKey().getKeyID() & MASK; +if ( pgpSec.isEmpty() ) +{ +// Convert the keyId to a hexadecimal upper case String +firstKeyId = Long.toHexString( key ).toUpperCase(); +} pgpSec.put( key, pgpSecret.getSecretKey() ); } @@ -100,6 +107,11 @@ public class BouncyCastleKeyRing impleme this.password = password; } +public String getFirstKeyId() +{ +return firstKeyId.toString(); +} + public char[] getPassword() { return password; Modified: commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/KeyRing.java URL: http://svn.apache.org/viewvc/commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/KeyRing.java?rev=1512829&r1=1512828&r2=1512829&view=diff == --- commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/KeyRing.java (original) +++ commons/sandbox/openpgp/trunk/src/main/java/org/apache/commons/openpgp/KeyRing.java Sat Aug 10 22:11:32 2013 @@ -36,6 +36,11 @@ public interface KeyRing String ROLE = KeyRing.class.getName(); /** + * Get the key ID of the first secret key that was added to the keyring. + */ +String getFirstKeyId(); + +/** * @return * @todo seems like the wrong place */
svn commit: r1512828 - /commons/sandbox/openpgp/trunk/src/site/apt/index.apt
Author: dennisl Date: Sat Aug 10 22:07:41 2013 New Revision: 1512828 URL: http://svn.apache.org/r1512828 Log: We are not Jakarta any more... Modified: commons/sandbox/openpgp/trunk/src/site/apt/index.apt Modified: commons/sandbox/openpgp/trunk/src/site/apt/index.apt URL: http://svn.apache.org/viewvc/commons/sandbox/openpgp/trunk/src/site/apt/index.apt?rev=1512828&r1=1512827&r2=1512828&view=diff == --- commons/sandbox/openpgp/trunk/src/site/apt/index.apt (original) +++ commons/sandbox/openpgp/trunk/src/site/apt/index.apt Sat Aug 10 22:07:41 2013 @@ -6,7 +6,7 @@ 10 December 2005 - -Jakarta Commons OpenPGP +Commons OpenPGP Commons OpenPGP was started to produce a common and simple interface for generating and verifying OpenPGP signatures.
svn commit: r1512827 - /commons/proper/commons-sandbox-parent/trunk/pom.xml
Author: dennisl Date: Sat Aug 10 21:57:33 2013 New Revision: 1512827 URL: http://svn.apache.org/r1512827 Log: commons-sandbox-parent:10 has been released so the version should now be 11-SNAPSHOT. Modified: commons/proper/commons-sandbox-parent/trunk/pom.xml Modified: commons/proper/commons-sandbox-parent/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/commons-sandbox-parent/trunk/pom.xml?rev=1512827&r1=1512826&r2=1512827&view=diff == --- commons/proper/commons-sandbox-parent/trunk/pom.xml (original) +++ commons/proper/commons-sandbox-parent/trunk/pom.xml Sat Aug 10 21:57:33 2013 @@ -27,7 +27,7 @@ under the License. org.apache.commons commons-sandbox-parent pom - 10-SNAPSHOT + 11-SNAPSHOT Commons Sandbox Parent http://commons.apache.org/sandbox/
svn commit: r1512825 - /commons/proper/math/trunk/src/changes/changes.xml
Author: erans Date: Sat Aug 10 21:47:57 2013 New Revision: 1512825 URL: http://svn.apache.org/r1512825 Log: MATH-991 Update "changes.xml". Modified: commons/proper/math/trunk/src/changes/changes.xml Modified: commons/proper/math/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1512825&r1=1512824&r2=1512825&view=diff == --- commons/proper/math/trunk/src/changes/changes.xml (original) +++ commons/proper/math/trunk/src/changes/changes.xml Sat Aug 10 21:47:57 2013 @@ -51,6 +51,10 @@ If the output is not quite correct, chec + +"PolynomialSplineFunction": added method "isValidPoint" that +checks whether a point is within the interpolation range. + "BicubicSplineInterpolatingFunction": added method "isValidPoint" that checks whether a point is within the interpolation range.
svn commit: r1512824 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/RandomDataGenerator.java
Author: erans Date: Sat Aug 10 21:42:39 2013 New Revision: 1512824 URL: http://svn.apache.org/r1512824 Log: MATH-1010 Deleted obsolete method (replaced by "MathArrays.shuffle"). Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/RandomDataGenerator.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/RandomDataGenerator.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/RandomDataGenerator.java?rev=1512824&r1=1512823&r2=1512824&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/RandomDataGenerator.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/RandomDataGenerator.java Sat Aug 10 21:42:39 2013 @@ -790,28 +790,6 @@ public class RandomDataGenerator impleme } /** - * Uses a 2-cycle permutation shuffle to randomly re-order the last elements - * of list. - * - * @param list list to be shuffled - * @param end element past which shuffling begins - */ -private void shuffle(int[] list, int end) { -int target = 0; -for (int i = list.length - 1; i >= end; i--) { -if (i == 0) { -target = 0; -} else { -// NumberIsTooLargeException cannot occur -target = nextInt(0, i); -} -int temp = list[target]; -list[target] = list[i]; -list[i] = temp; -} -} - -/** * Returns an array representing n. * * @param n the natural number to represent
svn commit: r1512811 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java
Author: mbenson Date: Sat Aug 10 18:04:12 2013 New Revision: 1512811 URL: http://svn.apache.org/r1512811 Log: make abbreviation maps immutable, andand add void:V for the sake of completeness Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java?rev=1512811&r1=1512810&r2=1512811&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ClassUtils.java Sat Aug 10 18:04:12 2013 @@ -104,36 +104,33 @@ public class ClassUtils { /** * Maps a primitive class name to its corresponding abbreviation used in array class names. */ -private static final Map abbreviationMap = new HashMap(); +private static final Map abbreviationMap; /** * Maps an abbreviation used in array class names to corresponding primitive class name. */ -private static final Map reverseAbbreviationMap = new HashMap(); - -/** - * Add primitive type abbreviation to maps of abbreviations. - * - * @param primitive Canonical name of primitive type - * @param abbreviation Corresponding abbreviation of primitive type - */ -private static void addAbbreviation(final String primitive, final String abbreviation) { -abbreviationMap.put(primitive, abbreviation); -reverseAbbreviationMap.put(abbreviation, primitive); -} +private static final Map reverseAbbreviationMap; /** * Feed abbreviation maps */ static { -addAbbreviation("int", "I"); -addAbbreviation("boolean", "Z"); -addAbbreviation("float", "F"); -addAbbreviation("long", "J"); -addAbbreviation("short", "S"); -addAbbreviation("byte", "B"); -addAbbreviation("double", "D"); -addAbbreviation("char", "C"); +final Map m = new HashMap(); +m.put("int", "I"); +m.put("boolean", "Z"); +m.put("float", "F"); +m.put("long", "J"); +m.put("short", "S"); +m.put("byte", "B"); +m.put("double", "D"); +m.put("char", "C"); +m.put("void", "V"); +final Map r = new HashMap(); +for (Map.Entry e : m.entrySet()) { +r.put(e.getValue(), e.getKey()); +} +abbreviationMap = Collections.unmodifiableMap(m); +reverseAbbreviationMap = Collections.unmodifiableMap(r); } /**
svn commit: r1512804 - in /commons/proper/compress/trunk/src: changes/ main/java/org/apache/commons/compress/archivers/ main/java/org/apache/commons/compress/archivers/cpio/ main/java/org/apache/commo
Author: bodewig Date: Sat Aug 10 17:04:41 2013 New Revision: 1512804 URL: http://svn.apache.org/r1512804 Log: Add encoding support to CPIO package - related to COMPRESS-180 Modified: commons/proper/compress/trunk/src/changes/changes.xml commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/ArchiveUtils.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=1512804&r1=1512803&r2=1512804&view=diff == --- commons/proper/compress/trunk/src/changes/changes.xml (original) +++ commons/proper/compress/trunk/src/changes/changes.xml Sat Aug 10 17:04:41 2013 @@ -97,7 +97,11 @@ The type attribute can be add,u DumpArchiveInputStream now supports an encoding parameter that -can be used to specify the default encoding of file names. +can be used to specify the encoding of file names. + + +The CPIO streams now support an encoding parameter that can be +used to specify the encoding of file names. http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java?rev=1512804&r1=1512803&r2=1512804&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java Sat Aug 10 17:04:41 2013 @@ -116,8 +116,8 @@ public class ArchiveStreamFactory { private String entryEncoding = null; /** - * Returns the encoding to use for arj, zip, dump and tar files, - * or null for the default. + * Returns the encoding to use for arj, zip, dump, cpio and tar + * files, or null for the default. * * @return entry encoding, or null * @since 1.5 @@ -127,8 +127,8 @@ public class ArchiveStreamFactory { } /** - * Sets the encoding to use for arj, zip, dump and tar files. Use - * null for the default. + * Sets the encoding to use for arj, zip, dump, cpio and tar + * files. Use null for the default. * * @since 1.5 */ @@ -185,7 +185,11 @@ public class ArchiveStreamFactory { return new JarArchiveInputStream(in); } if (CPIO.equalsIgnoreCase(archiverName)) { -return new CpioArchiveInputStream(in); +if (entryEncoding != null) { +return new CpioArchiveInputStream(in, entryEncoding); +} else { +return new CpioArchiveInputStream(in); +} } if (DUMP.equalsIgnoreCase(archiverName)) { if (entryEncoding != null) { @@ -238,7 +242,11 @@ public class ArchiveStreamFactory { return new JarArchiveOutputStream(out); } if (CPIO.equalsIgnoreCase(archiverName)) { -return new CpioArchiveOutputStream(out); +if (entryEncoding != null) { +return new CpioArchiveOutputStream(out, entryEncoding); +} else { +return new CpioArchiveOutputStream(out); +} } throw new ArchiveException("Archiver: " + archiverName + " not found."); } Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java?rev=1512804&r1=1512803&r2=1512804&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java Sat Aug 10 17:04:41 2013 @@ -24,7 +24,10 @@ import java.io.InputStream; import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.ArchiveInputStream; +import org.apache.commons.compress.archivers.zip.ZipEncoding; +import org.apache.commons.compress.archivers.zip.ZipEncodingHelper; import org.apache.commons.compress.utils.ArchiveUtils; +import org.apache.commons.compress.utils.CharsetNames; /** * CPIOArchiveInputStream is a str
svn commit: r1512801 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/convert/ test/java/org/apache/commons/configuration/convert/
Author: oheger Date: Sat Aug 10 17:01:00 2013 New Revision: 1512801 URL: http://svn.apache.org/r1512801 Log: Added missing svn properties. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java (contents, props changed) commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java (contents, props changed) commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDefaultConversionHandler.java (contents, props changed) Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java?rev=1512801&r1=1512800&r2=1512801&view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java Sat Aug 10 17:01:00 2013 @@ -50,7 +50,7 @@ import org.apache.commons.configuration. * configuration object can be adapted. * * - * @version $Id: $ + * @version $Id$ * @since 2.0 */ public interface ConversionHandler Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java -- svn:eol-style = native Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java -- svn:keywords = Author Id Revision HeadURL Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java?rev=1512801&r1=1512800&r2=1512801&view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java Sat Aug 10 17:01:00 2013 @@ -45,7 +45,7 @@ import org.apache.commons.lang3.ClassUti * actual conversion. * * - * @version $Id: $ + * @version $Id$ * @since 2.0 */ public class DefaultConversionHandler implements ConversionHandler Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java -- svn:eol-style = native Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java -- svn:keywords = Author Id Revision HeadURL Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDefaultConversionHandler.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDefaultConversionHandler.java?rev=1512801&r1=1512800&r2=1512801&view=diff == --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDefaultConversionHandler.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDefaultConversionHandler.java Sat Aug 10 17:01:00 2013 @@ -34,7 +34,7 @@ import org.junit.Test; /** * Test class for {@code DefaultConversionHandler}. * - * @version $Id: $ + * @version $Id$ */ public class TestDefaultConversionHandler { Propchange: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDefaultConversionHandler.java -- svn:eol-style = native Propchange: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDefaultConversionHandler.java -- svn:keywords = Author Id Revision HeadURL
svn commit: r1512799 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java test/java/org/apache/commons/configuration/convert/T
Author: oheger Date: Sat Aug 10 16:51:45 2013 New Revision: 1512799 URL: http://svn.apache.org/r1512799 Log: Initial implementation of DefaultConversionHandler. This class implements the conversion methods defined by the ConversionHandler interface. It delegates to PropertyConverter which does the actual type conversions. There are some protected methods which can be overridden by sub classes in order to customize the conversion mechanism. Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDefaultConversionHandler.java Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java?rev=1512799&view=auto == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java (added) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultConversionHandler.java Sat Aug 10 16:51:45 2013 @@ -0,0 +1,349 @@ +/* + * 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.configuration.convert; + +import java.lang.reflect.Array; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; + +import org.apache.commons.configuration.interpol.ConfigurationInterpolator; +import org.apache.commons.lang3.ClassUtils; + +/** + * + * A default implementation of the {@code ConversionHandler} interface. + * + * + * This class implements the standard data type conversions as used by + * {@code AbstractConfiguration} and derived classes. There is a central + * conversion method - {@code convert()} - for converting a passed in object to + * a given target class. The basic implementation already handles a bunch of + * standard data type conversions. If other conversions are to be supported, + * this method can be overridden. + * + * + * The object passed to {@code convert()} can be a single value or a complex + * object (like an array, a collection, etc.) containing multiple values. It + * lies in the responsibility of {@code convert()} to deal with such complex + * objects. The implementation provided by this class tries to extract the first + * child element and then delegates to {@code convertValue()} which does the + * actual conversion. + * + * + * @version $Id: $ + * @since 2.0 + */ +public class DefaultConversionHandler implements ConversionHandler +{ +/** A helper object used for extracting values from complex objects. */ +private static final AbstractListDelimiterHandler EXTRACTOR = +(AbstractListDelimiterHandler) DisabledListDelimiterHandler.INSTANCE; + +/** + * Constant for a default {@code ConfigurationInterpolator} to be used if + * none is provided by the caller. + */ +private static final ConfigurationInterpolator NULL_INTERPOLATOR = +new ConfigurationInterpolator() +{ +@Override +public Object interpolate(Object value) +{ +return value; +}; +}; + +public T to(Object src, Class targetCls, ConfigurationInterpolator ci) +{ +ConfigurationInterpolator interpolator = fetchInterpolator(ci); +return convert(interpolator.interpolate(src), targetCls, interpolator); +} + +/** + * {@inheritDoc} This implementation extracts all values stored in the + * passed in source object, converts them to the target type, and adds them + * to a result array. Arrays of objects and of primitive types are + * supported. If the source object is null, result is null, + * too. + */ +public Object toArray(Object src, Class elemClass, +ConfigurationInterpolator ci) +{ +if (src == null) +{ +return null; +
svn commit: r1512798 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/convert/AbstractListDelimiterHandler.java test/java/org/apache/commons/configuration/conve
Author: oheger Date: Sat Aug 10 16:51:12 2013 New Revision: 1512798 URL: http://svn.apache.org/r1512798 Log: Added a flatten() method which allows limiting the number of results. This method is needed for the conversion of collections or arrays to single values. Here only the first element needs to be extracted. It is more efficient to abort the extraction process early instead of producing the full result collection. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/AbstractListDelimiterHandler.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDisabledListDelimiterHandler.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/AbstractListDelimiterHandler.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/AbstractListDelimiterHandler.java?rev=1512798&r1=1512797&r2=1512798&view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/AbstractListDelimiterHandler.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/AbstractListDelimiterHandler.java Sat Aug 10 16:51:12 2013 @@ -119,16 +119,21 @@ public abstract class AbstractListDelimi protected abstract String escapeString(String s); /** - * Performs the actual work as advertised by the {@code parse()} method. The - * passed in object is evaluated (if necessary, in a recursive way), and all - * simple value objects it contains are extracted. They are returned as a - * collection. + * Extracts all values contained in the specified object up to the given + * limit. The passed in object is evaluated (if necessary in a recursive + * way). If it is a complex object (e.g. a collection or an array), all its + * elements are processed recursively and added to a target collection. The + * process stops if the limit is reached, but depending on the input object, + * it might be exceeded. (The limit is just an indicator to stop the process + * to avoid unnecessary work if the caller is only interested in a few + * values.) * * @param value the value to be processed + * @param limit the limit for aborting the processing * @return a "flat" collection containing all primitive values of * the passed in object */ -private Collection flatten(Object value) +Collection flatten(Object value, int limit) { if (value instanceof String) { @@ -138,19 +143,20 @@ public abstract class AbstractListDelimi Collection result = new LinkedList(); if (value instanceof Iterable) { -flattenIterator(result, ((Iterable) value).iterator()); +flattenIterator(result, ((Iterable) value).iterator(), limit); } else if (value instanceof Iterator) { -flattenIterator(result, (Iterator) value); +flattenIterator(result, (Iterator) value, limit); } else if (value != null) { if (value.getClass().isArray()) { -for (int len = Array.getLength(value), idx = 0; idx < len; idx++) +for (int len = Array.getLength(value), idx = 0, size = 0; idx < len +&& size < limit; idx++, size = result.size()) { -result.addAll(flatten(Array.get(value, idx))); +result.addAll(flatten(Array.get(value, idx), limit - size)); } } else @@ -163,17 +169,34 @@ public abstract class AbstractListDelimi } /** + * Performs the actual work as advertised by the {@code parse()} method. + * This method delegates to {@link #flatten(Object, int)} without specifying + * a limit. + * + * @param value the value to be processed + * @return a "flat" collection containing all primitive values of + * the passed in object + */ +private Collection flatten(Object value) +{ +return flatten(value, Integer.MAX_VALUE); +} + +/** * Flattens the given iterator. For each element in the iteration * {@code flatten()} is called recursively. * * @param target the target collection * @param it the iterator to process + * @param limit a limit for the number of elements to extract */ -private void flattenIterator(Collection target, Iterator it) +private void flattenIterator(Collection target, Iterator it, int limit) { -while (it.hasNext()) +int size = target.size(); +while (size < limit && it.hasNext()) { -target.addAll(flatten(it.next())); +
svn commit: r1512797 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/ main/java/org/apache/commons/configuration/beanutils/ main/java/org/apache/commons/config
Author: oheger Date: Sat Aug 10 16:49:31 2013 New Revision: 1512797 URL: http://svn.apache.org/r1512797 Log: Moved PropertyConverter to convert package. It will in future exclusively be used by classes in this package. Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/PropertyConverter.java - copied, changed from r1512796, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertyConverter.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestPropertyConverter.java - copied, changed from r1512796, commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertyConverter.java Removed: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertyConverter.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertyConverter.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/beanutils/DefaultBeanFactory.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/beanutils/XMLBeanDeclaration.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java?rev=1512797&r1=1512796&r2=1512797&view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java Sat Aug 10 16:49:31 2013 @@ -34,6 +34,7 @@ import java.util.concurrent.atomic.Atomi import org.apache.commons.configuration.convert.ConversionException; import org.apache.commons.configuration.convert.DefaultListDelimiterHandler; import org.apache.commons.configuration.convert.DisabledListDelimiterHandler; +import org.apache.commons.configuration.convert.PropertyConverter; import org.apache.commons.configuration.event.BaseEventSource; import org.apache.commons.configuration.event.ConfigurationErrorEvent; import org.apache.commons.configuration.event.ConfigurationErrorListener; Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java?rev=1512797&r1=1512796&r2=1512797&view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java Sat Aug 10 16:49:31 2013 @@ -33,6 +33,7 @@ import java.util.Locale; import java.util.NoSuchElementException; import org.apache.commons.configuration.convert.ConversionException; +import org.apache.commons.configuration.convert.PropertyConverter; import org.apache.commons.lang3.ClassUtils; import org.apache.commons.lang3.StringUtils; Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/beanutils/DefaultBeanFactory.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/beanutils/DefaultBeanFactory.java?rev=1512797&r1=1512796&r2=1512797&view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/beanutils/DefaultBeanFactory.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/beanutils/DefaultBeanFactory.java Sat Aug 10 16:49:31 2013 @@ -20,7 +20,7 @@ import java.lang.reflect.Constructor; import java.util.Collection; import java.util.Collections; -import org.apache.commons.configuration.PropertyConverter; +import org.apache.commons.configuration.convert.PropertyConverter; /** * Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/beanutils/XMLBeanDeclaration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/beanutils/XMLBeanDeclaration.java?rev=1512797&r1=1512796&r2=1512797&view=diff == --- comm
svn commit: r1512796 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/ main/java/org/apache/commons/configuration/convert/ test/java/org/apache/commons/configur
Author: oheger Date: Sat Aug 10 16:44:04 2013 New Revision: 1512796 URL: http://svn.apache.org/r1512796 Log: Moved ListDelimiterHandler classes to convert package. The topic of list delimiter handling is related to data type conversion. Also, some functionality for detecting containers (arrays, collections, ...) can be reused for some conversions. Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/AbstractListDelimiterHandler.java - copied, changed from r1512795, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractListDelimiterHandler.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DefaultListDelimiterHandler.java - copied, changed from r1512795, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultListDelimiterHandler.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/DisabledListDelimiterHandler.java - copied, changed from r1512795, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DisabledListDelimiterHandler.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/LegacyListDelimiterHandler.java - copied, changed from r1512795, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/LegacyListDelimiterHandler.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDefaultListDelimiterHandler.java - copied, changed from r1512795, commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDefaultListDelimiterHandler.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/convert/TestDisabledListDelimiterHandler.java - copied, changed from r1512795, commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDisabledListDelimiterHandler.java Removed: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractListDelimiterHandler.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultListDelimiterHandler.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DisabledListDelimiterHandler.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/LegacyListDelimiterHandler.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDefaultListDelimiterHandler.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDisabledListDelimiterHandler.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DatabaseConfiguration.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/MapConfiguration.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertiesConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfigurationBasicFeatures.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseNullConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCombinedConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCompositeConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationConverter.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationUtils.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDataConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDatabaseConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDynamicCombinedConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestINIConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestMapConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configurati
svn commit: r1512795 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java
Author: oheger Date: Sat Aug 10 16:41:19 2013 New Revision: 1512795 URL: http://svn.apache.org/r1512795 Log: Added ConversionHandler interface. This interface defines the basic facade of the data type conversion component. An object implementing this interface is associated with each configuration object. Requests for type conversions are delegated to this object. Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java?rev=1512795&view=auto == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java (added) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionHandler.java Sat Aug 10 16:41:19 2013 @@ -0,0 +1,111 @@ +/* + * 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.configuration.convert; + +import java.util.Collection; + +import org.apache.commons.configuration.interpol.ConfigurationInterpolator; + +/** + * + * An interface defining the possible data type conversions supported by the + * configuration framework. + * + * + * This interface defines a couple of methods related to different kinds of data + * type conversion: + * + * Conversion to an object of a specific type + * Conversion to an array of a specific type + * Conversion to a collection of a specific type + * + * + * + * Data type conversion is related to variable substitution (aka interpolation). + * Before a value can be converted to a target type substitution has to be + * performed first, and the conversion is done on the resulting value. In order + * to support this, the conversion methods expect a + * {@link ConfigurationInterpolator} object; {@code Configuration} + * implementations here pass in their associated instance. + * + * + * A {@code Configuration} object is associated with a concrete + * {@code ConversionHandler} implementation. Whenever a data type conversion is + * required it delegates to this handler. By providing a custom + * {@code ConversionHandler} object, the type conversion performed by the + * configuration object can be adapted. + * + * + * @version $Id: $ + * @since 2.0 + */ +public interface ConversionHandler +{ +/** + * Converts a single object to the specified target type. A concrete + * implementation has to attempt a conversion. If this is not possible, a + * {@link ConversionException} is thrown. It is up to a concrete + * implementation how null values are handled; a default strategy + * would be to return null if the source object is null. + * + * @param the type of the desired result + * @param src the object to be converted + * @param targetCls the target class of the conversion + * @param ci an object for performing variable substitution + * @return the converted object + * @throws ConversionException if the requested conversion is not possible + */ + T to(Object src, Class targetCls, ConfigurationInterpolator ci); + +/** + * Converts the given object to an array of the specified element type. The + * object can be a single value (e.g. a String, a primitive, etc.) or a + * complex object containing multiple values (like a collection or another + * array). In the latter case all elements contained in the complex object + * are converted to the target type. If the value(s) cannot be converted to + * the desired target class, a {@link ConversionException} is thrown. Note + * that the result type of this method is {@code Object}; because this + * method can also produce arrays of a primitive type the return type + * {@code Object[]} cannot be used. + * + * @param src the object to be converted + * @param elemClass the element class of the resulting array + * @param ci an object for
svn commit: r1512794 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/ main/java/org/apache/commons/configuration/convert/ test/java/org/apache/commons/configur
Author: oheger Date: Sat Aug 10 16:40:56 2013 New Revision: 1512794 URL: http://svn.apache.org/r1512794 Log: Created new convert package. This package will contain the code responsible for data type conversions. The ConversionException class was moved into the new package. Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/ConversionException.java - copied, changed from r1511080, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConversionException.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/convert/package.html Removed: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConversionException.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableConfiguration.java commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertyConverter.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestBaseNullConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDataConfiguration.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestPropertyConverter.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java?rev=1512794&r1=1512793&r2=1512794&view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/AbstractConfiguration.java Sat Aug 10 16:40:56 2013 @@ -31,6 +31,7 @@ import java.util.NoSuchElementException; import java.util.Properties; import java.util.concurrent.atomic.AtomicReference; +import org.apache.commons.configuration.convert.ConversionException; import org.apache.commons.configuration.event.BaseEventSource; import org.apache.commons.configuration.event.ConfigurationErrorEvent; import org.apache.commons.configuration.event.ConfigurationErrorListener; Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java?rev=1512794&r1=1512793&r2=1512794&view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DataConfiguration.java Sat Aug 10 16:40:56 2013 @@ -32,6 +32,7 @@ import java.util.List; import java.util.Locale; import java.util.NoSuchElementException; +import org.apache.commons.configuration.convert.ConversionException; import org.apache.commons.lang3.ClassUtils; import org.apache.commons.lang3.StringUtils; Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableConfiguration.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableConfiguration.java?rev=1512794&r1=1512793&r2=1512794&view=diff == --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableConfiguration.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ImmutableConfiguration.java Sat Aug 10 16:40:56 2013 @@ -22,6 +22,8 @@ import java.util.Iterator; import java.util.List; import java.util.Properties; +import org.apache.commons.configuration.convert.ConversionException; + /** * The main interface for accessing configuration data in a read-only fashion. * Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/PropertyConverter.java URL: http://svn.apache.org/viewvc/commons/proper/config
svn commit: r1512789 - in /commons/proper/compress/trunk/src: changes/ main/java/org/apache/commons/compress/archivers/ main/java/org/apache/commons/compress/archivers/dump/ main/java/org/apache/commo
Author: bodewig Date: Sat Aug 10 16:22:49 2013 New Revision: 1512789 URL: http://svn.apache.org/r1512789 Log: Add encoding support to DumpArchiveInputStream - related to COMPRESS-180 Modified: commons/proper/compress/trunk/src/changes/changes.xml commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.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=1512789&r1=1512788&r2=1512789&view=diff == --- commons/proper/compress/trunk/src/changes/changes.xml (original) +++ commons/proper/compress/trunk/src/changes/changes.xml Sat Aug 10 16:22:49 2013 @@ -95,6 +95,10 @@ The type attribute can be add,u TarArchiveOutputStream now properly handles link names that are too long to fit into a traditional TAR header. + +DumpArchiveInputStream now supports an encoding parameter that +can be used to specify the default encoding of file names. + Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java?rev=1512789&r1=1512788&r2=1512789&view=diff == --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java Sat Aug 10 16:22:49 2013 @@ -116,7 +116,7 @@ public class ArchiveStreamFactory { private String entryEncoding = null; /** - * Returns the encoding to use for arj, zip and tar files, + * Returns the encoding to use for arj, zip, dump and tar files, * or null for the default. * * @return entry encoding, or null @@ -127,8 +127,8 @@ public class ArchiveStreamFactory { } /** - * Sets the encoding to use for arj, zip and tar files. - * Use null for the default. + * Sets the encoding to use for arj, zip, dump and tar files. Use + * null for the default. * * @since 1.5 */ @@ -188,7 +188,11 @@ public class ArchiveStreamFactory { return new CpioArchiveInputStream(in); } if (DUMP.equalsIgnoreCase(archiverName)) { -return new DumpArchiveInputStream(in); +if (entryEncoding != null) { +return new DumpArchiveInputStream(in, entryEncoding); +} else { +return new DumpArchiveInputStream(in); +} } throw new ArchiveException("Archiver: " + archiverName + " not found."); 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=1512789&r1=1512788&r2=1512789&view=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 Sat Aug 10 16:22:49 2013 @@ -20,6 +20,8 @@ package org.apache.commons.compress.arch import org.apache.commons.compress.archivers.ArchiveException; import org.apache.commons.compress.archivers.ArchiveInputStream; +import org.apache.commons.compress.archivers.zip.ZipEncoding; +import org.apache.commons.compress.archivers.zip.ZipEncodingHelper; import java.io.EOFException; import java.io.IOException; @@ -39,6 +41,11 @@ import java.util.Stack; * the archive, and the read each entry as a normal input stream * using read(). * + * There doesn't seem to exist a hint on the encoding of string values + * in any piece documentation. Given the main purpose of dump/restore + * is backing up a system it seems very likely the format uses the + * current default encoding of the system. + * * @NotThreadSafe *
svn commit: r1512686 - /commons/proper/imaging/trunk/
Author: britter Date: Sat Aug 10 13:09:53 2013 New Revision: 1512686 URL: http://svn.apache.org/r1512686 Log: Add IntelliJ configuration files to svn:ignore Modified: commons/proper/imaging/trunk/ (props changed) Propchange: commons/proper/imaging/trunk/ -- --- svn:ignore (original) +++ svn:ignore Sat Aug 10 13:09:53 2013 @@ -5,3 +5,5 @@ target tmp .externalToolBuilders maven-eclipse.xml +.idea +commons-imaging.iml
svn commit: r1512650 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java
Author: britter Date: Sat Aug 10 11:46:28 2013 New Revision: 1512650 URL: http://svn.apache.org/r1512650 Log: Fix typo Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java?rev=1512650&r1=1512649&r2=1512650&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Sat Aug 10 11:46:28 2013 @@ -49,7 +49,7 @@ final class Lexer { private final char delimiter; private final char escape; private final char quoteChar; -private final char commmentStart; +private final char commentStart; private final boolean ignoreSurroundingSpaces; private final boolean ignoreEmptyLines; @@ -63,7 +63,7 @@ final class Lexer { this.delimiter = format.getDelimiter(); this.escape = mapNullToDisabled(format.getEscape()); this.quoteChar = mapNullToDisabled(format.getQuoteChar()); -this.commmentStart = mapNullToDisabled(format.getCommentStart()); +this.commentStart = mapNullToDisabled(format.getCommentStart()); this.ignoreSurroundingSpaces = format.getIgnoreSurroundingSpaces(); this.ignoreEmptyLines = format.getIgnoreEmptyLines(); } @@ -409,14 +409,14 @@ final class Lexer { } boolean isCommentStart(final int ch) { -return ch == commmentStart; +return ch == commentStart; } private boolean isMetaChar(final int ch) { return ch == delimiter || ch == escape || ch == quoteChar || - ch == commmentStart; + ch == commentStart; } /**
svn commit: r1512626 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java
Author: britter Date: Sat Aug 10 11:08:57 2013 New Revision: 1512626 URL: http://svn.apache.org/r1512626 Log: Make checkstyle happy: Line was longer than 120 chars Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java?rev=1512626&r1=1512625&r2=1512626&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Sat Aug 10 11:08:57 2013 @@ -307,9 +307,10 @@ final class Lexer { * On return, the next character is available by calling {@link ExtendedBufferedReader#getLastChar()} * on the input stream. * - * @return the unescaped character (as an int) or {@link Constants#END_OF_STREAM} if char following the escape is invalid. + * @return the unescaped character (as an int) or {@link Constants#END_OF_STREAM} if char following the escape is + * invalid. * @throws IOException if there is a problem reading the stream or the end of stream is detected: - * the escape character is not allowed at end of strem + * the escape character is not allowed at end of strem */ int readEscape() throws IOException { // the escape char has just been read (normally a backslash)
svn commit: r1512625 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
Author: britter Date: Sat Aug 10 11:07:15 2013 New Revision: 1512625 URL: http://svn.apache.org/r1512625 Log: Make checkstyle happy: Line was longer than 120 chars, file contained tabs Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java?rev=1512625&r1=1512624&r2=1512625&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java Sat Aug 10 11:07:15 2013 @@ -64,8 +64,8 @@ final class ExtendedBufferedReader exten /** * Returns the last character that was read as an integer (0 to 65535). This will be the last character returned by * any of the read methods. This will not include a character read using the {@link #lookAhead()} method. If no - * character has been read then this will return {@link Constants#UNDEFINED}. If the end of the stream was reached on the - * last read then this will return {@link Constants#END_OF_STREAM}. + * character has been read then this will return {@link Constants#UNDEFINED}. If the end of the stream was reached + * on the last read then this will return {@link Constants#END_OF_STREAM}. * * @return the last character that was read */ @@ -157,22 +157,22 @@ final class ExtendedBufferedReader exten return eolCounter + 1; // Allow for counter being incremented only at EOL } - public boolean isClosed() { - return closed; - } - - /** -* Closes the stream. -* -* @throws IOException -* If an I/O error occurs -*/ - @Override - public void close() throws IOException { - // Set ivars before calling super close() in case close() throws an IOException. - closed = true; - lastChar = END_OF_STREAM; - super.close(); - } +public boolean isClosed() { +return closed; +} + +/** + * Closes the stream. + * + * @throws IOException + * If an I/O error occurs + */ +@Override +public void close() throws IOException { +// Set ivars before calling super close() in case close() throws an IOException. +closed = true; +lastChar = END_OF_STREAM; +super.close(); +} }
svn commit: r1512624 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
Author: britter Date: Sat Aug 10 11:05:10 2013 New Revision: 1512624 URL: http://svn.apache.org/r1512624 Log: Make checkstyle happy: remove trailing whitespace Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1512624&r1=1512623&r2=1512624&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Sat Aug 10 11:05:10 2013 @@ -195,7 +195,7 @@ public final class CSVParser implements * If an I/O error occurs */ public static CSVParser parse(URL url, Charset charset, final CSVFormat format) throws IOException { -return new CSVParser(new InputStreamReader(url.openStream(), +return new CSVParser(new InputStreamReader(url.openStream(), charset == null ? Charset.forName("UTF-8") : charset), format); }
svn commit: r1512623 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Author: britter Date: Sat Aug 10 11:04:34 2013 New Revision: 1512623 URL: http://svn.apache.org/r1512623 Log: Make checkstyle happy: remove trailing white spaces, break line that was longer than 120 chars. Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1512623&r1=1512622&r2=1512623&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Sat Aug 10 11:04:34 2013 @@ -62,10 +62,10 @@ import java.util.Set; * * CSVFormat.EXCEL.withHeader("Col1", "Col2", "Col3"); * - * Calling {@link #withHeader(String...)} let's you use the given names to address values in a {@link CSVRecord}, and + * Calling {@link #withHeader(String...)} let's you use the given names to address values in a {@link CSVRecord}, and * assumes that your CSV source does not contain a first record that also defines column names. If it does, then - * you are overriding this metadata with your names and you should skip the first record by calling - * {@link #withSkipHeaderRecord(boolean)} with {@code true}. + * you are overriding this metadata with your names and you should skip the first record by calling + * {@link #withSkipHeaderRecord(boolean)} with {@code true}. * * Parsing * @@ -78,19 +78,19 @@ import java.util.Set; * * Referencing columns safely * - * If your source contains a header record, you can simplify your code and safely reference columns, + * If your source contains a header record, you can simplify your code and safely reference columns, * by using {@link #withHeader(String...)} with no arguments: * * CSVFormat.EXCEL.withHeader(); * * This causes the parser to read the first record and use its values as column names. * Then, call one of the {@link CSVRecord} get method that takes a String column name argument: - * + * * String value = record.get("Col1"); * * This makes your code impervious to changes in column order in the CSV file. * - * Notes + * Notes * * This class is immutable. * @@ -125,7 +125,8 @@ public class CSVFormat implements Serial * withIgnoreEmptyLines(true) * */ -public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true, CRLF, null, null, false); +public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, +false, true, CRLF, null, null, false); /** * Comma separated format as defined by http://tools.ietf.org/html/rfc4180";>RFC 4180.
svn commit: r1512622 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
Author: britter Date: Sat Aug 10 10:58:42 2013 New Revision: 1512622 URL: http://svn.apache.org/r1512622 Log: Remove redundant cast Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1512622&r1=1512621&r2=1512622&view=diff == --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Sat Aug 10 10:58:42 2013 @@ -700,7 +700,7 @@ public class CSVParserTest { @Test(expected = IllegalArgumentException.class) public void testInvalidFormat() throws Exception { final CSVFormat invalidFormat = CSVFormat.DEFAULT.withDelimiter(CR); -new CSVParser((Reader) null, invalidFormat).close(); +new CSVParser(null, invalidFormat).close(); } private void validateRecordNumbers(final String lineSeparator) throws IOException {
svn commit: r1512620 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java
Author: britter Date: Sat Aug 10 10:52:09 2013 New Revision: 1512620 URL: http://svn.apache.org/r1512620 Log: Fix JavaDoc references Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java?rev=1512620&r1=1512619&r2=1512620&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Sat Aug 10 10:52:09 2013 @@ -307,7 +307,7 @@ final class Lexer { * On return, the next character is available by calling {@link ExtendedBufferedReader#getLastChar()} * on the input stream. * - * @return the unescaped character (as an int) or {@link END_OF_STREAM} if char following the escape is invalid. + * @return the unescaped character (as an int) or {@link Constants#END_OF_STREAM} if char following the escape is invalid. * @throws IOException if there is a problem reading the stream or the end of stream is detected: * the escape character is not allowed at end of strem */
svn commit: r1512619 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
Author: britter Date: Sat Aug 10 10:51:43 2013 New Revision: 1512619 URL: http://svn.apache.org/r1512619 Log: Fix JavaDoc references Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java?rev=1512619&r1=1512618&r2=1512619&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java Sat Aug 10 10:51:43 2013 @@ -63,9 +63,9 @@ final class ExtendedBufferedReader exten /** * Returns the last character that was read as an integer (0 to 65535). This will be the last character returned by - * any of the read methods. This will not include a character read using the {@link #peek()} method. If no - * character has been read then this will return {@link #UNDEFINED}. If the end of the stream was reached on the - * last read then this will return {@link #END_OF_STREAM}. + * any of the read methods. This will not include a character read using the {@link #lookAhead()} method. If no + * character has been read then this will return {@link Constants#UNDEFINED}. If the end of the stream was reached on the + * last read then this will return {@link Constants#END_OF_STREAM}. * * @return the last character that was read */ @@ -109,7 +109,7 @@ final class ExtendedBufferedReader exten * * Increments {@link #eolCounter} * - * Sets {@link #lastChar} to {@link #END_OF_STREAM} at EOF, otherwise to LF + * Sets {@link #lastChar} to {@link Constants#END_OF_STREAM} at EOF, otherwise to LF * * @return the line that was read, or null if reached EOF. */
svn commit: r1512621 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
Author: britter Date: Sat Aug 10 10:57:32 2013 New Revision: 1512621 URL: http://svn.apache.org/r1512621 Log: No need for explicitly creating an array. Arrays.asList is a varargs method. Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1512621&r1=1512620&r2=1512621&view=diff == --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Sat Aug 10 10:57:32 2013 @@ -168,7 +168,7 @@ public class CSVPrinterTest { public void testExcelPrintAllArrayOfLists() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL); -printer.printRecords(new List[] { Arrays.asList(new String[] { "r1c1", "r1c2" }), Arrays.asList(new String[] { "r2c1", "r2c2" }) }); +printer.printRecords(new List[] { Arrays.asList("r1c1", "r1c2"), Arrays.asList("r2c1", "r2c2") }); assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString()); printer.close(); } @@ -186,8 +186,8 @@ public class CSVPrinterTest { public void testExcelPrintAllIterableOfLists() throws IOException { final StringWriter sw = new StringWriter(); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.EXCEL); -printer.printRecords(Arrays.asList(new List[] { Arrays.asList(new String[] { "r1c1", "r1c2" }), -Arrays.asList(new String[] { "r2c1", "r2c2" }) })); +printer.printRecords(Arrays.asList(new List[] { Arrays.asList("r1c1", "r1c2"), +Arrays.asList("r2c1", "r2c2") })); assertEquals("r1c1,r1c2" + recordSeparator + "r2c1,r2c2" + recordSeparator, sw.toString()); printer.close(); }
svn commit: r1512618 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java
Author: britter Date: Sat Aug 10 10:49:30 2013 New Revision: 1512618 URL: http://svn.apache.org/r1512618 Log: Don't make JavaDoc references from production code to test code Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java?rev=1512618&r1=1512617&r2=1512618&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java Sat Aug 10 10:49:30 2013 @@ -131,7 +131,6 @@ public final class CSVRecord implements * the header size. Some programs can export files that fails this test but still produce parsable files. * * @return true of this record is valid, false if not - * @see CSVParserTest#org.apache.commons.csv.CSVParserTest.testMappedButNotSetAsOutlook2007ContactExport() */ public boolean isConsistent() { return mapping == null ? true : mapping.size() == values.length;
svn commit: r1512617 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java
Author: britter Date: Sat Aug 10 10:46:03 2013 New Revision: 1512617 URL: http://svn.apache.org/r1512617 Log: Remove unused method. It made no sense anyway, since Assert.assertArrayEquals is capable of comparing multi dimensional arrays. Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java?rev=1512617&r1=1512616&r2=1512617&view=diff == --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java Sat Aug 10 10:46:03 2013 @@ -33,20 +33,6 @@ final class Utils { } /** - * Checks if the two 2d arrays have identical contents. - * - * @param message the message to be displayed - * @param expected the 2d array of expected results - * @param actual the 2d array of actual results - */ -public static void compare(final String message, final String[][] expected, final String[][] actual) { -Assert.assertEquals(message+" - outer array size", expected.length, actual.length); -for(int i = 0; i < expected.length; i++) { -Assert.assertArrayEquals(message+" (entry "+i+")",expected[i], actual[i]); -} -} - -/** * Checks if the 2d array has the same contents as the list of records. * * @param message the message to be displayed
svn commit: r1512615 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java
Author: britter Date: Sat Aug 10 10:41:27 2013 New Revision: 1512615 URL: http://svn.apache.org/r1512615 Log: Utils class is only used for internal testing, it can be package private. Also make it final since it should not be extended. Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java?rev=1512615&r1=1512614&r2=1512615&view=diff == --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/Utils.java Sat Aug 10 10:41:27 2013 @@ -27,7 +27,7 @@ import org.junit.Assert; * * @version $Id$ */ -public class Utils { +final class Utils { private Utils() { }
svn commit: r1512614 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
Author: britter Date: Sat Aug 10 10:39:48 2013 New Revision: 1512614 URL: http://svn.apache.org/r1512614 Log: Make members private, they are only needed in this test case Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1512614&r1=1512613&r2=1512614&view=diff == --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original) +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Sat Aug 10 10:39:48 2013 @@ -42,7 +42,9 @@ import org.junit.Test; */ public class CSVPrinterTest { -public static String printable(final String s) { +private final String recordSeparator = CSVFormat.DEFAULT.getRecordSeparator(); + +private static String printable(final String s) { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { final char ch = s.charAt(i); @@ -55,9 +57,7 @@ public class CSVPrinterTest { return sb.toString(); } -String recordSeparator = CSVFormat.DEFAULT.getRecordSeparator(); - -public void doOneRandom(final CSVFormat format) throws Exception { +private void doOneRandom(final CSVFormat format) throws Exception { final Random r = new Random(); final int nLines = r.nextInt(4) + 1; @@ -91,13 +91,13 @@ public class CSVPrinterTest { Utils.compare("Printer output :" + printable(result), lines, parseResult); } -public void doRandom(final CSVFormat format, final int iter) throws Exception { +private void doRandom(final CSVFormat format, final int iter) throws Exception { for (int i = 0; i < iter; i++) { doOneRandom(format); } } -public String randStr() { +private String randStr() { final Random r = new Random(); final int sz = r.nextInt(20);
svn commit: r1512610 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Author: britter Date: Sat Aug 10 10:32:19 2013 New Revision: 1512610 URL: http://svn.apache.org/r1512610 Log: Methods are no longer used in test code. Make them private. Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1512610&r1=1512609&r2=1512610&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Sat Aug 10 10:32:19 2013 @@ -187,8 +187,7 @@ public class CSVFormat implements Serial * * @return true if c is a line break character */ -// package protected to give access without needing a synthetic accessor -static boolean isLineBreak(final char c) { +private static boolean isLineBreak(final char c) { return c == LF || c == CR; } @@ -200,8 +199,7 @@ public class CSVFormat implements Serial * * @return true if c is a line break character (and not null) */ -// package protected to give access without needing a synthetic accessor -static boolean isLineBreak(final Character c) { +private static boolean isLineBreak(final Character c) { return c != null && isLineBreak(c.charValue()); }
svn commit: r1512606 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Author: britter Date: Sat Aug 10 10:30:48 2013 New Revision: 1512606 URL: http://svn.apache.org/r1512606 Log: Sort members alphabetically Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1512606&r1=1512605&r2=1512606&view=diff == --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Sat Aug 10 10:30:48 2013 @@ -100,19 +100,6 @@ public class CSVFormat implements Serial private static final long serialVersionUID = 1L; -/** - * Returns true if the given character is a line break character. - * - * @param c - *the character to check, may be null - * - * @return true if c is a line break character (and not null) - */ -// package protected to give access without needing a synthetic accessor -static boolean isLineBreak(final Character c) { -return c != null && isLineBreak(c.charValue()); -} - private final char delimiter; private final Character quoteChar; // null if quoting is disabled private final Quote quotePolicy; @@ -206,6 +193,19 @@ public class CSVFormat implements Serial } /** + * Returns true if the given character is a line break character. + * + * @param c + *the character to check, may be null + * + * @return true if c is a line break character (and not null) + */ +// package protected to give access without needing a synthetic accessor +static boolean isLineBreak(final Character c) { +return c != null && isLineBreak(c.charValue()); +} + +/** * Creates a new CSV format with the specified delimiter. * * @param delimiter