[jsword-svn] common/java/config/org/crosswire/common/config s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Wed Feb 16 20:40:16 MST 2005


Update of /cvs/jsword/common/java/config/org/crosswire/common/config
In directory www.crosswire.org:/tmp/cvs-serv10098/java/config/org/crosswire/common/config

Modified Files:
	Config.java 
Log Message:
Fix for JS-9.

Index: Config.java
===================================================================
RCS file: /cvs/jsword/common/java/config/org/crosswire/common/config/Config.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Config.java	6 Oct 2004 22:52:34 -0000	1.6
--- Config.java	17 Feb 2005 03:40:14 -0000	1.7
***************
*** 261,329 ****
       * Take the data in the local storage area and copy it to the
       * application.
-      * @param force If the new value is the same as the current do we set anyway
       */
!     public void localToApplication(boolean force)
      {
!         int highestChange = Choice.PRIORITY_LOWEST;
! 
!         if (force)
!         {
!             log.info("Force=true, all changes will propogate regardless"); //$NON-NLS-1$
!         }
! 
!         for (int priority = Choice.PRIORITY_SYSTEM; priority >= Choice.PRIORITY_LOWEST; priority--)
          {
!             log.info("Settings for priority level=" + priority); //$NON-NLS-1$
! 
!             Iterator it = keys.iterator();
!             while (it.hasNext())
              {
!                 String key = (String) it.next();
!                 Choice choice = getChoice(key);
! 
!                 if (choice.getPriority() == priority)
                  {
!                     String oldValue = choice.getString();
!                     String newValue = local.getProperty(key);
! 
!                     // The new value shouldn't really be blank - obviously this
!                     // choice has just been added, substitute the default.
!                     if (newValue == null)
!                     {
!                         local.put(key, oldValue);
!                         newValue = oldValue;
!                     }
! 
!                     try
!                     {
!                         // If a value has not changed, we only call setString()
!                         // if force==true or if a higher priority choice has
!                         // changed.
!                         if (force
!                             || priority < highestChange
!                             || !newValue.equals(oldValue))
!                         {
!                             log.info("Setting " + key + "=" + newValue + " (was " + oldValue + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
!                             choice.setString(newValue);
! 
!                             if (priority > highestChange)
!                             {
!                                 highestChange = priority;
! 
!                                 if (!force)
!                                 {
!                                     log.info("Change at level " + highestChange + ", all changes will propogate regardless"); //$NON-NLS-1$ //$NON-NLS-2$
!                                 }
!                             }
!                         }
!                     }
!                     catch (Exception ex)
!                     {
!                         log.warn("Failure setting " + key + "=" + newValue, ex);  //$NON-NLS-1$ //$NON-NLS-2$
!                         Reporter.informUser(this, new ConfigException(Msg.CONFIG_SETFAIL, ex, new Object[] { choice.getFullPath() } ));
!                     }
                  }
              }
          }
      }
  
--- 261,366 ----
       * Take the data in the local storage area and copy it to the
       * application.
       */
!     public void localToApplication()
      {
!         Iterator it = keys.iterator();
!         while (it.hasNext())
          {
!             String key = (String) it.next();
!             Choice choice = getChoice(key);
!         
!             String oldValue = choice.getString();
!             String newValue = local.getProperty(key);
!                             
!             // The new value shouldn't really be blank - obviously this
!             // choice has just been added, substitute the default.
!             if (newValue == null || newValue.length() == 0)
              {
!                 if (oldValue == null)
                  {
!                     continue;
!                 }
!                 local.setProperty(key, oldValue);
!                 newValue = oldValue;
!             }    
!     
!             try
!             {
!                 // If a value has not changed, we only call setString()
!                 // if force==true or if a higher priority choice has
!                 // changed.
!                 if (!newValue.equals(oldValue))
!                 {
!                     log.info("Setting " + key + "=" + newValue + " (was " + oldValue + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
!                     choice.setString(newValue);
                  }
              }
+             catch (Exception ex)
+             {
+                 log.warn("Failure setting " + key + "=" + newValue, ex);  //$NON-NLS-1$ //$NON-NLS-2$
+                 Reporter.informUser(this, new ConfigException(Msg.CONFIG_SETFAIL, ex, new Object[] { choice.getFullPath() } ));
+             }
          }
+ //        int highestChange = Choice.PRIORITY_LOWEST;
+ //
+ //        if (force)
+ //        {
+ //            log.info("Force=true, all changes will propagate regardless"); //$NON-NLS-1$
+ //        }
+ //
+ //        for (int priority = Choice.PRIORITY_SYSTEM; priority >= Choice.PRIORITY_LOWEST; priority--)
+ //        {
+ //            log.info("Settings for priority level=" + priority); //$NON-NLS-1$
+ //
+ //            Iterator it = keys.iterator();
+ //            while (it.hasNext())
+ //            {
+ //                String key = (String) it.next();
+ //                Choice choice = getChoice(key);
+ //
+ //                if (choice.getPriority() == priority)
+ //                {
+ //                    String oldValue = choice.getString();
+ //                    String newValue = local.getProperty(key);
+ //
+ //                    // The new value shouldn't really be blank - obviously this
+ //                    // choice has just been added, substitute the default.
+ //                    if (newValue == null)
+ //                    {
+ //                        local.put(key, oldValue);
+ //                        newValue = oldValue;
+ //                    }
+ //
+ //                    try
+ //                    {
+ //                        // If a value has not changed, we only call setString()
+ //                        // if force==true or if a higher priority choice has
+ //                        // changed.
+ //                        if (force
+ //                            || priority < highestChange
+ //                            || !newValue.equals(oldValue))
+ //                        {
+ //                            log.info("Setting " + key + "=" + newValue + " (was " + oldValue + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ //                            choice.setString(newValue);
+ //
+ //                            if (priority > highestChange)
+ //                            {
+ //                                highestChange = priority;
+ //
+ //                                if (!force)
+ //                                {
+ //                                    log.info("Change at level " + highestChange + ", all changes will propagate regardless"); //$NON-NLS-1$ //$NON-NLS-2$
+ //                                }
+ //                            }
+ //                        }
+ //                    }
+ //                    catch (Exception ex)
+ //                    {
+ //                        log.warn("Failure setting " + key + "=" + newValue, ex);  //$NON-NLS-1$ //$NON-NLS-2$
+ //                        Reporter.informUser(this, new ConfigException(Msg.CONFIG_SETFAIL, ex, new Object[] { choice.getFullPath() } ));
+ //                    }
+ //                }
+ //            }
+ //        }
      }
  



More information about the jsword-svn mailing list