[jsword-svn] jsword/java/jsword/org/crosswire/jsword/book/sword s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Mon Mar 21 16:28:11 MST 2005


Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword
In directory www.crosswire.org:/tmp/cvs-serv959/java/jsword/org/crosswire/jsword/book/sword

Modified Files:
	ConfigEntry.java ConfigEntryType.java 
Log Message:
Put a fix in for bad data in the conf.

Index: ConfigEntry.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/ConfigEntry.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ConfigEntry.java	21 Mar 2005 02:37:28 -0000	1.11
--- ConfigEntry.java	21 Mar 2005 23:28:08 -0000	1.12
***************
*** 206,209 ****
--- 206,214 ----
      {
          String confEntryName = getName();
+         // Filter known types of entries
+         if (type != null)
+         {
+             aValue = type.filter(aValue);            
+         }
          aValue = handleRTF(aValue);
          if (mayRepeat())

Index: ConfigEntryType.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/ConfigEntryType.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ConfigEntryType.java	6 Mar 2005 20:21:47 -0000	1.3
--- ConfigEntryType.java	21 Mar 2005 23:28:08 -0000	1.4
***************
*** 153,157 ****
          public boolean isAllowed(String value)
          {
!             return choices.contains(value);
          }
  
--- 153,165 ----
          public boolean isAllowed(String value)
          {
!             return choices.contains(filter(value));
!         }
!         
!         /* (non-Javadoc)
!          * @see org.crosswire.jsword.book.sword.ConfigEntryType#filter(java.lang.String)
!          */
!         public String filter(String value)
!         {
!             return value.toUpperCase();
          }
  
***************
*** 244,248 ****
          public boolean isAllowed(String value)
          {
!             return choices.contains(value);
          }
  
--- 252,264 ----
          public boolean isAllowed(String value)
          {
!             return choices.contains(filter(value));
!         }
! 
!         /* (non-Javadoc)
!          * @see org.crosswire.jsword.book.sword.ConfigEntryType#filter(java.lang.String)
!          */
!         public String filter(String value)
!         {
!             return value.toUpperCase();
          }
  
***************
*** 953,957 ****
          public boolean isAllowed(String value)
          {
!             return choices.contains(value);
          }
  
--- 969,989 ----
          public boolean isAllowed(String value)
          {
!             return choices.contains(filter(value));
!         }
! 
!         /* (non-Javadoc)
!          * @see org.crosswire.jsword.book.sword.ConfigEntryType#filter(java.lang.String)
!          */
!         public String filter(String value)
!         {
! 
!             for (int i = 0; i < choiceArray.length; i++)
!             {
!                 if (choiceArray[i].equalsIgnoreCase(value))
!                 {
!                     return choiceArray[i];
!                 }
!             }
!             return value;
          }
  
***************
*** 973,985 ****
  
          /**
           * The set of choices.
           */
!         private final Set choices = new HashSet(Arrays.asList(new String[]
!         {
!             "Plaintext", //$NON-NLS-1$
!             "GBF", //$NON-NLS-1$
!             "ThML", //$NON-NLS-1$
!             "OSIS", //$NON-NLS-1$
!         }));
  
          /**
--- 1005,1021 ----
  
          /**
+          * The array of choices.
+          */
+         private final String[] choiceArray = new String[]
+             {
+                 "Plaintext", //$NON-NLS-1$
+                 "GBF", //$NON-NLS-1$
+                 "ThML", //$NON-NLS-1$
+                 "OSIS", //$NON-NLS-1$
+             };
+         /**
           * The set of choices.
           */
!         private final Set choices = new HashSet(Arrays.asList(choiceArray));
  
          /**
***************
*** 1073,1078 ****
          {
              return aValue != null
!                 && aValue.equalsIgnoreCase("true") //$NON-NLS-1$
!                 && aValue.equalsIgnoreCase("false"); //$NON-NLS-1$
          }
  
--- 1109,1114 ----
          {
              return aValue != null
!                 && (aValue.equalsIgnoreCase("true") //$NON-NLS-1$
!                 || aValue.equalsIgnoreCase("false")); //$NON-NLS-1$
          }
  
***************
*** 1238,1241 ****
--- 1274,1287 ----
  
      /**
+      * Modify the value if necessary.
+      * @param value the input
+      * @return either value or a modified version of it.
+      */
+     public String filter(String value)
+     {
+         return value;
+     }
+ 
+     /**
       * RTF is allowed in a few config entries.
       * @return true if rtf is allowed



More information about the jsword-svn mailing list