Re: [classad-users] Error message


Date: Sun, 2 Jun 2002 17:26:18 -0500 (CDT)
From: Alain Aslag Roy <roy@xxxxxxxxxxx>
Subject: Re: [classad-users] Error message
Giuseppe,

>I need to get the error message displayed by the parse() method of the
>class ClassAddParser and put it in a string or something else.  How can
>I do it? is there a "global" variable containing the error message or a
>particular method returning this message?

Yes, I believe we can get the Java ClassAd source code to you. I believe 
the only real issue is that no one has packaged it up yet. I will try to do 
this within a couple of days and get it to you. Can you receive large 
attachments in email?

I asked the Java developer (who isn't yet on this email list) about the 
above question, and he wrote:

>Currently, parse error messages are always written to System.err.  You can 
>turn these messages off entirely by calling p.setVerbosity(0), where p is 
>your instance of lassAdParser.  If you have access to the source (I 
>believe the policy is "open source" for Condor Java code), you should find 
>it easy to modify the method error(String), which is at the end of 
>classad.y, to get the functionality you want.  The file classad.y is 
>processed by a version of yacc to create Parser.java, which is used by 
>ClassAdParser.   Everything in classad.y from the last "%%" to the end is 
>simply copied into Parser.java, so it should be easy to do add a "public 
>String errorMessage" field (or a private field and a public 
>getErrorMessage method).  A somewhat cleaner solution (which I will add to 
>the RFE list) would be to add a method to ClassAdParser along the lines of 
>"void setErrorStream(PrintWriter err)". You could then use a StringWriter 
>if you want the error messsage as a string.

-alain




[← Prev in Thread] Current Thread [Next in Thread→]