[jsword-svn] jsword/java/jsword/org/crosswire/jsword/book/filter/osis s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sat Mar 5 15:08:08 MST 2005


Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/filter/osis
In directory www.crosswire.org:/tmp/cvs-serv27571/java/jsword/org/crosswire/jsword/book/filter/osis

Modified Files:
	OSISFilter.java 
Log Message:
Improved error reporting when parsing modules. Specifically, I added Key as a n argument to toOSIS in Filter and its derivatives. On entry into the routine, I called DataPolice.setKey(key) and on exit, DataPolice.setKey(null)

Index: OSISFilter.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/filter/osis/OSISFilter.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** OSISFilter.java	4 Mar 2005 12:52:51 -0000	1.11
--- OSISFilter.java	5 Mar 2005 22:08:06 -0000	1.12
***************
*** 11,15 ****
  import org.crosswire.jsword.book.filter.Filter;
  import org.crosswire.jsword.book.filter.FilterException;
! import org.crosswire.jsword.book.filter.FilterUtil;
  import org.jdom.Document;
  import org.jdom.Element;
--- 11,15 ----
  import org.crosswire.jsword.book.filter.Filter;
  import org.crosswire.jsword.book.filter.FilterException;
! import org.crosswire.jsword.passage.Key;
  import org.jdom.Document;
  import org.jdom.Element;
***************
*** 47,54 ****
       * @see org.crosswire.jsword.book.filter.Filter#toOSIS(org.crosswire.jsword.book.filter.BookDataListener, java.lang.String)
       */
!     public List toOSIS(String plain) throws FilterException
      {
! //        Element ele = OSISUtil.factory().createDiv();
! 
          Element ele = null;
          try
--- 47,53 ----
       * @see org.crosswire.jsword.book.filter.Filter#toOSIS(org.crosswire.jsword.book.filter.BookDataListener, java.lang.String)
       */
!     public List toOSIS(Key key, String plain) throws FilterException
      {
!         DataPolice.setKey(key);
          Element ele = null;
          try
***************
*** 58,64 ****
          catch (Exception ex1)
          {
!             DataPolice.report("parse (1) original failed: " + ex1.getMessage() + //$NON-NLS-1$
!                               "\n  while parsing: " + plain); //$NON-NLS-1$
! //            DataPolice.report("  while parsing: " + FilterUtil.forOutput(plain)); //$NON-NLS-1$
  
              // Attempt to fix broken entities, that could be a low damage
--- 57,62 ----
          catch (Exception ex1)
          {
!             DataPolice.report("Parse failed: " + ex1.getMessage() + //$NON-NLS-1$
!                               "\non: " + plain); //$NON-NLS-1$
  
              // Attempt to fix broken entities, that could be a low damage
***************
*** 72,77 ****
              catch (Exception ex2)
              {
!                 DataPolice.report("parse (2) cropped failed: " + ex2.getMessage()); //$NON-NLS-1$
!                 DataPolice.report("  while parsing: " + FilterUtil.forOutput(cropped)); //$NON-NLS-1$
  
                  // So just try to strip out all XML looking things
--- 70,74 ----
              catch (Exception ex2)
              {
!                 log.warn("Could not fix it by cleaning entities", ex2); //$NON-NLS-1$
  
                  // So just try to strip out all XML looking things
***************
*** 84,89 ****
                  catch (Exception ex3)
                  {
!                     DataPolice.report("parse (3) shawn failed: " + ex3.getMessage()); //$NON-NLS-1$
!                     DataPolice.report("  while parsing: " + FilterUtil.forOutput(shawn)); //$NON-NLS-1$
  
                      try
--- 81,85 ----
                  catch (Exception ex3)
                  {
!                     log.warn("Could not fix it by cleaning tags", ex3); //$NON-NLS-1$
  
                      try
***************
*** 100,103 ****
--- 96,104 ----
              }
          }
+         finally
+         {
+             // Make sure that other places don't report this problem
+             DataPolice.setKey(null);
+         }
          return ele.removeContent();
      }



More information about the jsword-svn mailing list