[MGNLMIGRATION-101] Error when running created groovy script migrateComponents.groovy Created: 10/Oct/12  Updated: 29/Mar/13  Resolved: 11/Oct/12

Status: Closed
Project: Migration 4.4 to 4.5 (closed)
Component/s: None
Affects Version/s: 1.1.3
Fix Version/s: 1.1.4

Type: Bug Priority: Critical
Reporter: wolf bubenik Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

migrateComponents.groovy quits with an error, when one of the component scripts has been edited. After server restart the script is running.
Loocks like a class loader problem.

Message in result frame:
GroovyBugError: BUG! exception in phase 'semantic analysis' in source unit 'Script1.groovy' null

Stack trace:

12-10-10 13:59:50 ERROR AUTHOR[http-8001-2]info.magnolia.module.groovy.console.MgnlGroovyInteractiveConsole: Error while evaluating script: 
BUG! exception in phase 'semantic analysis' in source unit 'Script1.groovy' null
	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:828)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:521)
        ...........

Caused by: java.lang.NullPointerException
	at info.magnolia.module.groovy.support.classes.MgnlGroovyResourceLoader$MagnoliaURLConnection.getLastModified(MgnlGroovyResourceLoader.java:182)
	at org.codehaus.groovy.control.ResolveVisitor.isSourceNewer(ResolveVisitor.java:359)
	at org.codehaus.groovy.control.ResolveVisitor.resolveToScript(ResolveVisitor.java:390)
	at org.codehaus.groovy.control.ResolveVisitor.resolveToClass(ResolveVisitor.java:731)
	at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:272)
	at org.codehaus.groovy.control.ResolveVisitor.resolveFromModule(ResolveVisitor.java:645)
        ...........


 Comments   
Comment by Robert Šiška [ 11/Oct/12 ]

The issue was reproduced with latest groovy module snapshot (1.3).

All the scripts mentioned in the issue are located in the "scripts" repository.

Comment by Federico Grilli [ 11/Oct/12 ]

The issue was due to the fact that the migration scripts created dynamically by ScriptBuilder.groovy did not have
mgnl:metaData/mgnl:creationdate or mgnl:metaData/mgnl:lastmodified properties set. Those are the properties checked by MgnlGroovyResourceLoader to determine whether a Groovy source is newer than the currently loaded corresponding Java class (a Groovy source is compiled into a Java class eventually), hence the NPE.

Comment by Jan Haderka [ 29/Mar/13 ]

Closing all issues resolved and released in 1.1.x versions w/o further review. (current latest version is 1.2.2)

Generated at Mon Feb 12 10:17:10 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.