Thanks DM, I've now managed to narrow down the problem and have a unit test that replicates the issue:<div><br></div><div><div>Could someone lend me a hand and run a simple junit test to test this on another environment? The test below fails on my laptop (java 1.6 update 22) with that particular error I described earlier.</div>
<div><br></div><div><div>    @Test</div><div>    public void testConcurrencyIssueOnBookData() throws NoSuchKeyException, BookException,</div><div>            InterruptedException {</div><div>        final String name = "KJV";</div>
<div>        final String ref = "Rom.1.1";</div><div><br></div><div>        final Runnable t = new Runnable() {</div><div>            @Override</div><div>            public void run() {</div><div>                final Book b0 = Books.installed().getBook(name);</div>
<div>                BookData bd1;</div><div>                try {</div><div>                    bd1 = new BookData(b0, b0.getKey(ref));</div><div><b>                    bd1.getSAXEventProvider();</b></div><div>                } catch (final NoSuchKeyException e) {</div>
<div>                    e.printStackTrace();</div><div>                } catch (final BookException e) {</div><div>                    e.printStackTrace();</div><div>                }</div><div><br></div><div>            }</div>
<div>        };</div><div><br></div><div>        int ii = 0;</div><div>        while (ii++ < 1000) {</div><div>            final Thread t1 = new Thread(t);</div><div>            final Thread t2 = new Thread(t);</div><div>
            t1.start();</div><div>            t2.start();</div><div><br></div><div>            t1.join();</div><div>            t2.join();</div><div>        }</div><div>    }</div></div><div><br></div><div>The issue I have in the test above occurs with this line:</div>
<div>                    bd1.getSAXEventProvider(); (bold above)</div><div><br></div><div>If I put a breakpoint on the call to getSAXEventProvider and let one thread run through things look alright. If I put it line below, I get one of three scenarios. (so we may be looking at a couple of bugs)</div>
<div><br></div><div>75% stacktrace as below</div><div>20% no text returned, or garbled text (e.g. cross refs showing in the text displayed when they weren't asked for...)</div><div>5% it works</div><div><br></div><div>
If someone could try and run it and feedback that would be helpful (running latest version of jsword)</div><div>Chris</div><div><br></div><br><div class="gmail_quote">On 28 February 2011 20:58, DM Smith <span dir="ltr"><<a href="mailto:dmsmith@crosswire.org">dmsmith@crosswire.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

  
    
  
  <div 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<div><div></div><div class="h5"><br>
    <br>
    On 02/27/2011 05:37 PM, Chris Burrell wrote:
    </div></div><blockquote type="cite"><div><div></div><div class="h5">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 href="mailto:chris@burrell.me.uk" target="_blank">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>
      </div></div><pre><fieldset></fieldset>
_______________________________________________
jsword-devel mailing list
<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
jsword-devel mailing list<br>
<a href="mailto:jsword-devel@crosswire.org">jsword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
<br></blockquote></div><br></div>