bianca_batsch
New Responder

NPE bei toJson

Jump to solution

Hi,

ich habe folgende Vorlage:

$CMS_SET(set_st_big_teaser_data, {"":""})$$--

--$$CMS_SET(void, set_st_big_teaser_data.clear())$$--

--$$-- Titel über dem Teaser --$$--

--$$CMS_IF(!st_jass_ssm_big_teaser_headertitle.isEmpty)$$--

--$$CMS_SET(void, set_st_big_teaser_data.put("header_title", st_jass_ssm_big_teaser_headertitle))$$--

--$$CMS_END_IF$$--

--$$-- Text in der Roten Schleife rechts oben in der Ecke --$$--

--$$CMS_IF(!st_jass_ssm_big_teaser_ribbon_text.isEmpty)$$--

--$$CMS_SET(void, set_st_big_teaser_data.put("ribbon_txt", st_jass_ssm_big_teaser_ribbon_text))$$--

--$$CMS_END_IF$$--

--$$-- Buttons mit Animation Faden lassen oder nicht --$$--

--$$CMS_IF(st_jass_ssm_fade_buttons)$$--

--$$CMS_SET(void, set_st_big_teaser_data.put("animate_btn", true))$$--

--$$CMS_END_IF$$--

--$$-- Trainings Button anzeigen oder nicht --$$--

--$$CMS_IF(st_jass_ssm_show_training)$$--

--$$CMS_SET(void, set_st_big_teaser_data.put("training_btn", true))$$--

--$$CMS_END_IF$$--

--$$-- Teilnehmenbutton Einstellungen --$$--

--$$CMS_SET(set_st_participate_data, {"":""})$$--

--$$CMS_SET(void, set_st_participate_data.clear())$$--

--$$CMS_IF(st_jass_ssm_countdown)$$--

  --$$CMS_SET(void, set_st_participate_data.put("is_countdown", true))$$--

--$$CMS_ELSE$$--

  --$$CMS_SET(void, set_st_participate_data.put("is_countdown", false))$$--

   

  --$$-- Buttonlabel --$$--

  --$$CMS_IF(!st_jass_ssm_participate_label.isEmpty)$$--

    --$$CMS_SET(void, set_st_participate_data.put("label", st_jass_ssm_participate_label))$$--

  --$$CMS_END_IF$$--

 

  --$$-- Finale Teilnehmerlsite anzeigen / verlinken? --$$--

  --$$CMS_IF(st_jass_ssm_participants)$$--

    --$$CMS_SET(void, set_st_participate_data.put("is_participants", true))$$--

  --$$CMS_ELSE$$--

    --$$CMS_SET(void, set_st_participate_data.put("is_participants", false))$$--

  --$$CMS_END_IF$$--

 

  --$$-- Direkt Spiel starten --$$--

  --$$CMS_IF(st_jass_ssm_start_game)$$--

    --$$CMS_SET(void, set_st_participate_data.put("start_game", true))$$--

  --$$CMS_ELSE$$--

    --$$CMS_SET(void, set_st_participate_data.put("start_game", false))$$--

  --$$CMS_END_IF$$--

 

  --$$-- Button Referenz / Link --$$--

  --$$CMS_IF(!st_jass_ssm_participate_link.isEmpty)$$--

    --$$CMS_SET(void, set_st_participate_data.put("href", ref(st_jass_ssm_participate_link, abs:2).url))$$--

  --$$CMS_END_IF$$--

--$$CMS_END_IF$$--

--$$-- Bilder / Videos --$$--

--$$CMS_IF((!st_jass_ssm_desktop_resources_list.isEmpty) || (!st_jass_ssm_mobile_resources_list.isEmpty))$$--

  --$$CMS_SET(set_st_resources_data, {"":""})$$--

  --$$CMS_SET(void, set_st_resources_data.clear())$$--

 

  --$$-- DESKTOP (Bilder / Videos) --$$--

  --$$CMS_IF(!st_jass_ssm_desktop_resources_list.isEmpty)$$--

  --$$CMS_SET(set_desktop_resource, [])$$--

    --$$CMS_FOR(st_jass_ssm_desktop_resources_list_entry, st_jass_ssm_desktop_resources_list)$$--

      --$$CMS_SET(set_url_ref, ref(st_jass_ssm_desktop_resources_list_entry.st_jass_ssm_big_teaser_desktop_resource, abs:2).url)$$--

      --$$CMS_SET(void, set_desktop_resource.add(set_url_ref))$$--

   

    --$$CMS_END_FOR$$--

    --$$CMS_SET(void, set_st_resources_data.put("desktop", set_desktop_resource))$$--

  --$$CMS_END_IF$$----$$-- DESKTOP (Bilder / Videos) --$$--

--$$CMS_END_IF$$----$$-- Bilder / Videos --$$--

--$$CMS_SET(void, set_st_big_teaser_data.put("teilnehmen_btn", set_st_participate_data))$$--

--$$CMS_SET(void, set_st_big_teaser_data.put("background_img", set_st_resources_data))$$--

--$$CMS_VALUE(set_st_big_teaser_data.toJson)$

Die Vorschau dazu sieht auch korrekt aus:

{

    "animate_btn": true,

    "background_img": {

        "desktop": [

            "/fs5preview/preview/1611/media/DE_CH/current/142928/schweizer_schieber_meisterschaft_frau_aelter.mp4",

            "/fs5preview/preview/1611/media/DE_CH/current/142923/ORIGINAL/mann_aelter_still.jpg"

        ]

    },

    "header_title": "Teaser Title (DE)",

    "ribbon_txt": "Ribbon Title (DE)",

    "teilnehmen_btn": {

        "href": "/fs5preview/preview/1611/site/DE_CH/current/1616/5147",

        "is_countdown": false,

        "is_participants": false,

        "label": "Button Label (DE)",

        "start_game": false

    },

    "training_btn": true

}

Nur das Rendering erzeugt Fehler in der Ausgabe:

ERROR 

[–] 11:03:29 ERROR 31.07.2017 11:03:29.471 {uID=0,g-node=142929,seID=2702,pID=1611,g-se [...] 31.07.2017 11:03:29 ERROR 31.07.2017 11:03:29.471 {uID=0,g-node=142929,seID=2702,pID=1611,g-sec=143026} (de.espirit.firstspirit.generate.SiteProduction): java.lang.NullPointerException
inside of: Template 'json Seite' (id=105483)
inside of: $CMS_RENDER(template:"ft_settings__sl")$ - at 1, 1
inside of: Format Template 'ft_settings__sl' (id=1699)
inside of: $CMS_TRIM(level:4)$ - at 27, 4
inside of: $CMS_FOR( for_body, #global.page.getChildren(set_ft_bodyClass) )$ - at 75, 5
inside of: $CMS_SET(void, set_bodyContents.put(for_body.name, set_generatedBody.toString()))$ - at 85, 6
inside of: $CMS_FOR( for_section, for_body.getChildren() )$ - at 77, 7
inside of: $CMS_IF( for_section.isInOutputIncluded(#global.language) )$ - at 78, 7
inside of: $CMS_VALUE(for_section)$ - at 79, 8
inside of: Template 'st_jass_ssm_big_teaser' (id=142931)
inside of: $CMS_IF( ( ! st_jass_ssm_desktop_resources_list.isEmpty) || ( ! st_jass_ssm_mobile_resources_list.isEmpty) )$ - at 59, 4
inside of: $CMS_IF( ! st_jass_ssm_desktop_resources_list.isEmpty )$ - at 64, 6
inside of: $CMS_FOR( st_jass_ssm_desktop_resources_list_entry, st_jass_ssm_desktop_resources_list )$ - at 67, 8
inside of: $CMS_SET(void, set_desktop_resource.add(set_url_ref))$ - at 69, 10
FSVersion=5.1.507.70194#4330;JDK=1.8.0_60 64bit Oracle Corporation;OS=Linux 2.6.32-573.12.1.el6.x86_64 amd64;Date=31.07.2017 11:03:29
java.lang.NullPointerException

ERROR 

[–] 11:03:29 ERROR 31.07.2017 11:03:29.471 {uID=0,g-node=142929,seID=2702,pID=1611,g-se [...] 31.07.2017 11:03:29 ERROR 31.07.2017 11:03:29.471 {uID=0,g-node=142929,seID=2702,pID=1611,g-sec=143026} (de.espirit.firstspirit.generate.SiteProduction): no target selected
inside of: Template 'json Seite' (id=105483)
inside of: $CMS_RENDER(template:"ft_settings__sl")$ - at 1, 1
inside of: Format Template 'ft_settings__sl' (id=1699)
inside of: $CMS_TRIM(level:4)$ - at 27, 4
inside of: $CMS_FOR( for_body, #global.page.getChildren(set_ft_bodyClass) )$ - at 75, 5
inside of: $CMS_SET(void, set_bodyContents.put(for_body.name, set_generatedBody.toString()))$ - at 85, 6
inside of: $CMS_FOR( for_section, for_body.getChildren() )$ - at 77, 7
inside of: $CMS_IF( for_section.isInOutputIncluded(#global.language) )$ - at 78, 7
inside of: $CMS_VALUE(for_section)$ - at 79, 8
inside of: Template 'st_jass_ssm_big_teaser' (id=142931)
inside of: $CMS_IF( ( ! st_jass_ssm_desktop_resources_list.isEmpty) || ( ! st_jass_ssm_mobile_resources_list.isEmpty) )$ - at 59, 4
inside of: $CMS_IF( ! st_jass_ssm_desktop_resources_list.isEmpty )$ - at 64, 6
inside of: $CMS_FOR( st_jass_ssm_desktop_resources_list_entry, st_jass_ssm_desktop_resources_list )$ - at 67, 8
inside of: $CMS_SET(set_url_ref, ref(st_jass_ssm_desktop_resources_list_entry.st_jass_ssm_big_teaser_desktop_resource, abs:2).url)$ - at 68,
Kann mir jemand sagen, was hier falsch läuft?

Die Referenzen sind alle gefüllt...

Grüße,

Bianca

0 Kudos
1 Solution

Accepted Solutions
brueder
I'm new here

Hallo Bianca,

kann es sein dass der aktuelle Freigabestand nicht alle Werte befüllt hat? In der Vorschau werde ja die aktuellen, evtl noch nicht freigegebenen Werte verwendet, bei der Generierung wird allerdings der letzte Freigabestand verwendet.

Viele Grüße,

Lena

View solution in original post

0 Kudos
3 Replies
brueder
I'm new here

Hallo Bianca,

kann es sein dass der aktuelle Freigabestand nicht alle Werte befüllt hat? In der Vorschau werde ja die aktuellen, evtl noch nicht freigegebenen Werte verwendet, bei der Generierung wird allerdings der letzte Freigabestand verwendet.

Viele Grüße,

Lena

0 Kudos

Hallo zusammen,

ich denke auch, dass die Anmerkung von Lena in die richtige Richtung geht. Der Fehler kommt ja aus der Zeile

$CMS_SET(set_url_ref, ref(st_jass_ssm_desktop_resources_list_entry.st_jass_ssm_big_teaser_desktop_resource, abs:2).url)$

also könnte es sein, dass die Referenz zwar gefüllt ist, das st_jass_ssm_big_teaser_desktop_resource aber nicht freigegeben ist?

Grüße,

Hannes

0 Kudos
bianca_batsch
New Responder

Hi,

ja, es war eine fehlende Freigabe in einer anderen Sprache, die aber keinen Fehler beim Speichern zeigte 😕 Aber 3 FS-Leute habens beim drüber schauen übersehen -.-

Vielen Dank für eure Antworten.

Bianca

0 Kudos