- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
toXml() auf Dataset?
Hallo,
frรผher war es mรถglich mit getData.toXml() das XML des StoreElements zu bekommen. Jedoch ist Data bekanntlich deprected.
Im FormData gibt es das toXML nicht und im EditorValue ist es mir zu spรคt.
Auf dem StoreElement wird ebenfalls toXml angeboten. und bei einer Page geht es auch:
bsh % context.getStoreElement();
<<PAGE editor="913244" id="884541" name="test_topicpage_content" pagetemplate="4" pp="Content" releaseRevision="205429" releasedby="1" revision="205429" translated="EN">
<LANG displayname="test_topicpage_content" language="EN"/>
</PAGE>
>
bsh % context.getStoreElement().toXml();
<<PAGE editor="913244" id="884541" name="test_topicpage_content" pagetemplate="4" pp="Content" releaseRevision="205429" releasedby="1" revision="205429" translated="EN"><LANG......
Ich brauch es aber auf einem Dataset. Dataset erbt von StoreElement und in der API wird mir auch das toXml() angeboten. Wenn ich das toXML aufrufe erhalte ich einen NullPointer:
bsh % context.getStoreElement().getDataset(context.getSelectedRow()).toXml();
// Error: // Uncaught Exception: Method Invocation toXml : at Line: 1 : in file: <unknown file> : .toXml ( )
Target exception: java.lang.NullPointerException
bsh % java.lang.NullPointerException
at de.espirit.firstspirit.store.access.contentstore.DatasetImpl._toXml(DatasetImpl.java:1049)
at de.espirit.firstspirit.store.access.contentstore.DatasetImpl.toXml(DatasetImpl.java:1029)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at bsh.Reflect.invokeMethod(Unknown Source)
at bsh.Reflect.invokeObjectMethod(Unknown Source)
at bsh.BSHPrimarySuffix.doName(Unknown Source)
at bsh.BSHPrimarySuffix.doSuffix(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.Interpreter.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
bsh %
Ist das ein Fehler oder wird das toXml nicht mehr angeboten oder was wรคre denn der Ersatz?
p.s. Server-Version: 4.2.488.56504
Viele Grรผรe
Dennis
- Labels:
-
Developers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dennis,
der Fehler sieht mir eher danach aus, dass keine Zeile ausgewรคhlt ist und ein Dataset mit Entity null erzeugt wird. Laut API ist ein null-Wert nicht erlaubt. Bitte unbedingt vorher den Rรผckgabewert von getSelectedRow() im Skript auf null prรผfen, bevor getDataset(..) aufgerufen wird.
Gruร
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hallo,
ich habe die Beanshell auf der Entity ausgefรผhrt und damit ist diese nicht null:
bsh % show();
Content2 nicht null:
bsh % context.getStoreElement();
<<CONTENT2 editor="1" id="862325" name="products__input_" perm="859412:2047,859417:159,859415:23,859413:3,859416:279" pp="Template" revision="227305" tabletemplate="51">
<LANG displayname="Produkte" language="DE"/>
<LANG displayname="Products" language="EN"/>
<CONTENTPARAMETER source="Products" templateid="51"/>
</CONTENT2>
>
Entity nicht null:
bsh % context.getSelectedRow();
<de.espirit.or.impl.EntityImpl@9fa824d0{Products,PERSISTENT,FS_ID=40005,FS_VALID_FROM=1376917210801,FS_VALID_TO=9223372036854775807,FS_RELEASE_TO=0}>
Dataset nicht null:
bsh % context.getStoreElement().getDataset(context.getSelectedRow());
<de.espirit.firstspirit.store.access.contentstore.DatasetImpl@38c07b0d>
NullPointer trotzdem:
bsh % context.getStoreElement().getDataset(context.getSelectedRow()).toXml();
// Error: // Uncaught Exception: Method Invocation toXml : at Line: 1 : in file: <unknown file> : .toXml ( )
Target exception: java.lang.NullPointerException
bsh % java.lang.NullPointerException
at de.espirit.firstspirit.store.access.contentstore.DatasetImpl._toXml(DatasetImpl.java:1049)
at de.espirit.firstspirit.store.access.contentstore.DatasetImpl.toXml(DatasetImpl.java:1029)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at bsh.Reflect.invokeMethod(Unknown Source)
at bsh.Reflect.invokeObjectMethod(Unknown Source)
at bsh.BSHPrimarySuffix.doName(Unknown Source)
at bsh.BSHPrimarySuffix.doSuffix(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.Interpreter.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Viele Grรผรe
Dennis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Argl, ja. Bitte als Bug melden.
Bleibt aktuell (und vermutlich zukรผnftig in 4.2) nur der Weg รผber getData(). Das ist zwar veraltet, wird in 5.0 jedoch noch nicht entfernt.
Gruร
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vielen Dank!

