<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Chris,<br>
    <br>
    I haven't seen your problem before. However,<br>
    <br>
    The line:<br>
        requiredTransformation.iterator().next().getFile()<br>
    looks suspicious as the contract to iterator requires calling
    hasNext() before calling next() and only calling next() when
    hasNext() returns true.<br>
    <br>
    The reason for this is that hasNext() typically sets up what next()
    returns.<br>
    <br>
    Some implementations of an iterator will have the constructor
    setting up the first value to return and having next() do double
    duty of setting up the next value and returning the current value.
    In this case repeatedly calling next might work.<br>
    <br>
    Also calling, iterator().next(), if calling next() without hasNext()
    works, should only ever return the first value as the call to
    iterator should set up a fresh iterator.<br>
    <br>
    In Him,<br>
        DM<br>
    <br>
    On 02/27/2011 05:37 PM, Chris Burrell wrote:
    <blockquote
      cite="mid:AANLkTinUQ+56DgaGMe=C8g5Oh-Er1JwjGSAHHP4k9boq@mail.gmail.com"
      type="cite">The code I'm running into issues with is here. It
      could well be I'm mis-using the library?
      <div>
        <div>final SAXEventProvider osissep =
          bookData.getSAXEventProvider();</div>
        <div>            TransformingSAXEventProvider htmlsep = null;</div>
        <div>            htmlsep = (TransformingSAXEventProvider) new
          Converter() {</div>
        <div><br>
        </div>
        <div>                public SAXEventProvider convert(final
          SAXEventProvider provider) throws TransformerException {</div>
        <div>
                              try {</div>
        <div>                        // for now, we just assume that
          we'll only have one option, but this may change later</div>
        <div>                        // TODO, we can probably cache the
          resource</div>
        <div>                        final TransformingSAXEventProvider
          tsep = new TransformingSAXEventProvider(getClass()</div>
        <div>                               
.getResource(requiredTransformation.iterator().next().getFile()).toURI(),</div>
        <div>                                osissep);</div>
        <div><br>
        </div>
        <div>                        // set parameters here</div>
        <div>                        setOptions(tsep, options, version,
          reference);</div>
        <div>                        setupInterlinearOptions(tsep,
          interlinearVersion, reference);</div>
        <div>                        return tsep;</div>
        <div>                    } catch (final URISyntaxException e) {</div>
        <div>                        throw new
          StepInternalException("Failed to load resource correctly", e);</div>
        <div>                    }</div>
        <div>                }</div>
        <div><br>
        </div>
        <div>            }.convert(osissep);</div>
        <div><br>
        </div>
        <br>
        <div class="gmail_quote">On 27 February 2011 16:52, Chris
          Burrell <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:chris@burrell.me.uk">chris@burrell.me.uk</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">Hello...
            <div><br>
            </div>
            <div>I was just wondering if someone has come across this
              issue before?</div>
            <div><br>
            </div>
            <div>
              I have two panes loading two passages (1 ESV, 1 KJV). I am
              getting the following issue fairly frequently. (this is
              different to the issue I raised quite a while ago, in that
              the one before was corruption in the book reading driver).</div>
            <div><br>
            </div>
            <div>
              <div>Caused by: java.lang.IllegalStateException: Root
                element not set</div>
              <div><span style="white-space: pre-wrap;"> </span>at
                org.jdom.Document.getRootElement(Document.java:218)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
org.crosswire.jsword.book.filter.osis.OSISFilter.parse(OSISFilter.java:149)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
org.crosswire.jsword.book.filter.osis.OSISFilter.toOSIS(OSISFilter.java:74)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
org.crosswire.jsword.book.basic.AbstractPassageBook.getOsisIterator(AbstractPassageBook.java:90)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
                org.crosswire.jsword.book.BookData.getOsisContent(BookData.java:157)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
                org.crosswire.jsword.book.BookData.getOsisFragment(BookData.java:100)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
org.crosswire.jsword.book.BookData.getSAXEventProvider(BookData.java:113)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
com.tyndalehouse.step.core.service.impl.JSwordServiceImpl.getOsisText(JSwordServiceImpl.java:131)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
com.tyndalehouse.step.core.service.impl.BibleInformationServiceImpl.getPassageText(BibleInformationServiceImpl.java:57)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
com.tyndalehouse.step.rest.controllers.BibleController.getBibleText(BibleController.java:101)</div>
              <div><span style="white-space: pre-wrap;"> </span>at
com.tyndalehouse.step.rest.controllers.BibleController.getBibleText(BibleController.java:60)</div>
              <div><span style="white-space: pre-wrap;"> </span>... 28
                more</div>
            </div>
            <div><br>
            </div>
            <div>Also DM, have you started looking at JS-109? Just
              wondering...</div>
            <div>Chris</div>
            <font color="#888888">
              <div><br>
              </div>
            </font></blockquote>
        </div>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
jsword-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:jsword-devel@crosswire.org">jsword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/jsword-devel">http://www.crosswire.org/mailman/listinfo/jsword-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>