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

Bug 330555

Summary: Not able to set empty property values
Product: [RT] Gemini.JPA Reporter: Alex Blewitt <alex.blewitt>
Component: CoreAssignee: Michael Keith <michael.keith>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: unspecified   
Target Milestone: 1.0.0 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Alex Blewitt CLA 2010-11-18 07:02:19 EST
Build Identifier: 1.0.0-M2-incubation

The org.eclipse.gemini.jpa.xml.PersistenceDescriptorHandler fails to permit empty properties (such as an empty password)

<property name="javax.persistence.jdbc.password" value=""/>

throws an exception here:

        // Look for Driver properties
        } else if (currentElement.equals("property")) {
            String propName = attributes.getValue("name");
            debugXml("prop name: ", propName);
            if (nullOrEmpty(propName))
                GeminiUtil.fatalError("No property name found" , null);
            String propValue = attributes.getValue("value");
            debugXml("prop value: ", propValue);
*            if (nullOrEmpty(propValue))
*                GeminiUtil.fatalError("No property name found" , null);

Given that an empty password is indeed empty, this throws an exception.

As it happens the error mesgae is a bit useless; it doesn't tell you what property it's looking for the value of (and the error message should really say 'no value found for property ', name)

An empty name should be an error; an empty value should not be.

Reproducible: Always

Steps to Reproduce:
Put in an empty property (name unimportant) into a persistence file and it fails to load the persistence unit at all with the above stack trace.
Comment 1 Michael Keith CLA 2010-12-02 14:28:18 EST
Fixed.