Replace Graphviz/DOT with a Java implementation#7557
Replace Graphviz/DOT with a Java implementation#7557labkey-adam wants to merge 5 commits intodevelopfrom
Conversation
| String units = value.substring(value.length() - 2); | ||
| if (StringUtils.isNumeric(units)) | ||
| units = null; | ||
| else | ||
| value = value.substring(0, value.length() - 2); |
There was a problem hiding this comment.
Claude is concerned about units that aren't two characters.
Issue: The method assumes units are always exactly 2 characters (value.substring(value.length() - 2)). It uses StringUtils.isNumeric(units) to detect "no units". If the last two characters are numeric, units = null (no units). But this fails for values with 1-char units (e.g., "m" or future SVG units), or values where the last character is a digit and second-to-last is a unit letter (e.g., "785pt" with trailing numeric in the number). It also silently uses units for numeric-only 2-char endings. In practice the current SVG output always uses pt or px, so this works today, but the 2-char assumption is fragile.
Why it matters: If graph-support ever outputs different units, parsing would silently fail or corrupt the parsed value.
Suggestion: Use a more robust regex-based approach (e.g., match trailing alpha chars) to separate numeric value from units.
| } | ||
| else | ||
| { | ||
| ret = svg.substring(0, idx) + svg.substring(end + 2); |
There was a problem hiding this comment.
Claude is concerned about assumptions about a trailing space here:
Issue: When size == null (removing the attribute), the code does svg.substring(0, idx) + svg.substring(end + 2). Here end is the position of the closing ". end + 1 is the " itself, so end + 2 skips one character past the closing quote — this is intended to remove the trailing space. But if the attribute is at the end of the tag or is followed by something other than a space, this silently removes an extra character.
Why it matters: Could corrupt the SVG string if attribute is not followed by a space (e.g., the attribute is the last before >).
Suggestion: Check that svg.charAt(end + 1) == ' ' before skipping it, or use a regex replacement.
| svgFile.delete(); | ||
| } | ||
| String dot = GroupManager.getGroupGraphDot(groups, getUser(), form.getHideUnconnected()); | ||
| Graphviz graph = DotParser.parse(dot); |
There was a problem hiding this comment.
Error handling for the runtime exceptions thrown here?

Rationale
A native Java implementation is much simpler and cleaner than shelling out to an executable. Switching to https://github.com/jamisonjiang/graph-support
Related Pull Requests
Tasks
graphModuleDependencies(dependencies, "all")line in ModuleDependencySorter.java (line 84) and compile. Start up the server and examine the file in the temp directory that gets logged.User Education