[Simple-support] Persister write exception
Brought to you by:
niallg
|
From: Courtney, P. <Phi...@sr...> - 2011-08-05 17:03:09
|
I am getting the following error when I attempt to write an XML
document:
ERROR/SolutionPackageDeploymentDescriptor(335): serializer.write
exception Element 'providerInformation' not defined in class
com.sra.rtapp.spdd.SolutionPackageDeploymentType
My test scenario is to read an xml document into a set of classes using
Simple framework annotations. The document parses successfully and the
classes created are correct. I then attempt to write that set of classes
and get the exception.
Code excerpts from the SolutionPackageDeploymentDescriptor classes are
shown below:
public class SolutionPackageDeploymentDescriptor
{
...
private SolutionPackageDeploymentType itsSolutionPackageDeployment;
// the root element
public SolutionPackageDeploymentDescriptor( InputStream aInputStream
)
throws Exception
{
Serializer serializer = new Persister();
try
{
itsSolutionPackageDeployment =
serializer.read( SolutionPackageDeploymentType.class,
aInputStream, false );
}
catch (Exception exception)
{
Log.e( TAG, exception.getMessage() );
throw( exception );
}
}
...
public String toString()
{
Serializer serializer = new Persister();
StringWriter xmlWriter = new StringWriter();
try
{
serializer.write( itsSolutionPackageDeployment, xmlWriter );
}
catch (Exception exception)
{
Log.e( TAG, "serializer.write exception " +
exception.getMessage() );
xmlWriter.append( "serializer.write exception " +
exception.getMessage() );
}
return xmlWriter.toString();
}
}
Code excerpts from the SolutionPackageDeploymentType are included below:
public class SolutionPackageDeploymentType
extends UniversallyIdentifiedType
{
@Element(name = "ProviderInformation", required = true)
protected ProviderInformationType providerInformation;
...
/**
* Gets the value of the providerInformation property.
*
* @return
* possible object is
* {@link ProviderInformationType }
*
*/
public ProviderInformationType getProviderInformation() {
return providerInformation;
}
/**
* Sets the value of the providerInformation property.
*
* @param value
* allowed object is
* {@link ProviderInformationType }
*
*/
public void setProviderInformation(ProviderInformationType value) {
this.providerInformation = value;
}
...
}
Inspecting the variables with a debugger I confirmed that
itsSolutionPackageDeployment providerInformation does contain an
instance of ProviderInformationType and its contents are correct.
What is causing the write exception? Why can't the Persister write
method recognize providerInformation?
Your help is appreciated,
Phil
|