Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 121110

Summary: [DataBinding] null value for model-side Date property causes NPE
Product: [Eclipse Project] Platform Reporter: Boris Bokowski <bokowski>
Component: UIAssignee: Matthew Hall <qualidafial>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bradleyjames, qualidafial
Version: 3.2Keywords: helpwanted
Target Milestone: 3.5 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch with test
none
mylyn/context/zip
none
Same patch (can't remember if I changed anything, but just in case)
none
mylyn/context/zip none

Description Boris Bokowski CLA 2005-12-15 15:09:20 EST
java.lang.NullPointerException
	at java.util.Calendar.setTime(Unknown Source)
	at java.text.SimpleDateFormat.format(Unknown Source)
	at java.text.SimpleDateFormat.format(Unknown Source)
	at java.text.DateFormat.format(Unknown Source)
	at org.eclipse.jface.databinding.converterfunctions.DateConversionSupport.format(DateConversionSupport.java:91)
	at org.eclipse.jface.databinding.converterfunctions.DateConversionSupport.format(DateConversionSupport.java:86)
	at org.eclipse.jface.databinding.converterfunctions.ConvertDate2String.convert(ConvertDate2String.java:26)
	at org.eclipse.jface.databinding.converters.FunctionalConverter.convertModelToTarget(FunctionalConverter.java:42)
	at org.eclipse.jface.databinding.internal.ValueBinding.updateTargetFromModel(ValueBinding.java:144)
	at org.eclipse.jface.databinding.internal.DataBindingContext.bind(DataBindingContext.java:341)
	at org.eclipse.jface.databinding.internal.DataBindingContext.bind(DataBindingContext.java:375)
	at org.eclipse.jface.databinding.internal.DataBindingContext.bind(DataBindingContext.java:432)
	at org.eclipse.ui.examples.rcp.binding.scenarios.NullBinding.createLabelAndText(NullBinding.java:133)
	at org.eclipse.ui.examples.rcp.binding.scenarios.NullBinding.createGroup(NullBinding.java:119)
	at org.eclipse.ui.examples.rcp.binding.scenarios.NullBinding.initialize(NullBinding.java:94)
	at org.eclipse.ui.examples.rcp.binding.scenarios.NullBinding.<init>(NullBinding.java:82)
	... 8 more
Comment 1 Boris Bokowski CLA 2007-06-26 14:06:53 EDT
Not sure if this is still a problem.
Comment 2 Matthew Hall CLA 2009-01-21 22:10:12 EST
This bug is still relevant.  DateConversionSupport attempts to format a Date into a String without checking whether the Date is null
Comment 3 Boris Bokowski CLA 2009-01-22 00:08:00 EST
I hope you don't mind that I assign this bug to you.
Comment 4 Matthew Hall CLA 2009-01-22 10:59:04 EST
sure
Comment 5 Matthew Hall CLA 2009-01-26 13:21:39 EST
Created attachment 123783 [details]
Patch with test

Boris, +1 for M5?
Comment 6 Matthew Hall CLA 2009-01-26 13:21:43 EST
Created attachment 123784 [details]
mylyn/context/zip
Comment 7 Boris Bokowski CLA 2009-01-26 13:30:00 EST
Given the low traffic on this bug, I would vote for fixing this in M6 rather than M5.
Comment 8 Matthew Hall CLA 2009-01-26 13:38:35 EST
What is the value you would expect to have returned when DateFormatSupport.format(Date) is called with a null argument?  Null or empty string?
Comment 9 Matthew Hall CLA 2009-01-26 16:27:39 EST
Created attachment 123812 [details]
Same patch (can't remember if I changed anything, but just in case)
Comment 10 Matthew Hall CLA 2009-01-26 16:27:41 EST
Created attachment 123813 [details]
mylyn/context/zip
Comment 11 Matthew Hall CLA 2009-02-16 19:43:58 EST
Released to HEAD > 20090216
Comment 12 Matthew Hall CLA 2009-04-28 19:07:57 EDT
Verified in I20090428-0100