Uploaded image for project: 'Johnzon'
  1. Johnzon
  2. JOHNZON-345

StackOverflow when serializing Collection<URL>

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.2.11
    • 1.2.12
    • JSON-B
    • None

    Description

      The JSON-B specification mandates that compliant implementations MUST support serialization of Collection and URL.

      Unfortunately when serializing a Collection<URL> using Johnzon-Jsonb 1.2.11 an infinite loop happens, resulting in a StackOverflowException.

      I have reproduced this complaint by the following code:

        JsonbConfig jsonbConfig = new JsonbConfig();
        Jsonb jsonb = JsonbBuilder.create(jsonbConfig);
        URL url = new URL("http://www.apache.org");
        Collection<URL> collection = Collections.singleton(url);
        System.out.println("Jsonb collection: " + jsonb.toJson(collection));

      The same problem occurs with Collection<URI>, too.

      Collections in general work fine, i. e. the problem does not occur with e. g. Collection<UUID> or Collection<String>. Also single URL and URIs objects work fine, i. e. when not inside a collection!

      Attachments

        Activity

          People

            Unassigned Unassigned
            mkarg Markus Karg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: