Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330555 - Not able to set empty property values
Summary: Not able to set empty property values
Status: RESOLVED FIXED
Alias: None
Product: Gemini.JPA
Classification: RT
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 1.0.0 M4   Edit
Assignee: Michael Keith CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-18 07:02 EST by Alex Blewitt CLA
Modified: 2010-12-02 14:33 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.