Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 9075 invoked from network); 10 Feb 2006 16:02:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Feb 2006 16:02:26 -0000 Received: (qmail 49105 invoked by uid 500); 10 Feb 2006 16:02:19 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 49066 invoked by uid 500); 10 Feb 2006 16:02:19 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 49055 invoked by uid 99); 10 Feb 2006 16:02:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2006 08:02:19 -0800 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [68.142.201.64] (HELO web30911.mail.mud.yahoo.com) (68.142.201.64) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 10 Feb 2006 08:02:18 -0800 Received: (qmail 25620 invoked by uid 60001); 10 Feb 2006 16:01:56 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=EhfxmhGXLTIC0AYGz6oa8+RmMGx5eTDPO9e/OJ5KxDhs2t0Bee10zCSGQYCUtKPwDsmv8K0wvqHG4uUaG5WXloEJDNdImCrviTduu0HiUQk59SGo/ID2dn9TD27+ZJKTw3tjFWTRt5W7pMCN2RDAjV+r6WxUjIVsBbfadgUxJ58= ; Message-ID: <20060210160156.25618.qmail@web30911.mail.mud.yahoo.com> Received: from [66.10.233.130] by web30911.mail.mud.yahoo.com via HTTP; Fri, 10 Feb 2006 08:01:56 PST Date: Fri, 10 Feb 2006 08:01:56 -0800 (PST) From: Matt Benson Subject: Re: Displaying the value in a Java class? To: Ant Users List In-Reply-To: <003f01c62e57$9c3ec670$0d02a8c0@athlon> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --- Rhino wrote: > > [I've lost the original email containing this thread > but I found it in the > MARC archives and pasted it below the line of equal > signs....] > > Matt, > > You are absolutely right, it was NOT _remotely_ > obvious that BCEL has to be > present in order for LoadProperties to work. If you > hadn't posted that fact, > I would never have found that in the manual, for > several reasons: > 1. LoadProperties is a core task so I would have > assumed that it wouldn't > need extra jars. It's my understanding that core > tasks, by definition, are > ones that don't need extra jars to work. Apparently, > this is not true; even > a core task may need extra jars in somes cases. > 2. The article on LoadProperties doesn't mention the > need for BCEL to be > present. It's not loadproperties that needs BCEL; it's the classconstants filterchain. > 3. The article on FilterChains doesn't mention the > need for BCEL to be > present. > There should be a link; will add. > Even if I had looked at the optional jars page, I > might have missed it > because I would have been looking for filterchains > or loadproperties in the > second column of the table, not specifically > "ClassConstants filter reader". > > So thank you VERY much for pointing that out. As > soon as I installed BCEL, I > found that my task executed without the > IOExceptions. > > Unfortunately, I still have one problem that may > keep this from being the > solution to my problem after all: the ClassConstants > filter reader > apparently only gets information about _String_ > constants (it only returned > values for the Strings in my .class file but no > other types) but the > constant I am trying to read is defined as follows: > > public static final EmploymentHistoryFormats > DESIRED_EMPLOYMENT_HISTORY_FORMAT = > EmploymentHistoryFormats.LIST_FORMAT; > > EmploymentHistoryFormats is an enum, not a String. > > Is there any way to coax this filter to tell me that > the current value of > DESIRED_EMPLOYMENT_HISTORY_FORMAT is LIST_FORMAT? > That's all I really want > to know to get my build.xml working 100%. > > If not, is there any other way to get this > information? filter the Java file w/ regex looking for "^[\s]*public static final EmploymentHistoryFormats DESIRED_EMPLOYMENT_HISTORY_FORMAT[\s]*=[\s]*([^;]+);[\s]*$" and replace w/ "\1"? -Matt > > -- > Rhino > > ================================================================= > I thought the manual was wrong at first too, but > using > a class file is correct. What is not as obvious is > that you need BCEL to make it work. This is > documented in install.html#librarydependencies from > the manual. > > HTH, > Matt > > --- Rhino wrote: > > > The classcontents filterreader might very well be > > exactly what I want - if I > > could understand how to use it! > > > > I've just tried several experiments and nothing > > works for me; nothing at > > all. > > > > I must be misunderstanding some of the concepts. > For > > instance, it _looks_ as > > if I should be able to read a file, grab all the > > constants from it, and turn > > them into properties. But I can't make out if I'm > > supposed to reading a > > class file or a source file: it _looks_ as if I > > should be reading a class > > file, which seems counterintuitive to me. > > Nevertheless, I've tried pointing > > the task at both a real .class file and at a real > > Java source file in turn > > but I inevitably get "Unable to load file: > > java.io.IOException" regardless > > of which I use. Here is my task: > > > > > > > > > > > > > > > > > > > > > > > > > > > > (Replacing the srcfile value with > > "ResumeConstants.class" made no difference > > at all. Both the source and the class file are in > > the same directory as the > > Ant script itself, just to keep things nice and > > simple.) > > > > Here is the stackTrace: > > > > BUILD FAILED > > > > > E:\eclipse\3.1.1\eclipse\workspace\Resume_JDK_1.5.0\xml\filter.xml:34: > > > > Unable to load file: java.io.IOException > > > > at > > > org.apache.tools.ant.taskdefs.LoadProperties.execute(LoadProperties.java:227) > > > > at > > > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) > > > > at > org.apache.tools.ant.Task.perform(Task.java:364) > > > > at > > > org.apache.tools.ant.Target.execute(Target.java:341) > > > > at > > > org.apache.tools.ant.Target.performTasks(Target.java:369) > > > > at > > > org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) > > > > at > > > org.apache.tools.ant.Project.executeTarget(Project.java:1185) > > > > at > > > org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) > > > > at > > > org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDe > > \ > faultExecutor.java:32) > > > > at > > > org.apache.tools.ant.Project.executeTargets(Project.java:1068) > > > > at > > > org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:42 > > \ > 3) > > > > at > > > org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:1 > > \ > 37) > > > > Caused by: java.io.IOException > > > > at > > > org.apache.tools.ant.filters.ClassConstants.read(ClassConstants.java:136) > > > > at > > > org.apache.tools.ant.filters.BaseFilterReader.read(BaseFilterReader.java:86) > > > > at java.io.Reader.read(Unknown Source) > === message truncated === __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org