Is there a switch for syntax compatibilty?

0 votes
asked May 6, 2013 in Bug by yyachim (120 points)
edited May 7, 2013 by yyachim
I used release 7622 for old projects, but upgrading to Java version 1.7.0_21-b11 breaks it when GraphViz is installed in a path with a space (like on Windows by default).

This is fixed in release 7965, but the activity diagram syntax isn't recognized. Is there a way to tell PlantUML to use the older syntax with this later release?

2 Answers

0 votes
answered May 6, 2013 by plantuml (294,960 points)
Could you give an example of old syntax not recognized with Version 7965? This version should also recognize older syntax.

Thanks
commented May 7, 2013 by anonymous
For example:

@startuml
  start
      if (A is B) then
          if (B is C) then when yes
              - Report that A is C
          else when no
              - Report that A is not C
          endif
      else when no\n
          - Report that A is not B
      endif
  end
@enduml
commented May 8, 2013 by plantuml (294,960 points)
There have been some slight change in the syntax since then, you should try:

@startuml
  start
      if (A is B) then (yes)
          if (B is C) then (no)
              :Report that A is C;
          else (no)
              :Report that A is not C;
          endif
      else
          :Report that A is not B;
      endif
  stop
@enduml

I hope that it's ok for you

Regards,
commented May 13, 2013 by yyachim (120 points)
A lot of diagrams were written with the other syntax, so I just rebuilt that release (svn rev 168) with a "fix." This is the change as a patch:


Index: src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java
===================================================================
--- src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java    (revision 168)
+++ src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java    (working copy)
@@ -37,18 +37,53 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.ArrayList;
 
 import net.sourceforge.plantuml.Log;
 
 public class ProcessRunner {
 
     private final String cmd;
+    private String [] cmdArray;
 
     private String error;
     private String out;
 
     public ProcessRunner(String cmd) {
+        ArrayList<String> arglist = new ArrayList<String>();
+        String [] cmdlist = cmd.split(" ");
+        StringBuilder sb = new StringBuilder();
+        boolean q = false;
         this.cmd = cmd;
+       
+        for(int i = 0; i < cmdlist.length; i++)
+        {
+            if(cmdlist[i].contains("\""))
+            {
+                if(false == q)
+                {
+                    q = true;
+                    sb = new StringBuilder(cmdlist[i]);
+                }
+                else /* true == q */
+                {
+                    q = false;
+                    sb.append(" "+cmdlist[i]);
+                    arglist.add(sb.toString());
+                }
+            }
+            else if(true == q)
+            {
+                sb.append(" "+cmdlist[i]);
+            }
+            else
+            {
+                arglist.add(cmdlist[i]);
+            }
+        }
+       
+        cmdArray = new String[arglist.size()];
+        arglist.toArray(cmdArray);
     }
 
     static private int cpt = 0;
@@ -58,7 +93,7 @@
     }
 
     public void run(byte in[], OutputStream redirection, File dir) throws IOException, InterruptedException {
-        final Process process = Runtime.getRuntime().exec(cmd, null, dir);
+        final Process process = Runtime.getRuntime().exec(cmdArray, null, dir);
         final ThreadStream errorStream = new ThreadStream(process.getErrorStream(), null);
         final ThreadStream outStream = new ThreadStream(process.getInputStream(), redirection);
         errorStream.start();
0 votes
answered May 19, 2013 by plantuml (294,960 points)
edited May 19, 2013 by plantuml
Hello,

In version 7966, we have added back this "old" syntax for "Activity Beta".

The goal is not to support this "old" syntax forever, but to allow people to use the last versions of PlantUML and let them slowly migrate their diagrams. Having a version that support both version will help for this task.

Note that we are not talking here about the actual syntax (http://plantuml.sourceforge.net/activity.html ), which will remain probably forever.

Thanks to post here if you find other issue about this.

Regards,

Arnaud
commented May 21, 2013 by yyachim (120 points)
Thanks for this update Arnaud. It is very helpful.
...