splitbrain / dokuwiki-plugin-ditaa

Renders ASCII flowcharts contained in a DokuWiki page to images
http://www.dokuwiki.org/plugin:ditaa
5 stars 5 forks source link

Parameters passed to launch java contain "__DIR__/ditaa/ditaa.jar" #19

Closed Vi4Ever closed 8 years ago

Vi4Ever commented 8 years ago

I installed version 1.0 and as it did not work I reinstalled the call with a bat file which shows me the full set of parameters used to call java. This list of parameters contains the __DIR__ string which I suppose should have been expanded into the directory of the plugins. Currently looking for a workaround by using only a part of the parameters and then passing fixed parameters in the script (keeping the text and caching parameters) I do not know if my configuration maybe misses somehing but I'm not into PHP ... so I will leave a good solution to the experts ;(

Vi4Ever commented 8 years ago

Using the following script to work around the problem .. Waiting for advice by the experts ;) The following I put a script on the windows server and set the Ditaa parameter for the java location to the path to this script. The shifts make it possible to override the generated parameters. There will be better workarounds ... Eagor to learn about them ;) This seems however not always a solution, simple diagrams work, more complex remain a problem ...

set JAVA_HOME=O:\Tools\java\jdk1.7.0_51
set DITAA_PLUGIN_LOCATION=O:\Tools\www\workflow\lib\plugins/ditaa   

path %JAVA_HOME%\bin;%PATH%

shift
shift 
shift 
shift
shift
shift

%JAVA_HOME%\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -jar "%DITAA_PLUGIN_LOCATION%/ditaa/ditaa.jar" %1 %2 %3 %4 %5 %6 
Vi4Ever commented 8 years ago

Changed the script to also store the error output.

set JAVA_HOME=O:\Tools\java\jdk1.7.0_51

path %JAVA_HOME%\bin;%PATH%

shift
shift 
shift 
shift
shift
shift

%JAVA_HOME%\bin\java -Djava.awt.headless=true -Ddebug=true -Dfile.encoding=UTF-8 -jar "O:\Tools\www\workflow\lib\plugins/ditaa/ditaa/ditaa.jar" %1 %2 %3 %4 %5 %6  >> O:\Tools\java\Logs\javaOutpt.log   2>>O:\Tools\java\Logs\javaOutpt.err

The error file shows that there was an error in the drawing ...

Exception in thread "main" java.lang.RuntimeException: Cannot calculate distance of sloped edge from origin
    at org.stathissideris.ascii2image.graphics.ShapeEdge.getDistanceFromOrigin(Unknown Source)
    at org.stathissideris.ascii2image.graphics.ShapeEdge.touchesWith(Unknown Source)
    at org.stathissideris.ascii2image.graphics.Diagram.separateCommonEdges(Unknown Source)
    at org.stathissideris.ascii2image.graphics.Diagram.<init>(Unknown Source)
    at org.stathissideris.ascii2image.core.CommandLineConverter.main(Unknown Source

The causes were a pipe on a corner and an equal sign on a corner, which seems logic but at least it is possible to see that the drawing is not correct and the rendering works fine --> in giving an error. After correcting the drawing it took several refreshed of the page before all drawings were correctly rendered. Calling a script and storing the error pays of ;) Remains the problem of the __DIR__

Vi4Ever commented 8 years ago

This problem occurs when using the plugin with version HRun. Thanks again Werner Flamme for checking. The workaround works however.

splitbrain commented 8 years ago

The __DIR__ constant is available from PHP 5.3 only. You're running an unsupported PHP version.