Bug #2223
closedTitle and Abstract screen insert empty abstract tag
0%
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.
Updated by Saurabh Garg about 19 years ago
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.
Updated by Will Tyburczy about 19 years ago
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
Updated by P. Anderson almost 19 years ago
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
Updated by Matt Jones almost 19 years ago
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.
Updated by P. Anderson almost 19 years ago
OK now this is much better. Checks for empty abstract and makes sure to remove
any extant abstract from the DOM. If no abstract is given, then no XML tag is
produced.
Here's the diff:
http://cvs.ecoinformatics.org/cvs/cvsweb.cgi/morpho/src/edu/ucsb/nceas/morpho/datapackage/AddTitleAbstractCommand.java.diff?r1=1.2&r2=1.3
Updated by Jing Tao over 15 years ago
Morpho still create an empty string in abstract/para.
Updated by Jing Tao over 15 years ago
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.