From feb447ccc19eb3a5059fb0e421190b8799b57e87 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 13 Jan 2003 12:05:52 +0000 Subject: [PATCH] Enable compilation without Sun classes. PR: 16006 Submitted by: Dalibor Topic git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273785 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ build.xml | 1 - src/main/org/apache/tools/ant/taskdefs/Get.java | 11 ++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 72e577a3c..0ea1ebded 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -85,6 +85,9 @@ Fixed bugs: elements in Ant and the refid attribute didn't point to an existing project reference. +* The task can now be compiled (and Ant thus bootstrapped) using + Kaffee. + Other changes: -------------- * The filesetmanifest attribute of has been reenabled. diff --git a/build.xml b/build.xml index be15d5c31..39fab94d2 100644 --- a/build.xml +++ b/build.xml @@ -169,7 +169,6 @@ - diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java index 8ee98307e..66f952636 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Get.java +++ b/src/main/org/apache/tools/ant/taskdefs/Get.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -146,10 +146,11 @@ public class Get extends Task { String encoding; // check to see if sun's Base64 encoder is available. try { - sun.misc.BASE64Encoder encoder = - (sun.misc.BASE64Encoder) - Class.forName("sun.misc.BASE64Encoder").newInstance(); - encoding = encoder.encode (up.getBytes()); + Object encoder = + Class.forName("sun.misc.BASE64Encoder").newInstance(); + encoding = (String) + encoder.getClass().getMethod("encode", new Class[] {byte[].class}) + .invoke(encoder, new Object[] {up.getBytes()}); } catch (Exception ex) { // sun's base64 encoder isn't available Base64Converter encoder = new Base64Converter();