Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » EMF model from XML Schema fails if duration has default value
EMF model from XML Schema fails if duration has default value [message #76682] Sat, 27 December 2008 20:23 Go to next message
Dan Connelly is currently offline Dan ConnellyFriend
Messages: 7
Registered: July 2009
Junior Member
In standard ebRS rim.xsd (per enterprise healthcare integration,
www.ihe.net) we have a SubscriptionType defined with an optional duration
attribute:

<attribute name="notificationInterval" type="duration" use="optional"
default="P1D"/>

This gives NPE in XSDEcoreBuilder. But its okay if the default value
definition is removed.

Is this a known bug or an accepted limitation?

Dan Connelly, SOA Integration
S. Burlington, Vermont
Re: EMF model from XML Schema fails if duration has default value [message #76699 is a reply to message #76682] Sat, 27 December 2008 20:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dan,

What would I need to do to reproduce this problem myself?


Dan Connelly wrote:
> In standard ebRS rim.xsd (per enterprise healthcare integration,
> www.ihe.net) we have a SubscriptionType defined with an optional
> duration attribute:
>
> <attribute name="notificationInterval" type="duration" use="optional"
> default="P1D"/>
>
> This gives NPE in XSDEcoreBuilder. But its okay if the default
> value definition is removed.
>
> Is this a known bug or an accepted limitation?
>
> Dan Connelly, SOA Integration
> S. Burlington, Vermont
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF model from XML Schema fails if duration has default value [message #76714 is a reply to message #76699] Sat, 27 December 2008 23:43 Go to previous messageGo to next message
Dan Connelly is currently offline Dan ConnellyFriend
Messages: 7
Registered: July 2009
Junior Member
Ed:

Eclipse SDK, Version: 3.4.0
Build id: I20080617-2000

XML Schema Definition (XSD) - org.eclipse.xsd.ecore.converter
Version: 2.4.0.v200808251517
Build id: 200808251517

Eclipse Modeling Framework (EMF)
Version: 2.4.1.v200808251517
Build id: 200808251517

Try:

File->New->Project...->EMF Project->...->XML Schema (Importer)->
Model URIs:
ftp://ftp.ihe.net/TF_Implementation_Material/ITI/schema/ebRS /rim.xsd
->Load

Fundamentally, this XSD should be same as
<OASIS>/cvsroot/ebxmlrr/ebxmlrr-spec/misc/3.0/schema/rim.xsd

However, I have used only the IHE URI given above.

--Dan
Re: EMF model from XML Schema fails if duration has default value [message #76729 is a reply to message #76714] Sun, 28 December 2008 17:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050806040905070605040205
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Dan,

It worked fine for me, but then it occurred to me I ought to try a Sun
JRE. That resulted in this

java.lang.NullPointerException
at javax.xml.datatype.Duration.getYears(Duration.java:256)
at
com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImp l.compare(DurationImpl.java:875)
at javax.xml.datatype.Duration.equals(Duration.java:872)
at
org.eclipse.emf.ecore.xml.type.internal.XMLDuration.equals(X MLDuration.java:128)

Looking at Duration's getYear implementation:

public int getYears() {
return getField(DatatypeConstants.YEARS).intValue();
}

and then considering that getField is defined to return null

/**
* Gets the value of a field.
*
* @return
* If the specified field is present, this method returns
* a non-null non-negative {@link Number} object that
* represents its value. *If it is not present, return null.*
* For YEARS, MONTHS, DAYS, HOURS, and MINUTES, this method
* returns a {@link java.math.BigInteger} object. For
SECONDS, this
* method returns a {@link java.math.BigDecimal}.
*/
public abstract Number getField(final DatatypeConstants.Field
field);

it's not surprising that we'd get a null pointer exception in getYears.
It's really a bug in the JRE, but if you open a bugzilla, and I put in
workaround code (overrides of getYears and related methods) in our
XMLDuration implementation. So please open a bugzilla. Note that it's
an issue that needs to be fixed in the EMF core runtime, so best to open
the bugzilla there.


Dan Connelly wrote:
> Ed:
>
> Eclipse SDK, Version: 3.4.0
> Build id: I20080617-2000
>
> XML Schema Definition (XSD) - org.eclipse.xsd.ecore.converter Version:
> 2.4.0.v200808251517
> Build id: 200808251517
>
> Eclipse Modeling Framework (EMF) Version: 2.4.1.v200808251517
> Build id: 200808251517
>
> Try:
>
> File->New->Project...->EMF Project->...->XML Schema (Importer)->
> Model URIs:
> ftp://ftp.ihe.net/TF_Implementation_Material/ITI/schema/ebRS /rim.xsd
> ->Load
>
> Fundamentally, this XSD should be same as
> <OASIS>/cvsroot/ebxmlrr/ebxmlrr-spec/misc/3.0/schema/rim.xsd
> However, I have used only the IHE URI given above.
>
> --Dan
>

--------------050806040905070605040205
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dan,<br>
<br>
It worked fine for me, but then it occurred to me I ought to try a Sun
JRE.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF model from XML Schema fails if duration has default value [message #76745 is a reply to message #76729] Tue, 30 December 2008 16:49 Go to previous messageGo to next message
Dan Connelly is currently offline Dan ConnellyFriend
Messages: 7
Registered: July 2009
Junior Member
Sun's JAXP concrete DurationImpl over-rides the getXXXX methods of the
abstract parent Duration class for Sun jre 1.5 and Sun jre 1.6. Both
classes list the same authors in both releases. From this I conclude that
the NPE must be an intentional "feature" of Sun's recent releases! (?)
All concrete classes of Duration need to provide these over-rides (it
seems).

https://bugs.eclipse.org/bugs/show_bug.cgi?id=259794
Re: EMF model from XML Schema fails if duration has default value [message #76761 is a reply to message #76745] Tue, 30 December 2008 17:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dan,

Intentionally bogus! :-P It would have been better to leave them
abstract if a conforming implementation of getField is going to result
in null pointer exceptions. Jeesh. The changes are committed for 2.4.2
and 2.5.0.



Dan Connelly wrote:
> Sun's JAXP concrete DurationImpl over-rides the getXXXX methods of the
> abstract parent Duration class for Sun jre 1.5 and Sun jre 1.6. Both
> classes list the same authors in both releases. From this I conclude
> that the NPE must be an intentional "feature" of Sun's recent
> releases! (?) All concrete classes of Duration need to provide these
> over-rides (it seems).
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=259794
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF model from XML Schema fails if duration has default value [message #603574 is a reply to message #76682] Sat, 27 December 2008 20:58 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dan,

What would I need to do to reproduce this problem myself?


Dan Connelly wrote:
> In standard ebRS rim.xsd (per enterprise healthcare integration,
> www.ihe.net) we have a SubscriptionType defined with an optional
> duration attribute:
>
> <attribute name="notificationInterval" type="duration" use="optional"
> default="P1D"/>
>
> This gives NPE in XSDEcoreBuilder. But its okay if the default
> value definition is removed.
>
> Is this a known bug or an accepted limitation?
>
> Dan Connelly, SOA Integration
> S. Burlington, Vermont
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF model from XML Schema fails if duration has default value [message #603578 is a reply to message #76699] Sat, 27 December 2008 23:43 Go to previous message
Dan Connelly is currently offline Dan ConnellyFriend
Messages: 7
Registered: July 2009
Junior Member
Ed:

Eclipse SDK, Version: 3.4.0
Build id: I20080617-2000

XML Schema Definition (XSD) - org.eclipse.xsd.ecore.converter
Version: 2.4.0.v200808251517
Build id: 200808251517

Eclipse Modeling Framework (EMF)
Version: 2.4.1.v200808251517
Build id: 200808251517

Try:

File->New->Project...->EMF Project->...->XML Schema (Importer)->
Model URIs:
ftp://ftp.ihe.net/TF_Implementation_Material/ITI/schema/ebRS /rim.xsd
->Load

Fundamentally, this XSD should be same as
<OASIS>/cvsroot/ebxmlrr/ebxmlrr-spec/misc/3.0/schema/rim.xsd

However, I have used only the IHE URI given above.

--Dan
Re: EMF model from XML Schema fails if duration has default value [message #603579 is a reply to message #76714] Sun, 28 December 2008 17:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050806040905070605040205
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Dan,

It worked fine for me, but then it occurred to me I ought to try a Sun
JRE. That resulted in this

java.lang.NullPointerException
at javax.xml.datatype.Duration.getYears(Duration.java:256)
at
com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImp l.compare(DurationImpl.java:875)
at javax.xml.datatype.Duration.equals(Duration.java:872)
at
org.eclipse.emf.ecore.xml.type.internal.XMLDuration.equals(X MLDuration.java:128)

Looking at Duration's getYear implementation:

public int getYears() {
return getField(DatatypeConstants.YEARS).intValue();
}

and then considering that getField is defined to return null

/**
* Gets the value of a field.
*
* @return
* If the specified field is present, this method returns
* a non-null non-negative {@link Number} object that
* represents its value. *If it is not present, return null.*
* For YEARS, MONTHS, DAYS, HOURS, and MINUTES, this method
* returns a {@link java.math.BigInteger} object. For
SECONDS, this
* method returns a {@link java.math.BigDecimal}.
*/
public abstract Number getField(final DatatypeConstants.Field
field);

it's not surprising that we'd get a null pointer exception in getYears.
It's really a bug in the JRE, but if you open a bugzilla, and I put in
workaround code (overrides of getYears and related methods) in our
XMLDuration implementation. So please open a bugzilla. Note that it's
an issue that needs to be fixed in the EMF core runtime, so best to open
the bugzilla there.


Dan Connelly wrote:
> Ed:
>
> Eclipse SDK, Version: 3.4.0
> Build id: I20080617-2000
>
> XML Schema Definition (XSD) - org.eclipse.xsd.ecore.converter Version:
> 2.4.0.v200808251517
> Build id: 200808251517
>
> Eclipse Modeling Framework (EMF) Version: 2.4.1.v200808251517
> Build id: 200808251517
>
> Try:
>
> File->New->Project...->EMF Project->...->XML Schema (Importer)->
> Model URIs:
> ftp://ftp.ihe.net/TF_Implementation_Material/ITI/schema/ebRS /rim.xsd
> ->Load
>
> Fundamentally, this XSD should be same as
> <OASIS>/cvsroot/ebxmlrr/ebxmlrr-spec/misc/3.0/schema/rim.xsd
> However, I have used only the IHE URI given above.
>
> --Dan
>

--------------050806040905070605040205
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Dan,<br>
<br>
It worked fine for me, but then it occurred to me I ought to try a Sun
JRE.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF model from XML Schema fails if duration has default value [message #603581 is a reply to message #76729] Tue, 30 December 2008 16:49 Go to previous message
Dan Connelly is currently offline Dan ConnellyFriend
Messages: 7
Registered: July 2009
Junior Member
Sun's JAXP concrete DurationImpl over-rides the getXXXX methods of the
abstract parent Duration class for Sun jre 1.5 and Sun jre 1.6. Both
classes list the same authors in both releases. From this I conclude that
the NPE must be an intentional "feature" of Sun's recent releases! (?)
All concrete classes of Duration need to provide these over-rides (it
seems).

https://bugs.eclipse.org/bugs/show_bug.cgi?id=259794
Re: EMF model from XML Schema fails if duration has default value [message #603584 is a reply to message #76745] Tue, 30 December 2008 17:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Dan,

Intentionally bogus! :-P It would have been better to leave them
abstract if a conforming implementation of getField is going to result
in null pointer exceptions. Jeesh. The changes are committed for 2.4.2
and 2.5.0.



Dan Connelly wrote:
> Sun's JAXP concrete DurationImpl over-rides the getXXXX methods of the
> abstract parent Duration class for Sun jre 1.5 and Sun jre 1.6. Both
> classes list the same authors in both releases. From this I conclude
> that the NPE must be an intentional "feature" of Sun's recent
> releases! (?) All concrete classes of Duration need to provide these
> over-rides (it seems).
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=259794
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF model from XML Schema fails if duration has default value
Next Topic:XSDSimpleTypeDef validation
Goto Forum:
  


Current Time: Thu Mar 28 10:41:33 GMT 2024

Powered by FUDForum. Page generated in 0.03258 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top