Bug #5593

InvertBasicExpressionVisitor crashes when a user component's state property is of another type than Double

Added by Tuukka Lehtonen over 2 years ago. Updated over 2 years ago.

Status:ClosedStart date:2015-01-15
Priority:4Due date:2015-01-16
Assignee:Tuukka Lehtonen% Done:

100%

Category:-Spent time:1.00 hour
Target version:1.18.1
Release notes:Fixed set value operation to work also for other numeric types than Double in user component state properties.
Tags: diagram, profile, monitor
Story points-
Velocity based estimate-
ReleaseSimantics 1.18.1Release relationshipAuto

Description

One gets

org.simantics.db.exception.DatabaseException: java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Double
    at fi.vtt.simantics.procore.internal.WriteStateBase.finish(WriteStateBase.java:67)
    at fi.vtt.simantics.procore.internal.SessionRequestManager$4.run(SessionRequestManager.java:249)
    at org.simantics.db.impl.query.QueryThread.run(QueryThread.java:251)
Caused by: java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Double
    at org.simantics.modeling.InvertBasicExpressionVisitor.invert(InvertBasicExpressionVisitor.java:147)
    at org.simantics.modeling.All$1.setValue(All.java:88)
    at org.simantics.modeling.All$1.setValue(All.java:80)
    at fi.vtt.apros.ui.function.Func$AprosValueAccessor.setValue(Func.java:1441)
    at org.simantics.db.layer0.variable.StandardGraphPropertyVariable.setValue(StandardGraphPropertyVariable.java:180)
    at org.simantics.db.layer0.variable.VariableWrite.perform(VariableWrite.java:147)
    at fi.vtt.simantics.procore.internal.SessionImplSocket$1.run(SessionImplSocket.java:453)
    at fi.vtt.simantics.procore.internal.SessionRequestManager$3.run(SessionRequestManager.java:185)
    ... 1 more

when one tries to set a user component state property value that is typed as e.g. Float instead of Double.

Just fix the code to cast to Number, not Double.

Associated revisions

Revision 30800
Added by Tuukka Lehtonen over 2 years ago

Fixed InvertBasicExpression to not blatantly cast Number to Double but use Number.doubleValue() instead.
This bug caused problems in setting user component state property values of other type than Double.

refs #5593

History

#1 Updated by Tuukka Lehtonen over 2 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
  • Release notes set to Fixed set value operation to work also for other numeric types than Double in user component state properties.

Also available in: Atom PDF