[jsword-svn] r1159 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop bibledesktop/src/main/java/org/crosswire/bibledesktop/display/splitlist bibledesktop/src/main/java/org/crosswire/bibledesktop/display/tab common/src/main/java/org/crosswire/common/util common-swing/src/main/java/org/crosswire/common/config/swing common-swing/src/main/java/org/crosswire/common/swing common-swing/src/main/java/org/crosswire/common/swing/desktop jsword/src/main/java/org/crosswire/jsword/book/basic jsword/src/main/java/org/crosswire/jsword/book/filter/osis jsword/src/main/java/org/crosswire/jsword/book/filter/thml jsword/src/main/java/org/crosswire/jsword/book/readings jsword/src/main/java/org/crosswire/jsword/book/sword jsword/src/main/java/org/crosswire/jsword/examples jsword/src/main/java/org/crosswire/jsword/index jsword/src/main/java/org/crosswire/jsword/passage jsword/src/main/java/org/crosswire/jsword/util jsword/src/main/java/org/crosswire/jsword/versification jsword-support/tools/pmd jsword-web/src/web
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Sat Oct 14 08:20:10 MST 2006
Author: dmsmith
Date: 2006-10-14 08:18:57 -0700 (Sat, 14 Oct 2006)
New Revision: 1159
Added:
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/IndexKey.java
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BooksComboBoxModel.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BooksListModel.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DictionaryPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SwordSiteEditor.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Splash.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/splitlist/SplitBookDataDisplay.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/tab/TabbedBookDataDisplay.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ColorField.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/PathField.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/ToolBar.java
trunk/common/src/main/java/org/crosswire/common/util/CWClassLoader.java
trunk/common/src/main/java/org/crosswire/common/util/MsgBase.java
trunk/common/src/main/java/org/crosswire/common/util/ResourceUtil.java
trunk/jsword-support/tools/pmd/cpdhtml.xslt
trunk/jsword-web/src/web/template.xsl
trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/THMLFilter.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsKey.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawLDBackend.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDailyDevotion.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ZLDBackend.java
trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java
trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusEvent.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultKeyList.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultLeafKeyList.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/DistinctPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/RocketPassage.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/SetKeyList.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
trunk/jsword/src/main/java/org/crosswire/jsword/util/OSType.java
trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java
trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java
trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java
trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java
Log:
Fixed "bugs" indicated by findbugs.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -27,6 +27,7 @@
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.Reader;
import java.io.Writer;
@@ -368,6 +369,19 @@
}
}
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ listeners = new EventListenerList();
+ is.defaultReadObject();
+ }
+
protected File saved;
private transient EventListenerList listeners;
private DisplaySelectPane pnlSelect;
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BooksComboBoxModel.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BooksComboBoxModel.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BooksComboBoxModel.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -21,6 +21,9 @@
*/
package org.crosswire.bibledesktop.book;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
import javax.swing.ComboBoxModel;
import org.crosswire.jsword.book.Book;
@@ -142,6 +145,19 @@
}
/**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ current = null;
+ is.defaultReadObject();
+ }
+
+ /**
* The currently selected version
*/
protected transient Book current;
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BooksListModel.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BooksListModel.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BooksListModel.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -21,6 +21,8 @@
*/
package org.crosswire.bibledesktop.book;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -196,6 +198,24 @@
}
/**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ listener = new CustomListDataListener();
+ filter = null;
+ // This is not quite right. Probably should write out the Book initials and read them in here.
+ // But at this time we don't serialize views.
+ bookList = Books.installed();
+
+ is.defaultReadObject();
+ }
+
+ /**
* The list of books in this tree
*/
private transient BookList bookList;
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DictionaryPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DictionaryPane.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DictionaryPane.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -25,6 +25,8 @@
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.JComboBox;
import javax.swing.JList;
@@ -374,9 +376,25 @@
}
/**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ // We don't serialize views
+ display = BookDataDisplayFactory.createBookDataDisplay();
+ dict = null;
+ set = null;
+ is.defaultReadObject();
+ }
+
+ /**
* The display of OSIS data
*/
- private BookDataDisplay display;
+ private transient BookDataDisplay display;
private transient Book dict;
protected transient BibleComboBoxModelSet set;
private JPanel pnlSelect;
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -32,6 +32,8 @@
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
@@ -568,7 +570,7 @@
/**
* Keep the selection up to date with indexing.
*/
- private IndexStatusListener isl = new IndexStatusListener()
+ private transient IndexStatusListener isl = new IndexStatusListener()
{
public void statusChanged(IndexStatusEvent ev)
{
@@ -724,6 +726,32 @@
}
/**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ // We don't serialize views
+ selected = null;
+
+ listeners = new EventListenerList();
+
+ actions = new ActionFactory(DisplaySelectPane.class, this);
+
+ isl = new IndexStatusListener()
+ {
+ public void statusChanged(IndexStatusEvent ev)
+ {
+ enableComponents();
+ }
+ };
+ is.defaultReadObject();
+ }
+
+ /**
*
*/
static final class SelectedActionListener implements ActionListener
@@ -798,7 +826,7 @@
/**
* Who is interested in things this DisplaySelectPane does
*/
- private EventListenerList listeners;
+ private transient EventListenerList listeners;
/**
* How may hits to show when the search results are ranked.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/PassageSelectionPane.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -29,6 +29,8 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@@ -80,8 +82,8 @@
*/
public PassageSelectionPane()
{
- icoGood = GuiUtil.getIcon("toolbarButtonGraphics/general/About24.gif"); //$NON-NLS-1$
- icoBad = GuiUtil.getIcon("toolbarButtonGraphics/general/Stop24.gif"); //$NON-NLS-1$
+ icoGood = GuiUtil.getIcon(GOOD_ICON);
+ icoBad = GuiUtil.getIcon(BAD_ICON);
init();
}
@@ -387,12 +389,31 @@
actions.getAction(DELETE).setEnabled(selected != null && selected.length > 0);
}
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ // We don't serialize views
+ icoGood = GuiUtil.getIcon(GOOD_ICON);
+ icoBad = GuiUtil.getIcon(BAD_ICON);
+ keyf = PassageKeyFactory.instance();
+ actions = new ActionFactory(PassageSelectionPane.class, this);
+ is.defaultReadObject();
+ }
+
private static final String BIBLE_TREE = "BibleTree"; //$NON-NLS-1$
private static final String ADD = "AddVerse"; //$NON-NLS-1$
private static final String DELETE = "DeleteVerse"; //$NON-NLS-1$
private static final String SELECTED_VERSES = "SelectedVerses"; //$NON-NLS-1$
private static final String VERSES = "Verses"; //$NON-NLS-1$
private static final String DONE = "Done"; //$NON-NLS-1$
+ private static final String GOOD_ICON = "toolbarButtonGraphics/general/About24.gif"; //$NON-NLS-1$
+ private static final String BAD_ICON = "toolbarButtonGraphics/general/Stop24.gif"; //$NON-NLS-1$
/**
* To convert strings into Biblical keys
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitePane.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -23,6 +23,8 @@
import java.awt.BorderLayout;
import java.awt.Component;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.BorderFactory;
import javax.swing.JButton;
@@ -522,6 +524,22 @@
}
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ // Broken but we don't serialize views
+ installer = null;
+ display = null;
+ actions = new ActionFactory(SitePane.class, this);
+ is.defaultReadObject();
+ }
+
private static final String INSTALLED_BOOKS_LABEL = "InstalledBooksLabel"; //$NON-NLS-1$
private static final String AVAILABLE_BOOKS_LABEL = "AvailableBooksLabel"; //$NON-NLS-1$
private static final String SELECTED_BOOK_LABEL = "SelectedBookLabel"; //$NON-NLS-1$
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SitesPane.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -27,6 +27,8 @@
import java.awt.FlowLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.util.Iterator;
import java.util.Map;
@@ -71,35 +73,7 @@
addAllInstallers();
- imanager.addInstallerListener(new InstallerListener()
- {
- /* (non-Javadoc)
- * @see org.crosswire.jsword.book.install.InstallerListener#installerAdded(org.crosswire.jsword.book.install.InstallerEvent)
- */
- public void installerAdded(InstallerEvent ev)
- {
- Installer installer = ev.getInstaller();
- String name = imanager.getInstallerNameForInstaller(installer);
-
- SitePane site = new SitePane(installer);
- tabMain.add(name, site);
- }
-
- /* (non-Javadoc)
- * @see org.crosswire.jsword.book.install.InstallerListener#installerRemoved(org.crosswire.jsword.book.install.InstallerEvent)
- */
- public void installerRemoved(InstallerEvent ev)
- {
- // This gets tricky because if you add a site with a new name
- // but the same details as an old one, then the old name goes
- // so we can't get the old name to remove it's tab (and anyway
- // we would have to do a search through all the tabs to find it
- // by name)
- // So we just nuke all the tabs and re-create them
- removeAllInstallers();
- addAllInstallers();
- }
- });
+ imanager.addInstallerListener(new SiteInstallerListener());
}
/**
@@ -213,13 +187,67 @@
}
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ actions = new ActionFactory(SitesPane.class, this);
+ imanager = new InstallManager();
+ installers = imanager.getInstallers();
+
+ is.defaultReadObject();
+
+ addAllInstallers();
+
+ imanager.addInstallerListener(new SiteInstallerListener());
+ }
+
+ /**
+ * Local listener for install events.
+ */
+ class SiteInstallerListener implements InstallerListener
+ {
+
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.book.install.InstallerListener#installerAdded(org.crosswire.jsword.book.install.InstallerEvent)
+ */
+ public void installerAdded(InstallerEvent ev)
+ {
+ Installer installer = ev.getInstaller();
+ String name = imanager.getInstallerNameForInstaller(installer);
+
+ SitePane site = new SitePane(installer);
+ tabMain.add(name, site);
+ }
+
+ /* (non-Javadoc)
+ * @see org.crosswire.jsword.book.install.InstallerListener#installerRemoved(org.crosswire.jsword.book.install.InstallerEvent)
+ */
+ public void installerRemoved(InstallerEvent ev)
+ {
+ // This gets tricky because if you add a site with a new name
+ // but the same details as an old one, then the old name goes
+ // so we can't get the old name to remove it's tab (and anyway
+ // we would have to do a search through all the tabs to find it
+ // by name)
+ // So we just nuke all the tabs and re-create them
+ removeAllInstallers();
+ addAllInstallers();
+ }
+ }
+
private static final String CLOSE = "SitesClose"; //$NON-NLS-1$
private static final String EDIT_SITE = "ManageSites"; //$NON-NLS-1$
/**
* The known installers fetched from InstallManager
*/
- private Map installers;
+ private transient Map installers;
/**
* The current installer
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SwordSiteEditor.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SwordSiteEditor.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/SwordSiteEditor.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -24,6 +24,8 @@
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.JLabel;
import javax.swing.JPanel;
@@ -175,7 +177,20 @@
return label;
}
- private AbstractSwordInstaller installer;
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ installer = null;
+ is.defaultReadObject();
+ }
+
+ private transient AbstractSwordInstaller installer;
private JTextField host;
private JTextField directory;
private JTextField proxyHost;
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -29,6 +29,7 @@
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
+import java.io.ObjectInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
@@ -788,7 +789,7 @@
}
Locale defaultLocale = Locale.getDefault();
- ResourceBundle configResources = ResourceBundle.getBundle(CONFIG_KEY, defaultLocale, new CWClassLoader(Desktop.class));
+ ResourceBundle configResources = ResourceBundle.getBundle(CONFIG_KEY, defaultLocale, CWClassLoader.instance(Desktop.class));
config.add(xmlconfig, configResources);
@@ -988,6 +989,21 @@
}
/**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ actions = new DesktopActions(this);
+ views = new ViewManager(this);
+ views.addViewEventListener(this);
+ is.defaultReadObject();
+ }
+
+ /**
* Helper class to run the application in a thread group and capture errors.
*/
private static final class DesktopThread extends Thread
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -515,7 +515,7 @@
/**
* The factory for actions that this class works with
*/
- private transient ActionFactory actions;
+ private ActionFactory actions;
/**
* The About window
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Splash.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Splash.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Splash.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -31,6 +31,8 @@
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@@ -158,6 +160,19 @@
dispose();
}
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ listener = new CustomWorkListener();
+ is.defaultReadObject();
+ }
+
private transient CustomWorkListener listener = new CustomWorkListener();
private static final String SPLASH_FONT = "SanSerif"; //$NON-NLS-1$
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/splitlist/SplitBookDataDisplay.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/splitlist/SplitBookDataDisplay.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/splitlist/SplitBookDataDisplay.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -243,7 +243,7 @@
*/
private KeySidebar sidebar;
private JSplitPane split;
- private BookDataDisplay child;
+ private transient BookDataDisplay child;
/**
* Serialization ID
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/tab/TabbedBookDataDisplay.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/tab/TabbedBookDataDisplay.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/tab/TabbedBookDataDisplay.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -396,7 +396,7 @@
/**
* A list of all the HyperlinkListeners
*/
- private transient List hyperlis;
+ private List hyperlis;
/**
* The passage that we are displaying (in one or more tabs)
Modified: trunk/common/src/main/java/org/crosswire/common/util/CWClassLoader.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/CWClassLoader.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/common/src/main/java/org/crosswire/common/util/CWClassLoader.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -24,6 +24,8 @@
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
* CWClassLoader extends the regular class loader by using looking
@@ -34,7 +36,7 @@
* The copyright to this program is held by it's authors.
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
-public class CWClassLoader extends ClassLoader
+public final class CWClassLoader extends ClassLoader
{
/**
* Creates a class loader that finds resources
@@ -43,7 +45,7 @@
* to load resources for a derived class.
* @param resourceOwner is the owner of the resource
*/
- public CWClassLoader(Class resourceOwner)
+ CWClassLoader(Class resourceOwner)
{
owner = resourceOwner;
}
@@ -53,11 +55,34 @@
* for the calling class that may not be in the class' package.
* Use this only within classes that are directly looking up their resources.
*/
- public CWClassLoader()
+ CWClassLoader()
{
owner = CallContext.getCallingClass();
}
+ /**
+ * Creates a privleged class loader that finds resources
+ * for the supplied class that may not be in the class' package.
+ * You can use this within base classes by passing getClass()
+ * to load resources for a derived class.
+ * @param resourceOwner is the owner of the resource
+ */
+ public static CWClassLoader instance(Class resourceOwner)
+ {
+ return (CWClassLoader) AccessController.doPrivileged(new PrivilegedLoader(resourceOwner));
+ }
+
+ /**
+ * Creates a privileged class loader that finds resources
+ * for the calling class that may not be in the class' package.
+ * Use this only within classes that are directly looking up their resources.
+ */
+ public static CWClassLoader instance()
+ {
+ Class resourceOwner = CallContext.getCallingClass();
+ return instance(resourceOwner);
+ }
+
/* (non-Javadoc)
* @see java.lang.ClassLoader#findResource(java.lang.String)
*/
@@ -290,6 +315,46 @@
}
/**
+ * PrivilegedLoader creates a CWClassLoader if it is
+ * able to obtain java security permissions to do so.
+ */
+ private static class PrivilegedLoader implements PrivilegedAction
+ {
+ /**
+ * Creates a privleged class loader that finds resources
+ * for the supplied class that may not be in the class' package.
+ * You can use this within base classes by passing getClass()
+ * to load resources for a derived class.
+ * @param resourceOwner is the owner of the resource
+ */
+ public PrivilegedLoader(Class resourceOwner)
+ {
+ owningClass = resourceOwner;
+ }
+
+ /**
+ * Creates a privleged class loader that finds resources
+ * for the calling class that may not be in the class' package.
+ * Use this only within classes that are directly looking up their resources.
+ */
+ public PrivilegedLoader()
+ {
+ owningClass = CallContext.getCallingClass();
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.security.PrivilegedAction#run()
+ */
+ public Object run()
+ {
+ return new CWClassLoader(owningClass);
+ }
+
+ private Class owningClass;
+ }
+
+ /**
* The class to which the resources belong
*/
private Class owner;
Modified: trunk/common/src/main/java/org/crosswire/common/util/MsgBase.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/MsgBase.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/common/src/main/java/org/crosswire/common/util/MsgBase.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -116,7 +116,7 @@
Locale defaultLocale = Locale.getDefault();
try
{
- resources = ResourceBundle.getBundle(className, defaultLocale, new CWClassLoader(implementingClass));
+ resources = ResourceBundle.getBundle(className, defaultLocale, CWClassLoader.instance(implementingClass));
resourceMap.put(className, resources);
}
catch (MissingResourceException ex)
Modified: trunk/common/src/main/java/org/crosswire/common/util/ResourceUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/ResourceUtil.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/common/src/main/java/org/crosswire/common/util/ResourceUtil.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -66,7 +66,7 @@
*/
public static URL getResource(Class clazz, String resourceName) throws MissingResourceException
{
- URL resource = new CWClassLoader(clazz).findResource(resourceName);
+ URL resource = CWClassLoader.instance(clazz).findResource(resourceName);
if (resource == null)
{
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ColorField.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ColorField.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ColorField.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -26,6 +26,8 @@
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.Icon;
import javax.swing.JButton;
@@ -101,6 +103,19 @@
return this;
}
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ actions = new ActionFactory(ColorField.class, this);
+ is.defaultReadObject();
+ }
+
private static final String EDIT = "EditColor"; //$NON-NLS-1$
/**
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/PathField.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/PathField.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/PathField.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -25,6 +25,8 @@
import java.awt.FlowLayout;
import java.awt.Font;
import java.io.File;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
@@ -187,6 +189,19 @@
return (String) model.getElementAt(list.getSelectedIndex());
}
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ actions = new ActionFactory(PathField.class, this);
+ is.defaultReadObject();
+ }
+
private static final String ADD = "AddPathEntry"; //$NON-NLS-1$
private static final String REMOVE = "RemovePathEntry"; //$NON-NLS-1$
private static final String UPDATE = "UpdatePathEntry"; //$NON-NLS-1$
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -24,6 +24,8 @@
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
@@ -192,6 +194,19 @@
}
/**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ actions = new ActionFactory(StringArrayField.class, this);
+ is.defaultReadObject();
+ }
+
+ /**
* The panel for a JOptionPane that allows editing a name/class
* combination.
*/
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -29,6 +29,8 @@
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -270,6 +272,19 @@
}
}
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ actions = new ActionFactory(WizardConfigEditor.class, this);
+ is.defaultReadObject();
+ }
+
private static final String NEXT = "WizardNext"; //$NON-NLS-1$
private static final String CANCEL = "WizardCancel"; //$NON-NLS-1$
private static final String FINISH = "WizardFinish"; //$NON-NLS-1$
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -188,7 +188,7 @@
{
try
{
- ResourceBundle resources = ResourceBundle.getBundle(basis.getName(), Locale.getDefault(), new CWClassLoader(basis));
+ ResourceBundle resources = ResourceBundle.getBundle(basis.getName(), Locale.getDefault(), CWClassLoader.instance(basis));
Enumeration en = resources.getKeys();
while (en.hasMoreElements())
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/ToolBar.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/ToolBar.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/desktop/ToolBar.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -25,6 +25,8 @@
import java.awt.Component;
import java.awt.Container;
import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import javax.swing.Action;
import javax.swing.Icon;
@@ -207,6 +209,19 @@
showLargeIcons(toggle.isSelected());
}
+ /**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ actions = new ActionFactory(ToolBar.class, this);
+ is.defaultReadObject();
+ }
+
private static final String TOOLBAR_TOGGLE = "ToolBarToggle"; //$NON-NLS-1$
private static final String TOOLBAR_TEXT = "ToolBarText"; //$NON-NLS-1$
private static final String TOOLBAR_LARGE = "ToolBarLarge"; //$NON-NLS-1$
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -411,5 +411,5 @@
/**
* The list of property change listeners
*/
- private transient EventListenerList listeners;
+ private EventListenerList listeners;
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -392,7 +392,7 @@
{
try
{
- languages = ResourceBundle.getBundle("iso639", Locale.getDefault(), new CWClassLoader()); //$NON-NLS-1$;
+ languages = ResourceBundle.getBundle("iso639", Locale.getDefault(), CWClassLoader.instance()); //$NON-NLS-1$;
}
catch (MissingResourceException e)
{
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/osis/OSISFilter.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -68,17 +68,14 @@
}
finally
{
- if (ex != null)
- {
- DataPolice.report("Parse failed: " + ex.getMessage() + //$NON-NLS-1$
- "\non: " + plain); //$NON-NLS-1$
- }
// Make sure that other places don't report this problem
DataPolice.setKey(null);
}
if (ex != null)
{
+ DataPolice.report("Parse failed: " + ex.getMessage() + //$NON-NLS-1$
+ "\non: " + plain); //$NON-NLS-1$
ele = cleanTags(plain);
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/THMLFilter.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/THMLFilter.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/THMLFilter.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -80,17 +80,14 @@
}
finally
{
- if (ex != null)
- {
- DataPolice.report("Parse failed: " + ex.getMessage() + //$NON-NLS-1$
- "\non: " + plain); //$NON-NLS-1$
- }
// Make sure that other places don't report this problem
DataPolice.setKey(null);
}
if (ex != null)
{
+ DataPolice.report("Parse failed: " + ex.getMessage() + //$NON-NLS-1$
+ "\non: " + plain); //$NON-NLS-1$
ele = cleanTags(plain);
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsBook.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -72,7 +72,7 @@
String setname = ReadingsBookDriver.getReadingsSet();
Locale defaultLocale = Locale.getDefault();
- ResourceBundle prop = ResourceBundle.getBundle(setname, defaultLocale, new CWClassLoader(ReadingsBookDriver.class));
+ ResourceBundle prop = ResourceBundle.getBundle(setname, defaultLocale, CWClassLoader.instance(ReadingsBookDriver.class));
String name = Msg.TITLE.toString();
try
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsKey.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsKey.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/readings/ReadingsKey.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -143,6 +143,11 @@
private Date date;
/**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = -5500401548068844993L;
+
+ /**
* Date formatter
*/
private static final DateFormat NAME_DF = new SimpleDateFormat("d MMMM"); //$NON-NLS-1$
Added: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/IndexKey.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/IndexKey.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/IndexKey.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -0,0 +1,105 @@
+package org.crosswire.jsword.book.sword;
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: LZSSBackend.java 1143 2006-10-04 22:07:23 -0400 (Wed, 04 Oct 2006) dmsmith $
+ */
+import org.crosswire.jsword.passage.DefaultLeafKeyList;
+import org.crosswire.jsword.passage.Key;
+
+/**
+ * A Key that knows where the data is in the real file.
+ *
+ * @see gnu.lgpl.License for license details.
+ * The copyright to this program is held by it's authors.
+ * @author Joe Walker [joe at eireneh dot com]
+ */
+class IndexKey extends DefaultLeafKeyList
+{
+ /**
+ * Setup with the key name and positions of data in the file
+ */
+ IndexKey(String text, int offset, int size, Key parent)
+ {
+ super(text, text, parent);
+
+ this.offset = offset;
+ this.size = size;
+ }
+
+ /**
+ * Setup with the key name. Use solely for searching.
+ */
+ IndexKey(String text)
+ {
+ super(text, text, null);
+
+ this.offset = -1;
+ this.size = -1;
+ }
+
+ /**
+ * @return the offset
+ */
+ public int getOffset()
+ {
+ return offset;
+ }
+
+ /**
+ * @param newOffset the offset to set
+ */
+ public void setOffset(int newOffset)
+ {
+ offset = newOffset;
+ }
+
+ /**
+ * @return the size
+ */
+ public int getSize()
+ {
+ return size;
+ }
+
+ /**
+ * @param newSize the size to set
+ */
+ public void setSize(int newSize)
+ {
+ size = newSize;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#clone()
+ */
+ public Object clone()
+ {
+ return super.clone();
+ }
+
+ private int offset;
+ private int size;
+
+ /**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = -2472601787934480762L;
+
+}
\ No newline at end of file
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawLDBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawLDBackend.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawLDBackend.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -40,7 +40,6 @@
import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.book.DataPolice;
import org.crosswire.jsword.passage.DefaultKeyList;
-import org.crosswire.jsword.passage.DefaultLeafKeyList;
import org.crosswire.jsword.passage.Key;
/**
@@ -243,7 +242,7 @@
try
{
- byte[] data = SwordUtil.readRAF(datRaf, ikey.offset, ikey.size);
+ byte[] data = SwordUtil.readRAF(datRaf, ikey.getOffset(), ikey.getSize());
int keyend = SwordUtil.findByte(data, SEPARATOR);
if (keyend == -1)
@@ -327,43 +326,4 @@
* The log stream
*/
private static final Logger log = Logger.getLogger(RawLDBackend.class);
-
- /**
- * A Key that knows where the data is in the real file.
- */
- static class IndexKey extends DefaultLeafKeyList
- {
- /**
- * Setup with the key name and positions of data in the file
- */
- protected IndexKey(String text, int offset, int size, Key parent)
- {
- super(text, text, parent);
-
- this.offset = offset;
- this.size = size;
- }
-
- /**
- * Setup with the key name. Use solely for searching.
- */
- protected IndexKey(String text)
- {
- super(text, text, null);
-
- this.offset = -1;
- this.size = -1;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#clone()
- */
- public Object clone()
- {
- return super.clone();
- }
-
- protected int offset;
- protected int size;
- }
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDailyDevotion.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDailyDevotion.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordDailyDevotion.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -22,7 +22,6 @@
import java.text.DateFormat;
import java.util.Date;
-import org.crosswire.jsword.book.sword.RawLDBackend.IndexKey;
import org.crosswire.jsword.passage.Key;
import org.crosswire.jsword.passage.PreferredKey;
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ZLDBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ZLDBackend.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/ZLDBackend.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -40,7 +40,6 @@
import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.book.DataPolice;
import org.crosswire.jsword.passage.DefaultKeyList;
-import org.crosswire.jsword.passage.DefaultLeafKeyList;
import org.crosswire.jsword.passage.Key;
/**
@@ -288,7 +287,7 @@
try
{
- byte[] data = SwordUtil.readRAF(datRaf, ikey.offset, ikey.size);
+ byte[] data = SwordUtil.readRAF(datRaf, ikey.getOffset(), ikey.getSize());
int keyend = SwordUtil.findByte(data, SEPARATOR);
if (keyend == -1)
@@ -381,44 +380,4 @@
Activator.activate(this);
}
}
-
- /**
- * A Key that knows where the data is in the real file.
- */
- static class IndexKey extends DefaultLeafKeyList
- {
- /**
- * Setup with the key name and positions of data in the file
- */
- protected IndexKey(String text, int offset, int size, Key parent)
- {
- super(text, text, parent);
-
- this.offset = offset;
- this.size = size;
- }
-
- /**
- * Setup with the key name. Use solely for searching.
- */
- protected IndexKey(String text)
- {
- super(text, text, null);
-
- this.offset = -1;
- this.size = -1;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#clone()
- */
- public Object clone()
- {
- return super.clone();
- }
-
- protected int offset;
- protected int size;
- }
-
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/examples/BibleToOsis.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -77,7 +77,7 @@
openOutputFile(bmd.getInitials(), !BY_BOOK);
buildDocumentOpen(buf, bmd, range, !BY_BOOK);
- if ( !BY_BOOK)
+ if (!BY_BOOK)
{
writeDocument(buf);
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusEvent.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusEvent.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/IndexStatusEvent.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -56,7 +56,7 @@
/**
* The indexStatus of the book.
*/
- private transient IndexStatus indexStatus;
+ private IndexStatus indexStatus;
/**
* Serialization ID
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -55,15 +55,17 @@
*/
protected AbstractPassage()
{
+ this(null);
}
/**
* Setup the original name of this reference
- * @param original_name The text originally used to create this Passage.
+ * @param passageName The text originally used to create this Passage.
*/
- protected AbstractPassage(String original_name)
+ protected AbstractPassage(String passageName)
{
- this.originalName = original_name;
+ originalName = passageName;
+ listeners = new ArrayList();
}
/* (non-Javadoc)
@@ -1243,10 +1245,6 @@
*/
protected void writeObjectSupport(ObjectOutputStream out) throws IOException
{
- // This allows our children to have default serializable fields
- // even though we have none.
- out.defaultWriteObject();
-
// the size in bits of teach storage method
int bitwise_size = BibleInfo.versesInBible();
int ranged_size = 8 * countRanges(RestrictionType.NONE);
@@ -1305,30 +1303,41 @@
}
/**
+ * Serialization support.
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ listeners = new ArrayList();
+ originalName = null;
+ parent = null;
+ skipNormalization = 0;
+ suppressEvents = 0;
+
+ is.defaultReadObject();
+ }
+
+ /**
* Write out the object to the given ObjectOutputStream
- * @param in The stream to read our state from
+ * @param is The stream to read our state from
* @throws IOException if the read fails
* @throws ClassNotFoundException If the read data is incorrect
*/
- protected void readObjectSupport(ObjectInputStream in) throws IOException, ClassNotFoundException
+ protected void readObjectSupport(ObjectInputStream is) throws IOException, ClassNotFoundException
{
raiseEventSuppresion();
raiseNormalizeProtection();
- // This allows our children to have default serializable fields
- // even though we have none.
- in.defaultReadObject();
-
- // Setup
- listeners = new ArrayList();
-
try
{
- int type = in.readInt();
+ int type = is.readInt();
switch (type)
{
case BITWISE:
- BitSet store = (BitSet) in.readObject();
+ BitSet store = (BitSet) is.readObject();
for (int i = 0; i < BibleInfo.versesInBible(); i++)
{
if (store.get(i))
@@ -1339,20 +1348,20 @@
break;
case DISTINCT:
- int verses = in.readInt();
+ int verses = is.readInt();
for (int i = 0; i < verses; i++)
{
- int ord = in.readInt();
+ int ord = is.readInt();
add(new Verse(ord));
}
break;
case RANGED:
- int ranges = in.readInt();
+ int ranges = is.readInt();
for (int i = 0; i < ranges; i++)
{
- int ord = in.readInt();
- int count = in.readInt();
+ int ord = is.readInt();
+ int count = is.readInt();
add(RestrictionType.NONE.toRange(new Verse(ord), count));
}
break;
@@ -1410,7 +1419,7 @@
/**
* Support for change notification
*/
- protected transient List listeners = new ArrayList();
+ protected transient List listeners;
/**
* The original string for picky users
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -423,6 +423,8 @@
*/
private void writeObject(ObjectOutputStream out) throws IOException
{
+ out.defaultWriteObject();
+
writeObjectSupport(out);
}
@@ -439,6 +441,9 @@
optimizeWrites();
store = new BitSet(BibleInfo.versesInBible() + 1);
+
+ in.defaultReadObject();
+
readObjectSupport(in);
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultKeyList.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultKeyList.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -163,6 +163,11 @@
private List keys = new ArrayList();
/**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = -1633375337613230599L;
+
+ /**
* The log stream
*/
private static final Logger log = Logger.getLogger(DefaultKeyList.class);
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultLeafKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultLeafKeyList.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/DefaultLeafKeyList.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -273,4 +273,10 @@
* The OSIS version of this Key
*/
private String osisName;
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7462556005744186622L;
+
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/DistinctPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/DistinctPassage.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/DistinctPassage.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -215,6 +215,8 @@
*/
private void writeObject(ObjectOutputStream out) throws IOException
{
+ out.defaultWriteObject();
+
writeObjectSupport(out);
}
@@ -231,6 +233,9 @@
optimizeWrites();
store = new TreeSet();
+
+ in.defaultReadObject();
+
readObjectSupport(in);
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Key.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -21,6 +21,8 @@
*/
package org.crosswire.jsword.passage;
+import java.io.Serializable;
+
import org.crosswire.common.util.Iterable;
/**
@@ -34,7 +36,7 @@
* The copyright to this program is held by it's authors.
* @author Joe Walker [joe at eireneh dot com]
*/
-public interface Key extends Comparable, Cloneable, Iterable
+public interface Key extends Comparable, Cloneable, Iterable, Serializable
{
/**
* A Human readable version of the Key.
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -540,6 +540,8 @@
*/
private void writeObject(ObjectOutputStream out) throws IOException
{
+ out.defaultWriteObject();
+
writeObjectSupport(out);
}
@@ -556,6 +558,9 @@
optimizeWrites();
store = new TreeSet();
+
+ in.defaultReadObject();
+
readObjectSupport(in);
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/ReadOnlyKeyList.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -238,4 +238,9 @@
* The Key to which we proxy
*/
private Key keys;
+
+ /**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = -7947159638198641657L;
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/RocketPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/RocketPassage.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/RocketPassage.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -21,13 +21,15 @@
*/
package org.crosswire.jsword.passage;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.util.Iterator;
/**
* A RocketPassage is a bit and heavy implementation of Passage that goes
* fairly quickly once let of the leash. It manages its speed by creating
* contained instances of DistinctPassage and RangedPassage and selects
- * the fastest implementation for each fo its methods from the 3 available.
+ * the fastest implementation for each of its methods from the 3 available.
*
* @see gnu.lgpl.License for license details.
* The copyright to this program is held by it's authors.
@@ -249,6 +251,18 @@
}
/**
+ * Serialization support
+ * @param is The stream to read our state from
+ * @throws IOException if the read fails
+ * @throws ClassNotFoundException If the read data is incorrect
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ optimizeWrites();
+ is.defaultReadObject();
+ }
+
+ /**
* The contained DistinctPassage
*/
private transient DistinctPassage distinct;
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/SetKeyList.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/SetKeyList.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/SetKeyList.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -200,6 +200,11 @@
private List list = new ArrayList();
/**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = -1460162676283475117L;
+
+ /**
* The log stream
*/
private static final Logger log = Logger.getLogger(SetKeyList.class);
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -58,7 +59,7 @@
* The copyright to this program is held by it's authors.
* @author Joe Walker [joe at eireneh dot com]
*/
-public final class Verse implements Key
+public final class Verse implements Key, Serializable
{
/**
* The default Verse is Genesis 1:1. I didn't want to provide this
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -43,7 +44,7 @@
* @author Joe Walker [joe at eireneh dot com]
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
-public final class VerseRange implements Key
+public final class VerseRange implements Key, Serializable
{
/**
* The default VerseRange is a single verse - Genesis 1:1. I didn't
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/util/OSType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/util/OSType.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/util/OSType.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -74,7 +74,7 @@
{
if (userArea == null)
{
- userArea = NetUtil.lengthenURL(userHome, WIN32_USER_DATA_AREA);
+ userArea = NetUtil.lengthenURL(getUserHome(), WIN32_USER_DATA_AREA);
}
return userArea;
}
@@ -100,7 +100,7 @@
*/
public URL getUserArea()
{
- return userHome;
+ return getUserHome();
}
/* (non-Javadoc)
@@ -280,7 +280,7 @@
/**
* The user's home directory.
*/
- protected static URL userHome;
+ private static URL userHome;
/**
* The log stream
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/util/Project.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -23,7 +23,6 @@
import java.io.File;
import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URL;
import org.crosswire.common.util.CWClassLoader;
@@ -105,7 +104,6 @@
/**
* Establishes the user's project directory.
- * @throws MalformedURLException
*/
public URL getUserProjectDir(String hiddenFolderName, String visibleFolderName)
{
@@ -114,7 +112,6 @@
/**
* Establishes the user's project directory.
- * @throws MalformedURLException
*/
public URL getUserProjectDir()
{
@@ -132,7 +129,6 @@
* Get the location where the project dir used to be.
*
* @return ~/.jsword
- * @throws MalformedURLException
*/
public URL getDeprecatedUserProjectDir()
{
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -238,7 +238,7 @@
altBooks = new String[booksInBible][];
altBooksMap = new HashMap(booksInBible);
- ResourceBundle resources = ResourceBundle.getBundle(BibleNames.class.getName(), locale, new CWClassLoader(BibleNames.class));
+ ResourceBundle resources = ResourceBundle.getBundle(BibleNames.class.getName(), locale, CWClassLoader.instance(BibleNames.class));
for (int i = 0; i < booksInBible; i++)
{
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/OSISNames.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -123,7 +123,7 @@
osisMap = new HashMap(booksInBible);
// Get all the OSIS standard book names
- ResourceBundle resources = ResourceBundle.getBundle(OSISNames.class.getName(), OSIS_LOCALE, new CWClassLoader(OSISNames.class));
+ ResourceBundle resources = ResourceBundle.getBundle(OSISNames.class.getName(), OSIS_LOCALE, CWClassLoader.instance(OSISNames.class));
for (int i = 0; i < osisBooks.length; i++)
{
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/SectionNames.java 2006-10-14 15:18:57 UTC (rev 1159)
@@ -219,7 +219,7 @@
*/
private void initialize()
{
- ResourceBundle resources = ResourceBundle.getBundle(SectionNames.class.getName(), Locale.getDefault(), new CWClassLoader(SectionNames.class));
+ ResourceBundle resources = ResourceBundle.getBundle(SectionNames.class.getName(), Locale.getDefault(), CWClassLoader.instance(SectionNames.class));
sections = new String[SECTIONS_IN_BIBLE];
Modified: trunk/jsword-support/tools/pmd/cpdhtml.xslt
===================================================================
--- trunk/jsword-support/tools/pmd/cpdhtml.xslt 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword-support/tools/pmd/cpdhtml.xslt 2006-10-14 15:18:57 UTC (rev 1159)
@@ -64,7 +64,8 @@
<td>
<table>
<xsl:for-each select="file">
- <tr><td><a><xsl:attribute name="href">../src/<xsl:value-of select="@path"/>.html#<xsl:value-of select="@line"/></xsl:attribute><xsl:value-of select="@path"/></a></td><td> line <xsl:value-of select="@line"/></td></tr>
+ <xsl:variable name="webpath" select="substring-after(@path, substring-before(@path, '/org/'))"/>
+ <tr><td><a><xsl:attribute name="href">/jsword/java2html<xsl:value-of select="$webpath"/>.html#<xsl:value-of select="@line"/></xsl:attribute><xsl:value-of select="substring-before(translate(substring-after($webpath, '/'),'/','.'),'.java')"/></a></td><td> line <xsl:value-of select="@line"/></td></tr>
</xsl:for-each>
</table>
</td>
Modified: trunk/jsword-web/src/web/template.xsl
===================================================================
--- trunk/jsword-web/src/web/template.xsl 2006-10-13 20:48:53 UTC (rev 1158)
+++ trunk/jsword-web/src/web/template.xsl 2006-10-14 15:18:57 UTC (rev 1159)
@@ -113,7 +113,7 @@
<!-- li><a href="jcoverage">Test-Coverage</a></li -->
<li><a href="checkstyle">CheckStyle</a></li>
<li><a href="pmd">PMD Report</a></li>
- <li><a href="cpd/report.txt">CPD Report</a></li>
+ <li><a href="cpd">CPD Report</a></li>
<li><a href="findbugs">FindBugs Report</a></li>
<li><a href="jdepend/jdepend-report.html">JDepend Report</a></li>
<li><a href="javancss">NCSS Report</a></li>
More information about the jsword-svn
mailing list