Re: Issue implementing Runtime.exec() with StreamGobbler




"Vic" <vikrantp@xxxxxxxxx> wrote in message
news:94832ae5-aed7-46cf-8cc2-b51b3d5dd6dc@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mar 6, 9:56 am, Knute Johnson <nos...@xxxxxxxxxxxxxxxxxxxxxxx>
wrote:

<snip code>

int val = proc.waitFor();
System.out.println("ExitValue for Command "+cmd+" is: "+val);

stdout = outputGobbler.getResult();
stderr = errorGobbler.getResult();

//VikP - Waits for these threads to die
errorGobbler.join();
outputGobbler.join();

Thanks for the reply. it doesn't throw any exception or anything just
ends without running all the tests and its not like the loop gets
terminated at one specific point its random and could be anywhere in
the entire loop. Sometimes it runs 100 cases n will stop whereas
sometimes it'll run 150x cases n will stop there

There is a small opportunity for error in that you are retrieving the stream
gobbler results before the threads have finished. That is, the test process
may have finished, but some output in the pipeline is still being processed
by the stream gobbler. getResult will return null because the results are
not transferred until the reading loop has finished.

The answer to your problem is in the loop code (please show it) because the
call to the executer must either return or throw an exception. What are
the loop exit conditions? What happens to any exceptions (e.g. Xml-out
query... exception) ? What did the JVM do after the loop exited?

Matt Humphrey http://www.iviz.com/


.



Relevant Pages

  • Re: Issue implementing Runtime.exec() with StreamGobbler
    ... stderr = errorGobbler.getResult; ... the entire loop. ... call to the executer must either return or throw an exception. ...
    (comp.lang.java.programmer)
  • Re: Is it possible to throw an exception into parent thread?
    ... Is it possible to get the exception back to the UI thread is the ... idly waiting for a windows message, it may be deep down in the middle ... of a loop, it could be anywhere. ...
    (microsoft.public.dotnet.framework)
  • Re: how can I write complex roots in a text file?
    ... you can get out of the lopp the definitions of ... the variables which not change during the loop: ... for indice = 1:length ...
    (comp.soft-sys.matlab)
  • Re: long double versions of functions in gcc under Cygwin
    ... rather than the nearest enclosing one) and a decent exception ... them it doesn't seem like goto usage would be affected ... int typfun() ... Why use a for loop when it is just a while loop in disguise? ...
    (comp.lang.c)
  • Re: CInternetSession
    ... the presence of the Sleepindicates the serious design flaw. ... Sleep() calls around like pixie dust, your design is fundamentally broken and will need to ... If you use Sleepin a loop, your design is probably wrong and needs to be ... The "First Chance Exception" message usually indicates nothing harmful. ...
    (microsoft.public.vc.mfc)