[OS-JIRA] Created: (CAY-257) Expression.fromString("empCode = " + [java.lang.Long]-value results in expressionException

From: jir..bjectstyle.org
Date: Tue Jan 04 2005 - 13:13:06 EST

  • Next message: Mike Kienenberger: "invalidation -> transient patch comments?"

    Message:

      A new issue has been created in JIRA.

    ---------------------------------------------------------------------
    View the issue:

      http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-257

    Here is an overview of the issue:
    ---------------------------------------------------------------------
            Key: CAY-257
        Summary: Expression.fromString("empCode = " + [java.lang.Long]-value results in expressionException
           Type: Bug

         Status: Assigned
       Priority: Major

        Project: Cayenne

       Assignee: Andrus Adamchik
       Reporter: Laszlo Spoor

        Created: Tue, 4 Jan 2005 1:11 PM
        Updated: Tue, 4 Jan 2005 1:11 PM
    Environment: winxp sp2, java1.5.0, cayenne 1.1, mysql 4.1 innodb

    Description:
    This code:

        Long myId = new Long ("216201000180");
        [...]
        SelectQuery qcw = new SelectQuery(Employee.class);
        Expression exp = Expression.fromString("empCode = " + myId.toString());
        qcw.setQualifier(exp);
        mContext.performQuery(qcw);

    Results in in an 'org.objectstyle.cayenne.exp.ExpressionException'. 'empCode' is of type long/bigint. When examining the stackTrace, I have noticed that 216201000180 is being handled as an Integer, not a Long.

    Stacktrace:
    org.objectstyle.cayenne.exp.ExpressionException: [v.1.1 December 6 2004] For input string: "216201000180"
            at org.objectstyle.cayenne.exp.Expression.fromString(Expression.java:234)
            at org.pva.handler.test.WngCpxResolverHandlerTester.testGetCustomWoning(WngCpxResolverHandlerTester.java:77)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at junit.framework.TestCase.runTest(TestCase.java:154)
            at junit.framework.TestCase.runBare(TestCase.java:127)
            at junit.framework.TestResult$1.protect(TestResult.java:106)
            at junit.framework.TestResult.runProtected(TestResult.java:124)
            at junit.framework.TestResult.run(TestResult.java:109)
            at junit.framework.TestCase.run(TestCase.java:118)
            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
            at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
    Caused by: java.lang.NumberFormatException: For input string: "216201000180"
            at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
            at java.lang.Integer.parseInt(Integer.java:459)
            at java.lang.Integer.valueOf(Integer.java:526)
            at org.objectstyle.cayenne.exp.parser.ExpressionParserTokenManager.makeInt(ExpressionParserTokenManager.java:118)
            at org.objectstyle.cayenne.exp.parser.ExpressionParserTokenManager.TokenLexicalActions(ExpressionParserTokenManager.java:1585)
            at org.objectstyle.cayenne.exp.parser.ExpressionParserTokenManager.getNextToken(ExpressionParserTokenManager.java:1459)
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.jj_ntk(ExpressionParser.java:1350)
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.scalarExpression(ExpressionParser.java:763)
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.simpleCondition(ExpressionParser.java:275)
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.notCondition(ExpressionParser.java:226)
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.andCondition(ExpressionParser.java:134)
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.orCondition(ExpressionParser.java:94)
            at org.objectstyle.cayenne.exp.parser.ExpressionParser.expression(ExpressionParser.java:87)
            at org.objectstyle.cayenne.exp.Expression.fromString(Expression.java:227)
            ... 14 more

    ---------------------------------------------------------------------
    JIRA INFORMATION:
    This message is automatically generated by JIRA.

    If you think it was sent incorrectly contact one of the administrators:
       http://objectstyle.org/jira/secure/Administrators.jspa

    If you want more information on JIRA, or have a bug to report see:
       http://www.atlassian.com/software/jira



    This archive was generated by hypermail 2.0.0 : Tue Jan 04 2005 - 13:13:08 EST