Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322836 - Wrong default value generated for base64binary simple types
Summary: Wrong default value generated for base64binary simple types
Status: CLOSED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xsd (show other bugs)
Version: 3.0.5   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 3.0.5 P   Edit
Assignee: Valentin Baciu CLA
QA Contact: Valentin Baciu CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 322841 322842
  Show dependency tree
 
Reported: 2010-08-16 16:14 EDT by Valentin Baciu CLA
Modified: 2010-08-25 11:40 EDT (History)
2 users (show)

See Also:
thatnitind: review+


Attachments
Sample schema (270 bytes, application/octet-stream)
2010-08-16 16:14 EDT, Valentin Baciu CLA
no flags Details
New failing JUnit (3.26 KB, patch)
2010-08-16 16:28 EDT, Valentin Baciu CLA
no flags Details | Diff
Patch (2.12 KB, patch)
2010-08-16 16:29 EDT, Valentin Baciu CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Valentin Baciu CLA 2010-08-16 16:14:28 EDT
Created attachment 176724 [details]
Sample schema

To recreate the problem:
- place the attached schema in a workspace project (if using a simple project, add the validation builder)
- right click the schema and select Generate->XML...
- use the default values in the wizard
- click Finish

The generator produces an XML instance with the following validation errors:

Description	Resource	Path	Location	Type
cvc-datatype-valid.1.2.1: '0' is not a valid value for 'base64Binary'.	Test.xml	TestBase64	line 3	XML Problem
cvc-type.3.1.3: The value '0' of element 'tns:Test' is not valid.	Test.xml	TestBase64	line 3	XML Problem
Comment 1 Valentin Baciu CLA 2010-08-16 16:19:20 EDT
The problem code is in org.eclipse.wst.xsd.contentmodel.internal.XSDTypeUtil. The default value provided for base64Binary is the literal string 0, which is not a valid base64 value.

The solution seems to be to encode the literal string 0 as base64, which is the literal string MA==.
Comment 2 Valentin Baciu CLA 2010-08-16 16:28:30 EDT
Created attachment 176728 [details]
New failing JUnit

Apply to org.eclipse.wst.xsd.core.tests.
Comment 3 Valentin Baciu CLA 2010-08-16 16:29:04 EDT
Created attachment 176729 [details]
Patch

Apply to org.eclipse.wst.xsd.core.
Comment 4 Valentin Baciu CLA 2010-08-16 16:30:25 EDT
Hi Nitin, please review and consider approving this fix for WTP 3.0.5 patches.
Comment 5 Carl Anderson CLA 2010-08-20 08:07:56 EDT
Committed Patch to R3_0_5_patches.
Comment 6 Valentin Baciu CLA 2010-08-25 11:40:28 EDT
Verified. Closing.