StringIndexOutOfBoundsException when listing models

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

StringIndexOutOfBoundsException when listing models

Jonas
Hi, thanks for a great product - keep up the good work!

When I click 'Model' in the console I get the following error message:

Error 500: Internal Server Error
URI /console/model/list
Class java.lang.StringIndexOutOfBoundsException
Message String index out of range: 10

    Line | Method
->>  464 | handle           in /model/list.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Caused by GrailsTagException: Error executing tag <g:render>: Error executing tag <g:form>: Error executing tag <cl:renderSystemId>: String index out of range: 10
->>   18 | doCall           in /WEB-INF/grails-app/views/model/list.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <cl:renderSystemId>: String index out of range: 10
->>   39 | run              in /WEB-INF/grails-app/views/model/_model.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Caused by GrailsTagException: Error executing tag <cl:renderSystemId>: String index out of range: 10
->>   19 | doCall           in /WEB-INF/grails-app/views/model/_model.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Caused by StringIndexOutOfBoundsException: String index out of range: 10
->> 1934 | substring        in java.lang.String
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   1034 | doCall           in ConsoleTagLib$_closure34
|     36 | doCall . . . . . in gsp_console_model_model_gsp$_run_closure1
|     68 | run              in gsp_console_model_model_gsp
|     36 | doCall . . . . . in gsp_console_modellist_gsp$_run_closure2
|     41 | run              in gsp_console_modellist_gsp
|    669 | handle . . . . . in org.eclipse.jetty.servlet.ServletHolder
|   1448 | doFilter         in org.eclipse.jetty.servlet.ServletHandler$CachedChain
|    195 | doFilter . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter         in grails.plugin.cache.web.filter.AbstractFilter
|   1419 | doFilter . . . . in org.eclipse.jetty.servlet.ServletHandler$CachedChain
|    455 | doHandle         in org.eclipse.jetty.servlet.ServletHandler
|    137 | handle . . . . . in org.eclipse.jetty.server.handler.ScopedHandler
|    575 | handle           in org.eclipse.jetty.security.SecurityHandler
|    231 | doHandle . . . . in org.eclipse.jetty.server.session.SessionHandler
|   1075 | doHandle         in org.eclipse.jetty.server.handler.ContextHandler
|    384 | doScope . . . .  in org.eclipse.jetty.servlet.ServletHandler
|    193 | doScope          in org.eclipse.jetty.server.session.SessionHandler
|   1009 | doScope . . . .  in org.eclipse.jetty.server.handler.ContextHandler
|    135 | handle           in org.eclipse.jetty.server.handler.ScopedHandler
|    276 | forward . . . .  in org.eclipse.jetty.server.Dispatcher
|    103 | forward          in     ''
|   1419 | doFilter . . . . in org.eclipse.jetty.servlet.ServletHandler$CachedChain
|     55 | doFilter         in org.apache.shiro.grails.SavedRequestFilter
|   1419 | doFilter . . . . in org.eclipse.jetty.servlet.ServletHandler$CachedChain
|    449 | executeChain     in org.apache.shiro.web.servlet.AbstractShiroFilter
|    365 | call . . . . . . in org.apache.shiro.web.servlet.AbstractShiroFilter$1
|     90 | doCall           in org.apache.shiro.subject.support.SubjectCallable
|     83 | call . . . . . . in     ''
|    383 | execute          in org.apache.shiro.subject.support.DelegatingSubject
|    362 | doFilterInternal in org.apache.shiro.web.servlet.AbstractShiroFilter
|    125 | doFilter         in org.apache.shiro.web.servlet.OncePerRequestFilter
|   1419 | doFilter . . . . in org.eclipse.jetty.servlet.ServletHandler$CachedChain
|    455 | doHandle         in org.eclipse.jetty.servlet.ServletHandler
|    137 | handle . . . . . in org.eclipse.jetty.server.handler.ScopedHandler
|    533 | handle           in org.eclipse.jetty.security.SecurityHandler
|    231 | doHandle . . . . in org.eclipse.jetty.server.session.SessionHandler
|   1075 | doHandle         in org.eclipse.jetty.server.handler.ContextHandler
|    384 | doScope . . . .  in org.eclipse.jetty.servlet.ServletHandler
|    193 | doScope          in org.eclipse.jetty.server.session.SessionHandler
|   1009 | doScope . . . .  in org.eclipse.jetty.server.handler.ContextHandler
|    135 | handle           in org.eclipse.jetty.server.handler.ScopedHandler
|    255 | handle . . . . . in org.eclipse.jetty.server.handler.ContextHandlerCollection
|    154 | handle           in org.eclipse.jetty.server.handler.HandlerCollection
|    116 | handle . . . . . in org.eclipse.jetty.server.handler.HandlerWrapper
|    368 | handle           in org.eclipse.jetty.server.Server
|    489 | handleRequest .  in org.eclipse.jetty.server.AbstractHttpConnection
|    942 | headerComplete   in     ''
|   1004 | headerComplete . in org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler
|    640 | parseNext        in org.eclipse.jetty.http.HttpParser
|    235 | parseAvailable . in     ''
|     82 | handle           in org.eclipse.jetty.server.AsyncHttpConnection
|    628 | handle . . . . . in org.eclipse.jetty.io.nio.SelectChannelEndPoint
|     52 | run              in org.eclipse.jetty.io.nio.SelectChannelEndPoint$1
|    608 | runJob . . . . . in org.eclipse.jetty.util.thread.QueuedThreadPool
|    543 | run              in org.eclipse.jetty.util.thread.QueuedThreadPool$3
^    662 | run . . . . . .  in java.lang.Thread



I've been loading models into the console using the REST API, which seems to work because the current model is always correct. I only get this problem when listing the models.
Glu version is 4.7.1. Java 1.6. Ubuntu.
Reply | Threaded
Open this post in threaded view
|

Re: StringIndexOutOfBoundsException when listing models

frenchyan
Administrator
The error is at this line: https://github.com/pongasoft/glu/blob/master/console/org.linkedin.glu.console-webapp/grails-app/taglib/ConsoleTagLib.groovy#L1034

There seems to be a model in your database that has a systemid of less than 10 characters. glu always generate the systemid to be the sha-1 of the json document so it is always > 10 characters.

I am unclear how this could have happened. Did you by any chance insert rows in the database manually? Could you access the database directly and select the row from db_system_model where systemid <= 10 characters? What does the systemid look like?

Thanks
Yan
Reply | Threaded
Open this post in threaded view
|

Re: StringIndexOutOfBoundsException when listing models

Jonas
I didn't insert anything directly to the db myself, however I did provide an "id" field with only three characters in the json when I uploaded a model through the console REST API. Maybe you're not supposed to do that?

I can't access the db right now, I'll look at it later on.

/ Jonas
Reply | Threaded
Open this post in threaded view
|

Re: StringIndexOutOfBoundsException when listing models

sodul
I never touch the ID field, I consider it a reserved field for Glu's internal use. I always assumed that the console would discard it anyway.
Reply | Threaded
Open this post in threaded view
|

Re: StringIndexOutOfBoundsException when listing models

Jonas
I did try to upload models without the id field in them, but still got the errors. So I figured it was because glu was reading the old models.

I deleted the fabric and created a new one, and now I've removed the id field from my models and it works.
You should probably either allow custom id's or validate that they aren't present in new models.

Thanks / Jonas
Reply | Threaded
Open this post in threaded view
|

Re: StringIndexOutOfBoundsException when listing models

frenchyan
Administrator

There is clearly something fishy going on there. Either glu should not allow to provide your own id, or it should not generate an exception if too small...

I created a ticket to keep track of it: https://github.com/pongasoft/glu/issues/224

Thanks for reporting

Yan