[jsword-devel] [JIRA] Created: (JS-185) Concurrency issue with JSword - bd1.getSAXEventProvider(); throws "Root Element not set"

Chris Burrell (JIRA) jira at crosswire.org
Tue Mar 29 14:41:03 MST 2011


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

                 Key: JS-185
                 URL: http://www.crosswire.org/bugs/browse/JS-185
             Project: JSword
          Issue Type: Bug
    Affects Versions: 1.6
            Reporter: Chris Burrell
            Assignee: DM Smith
             Fix For: 1.7


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();
        }
    }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jsword-devel mailing list