ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: java errors when running build file
Date Mon, 22 Jan 2007 11:50:51 GMT
Dalibor Topic wrote:

> Steve Loughran <stevel <at> apache.org> writes:
> 
>> Mike.Horn <at> wincanton.co.uk wrote:
>>> Hello
>>>
>>> HP-UX11i
>>> Java 1.3
>>> ANT v.1.7.0
>>>
>>> $ ant -f Unix_Build.xml
>>> Buildfile: Unix_Build.xml
>>>  [property] java.lang.reflect.InvocationTargetException: 
>>> java.lang.IllegalArgume
>>> ntException: Unknown signal: HUP
>>>  [property]     at sun.misc.Signal.<init>(Unknown Source)
>>>  [property]     at java.lang.Terminator.setup(Unknown Source)
> 
> [snip]
> 
>> In smartfrog we have to wrap signal setup with an exception catcher, as 
>> it fails earlly on on the kaffe JVMs. We catch it and warn that the tool 
>> is not tested on those JVMs and so use at your own risk...
> 
> We don't have an implementation of sun.misc.Signal in Kaffe, I don't think it's
> part of the standard API.
> 

no, its not, which is why my work project skips the whole signal 
handling setup -its currently sun JVM only.

If ant is doing some signal handling during an exec it should catch a 
failure and continue with the run.

(pause)

OK. here's the source in question.

1. ant uses reflection to get the shutdown hook.
     public ProcessDestroyer() {
         try {
             // check to see if the shutdown hook methods exists
             // (support pre-JDK 1.3 VMs)
             Class[] paramTypes = {Thread.class};
             addShutdownHookMethod =
                 Runtime.class.getMethod("addShutdownHook", paramTypes);

             removeShutdownHookMethod =
                 Runtime.class.getMethod("removeShutdownHook", paramTypes);
             // wait to add shutdown hook as needed
         } catch (NoSuchMethodException e) {
             // it just won't be added as a shutdown hook... :(
         } catch (Exception e) {
             e.printStackTrace();
         }
     }

If there is no method (as with kaffe), then nothing is printed.

2. when the hook is added, if the method throws an exception, then yes, 
it is printed.

     private void addShutdownHook() {
         if (addShutdownHookMethod != null && !running) {
             destroyProcessThread = new ProcessDestroyerImpl();
             Object[] args = {destroyProcessThread};
             try {
                 addShutdownHookMethod.invoke(Runtime.getRuntime(), args);
                 added = true;
             } catch (IllegalAccessException e) {
                 e.printStackTrace();
             } catch (InvocationTargetException e) {
                 Throwable t = e.getTargetException();
                 if (t != null && t.getClass() == 
IllegalStateException.class) {
                     // shutdown already is in progress
                     running = true;
                 } else {
                     e.printStackTrace();
                 }
             }
         }
     }

This code is not tied to a project, and so cannot use Project.log(). 
Otherwise I'd downgrade the trace to a -verbose level. As it is, I think 
we just need to leave it in.

Mike: this stack trace is a warning that your JVM doesnt support the 
complete signal set. It is mostly harmless, but you should know that if 
you kill ant with a control-C or similar, processes it starts may hang 
around, as ant wont get told. Other than that, its a message you can ignore.

-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message