Skip to main content

Writing, debugging and testing a custom UrlGenerator

Comments

5 comments

  • Zendesk API User
    Author: mbergmann - 9/7/2017 21:25

    Hi Liam,

    did you reset the stored urls? If you used another UrlFactory before that uses storedUrls (e.g. the AdvancedUrlFactory) and your implementation uses them too, it won't be used to create urls for nodes that already have a stored url.

    The default configuration for this behavior is done in the module.xml but can be overridden in the schedule entry using the "useregistry" parameter, see also here.

    Michael

    0
  • Zendesk API User
    Author: mikula - 9/20/2017 9:06

    Hello Liam, 

    do you need further help or did Michaels reply already help you? If so, it would be great if you marked his reply as "correct answer" so that other community users find the solution easily. If you have already found a solution by yourself, it would be very kind of you, if you could share it here.

    Best regards 

    Martin

    0
  • Zendesk API User
    Author: liam_davison - 9/20/2017 12:02

    The stored urls was helpful.

    I would still like to be able to add logging statements in my UrlFactory but I don't have a Context object available for logging.

    0
  • Zendesk API User
    Author: mbergmann - 9/20/2017 12:15

    Hi Liam,

    you should always be able to use the method Logging.logInfo (warning/error/debug). Even when there is a context object you should use that approach.

    BTW: When you do not want to reset (and lose...) the stored URLs until your implementation is done, you can also just disable the use of stored URLs in your UrlFactory. The setting is used both to configure if already stored URLs should be used and (if this is activated) if the URLs calculated by your UrlFactory shoould be stored. You can achieve this by using the "useregistry" parameter in the configuration part in the module.xml and/or by "overriding" it by a script in the generation schedule.

    Michael

    0
  • Zendesk API User
    Author: liam_davison - 9/22/2017 10:28

    Hi Michael,

    Thank you for the logging information.

    When I add <useRegistry>false</useRegistry> I get thousands of NullPointerExceptions, though the URLs and files are generated correctly. 11 NullPointerExceptions per page generated!

    ERROR 22.09.2017 08:46:50.342{g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.344{g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.345{g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.347{g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.349{g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.386{g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.484{g-sec=661828,g-node=661826,g-entity=News and Events(5451)} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.715{g-sec=716312,g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.727{g-sec=716011,g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.729{g-sec=688182,g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    ERROR 22.09.2017 08:46:50.731{g-sec=716459,g-node=661826} (de.espirit.firstspirit.generate.SiteProduction): Error resolving reference - java.lang.NullPointerException

    INFO  22.09.2017 08:46:50.734 (de.espirit.firstspirit.generate.SiteProduction): creating output stream for /news-events/rural-priorities-scheme-contracts---management-diaries-2017.html

    Unfortunately there's no more information in the logs to help me find the source of the error.

    Liam

    0

Please sign in to leave a comment.