Bug #2223
closed
Title and Abstract screen insert empty abstract tag
Added by Saurabh Garg about 19 years ago.
Updated over 15 years ago.
Category:
morpho - general
Description
To reproduce the bug:
1. Create a datapackage with no abstract using the data package wizard.
2. Save it locally or over the network.
3. Open the documentation menu and open the Title and Abstract screen.
4. Modify the title but add no abstract.
5. Save the dp again.
Oops.. commited the bug too soon.
The result of the above steps is that a empty abstract tag is inserted by the
Title and Abstract screen.
If you try to save the document over the network, Metacat will return an error:
org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of
element 'abstract' is not complete. One of '{"":section, "":para}' is expected.
fix is working great, resolving bug
the insertion of an empty abtract tag is fixed, however it is now not possible
to delete an abstract from a dp using the wizard interface (modifications still
work, as long as some non whitespace characters are left in the abstract at the
end).
To recreate this bug:
-open a data package that doesn't have an abstract
-open the title and abstract wizard page
-add some text to the abstract
-click ok
The change will occur normally
-open the title and abstract wizard page again
-delete the text in the abstract field
-click ok
The abstract will still appear in the dp view with the text you added originally
This seems to be a problem with the wizard, as you can still delete the abstract
by deleting the text through the tree editor
The problem is that the following code (in both getPageData() methods of
plugins/datapackagewizard/pages/General.java) prevents an empty abstract from
being set.
if ( !(absField.getText().trim().equals("")) ) {
returnMap.put(rootXPath + "/abstract/para1",
absField.getText().trim());
}
Removing the if statement and trying to save an empty abstract produces this XML:
<abstract><para> </para>
</abstract>
...which Metacat seems to accept. AFAICT, this bug is now fixed.
Here is the link to the code:
http://cvs.ecoinformatics.org/cvs/cvsweb.cgi/morpho/src/edu/ucsb/nceas/morpho/plugins/datapackagewizard/pages/General.java
I don't like this fix. We need to discuss this before we finalize, so I am
reopening the bug to force us to discuss the issue.
Morpho still create an empty string in abstract/para.
In WizardContainerFrame class, a statement of checking if abstract object is empty string is added. If it is empty, the abstract tree wouldn't be added to the eml. So this bug is fixed:
1. In new wizard page, if the abstract field is empty, no abstract will be added.
2. User still can use title/abstract button to remove an abstract.
Original Bugzilla ID was 2223
Also available in: Atom
PDF