commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edzard Hoefig (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SCXML-74) <data> uses "name" attribute instead of "ID"
Date Wed, 09 Jul 2008 09:31:31 GMT

    [ https://issues.apache.org/jira/browse/SCXML-74?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611955#action_12611955
] 

Edzard Hoefig commented on SCXML-74:
------------------------------------

The issue seems to be fairly easily fixed (at least all junit tests stay green) by the following
steps.
I could also commit these to the SVN, but am unsure about the process followed in this project.
:-)

1) Class org.apache.commons.scxml.SCXMLHelper.java 
Three changes in line 448, line 464, line 466 (in "cloneDatamodel")

Use "datum.getId()" instead of "datum.getName()"
(It is important to use the lowercase "Id" and not "ID", which is not working -- confusing
the Digester?)

2) Class org.apache.commons.scxml.io.SCXMLSerializer.java
One change in else clause starting on line 363 (in "serializeDatamodel") 

Use
b.append(indent).append(INDENT).append("<data id=\"").
	append(datum.getId()).append("\" expr=\"").
	append(datum.getExpr()).append("\" />\n");
Instead of
b.append(indent).append(INDENT).append("<data name=\"").
	append(datum.getName()).append("\" expr=\"").
	append(datum.getExpr()).append("\" />\n");

3) Class org.apache.commons.scxml.model.Data.java
Re-factor "name" attribute to "id", also change accessor methods:

line 39 (the attribute name)
line 68 (initialization in ctor)
line 74ff: 
rename accessor methods, e.g. use these

/**
 * Get the ID.
 *
 * @return String The identifier.
 */
public final String getId() {
	return id;
}

/**
 * Set the ID.
 *
 * @param id The identifier.
 */
public final void setId(final String id) {
	this.id = id;
}

4) Refactor the xml test data files
Use "id" instead of "name" as attribute in declaration of <data/> elements 
This has to be done for following files:

org.apache.commons.scxml.custom-hello-world-04-el.xml
org.apache.commons.scxml.custom-hello-world-04-jexl.xml
org.apache.commons.scxml.env.jexl.datamodel-01.xml
org.apache.commons.scxml.env.jexl.datamodel-02.xml
org.apache.commons.scxml.env.jexl.datamodel-03.xml
org.apache.commons.scxml.env.jexl.datamodel-04.xml
org.apache.commons.scxml.env.jexl.eventdata-03.xml
org.apache.commons.scxml.env.jsp.datamodel-01.xml
org.apache.commons.scxml.env.jsp.datamodel-02.xml
org.apache.commons.scxml.env.jsp.datamodel-03.xml
org.apache.commons.scxml.issues.issue64-01.xml
org.apache.commons.scxml.issues.issue64-02.xml
org.apache.commons.scxml.model.assign-test.xml



> <data> uses "name" attribute instead of "ID"
> --------------------------------------------
>
>                 Key: SCXML-74
>                 URL: https://issues.apache.org/jira/browse/SCXML-74
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.8
>            Reporter: Edzard Hoefig
>            Priority: Minor
>             Fix For: 0.9
>
>
> In the recent SCXML WD (WD-scxml-20080516), the <data> element is defined to use
an "ID" attribute. Previously it had been "name" (WD-scxml-20070221). This change is not reflected
in the source (see class org.apache.commons.scxml.model.Data) and leads to a NullPointerException
when trying to use it.
> Example: 
> This SCXML document...
> <?xml version="1.0" encoding="UTF-8"?>
> <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="InitialState"
>
> 	<datamodel>
> 		<data id="RequestForBerlin">
> 			<GetWeather xmlns="http://www.webserviceX.NET">
> 			  <CityName>Berlin</CityName>
> 			  <CountryName>Germany</CountryName>
> 			</GetWeather>				
> 		</data>
> 	</datamodel>
> 	<state id="InitialState">
> 		<transition target="GetWeatherState"/>
> 	</state>
> 	<state id="GetWeatherState">
> 		<invoke src="WeatherService#GetWeather" targettype="x-soap">
> 			<param name="RequestForBerlin"/>
> 		</invoke>
> 	</state>
> </scxml>
> ... leads to ...
> ...  java.lang.NullPointerException
> 	at org.apache.commons.scxml.env.SimpleContext.setLocal(SimpleContext.java:164)
> 	at org.apache.commons.scxml.SCXMLHelper.cloneDatamodel(SCXMLHelper.java:466)
> 	at org.apache.commons.scxml.SCXMLExecutor.reset(SCXMLExecutor.java:223)
> 	at org.apache.commons.scxml.SCXMLExecutor.go(SCXMLExecutor.java:351)
> [...]
> ... because the name field of a Data class instance is null.
> when changing the <data id="RequestForBerlin"> line to <data name="RequestForBerlin">
the problem dissapears.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message