[jira] [Issue Comment Edited] (CSV-70) Improve readability of CSVLexer

2012-03-25 Thread Sebb (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/CSV-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13238039#comment-13238039
 ] 

Sebb edited comment on CSV-70 at 3/26/12 1:29 AM:
--

Yes, I tried something similar and it broke the tests.

I think it would be useful to provide (optional) access to the comment fields 
so one way to solve this would be to return the comment as a token, and deal 
with it at the record level.

  was (Author: s...@apache.org):
Yes, I tried something similar and it broke the tests.

I think it would be useful to provide (optional) access to the comment fields 
so one way to solve this would be to return the comment as a token, and deal 
will it at the record level.
  
> Improve readability of CSVLexer
> ---
>
> Key: CSV-70
> URL: https://issues.apache.org/jira/browse/CSV-70
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.0
>Reporter: Benedikt Ritter
> Fix For: 1.0
>
>
> There are several things that can be improved in the token lexer (this has 
> also been discussed on ML, see http://markmail.org/thread/c6x5ji4v44nx5k4h):
> * Remove Token input parameter in nextToken()
> * Add convenience methods isDelimiter(c) and isEncapsulator(c)
> * Remove current caracter input parameter from methods
> * If possible: replace while(true) loops

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (CSV-70) Improve readability of CSVLexer

2012-03-25 Thread Sebb (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/CSV-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13238039#comment-13238039
 ] 

Sebb commented on CSV-70:
-

Yes, I tried something similar and it broke the tests.

I think it would be useful to provide (optional) access to the comment fields 
so one way to solve this would be to return the comment as a token, and deal 
will it at the record level.

> Improve readability of CSVLexer
> ---
>
> Key: CSV-70
> URL: https://issues.apache.org/jira/browse/CSV-70
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.0
>Reporter: Benedikt Ritter
> Fix For: 1.0
>
>
> There are several things that can be improved in the token lexer (this has 
> also been discussed on ML, see http://markmail.org/thread/c6x5ji4v44nx5k4h):
> * Remove Token input parameter in nextToken()
> * Add convenience methods isDelimiter(c) and isEncapsulator(c)
> * Remove current caracter input parameter from methods
> * If possible: replace while(true) loops

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (CSV-86) Remove current character input parameter from Lexer methods

2012-03-25 Thread Sebb (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/CSV-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13238032#comment-13238032
 ] 

Sebb commented on CSV-86:
-

As I wrote on the dve list, the current character may perhaps be required for 
the readEscape method.

> Remove current character input parameter from Lexer methods
> ---
>
> Key: CSV-86
> URL: https://issues.apache.org/jira/browse/CSV-86
> Project: Commons CSV
>  Issue Type: Sub-task
>  Components: Parser
>Reporter: Benedikt Ritter
> Fix For: 1.0
>
> Attachments: CSV-86.patch
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (SANDBOX-416) Improve DFS/BFS visit states

2012-03-25 Thread Claudio Squarcella (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/SANDBOX-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13237995#comment-13237995
 ] 

Claudio Squarcella commented on SANDBOX-416:


Hi,

I just implemented and committed the change, see 
[r1305162|http://svn.apache.org/viewvc?view=revision&revision=1305162]. 
I'll wait for your ack before marking the issue as resolved!

Ciao,
Claudio

> Improve DFS/BFS visit states
> 
>
> Key: SANDBOX-416
> URL: https://issues.apache.org/jira/browse/SANDBOX-416
> Project: Commons Sandbox
>  Issue Type: Improvement
>  Components: Graph
>Reporter: Simone Tripodi
>Assignee: Simone Tripodi
>
> As discussed in 
> [ML|http://mail-archives.apache.org/mod_mbox/commons-dev/201203.mbox/%3CCAAqLGLOhZYC8qvT4TLugsnqCgw9BQ-%2BkYoGXVrKASy7PDZdeoQ%40mail.gmail.com%3E],
>  {{org.apache.commons.graph.visit.GraphVisitHandler}} methods that return 
> {{boolean}} flags can be sometimes not so intuitive.
> The proposal is replacing {{boolean}} flags return statements with an 
> enumeration values {{ABORT}}, {{CONTINUE}}, {{SKIP}} to identify
>  * visit has to be immediately terminated
>  * visit can continue;
>  * current node children visit can be skipped.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (SANDBOX-416) Improve DFS/BFS visit states

2012-03-25 Thread Simone Tripodi (Created) (JIRA)
Improve DFS/BFS visit states


 Key: SANDBOX-416
 URL: https://issues.apache.org/jira/browse/SANDBOX-416
 Project: Commons Sandbox
  Issue Type: Improvement
  Components: Graph
Reporter: Simone Tripodi
Assignee: Simone Tripodi


As discussed in 
[ML|http://mail-archives.apache.org/mod_mbox/commons-dev/201203.mbox/%3CCAAqLGLOhZYC8qvT4TLugsnqCgw9BQ-%2BkYoGXVrKASy7PDZdeoQ%40mail.gmail.com%3E],
 {{org.apache.commons.graph.visit.GraphVisitHandler}} methods that return 
{{boolean}} flags can be sometimes not so intuitive.

The proposal is replacing {{boolean}} flags return statements with an 
enumeration values {{ABORT}}, {{CONTINUE}}, {{SKIP}} to identify

 * visit has to be immediately terminated
 * visit can continue;
 * current node children visit can be skipped.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Updated] (EXEC-65) Watchdog can't destroy 'sudo' and 'sleep'

2012-03-25 Thread Rusi Filipov (Updated) (JIRA)

 [ 
https://issues.apache.org/jira/browse/EXEC-65?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rusi Filipov updated EXEC-65:
-

Description: 
I want to run a command from a shell script with make sure the process will be 
destroyed after a timeout, especially if it asks for user input or contains 
sleep commands.

{code:title=Java}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("./client.sh");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}

I run this code on the server like this:
{code}
java -cp .:commons-exec-1.1.jar App
{code}

*Problem 1.* I want to run {{sudo}} in order to execute a script as a different 
user:
{code:title=client.sh}
#!/bin/bash
sudo -u occ02 /apps/occ02/catalina_base/bin/restart-occ.sh
{code}
In case of a misconfiguration of {{/etc/sudoers}} this prompts me for a 
password.
{code}
Password:
{code}
And terminates only after about 5 minutes, not 3 seconds:
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}
Only if I use the {{sudo -S ...}} the process is killed after about 4 seconds:
{code}
Password:
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 1 (Exit value: 1)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}

*Problem 2.* I want to prevent a too long {{sleep}}:
{code:title=client.sh}
#!/bin/bash
sleep 900
{code}
The Process just hangs! After 15 minutes the process terminates with this error:
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}

If I run the {{sleep}} command directly from within Java without the 
shell-script, the process is destroyed on time:
{code}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("sleep");
command.addArgument("900");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy4(App.java:67)
at App.main(App.java:23)
{code}

The problems were not visible when I tested on my development machine with 
Windows 7 64bit and JDK 1.6.0_25, 64bit. But now these issues are a serious 
barrier for using commons-exec in production.

Btw, with the {{ProcessBuilder}} from the JDK the process is destroyed in both 
cases:
{code}
ProcessBuilder builder = new ProcessBuilder("./client.sh");
Process process = builder.start();
Thread.sleep(3000);
process.destroy();
{code}

Best regards,
Rusi

  was:
I want to run a command from a shell script with make sure the process will be 
destroyed after a timeout, especially if it asks for user input or contains 
sleep commands.

{code:title=Java}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("./client.sh");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}

I run this code on the server like this:
{code}
java -cp .:commons-exec-1.1.jar App
{code}

*Problem 1.* I want to run {{sudo}} in order to execute a script 

[jira] [Updated] (EXEC-65) Watchdog can't destroy 'sudo' and 'sleep'

2012-03-25 Thread Rusi Filipov (Updated) (JIRA)

 [ 
https://issues.apache.org/jira/browse/EXEC-65?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rusi Filipov updated EXEC-65:
-

Description: 
I want to run a command from a shell script with make sure the process will be 
destroyed after a timeout, especially if it asks for user input or contains 
sleep commands.

{code:title=Java}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("./client.sh");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}

I run this code on the server like this:
{code}
java -cp .:commons-exec-1.1.jar App
{code}

*Problem 1.* I want to run {{sudo}} in order to execute a script as a different 
user:
{code:title=client.sh}
#!/bin/bash
sudo -u occ02 /apps/occ02/catalina_base/bin/restart-occ.sh
{code}
In case of a misconfiguration of {{/etc/sudoers}} this prompts me for a 
password.
{code}
Password:
{code}
And terminates only after about 5 minutes, not 3 seconds:
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}
Only if I use the {{-S}} option the process is killed after about 4 seconds:
{code}
Password:
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 1 (Exit value: 1)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}

*Problem 2.* I want to prevent a too long {{sleep}}:
{code:title=client.sh}
#!/bin/bash
sleep 900
{code}
The Process just hangs! After 15 minutes the process terminates with this error:
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}

If I run the {{sleep}} command directly from within Java without the 
shell-script, the process is destroyed on time:
{code}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("sleep");
command.addArgument("900");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy4(App.java:67)
at App.main(App.java:23)
{code}

These issues are currently blocking us to use commons-exec in production. The 
problems were not visible when I tested on my development machine with Windows 
7 64bit and JDK 1.6.0_25, 64bit. 

Btw, with the {{ProcessBuilder}} from the JDK the process is destroyed in both 
cases:
{code}
ProcessBuilder builder = new ProcessBuilder("./client.sh");
Process process = builder.start();
Thread.sleep(3000);
process.destroy();
{code}

Best regards,
Rusi

  was:
I want to run a command from a shell script with make sure the process will be 
destroyed after a timeout, especially if it asks for user input or contains 
sleep commands.

{code:title=Java}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("./client.sh");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}

I run this code on the server like this:
{code}
java -cp .:commons-exec-1.1.jar App
{code}

*Problem 1.* I want to run {{sudo}} in order to execute a script as a dif

[jira] [Updated] (EXEC-65) Watchdog can't destroy 'sudo' and 'sleep'

2012-03-25 Thread Rusi Filipov (Updated) (JIRA)

 [ 
https://issues.apache.org/jira/browse/EXEC-65?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rusi Filipov updated EXEC-65:
-

Description: 
I want to run a command from a shell script with make sure the process will be 
destroyed after a timeout, especially if it asks for user input or contains 
sleep commands.

{code:title=Java}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("./client.sh");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}

I run this code on the server like this:
{code}
java -cp .:commons-exec-1.1.jar App
{code}

*Problem 1.* I want to run {{sudo}} in order to execute a script as a different 
user:
{code:title=client.sh}
#!/bin/bash
sudo -u occ02 /apps/occ02/catalina_base/bin/restart-occ.sh
{code}
In case of a misconfiguration of {{/etc/sudoers}} this prompts me for a 
password.
{code}
Password:
{code}
And terminates only after about 5 minutes, not 3 seconds:
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}
Only if I use the {{sudo -S ...}} the process is killed after about 4 seconds:
{code}
Password:
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 1 (Exit value: 1)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}

*Problem 2.* I want to prevent a too long {{sleep}}:
{code:title=client.sh}
#!/bin/bash
sleep 900
{code}
The Process just hangs! After 15 minutes the process terminates with this error:
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}

If I run the {{sleep}} command directly from within Java without the 
shell-script, the process is destroyed on time:
{code}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("sleep");
command.addArgument("900");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy4(App.java:67)
at App.main(App.java:23)
{code}

These issues are currently blocking us to use commons-exec in production. The 
problems were not visible when I tested on my development machine with Windows 
7 64bit and JDK 1.6.0_25, 64bit. 

Btw, with the {{ProcessBuilder}} from the JDK the process is destroyed in both 
cases:
{code}
ProcessBuilder builder = new ProcessBuilder("./client.sh");
Process process = builder.start();
Thread.sleep(3000);
process.destroy();
{code}

Best regards,
Rusi

  was:
I want to run a command from a shell script with make sure the process will be 
destroyed after a timeout, especially if it asks for user input or contains 
sleep commands.

{code:title=Java}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("./client.sh");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}

I run this code on the server like this:
{code}
java -cp .:commons-exec-1.1.jar App
{code}

*Problem 1.* I want to run {{sudo}} in order to execute a script as a d

[jira] [Updated] (EXEC-65) Watchdog can't destroy 'sudo' and 'sleep'

2012-03-25 Thread Rusi Filipov (Updated) (JIRA)

 [ 
https://issues.apache.org/jira/browse/EXEC-65?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rusi Filipov updated EXEC-65:
-

Description: 
I want to run a command from a shell script with make sure the process will be 
destroyed after a timeout, especially if it asks for user input or contains 
sleep commands.

{code:title=Java}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("./client.sh");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}

I run this code on the server like this:
{code}
java -cp .:commons-exec-1.1.jar App
{code}

*Problem 1.* I want to run {{sudo}} in order to execute a script as a different 
user:
{code:title=client.sh}
#!/bin/bash
sudo -u occ02 /apps/occ02/catalina_base/bin/restart-occ.sh
{code}
In case of a misconfiguration of {{/etc/sudoers}} this prompts me for a 
password.
{code}
Password:
{code}
And terminates only after about 5 minutes, not 3 seconds:
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}
Only if I use the {{-S}} option the process is killed after about 4 seconds:
{code}
Password:
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 1 (Exit value: 1)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}

*Problem 2.* I want to prevent a too long {{sleep}}:
{code:title=client.sh}
#!/bin/bash
sleep 900
{code}
The Process is not destroyed!

These issues are currently blocking us to use commons-exec in production. The 
problems were not visible when I tested on my development machine with Windows 
7 64bit and JDK 1.6.0_25, 64bit. 

Btw, with the {{ProcessBuilder}} from the JDK the process is destroyed in both 
cases:
{code}
ProcessBuilder builder = new ProcessBuilder("./client.sh");
Process process = builder.start();
Thread.sleep(3000);
process.destroy();
{code}

Best regards,
Rusi

  was:
I want to run a command from a shell script with and make sure the process will 
be destroyed after a fixed timeout, especially if it asks for user input or has 
sleep commands inside.

{code:title=Java}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("./client.sh");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}

I run this code on the server like this:
{code}
java -cp .:commons-exec-1.1.jar App
{code}

*Problem 1.* I want to run {{sudo}} in order to execute a script as a different 
user:
{code:title=client.sh}
#!/bin/bash
sudo -u occ02 /apps/occ02/catalina_base/bin/restart-occ.sh
{code}
In case of a misconfiguration of {{/etc/sudoers}} this prompts me for a 
password.
{code}
Password:
{code}
And terminates only after about 5 minutes, not 3 seconds:
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}
Only if I use the {{-S}} option the process is killed after about 4 seconds:
{code}
Password:
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 1 (Exit value: 1)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}

*Problem 2.* I want to prevent a too long {{sleep}}:
{code:title=client.sh}
#!/bin/bash
sleep 900
{code}
The Process is not destroyed!

These issues are currently block

[jira] [Created] (EXEC-65) Watchdog can't destroy 'sudo' and 'sleep'

2012-03-25 Thread Rusi Filipov (Created) (JIRA)
Watchdog can't destroy 'sudo' and 'sleep'
-

 Key: EXEC-65
 URL: https://issues.apache.org/jira/browse/EXEC-65
 Project: Commons Exec
  Issue Type: Bug
Affects Versions: 1.1
 Environment: RedHat Enterprise Linux 64bit, JDK 1.6.0_25 64bit.

{code}
$ uname -a
Linux demo-vrs1-happdb1.lts.stgt.vrs.cust.disy.net 2.6.9-42.ELsmp #1 SMP Wed 
Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux
{code}

{code}
$ java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Server VM (build 20.0-b11, mixed mode)
{code}
Reporter: Rusi Filipov
Priority: Critical


I want to run a command from a shell script with and make sure the process will 
be destroyed after a fixed timeout, especially if it asks for user input or has 
sleep commands inside.

{code:title=Java}
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
ExecuteWatchdog watchDog = new ExecuteWatchdog(3000);
executor.setWatchdog(watchDog);
CommandLine command = new CommandLine("./client.sh");
int exitValue = executor.execute(command);
System.out.println(exitValue);
{code}

I run this code on the server like this:
{code}
java -cp .:commons-exec-1.1.jar App
{code}

*Problem 1.* I want to run {{sudo}} in order to execute a script as a different 
user:
{code:title=client.sh}
#!/bin/bash
sudo -u occ02 /apps/occ02/catalina_base/bin/restart-occ.sh
{code}
In case of a misconfiguration of {{/etc/sudoers}} this prompts me for a 
password.
{code}
Password:
{code}
And terminates only after about 5 minutes, not 3 seconds:
{code}
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 143 (Exit value: 143)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}
Only if I use the {{-S}} option the process is killed after about 4 seconds:
{code}
Password:
Exception in thread "main" org.apache.commons.exec.ExecuteException: Process 
exited with an error: 1 (Exit value: 1)
at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
at App.destroy2(App.java:51)
at App.main(App.java:21)
{code}

*Problem 2.* I want to prevent a too long {{sleep}}:
{code:title=client.sh}
#!/bin/bash
sleep 900
{code}
The Process is not destroyed!

These issues are currently blocking us to use commons-exec in production. The 
problems were not visible when I tested on my development machine with Windows 
7 64bit and JDK 1.6.0_25, 64bit. 

Btw, with the {{ProcessBuilder}} from the JDK the process is destroyed in both 
cases:
{code}
ProcessBuilder builder = new ProcessBuilder("./client.sh");
Process process = builder.start();
Thread.sleep(3000);
process.destroy();
{code}

Best regards,
Rusi

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (SANDBOX-415) Add the Elo rating system algorithm

2012-03-25 Thread Simone Tripodi (Created) (JIRA)
Add the Elo rating system algorithm
---

 Key: SANDBOX-415
 URL: https://issues.apache.org/jira/browse/SANDBOX-415
 Project: Commons Sandbox
  Issue Type: New Feature
Reporter: Simone Tripodi
Assignee: Simone Tripodi


The [ELO|http://en.wikipedia.org/wiki/Elo_rating_system] rating algorithm can 
be modeled and resolved via a Graph algo.
I already started working on 
[OpenELO|https://svn.apache.org/repos/asf/labs/openelo/] Lab at ASF that I 
intend migrate to commons-graph

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (SANDBOX-414) Implement the Google PageRank algorithm

2012-03-25 Thread Simone Tripodi (Created) (JIRA)
Implement the Google PageRank algorithm
---

 Key: SANDBOX-414
 URL: https://issues.apache.org/jira/browse/SANDBOX-414
 Project: Commons Sandbox
  Issue Type: New Feature
  Components: Graph
Reporter: Simone Tripodi


Google [PageRank|http://en.wikipedia.org/wiki/PageRank] algorithm can be 
modeled and resolved via a Graph algo.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (CSV-70) Improve readability of CSVLexer

2012-03-25 Thread Benedikt Ritter (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/CSV-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13237807#comment-13237807
 ] 

Benedikt Ritter commented on CSV-70:


I have looked at that several times, but I don't know how to remove the 
recursive call. First I thought one could just change: 
{code:java}
if (isCommentStart(c)) {
// ignore everything till end of line and continue (incr linecount)
in.readLine();
tkn = nextToken(tkn.reset());
}
{code}
to:
{code:java}
if (isCommentStart(c)) {
// ignore everything till end of line and continue (incr linecount)
in.readLine();
tkn.reset();
continue;
}
{code}

But that will skip all the empty line processing... Maybe it will be easier to 
remove that recursive call once we have split up the parsing logic some more.

> Improve readability of CSVLexer
> ---
>
> Key: CSV-70
> URL: https://issues.apache.org/jira/browse/CSV-70
> Project: Commons CSV
>  Issue Type: Improvement
>  Components: Parser
>Affects Versions: 1.0
>Reporter: Benedikt Ritter
> Fix For: 1.0
>
>
> There are several things that can be improved in the token lexer (this has 
> also been discussed on ML, see http://markmail.org/thread/c6x5ji4v44nx5k4h):
> * Remove Token input parameter in nextToken()
> * Add convenience methods isDelimiter(c) and isEncapsulator(c)
> * Remove current caracter input parameter from methods
> * If possible: replace while(true) loops

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Updated] (CSV-86) Remove current character input parameter from Lexer methods

2012-03-25 Thread Benedikt Ritter (Updated) (JIRA)

 [ 
https://issues.apache.org/jira/browse/CSV-86?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benedikt Ritter updated CSV-86:
---

Attachment: CSV-86.patch

I have created a patch. Performance measurements for this patch:
* Before: 4835ms
* After: 4813ms

> Remove current character input parameter from Lexer methods
> ---
>
> Key: CSV-86
> URL: https://issues.apache.org/jira/browse/CSV-86
> Project: Commons CSV
>  Issue Type: Sub-task
>  Components: Parser
>Reporter: Benedikt Ritter
> Fix For: 1.0
>
> Attachments: CSV-86.patch
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (CSV-86) Remove current character input parameter from Lexer methods

2012-03-25 Thread Benedikt Ritter (Created) (JIRA)
Remove current character input parameter from Lexer methods
---

 Key: CSV-86
 URL: https://issues.apache.org/jira/browse/CSV-86
 Project: Commons CSV
  Issue Type: Sub-task
Reporter: Benedikt Ritter




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira