How to detect any error after run generate.bat?

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

How to detect any error after run generate.bat?

Postby zzhou@solielcom.com » Mon Jul 01, 2019 1:40 pm

Hi,we are using a java program to execute generate.bat command for each project and wait on the InputStream and ErrorStream.
The problem is, some of the project to be loaded has some error and couldn't be loaded, but it fails quitely, only put the information into cea.log,
the calling process is waiting on the input streat, so, it will wait a long time to time out for some failed project. I saw some error information in cea.log,
is there any way we can force the error goes to the error stream (System.err) besides going to the log file? That way, my calling process will know error happend and not wait for it
anymore.

Thanks!
zzhou@solielcom.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Mon Jul 01, 2019 1:30 pm

Re: How to detect any error after run generate.bat?

Postby sarawut_w » Mon Jul 01, 2019 9:43 pm

Hello,

What is your MagicDraw version?

Best regards,
Sarawut W.
Support Engineer
sarawut_w
No Magic
No Magic
 
Posts: 368
Posts Rating:27
Joined: Thu Jun 23, 2011 12:47 am

Re: How to detect any error after run generate.bat?

Postby zzhou@solielcom.com » Tue Jul 02, 2019 11:53 am

18.5
If check the execStatus, it always returns 0 even if there is some error during the generate and the output file is not created. I can only check if the output file exists to decide if the generate runs success or not.
Also, not sure why the process continues run for a while even though it encounters some error and not write to the output file. Is there any api I can use to check if the project is good or bad for generate scripts to run against in advance?

Thanks!
zzhou@solielcom.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Mon Jul 01, 2019 1:30 pm

Re: How to detect any error after run generate.bat?

Postby sarawut_w » Wed Jul 03, 2019 7:53 pm

Hello,

Because the geneate.bat has many commands for Java, it would check for exit status at the last command.
In case, invalid project when executing generate.bat, there are system.exit at line4, it still continue work at line6.

You need to extract this below zip file to {MD}\plugins\com.nomagic.magicdraw.reportwizard.
community_18386.zip

We created commandline2.jar for ensure that there is System.exit(statusCode) when there is error in the process.
You should execute it with this command.
Code: Select all
generateandexit -strategy "com.nomagic.magicdraw.magicreport.CommandLine2" following with common arguments

For example:
Code: Select all
generateandexit -strategy "com.nomagic.magicdraw.magicreport.CommandLine2" -project "C:\Users\uraiwan_i\Desktop\sample.mdzip" -output "C:\Users\uraiwan_i\Desktop\test.docx" -template "Class Specification Report" -package "Model"


See the sample in TestCommandLine.java

Best regards,
Sarawut
You do not have the required permissions to view the files attached to this post.
sarawut_w
No Magic
No Magic
 
Posts: 368
Posts Rating:27
Joined: Thu Jun 23, 2011 12:47 am

Re: How to detect any error after run generate.bat?

Postby zzhou@solielcom.com » Fri Jul 12, 2019 7:55 am

Thanks! I will give it a try. It should work for both windows and unix, right?

Thanks!
zzhou@solielcom.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Mon Jul 01, 2019 1:30 pm

Re: How to detect any error after run generate.bat?

Postby sarawut_w » Tue Jul 16, 2019 9:37 pm

Yes, it is.
sarawut_w
No Magic
No Magic
 
Posts: 368
Posts Rating:27
Joined: Thu Jun 23, 2011 12:47 am


Return to Report Engine

Who is online

Users browsing this forum: No registered users and 0 guests