JiBX
  1. JiBX
  2. JIBX-82

JIBX hangs while reading from streaming XML

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0-RC1
    • Fix Version/s: 1.0-RC2
    • Component/s: core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I'm using a service that sends back an xml response. The problem is that there are no separators between the xml tags and it seems that when InputStreamWrapper is reading the tokens the in the getReader method it reads forever, because the end of the inital <?xml version="1.0"?> cannot be recognized. The token contains the first part of the next tag, i.e. ?><some-name. Then the following loop continues forever,

      while ((token = scanToken()) != null &&
      !"?>".startsWith(token)) {
      if ("encoding".equals(token)) {
      if ("=".equals(scanToken())) {
      token = scanQuoted();
      if (token != null)

      { m_encodingName = token; break; }

      }
      } else if ("=".equals(token))

      { scanQuoted(); }

      }

      If I skip 21 bytes from the stream before the unmarshalling then there is no problem.

      We'll probably patcth JIBX for now, so instead of comparing by using equals

      while ((token = scanToken()) != null &&
      !"?>".startsWith(token)) {
      ........
      },

      use startsWith

      while ((token = scanToken()) != null &&
      !"?>".startsWith(token)) {
      .....
      }

      Thanks.
      -Ivan

        Activity

        Hide
        Ivan Hadzhiiliev added a comment -

        Sorry the fix should be,

        while ((token = scanToken()) != null &&
        !token.startsWith("?>"))

        { ..... }

        instead of

        while ((token = scanToken()) != null &&
        !"?>".equals(token)) { ..... }
        Show
        Ivan Hadzhiiliev added a comment - Sorry the fix should be, while ((token = scanToken()) != null && !token.startsWith("?>")) { ..... } instead of while ((token = scanToken()) != null && !"?>".equals(token)) { ..... }
        Hide
        Dennis Sosnoski added a comment -

        Fixed this for RC1

        Show
        Dennis Sosnoski added a comment - Fixed this for RC1

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Ivan Hadzhiiliev
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: