Bug 314842

Summary: NumericTextRidget updateFromModel fails
Product: [RT] Riena Reporter: Christian Campo <christian.campo>
Component: ridgetAssignee: Christian Campo <christian.campo>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: elias, ralf.stuckert, Stefan.Liebig, thorsten.schenkel
Version: 2.0.0   
Target Milestone: 2.0.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch that fixes the problem described under a)
none
patch that fixes usecase b) none

Description Christian Campo CLA 2010-05-28 07:18:54 EDT
The method updateFromModel fails in certain cases:

NumericTextRidget numericText = getRidget(INumericTextRidget.class,"amount");

a) numericText.updateFromModel() and no model is bound, that should silently do nothing.....

creates NPE like this:
Caused by: java.lang.NullPointerException
 at org.eclipse.riena.internal.ui.ridgets.swt.NumericTextRidget.checkValue(NumericTextRidget.java:490)
 at org.eclipse.riena.internal.ui.ridgets.swt.NumericTextRidget.updateFromModel(NumericTextRidget.java:412)
 at org.eclipse.riena.navigation.ui.controllers.SubModuleController.updateAllRidgetsFromModel(SubModuleController.java:241)

b) numericText.bindToModel(new WritableValue());

creates NPE like this:
java.lang.NullPointerException
 at java.lang.Class.isAssignableFrom(Native Method)
 at org.eclipse.riena.ui.ridgets.swt.ToStringConverterFactory.createNumberConverter(ToStringConverterFactory.java:38)
 at org.eclipse.riena.internal.ui.ridgets.swt.NumericTextRidget.getConverter(NumericTextRidget.java:262)
 at org.eclipse.riena.internal.ui.ridgets.swt.NumericTextRidget.checkValue(NumericTextRidget.java:492)
 at org.eclipse.riena.internal.ui.ridgets.swt.NumericTextRidget.updateFromModel(NumericTextRidget.java:412)
 at org.eclipse.riena.navigation.ui.controllers.SubModuleController.updateAllRidgetsFromModel(SubModuleController.java:241)
Comment 1 Christian Campo CLA 2010-05-28 07:24:06 EDT
Created attachment 170328 [details]
patch that fixes the problem described under a)
Comment 2 Christian Campo CLA 2010-05-28 07:33:27 EDT
@Elias: can you please review the first patch (it
Comment 3 Christian Campo CLA 2010-05-28 07:34:46 EDT
@Elias can please review patch #1 which should fix usecase a)
Comment 4 Christian Campo CLA 2010-05-28 07:44:29 EDT
usecase b) is actually
numericText.bindToModel(new WritableValue());
numericText.updateFromModel();
Comment 5 Christian Campo CLA 2010-05-28 07:46:35 EDT
Created attachment 170329 [details]
patch that fixes usecase b)
Comment 6 Christian Campo CLA 2010-05-28 07:48:27 EDT
@elias can you please also review patch b). If you find both ok (they are both already in CVS), please close the bug. thanks
Comment 7 Elias Volanakis CLA 2010-05-28 13:26:45 EDT
Looks ok to me.