Axis2
  1. Axis2
  2. AXIS2-4480

AbstractJSONDataSource#getJSONString() and buffering

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5, 1.6.0
    • Fix Version/s: None
    • Component/s: modules
    • Labels:
      None

      Description

      The method getJSONString() in AbstractJSONDataSource makes
      use of string concatenation instead of using a buffer (e.g. StringBuilder).

      char temp = (char)jsonReader.read();
      jsonString = "";
      while ((int)temp != 65535)

      { jsonString += temp; temp = (char)jsonReader.read(); }

      A buffer would be nice for printing large JSON-strings (e.g. with 40000 characters)
      or a printing a lot of middle-sized JSON-strings.

      char temp = (char)jsonReader.read();
      StringBuilder sb = new StringBuilder(100); // TODO which initial capacity?
      while ((int)temp != 65535)

      { sb.append(temp); temp = (char)jsonReader.read(); }

      jsonString = sb.toString();

        Activity

        Sascha Rogmann created issue -
        Isuru Eranga Suriarachchi made changes -
        Field Original Value New Value
        Assignee Isuru Eranga Suriarachchi [ isurues ]
        Isuru Eranga Suriarachchi made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Isuru Eranga Suriarachchi
            Reporter:
            Sascha Rogmann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development