Wrong exception in groovy.text.TemplateEngine?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrong exception in groovy.text.TemplateEngine?

Hilmar Bunjes
Hi,
I've just found that
"public Template createTemplate(String templateText)" in
groovy.text.TemplateEngine can throw an FileNotFoundException.

The part of interest in the class is:
>public abstract Template createTemplate(Reader reader) throws
CompilationFailedException, ClassNotFoundException, IOException;

>public Template createTemplate(String templateText) throws
CompilationFailedException, FileNotFoundException,
ClassNotFoundException, IOException {
>        return createTemplate(new StringReader(templateText));
>}

So I wonder if there is just a wrong exception in the throws-clause or
is there any sense in the FileNotFoundException?

Thanks,
Hilmar

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Wrong exception in groovy.text.TemplateEngine?

tugwilson

On 17 Jan 2007, at 15:28, Hilmar Bunjes wrote:

> Hi,
> I've just found that
> "public Template createTemplate(String templateText)" in
> groovy.text.TemplateEngine can throw an FileNotFoundException.
>
> The part of interest in the class is:
>> public abstract Template createTemplate(Reader reader) throws
> CompilationFailedException, ClassNotFoundException, IOException;
>
>> public Template createTemplate(String templateText) throws
> CompilationFailedException, FileNotFoundException,
> ClassNotFoundException, IOException {
>>        return createTemplate(new StringReader(templateText));
>> }
>
> So I wonder if there is just a wrong exception in the throws-clause or
> is there any sense in the FileNotFoundException?


The FileNotFoundException in the throws clause is redundant as  
FileNotFoundException is a subclass of IOException.

The actual implementation of this interface could well throw an  
IOException even if the parameter is a String.


John Wilson
The Wilson Partnership
web http://www.wilson.co.uk
blog http://eek.ook.org



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

RE: Wrong exception in groovy.text.TemplateEngine?

Furash Gary
Every so often I need to do something using the windows script host
stuff (e.g., change an environment variable, etc.

I'd rather do this with groovy.  Has anyone ever gotten something like
this to work?

Thanks

G

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Accessing environment variables

Raffaele Castagno-3
You can easily read them with

println System.getenv().each {println it}

but AFAIK you must call system specific commands to set them. (ie. "set"
for win, "export" for *nix)

Raffaele

Furash Gary ha scritto:

> Every so often I need to do something using the windows script host
> stuff (e.g., change an environment variable, etc.
>
> I'd rather do this with groovy.  Has anyone ever gotten something like
> this to work?
>
> Thanks
>
> G
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
>  

--
        */Raffaele CASTAGNO
/*/Logistica & Retail/
/[hidden email]
<mailto:[hidden email]>/

/www.gruppotesi.com/

------------------------------------------------------------------------
*TESI S.p.A.*
Sede Legale: Via Mendicita' Istruita, 24 - 12042 Bra (CN)
Sede Operativa: Via Savigliano, 48 - 12060 Loc. Roreto di Cherasco (CN)
Tel. 0172 476301 - Fax 0172 476399 - [hidden email]

/
Disclaimer
Questo messaggio è rivolto unicamente al destinatario indicato e
potrebbe contenere informazioni riservate o confidenziali. Nel caso lo
avesse ricevuto per errore, ci scusiamo per l'inconveniente: lo segnali
cortesemente al mittente e distrugga subito l'originale. Ogni altro
utilizzo sarà considerato illegale. Tesi SpA non si assume alcuna
responsabilità per usi impropri di questo messaggio o di sue parti./

/This message is for the designated recipient only and may contain
privileged or confidential information. If you have received it in
error, we apologize for this: please notify the sender immediately and
delete the original. Any other use of the message is illegal. Tesi SpA
does not accept any liability for corruption, interception or damages,
if any, caused by unauthorized use of this message or parts./



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

RE: Wrong exception in groovy.text.TemplateEngine?

Dierk König
In reply to this post by Furash Gary
See the Scriptom wiki pages or chapter 15 of Groovy in Action
(most likely WScript.shell is what you need)

ciao
Dierk

http://groovy.canoo.com/gina

> -----Original Message-----
> From: Furash Gary [mailto:[hidden email]]
> Sent: Mittwoch, 17. Januar 2007 16:59
> To: [hidden email]
> Cc: Furash Gary
> Subject: RE: [groovy-user] Wrong exception in
> groovy.text.TemplateEngine?
>
>
> Every so often I need to do something using the windows script host
> stuff (e.g., change an environment variable, etc.
>
> I'd rather do this with groovy.  Has anyone ever gotten something like
> this to work?
>
> Thanks
>
> G
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

RE: Wrong exception in groovy.text.TemplateEngine?

Furash Gary
Thanks

-----Original Message-----
From: Dierk Koenig [mailto:[hidden email]]
Sent: Wednesday, January 17, 2007 9:15 AM
To: [hidden email]
Subject: RE: [groovy-user] Wrong exception in
groovy.text.TemplateEngine?

See the Scriptom wiki pages or chapter 15 of Groovy in Action (most
likely WScript.shell is what you need)

ciao
Dierk

http://groovy.canoo.com/gina

> -----Original Message-----
> From: Furash Gary [mailto:[hidden email]]
> Sent: Mittwoch, 17. Januar 2007 16:59
> To: [hidden email]
> Cc: Furash Gary
> Subject: RE: [groovy-user] Wrong exception in
> groovy.text.TemplateEngine?
>
>
> Every so often I need to do something using the windows script host
> stuff (e.g., change an environment variable, etc.
>
> I'd rather do this with groovy.  Has anyone ever gotten something like

> this to work?
>
> Thanks
>
> G
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email