DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5624>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5624

Postgresql template typo causes ArrayIndexOutOfBounds on generation





------- Additional Comments From [EMAIL PROTECTED]  2002-01-02 21:05 -------
Output follows:
----- CONSOLE OUTPUT -----------------------------------------------------
Buildfile: build.xml

main:

init-tasks:

project-sql:
     [echo] +------------------------------------------+
     [echo] |                                          |
     [echo] | Generating SQL for YOUR Turbine project! |
     [echo] | Woo hoo!                                 |
     [echo] |                                          |
     [echo] +------------------------------------------+
[torque-sql] C:\Documents and Settings\int\Desktop\torque-2.1\torque\src\sql\rep
ort.project.sql.generation
[torque-sql] Resolver: used database.dtd

BUILD FAILED

C:\Documents and Settings\int\Desktop\torque-2.1\torque\build.xml:193: Exception
 thrown by 'generator.parse'. For more information consult the velocity log.

Total time: 4 seconds
----- END CONSOLE --------------------------------------------------------

----- VELOCITY.LOG -------------------------------------------------------
Wed Jan 02 23:43:58 EST 2002 AvalonLogSystem initialized using logfile
C:\Documents and Settings\int\Desktop\torque-2.1\torque\velocity.log
Wed Jan 02 23:43:59 EST 2002   [info]   [info] Default Properties File:
org\apache\velocity\runtime\defaults\velocity.properties
Wed Jan 02 23:43:59 EST 2002   [info] Resource Loader Instantiated:
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Jan 02 23:43:59 EST 2002   [info] FileResourceLoader : initialization starting.
Wed Jan 02 23:43:59 EST 2002   [info] FileResourceLoader : adding path
'C:\Documents and Settings\int\Desktop\torque-2.1\torque\templates'
Wed Jan 02 23:43:59 EST 2002   [info] FileResourceLoader : initialization complete.
Wed Jan 02 23:43:59 EST 2002   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Literal
Wed Jan 02 23:43:59 EST 2002   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Macro
Wed Jan 02 23:43:59 EST 2002   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Parse
Wed Jan 02 23:43:59 EST 2002   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Include
Wed Jan 02 23:43:59 EST 2002   [info] Loaded Pluggable Directive:
org.apache.velocity.runtime.directive.Foreach
Wed Jan 02 23:43:59 EST 2002   [info] Created: 20 parsers.
Wed Jan 02 23:43:59 EST 2002   [info] Velocimacro : initialization starting.
Wed Jan 02 23:43:59 EST 2002   [info] Velocimacro : adding VMs from VM library
template : VM_global_library.vm
Wed Jan 02 23:43:59 EST 2002  [error] ResourceManager : unable to find resource
'VM_global_library.vm' in any resource loader.
Wed Jan 02 23:43:59 EST 2002   [info] Velocimacro : error using  VM library
template VM_global_library.vm :
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource
'VM_global_library.vm'
Wed Jan 02 23:43:59 EST 2002   [info] Velocimacro : allowInline = true : VMs can
be defined inline in templates
Wed Jan 02 23:43:59 EST 2002   [info] Velocimacro : allowInlineToOverride =
false : VMs defined inline may NOT replace previous VM definitions
Wed Jan 02 23:43:59 EST 2002   [info] Velocimacro : allowInlineLocal = false :
VMs defined inline will be  global in scope if allowed.
Wed Jan 02 23:43:59 EST 2002   [info] Velocimacro : messages on  : VM system
will output logging messages
Wed Jan 02 23:43:59 EST 2002   [info] Velocimacro : initialization complete.
Wed Jan 02 23:43:59 EST 2002   [info] Velocity successfully started.
Wed Jan 02 23:44:00 EST 2002   [info] ResourceManager : found
sql/base/Control.vm with loader
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Jan 02 23:44:01 EST 2002   [info] ResourceManager : found
sql/base/postgresql/table.vm with loader
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Jan 02 23:44:01 EST 2002   [info] ResourceManager : found
sql/base/postgresql/drop.vm with loader
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Jan 02 23:44:01 EST 2002   [info] ResourceManager : found
sql/base/postgresql/columns.vm with loader
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Jan 02 23:44:01 EST 2002   [info] ResourceManager : found
sql/base/postgresql/primarykey.vm with loader
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Jan 02 23:44:01 EST 2002   [info] ResourceManager : found
sql/base/postgresql/unique.vm with loader
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Jan 02 23:44:01 EST 2002   [info] ResourceManager : found
sql/base/postgresql/index.vm with loader
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Jan 02 23:44:01 EST 2002  [error] Method chop threw exception for reference
$strings in template sql/base/postgresql/table.vm at  [17,25]
Wed Jan 02 23:44:01 EST 2002  [error] Method parse threw exception for reference
$generator in template sql/base/Control.vm at  [17,17]
----- END VELOCITY.LOG ---------------------------------------------------

----- EXCEPTION TRACE FROM DEBUG MODE ------------------------------------
C:\Documents and Settings\int\Desktop\torque-2.1\torque\build.xml:193: Exception
 thrown by 'generator.parse'. For more information consult the velocity log.
        at org.apache.velocity.texen.ant.TexenTask.execute(TexenTask.java)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:104)
        at org.apache.tools.ant.Task.perform(Task.java:217)
        at org.apache.tools.ant.Target.execute(Target.java:184)
        at org.apache.tools.ant.Target.performTasks(Target.java:202)
        at org.apache.tools.ant.Project.executeTarget(Project.java:601)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:266)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)

        at org.apache.tools.ant.Task.perform(Task.java:217)
        at org.apache.tools.ant.Target.execute(Target.java:184)
        at org.apache.tools.ant.Target.performTasks(Target.java:202)
        at org.apache.tools.ant.Project.executeTarget(Project.java:601)
        at org.apache.tools.ant.Project.executeTargets(Project.java:560)
        at org.apache.tools.ant.Main.runBuild(Main.java:454)
        at org.apache.tools.ant.Main.start(Main.java:153)
        at org.apache.tools.ant.Main.main(Main.java:176)
--- Nested Exception ---
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'c
hop' in  class org.apache.velocity.util.StringUtils threw exception class java.l
ang.ArrayIndexOutOfBoundsException
        at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.j
ava)
        at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTRefer
ence.java)
        at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTRefere
nce.java)
        at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
)
        at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfSt
atement.java)
        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.
java)
        at org.apache.velocity.Template.merge(Template.java)
        at org.apache.velocity.texen.Generator.parse(Generator.java)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.j
ava)
        at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTRefer
ence.java)
        at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTRefere
nce.java)
        at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
)
        at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfSt
atement.java)
        at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
)
        at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java)
        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirect
ive.java)
        at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
)
        at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfSt
atement.java)
        at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java
)
        at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java)
        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirect
ive.java)
        at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.
java)
        at org.apache.velocity.Template.merge(Template.java)
        at org.apache.velocity.texen.Generator.parse(Generator.java)
        at org.apache.velocity.texen.ant.TexenTask.execute(TexenTask.java)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:104)
        at org.apache.tools.ant.Task.perform(Task.java:217)
        at org.apache.tools.ant.Target.execute(Target.java:184)
        at org.apache.tools.ant.Target.performTasks(Target.java:202)
        at org.apache.tools.ant.Project.executeTarget(Project.java:601)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:266)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)

        at org.apache.tools.ant.Task.perform(Task.java:217)
        at org.apache.tools.ant.Target.execute(Target.java:184)
        at org.apache.tools.ant.Target.performTasks(Target.java:202)
        at org.apache.tools.ant.Project.executeTarget(Project.java:601)
        at org.apache.tools.ant.Project.executeTargets(Project.java:560)
        at org.apache.tools.ant.Main.runBuild(Main.java:454)
        at org.apache.tools.ant.Main.start(Main.java:153)
        at org.apache.tools.ant.Main.main(Main.java:176)
----- END EXCEPTION TRACE FROM DEBUG MODE --------------------------------


This is more or less a result of how the template is using the length function
to check whether there was an index.  The existing template expects a zero
length string to come back from the index.vm template in the event that there
are no indices defined the schema document.  Since there's trailing whitespace
(after the "#end" on line 3 of the file, it's returning the whitespace in the
index string, and dying when the table template tries to execute the chop.

Steps to reproduce (clearer than last time, sorry)
- Unzip the torque-2.1.zip file
- Change build.properties to generate targetting postgresql 
- execute ant in to build the default sample

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to