slub.team team mailing list archive
-
slub.team team
-
Mailing list archive
-
Message #00244
Re: lp:~zeutschel/goobi-production/refactoring-filesystem-and-shellscript-functions into lp:goobi-production
There seems to be no way to find out whether the file is executable.
java.io.File offers a canExecute() function but I found it to be not reliable: For example, it returns “true” for a txt file on Windows − there seem to be issues for linux, too, e.g.: http://stackoverflow.com/questions/891857/in-java-what-exactly-does-file-canexecute-do
Even running the command doesn’t bring manageable failure results, τhe documentation of java.lang.ProcessBuilder.start() is fairly unascertained in that point:
“Starting an operating system process is highly system-dependent. […] many things […] can go wrong […]. In such cases an exception will be thrown. The exact nature of the exception is system-dependent, but it will always be a subclass of IOException.”
(See: http://docs.oracle.com/javase/6/docs/api/java/lang/ProcessBuilder.html#start%28%29 )
That means that if the command cannot be executed some IOException not further specified will be thrown. I “unwraped” the error so that the full error message shows up now. For example, when pointing the script path to a text file I get the following: “Cannot run program "C:\Goobi\script\neu.txt": CreateProcess error=193, %1 ist keine zulässige Win32-Anwendung”. I also added a fix for a null pointer exception.
--
https://code.launchpad.net/~zeutschel/goobi-production/refactoring-filesystem-and-shellscript-functions/+merge/105464
Your team Saxon State Library Team is subscribed to branch lp:goobi-production.
References