hbm2doc with graphing fails on MacOSX
Description
Environment
Activity
Koen Aers December 9, 2024 at 4:03 PM
I am closing this issue as it did not have any relevant updates since 2010. Please feel free to reopen it if you think it is still relevant.
Bob Obringer December 23, 2010 at 11:33 PM
Same issue. Strange seeing Windows be a better supported platform then OSX for this sort of tool.
I'm attempting to run hibernate tools inside of Eclipse... and it teased me with the dropdown to set "Executable To Run Graphvitz" option in the properties for Schema Documentation Export.
Ted Bergeron December 15, 2009 at 4:06 AM
This has been a reported problem for nearly 3 years now: https://forum.hibernate.org/viewtopic.php?f=6&t=971908
The solution is very simple, Windows is the oddball, not Linux, Mac, Solaris and every other flavor of Unix out there. Change the escape method logic to IS_WINDOWS and only add the escape characters for that case.
Details
Details
Assignee
Reporter
Bug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
In the method org.hibernate.tool.hbm2x.DocExporter.dotToFile, the portions of the command passed to Runtime.exec() are being passed to an escape(String) method that optionally adds quotes to the executable file path and the path to the input file, but only if the OS is not linux. MacOSX is not linux, but adding quotes causes exec() to fail.
The solution is to change the following statement:
String exeCmd = escape(dotExeFileName) + " -T" + getFormatForFile(outFileName) + " " + escape(dotFileName) + " -o " + escape(outFileName);
to:
String[] exeCmd = new String[] {dotExeFileName, " -T", getFormatForFile(outFileName), dotFileName, " -o ", outFileName};
If you pass the command and arguments as separate strings within an array to Runtime.exec() you do not need to quote filenames, regardless of platform.
A (potentially very harmful) workaround is to pass -Dos.name=Linux to the VM.
Please note that I've checked both the 3.2 branch and trunk and both contain the same problem.