git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@440476 13f79535-47bb-0310-9956-ffa450edef68master
@@ -245,9 +245,10 @@ Victor Toni | |||
Waldek Herka | |||
Will Wang | |||
William Ferguson | |||
Wolf Siberski | |||
Wolfgang Baer | |||
Wolfgang Frech | |||
Wolfgang Werner | |||
Wolf Siberski | |||
Yohann Roussel | |||
Yuji Yamano | |||
Yves Martin | |||
@@ -28,6 +28,8 @@ Other changes: | |||
* trim the driver attribute on the <sql> task. Bugzilla report 21228. | |||
* Allow (jar) files as well as directories to be given to jdepend. | |||
Bugzilla report 28865. | |||
* Convert SplashTask to use NOT sun internal classes. | |||
Bugzilla report 35619. | |||
Changes from Ant 1.6.5 to Ant 1.7.0Beta1 | |||
======================================== | |||
@@ -190,13 +190,6 @@ | |||
<filename name="${ant.package}/taskdefs/email/UUMailer*"/> | |||
</selector> | |||
<selector id="needs.sun.b64"> | |||
<or> | |||
<filename name="${optional.package}/splash/SplashTask*"/> | |||
<filename name="${optional.package}/splash/SplashScreenTest.java"/> | |||
</or> | |||
</selector> | |||
<!-- depends on external libraries --> | |||
<selector id="needs.trax"> | |||
<or> | |||
@@ -503,8 +496,6 @@ | |||
</and> | |||
</condition> | |||
<available property="base64.present" classname="sun.misc.BASE64Encoder"/> | |||
<property name="build.tests.resolved" location="${build.tests}"/> | |||
<condition property="tests.are.on.system.classpath"> | |||
<or> | |||
@@ -651,7 +642,6 @@ | |||
<selector refid="needs.jdk1.5+" unless="jdk1.5+"/> | |||
<selector refid="not.in.kaffe" if="kaffe"/> | |||
<selector refid="needs.sun.uue" unless="sunuue.present"/> | |||
<selector refid="needs.sun.b64" unless="base64.present"/> | |||
<selector refid="needs.trax" unless="trax.present"/> | |||
<selector refid="needs.apache-resolver" unless="apache.resolver.present"/> | |||
@@ -970,17 +970,21 @@ | |||
<first>William</first> | |||
<last>Ferguson</last> | |||
</name> | |||
<name> | |||
<first>Wolf</first> | |||
<last>Siberski</last> | |||
</name> | |||
<name> | |||
<first>Wolfgang</first> | |||
<last>Frech</last> | |||
<last>Baer</last> | |||
</name> | |||
<name> | |||
<first>Wolfgang</first> | |||
<last>Werner</last> | |||
<last>Frech</last> | |||
</name> | |||
<name> | |||
<first>Wolf</first> | |||
<last>Siberski</last> | |||
<first>Wolfgang</first> | |||
<last>Werner</last> | |||
</name> | |||
<name> | |||
<first>Yohann</first> | |||
@@ -336,80 +336,12 @@ public class Get extends Task { | |||
this.pword = p; | |||
} | |||
/********************************************************************* | |||
* BASE 64 encoding of a String or an array of bytes. | |||
* | |||
* Based on RFC 1421. | |||
* | |||
*********************************************************************/ | |||
protected static class Base64Converter { | |||
public final char[] alphabet = { | |||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 to 7 | |||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 8 to 15 | |||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 16 to 23 | |||
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 24 to 31 | |||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 32 to 39 | |||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 40 to 47 | |||
'w', 'x', 'y', 'z', '0', '1', '2', '3', // 48 to 55 | |||
'4', '5', '6', '7', '8', '9', '+', '/'}; // 56 to 63 | |||
public String encode(String s) { | |||
return encode(s.getBytes()); | |||
} | |||
public String encode(byte[] octetString) { | |||
int bits24; | |||
int bits6; | |||
char[] out = new char[((octetString.length - 1) / 3 + 1) * 4]; | |||
int outIndex = 0; | |||
int i = 0; | |||
while ((i + 3) <= octetString.length) { | |||
// store the octets | |||
bits24 = (octetString[i++] & 0xFF) << 16; | |||
bits24 |= (octetString[i++] & 0xFF) << 8; | |||
bits24 |= octetString[i++]; | |||
bits6 = (bits24 & 0x00FC0000) >> 18; | |||
out[outIndex++] = alphabet[bits6]; | |||
bits6 = (bits24 & 0x0003F000) >> 12; | |||
out[outIndex++] = alphabet[bits6]; | |||
bits6 = (bits24 & 0x00000FC0) >> 6; | |||
out[outIndex++] = alphabet[bits6]; | |||
bits6 = (bits24 & 0x0000003F); | |||
out[outIndex++] = alphabet[bits6]; | |||
} | |||
if (octetString.length - i == 2) { | |||
// store the octets | |||
bits24 = (octetString[i] & 0xFF) << 16; | |||
bits24 |= (octetString[i + 1] & 0xFF) << 8; | |||
bits6 = (bits24 & 0x00FC0000) >> 18; | |||
out[outIndex++] = alphabet[bits6]; | |||
bits6 = (bits24 & 0x0003F000) >> 12; | |||
out[outIndex++] = alphabet[bits6]; | |||
bits6 = (bits24 & 0x00000FC0) >> 6; | |||
out[outIndex++] = alphabet[bits6]; | |||
// padding | |||
out[outIndex++] = '='; | |||
} else if (octetString.length - i == 1) { | |||
// store the octets | |||
bits24 = (octetString[i] & 0xFF) << 16; | |||
bits6 = (bits24 & 0x00FC0000) >> 18; | |||
out[outIndex++] = alphabet[bits6]; | |||
bits6 = (bits24 & 0x0003F000) >> 12; | |||
out[outIndex++] = alphabet[bits6]; | |||
// padding | |||
out[outIndex++] = '='; | |||
out[outIndex++] = '='; | |||
} | |||
return new String(out); | |||
} | |||
} | |||
/** | |||
* Provide this for Backward Compatibility. | |||
*/ | |||
protected static class Base64Converter | |||
extends org.apache.tools.ant.util.Base64Converter {} | |||
public interface DownloadProgress { | |||
/** | |||
@@ -28,6 +28,7 @@ import javax.swing.ImageIcon; | |||
import org.apache.tools.ant.BuildException; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.Task; | |||
import org.apache.tools.ant.util.Base64Converter; | |||
/** | |||
* Creates a splash screen. The splash screen is displayed | |||
@@ -141,9 +142,11 @@ public class SplashTask extends Task { | |||
conn = url.openConnection(); | |||
if (user != null && user.length() > 0) { | |||
// converted from sun internal classes to | |||
// new Base64Converter | |||
// utility class extracted from Get task | |||
String encodedcreds = | |||
new sun.misc.BASE64Encoder().encode( | |||
(new String(user + ":" + password)).getBytes()); | |||
new Base64Converter().encode(user + ":" + password); | |||
conn.setRequestProperty("Proxy-Authorization", | |||
encodedcreds); | |||
} | |||
@@ -0,0 +1,106 @@ | |||
/* | |||
* 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.tools.ant.util; | |||
/** | |||
* BASE 64 encoding of a String or an array of bytes. | |||
* | |||
* Based on RFC 1421. | |||
* | |||
**/ | |||
public class Base64Converter { | |||
private final static char[] ALPHABET = { | |||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 to 7 | |||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 8 to 15 | |||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 16 to 23 | |||
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 24 to 31 | |||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 32 to 39 | |||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 40 to 47 | |||
'w', 'x', 'y', 'z', '0', '1', '2', '3', // 48 to 55 | |||
'4', '5', '6', '7', '8', '9', '+', '/'}; // 56 to 63 | |||
/** Provided for BC purposes */ | |||
public static final char[] alphabet = ALPHABET; | |||
/** | |||
* Encode a string into base64 encoding. | |||
* @param s the string to encode. | |||
* @return the encoded string. | |||
*/ | |||
public String encode(String s) { | |||
return encode(s.getBytes()); | |||
} | |||
/** | |||
* Encode a byte array into base64 encoding. | |||
* @param octetString the byte array to encode. | |||
* @return the encoded string. | |||
*/ | |||
public String encode(byte[] octetString) { | |||
int bits24; | |||
int bits6; | |||
char[] out = new char[((octetString.length - 1) / 3 + 1) * 4]; | |||
int outIndex = 0; | |||
int i = 0; | |||
while ((i + 3) <= octetString.length) { | |||
// store the octets | |||
bits24 = (octetString[i++] & 0xFF) << 16; | |||
bits24 |= (octetString[i++] & 0xFF) << 8; | |||
bits24 |= octetString[i++]; | |||
bits6 = (bits24 & 0x00FC0000) >> 18; | |||
out[outIndex++] = ALPHABET[bits6]; | |||
bits6 = (bits24 & 0x0003F000) >> 12; | |||
out[outIndex++] = ALPHABET[bits6]; | |||
bits6 = (bits24 & 0x00000FC0) >> 6; | |||
out[outIndex++] = ALPHABET[bits6]; | |||
bits6 = (bits24 & 0x0000003F); | |||
out[outIndex++] = ALPHABET[bits6]; | |||
} | |||
if (octetString.length - i == 2) { | |||
// store the octets | |||
bits24 = (octetString[i] & 0xFF) << 16; | |||
bits24 |= (octetString[i + 1] & 0xFF) << 8; | |||
bits6 = (bits24 & 0x00FC0000) >> 18; | |||
out[outIndex++] = ALPHABET[bits6]; | |||
bits6 = (bits24 & 0x0003F000) >> 12; | |||
out[outIndex++] = ALPHABET[bits6]; | |||
bits6 = (bits24 & 0x00000FC0) >> 6; | |||
out[outIndex++] = ALPHABET[bits6]; | |||
// padding | |||
out[outIndex++] = '='; | |||
} else if (octetString.length - i == 1) { | |||
// store the octets | |||
bits24 = (octetString[i] & 0xFF) << 16; | |||
bits6 = (bits24 & 0x00FC0000) >> 18; | |||
out[outIndex++] = ALPHABET[bits6]; | |||
bits6 = (bits24 & 0x0003F000) >> 12; | |||
out[outIndex++] = ALPHABET[bits6]; | |||
// padding | |||
out[outIndex++] = '='; | |||
out[outIndex++] = '='; | |||
} | |||
return new String(out); | |||
} | |||
} |