Uploaded image for project: 'JSword'
  1. JSword
  2. JS-185

Concurrency issue with JSword - bd1.getSAXEventProvider(); throws "Root Element not set"

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.7
    • Component/s: None
    • Labels:
      None

      Description

      Caused by: java.lang.IllegalStateException: Root element not set
      at org.jdom.Document.getRootElement(Document.java:218)
      at org.crosswire.jsword.book.filter.osis.OSISFilter.parse(OSISFilter.java:149)
      at org.crosswire.jsword.book.filter.osis.OSISFilter.toOSIS(OSISFilter.java:74)
      at org.crosswire.jsword.book.basic.AbstractPassageBook.getOsisIterator(AbstractPassageBook.java:90)
      at org.crosswire.jsword.book.BookData.getOsisContent(BookData.java:157)
      at org.crosswire.jsword.book.BookData.getOsisFragment(BookData.java:100)
      at org.crosswire.jsword.book.BookData.getSAXEventProvider(BookData.java:113)
      at com.tyndalehouse.step.core.service.impl.JSwordServiceImpl.getOsisText(JSwordServiceImpl.java:131)
      at com.tyndalehouse.step.core.service.impl.BibleInformationServiceImpl.getPassageText(BibleInformationServiceImpl.java:57)
      at com.tyndalehouse.step.rest.controllers.BibleController.getBibleText(BibleController.java:101)
      at com.tyndalehouse.step.rest.controllers.BibleController.getBibleText(BibleController.java:60)
      ... 28 more

      @Test
      public void testConcurrencyIssueOnBookData() throws NoSuchKeyException, BookException,
      InterruptedException {
      final String[] names =

      { "KJV", "ESV" }

      ;
      final String ref = "Rom.1.1";

      final Runnable r1 = new Runnable() {
      @Override
      public void run() {
      final Book b0 = Books.installed().getBook(names[0]);
      BookData bd1;
      try

      { bd1 = new BookData(b0, b0.getKey(ref)); bd1.getSAXEventProvider(); } catch (final NoSuchKeyException e) { e.printStackTrace(); } catch (final BookException e) { e.printStackTrace(); }

      }
      };

      final Runnable r2 = new Runnable() {
      @Override
      public void run() {
      final Book b0 = Books.installed().getBook(names[1]);
      BookData bd1;
      try { bd1 = new BookData(b0, b0.getKey(ref)); bd1.getSAXEventProvider(); }

      catch (final NoSuchKeyException e)

      { e.printStackTrace(); } catch (final BookException e) { e.printStackTrace(); }

      }
      };

      int ii = 0;
      while (ii++ < 1000)

      { final Thread t1 = new Thread(r1); final Thread t2 = new Thread(r2); t1.start(); t2.start(); t1.join(); t2.join(); }

      }

        Attachments

          Activity

            People

            • Assignee:
              dmsmith DM Smith
              Reporter:
              chrisburrell Chris Burrell
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: