[
https://issues.jboss.org/browse/FORGE-1802?page=com.atlassian.jira.plugin...
]
Ivan St. Ivanov commented on FORGE-1802:
----------------------------------------
OK, found the reason for the hanging shell
Basically, when you run scripts, the Run command will execute the commands one after the
other. It will wait until the command returns a result (success or failure) or until a
timeout of 500 seconds passes.
The issue doesn't come when the command *execution* throws an exception. Then the
command execution listener's postCommandFailure method will be run and the run script
command will not hang - it will report an error.
The real issue occurs when the command *initialization* fails for some reason. In that
case one of he ForgeCommandRegistry methods would throw an exception. The problem with
that exception is that it gets lost somewhere in AeshShell and there is nobody to notify
the command execution listeners about the failure. So the execute method in the RunCommand
class will run for the full 500 seconds waiting in vain for a result.
Now, I've hacked a quick solution to this problem, that works:
https://github.com/ivannov/core/commit/5ed84f5f3ce5fedae2bfa100f7e270cc64...
I just need an advise from someone more knowledgeable:
1) Having so many nulls on line 132 is fine for RunCommand.ScriptCommandListener, but
probably this does not apply for all the possible listeners that may come to this point.
Obviously there is no Command object so far, but can I get somehow UIExecutionContext? I
only got a UIContext
2) I just fire the failure notification when parsing of the command doesn't succeed. I
can also spot some other candidates in this class. But are these all the locations that we
must fire the event?
Cheers,
Ivan
Console hangs when running an invalid script
--------------------------------------------
Key: FORGE-1802
URL:
https://issues.jboss.org/browse/FORGE-1802
Project: Forge
Issue Type: Sub-task
Components: UI - Shell
Affects Versions: 2.5.0.Final
Reporter: Antonio Goncalves
Assignee: Ivan St. Ivanov
Priority: Critical
Fix For: 2.x Future
I am executing a script (with the {{run}} command) and the console hanged and stopped
working completely (I had to kill the process). I realized that there is an error in the
script (missing {{;}} at the end of line {{--named ISBN}}).
Take the following script, and save it on a {{hangs.fsh}} file
{code}
# ##################### #
# Creates a new project #
# ##################### #
project-new --named cdbookstore --topLevelPackage org.agoncal.training.javaee6adv --type
war --finalName cdbookstore ;
# Setup the persistence unit in persistence.xml
# ############
jpa-setup --persistenceUnitName cdbookstorePU ;
# ######################## #
# Creates the domain model #
# ######################## #
# ISBN constraint
# ############
constraint-new-annotation --named ISBN
# Genre entity
# ############
jpa-new-entity --named Genre ;
jpa-new-field --named name --length 100 ;
{code}
Now, execute the script, and see the error message :
{code}
[temp]$ run hangs.fsh
project-new --named cdbookstore --topLevelPackage org.agoncal.training.javaee6adv --type
war --finalName cdbookstore ;
***SUCCESS*** Project named 'cdbookstore' has been created.
[cdbookstore]$ jpa-setup --persistenceUnitName cdbookstorePU ;
***SUCCESS*** Persistence (JPA) is installed.
[cdbookstore]$ constraint-new-annotation --named ISBN
***SUCCESS*** Bean Validation Constraint Annotations
org.agoncal.training.javaee6adv.constraints.ISBN was created
[ISBN.java]$ jpa-new-entity --named Genre ;
Exception when parsing/running: jpa-new-entity --named Genre ,
org.jboss.forge.roaster.model.impl.JavaAnnotationImpl cannot be cast to
org.jboss.forge.roaster.model.MemberHolder
[ISBN.java]$
{code}
At this point, I can't interact with the console and need to kill the process.
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)