From: <leg...@at...> - 2003-12-14 20:42:28
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?= key=3DHB-552 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-552 Summary: StringIndexOutOfBoundException Type: Bug Status: Unassigned Priority: Minor Project: Hibernate2 Components:=20 core Versions: 2.1 rc1 Assignee:=20 Reporter: Andr=C3=A9 Wolf Created: Sun, 14 Dec 2003 2:41 PM Updated: Sun, 14 Dec 2003 2:41 PM Environment: Hibernate 2.1final, MSSQL-Server using Microsoft's JDBC-Driver= , JDK 1.4.1, Tomcat 4.1.29, Eclipse 2.1.1 Description: A StringOutOfBoundException occurs, if you use Query.setParameterList() wit= h a named parameter and the named parameter is the last word in the query s= tring: Query q =3D session.createQuery("from TreeNode tn where tn not in :NODELIS= T"); q.setParameterList("NODELIST", nodeList); // nodelist is an ArrayList List result =3D q.list(); If you put the parameter within parenthesis, all works well: Query q =3D session.createQuery("from TreeNode tn where tn not in (:NODELI= ST)"); It seems to be good practice to alway use parenthesis for parameter lists, = but the exception is capable of being misunderstood. I managed to find the location, where this exception occurs. It is in net.s= f.hibernate.util.StringHelper.replace() (line 63). This method tries to ver= ify, if the character after the placeholder (of the named parameter) may be= a part of a Java identifier using Character.isJavaIdentifierPart(). But th= e method does not check if the character is outside of the template string,= it just assumes there is always a character. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators= .jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |