History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-2376
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Graeme Rocher
Reporter: Silvio Wangler
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Grails

Constraint range (with large numbers), scaffolding, g:select cause an OutOfMemoryException (Java heap)

Created: 05/Feb/08 05:45 PM   Updated: 05/Feb/08 05:45 PM
Component/s: TagLib
Affects Version/s: 1.0
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive domain.zip (0.7 kb)

Environment:
Windows XP (SP2) / Windows Vista
JDK 1.6.x


 Description  « Hide
If one defines a range constraint on a domain object property with a large number (e.g. 1..1000000) the scaffolding mechanism generates with the create view a <g:select> tag

<tr class="prop">
<td valign="top" class="name">
<label for="price">Price:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:giftItem,field:'price','errors')}">
<g:select from="${0..1000000}" id="price" name="price" value="${giftItem?.price}" ></g:select>
</td>
</tr>

It seems that this tag is somehow not able to handle this large range appropriate and causes the OutOfMemoryException.

Reproduction instructions:
-----------------------------------

1. Create grails app
2. Drop domain object (see attachment) into domain folder
3. run grails generate-all for each domain object
4. start grails app
5. call http://localhost:8080/<app-name>/giftItem/create

Stacktrace
--------------

java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
at java.lang.StringBuffer.append(StringBuffer.java:224)
at java.io.StringWriter.write(StringWriter.java:95)
at java.io.PrintWriter.write(PrintWriter.java:412)
at java.io.PrintWriter.write(PrintWriter.java:429)
at org.codehaus.groovy.grails.web.taglib.GroovyPageTagWriter.write(GroovyPageTagWriter.java:57)
at org.codehaus.groovy.runtime.InvokerHelper.write(InvokerHelper.java:477)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.leftShift(DefaultGroovyMethods.java:3916)
at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:51)
at org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:54)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:946)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)
at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:765)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
at org.codehaus.groovy.grails.plugins.web.taglib.FormTagLib$_closure16_closure25.doCall(FormTagLib.groovy:556)
at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:946)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)
at groovy.lang.Closure.call(Closure.java:292)



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.