Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 123783 Details for
Bug 121110
[DataBinding] null value for model-side Date property causes NPE
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch with test
clipboard.txt (text/plain), 2.98 KB, created by
Matthew Hall
on 2009-01-26 13:21:39 EST
(
hide
)
Description:
Patch with test
Filename:
MIME Type:
Creator:
Matthew Hall
Created:
2009-01-26 13:21:39 EST
Size:
2.98 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.databinding >Index: src/org/eclipse/core/internal/databinding/conversion/DateConversionSupport.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/DateConversionSupport.java,v >retrieving revision 1.3 >diff -u -r1.3 DateConversionSupport.java >--- src/org/eclipse/core/internal/databinding/conversion/DateConversionSupport.java 16 Apr 2008 02:51:52 -0000 1.3 >+++ src/org/eclipse/core/internal/databinding/conversion/DateConversionSupport.java 26 Jan 2009 18:21:08 -0000 >@@ -1,4 +1,4 @@ >-/* >+/******************************************************************************* > * Copyright (C) 2005 db4objects Inc. http://www.db4o.com > * > * All rights reserved. This program and the accompanying materials >@@ -9,7 +9,8 @@ > * Contributors: > * db4objects - Initial API and implementation > * Tom Schindl<tom.schindl@bestsolution.at> - bugfix for 217940 >- */ >+ * Matthew Hall - bug 121110 >+ ******************************************************************************/ > package org.eclipse.core.internal.databinding.conversion; > > import java.text.ParsePosition; >@@ -99,6 +100,8 @@ > } > > protected String format(Date date,int formatterIdx) { >+ if (date == null) >+ return null; > if(formatterIdx>=0) { > return formatters[formatterIdx].format(date); > } >#P org.eclipse.jface.tests.databinding >Index: src/org/eclipse/core/tests/internal/databinding/conversion/DateConversionSupportTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/conversion/DateConversionSupportTest.java,v >retrieving revision 1.1 >diff -u -r1.1 DateConversionSupportTest.java >--- src/org/eclipse/core/tests/internal/databinding/conversion/DateConversionSupportTest.java 7 Apr 2007 03:58:42 -0000 1.1 >+++ src/org/eclipse/core/tests/internal/databinding/conversion/DateConversionSupportTest.java 26 Jan 2009 18:21:09 -0000 >@@ -7,10 +7,13 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Matthew Hall - bug 121110 > ******************************************************************************/ > > package org.eclipse.core.tests.internal.databinding.conversion; > >+import java.util.Date; >+ > import junit.framework.TestCase; > > import org.eclipse.core.internal.databinding.BindingMessages; >@@ -43,9 +46,18 @@ > assertEquals(format, dateFormat.toPattern()); > } > >+ public void testFormat_NullDate() { >+ StubConverter stub = new StubConverter(); >+ assertNull(stub.format(null)); >+ } >+ > static class StubConverter extends DateConversionSupport { > protected DateFormat getDateFormat(int index) { > return super.getDateFormat(index); > } >+ >+ protected String format(Date date) { >+ return super.format(date); >+ } > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 121110
: 123783 |
123784
|
123812
|
123813