[jsword-svn] r1994 - in trunk/common: .settings src/main/java/gnu/gpl src/main/java/gnu/lgpl src/main/java/org/crosswire/common/activate src/main/java/org/crosswire/common/compress src/main/java/org/crosswire/common/config src/main/java/org/crosswire/common/diff src/main/java/org/crosswire/common/icu src/main/java/org/crosswire/common/options src/main/java/org/crosswire/common/progress src/main/java/org/crosswire/common/util src/main/java/org/crosswire/common/xml src/test/java/org/crosswire/common/compress src/test/java/org/crosswire/common/diff src/test/java/org/crosswire/common/history src/test/java/org/crosswire/common/icu src/test/java/org/crosswire/common/progress src/test/java/org/crosswire/common/util src/test/java/org/crosswire/common/xml
dmsmith at crosswire.org
dmsmith at crosswire.org
Sat Oct 23 13:24:09 MST 2010
Author: dmsmith
Date: 2010-10-23 13:24:08 -0700 (Sat, 23 Oct 2010)
New Revision: 1994
Modified:
trunk/common/.settings/org.eclipse.jdt.core.prefs
trunk/common/src/main/java/gnu/gpl/License.java
trunk/common/src/main/java/gnu/gpl/UserMsg.java
trunk/common/src/main/java/gnu/lgpl/License.java
trunk/common/src/main/java/gnu/lgpl/Msg.java
trunk/common/src/main/java/org/crosswire/common/activate/Msg.java
trunk/common/src/main/java/org/crosswire/common/activate/Msg.properties
trunk/common/src/main/java/org/crosswire/common/activate/Msg_de.properties
trunk/common/src/main/java/org/crosswire/common/compress/CompressorType.java
trunk/common/src/main/java/org/crosswire/common/config/AbstractReflectedChoice.java
trunk/common/src/main/java/org/crosswire/common/config/ChoiceFactory.java
trunk/common/src/main/java/org/crosswire/common/config/ClassChoice.java
trunk/common/src/main/java/org/crosswire/common/config/Config.java
trunk/common/src/main/java/org/crosswire/common/config/FileChoice.java
trunk/common/src/main/java/org/crosswire/common/config/IntOptionsChoice.java
trunk/common/src/main/java/org/crosswire/common/config/MappedOptionsChoice.java
trunk/common/src/main/java/org/crosswire/common/config/Msg.java
trunk/common/src/main/java/org/crosswire/common/config/Msg.properties
trunk/common/src/main/java/org/crosswire/common/config/StringArrayChoice.java
trunk/common/src/main/java/org/crosswire/common/config/StringOptionsChoice.java
trunk/common/src/main/java/org/crosswire/common/diff/Bitap.java
trunk/common/src/main/java/org/crosswire/common/diff/Commonality.java
trunk/common/src/main/java/org/crosswire/common/diff/Diff.java
trunk/common/src/main/java/org/crosswire/common/diff/DiffCleanup.java
trunk/common/src/main/java/org/crosswire/common/diff/DifferenceEngine.java
trunk/common/src/main/java/org/crosswire/common/diff/Distance.java
trunk/common/src/main/java/org/crosswire/common/diff/EditType.java
trunk/common/src/main/java/org/crosswire/common/diff/LineMap.java
trunk/common/src/main/java/org/crosswire/common/diff/Match.java
trunk/common/src/main/java/org/crosswire/common/diff/Patch.java
trunk/common/src/main/java/org/crosswire/common/diff/PatchEntry.java
trunk/common/src/main/java/org/crosswire/common/icu/DateFormatter.java
trunk/common/src/main/java/org/crosswire/common/icu/NumberShaper.java
trunk/common/src/main/java/org/crosswire/common/options/ArgumentType.java
trunk/common/src/main/java/org/crosswire/common/options/DataType.java
trunk/common/src/main/java/org/crosswire/common/options/GetOptions.java
trunk/common/src/main/java/org/crosswire/common/options/OptionList.java
trunk/common/src/main/java/org/crosswire/common/progress/Job.java
trunk/common/src/main/java/org/crosswire/common/progress/JobManager.java
trunk/common/src/main/java/org/crosswire/common/progress/UserMsg.java
trunk/common/src/main/java/org/crosswire/common/progress/UserMsg.properties
trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_de.properties
trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_fa.properties
trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_in.properties
trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_vi.properties
trunk/common/src/main/java/org/crosswire/common/util/CWProject.java
trunk/common/src/main/java/org/crosswire/common/util/CallContext.java
trunk/common/src/main/java/org/crosswire/common/util/ClassUtil.java
trunk/common/src/main/java/org/crosswire/common/util/Convert.java
trunk/common/src/main/java/org/crosswire/common/util/Countries.java
trunk/common/src/main/java/org/crosswire/common/util/EventListenerList.java
trunk/common/src/main/java/org/crosswire/common/util/FileUtil.java
trunk/common/src/main/java/org/crosswire/common/util/IOUtil.java
trunk/common/src/main/java/org/crosswire/common/util/Language.java
trunk/common/src/main/java/org/crosswire/common/util/Languages.java
trunk/common/src/main/java/org/crosswire/common/util/LogConfig.java
trunk/common/src/main/java/org/crosswire/common/util/Logger.java
trunk/common/src/main/java/org/crosswire/common/util/LucidException.java
trunk/common/src/main/java/org/crosswire/common/util/LucidRuntimeException.java
trunk/common/src/main/java/org/crosswire/common/util/Msg.java
trunk/common/src/main/java/org/crosswire/common/util/Msg.properties
trunk/common/src/main/java/org/crosswire/common/util/MsgBase.java
trunk/common/src/main/java/org/crosswire/common/util/Msg_de.properties
trunk/common/src/main/java/org/crosswire/common/util/NetUtil.java
trunk/common/src/main/java/org/crosswire/common/util/OSType.java
trunk/common/src/main/java/org/crosswire/common/util/PatternFormatter.java
trunk/common/src/main/java/org/crosswire/common/util/PluginUtil.java
trunk/common/src/main/java/org/crosswire/common/util/Reporter.java
trunk/common/src/main/java/org/crosswire/common/util/StackTrace.java
trunk/common/src/main/java/org/crosswire/common/util/StringUtil.java
trunk/common/src/main/java/org/crosswire/common/util/Translations.java
trunk/common/src/main/java/org/crosswire/common/util/UserMsg.java
trunk/common/src/main/java/org/crosswire/common/util/UserMsg.properties
trunk/common/src/main/java/org/crosswire/common/util/UserMsg_de.properties
trunk/common/src/main/java/org/crosswire/common/util/WebResource.java
trunk/common/src/main/java/org/crosswire/common/xml/FormatType.java
trunk/common/src/main/java/org/crosswire/common/xml/HTMLSerializingContentHandler.java
trunk/common/src/main/java/org/crosswire/common/xml/PrettySerializingContentHandler.java
trunk/common/src/main/java/org/crosswire/common/xml/SAXEventProviderXMLReader.java
trunk/common/src/main/java/org/crosswire/common/xml/SerializingContentHandler.java
trunk/common/src/main/java/org/crosswire/common/xml/TransformingSAXEventProvider.java
trunk/common/src/main/java/org/crosswire/common/xml/XMLFeature.java
trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java
trunk/common/src/main/java/org/crosswire/common/xml/XMLHandlerAdapter.java
trunk/common/src/main/java/org/crosswire/common/xml/XMLProcess.java
trunk/common/src/main/java/org/crosswire/common/xml/XMLUtil.java
trunk/common/src/main/java/org/crosswire/common/xml/XalanProcess.java
trunk/common/src/test/java/org/crosswire/common/compress/AllTests.java
trunk/common/src/test/java/org/crosswire/common/compress/LZSSTest.java
trunk/common/src/test/java/org/crosswire/common/diff/AllTests.java
trunk/common/src/test/java/org/crosswire/common/diff/BitapTest.java
trunk/common/src/test/java/org/crosswire/common/diff/CommonalityTest.java
trunk/common/src/test/java/org/crosswire/common/diff/DiffCleanupTest.java
trunk/common/src/test/java/org/crosswire/common/diff/DiffTest.java
trunk/common/src/test/java/org/crosswire/common/diff/DifferenceEngineTest.java
trunk/common/src/test/java/org/crosswire/common/diff/DifferenceTest.java
trunk/common/src/test/java/org/crosswire/common/diff/LineMapTest.java
trunk/common/src/test/java/org/crosswire/common/diff/MatchTest.java
trunk/common/src/test/java/org/crosswire/common/diff/PatchEntryTest.java
trunk/common/src/test/java/org/crosswire/common/diff/PatchTest.java
trunk/common/src/test/java/org/crosswire/common/diff/diff_match_patch_test.java
trunk/common/src/test/java/org/crosswire/common/history/AllTests.java
trunk/common/src/test/java/org/crosswire/common/history/HistoryTest.java
trunk/common/src/test/java/org/crosswire/common/icu/AllTests.java
trunk/common/src/test/java/org/crosswire/common/icu/NumberShaperTest.java
trunk/common/src/test/java/org/crosswire/common/progress/AllTests.java
trunk/common/src/test/java/org/crosswire/common/progress/JobTest.java
trunk/common/src/test/java/org/crosswire/common/progress/WorkEventTest.java
trunk/common/src/test/java/org/crosswire/common/util/AllTests.java
trunk/common/src/test/java/org/crosswire/common/util/StringUtilTest.java
trunk/common/src/test/java/org/crosswire/common/xml/AllTests.java
trunk/common/src/test/java/org/crosswire/common/xml/XMLUtilTest.java
Log:
remove NON-NLS comments
Start a new methodology for messages. Goal is a single file per jar for translation. It will take a while.
Modified: trunk/common/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/common/.settings/org.eclipse.jdt.core.prefs 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/.settings/org.eclipse.jdt.core.prefs 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,4 +1,4 @@
-#Thu Oct 29 08:52:55 EDT 2009
+#Sun Jan 31 10:09:23 EST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -27,12 +27,16 @@
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -48,6 +52,7 @@
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
@@ -56,13 +61,18 @@
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=disabled
@@ -76,13 +86,18 @@
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.4
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
Modified: trunk/common/src/main/java/gnu/gpl/License.java
===================================================================
--- trunk/common/src/main/java/gnu/gpl/License.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/gnu/gpl/License.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -387,7 +387,10 @@
* @return the warranty for this program
*/
public String getWarranty() {
- return UserMsg.WARRANTY.toString(name);
+ /* TRANSLATOR: This is short-hand for the actual GPL warranty.
+ * See the English for this to see what needs to be translated.
+ */
+ return UserMsg.gettext("License.warranty", name);
}
/**
@@ -396,7 +399,10 @@
* @return the details of this program's distribution license
*/
public String getDetails() {
- return UserMsg.DETAILS.toString(name);
+ /* TRANSLATOR: This is short-hand for the actual GPL license.
+ * See the English for this to see what needs to be translated.
+ */
+ return UserMsg.gettext("License.details", name);
}
/**
Modified: trunk/common/src/main/java/gnu/gpl/UserMsg.java
===================================================================
--- trunk/common/src/main/java/gnu/gpl/UserMsg.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/gnu/gpl/UserMsg.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -31,13 +31,43 @@
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
public final class UserMsg extends MsgBase {
- static final UserMsg WARRANTY = new UserMsg("License.warranty"); //$NON-NLS-1$
- static final UserMsg DETAILS = new UserMsg("License.details"); //$NON-NLS-1$
/**
- * Passthrough ctor
+ * Get the internationalized text, but return key if key is unknown.
+ *
+ * @param key
+ * @return the internationalized text
*/
- private UserMsg(String name) {
- super(name);
+ public static String gettext(String key)
+ {
+ return msg.lookup(key);
}
+
+ /**
+ * Get the internationalized text, but return key if key is unknown.
+ * The text requires one parameter to be passed.
+ *
+ * @param key
+ * @param param
+ * @return the formatted, internationalized text
+ */
+ public static String gettext(String key, Object param)
+ {
+ return msg.toString(key, param);
+ }
+
+ /**
+ * Get the internationalized text, but return key if key is unknown.
+ * The text requires one parameter to be passed.
+ *
+ * @param key
+ * @param param
+ * @return the formatted, internationalized text
+ */
+ public static String gettext(String key, Object[] params)
+ {
+ return msg.toString(key, params);
+ }
+
+ private static MsgBase msg = new UserMsg();
}
Modified: trunk/common/src/main/java/gnu/lgpl/License.java
===================================================================
--- trunk/common/src/main/java/gnu/lgpl/License.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/gnu/lgpl/License.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -549,7 +549,7 @@
* @return the warranty for this program
*/
public String getWarranty() {
- return Msg.WARRANTY.toString(name);
+ return Msg.gettext("License.warranty", name);
}
/**
@@ -558,7 +558,7 @@
* @return the details of this program's distribution license
*/
public String getDetails() {
- return Msg.DETAILS.toString(name);
+ return Msg.gettext("License.details", name);
}
/**
Modified: trunk/common/src/main/java/gnu/lgpl/Msg.java
===================================================================
--- trunk/common/src/main/java/gnu/lgpl/Msg.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/gnu/lgpl/Msg.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -31,13 +31,42 @@
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
public final class Msg extends MsgBase {
- static final Msg WARRANTY = new Msg("License.warranty"); //$NON-NLS-1$
- static final Msg DETAILS = new Msg("License.details"); //$NON-NLS-1$
+ /**
+ * Get the internationalized text, but return key if key is unknown.
+ *
+ * @param key
+ * @return the internationalized text
+ */
+ public static String gettext(String key)
+ {
+ return msg.lookup(key);
+ }
/**
- * Passthrough ctor
+ * Get the internationalized text, but return key if key is unknown.
+ * The text requires one parameter to be passed.
+ *
+ * @param key
+ * @param param
+ * @return the formatted, internationalized text
*/
- private Msg(String name) {
- super(name);
+ public static String gettext(String key, Object param)
+ {
+ return msg.toString(key, param);
}
+
+ /**
+ * Get the internationalized text, but return key if key is unknown.
+ * The text requires one parameter to be passed.
+ *
+ * @param key
+ * @param param
+ * @return the formatted, internationalized text
+ */
+ public static String gettext(String key, Object[] params)
+ {
+ return msg.toString(key, params);
+ }
+
+ private static MsgBase msg = new Msg();
}
Modified: trunk/common/src/main/java/org/crosswire/common/activate/Msg.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/activate/Msg.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/activate/Msg.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -31,7 +31,7 @@
* @author Joe Walker [joe at eireneh dot com]
*/
public final class Msg extends MsgBase {
- static final Msg NOT_IMPLEMENTED = new Msg("Activator.NotImplemented"); //$NON-NLS-1$
+ static final Msg NOT_IMPLEMENTED = new Msg("Not implemented");
/**
* Passthrough ctor
Modified: trunk/common/src/main/java/org/crosswire/common/activate/Msg.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/activate/Msg.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/activate/Msg.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,8 +1,2 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
-Activator.NotImplemented=Not Implemented
+Not\ implemented = Not implemented
Modified: trunk/common/src/main/java/org/crosswire/common/activate/Msg_de.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/activate/Msg_de.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/activate/Msg_de.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,9 +1,2 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
-Activator.NotImplemented=Nicht implementiert
-
+Not\ implemented = Nicht implementiert
Modified: trunk/common/src/main/java/org/crosswire/common/compress/CompressorType.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/compress/CompressorType.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/compress/CompressorType.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -35,7 +35,7 @@
/**
* Delete a sequence.
*/
- public static final CompressorType ZIP = new CompressorType("ZIP") { //$NON-NLS-1$
+ public static final CompressorType ZIP = new CompressorType("ZIP") {
/*
* (non-Javadoc)
@@ -56,7 +56,7 @@
/**
* Insert a sequence
*/
- public static final CompressorType LZSS = new CompressorType("LZSS") { //$NON-NLS-1$
+ public static final CompressorType LZSS = new CompressorType("LZSS") {
/*
* (non-Javadoc)
Modified: trunk/common/src/main/java/org/crosswire/common/config/AbstractReflectedChoice.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/AbstractReflectedChoice.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/AbstractReflectedChoice.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -48,12 +48,12 @@
public void init(Element option, ResourceBundle configResources) throws StartupException {
assert configResources != null;
- key = option.getAttributeValue("key"); //$NON-NLS-1$
+ key = option.getAttributeValue("key");
// Hidden is an optional field so it is ok for the resource to be
// missing.
try {
- String hiddenState = configResources.getString(key + ".hidden"); //$NON-NLS-1$
+ String hiddenState = configResources.getString(key + ".hidden");
hidden = Boolean.valueOf(hiddenState).booleanValue();
} catch (MissingResourceException e) {
hidden = false;
@@ -62,7 +62,7 @@
// Ignore is an optional field so it is ok for the resource to be
// missing.
try {
- String ignoreState = configResources.getString(key + ".ignore"); //$NON-NLS-1$
+ String ignoreState = configResources.getString(key + ".ignore");
ignored = Boolean.valueOf(ignoreState).booleanValue();
if (ignored) {
hidden = true;
@@ -72,7 +72,7 @@
ignored = false;
}
- String helpText = configResources.getString(key + ".help"); //$NON-NLS-1$
+ String helpText = configResources.getString(key + ".help");
assert helpText != null;
setHelpText(helpText);
@@ -86,36 +86,36 @@
path.append('.');
}
parentKey.append(pathParts[i]);
- String parent = configResources.getString(parentKey + ".name"); //$NON-NLS-1$
+ String parent = configResources.getString(parentKey + ".name");
assert parent != null;
path.append(parent);
}
setFullPath(path.toString());
- external = Boolean.valueOf(option.getAttributeValue("external")).booleanValue(); //$NON-NLS-1$
+ external = Boolean.valueOf(option.getAttributeValue("external")).booleanValue();
- restart = Boolean.valueOf(option.getAttributeValue("restart")).booleanValue(); //$NON-NLS-1$
+ restart = Boolean.valueOf(option.getAttributeValue("restart")).booleanValue();
- type = option.getAttributeValue("type"); //$NON-NLS-1$
+ type = option.getAttributeValue("type");
// The important 3 things saying what we update and how we describe
// ourselves
- Element introspector = option.getChild("introspect"); //$NON-NLS-1$
+ Element introspector = option.getChild("introspect");
if (introspector == null) {
throw new StartupException(Msg.CONFIG_MISSINGELE, new Object[] {
- "introspect"}); //$NON-NLS-1$
+ "introspect"});
}
- String clazzname = introspector.getAttributeValue("class"); //$NON-NLS-1$
+ String clazzname = introspector.getAttributeValue("class");
if (clazzname == null) {
throw new StartupException(Msg.CONFIG_MISSINGELE, new Object[] {
- "class"}); //$NON-NLS-1$
+ "class"});
}
- propertyname = introspector.getAttributeValue("property"); //$NON-NLS-1$
+ propertyname = introspector.getAttributeValue("property");
if (propertyname == null) {
throw new StartupException(Msg.CONFIG_MISSINGELE, new Object[] {
- "property"}); //$NON-NLS-1$
+ "property"});
}
// log.debug("Looking up " + clazzname + ".set" + propertyname + "(" +
@@ -131,7 +131,7 @@
}
try {
- setter = clazz.getMethod("set" + propertyname, new Class[] { getConversionClass()}); //$NON-NLS-1$
+ setter = clazz.getMethod("set" + propertyname, new Class[] { getConversionClass()});
} catch (NoSuchMethodException ex) {
throw new StartupException(Msg.CONFIG_NOSETTER, ex, new Object[] {
clazz.getName(), propertyname, getConversionClass().getName()
@@ -140,9 +140,9 @@
try {
try {
- getter = clazz.getMethod("is" + propertyname, new Class[0]); //$NON-NLS-1$
+ getter = clazz.getMethod("is" + propertyname, new Class[0]);
} catch (NoSuchMethodException e) {
- getter = clazz.getMethod("get" + propertyname, new Class[0]); //$NON-NLS-1$
+ getter = clazz.getMethod("get" + propertyname, new Class[0]);
}
} catch (NoSuchMethodException ex) {
throw new StartupException(Msg.CONFIG_NOGETTER, ex, new Object[] {
@@ -152,7 +152,7 @@
if (getter.getReturnType() != getConversionClass()) {
log
- .debug("Not using " + propertyname + " from " + clazz.getName() + " because the return type of the getter is not " + getConversionClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ .debug("Not using " + propertyname + " from " + clazz.getName() + " because the return type of the getter is not " + getConversionClass().getName());
throw new StartupException(Msg.CONFIG_NORETURN, new Object[] {
getter.getReturnType(), getConversionClass()
});
@@ -269,11 +269,11 @@
Object retval = getter.invoke(null, new Object[0]);
return convertToString(retval);
} catch (IllegalAccessException ex) {
- log.error("Illegal access getting value from " + clazz.getName() + "." + getter.getName(), ex); //$NON-NLS-1$ //$NON-NLS-2$
- return ""; //$NON-NLS-1$
+ log.error("Illegal access getting value from " + clazz.getName() + "." + getter.getName(), ex);
+ return "";
} catch (InvocationTargetException ex) {
- log.error("Failed to get value from " + clazz.getName() + "." + getter.getName(), ex); //$NON-NLS-1$ //$NON-NLS-2$
- return ""; //$NON-NLS-1$
+ log.error("Failed to get value from " + clazz.getName() + "." + getter.getName(), ex);
+ return "";
}
}
@@ -302,7 +302,7 @@
}
if (ex != null) {
- log.info("Exception while attempting to execute: " + setter.toString()); //$NON-NLS-1$
+ log.info("Exception while attempting to execute: " + setter.toString());
// So we can't re-throw the original exception because it wasn't an
// Exception so we will have to re-throw the
Modified: trunk/common/src/main/java/org/crosswire/common/config/ChoiceFactory.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/ChoiceFactory.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/ChoiceFactory.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -55,9 +55,9 @@
{
Class clazz = null;
- String type = option.getAttributeValue("type"); //$NON-NLS-1$
- if ("custom".equals(type)) { //$NON-NLS-1$
- String clazzstr = option.getAttributeValue("class"); //$NON-NLS-1$
+ String type = option.getAttributeValue("type");
+ if ("custom".equals(type)) {
+ String clazzstr = option.getAttributeValue("class");
clazz = ClassUtil.forName(clazzstr);
} else {
clazz = (Class) map.get(type);
Modified: trunk/common/src/main/java/org/crosswire/common/config/ClassChoice.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/ClassChoice.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/ClassChoice.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -69,7 +69,7 @@
try {
return ClassUtil.forName(orig);
} catch (ClassNotFoundException ex) {
- log.warn("Class not found: " + orig, ex); //$NON-NLS-1$
+ log.warn("Class not found: " + orig, ex);
return null;
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/config/Config.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/Config.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/Config.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -117,8 +117,8 @@
String value = model.getString();
if (value == null) {
- value = ""; //$NON-NLS-1$
- log.info("key=" + key + " had a null value"); //$NON-NLS-1$//$NON-NLS-2$
+ value = "";
+ log.info("key=" + key + " had a null value");
}
local.put(key, value);
@@ -141,7 +141,7 @@
Iterator iter = root.getChildren().iterator();
while (iter.hasNext()) {
Element element = (Element) iter.next();
- String key = element.getAttributeValue("key"); //$NON-NLS-1$
+ String key = element.getAttributeValue("key");
Exception ex = null;
try {
@@ -160,7 +160,7 @@
}
if (ex != null) {
- log.warn("Error creating config element, key=" + key, ex); //$NON-NLS-1$
+ log.warn("Error creating config element, key=" + key, ex);
}
}
}
@@ -272,14 +272,14 @@
// 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$
+ log.info("Setting " + key + "=" + newValue + " (was " + oldValue + ")");
try {
choice.setString(newValue);
if (changeListeners != null) {
changeListeners.firePropertyChange(new PropertyChangeEvent(choice, choice.getKey(), oldValue, newValue));
}
} catch (LucidException ex) {
- log.warn("Failure setting " + key + "=" + newValue, ex); //$NON-NLS-1$ //$NON-NLS-2$
+ log.warn("Failure setting " + key + "=" + newValue, ex);
Reporter.informUser(this, new ConfigException(Msg.CONFIG_SETFAIL, ex, new Object[] {
choice.getFullPath()
}));
@@ -353,7 +353,7 @@
public static String getPath(String key) {
int lastDot = key.lastIndexOf('.');
if (lastDot == -1) {
- throw new IllegalArgumentException("key=" + key + " does not contain a dot."); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new IllegalArgumentException("key=" + key + " does not contain a dot.");
}
return key.substring(0, lastDot);
@@ -365,7 +365,7 @@
public static String getLeaf(String key) {
int lastDot = key.lastIndexOf('.');
if (lastDot == -1) {
- throw new IllegalArgumentException("key=" + key + " does not contain a dot."); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new IllegalArgumentException("key=" + key + " does not contain a dot.");
}
return key.substring(lastDot + 1);
Modified: trunk/common/src/main/java/org/crosswire/common/config/FileChoice.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/FileChoice.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/FileChoice.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -50,7 +50,7 @@
/* @Override */
public String convertToString(Object orig) {
if (orig == null) {
- return ""; //$NON-NLS-1$
+ return "";
}
return ((File) orig).getAbsolutePath();
Modified: trunk/common/src/main/java/org/crosswire/common/config/IntOptionsChoice.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/IntOptionsChoice.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/IntOptionsChoice.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -48,13 +48,13 @@
super.init(option, configResources);
- String prefix = getKey() + ".alternative."; //$NON-NLS-1$
+ String prefix = getKey() + ".alternative.";
options = new TreeMap();
- Iterator iter = option.getChildren("alternative").iterator(); //$NON-NLS-1$
+ Iterator iter = option.getChildren("alternative").iterator();
while (iter.hasNext()) {
Element alternative = (Element) iter.next();
- int number = Integer.parseInt(alternative.getAttributeValue("number")); //$NON-NLS-1$
+ int number = Integer.parseInt(alternative.getAttributeValue("number"));
String name = configResources.getString(prefix + number);
options.put(new Integer(number), name);
}
Modified: trunk/common/src/main/java/org/crosswire/common/config/MappedOptionsChoice.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/MappedOptionsChoice.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/MappedOptionsChoice.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -48,12 +48,12 @@
assert configResources != null;
super.init(option, configResources);
- Element mapElement = option.getChild("map"); //$NON-NLS-1$
+ Element mapElement = option.getChild("map");
if (mapElement == null) {
throw new StartupException(Msg.CONFIG_NOMAP);
}
- String name = mapElement.getAttributeValue("name"); //$NON-NLS-1$
+ String name = mapElement.getAttributeValue("name");
Object map = ChoiceFactory.getDataMap().get(name);
if (map instanceof Map) {
options = (Map) map;
@@ -89,7 +89,7 @@
*/
/* @Override */
public String convertToString(Object orig) {
- return orig != null ? orig.toString() : ""; //$NON-NLS-1$
+ return orig != null ? orig.toString() : "";
}
/*
@@ -110,7 +110,7 @@
}
}
logger.warn(Msg.IGNORE.toString(orig));
- return ""; //$NON-NLS-1$
+ return "";
}
private static Logger logger = Logger.getLogger(MappedOptionsChoice.class);
Modified: trunk/common/src/main/java/org/crosswire/common/config/Msg.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/Msg.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/Msg.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -31,14 +31,14 @@
* @author Joe Walker [joe at eireneh dot com]
*/
public final class Msg extends MsgBase {
- static final Msg CONFIG_NOCLASS = new Msg("AbstractReflectedChoice.ConfigNoClass"); //$NON-NLS-1$
- static final Msg CONFIG_MISSINGELE = new Msg("AbstractReflectedChoice.ConfigMissingEle"); //$NON-NLS-1$
- static final Msg CONFIG_NOSETTER = new Msg("AbstractReflectedChoice.ConfigNoSetter"); //$NON-NLS-1$
- static final Msg CONFIG_NOGETTER = new Msg("AbstractReflectedChoice.ConfigNoGetter"); //$NON-NLS-1$
- static final Msg CONFIG_NORETURN = new Msg("AbstractReflectedChoice.ConfigNoReturn"); //$NON-NLS-1$
- static final Msg CONFIG_NOMAP = new Msg("StringOptionsChoice.ConfigNoMap"); //$NON-NLS-1$
- static final Msg IGNORE = new Msg("IntOptionsChoice.Ignore"); //$NON-NLS-1$
- static final Msg CONFIG_SETFAIL = new Msg("Config.SetFail"); //$NON-NLS-1$
+ static final Msg CONFIG_NOCLASS = new Msg("Specified class not found: {0}");
+ static final Msg CONFIG_MISSINGELE = new Msg("Missing {0} element in config.xml");
+ static final Msg CONFIG_NOSETTER = new Msg("Specified method not found {0}.set{1}({2} arg0)");
+ static final Msg CONFIG_NOGETTER = new Msg("Specified method not found {0}.get{1}()");
+ static final Msg CONFIG_NORETURN = new Msg("Mismatch of return types, found: {0} required: {1}");
+ static final Msg CONFIG_NOMAP = new Msg("Missing <map> element.");
+ static final Msg IGNORE = new Msg("Ignoring invalid option: {0}");
+ static final Msg CONFIG_SETFAIL = new Msg("Failed to set option: {0}");
/**
* Passthrough ctor
Modified: trunk/common/src/main/java/org/crosswire/common/config/Msg.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/Msg.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/Msg.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,15 +1,15 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
-AbstractReflectedChoice.ConfigNoClass=Specified class not found: {0}
-AbstractReflectedChoice.ConfigMissingEle=Missing {0} element in config.xml
-AbstractReflectedChoice.ConfigNoSetter=Specified method not found {0}.set{1}({2} arg0)
-AbstractReflectedChoice.ConfigNoGetter=Specified method not found {0}.get{1}()
-AbstractReflectedChoice.ConfigNoReturn=Mismatch of return types, found: {0} required: {1}
-StringOptionsChoice.ConfigNoMap=Missing <map> element.
-IntOptionsChoice.Ignore=Ignoring invalid option: {0}
-Config.SetFail=Failed to set option: {0}
+Failed\ to\ set\ option\:\ {0} = Failed to set option: {0}
+
+Ignoring\ invalid\ option\:\ {0} = Ignoring invalid option: {0}
+
+Mismatch\ of\ return\ types,\ found\:\ {0}\ required\:\ {1} = Mismatch of return types, found: {0} required: {1}
+
+Missing\ <map>\ element. = Missing <map> element.
+
+Missing\ {0}\ element\ in\ config.xml = Missing {0} element in config.xml
+
+Specified\ class\ not\ found\:\ {0} = Specified class not found: {0}
+
+Specified\ method\ not\ found\ {0}.get{1}() = Specified method not found {0}.get{1}()
+Specified\ method\ not\ found\ {0}.set{1}({2}\ arg0) = Specified method not found {0}.set{1}({2} arg0)
Modified: trunk/common/src/main/java/org/crosswire/common/config/StringArrayChoice.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/StringArrayChoice.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/StringArrayChoice.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -42,7 +42,7 @@
/* @Override */
public void init(Element option, ResourceBundle configResources) throws StartupException {
super.init(option, configResources);
- separator = option.getAttributeValue("separator"); //$NON-NLS-1$
+ separator = option.getAttributeValue("separator");
}
/*
@@ -78,5 +78,5 @@
return Convert.string2StringArray(orig, separator);
}
- private String separator = " "; //$NON-NLS-1$
+ private String separator = " ";
}
Modified: trunk/common/src/main/java/org/crosswire/common/config/StringOptionsChoice.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/StringOptionsChoice.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/config/StringOptionsChoice.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -41,12 +41,12 @@
/* @Override */
public void init(Element option, ResourceBundle configResources) throws StartupException {
super.init(option, configResources);
- Element map = option.getChild("map"); //$NON-NLS-1$
+ Element map = option.getChild("map");
if (map == null) {
throw new StartupException(Msg.CONFIG_NOMAP);
}
- String name = map.getAttributeValue("name"); //$NON-NLS-1$
+ String name = map.getAttributeValue("name");
array = (String[]) ChoiceFactory.getDataMap().get(name);
}
Modified: trunk/common/src/main/java/org/crosswire/common/diff/Bitap.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/Bitap.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/Bitap.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -198,7 +198,7 @@
protected void alphabet() {
int len = pattern.length();
- assert len <= Bitap.MAXBITS : "Pattern too long for this application."; //$NON-NLS-1$
+ assert len <= Bitap.MAXBITS : "Pattern too long for this application.";
for (int i = 0; i < len; i++) {
Character c = new Character(pattern.charAt(i));
Modified: trunk/common/src/main/java/org/crosswire/common/diff/Commonality.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/Commonality.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/Commonality.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -160,11 +160,11 @@
// Start with a 1/4 length substring at position i as a seed.
String seed = longText.substring(startIndex, startIndex + (longText.length() / 4));
int j = -1;
- String common = ""; //$NON-NLS-1$
- String longTextPrefix = ""; //$NON-NLS-1$
- String longTextSuffix = ""; //$NON-NLS-1$
- String shortTextPrefix = ""; //$NON-NLS-1$
- String shortTextSuffix = ""; //$NON-NLS-1$
+ String common = "";
+ String longTextPrefix = "";
+ String longTextSuffix = "";
+ String shortTextPrefix = "";
+ String shortTextSuffix = "";
while ((j = shortText.indexOf(seed, j + 1)) != -1) {
int prefixLength = Commonality.prefix(longText.substring(startIndex), shortText.substring(j));
int suffixLength = Commonality.suffix(longText.substring(0, startIndex), shortText.substring(0, j));
Modified: trunk/common/src/main/java/org/crosswire/common/diff/Diff.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/Diff.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/Diff.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -103,11 +103,11 @@
diffs = compute();
// Restore the prefix and suffix
- if (!"".equals(commonPrefix)) { //$NON-NLS-1$
+ if (!"".equals(commonPrefix)) {
diffs.add(0, new Difference(EditType.EQUAL, commonPrefix));
}
- if (!"".equals(commonSuffix)) { //$NON-NLS-1$
+ if (!"".equals(commonSuffix)) {
diffs.add(new Difference(EditType.EQUAL, commonSuffix));
}
@@ -124,13 +124,13 @@
private List compute() {
List diffs = new ArrayList();
- if ("".equals(source)) { //$NON-NLS-1$
+ if ("".equals(source)) {
// Just add some text (speedup)
diffs.add(new Difference(EditType.INSERT, target));
return diffs;
}
- if ("".equals(target)) { //$NON-NLS-1$
+ if ("".equals(target)) {
// Just delete some text (speedup)
diffs.add(new Difference(EditType.DELETE, source));
return diffs;
@@ -192,7 +192,7 @@
// Rediff any replacement blocks, this time character-by-character.
// Add a dummy entry at the end.
- diffs.add(new Difference(EditType.EQUAL, "")); //$NON-NLS-1$
+ diffs.add(new Difference(EditType.EQUAL, ""));
int countDeletes = 0;
int countInserts = 0;
StringBuffer textDelete = new StringBuffer();
@@ -304,17 +304,17 @@
// text = text.replace(/>/g, ">");
// text = text.replace(/\n/g, "¶<BR>");
if (EditType.DELETE.equals(editType)) {
- buf.append("<del style=\"background:#FFE6E6;\">"); //$NON-NLS-1$
+ buf.append("<del style=\"background:#FFE6E6;\">");
buf.append(text);
- buf.append("</del>"); //$NON-NLS-1$
+ buf.append("</del>");
} else if (EditType.INSERT.equals(editType)) {
- buf.append("<ins style=\"background:#E6FFE6;\">"); //$NON-NLS-1$
+ buf.append("<ins style=\"background:#E6FFE6;\">");
buf.append(text);
- buf.append("</ins>"); //$NON-NLS-1$
+ buf.append("</ins>");
} else {
- buf.append("<span>"); //$NON-NLS-1$
+ buf.append("<span>");
buf.append(text);
- buf.append("</span>"); //$NON-NLS-1$
+ buf.append("</span>");
}
}
return buf.toString();
Modified: trunk/common/src/main/java/org/crosswire/common/diff/DiffCleanup.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/DiffCleanup.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/DiffCleanup.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -253,7 +253,7 @@
*/
public static void cleanupMerge(final List diffs) {
// Add a dummy entry at the end.
- diffs.add(new Difference(EditType.EQUAL, "")); //$NON-NLS-1$
+ diffs.add(new Difference(EditType.EQUAL, ""));
int countDelete = 0;
int countInsert = 0;
@@ -295,7 +295,7 @@
if (commonLength > 0) {
if (pointer.hasPrevious()) {
curDiff = (Difference) pointer.previous();
- assert EditType.EQUAL.equals(curDiff.getEditType()) : "Previous diff should have been an equality."; //$NON-NLS-1$
+ assert EditType.EQUAL.equals(curDiff.getEditType()) : "Previous diff should have been an equality.";
curDiff.appendText(textInsert.substring(0, commonLength));
pointer.next();
} else {
Modified: trunk/common/src/main/java/org/crosswire/common/diff/DifferenceEngine.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/DifferenceEngine.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/DifferenceEngine.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -46,7 +46,7 @@
* Empty Difference Engine, which won't find anything.
*/
public DifferenceEngine() {
- this("", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ this("", "");
}
/**
@@ -120,7 +120,7 @@
x = kMinus1Value.intValue() + 1;
}
y = x - k;
- footstep = x + "," + y; //$NON-NLS-1$
+ footstep = x + "," + y;
if (front && (footsteps.containsKey(footstep))) {
done = true;
}
@@ -130,7 +130,7 @@
while (!done && x < source.length() && y < target.length() && source.charAt(x) == target.charAt(y)) {
x++;
y++;
- footstep = x + "," + y; //$NON-NLS-1$
+ footstep = x + "," + y;
if (front && footsteps.containsKey(footstep)) {
done = true;
}
@@ -140,7 +140,7 @@
}
v1.put(new Integer(k), new Integer(x));
Set s = (Set) vMap1.get(d);
- s.add(x + "," + y); //$NON-NLS-1$
+ s.add(x + "," + y);
if (done) {
// Front path ran over reverse path.
Integer footstepValue = (Integer) footsteps.get(footstep);
@@ -164,7 +164,7 @@
x = kMinus1Value.intValue() + 1;
}
y = x - k;
- footstep = (source.length() - x) + "," + (target.length() - y); //$NON-NLS-1$
+ footstep = (source.length() - x) + "," + (target.length() - y);
if (!front && (footsteps.containsKey(footstep))) {
done = true;
}
@@ -174,7 +174,7 @@
while (!done && x < source.length() && y < target.length() && source.charAt(source.length() - x - 1) == target.charAt(target.length() - y - 1)) {
x++;
y++;
- footstep = (source.length() - x) + "," + (target.length() - y); //$NON-NLS-1$
+ footstep = (source.length() - x) + "," + (target.length() - y);
if (!front && (footsteps.containsKey(footstep))) {
done = true;
}
@@ -185,7 +185,7 @@
v2.put(new Integer(k), new Integer(x));
Set s = (Set) vMap2.get(d);
- s.add(x + "," + y); //$NON-NLS-1$
+ s.add(x + "," + y);
if (done) {
// Reverse path ran over front path.
Integer footstepValue = (Integer) footsteps.get(footstep);
@@ -220,7 +220,7 @@
for (int d = vMap.size() - 2; d >= 0; d--) {
while (true) {
Set set = (Set) vMap.get(d);
- if (set.contains((x - 1) + "," + y)) { //$NON-NLS-1$
+ if (set.contains((x - 1) + "," + y)) {
x--;
if (EditType.DELETE.equals(lastEditType)) {
Difference firstDiff = (Difference) path.get(0);
@@ -230,7 +230,7 @@
}
lastEditType = EditType.DELETE;
break;
- } else if (set.contains(x + "," + (y - 1))) { //$NON-NLS-1$
+ } else if (set.contains(x + "," + (y - 1))) {
y--;
if (EditType.INSERT.equals(lastEditType)) {
Difference firstDiff = (Difference) path.get(0);
@@ -243,7 +243,7 @@
} else {
x--;
y--;
- assert newSource.charAt(x) == newTarget.charAt(y) : "No diagonal. Can't happen. (path1)"; //$NON-NLS-1$
+ assert newSource.charAt(x) == newTarget.charAt(y) : "No diagonal. Can't happen. (path1)";
if (EditType.EQUAL.equals(lastEditType)) {
Difference firstDiff = (Difference) path.get(0);
firstDiff.prependText(newSource.charAt(x));
@@ -276,7 +276,7 @@
for (int d = vMap.size() - 2; d >= 0; d--) {
while (true) {
Set set = (Set) vMap.get(d);
- if (set.contains((x - 1) + "," + y)) { //$NON-NLS-1$
+ if (set.contains((x - 1) + "," + y)) {
x--;
if (EditType.DELETE.equals(lastEditType)) {
Difference lastDiff = (Difference) path.get(path.size() - 1);
@@ -286,7 +286,7 @@
}
lastEditType = EditType.DELETE;
break;
- } else if (set.contains(x + "," + (y - 1))) { //$NON-NLS-1$
+ } else if (set.contains(x + "," + (y - 1))) {
y--;
if (EditType.INSERT.equals(lastEditType)) {
Difference lastDiff = (Difference) path.get(path.size() - 1);
@@ -299,7 +299,7 @@
} else {
x--;
y--;
- assert newSource.charAt(newSource.length() - x - 1) == newTarget.charAt(newTarget.length() - y - 1) : "No diagonal. Can't happen. (path2)"; //$NON-NLS-1$
+ assert newSource.charAt(newSource.length() - x - 1) == newTarget.charAt(newTarget.length() - y - 1) : "No diagonal. Can't happen. (path2)";
if (EditType.EQUAL.equals(lastEditType)) {
Difference lastDiff = (Difference) path.get(path.size() - 1);
Modified: trunk/common/src/main/java/org/crosswire/common/diff/Distance.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/Distance.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/Distance.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -50,7 +50,7 @@
*/
public static int getLevenshteinDistance(String source, String target) {
if (source == null || target == null) {
- throw new IllegalArgumentException("Strings must not be null"); //$NON-NLS-1$
+ throw new IllegalArgumentException("Strings must not be null");
}
/*
Modified: trunk/common/src/main/java/org/crosswire/common/diff/EditType.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/EditType.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/EditType.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -34,17 +34,17 @@
/**
* Delete a sequence.
*/
- public static final EditType DELETE = new EditType("Delete", '-'); //$NON-NLS-1$
+ public static final EditType DELETE = new EditType("Delete", '-');
/**
* Insert a sequence
*/
- public static final EditType INSERT = new EditType("Insert", '+'); //$NON-NLS-1$
+ public static final EditType INSERT = new EditType("Insert", '+');
/**
* Equal sequences
*/
- public static final EditType EQUAL = new EditType("Equal", ' '); //$NON-NLS-1$
+ public static final EditType EQUAL = new EditType("Equal", ' ');
/**
* @param name
Modified: trunk/common/src/main/java/org/crosswire/common/diff/LineMap.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/LineMap.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/LineMap.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -53,7 +53,7 @@
// "\x00" is a valid character, but various debuggers don't like it.
// So we'll insert a junk entry to avoid generating a null character.
lines = new ArrayList();
- lines.add(""); //$NON-NLS-1$
+ lines.add("");
Map linehash = new HashMap();
sourceMap = linesToCharsMunge(source, lines, linehash);
Modified: trunk/common/src/main/java/org/crosswire/common/diff/Match.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/Match.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/Match.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -34,7 +34,7 @@
*/
public class Match implements Locator {
public Match() {
- this("", "", 0); //$NON-NLS-1$ //$NON-NLS-2$
+ this("", "", 0);
}
/**
Modified: trunk/common/src/main/java/org/crosswire/common/diff/Patch.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/Patch.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/Patch.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -199,8 +199,8 @@
int delta = 0;
int expectedLoc = 0;
int startLoc = -1;
- String text1 = ""; //$NON-NLS-1$
- String text2 = ""; //$NON-NLS-1$
+ String text1 = "";
+ String text2 = "";
List diffs;
int index1 = 0;
int index2 = 0;
@@ -279,7 +279,7 @@
int patchSize = maxPatternLength;
int start1 = bigPatch.getSourceStart();
int start2 = bigPatch.getTargetStart();
- String preContext = ""; //$NON-NLS-1$
+ String preContext = "";
while (bigPatch.hasDifferences()) {
// Create one of several smaller patches.
PatchEntry patch = new PatchEntry();
@@ -441,7 +441,7 @@
// Ideally we'd like to have the @@ be merely a look-ahead, but it doesn't
// work that way with split.
- private static Pattern patchBoundaryPattern = Pattern.compile("\n@@"); //$NON-NLS-1$
+ private static Pattern patchBoundaryPattern = Pattern.compile("\n@@");
private List patches;
private int margin;
Modified: trunk/common/src/main/java/org/crosswire/common/diff/PatchEntry.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/diff/PatchEntry.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/diff/PatchEntry.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -154,11 +154,11 @@
// Indices are printed as 1-based, not 0-based.
public String toString() {
StringBuffer txt = new StringBuffer();
- txt.append("@@ -"); //$NON-NLS-1$
+ txt.append("@@ -");
txt.append(getCoordinates(sourceStart, sourceLength));
- txt.append(" +"); //$NON-NLS-1$
+ txt.append(" +");
txt.append(getCoordinates(targetStart, targetLength));
- txt.append(" @@\n"); //$NON-NLS-1$
+ txt.append(" @@\n");
Iterator iter = diffs.iterator();
while (iter.hasNext()) {
@@ -191,11 +191,11 @@
diffs.clear();
String[] text = newlinePattern.split(input);
char sign = '\0';
- String line = ""; //$NON-NLS-1$
+ String line = "";
Matcher matcher = patchPattern.matcher(text[0]);
matcher.matches();
- assert matcher.groupCount() == 4 : "Invalid patch string:\n" + text[0]; //$NON-NLS-1$
+ assert matcher.groupCount() == 4 : "Invalid patch string:\n" + text[0];
// m = text[0].match(/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/);
sourceStart = Integer.parseInt(matcher.group(1));
@@ -360,7 +360,7 @@
if (length == 0) {
buf.append(start);
- buf.append(",0"); //$NON-NLS-1$
+ buf.append(",0");
} else if (length == 1) {
buf.append(sourceStart + 1);
} else {
@@ -388,10 +388,10 @@
char c = str.charAt(i);
switch (c) {
case '%':
- buf.append("%25"); //$NON-NLS-1$
+ buf.append("%25");
break;
case '\n':
- buf.append("%0A"); //$NON-NLS-1$
+ buf.append("%0A");
break;
default:
buf.append(c);
@@ -414,7 +414,7 @@
for (i = 0; i < strlen; i++) {
char c = str.charAt(i);
if (c == '%') {
- if ("%0A".equals(str.substring(i, i + 3))) { //$NON-NLS-1$
+ if ("%0A".equals(str.substring(i, i + 3))) {
buf.append('\n');
} else { // if ("%25".equals(str.substring(i, i + 3))
buf.append('%');
@@ -432,8 +432,8 @@
*/
private static final int MARGIN = 4;
private static int margin = MARGIN;
- private static Pattern newlinePattern = Pattern.compile("\n"); //$NON-NLS-1$
- private static Pattern patchPattern = Pattern.compile("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$"); //$NON-NLS-1$
+ private static Pattern newlinePattern = Pattern.compile("\n");
+ private static Pattern patchPattern = Pattern.compile("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$");
private List diffs;
private int sourceStart;
Modified: trunk/common/src/main/java/org/crosswire/common/icu/DateFormatter.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/icu/DateFormatter.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/icu/DateFormatter.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -56,7 +56,7 @@
DateFormatter fmt = new DateFormatter();
boolean oops = false;
try {
- fmt.formatterClass = ClassUtil.forName("com.ibm.icu.text.DateFormat"); //$NON-NLS-1$
+ fmt.formatterClass = ClassUtil.forName("com.ibm.icu.text.DateFormat");
// To call a method taking a type of int, the type has to match but
// the object has to be wrapped
Class[] instanceTypes = {
@@ -65,7 +65,7 @@
Object[] instanceParams = {
new Integer(format)
};
- fmt.formatter = ReflectionUtil.invoke(fmt.formatterClass, fmt.formatterClass, "getDateInstance", instanceParams, instanceTypes); //$NON-NLS-1$
+ fmt.formatter = ReflectionUtil.invoke(fmt.formatterClass, fmt.formatterClass, "getDateInstance", instanceParams, instanceTypes);
} catch (NoSuchMethodException e) {
oops = true;
} catch (IllegalAccessException e) {
@@ -102,11 +102,11 @@
DateFormatter fmt = new DateFormatter();
boolean oops = false;
try {
- fmt.formatterClass = ClassUtil.forName("com.ibm.icu.text.SimpleDateFormat"); //$NON-NLS-1$
+ fmt.formatterClass = ClassUtil.forName("com.ibm.icu.text.SimpleDateFormat");
Object[] instanceParams = {
format
};
- fmt.formatter = ReflectionUtil.construct("com.ibm.icu.text.SimpleDateFormat", instanceParams); //$NON-NLS-1$
+ fmt.formatter = ReflectionUtil.construct("com.ibm.icu.text.SimpleDateFormat", instanceParams);
} catch (NoSuchMethodException e) {
oops = true;
} catch (IllegalAccessException e) {
@@ -140,7 +140,7 @@
Object[] lenientParams = {
Boolean.valueOf(lenient)
};
- ReflectionUtil.invoke(formatterClass, formatter, "setLenient", lenientParams, lenientTypes); //$NON-NLS-1$
+ ReflectionUtil.invoke(formatterClass, formatter, "setLenient", lenientParams, lenientTypes);
} catch (NoSuchMethodException e) {
assert false : e;
} catch (IllegalAccessException e) {
@@ -160,10 +160,10 @@
Object[] formatParams = {
date
};
- return (String) ReflectionUtil.invoke(formatterClass, formatter, "format", formatParams); //$NON-NLS-1$
+ return (String) ReflectionUtil.invoke(formatterClass, formatter, "format", formatParams);
} catch (Exception e) {
assert false : e;
- return ""; //$NON-NLS-1$
+ return "";
}
}
@@ -177,7 +177,7 @@
Object[] parseParams = {
text
};
- return (Date) ReflectionUtil.invoke(formatterClass, formatter, "parse", parseParams); //$NON-NLS-1$
+ return (Date) ReflectionUtil.invoke(formatterClass, formatter, "parse", parseParams);
} catch (Exception e) {
if (e instanceof ParseException) {
throw (ParseException) e;
Modified: trunk/common/src/main/java/org/crosswire/common/icu/NumberShaper.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/icu/NumberShaper.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/icu/NumberShaper.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -284,9 +284,9 @@
private char getNine() {
if (nineShape == '\u0000') {
nineShape = '9';
- if ("fa".equals(locale.getLanguage())) { //$NON-NLS-1$
+ if ("fa".equals(locale.getLanguage())) {
nineShape = '\u06f9';
- } else if ("ar".equals(locale.getLanguage())) { //$NON-NLS-1$
+ } else if ("ar".equals(locale.getLanguage())) {
nineShape = '\u0669';
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/options/ArgumentType.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/options/ArgumentType.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/options/ArgumentType.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -36,17 +36,17 @@
/**
* The option is not followed by an argument.
*/
- public static final ArgumentType NO_ARGUMENT = new ArgumentType("NO"); //$NON-NLS-1$
+ public static final ArgumentType NO_ARGUMENT = new ArgumentType("NO");
/**
* The option is followed by an argument.
*/
- public static final ArgumentType REQUIRED_ARGUMENT = new ArgumentType("Required"); //$NON-NLS-1$
+ public static final ArgumentType REQUIRED_ARGUMENT = new ArgumentType("Required");
/**
* The option may be followed by an argument.
*/
- public static final ArgumentType OPTIONAL_ARGUMENT = new ArgumentType("Optional"); //$NON-NLS-1$
+ public static final ArgumentType OPTIONAL_ARGUMENT = new ArgumentType("Optional");
/**
* @param name
Modified: trunk/common/src/main/java/org/crosswire/common/options/DataType.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/options/DataType.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/options/DataType.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -37,7 +37,7 @@
/**
* A string argument.
*/
- public static final DataType STRING = new DataType("String") //$NON-NLS-1$
+ public static final DataType STRING = new DataType("String")
{
/*
* (non-Javadoc)
@@ -59,7 +59,7 @@
/**
* An integer argument.
*/
- public static final DataType INTEGER = new DataType("Integer") //$NON-NLS-1$
+ public static final DataType INTEGER = new DataType("Integer")
{
/*
* (non-Javadoc)
@@ -81,7 +81,7 @@
/**
* An boolean argument that allows various values for 'true'.
*/
- public static final DataType BOOLEAN = new DataType("Boolean") //$NON-NLS-1$
+ public static final DataType BOOLEAN = new DataType("Boolean")
{
/*
* (non-Javadoc)
Modified: trunk/common/src/main/java/org/crosswire/common/options/GetOptions.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/options/GetOptions.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/options/GetOptions.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -112,7 +112,7 @@
// If we are at the end of all options, '--', we need to skip this
// and copy what follows to the end
- if ("--".equals(nextArg)) { //$NON-NLS-1$
+ if ("--".equals(nextArg)) {
for (int j = i + 1; j < nargs; j++) {
nonOptionArgs.add(args[j]);
}
@@ -131,10 +131,10 @@
List opts = programOptions.getLongOptions(flag);
int count = opts.size();
if (count == 0) {
- throw new IllegalArgumentException("Illegal option --" + flag); //$NON-NLS-1$
+ throw new IllegalArgumentException("Illegal option --" + flag);
}
if (count > 1) {
- throw new IllegalArgumentException("Ambiguous option --" + flag); //$NON-NLS-1$
+ throw new IllegalArgumentException("Ambiguous option --" + flag);
}
Option option = (Option) opts.get(0);
if (option.getArgumentType().equals(ArgumentType.NO_ARGUMENT)) {
@@ -146,7 +146,7 @@
if (equalPos != -1) {
// Add option with argument to options
// Check for empty argument
- String argument = (equalPos + 1 < nextArg.length()) ? nextArg.substring(equalPos + 1) : ""; //$NON-NLS-1$
+ String argument = (equalPos + 1 < nextArg.length()) ? nextArg.substring(equalPos + 1) : "";
suppliedOptions.put(option, argument);
continue;
}
@@ -159,7 +159,7 @@
suppliedOptions.put(option, argument);
continue;
}
- throw new IllegalArgumentException("Option missing required argument"); //$NON-NLS-1$
+ throw new IllegalArgumentException("Option missing required argument");
}
} else {
// Process a short argument or short argument sequence
@@ -170,7 +170,7 @@
char curChar = nextArg.charAt(j);
Option option = programOptions.getShortOption(curChar);
if (option == null) {
- throw new IllegalArgumentException("Illegal option -" + curChar); //$NON-NLS-1$
+ throw new IllegalArgumentException("Illegal option -" + curChar);
}
if (option.getArgumentType().equals(ArgumentType.NO_ARGUMENT)) {
// Add option with null argument to options
@@ -193,7 +193,7 @@
suppliedOptions.put(option, argument);
continue;
}
- throw new IllegalArgumentException("Option missing required argument"); //$NON-NLS-1$
+ throw new IllegalArgumentException("Option missing required argument");
}
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/options/OptionList.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/options/OptionList.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/options/OptionList.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -54,12 +54,12 @@
String longName = option.getLongName();
if (shortName != '\u0000') {
String optionName = Character.toString(shortName);
- assert !shortOptions.containsKey(optionName) : optionName + " already present"; //$NON-NLS-1$
+ assert !shortOptions.containsKey(optionName) : optionName + " already present";
shortOptions.put(optionName, option);
}
if (longName != null) {
- assert !longOptions.containsKey(longName) : longName + " already present"; //$NON-NLS-1$
+ assert !longOptions.containsKey(longName) : longName + " already present";
longOptions.put(longName, option);
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/progress/Job.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/Job.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/progress/Job.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -186,7 +186,8 @@
public void done() {
synchronized (this) {
finished = true;
- sectionName = UserMsg.DONE.toString();
+ // TRANSLATOR: This shows up in a progress bar when progress is finished.
+ sectionName = UserMsg.gettext("Done");
work = 100;
if (updater != null) {
@@ -356,7 +357,7 @@
long now = System.currentTimeMillis();
if (now < sectionStart) {
- log.warn("now before started: now=" + new Date(now) + " started=" + new Date(sectionStart)); //$NON-NLS-1$ //$NON-NLS-2$
+ log.warn("now before started: now=" + new Date(now) + " started=" + new Date(sectionStart));
return;
}
@@ -425,7 +426,7 @@
percentEnd = work + pcdiff;
- log.debug("Predicting " + predsecttime + "ms (" + work + '-' + percentEnd + "%) for section " + message); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ log.debug("Predicting " + predsecttime + "ms (" + work + '-' + percentEnd + "%) for section " + message);
}
/**
@@ -451,11 +452,11 @@
predictedLength = age;
}
} catch (NumberFormatException ex) {
- log.error("Time format error", ex); //$NON-NLS-1$
+ log.error("Time format error", ex);
}
}
} catch (IOException ex) {
- log.debug("Failed to load prediction times - guessing"); //$NON-NLS-1$
+ log.debug("Failed to load prediction times - guessing");
}
}
@@ -487,9 +488,9 @@
// And save. It's not a disaster if this goes wrong
try {
- NetUtil.storeProperties(predictions, predictURI, "Predicted Startup Times"); //$NON-NLS-1$
+ NetUtil.storeProperties(predictions, predictURI, "Predicted Startup Times");
} catch (IOException ex) {
- log.error("Failed to save prediction times", ex); //$NON-NLS-1$
+ log.error("Failed to save prediction times", ex);
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/progress/JobManager.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/JobManager.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/progress/JobManager.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -84,7 +84,7 @@
Progress job = new Job(description, predictURI, work, fakeupdates ? Progress.UNKNOWN : 100);
jobs.add(job);
- log.debug("job starting: " + job.getJobName()); //$NON-NLS-1$
+ log.debug("job starting: " + job.getJobName());
return job;
}
@@ -173,7 +173,7 @@
// that are no longer in our list of jobs. ho hum.
synchronized (JobManager.class) {
if (job.isFinished()) {
- log.debug("job finished: " + job.getJobName()); //$NON-NLS-1$
+ log.debug("job finished: " + job.getJobName());
jobs.remove(job);
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/progress/UserMsg.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/UserMsg.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/progress/UserMsg.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -31,12 +31,43 @@
* @author Joe Walker [joe at eireneh dot com]
*/
public final class UserMsg extends MsgBase {
- static final UserMsg DONE = new UserMsg("Job.Done"); //$NON-NLS-1$
/**
- * Passthrough ctor
+ * Get the internationalized text, but return key if key is unknown.
+ *
+ * @param key
+ * @return the internationalized text
*/
- private UserMsg(String name) {
- super(name);
+ public static String gettext(String key)
+ {
+ return msg.lookup(key);
}
+
+ /**
+ * Get the internationalized text, but return key if key is unknown.
+ * The text requires one parameter to be passed.
+ *
+ * @param key
+ * @param param
+ * @return the formatted, internationalized text
+ */
+ public static String gettext(String key, Object param)
+ {
+ return msg.toString(key, param);
+ }
+
+ /**
+ * Get the internationalized text, but return key if key is unknown.
+ * The text requires one parameter to be passed.
+ *
+ * @param key
+ * @param param
+ * @return the formatted, internationalized text
+ */
+ public static String gettext(String key, Object[] params)
+ {
+ return msg.toString(key, params);
+ }
+
+ private static MsgBase msg = new UserMsg();
}
Modified: trunk/common/src/main/java/org/crosswire/common/progress/UserMsg.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/UserMsg.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/progress/UserMsg.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,8 +1 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
-
-Job.Done=Done
+Done=Done
Modified: trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_de.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_de.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_de.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,8 +1 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
-
-Job.Done=OK
+Done=OK
Modified: trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_fa.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_fa.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_fa.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,8 +1 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
-
-Job.Done=\u062A\u0645\u0627\u0645
+Done=\u062A\u0645\u0627\u0645
Modified: trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_in.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_in.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_in.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,8 +1 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
-
-Job.Done=Selesai
+Done=Selesai
Modified: trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_vi.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_vi.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/progress/UserMsg_vi.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,8 +1 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
-
-Job.Done=Xong
+Done=Xong
Modified: trunk/common/src/main/java/org/crosswire/common/util/CWProject.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/CWProject.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/CWProject.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -227,7 +227,7 @@
// This isn't fatal, it just means that NetUtil will try to use
// $TMP
// in place of a more permanent solution.
- log.warn("Failed to get directory for NetUtil.setURICacheDir()", ex); //$NON-NLS-1$
+ log.warn("Failed to get directory for NetUtil.setURICacheDir()", ex);
}
}
@@ -267,7 +267,7 @@
/**
* The cache of downloaded files inside the project directory
*/
- private static final String DIR_NETCACHE = "netcache"; //$NON-NLS-1$
+ private static final String DIR_NETCACHE = "netcache";
/**
* The homes for this application: first is writable, second (if present) is
@@ -289,17 +289,17 @@
/**
* System property for home directory
*/
- private static String homeProperty = "jsword.home"; //$NON-NLS-1$
+ private static String homeProperty = "jsword.home";
/**
* The JSword user settings directory
*/
- private static String homeDirectory = ".jsword"; //$NON-NLS-1$
+ private static String homeDirectory = ".jsword";
/**
* The JSword user settings directory for Mac and Windows
*/
- private static String homeAltDirectory = "JSword"; //$NON-NLS-1$
+ private static String homeAltDirectory = "JSword";
/**
* The filesystem resources
Modified: trunk/common/src/main/java/org/crosswire/common/util/CallContext.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/CallContext.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/CallContext.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -49,7 +49,7 @@
return resolver;
} catch (SecurityException se) {
- throw new LucidRuntimeException(Msg.SECURITY, se);
+ throw new LucidRuntimeException(Msg.SECURITY.toString(), se, null);
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/ClassUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/ClassUtil.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/ClassUtil.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -71,14 +71,14 @@
if (entry != null && !entry.isDirectory()) {
if (full != null && !full.equals(fileName)) {
- log.warn("Warning duplicate " + classname + " found: " + full + " and " + paths[i]); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ log.warn("Warning duplicate " + classname + " found: " + full + " and " + paths[i]);
} else {
full = paths[i];
}
}
} catch (IOException ex) {
// If that zip file failed, then ignore it and move on.
- log.warn("Missing zip file for " + classname + " and " + paths[i]); //$NON-NLS-1$ //$NON-NLS-2$
+ log.warn("Missing zip file for " + classname + " and " + paths[i]);
}
} else {
StringBuffer path = new StringBuffer(256);
@@ -97,7 +97,7 @@
if (new File(fileName).isFile()) {
if (full != null && !full.equals(fileName)) {
- log.warn("Warning duplicate " + classname + " found: " + full + " and " + paths[i]); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ log.warn("Warning duplicate " + classname + " found: " + full + " and " + paths[i]);
} else {
full = paths[i];
}
@@ -113,7 +113,7 @@
* the classpath, if none is found it returns null.
*/
public static String findClasspathEntry(String classname) {
- String classpath = System.getProperty("java.class.path", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ String classpath = System.getProperty("java.class.path", "");
return findClasspathEntry(classname, classpath);
}
@@ -150,7 +150,7 @@
*/
public static String getShortClassName(Class cls) {
if (cls == null) {
- throw new IllegalArgumentException("The class must not be null"); //$NON-NLS-1$
+ throw new IllegalArgumentException("The class must not be null");
}
return getShortClassName(cls.getName());
}
@@ -173,7 +173,7 @@
*/
public static String getShortClassName(String className) {
if (className == null || className.length() == 0) {
- throw new IllegalArgumentException("The class name must not be empty"); //$NON-NLS-1$
+ throw new IllegalArgumentException("The class name must not be empty");
}
char[] chars = className.toCharArray();
int lastDot = 0;
@@ -201,9 +201,9 @@
*/
private static final char INNER_CLASS_SEPARATOR_CHAR = '$';
- private static final String EXTENSION_CLASS = ".class"; //$NON-NLS-1$
- private static final String EXTENSION_JAR = ".jar"; //$NON-NLS-1$
- private static final String EXTENSION_ZIP = ".zip"; //$NON-NLS-1$
+ private static final String EXTENSION_CLASS = ".class";
+ private static final String EXTENSION_JAR = ".jar";
+ private static final String EXTENSION_ZIP = ".zip";
/**
* The log stream
Modified: trunk/common/src/main/java/org/crosswire/common/util/Convert.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Convert.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Convert.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -48,11 +48,11 @@
*/
public static boolean string2Boolean(String data) {
return Boolean.valueOf(data).booleanValue()
- || data.equalsIgnoreCase("yes") //$NON-NLS-1$
- || data.equalsIgnoreCase("ok") //$NON-NLS-1$
- || data.equalsIgnoreCase("okay") //$NON-NLS-1$
- || data.equalsIgnoreCase("on") //$NON-NLS-1$
- || data.equals("1"); //$NON-NLS-1$
+ || data.equalsIgnoreCase("yes")
+ || data.equalsIgnoreCase("ok")
+ || data.equalsIgnoreCase("okay")
+ || data.equalsIgnoreCase("on")
+ || data.equals("1");
}
/**
@@ -146,8 +146,8 @@
public static Map string2Hashtable(String data, Class superclass) {
Map commands = new HashMap();
- String[] data_arr = StringUtil.split(data, " "); //$NON-NLS-1$
- String entry = ""; //$NON-NLS-1$
+ String[] data_arr = StringUtil.split(data, " ");
+ String entry = "";
for (int i = 0; i < data_arr.length; i++) {
try {
entry = data_arr[i];
@@ -162,7 +162,7 @@
commands.put(key, value);
}
} catch (ClassNotFoundException ex) {
- log.warn("Invalid config file entry: " + entry + " System message: " + ex.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ log.warn("Invalid config file entry: " + entry + " System message: " + ex.getMessage());
Reporter.informUser(Convert.class, ex);
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/Countries.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Countries.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Countries.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -100,13 +100,13 @@
}
}
- public static final String DEFAULT_COUNTRY_CODE = "US"; //$NON-NLS-1$
- private static final String UNKNOWN_COUNTRY_CODE = "XX"; //$NON-NLS-1$
+ public static final String DEFAULT_COUNTRY_CODE = "US";
+ private static final String UNKNOWN_COUNTRY_CODE = "XX";
private static/* final */ResourceBundle countries;
static {
try {
- countries = ResourceBundle.getBundle("iso3166", Locale.getDefault(), CWClassLoader.instance()); //$NON-NLS-1$;
+ countries = ResourceBundle.getBundle("iso3166", Locale.getDefault(), CWClassLoader.instance());
} catch (MissingResourceException e) {
assert false;
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/EventListenerList.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/EventListenerList.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/EventListenerList.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -311,14 +311,14 @@
/* @Override */
public String toString() {
Object[] lList = listenerList;
- StringBuffer s = new StringBuffer("EventListenerList: "); //$NON-NLS-1$
+ StringBuffer s = new StringBuffer("EventListenerList: ");
s.append(lList.length / 2);
- s.append(" listeners: "); //$NON-NLS-1$
+ s.append(" listeners: ");
for (int i = 0; i <= lList.length - 2; i += 2) {
- s.append(" type "); //$NON-NLS-1$
+ s.append(" type ");
s.append(((Class) lList[i]).getName());
- s.append(" listener "); //$NON-NLS-1$
+ s.append(" listener ");
s.append(lList[i + 1]);
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/FileUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/FileUtil.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/FileUtil.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -82,35 +82,35 @@
/**
* Extension for java files
*/
- public static final String EXTENSION_JAVA = ".java"; //$NON-NLS-1$
+ public static final String EXTENSION_JAVA = ".java";
/**
* Extension for properties files
*/
- public static final String EXTENSION_PROPERTIES = ".properties"; //$NON-NLS-1$
+ public static final String EXTENSION_PROPERTIES = ".properties";
/**
* Extension for plug-in files
*/
- public static final String EXTENSION_PLUGIN = ".plugin"; //$NON-NLS-1$
+ public static final String EXTENSION_PLUGIN = ".plugin";
/**
* Extension for XSLT files
*/
- public static final String EXTENSION_XSLT = ".xsl"; //$NON-NLS-1$
+ public static final String EXTENSION_XSLT = ".xsl";
/**
* Extension for XML files
*/
- public static final String EXTENSION_XML = ".xml"; //$NON-NLS-1$
+ public static final String EXTENSION_XML = ".xml";
/**
* Modes for opening random access files
*/
- public static final String MODE_READ = "r"; //$NON-NLS-1$
+ public static final String MODE_READ = "r";
/**
* Modes for opening random access files
*/
- public static final String MODE_WRITE = "rw"; //$NON-NLS-1$
+ public static final String MODE_WRITE = "rw";
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/IOUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/IOUtil.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/IOUtil.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -72,7 +72,8 @@
if (!parentDir.isDirectory()) {
// Create the directory and make sure it worked.
if (!parentDir.mkdirs()) {
- throw new MalformedURLException(UserMsg.CREATE_DIR_FAIL.toString(parentDir.toString()));
+ // TRANSLATOR: Error condition: A directory could not be created. {0} is a placeholder for the directory
+ throw new MalformedURLException(UserMsg.gettext("The given URL {0} could not be created as a directory.", parentDir.toString()));
}
}
@@ -104,7 +105,7 @@
try {
raf.close();
} catch (IOException ex) {
- log.error("close", ex); //$NON-NLS-1$
+ log.error("close", ex);
}
}
}
@@ -120,7 +121,7 @@
try {
out.close();
} catch (IOException ex) {
- log.error("close", ex); //$NON-NLS-1$
+ log.error("close", ex);
}
}
}
@@ -136,7 +137,7 @@
try {
in.close();
} catch (IOException ex) {
- log.error("close", ex); //$NON-NLS-1$
+ log.error("close", ex);
}
}
}
@@ -152,7 +153,7 @@
try {
in.close();
} catch (IOException ex) {
- log.error("close", ex); //$NON-NLS-1$
+ log.error("close", ex);
}
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/Language.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Language.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Language.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -85,13 +85,13 @@
public boolean isLeftToRight() {
if (!knowsDirection) {
// TODO(DMS): Improve this.
- ltor = !("he".equals(code) || //$NON-NLS-1$ Hebrew
- "ar".equals(code) || //$NON-NLS-1$ Arabic
- "fa".equals(code) || //$NON-NLS-1$ Farsi/Persian
- "ur".equals(code) || //$NON-NLS-1$ Uighur
- "uig".equals(code) || //$NON-NLS-1$ Uighur, too
- "syr".equals(code) || //$NON-NLS-1$ Syriac
- "iw".equals(code)); //$NON-NLS-1$ Java's notion of Hebrew
+ ltor = !("he".equals(code) || // Hebrew
+ "ar".equals(code) || // Arabic
+ "fa".equals(code) || // Farsi/Persian
+ "ur".equals(code) || // Uighur
+ "uig".equals(code) || // Uighur, too
+ "syr".equals(code) || // Syriac
+ "iw".equals(code)); // Java's notion of Hebrew
knowsDirection = true;
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/Languages.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Languages.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Languages.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -108,7 +108,7 @@
// These are not uncommon. Looking for them prevents exceptions
// and provides the same result.
- if (lookup.startsWith("x-") || lookup.startsWith("X-") || lookup.length() > 3) //$NON-NLS-1$ //$NON-NLS-2$
+ if (lookup.startsWith("x-") || lookup.startsWith("X-") || lookup.length() > 3)
{
return UNKNOWN_LANG_CODE;
}
@@ -116,13 +116,13 @@
return lookup;
}
- public static final String DEFAULT_LANG_CODE = "en"; //$NON-NLS-1$
- private static final String UNKNOWN_LANG_CODE = "und"; //$NON-NLS-1$
+ public static final String DEFAULT_LANG_CODE = "en";
+ private static final String UNKNOWN_LANG_CODE = "und";
private static/* final */ResourceBundle languages;
static {
try {
- languages = ResourceBundle.getBundle("iso639", Locale.getDefault(), CWClassLoader.instance()); //$NON-NLS-1$;
+ languages = ResourceBundle.getBundle("iso639", Locale.getDefault(), CWClassLoader.instance());
} catch (MissingResourceException e) {
assert false;
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/LogConfig.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/LogConfig.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/LogConfig.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -33,6 +33,6 @@
*/
public class LogConfig {
public LogConfig() throws SecurityException, IOException {
- LogManager.getLogManager().readConfiguration(ResourceUtil.getResourceAsStream("CWLogging.properties")); //$NON-NLS-1$
+ LogManager.getLogManager().readConfiguration(ResourceUtil.getResourceAsStream("CWLogging.properties"));
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/Logger.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Logger.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Logger.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -281,7 +281,7 @@
Exception ex = null;
try {
- InputStream cwConfigStream = ResourceUtil.getResourceAsStream("CWLogging.properties"); //$NON-NLS-1$
+ InputStream cwConfigStream = ResourceUtil.getResourceAsStream("CWLogging.properties");
LogManager.getLogManager().readConfiguration(cwConfigStream);
} catch (SecurityException e) {
ex = e;
@@ -291,7 +291,7 @@
ex = e;
}
if (ex != null) {
- cwLogger.info("Can't load CWLogging.properties", ex); //$NON-NLS-1$
+ cwLogger.info("Can't load CWLogging.properties", ex);
}
}
@@ -316,7 +316,7 @@
}
}
- private static final String ROOT_LOGGER = ""; //$NON-NLS-1$
+ private static final String ROOT_LOGGER = "";
private static final String CLASS_NAME = Logger.class.getName();
private static volatile boolean established;
private static volatile Level level;
Modified: trunk/common/src/main/java/org/crosswire/common/util/LucidException.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/LucidException.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/LucidException.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -108,6 +108,60 @@
}
/**
+ * All LucidExceptions are constructed with references to resources in an
+ * i18n properties file.
+ *
+ * @param msg
+ * The resource id to read
+ */
+ public LucidException(String msg) {
+ this(msg, null, (Object[]) null);
+ }
+
+ /**
+ * All LucidExceptions are constructed with references to resources in an
+ * i18n properties file.
+ *
+ * @param msg
+ * The resource id to read
+ */
+ public LucidException(String msg, Throwable cause) {
+ this(msg, cause, (Object[]) null);
+ }
+
+ /**
+ * All LucidExceptions are constructed with references to resources in an
+ * i18n properties file. This version allows us to add parameters
+ *
+ * @param msg
+ * The resource id to read
+ * @param params
+ * An array of parameters
+ */
+ public LucidException(String msg, Object[] params) {
+ this(msg, null, params);
+ }
+
+ /**
+ * All LucidExceptions are constructed with references to resources in an
+ * i18n properties file. This version allows us to add parameters
+ *
+ * @param msg
+ * The resource id to read
+ * @param params
+ * An array of parameters
+ */
+ public LucidException(String msg, Throwable cause, Object[] params) {
+ super(msg, cause);
+ this.deprecated = false;
+ if (params != null) {
+ this.params = (Object[]) params.clone();
+ } else {
+ this.params = null;
+ }
+ }
+
+ /**
* We only unravel the message when we need to to save time
*
* @return The unraveled i18n string
@@ -123,8 +177,8 @@
try {
return MessageFormat.format(out, params);
} catch (IllegalArgumentException ex) {
- log.warn("Format fail for '" + out + '\'', ex); //$NON-NLS-1$
- return "Error formatting message '" + out + '\''; //$NON-NLS-1$
+ log.warn("Format fail for '" + out + '\'', ex);
+ return "Error formatting message '" + out + '\'';
}
}
@@ -139,11 +193,13 @@
return getMessage();
}
+ // TRANSLATOR: When an error occurs this label precedes the details of the problem.
+ String reason = UserMsg.gettext("Reason:");
if (cause instanceof LucidException) {
LucidException lex = (LucidException) cause;
- return getMessage() + UserMsg.REASON + lex.getDetailedMessage();
+ return getMessage() + reason + lex.getDetailedMessage();
}
- return getMessage() + UserMsg.REASON + cause.getMessage();
+ return getMessage() + reason + cause.getMessage();
}
/**
Modified: trunk/common/src/main/java/org/crosswire/common/util/LucidRuntimeException.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/LucidRuntimeException.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/LucidRuntimeException.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -41,6 +41,7 @@
* @see LucidException
*/
public class LucidRuntimeException extends RuntimeException {
+
/**
* All LucidRuntimeException are constructed with references to resources in
* an i18n properties file.
@@ -48,7 +49,7 @@
* @param msg
* The resource id to read
*/
- public LucidRuntimeException(MsgBase msg) {
+ public LucidRuntimeException(String msg) {
this(msg, null, null);
}
@@ -59,7 +60,7 @@
* @param msg
* The resource id to read
*/
- public LucidRuntimeException(MsgBase msg, Throwable cause) {
+ public LucidRuntimeException(String msg, Throwable cause) {
this(msg, cause, null);
}
@@ -72,7 +73,7 @@
* @param params
* An array of parameters
*/
- public LucidRuntimeException(MsgBase msg, Object[] params) {
+ public LucidRuntimeException(String msg, Object[] params) {
this(msg, null, params);
}
@@ -81,12 +82,12 @@
* an i18n properties file. This version allows us to add parameters
*
* @param msg
- * The resource id to read
+ * the internationalized message to format
* @param newParams
* An array of parameters
*/
- public LucidRuntimeException(MsgBase msg, Throwable cause, Object[] newParams) {
- super(msg.toString(), cause);
+ public LucidRuntimeException(String msg, Throwable cause, Object[] newParams) {
+ super(msg, cause);
this.params = newParams == null ? null : (Object[]) newParams.clone();
}
@@ -107,8 +108,8 @@
try {
return MessageFormat.format(out, params);
} catch (IllegalArgumentException ex) {
- log.warn("Format fail for '" + out + '\'', ex); //$NON-NLS-1$
- return "Error formatting message '" + out + '\''; //$NON-NLS-1$
+ log.warn("Format fail for '" + out + '\'', ex);
+ return "Error formatting message '" + out + '\'';
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/Msg.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Msg.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Msg.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -30,11 +30,11 @@
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
final class Msg extends MsgBase {
- static final Msg SECURITY = new Msg("CallContext.Security"); //$NON-NLS-1$
- static final Msg WRONG_TYPE = new Msg("EventListenerList.WrongType"); //$NON-NLS-1$
- static final Msg CANT_STRIP = new Msg("NetUtil.CantStrip"); //$NON-NLS-1$
- static final Msg NO_RESOURCE = new Msg("ResourceUtil.NoResource"); //$NON-NLS-1$
- static final Msg NOT_ASSIGNABLE = new Msg("ResourceUtil.NotAssignable"); //$NON-NLS-1$
+ static final Msg SECURITY = new Msg("Could not create ClassResolver:");
+ static final Msg WRONG_TYPE = new Msg("Listener {0} is not of type {1}");
+ static final Msg CANT_STRIP = new Msg("The URL {0} does not end in {1}.");
+ static final Msg NO_RESOURCE = new Msg("Cannot find resource: {0}");
+ static final Msg NOT_ASSIGNABLE = new Msg("Class {0} does not implement {1}.");
/**
* Passthrough ctor
Modified: trunk/common/src/main/java/org/crosswire/common/util/Msg.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Msg.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Msg.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,12 +1,9 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
+Cannot\ find\ resource\:\ {0} = Cannot find resource: {0}
-CallContext.Security=Could not create ClassResolver:
-EventListenerList.WrongType=Listener {0} is not of type {1}
-NetUtil.CantStrip=The URL {0} does not end in {1}.
-ResourceUtil.NoResource=Cannot find resource: {0}
-ResourceUtil.NotAssignable=Class {0} does not implement {1}
+Class\ {0}\ does\ not\ implement\ {1}. = Class {0} does not implement {1}.
+
+Could\ not\ create\ ClassResolver\: = Could not create ClassResolver:
+
+Listener\ {0}\ is\ not\ of\ type\ {1}. = Listener {0} is not of type {1}.
+
+The\ URL\ {0}\ does\ not\ end\ in\ {1}. = The URL {0} does not end in {1}.
Modified: trunk/common/src/main/java/org/crosswire/common/util/MsgBase.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/MsgBase.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/MsgBase.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -35,44 +35,65 @@
* easy for most cases. See {@link org.crosswire.common.util.Msg} for an example
* of how to inherit from here.
*
- * <p>
- * Some Regex/Vi macros to convert from a half way house i18n scheme where the
- * strings are in Msg classes but not properties files: The following makes the
- * lookup string simple :%s/Msg \([^ ]*\) = new Msg(".*")/Msg \1 = new
- * Msg("\1")/ These turn a lookup string into a properties file :%s/ static
- * final Msg // :%s/ = new Msg("/: / :%s/");\/\/\$NON-NLS-1\$$/
- *
* @see gnu.lgpl.License for license details.<br>
* The copyright to this program is held by it's authors.
* @author Joe Walker [joe at eireneh dot com]
* @author DM Smith [dmsmith555 at yahoo dot com]
- * @see org.crosswire.common.util.Msg
*/
public class MsgBase {
/**
* Create a MsgBase object
*/
protected MsgBase(String name) {
+ this();
this.name = name;
+ }
+
+ protected MsgBase()
+ {
this.shaper = new NumberShaper();
loadResources();
}
- /*
- * (non-Javadoc)
+ /**
+ * Get the internationalized text, but return key if key is unknown.
*
- * @see org.apache.commons.lang.enum.Enum#toString()
+ * @param key
+ * @return the internationalized text
*/
- /* @Override */
+ public String lookup(String key)
+ {
+ return shaper.shape(obtainString(key));
+ }
+
+ /**
+ * Formats the message with the given parameter.
+ */
+ public String toString(String key, Object param) {
+ return shaper.shape(MessageFormat.format(obtainString(key), new Object[] {
+ param
+ }));
+ }
+
+ /**
+ * Formats the message with the given parameters.
+ */
+ public String toString(String key, Object[] params) {
+ return shaper.shape(MessageFormat.format(obtainString(key), params));
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
public String toString() {
- return shaper.shape(obtainString());
+ return shaper.shape(obtainString(name));
}
/**
* Formats the message with the given parameter.
*/
public String toString(Object param) {
- return shaper.shape(MessageFormat.format(obtainString(), new Object[] {
+ return shaper.shape(MessageFormat.format(obtainString(name), new Object[] {
param
}));
}
@@ -81,7 +102,7 @@
* Formats the message with the given parameters.
*/
public String toString(Object[] params) {
- return shaper.shape(MessageFormat.format(obtainString(), params));
+ return shaper.shape(MessageFormat.format(obtainString(name), params));
}
/**
@@ -103,32 +124,32 @@
resources = ResourceBundle.getBundle(className, defaultLocale, CWClassLoader.instance(implementingClass));
resourceMap.put(className, resources);
} catch (MissingResourceException ex) {
- log.warn("Assuming key is the default message " + className + ": " + name); //$NON-NLS-1$ //$NON-NLS-2$
+ log.warn("Assuming key is the default message " + className);
}
}
}
}
- private String obtainString() {
+ private String obtainString(String key) {
try {
if (resources != null) {
- return resources.getString(name);
+ return resources.getString(key);
}
} catch (MissingResourceException ex) {
- log.error("Missing resource: Locale=" + Locale.getDefault().toString() + " name=" + name + " package=" + getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ log.error("Missing resource: Locale=" + Locale.getDefault().toString() + " name=" + key + " package=" + getClass().getName());
}
- return name;
+ return key;
}
- private String name;
-
/**
* resource map maintains a mapping of class names to resources found by
* that name.
*/
private static Map resourceMap = new HashMap();
+ private String name;
+
/**
* If there is any internationalization to be done, it is thru this
*/
Modified: trunk/common/src/main/java/org/crosswire/common/util/Msg_de.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Msg_de.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Msg_de.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,12 +1,9 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
+Cannot\ find\ resource\:\ {0} = Cannot find resource: {0}
-CallContext.Security=ClassResolver konnte nicht erzeugt werden:
-EventListenerList.WrongType=Listener {0} ist nicht von Typ {1}
-NetUtil.CantStrip=The URL {0} endet nicht mit {1}.
-ResourceUtil.NoResource=Cannot find resource: {0}
-ResourceUtil.NotAssignable=Class {0} does not implement {1}
+Class\ {0}\ does\ not\ implement\ {1}. = Class {0} does not implement {1}.
+
+Could\ not\ create\ ClassResolver\: = ClassResolver konnte nicht erzeugt werden:
+
+Listener\ {0}\ is\ not\ of\ type\ {1}. = Listener {0} ist nicht von Typ {1}.
+
+The\ URL\ {0}\ does\ not\ end\ in\ {1}. = The URL {0} endet nicht mit {1}.
Modified: trunk/common/src/main/java/org/crosswire/common/util/NetUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/NetUtil.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/NetUtil.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -63,48 +63,48 @@
/**
* Constant for the file: protocol or scheme
*/
- public static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$
+ public static final String PROTOCOL_FILE = "file";
/**
* Constant for the http: protocol or scheme
*/
- public static final String PROTOCOL_HTTP = "http"; //$NON-NLS-1$
+ public static final String PROTOCOL_HTTP = "http";
/**
* Constant for the ftp: protocol or scheme
*/
- public static final String PROTOCOL_FTP = "ftp"; //$NON-NLS-1$
+ public static final String PROTOCOL_FTP = "ftp";
/**
* Constant for the jar: protocol or scheme
*/
- public static final String PROTOCOL_JAR = "jar"; //$NON-NLS-1$
+ public static final String PROTOCOL_JAR = "jar";
/**
* For directory listings
*/
- public static final String INDEX_FILE = "index.txt"; //$NON-NLS-1$
+ public static final String INDEX_FILE = "index.txt";
/**
* URL/URI separator
*/
- public static final String SEPARATOR = "/"; //$NON-NLS-1$
+ public static final String SEPARATOR = "/";
/**
* Separating the username from the rest of the URL/URI
*/
- public static final String AUTH_SEPERATOR_USERNAME = "@"; //$NON-NLS-1$
+ public static final String AUTH_SEPERATOR_USERNAME = "@";
/**
* Separating the password from the username
*/
- public static final String AUTH_SEPERATOR_PASSWORD = ":"; //$NON-NLS-1$
+ public static final String AUTH_SEPERATOR_PASSWORD = ":";
/**
* The temporary suffix, used when a temporary file is needed in the
* system's temporary directory.
*/
- private static final String TEMP_SUFFIX = "tmp"; //$NON-NLS-1$
+ private static final String TEMP_SUFFIX = "tmp";
public static URI copy(URI uri) {
try {
@@ -129,14 +129,16 @@
// If it is a file, except
if (file.isFile()) {
- throw new MalformedURLException(UserMsg.IS_FILE.toString(orig));
+ // TRANSLATOR: Error condition: A directory was expected, but a file was found. {0} is a placeholder for the file.
+ throw new MalformedURLException(UserMsg.gettext("The given URL {0} is a file.", orig));
}
// Is it already a directory ?
if (!file.isDirectory()) {
// Create the directory and make sure it worked.
if (!file.mkdirs()) {
- throw new MalformedURLException(UserMsg.CREATE_DIR_FAIL.toString(orig));
+ // TRANSLATOR: Error condition: A directory could not be created. {0} is a placeholder for the directory
+ throw new MalformedURLException(UserMsg.gettext("The given URL {0} could not be created as a directory.", orig));
}
}
}
@@ -155,7 +157,8 @@
// If it is a file, except
if (file.isDirectory()) {
- throw new MalformedURLException(UserMsg.IS_DIR.toString(orig));
+ // TRANSLATOR: Error condition: A file was expected, but a directory was found. {0} is a placeholder for the directory.
+ throw new MalformedURLException(UserMsg.gettext("The given URL {0} is a directory.", orig));
}
// Is it already a directory ?
@@ -165,7 +168,8 @@
// Did that work?
if (!file.isFile()) {
- throw new MalformedURLException(UserMsg.CREATE_FILE_FAIL.toString(orig));
+ // TRANSLATOR: Error condition: A file could not be created. {0} is a placeholder for the file
+ throw new MalformedURLException(UserMsg.gettext("The given URL {0} could not be created as a file.", orig));
}
}
}
@@ -286,7 +290,7 @@
if (uri.getScheme().equals(PROTOCOL_FILE)) {
return new File(uri.getPath());
}
- String hashString = (uri.toString().hashCode() + "").replace('-', 'm'); //$NON-NLS-1$
+ String hashString = (uri.toString().hashCode() + "").replace('-', 'm');
// get the location of the tempWorkingDir
File workingDir = getURICacheDir();
@@ -354,8 +358,8 @@
String newFile = file.substring(0, file.length() - strip.length());
try {
- return new URI(orig.getScheme(), orig.getUserInfo(), orig.getHost(), orig.getPort(), newFile, "", //$NON-NLS-1$
- ""); //$NON-NLS-1$
+ return new URI(orig.getScheme(), orig.getUserInfo(), orig.getHost(), orig.getPort(), newFile, "",
+ "");
} catch (URISyntaxException e) {
throw new MalformedURLException(Msg.CANT_STRIP.toString(new Object[] {
orig, strip
@@ -478,7 +482,7 @@
// JNLP or other systems that can't use file: URIs. But it is silly
// to get to picky so if there is a solution using file: then just
// print a warning and carry on.
- log.warn("index file for " + uri.toString() + " was not found."); //$NON-NLS-1$ //$NON-NLS-2$
+ log.warn("index file for " + uri.toString() + " was not found.");
if (uri.getScheme().equals(PROTOCOL_FILE)) {
return listByFile(uri, filter);
}
@@ -490,12 +494,12 @@
// Check that the answers are the same
if (files.length != reply.length) {
- log.warn("index file for " + uri.toString() + " has incorrect number of entries."); //$NON-NLS-1$ //$NON-NLS-2$
+ log.warn("index file for " + uri.toString() + " has incorrect number of entries.");
} else {
List list = Arrays.asList(files);
for (int i = 0; i < files.length; i++) {
if (!list.contains(files[i])) {
- log.warn("file: based index found " + files[i] + " but this was not found using index file."); //$NON-NLS-1$ //$NON-NLS-2$
+ log.warn("file: based index found " + files[i] + " but this was not found using index file.");
}
}
}
@@ -512,7 +516,8 @@
public static String[] listByFile(URI uri, URIFilter filter) throws MalformedURLException {
File fdir = new File(uri.getPath());
if (!fdir.isDirectory()) {
- throw new MalformedURLException(UserMsg.NOT_DIR.toString(uri.toString()));
+ // TRANSLATOR: Error condition: A directory was expected, but a file was found. {0} is a placeholder for the file.
+ throw new MalformedURLException(UserMsg.gettext("URL {0} is not a directory", uri.toString()));
}
return fdir.list(new URIFilterFilenameFilter(filter));
@@ -546,7 +551,7 @@
// We still need to do the filtering
List list = new ArrayList();
- String[] names = StringUtil.split(contents, "\n"); //$NON-NLS-1$
+ String[] names = StringUtil.split(contents, "\n");
for (int i = 0; i < names.length; i++) {
// we need to trim, as we may have \r\n not \n
String name = names[i].trim();
@@ -667,7 +672,7 @@
return time;
} catch (IOException ex) {
- log.warn("Failed to get modified time", ex); //$NON-NLS-1$
+ log.warn("Failed to get modified time", ex);
return new Date().getTime();
}
}
@@ -725,7 +730,8 @@
*/
private static void checkFileURI(URI uri) throws MalformedURLException {
if (!uri.getScheme().equals(PROTOCOL_FILE)) {
- throw new MalformedURLException(UserMsg.NOT_FILE_URI.toString(uri));
+ // TRANSLATOR: Error condition: The URL protocol "file:" was expected, but something else was found. {0} is a placeholder for the URL.
+ throw new MalformedURLException(UserMsg.gettext("The given URL {0} is not a file: URL.", uri));
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/OSType.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/OSType.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/OSType.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -33,7 +33,7 @@
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
public abstract class OSType implements Serializable {
- public static final OSType MAC = new OSType("Mac") //$NON-NLS-1$
+ public static final OSType MAC = new OSType("Mac")
{
/*
* (non-Javadoc)
@@ -61,7 +61,7 @@
private static final long serialVersionUID = -1575982665011980783L;
};
- public static final OSType WIN32 = new OSType("Win") //$NON-NLS-1$
+ public static final OSType WIN32 = new OSType("Win")
{
/*
* (non-Javadoc)
@@ -89,7 +89,7 @@
private static final long serialVersionUID = 2448098399487879399L;
};
- public static final OSType DEFAULT = new OSType("*nix") //$NON-NLS-1$
+ public static final OSType DEFAULT = new OSType("*nix")
{
/*
* (non-Javadoc)
@@ -145,7 +145,7 @@
public abstract URI getUserAreaFolder(String hiddenFolderName, String visibleFolderName);
public static URI getUserHome() {
- return NetUtil.getURI(new File(System.getProperty("user.home"))); //$NON-NLS-1$;
+ return NetUtil.getURI(new File(System.getProperty("user.home")));
}
/**
@@ -240,17 +240,17 @@
/**
* The Windows user settings parent directory
*/
- private static final String WIN32_USER_DATA_AREA = "Application Data"; //$NON-NLS-1$
+ private static final String WIN32_USER_DATA_AREA = "Application Data";
/**
* The Mac user settings parent directory
*/
- private static final String MAC_USER_DATA_AREA = "Library/Application Support"; //$NON-NLS-1$
+ private static final String MAC_USER_DATA_AREA = "Library/Application Support";
/**
* The machine's osType
*/
- private static OSType osType = fromString(System.getProperty("os.name")); //$NON-NLS-1$
+ private static OSType osType = fromString(System.getProperty("os.name"));
/**
* Serialization ID
Modified: trunk/common/src/main/java/org/crosswire/common/util/PatternFormatter.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/PatternFormatter.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/PatternFormatter.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -62,7 +62,7 @@
public synchronized String format(LogRecord record) {
// Minimize memory allocations here.
dat.setTime(record.getMillis());
- String throwable = ""; //$NON-NLS-1$
+ String throwable = "";
if (record.getThrown() != null) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
@@ -71,7 +71,7 @@
throwable = sw.toString();
}
- String format = LogManager.getLogManager().getProperty(PatternFormatter.class.getName() + ".format"); //$NON-NLS-1$
+ String format = LogManager.getLogManager().getProperty(PatternFormatter.class.getName() + ".format");
String loggerName = record.getLoggerName();
Logger logger = LogManager.getLogManager().getLogger(loggerName);
@@ -80,7 +80,7 @@
String aLoggerName = aLogger.getName();
if (aLoggerName != null) {
- property = LogManager.getLogManager().getProperty(aLoggerName + ".format"); //$NON-NLS-1$
+ property = LogManager.getLogManager().getProperty(aLoggerName + ".format");
}
if (property != null) {
@@ -112,10 +112,10 @@
}
private Date dat = new Date();
- private static final String DEFAULT_FORMAT = "{1}({2}): {3}{8} {4}"; //$NON-NLS-1$
+ private static final String DEFAULT_FORMAT = "{1}({2}): {3}{8} {4}";
private MessageFormat formatter;
// Line separator string. This is the value of the line.separator
// property at the moment that the PatternFormatter was created.
- private String lineSeparator = System.getProperty("line.separator", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ private String lineSeparator = System.getProperty("line.separator", "\r\n");
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/PluginUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/PluginUtil.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/PluginUtil.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -70,17 +70,17 @@
if (clazz.isAssignableFrom(impl)) {
matches.add(impl);
} else {
- log.warn("Class " + impl.getName() + " does not implement " + clazz.getName() + ". Ignoring."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ log.warn("Class " + impl.getName() + " does not implement " + clazz.getName() + ". Ignoring.");
}
} catch (ClassNotFoundException ex) {
- log.warn("Failed to add class to list: " + clazz.getName(), ex); //$NON-NLS-1$
+ log.warn("Failed to add class to list: " + clazz.getName(), ex);
}
}
- log.debug("Found " + matches.size() + " implementors of " + clazz.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ log.debug("Found " + matches.size() + " implementors of " + clazz.getName());
return (Class[]) matches.toArray(new Class[matches.size()]);
} catch (IOException ex) {
- log.error("Failed to get any classes.", ex); //$NON-NLS-1$
+ log.error("Failed to get any classes.", ex);
return new Class[0];
}
}
@@ -112,16 +112,16 @@
if (clazz.isAssignableFrom(impl)) {
matches.put(key, impl);
} else {
- log.warn("Class " + impl.getName() + " does not implement " + clazz.getName() + ". Ignoring."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ log.warn("Class " + impl.getName() + " does not implement " + clazz.getName() + ". Ignoring.");
}
} catch (ClassNotFoundException ex) {
- log.warn("Failed to add class to list: " + clazz.getName(), ex); //$NON-NLS-1$
+ log.warn("Failed to add class to list: " + clazz.getName(), ex);
}
}
- log.debug("Found " + matches.size() + " implementors of " + clazz.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ log.debug("Found " + matches.size() + " implementors of " + clazz.getName());
} catch (IOException ex) {
- log.error("Failed to get any classes.", ex); //$NON-NLS-1$
+ log.error("Failed to get any classes.", ex);
}
return matches;
@@ -216,12 +216,12 @@
/**
* Extension for properties files
*/
- public static final String EXTENSION_PLUGIN = ".plugin"; //$NON-NLS-1$
+ public static final String EXTENSION_PLUGIN = ".plugin";
/**
* The string for default implementations
*/
- private static final String DEFAULT = "default"; //$NON-NLS-1$
+ private static final String DEFAULT = "default";
/**
* The log stream
Modified: trunk/common/src/main/java/org/crosswire/common/util/Reporter.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Reporter.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Reporter.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -124,7 +124,6 @@
* The cause of the message, a Component if possible.
* @param message
* The message to pass to the user
- * @deprecated Use informUser(Object source, MsgBase message) instead
*/
public static void informUser(Object source, String message) {
log.debug(message);
@@ -223,7 +222,7 @@
Object[] liArr = LISTENERS.getListenerList();
if (liArr.length == 0) {
- log.warn("Nothing to listen to report: message=" + ev.getMessage(), ev.getException()); //$NON-NLS-1$
+ log.warn("Nothing to listen to report: message=" + ev.getMessage(), ev.getException());
}
// Process the listeners last to first, notifying
@@ -260,7 +259,7 @@
/**
* The system property name for registering AWT exceptions
*/
- private static final String AWT_HANDLER_PROPERTY = "sun.awt.exception.handler"; //$NON-NLS-1$
+ private static final String AWT_HANDLER_PROPERTY = "sun.awt.exception.handler";
/**
* The name of the class to register for AWT exceptions
@@ -296,7 +295,8 @@
// were causing recursive AWT exceptions
// and way too many dialogs were being thrown up on the screen.
if (gate.open()) {
- Reporter.informUser(this, new LucidException(UserMsg.UNEXPECTED_ERROR, ex));
+ // TRANSLATOR: Very frequent error condition: The program has encountered a severe problem and it is likely that the program is unusable.
+ Reporter.informUser(this, new LucidException(UserMsg.gettext("Unexpected internal problem. You may need to restart."), ex));
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/StackTrace.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/StackTrace.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/StackTrace.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -66,13 +66,13 @@
StringWriter sout = new StringWriter();
ex.printStackTrace(new PrintWriter(sout));
String msg = new String(sout.getBuffer());
- String[] calls = StringUtil.split(msg, "\n\r"); //$NON-NLS-1$
+ String[] calls = StringUtil.split(msg, "\n\r");
int total = 0;
for (int i = 0; i < calls.length - discard; i++) {
String call = calls[i + discard];
- if (!(call.startsWith("Caused") || call.indexOf("...") >= 0)) //$NON-NLS-1$ //$NON-NLS-2$
+ if (!(call.startsWith("Caused") || call.indexOf("...") >= 0))
{
total++;
}
@@ -88,7 +88,7 @@
String call = calls[i + discard];
try {
- if (!(call.startsWith("Caused") || call.indexOf("...") >= 0)) //$NON-NLS-1$ //$NON-NLS-2$
+ if (!(call.startsWith("Caused") || call.indexOf("...") >= 0))
{
int spcIndex = call.indexOf(' ');
int lhsIndex = call.indexOf('(');
@@ -111,9 +111,9 @@
j++;
}
} catch (NumberFormatException ex2) {
- classNames[j] = "ParseError: "; //$NON-NLS-1$
+ classNames[j] = "ParseError: ";
methodNames[j] = call;
- fileNames[j] = "Error"; //$NON-NLS-1$
+ fileNames[j] = "Error";
lineNumbers[j] = 0;
j++;
}
@@ -144,7 +144,7 @@
* Number of calling function
*/
public String getFullFunctionName(int level) {
- return classNames[level] + '.' + methodNames[level] + "()"; //$NON-NLS-1$
+ return classNames[level] + '.' + methodNames[level] + "()";
}
/**
Modified: trunk/common/src/main/java/org/crosswire/common/util/StringUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/StringUtil.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/StringUtil.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -45,7 +45,7 @@
/**
* The newline character
*/
- public static final String NEWLINE = System.getProperty("line.separator", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String NEWLINE = System.getProperty("line.separator", "\r\n");
/**
* This method reads an InputStream <b>In its entirety</b>, and passes The
@@ -552,7 +552,7 @@
return null;
}
if (separator == null) {
- separator = ""; //$NON-NLS-1$
+ separator = "";
}
int arraySize = array.length;
@@ -596,11 +596,11 @@
*/
public static String toString(Object[] a) {
if (a == null) {
- return "null"; //$NON-NLS-1$
+ return "null";
}
if (a.length == 0) {
- return "[]"; //$NON-NLS-1$
+ return "[]";
}
StringBuffer buf = new StringBuffer();
@@ -609,13 +609,13 @@
if (i == 0) {
buf.append('[');
} else {
- buf.append(", "); //$NON-NLS-1$
+ buf.append(", ");
}
buf.append(String.valueOf(a[i]));
}
- buf.append("]"); //$NON-NLS-1$
+ buf.append("]");
return buf.toString();
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/Translations.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/Translations.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/Translations.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -143,7 +143,7 @@
*/
public void setCurrent(String newTranslation) {
String found = DEFAULT_TRANSLATION;
- String currentTranslation = ""; //$NON-NLS-1$
+ String currentTranslation = "";
for (int i = 0; i < translations.length; i++) {
String trans = translations[i];
currentTranslation = toString(translation);
@@ -162,9 +162,9 @@
}
URI outputURI = CWProject.instance().getWritableURI(getClass().getName(), FileUtil.EXTENSION_PROPERTIES);
- NetUtil.storeProperties(props, outputURI, "BibleDesktop UI Translation"); //$NON-NLS-1$
+ NetUtil.storeProperties(props, outputURI, "BibleDesktop UI Translation");
} catch (IOException ex) {
- log.error("Failed to save BibleDesktop UI Translation", ex); //$NON-NLS-1$
+ log.error("Failed to save BibleDesktop UI Translation", ex);
}
}
@@ -220,7 +220,7 @@
private void loadSupportedTranslations() {
if (translations == null) {
try {
- URL index = ResourceUtil.getResource(Translations.class, "translations.txt"); //$NON-NLS-1$
+ URL index = ResourceUtil.getResource(Translations.class, "translations.txt");
translations = NetUtil.listByIndexFile(NetUtil.toURI(index));
} catch (IOException ex) {
translations = new String[0];
@@ -233,7 +233,7 @@
if (translationCode.indexOf('_') != -1) {
String[] locale = StringUtil.split(translationCode, '_');
- currentTranslation.append(", "); //$NON-NLS-1$
+ currentTranslation.append(", ");
currentTranslation.append(Countries.getCountry(locale[1]));
}
@@ -243,12 +243,12 @@
/**
* The key used in config.xml
*/
- private static final String TRANSLATION_KEY = "translation-codes"; //$NON-NLS-1$
+ private static final String TRANSLATION_KEY = "translation-codes";
/**
* The default translation, if the user has not chosen anything else.
*/
- public static final String DEFAULT_TRANSLATION = "en"; //$NON-NLS-1$
+ public static final String DEFAULT_TRANSLATION = "en";
/**
* The default Locale, it the user has not chosen anything else.
Modified: trunk/common/src/main/java/org/crosswire/common/util/UserMsg.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/UserMsg.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/UserMsg.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -21,6 +21,7 @@
*/
package org.crosswire.common.util;
+
/**
* Compile safe Msg resource settings.
*
@@ -30,20 +31,43 @@
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
final class UserMsg extends MsgBase {
- static final UserMsg REASON = new UserMsg("LucidException.Reason"); //$NON-NLS-1$
- static final UserMsg CREATE_DIR_FAIL = new UserMsg("NetUtil.CreateDirFail"); //$NON-NLS-1$
- static final UserMsg CREATE_FILE_FAIL = new UserMsg("NetUtil.CreateFileFail"); //$NON-NLS-1$
- static final UserMsg IS_DIR = new UserMsg("NetUtil.IsDir"); //$NON-NLS-1$
- static final UserMsg IS_FILE = new UserMsg("NetUtil.IsFile"); //$NON-NLS-1$
- static final UserMsg NOT_DIR = new UserMsg("NetUtil.NotDir"); //$NON-NLS-1$
- static final UserMsg NOT_FILE_URI = new UserMsg("NetUtil.NotFileURI"); //$NON-NLS-1$
- static final UserMsg MISSING_FILE = new UserMsg("WebResource.MissingFile"); //$NON-NLS-1$
- static final UserMsg UNEXPECTED_ERROR = new UserMsg("Reporter.Unexpected"); //$NON-NLS-1$
/**
- * Passthrough ctor
+ * Get the internationalized text, but return key if key is unknown.
+ *
+ * @param key
+ * @return the internationalized text
*/
- private UserMsg(String name) {
- super(name);
+ public static String gettext(String key)
+ {
+ return msg.lookup(key);
}
+
+ /**
+ * Get the internationalized text, but return key if key is unknown.
+ * The text requires one parameter to be passed.
+ *
+ * @param key
+ * @param param
+ * @return the formatted, internationalized text
+ */
+ public static String gettext(String key, Object param)
+ {
+ return msg.toString(key, param);
+ }
+
+ /**
+ * Get the internationalized text, but return key if key is unknown.
+ * The text requires one parameter to be passed.
+ *
+ * @param key
+ * @param param
+ * @return the formatted, internationalized text
+ */
+ public static String gettext(String key, Object[] params)
+ {
+ return msg.toString(key, params);
+ }
+
+ private static MsgBase msg = new UserMsg();
}
Modified: trunk/common/src/main/java/org/crosswire/common/util/UserMsg.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/UserMsg.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/UserMsg.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,16 +1,17 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
+Reason\: = Reason:
-LucidException.Reason=Reason:
-NetUtil.CreateDirFail=The given URL {0} could not be created as a directory.
-NetUtil.CreateFileFail=The given URL {0} could not be created as a file.
-NetUtil.IsDir=The given URL {0} is a directory.
-NetUtil.IsFile=The given URL {0} is a file.
-NetUtil.NotDir=URL {0} is not a directory
-NetUtil.NotFileURI=The given URL {0} is not a file: URL.
-WebResource.MissingFile=Unable to find: {0}
-Reporter.Unexpected=Unexpected internal problem. You may need to restart.
+The\ URL\ {0}\ could\ not\ be\ created\ as\ a\ directory. = The URL {0} could not be created as a directory.
+
+The\ URL\ {0}\ could\ not\ be\ created\ as\ a\ file. = The URL {0} could not be created as a file.
+
+The\ URL\ {0}\ is\ a\ directory. = The URL {0} is a directory.
+
+The\ URL\ {0}\ is\ a\ file. = The URL {0} is a file.
+
+The\ URL\ {0}\ is\ not\ a\ directory. = The URL {0} is not a directory.
+
+The\ URL\ {0}\ is\ not\ a\ file\:\ URL. = The URL {0} is not a file: URL.
+
+Unable\ to\ find\:\ {0} = Unable to find: {0}
+
+Unexpected\ internal\ problem.\ You\ may\ need\ to\ restart. = Unexpected internal problem. You may need to restart.
Modified: trunk/common/src/main/java/org/crosswire/common/util/UserMsg_de.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/UserMsg_de.properties 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/UserMsg_de.properties 2010-10-23 20:24:08 UTC (rev 1994)
@@ -1,16 +1,17 @@
-# The naming convention for the keys in the file is ClassName.MessageName
-# Where ClassName is the name of the class using the property.
-# When the resource is used by more than one class it should be the one
-# that the resource is most closely associated.
-# The MessageName should be mixed case, with a leading capital.
-# It should have no spaces or other punctuation (e.g. _, -, ', ...)
+Reason\: = Grund:
-LucidException.Reason=Grund:
-NetUtil.CreateDirFail=Die URL {0} konnte nicht als Verzeichnis erzeugt werden.
-NetUtil.CreateFileFail=The given URL {0} konnte nicht als Datei erzeugt werden.
-NetUtil.IsDir=Die angegebene URL {0} ist ein Verzeichnis.
-NetUtil.IsFile=Die angegegebene URL {0} ist eine Datei.
-NetUtil.NotDir=URL {0} is not a directory
-NetUtil.NotFileURI=The given URL {0} is not a file: URL.
-WebResource.MissingFile=Konnte nicht gefunden werden: {0}
-Reporter.Unexpected=Unexpected internal problem. You may need to restart.
\ No newline at end of file
+The\ URL\ {0}\ could\ not\ be\ created\ as\ a\ directory. = Die URL {0} konnte nicht als Verzeichnis erzeugt werden.
+
+The\ URL\ {0}\ could\ not\ be\ created\ as\ a\ file. = Die URL {0} konnte nicht als Datei erzeugt werden.
+
+The\ URL\ {0}\ is\ a\ directory. = Die URL {0} ist ein Verzeichnis.
+
+The\ URL\ {0}\ is\ a\ file. = Die URL {0} ist eine Datei.
+
+The\ URL\ {0}\ is\ not\ a\ directory. = The URL {0} is not a directory
+
+The\ URL\ {0}\ is\ not\ a\ file\:\ URL. = The given URL {0} is not a file: URL.
+
+Unable\ to\ find\:\ {0} = Konnte nicht gefunden werden: {0}
+
+Unexpected\ internal\ problem.\ You\ may\ need\ to\ restart. = Unexpected internal problem. You may need to restart.
Modified: trunk/common/src/main/java/org/crosswire/common/util/WebResource.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/WebResource.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/util/WebResource.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -92,9 +92,10 @@
return new HttpURLConnection(method, NetUtil.toURL(uri)).getContentLength();
}
String reason = HttpStatus.getStatusText(status);
- Reporter.informUser(this, UserMsg.MISSING_FILE, new Object[] {
+ // TRANSLATOR: Common error condition: {0} is a placeholder for the URL of what could not be found.
+ Reporter.informUser(this, UserMsg.gettext("Unable to find: {0}", new Object[] {
reason + ':' + uri.getPath()
- });
+ }));
} catch (IOException e) {
return 0;
} finally {
@@ -158,14 +159,16 @@
}
} else {
String reason = HttpStatus.getStatusText(status);
- Reporter.informUser(this, UserMsg.MISSING_FILE, new Object[] {
+ // TRANSLATOR: Common error condition: {0} is a placeholder for the URL of what could not be found.
+ Reporter.informUser(this, UserMsg.gettext("Unable to find: {0}", new Object[] {
reason + ':' + uri.getPath()
- });
+ }));
}
} catch (IOException e) {
- throw new LucidException(UserMsg.MISSING_FILE, e, new Object[] {
+ // TRANSLATOR: Common error condition: {0} is a placeholder for the URL of what could not be found.
+ throw new LucidException(UserMsg.gettext("Unable to find: {0}", new Object[] {
uri.toString()
- });
+ }), e);
} finally {
// Release the connection.
method.releaseConnection();
Modified: trunk/common/src/main/java/org/crosswire/common/xml/FormatType.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/FormatType.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/FormatType.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -31,11 +31,11 @@
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
public final class FormatType implements Serializable {
- public static final FormatType AS_IS = new FormatType("AS_IS", false, false, false); //$NON-NLS-1$
- public static final FormatType ANALYSIS = new FormatType("ANALYSIS", true, false, false); //$NON-NLS-1$
- public static final FormatType CLASSIC = new FormatType("CLASSIC", true, false, true); //$NON-NLS-1$
- public static final FormatType ANALYSIS_INDENT = new FormatType("ANALYSIS_INDENT", true, true, false); //$NON-NLS-1$
- public static final FormatType CLASSIC_INDENT = new FormatType("CLASSIC_INDENT", true, true, true); //$NON-NLS-1$
+ public static final FormatType AS_IS = new FormatType("AS_IS", false, false, false);
+ public static final FormatType ANALYSIS = new FormatType("ANALYSIS", true, false, false);
+ public static final FormatType CLASSIC = new FormatType("CLASSIC", true, false, true);
+ public static final FormatType ANALYSIS_INDENT = new FormatType("ANALYSIS_INDENT", true, true, false);
+ public static final FormatType CLASSIC_INDENT = new FormatType("CLASSIC_INDENT", true, true, true);
/**
* Simple ctor
Modified: trunk/common/src/main/java/org/crosswire/common/xml/HTMLSerializingContentHandler.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/HTMLSerializingContentHandler.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/HTMLSerializingContentHandler.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -69,9 +69,9 @@
/* @Override */
protected String decorateTagName(String tagName) {
StringBuffer buf = new StringBuffer(50);
- buf.append("<font class='tag'>"); //$NON-NLS-1$
+ buf.append("<font class='tag'>");
buf.append(super.decorateTagName(tagName));
- buf.append("</font>"); //$NON-NLS-1$
+ buf.append("</font>");
return buf.toString();
}
@@ -84,9 +84,9 @@
/* @Override */
protected String decorateAttributeName(String attrName) {
StringBuffer buf = new StringBuffer(50);
- buf.append("<font class='attr'>"); //$NON-NLS-1$
+ buf.append("<font class='attr'>");
buf.append(super.decorateAttributeName(attrName));
- buf.append("</font>"); //$NON-NLS-1$
+ buf.append("</font>");
return buf.toString();
}
@@ -99,9 +99,9 @@
/* @Override */
protected String decorateAttributeValue(String attrValue) {
StringBuffer buf = new StringBuffer(50);
- buf.append("<font class='value'>"); //$NON-NLS-1$
+ buf.append("<font class='value'>");
buf.append(super.decorateAttributeValue(attrValue));
- buf.append("</font>"); //$NON-NLS-1$
+ buf.append("</font>");
return buf.toString();
}
@@ -115,9 +115,9 @@
/* @Override */
protected String decorateCharacters(String characters) {
StringBuffer buf = new StringBuffer(50);
- buf.append("<font class='text'>"); //$NON-NLS-1$
- buf.append(XMLUtil.escape(super.decorateCharacters(characters)).replaceAll("\n", "<br>")); //$NON-NLS-1$ //$NON-NLS-2$
- buf.append("</font>"); //$NON-NLS-1$
+ buf.append("<font class='text'>");
+ buf.append(XMLUtil.escape(super.decorateCharacters(characters)).replaceAll("\n", "<br>"));
+ buf.append("</font>");
return buf.toString();
}
@@ -131,9 +131,9 @@
/* @Override */
protected String decorateIndent(int indentLevel) {
StringBuffer buf = new StringBuffer(100);
- buf.append("<font class='indent'>"); //$NON-NLS-1$
- buf.append(super.decorateIndent(indentLevel).replaceAll("\t", " ")); //$NON-NLS-1$ //$NON-NLS-2$
- buf.append("</font>"); //$NON-NLS-1$
+ buf.append("<font class='indent'>");
+ buf.append(super.decorateIndent(indentLevel).replaceAll("\t", " "));
+ buf.append("</font>");
return buf.toString();
}
@@ -147,7 +147,7 @@
// Note: we should be using SPAN here but Sun's Java does not support
// styling it.
// Also, it introduces whitespace between the span and the text.
- write("<html><head><style type='text/css'>\nFONT.tag { font-family:courier new, monospaced; color:#666699; font-weight:bold; }\nFONT.attr { font-family:courier new, monospaced; color:#669966; font-weight:bold; }\nFONT.value { font-family:courier new, monospaced; color:#669966; font-style:italic; }\nFONT.indent { }\nFONT.text { font-family:courier new, monospaced; background:#FFFF99; }\n</style></head><body>\n"); //$NON-NLS-1$
+ write("<html><head><style type='text/css'>\nFONT.tag { font-family:courier new, monospaced; color:#666699; font-weight:bold; }\nFONT.attr { font-family:courier new, monospaced; color:#669966; font-weight:bold; }\nFONT.value { font-family:courier new, monospaced; color:#669966; font-style:italic; }\nFONT.indent { }\nFONT.text { font-family:courier new, monospaced; background:#FFFF99; }\n</style></head><body>\n");
}
/*
@@ -157,7 +157,7 @@
*/
/* @Override */
public void endDocument() {
- write("</body></head>"); //$NON-NLS-1$
+ write("</body></head>");
}
/*
@@ -232,6 +232,6 @@
*/
/* @Override */
protected String getNewline() {
- return "<br>"; //$NON-NLS-1$
+ return "<br>";
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/xml/PrettySerializingContentHandler.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/PrettySerializingContentHandler.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/PrettySerializingContentHandler.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -142,7 +142,7 @@
for (int i = 0; i < attrs.getLength(); i++) {
write(' ');
write(decorateAttributeName(XMLUtil.getAttributeName(attrs, i)));
- write("='"); //$NON-NLS-1$
+ write("='");
write(decorateAttributeValue(XMLUtil.escape(attrs.getValue(i))));
write('\'');
}
@@ -167,7 +167,7 @@
}
//
// // Hack alert JTextPane cannot handle <br/>
- // if (localname.equalsIgnoreCase("br")) //$NON-NLS-1$
+ // if (localname.equalsIgnoreCase("br"))
// {
write(getTagEnd());
// }
@@ -249,31 +249,31 @@
}
protected String getTagStart() {
- return "<"; //$NON-NLS-1$
+ return "<";
}
protected String getTagEnd() {
- return ">"; //$NON-NLS-1$
+ return ">";
}
protected String getEmptyTagEnd() {
- return "/>"; //$NON-NLS-1$
+ return "/>";
}
protected String getEndTagStart() {
- return "</"; //$NON-NLS-1$
+ return "</";
}
protected String getPIStart() {
- return "<!"; //$NON-NLS-1$
+ return "<!";
}
protected String getPIEnd() {
- return "!>"; //$NON-NLS-1$
+ return "!>";
}
protected String getNewline() {
- return "\n"; //$NON-NLS-1$
+ return "\n";
}
protected String decorateTagName(String tagName) {
Modified: trunk/common/src/main/java/org/crosswire/common/xml/SAXEventProviderXMLReader.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/SAXEventProviderXMLReader.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/SAXEventProviderXMLReader.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -158,7 +158,7 @@
*/
public void parse(InputSource is) throws SAXException {
if (!(is instanceof SAXEventProviderInputSource)) {
- throw new SAXException("SAXEventProviderInputSource required"); //$NON-NLS-1$
+ throw new SAXException("SAXEventProviderInputSource required");
}
docIn.provideSAXEvents(getContentHandler());
@@ -170,7 +170,7 @@
* @see org.xml.sax.XMLReader#parse(java.lang.String)
*/
public void parse(String arg0) throws SAXException {
- throw new SAXException("SAXEventProviderInputSource required"); //$NON-NLS-1$
+ throw new SAXException("SAXEventProviderInputSource required");
}
private SAXEventProvider docIn;
Modified: trunk/common/src/main/java/org/crosswire/common/xml/SerializingContentHandler.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/SerializingContentHandler.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/SerializingContentHandler.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -120,7 +120,7 @@
for (int i = 0; i < attrs.getLength(); i++) {
buffer.append(' ');
buffer.append(XMLUtil.getAttributeName(attrs, i));
- buffer.append("=\""); //$NON-NLS-1$
+ buffer.append("=\"");
buffer.append(attrs.getValue(i));
buffer.append('\"');
}
@@ -139,7 +139,7 @@
* java.lang.String, java.lang.String)
*/
public void endElement(String uri, String localname, String qname) {
- buffer.append("</"); //$NON-NLS-1$
+ buffer.append("</");
if (qname != null) {
buffer.append(qname);
} else {
@@ -180,11 +180,11 @@
* java.lang.String)
*/
public void processingInstruction(String target, String data) {
- buffer.append("<!"); //$NON-NLS-1$
+ buffer.append("<!");
buffer.append(target);
buffer.append(' ');
buffer.append(data);
- buffer.append("!>"); //$NON-NLS-1$
+ buffer.append("!>");
if (newlines) {
buffer.append('\n');
Modified: trunk/common/src/main/java/org/crosswire/common/xml/TransformingSAXEventProvider.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/TransformingSAXEventProvider.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/TransformingSAXEventProvider.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -80,11 +80,11 @@
if (tinfo != null && modtime > tinfo.getModtime()) {
txers.remove(xsluri);
tinfo = null;
- log.debug("updated style, re-caching. xsl=" + xsluri); //$NON-NLS-1$
+ log.debug("updated style, re-caching. xsl=" + xsluri);
}
if (tinfo == null) {
- log.debug("generating templates for " + xsluri); //$NON-NLS-1$
+ log.debug("generating templates for " + xsluri);
InputStream xslStream = null;
try {
Modified: trunk/common/src/main/java/org/crosswire/common/xml/XMLFeature.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XMLFeature.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XMLFeature.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -33,37 +33,37 @@
*/
public class XMLFeature implements Serializable, Comparable {
/** Namespaces feature id */
- public static final XMLFeature NAMESPACES = new XMLFeature("http://xml.org/sax/features/namespaces"); //$NON-NLS-1$
+ public static final XMLFeature NAMESPACES = new XMLFeature("http://xml.org/sax/features/namespaces");
/** Namespace prefixes feature id */
- public static final XMLFeature NAMESPACE_PREFIX = new XMLFeature("http://xml.org/sax/features/namespace-prefixes"); //$NON-NLS-1$
+ public static final XMLFeature NAMESPACE_PREFIX = new XMLFeature("http://xml.org/sax/features/namespace-prefixes");
/** Validation feature id */
- public static final XMLFeature VALIDATION = new XMLFeature("http://xml.org/sax/features/validation"); //$NON-NLS-1$
+ public static final XMLFeature VALIDATION = new XMLFeature("http://xml.org/sax/features/validation");
/** Schema validation feature id */
- public static final XMLFeature SCHEMA_VALIDATION = new XMLFeature("http://apache.org/xml/features/validation/schema"); //$NON-NLS-1$
+ public static final XMLFeature SCHEMA_VALIDATION = new XMLFeature("http://apache.org/xml/features/validation/schema");
/** Schema full checking feature id */
- public static final XMLFeature SCHEMA_FULL_CHECKING = new XMLFeature("http://apache.org/xml/features/validation/schema-full-checking"); //$NON-NLS-1$
+ public static final XMLFeature SCHEMA_FULL_CHECKING = new XMLFeature("http://apache.org/xml/features/validation/schema-full-checking");
/** Validate schema annotations feature id */
- public static final XMLFeature VALIDATE_ANNOTATIONS = new XMLFeature("http://apache.org/xml/features/validate-annotations"); //$NON-NLS-1$
+ public static final XMLFeature VALIDATE_ANNOTATIONS = new XMLFeature("http://apache.org/xml/features/validate-annotations");
/** Dynamic validation feature id */
- public static final XMLFeature DYNAMIC_VALIDATION = new XMLFeature("http://apache.org/xml/features/validation/dynamic"); //$NON-NLS-1$
+ public static final XMLFeature DYNAMIC_VALIDATION = new XMLFeature("http://apache.org/xml/features/validation/dynamic");
/** Load external DTD feature id */
- public static final XMLFeature LOAD_EXTERNAL_DTD = new XMLFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd"); //$NON-NLS-1$
+ public static final XMLFeature LOAD_EXTERNAL_DTD = new XMLFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd");
/** XInclude feature id */
- public static final XMLFeature XINCLUDE = new XMLFeature("http://apache.org/xml/features/xinclude"); //$NON-NLS-1$
+ public static final XMLFeature XINCLUDE = new XMLFeature("http://apache.org/xml/features/xinclude");
/** XInclude fixup base URIs feature id */
- public static final XMLFeature XINCLUDE_FIXUP_BASE_URIS = new XMLFeature("http://apache.org/xml/features/xinclude/fixup-base-uris", true); //$NON-NLS-1$
+ public static final XMLFeature XINCLUDE_FIXUP_BASE_URIS = new XMLFeature("http://apache.org/xml/features/xinclude/fixup-base-uris", true);
/** XInclude fixup language feature id */
- public static final XMLFeature XINCLUDE_FIXUP_LANGUAGE = new XMLFeature("http://apache.org/xml/features/xinclude/fixup-language", true); //$NON-NLS-1$
+ public static final XMLFeature XINCLUDE_FIXUP_LANGUAGE = new XMLFeature("http://apache.org/xml/features/xinclude/fixup-language", true);
/**
* Construct a feature for xml, setting the initial state
@@ -149,7 +149,7 @@
* @see java.lang.Object#toString()
*/
public String toString() {
- return (state ? "on " : "off ") + control; //$NON-NLS-1$ //$NON-NLS-2$
+ return (state ? "on " : "off ") + control;
}
/*
Modified: trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XMLFeatureSet.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -62,17 +62,17 @@
public final class XMLFeatureSet {
public XMLFeatureSet() {
- features.put("n", new XMLFeatureState(XMLFeature.NAMESPACES, true)); //$NON-NLS-1$
- features.put("np", new XMLFeatureState(XMLFeature.NAMESPACE_PREFIX)); //$NON-NLS-1$
- features.put("v", new XMLFeatureState(XMLFeature.VALIDATION)); //$NON-NLS-1$
- features.put("xd", new XMLFeatureState(XMLFeature.LOAD_EXTERNAL_DTD, true)); //$NON-NLS-1$
- features.put("s", new XMLFeatureState(XMLFeature.SCHEMA_VALIDATION)); //$NON-NLS-1$
- features.put("f", new XMLFeatureState(XMLFeature.SCHEMA_FULL_CHECKING)); //$NON-NLS-1$
- features.put("va", new XMLFeatureState(XMLFeature.VALIDATE_ANNOTATIONS)); //$NON-NLS-1$
- features.put("dv", new XMLFeatureState(XMLFeature.DYNAMIC_VALIDATION)); //$NON-NLS-1$
- features.put("xi", new XMLFeatureState(XMLFeature.XINCLUDE)); //$NON-NLS-1$
- features.put("xb", new XMLFeatureState(XMLFeature.XINCLUDE_FIXUP_BASE_URIS, true)); //$NON-NLS-1$
- features.put("xl", new XMLFeatureState(XMLFeature.XINCLUDE_FIXUP_LANGUAGE, true)); //$NON-NLS-1$
+ features.put("n", new XMLFeatureState(XMLFeature.NAMESPACES, true));
+ features.put("np", new XMLFeatureState(XMLFeature.NAMESPACE_PREFIX));
+ features.put("v", new XMLFeatureState(XMLFeature.VALIDATION));
+ features.put("xd", new XMLFeatureState(XMLFeature.LOAD_EXTERNAL_DTD, true));
+ features.put("s", new XMLFeatureState(XMLFeature.SCHEMA_VALIDATION));
+ features.put("f", new XMLFeatureState(XMLFeature.SCHEMA_FULL_CHECKING));
+ features.put("va", new XMLFeatureState(XMLFeature.VALIDATE_ANNOTATIONS));
+ features.put("dv", new XMLFeatureState(XMLFeature.DYNAMIC_VALIDATION));
+ features.put("xi", new XMLFeatureState(XMLFeature.XINCLUDE));
+ features.put("xb", new XMLFeatureState(XMLFeature.XINCLUDE_FIXUP_BASE_URIS, true));
+ features.put("xl", new XMLFeatureState(XMLFeature.XINCLUDE_FIXUP_LANGUAGE, true));
Iterator iter = features.entrySet().iterator();
while (iter.hasNext()) {
@@ -119,27 +119,27 @@
/** Prints the usage. */
public void printUsage() {
- System.err.println("XML Feature Set options:"); //$NON-NLS-1$
- System.err.println(" -n | -N Turn on/off namespace processing."); //$NON-NLS-1$
- System.err.println(" -np | -NP Turn on/off namespace prefixes."); //$NON-NLS-1$
- System.err.println(" NOTE: Requires use of -n."); //$NON-NLS-1$
- System.err.println(" -v | -V Turn on/off validation."); //$NON-NLS-1$
- System.err.println(" -xd | -XD Turn on/off loading of external DTDs."); //$NON-NLS-1$
- System.err.println(" NOTE: Always on when -v in use and not supported by all parsers."); //$NON-NLS-1$
- System.err.println(" -s | -S Turn on/off Schema validation support."); //$NON-NLS-1$
- System.err.println(" NOTE: Not supported by all parsers."); //$NON-NLS-1$
- System.err.println(" -f | -F Turn on/off Schema full checking."); //$NON-NLS-1$
- System.err.println(" NOTE: Requires use of -s and not supported by all parsers."); //$NON-NLS-1$
- System.err.println(" -va | -VA Turn on/off validation of schema annotations."); //$NON-NLS-1$
- System.err.println(" NOTE: Requires use of -s and not supported by all parsers."); //$NON-NLS-1$
- System.err.println(" -dv | -DV Turn on/off dynamic validation."); //$NON-NLS-1$
- System.err.println(" NOTE: Not supported by all parsers."); //$NON-NLS-1$
- System.err.println(" -xi | -XI Turn on/off XInclude processing."); //$NON-NLS-1$
- System.err.println(" NOTE: Not supported by all parsers."); //$NON-NLS-1$
- System.err.println(" -xb | -XB Turn on/off base URI fixup during XInclude processing."); //$NON-NLS-1$
- System.err.println(" NOTE: Requires use of -xi and not supported by all parsers."); //$NON-NLS-1$
- System.err.println(" -xl | -XL Turn on/off language fixup during XInclude processing."); //$NON-NLS-1$
- System.err.println(" NOTE: Requires use of -xi and not supported by all parsers."); //$NON-NLS-1$
+ System.err.println("XML Feature Set options:");
+ System.err.println(" -n | -N Turn on/off namespace processing.");
+ System.err.println(" -np | -NP Turn on/off namespace prefixes.");
+ System.err.println(" NOTE: Requires use of -n.");
+ System.err.println(" -v | -V Turn on/off validation.");
+ System.err.println(" -xd | -XD Turn on/off loading of external DTDs.");
+ System.err.println(" NOTE: Always on when -v in use and not supported by all parsers.");
+ System.err.println(" -s | -S Turn on/off Schema validation support.");
+ System.err.println(" NOTE: Not supported by all parsers.");
+ System.err.println(" -f | -F Turn on/off Schema full checking.");
+ System.err.println(" NOTE: Requires use of -s and not supported by all parsers.");
+ System.err.println(" -va | -VA Turn on/off validation of schema annotations.");
+ System.err.println(" NOTE: Requires use of -s and not supported by all parsers.");
+ System.err.println(" -dv | -DV Turn on/off dynamic validation.");
+ System.err.println(" NOTE: Not supported by all parsers.");
+ System.err.println(" -xi | -XI Turn on/off XInclude processing.");
+ System.err.println(" NOTE: Not supported by all parsers.");
+ System.err.println(" -xb | -XB Turn on/off base URI fixup during XInclude processing.");
+ System.err.println(" NOTE: Requires use of -xi and not supported by all parsers.");
+ System.err.println(" -xl | -XL Turn on/off language fixup during XInclude processing.");
+ System.err.println(" NOTE: Requires use of -xi and not supported by all parsers.");
}
public void setFeatures(XMLReader parser) {
@@ -189,9 +189,9 @@
try {
parser.setFeature(control, state);
} catch (SAXNotRecognizedException e) {
- System.err.println("warning: Parser does not recognize feature (" + control + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.err.println("warning: Parser does not recognize feature (" + control + ")");
} catch (SAXNotSupportedException e) {
- System.err.println("warning: Parser does not support feature (" + control + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.err.println("warning: Parser does not support feature (" + control + ")");
}
}
Modified: trunk/common/src/main/java/org/crosswire/common/xml/XMLHandlerAdapter.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XMLHandlerAdapter.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XMLHandlerAdapter.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -287,7 +287,7 @@
* @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
*/
public void warning(SAXParseException ex) throws SAXException {
- printError("Warning", ex); //$NON-NLS-1$
+ printError("Warning", ex);
}
/*
@@ -296,7 +296,7 @@
* @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
*/
public void error(SAXParseException ex) throws SAXException {
- printError("Error", ex); //$NON-NLS-1$
+ printError("Error", ex);
}
/*
@@ -305,14 +305,14 @@
* @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
*/
public void fatalError(SAXParseException ex) throws SAXException {
- printError("Fatal Error", ex); //$NON-NLS-1$
+ printError("Fatal Error", ex);
}
/** Prints the error message. */
private void printError(String type, SAXParseException ex) {
- System.err.print("["); //$NON-NLS-1$
+ System.err.print("[");
System.err.print(type);
- System.err.print("] "); //$NON-NLS-1$
+ System.err.print("] ");
String systemId = ex.getSystemId();
if (systemId != null) {
int index = systemId.lastIndexOf('/');
@@ -325,7 +325,7 @@
System.err.print(ex.getLineNumber());
System.err.print(':');
System.err.print(ex.getColumnNumber());
- System.err.print(": "); //$NON-NLS-1$
+ System.err.print(": ");
System.err.print(ex.getMessage());
System.err.println();
System.err.flush();
Modified: trunk/common/src/main/java/org/crosswire/common/xml/XMLProcess.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XMLProcess.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XMLProcess.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -71,7 +71,7 @@
arg = argv[i];
if (arg.charAt(0) == '-') {
String option = arg.substring(1);
- if ("h".equals(option)) { //$NON-NLS-1$
+ if ("h".equals(option)) {
checker.usage();
System.exit(0);
}
@@ -90,20 +90,20 @@
String arg = argv[i];
if (arg.charAt(0) == '-') {
String option = arg.substring(1);
- if ("p".equals(option)) { //$NON-NLS-1$
+ if ("p".equals(option)) {
// get parser name
if (++i == argv.length) {
- System.err.println("error: Missing argument to -p option."); //$NON-NLS-1$
+ System.err.println("error: Missing argument to -p option.");
}
parserName = argv[i];
createParser();
continue;
}
- if ("a".equals(option)) { //$NON-NLS-1$
+ if ("a".equals(option)) {
// get parser name
if (++i == argv.length) {
- System.err.println("error: Missing argument to -a option."); //$NON-NLS-1$
+ System.err.println("error: Missing argument to -a option.");
}
adapterName = argv[i];
@@ -135,7 +135,7 @@
try {
parser = XMLReaderFactory.createXMLReader(parserName);
} catch (SAXException e) {
- System.err.println("error: Unable to instantiate parser (" + parserName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.err.println("error: Unable to instantiate parser (" + parserName + ")");
}
}
@@ -148,11 +148,11 @@
try {
adapter = (XMLHandlerAdapter) ClassUtil.forName(adapterName).newInstance();
} catch (ClassNotFoundException e) {
- System.err.println("error: Unable to instantiate XMLHandlerAdpater (" + adapterName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.err.println("error: Unable to instantiate XMLHandlerAdpater (" + adapterName + ")");
} catch (InstantiationException e) {
- System.err.println("error: Unable to instantiate XMLHandlerAdpater (" + adapterName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.err.println("error: Unable to instantiate XMLHandlerAdpater (" + adapterName + ")");
} catch (IllegalAccessException e) {
- System.err.println("error: Unable to instantiate XMLHandlerAdpater (" + adapterName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.err.println("error: Unable to instantiate XMLHandlerAdpater (" + adapterName + ")");
}
}
@@ -179,12 +179,12 @@
bind();
// parse file
try {
- System.out.println("Parsing with the following:"); //$NON-NLS-1$
+ System.out.println("Parsing with the following:");
printActual();
parser.parse(xmlFile);
- System.out.println("Done: no problems found."); //$NON-NLS-1$
+ System.out.println("Done: no problems found.");
} catch (SAXException e) {
- System.err.println("error: Parse error occurred - " + e.getMessage()); //$NON-NLS-1$
+ System.err.println("error: Parse error occurred - " + e.getMessage());
Exception nested = e.getException();
if (nested != null) {
nested.printStackTrace(System.err);
@@ -198,33 +198,33 @@
/** Prints the usage. */
private void usage() {
- System.err.println("usage: java org.crosswire.common.xml.XMLProcess (options) uri"); //$NON-NLS-1$
+ System.err.println("usage: java org.crosswire.common.xml.XMLProcess (options) uri");
System.err.println();
- System.err.println("options:"); //$NON-NLS-1$
+ System.err.println("options:");
printUsage();
- System.err.println(" -h This help screen."); //$NON-NLS-1$
+ System.err.println(" -h This help screen.");
System.err.println();
- System.err.println("defaults:"); //$NON-NLS-1$
+ System.err.println("defaults:");
printDefaults();
}
public void printUsage() {
- System.err.println(" -p name Select parser by name."); //$NON-NLS-1$
- System.err.println(" -a name Select XMLHandlerAdapter by name."); //$NON-NLS-1$
+ System.err.println(" -p name Select parser by name.");
+ System.err.println(" -a name Select XMLHandlerAdapter by name.");
features.printUsage();
}
public void printDefaults() {
- System.err.println("Parser: " + DEFAULT_PARSER_NAME); //$NON-NLS-1$
- System.err.println("Handler: " + DEFAULT_HANDLER_NAME); //$NON-NLS-1$
+ System.err.println("Parser: " + DEFAULT_PARSER_NAME);
+ System.err.println("Handler: " + DEFAULT_HANDLER_NAME);
System.err.println(new XMLFeatureSet().toString());
}
public void printActual() {
- System.err.println("Parser: " + parserName); //$NON-NLS-1$
- System.err.println("Handler: " + adapterName); //$NON-NLS-1$
+ System.err.println("Parser: " + parserName);
+ System.err.println("Handler: " + adapterName);
System.err.println(new XMLFeatureSet().toString());
}
@@ -233,18 +233,18 @@
/**
* Lexical handler property id
*/
- private static final String LEXICAL_HANDLER_PROPERTY_ID = "http://xml.org/sax/properties/lexical-handler"; //$NON-NLS-1$
+ private static final String LEXICAL_HANDLER_PROPERTY_ID = "http://xml.org/sax/properties/lexical-handler";
/**
* Declaration handler property id
*/
- private static final String DECLARATION_HANDLER_PROPERTY_ID = "http://xml.org/sax/properties/declaration-handler"; //$NON-NLS-1$
+ private static final String DECLARATION_HANDLER_PROPERTY_ID = "http://xml.org/sax/properties/declaration-handler";
// default settings
/** Default parser name. */
- private static final String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser"; //$NON-NLS-1$
- private static final String DEFAULT_HANDLER_NAME = "org.crosswire.common.xml.XMLHandlerAdapter"; //$NON-NLS-1$
+ private static final String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser";
+ private static final String DEFAULT_HANDLER_NAME = "org.crosswire.common.xml.XMLHandlerAdapter";
private String parserName = DEFAULT_PARSER_NAME;
private XMLReader parser;
Modified: trunk/common/src/main/java/org/crosswire/common/xml/XMLUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XMLUtil.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XMLUtil.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -70,7 +70,7 @@
String resource = subject + FileUtil.EXTENSION_XML;
InputStream in = ResourceUtil.getResourceAsStream(resource);
- log.debug("Loading " + subject + ".xml from classpath: [OK]"); //$NON-NLS-1$ //$NON-NLS-2$
+ log.debug("Loading " + subject + ".xml from classpath: [OK]");
SAXBuilder builder = new SAXBuilder(true);
return builder.build(in);
}
@@ -110,7 +110,7 @@
*/
public static void debugSAXAttributes(Attributes attrs) {
for (int i = 0; i < attrs.getLength(); i++) {
- log.debug("attr[" + i + "]: " + attrs.getQName(i) + '=' + attrs.getValue(i)); //$NON-NLS-1$ //$NON-NLS-2$
+ log.debug("attr[" + i + "]: " + attrs.getQName(i) + '=' + attrs.getValue(i));
}
}
@@ -128,19 +128,19 @@
char ch = s.charAt(i);
switch (ch) {
case '<':
- str.append("<"); //$NON-NLS-1$
+ str.append("<");
break;
case '>':
- str.append(">"); //$NON-NLS-1$
+ str.append(">");
break;
case '&':
- str.append("&"); //$NON-NLS-1$
+ str.append("&");
break;
case '"':
- str.append("""); //$NON-NLS-1$
+ str.append(""");
break;
default:
@@ -192,7 +192,7 @@
// DataPolice.report("replacing unterminated entity: '" +
// entity + "' with: '" + replace + "'");
- return working.substring(0, amp) + "&" + working.substring(amp + 1); //$NON-NLS-1$
+ return working.substring(0, amp) + "&" + working.substring(amp + 1);
}
// if we have come to a ; then we have an entity
@@ -216,7 +216,7 @@
// log.warn("replacing invalid entity: '" + entity +
// "' with: '" + replace + "': " + broken);
- working = working.substring(0, amp) + "&" + working.substring(amp + 1); //$NON-NLS-1$
+ working = working.substring(0, amp) + "&" + working.substring(amp + 1);
amp = i + 4; // account for the 4 extra characters
break;
}
@@ -242,7 +242,7 @@
* @return the cleaned string
*/
public static String cleanAllCharacters(String broken) {
- return invalidCharacterPattern.matcher(broken).replaceAll(""); //$NON-NLS-1$;
+ return invalidCharacterPattern.matcher(broken).replaceAll("");
}
/**
@@ -258,7 +258,7 @@
return null;
}
- return openHTMLTagPattern.matcher(broken).replaceAll("<$1$2/>"); //$NON-NLS-1$
+ return openHTMLTagPattern.matcher(broken).replaceAll("<$1$2/>");
}
/**
@@ -351,7 +351,7 @@
return replace;
}
- return ""; //$NON-NLS-1$
+ return "";
}
// Map entities to their unicode equivalent
@@ -359,113 +359,113 @@
private static Map badEntities = new HashMap();
static {
// pre-defined XML entities
- goodEntities.add("""); //$NON-NLS-1$ // quotation mark
- goodEntities.add("&"); //$NON-NLS-1$ // ampersand
- goodEntities.add("<"); //$NON-NLS-1$ // less-than sign
- goodEntities.add(">"); //$NON-NLS-1$ // greater-than sign
+ goodEntities.add("""); // quotation mark
+ goodEntities.add("&"); // ampersand
+ goodEntities.add("<"); // less-than sign
+ goodEntities.add(">"); // greater-than sign
// misc entities
- badEntities.put("€", "\u20AC"); //$NON-NLS-1$ //$NON-NLS-2$ // euro
- badEntities.put("‘", "\u2018"); //$NON-NLS-1$ //$NON-NLS-2$ // left single quotation mark
- badEntities.put("’", "\u2019"); //$NON-NLS-1$ //$NON-NLS-2$ // right single quotation mark
+ badEntities.put("€", "\u20AC"); // euro
+ badEntities.put("‘", "\u2018"); // left single quotation mark
+ badEntities.put("’", "\u2019"); // right single quotation mark
// Latin 1 entities
- badEntities.put(" ", "\u00A0"); //$NON-NLS-1$ //$NON-NLS-2$ // no-break space
- badEntities.put("¡", "\u00A1"); //$NON-NLS-1$ //$NON-NLS-2$ // inverted exclamation mark
- badEntities.put("¢", "\u00A2"); //$NON-NLS-1$ //$NON-NLS-2$ // cent sign
- badEntities.put("£", "\u00A3"); //$NON-NLS-1$ //$NON-NLS-2$ // pound sign
- badEntities.put("¤", "\u00A4"); //$NON-NLS-1$ //$NON-NLS-2$ // currency sign
- badEntities.put("¥", "\u00A5"); //$NON-NLS-1$ //$NON-NLS-2$ // yen sign
- badEntities.put("¦", "\u00A6"); //$NON-NLS-1$ //$NON-NLS-2$ // broken vertical bar
- badEntities.put("§", "\u00A7"); //$NON-NLS-1$ //$NON-NLS-2$ // section sign
- badEntities.put("¨", "\u00A8"); //$NON-NLS-1$ //$NON-NLS-2$ // diaeresis
- badEntities.put("©", "\u00A9"); //$NON-NLS-1$ //$NON-NLS-2$ // copyright sign
- badEntities.put("ª", "\u00AA"); //$NON-NLS-1$ //$NON-NLS-2$ // feminine ordinal indicator
- badEntities.put("«", "\u00AB"); //$NON-NLS-1$ //$NON-NLS-2$ // left-pointing double angle quotation mark
- badEntities.put("¬", "\u00AC"); //$NON-NLS-1$ //$NON-NLS-2$ // not sign
- badEntities.put("­", "\u00AD"); //$NON-NLS-1$ //$NON-NLS-2$ // soft hyphen
- badEntities.put("®", "\u00AE"); //$NON-NLS-1$ //$NON-NLS-2$ // registered sign
- badEntities.put("¯", "\u00AF"); //$NON-NLS-1$ //$NON-NLS-2$ // macron
- badEntities.put("°", "\u00B0"); //$NON-NLS-1$ //$NON-NLS-2$ // degree sign
- badEntities.put("±", "\u00B1"); //$NON-NLS-1$ //$NON-NLS-2$ // plus-minus sign
- badEntities.put("²", "\u00B2"); //$NON-NLS-1$ //$NON-NLS-2$ // superscript two
- badEntities.put("³", "\u00B3"); //$NON-NLS-1$ //$NON-NLS-2$ // superscript three
- badEntities.put("´", "\u00B4"); //$NON-NLS-1$ //$NON-NLS-2$ // acute accent
- badEntities.put("µ", "\u00B5"); //$NON-NLS-1$ //$NON-NLS-2$ // micro sign
- badEntities.put("¶", "\u00B6"); //$NON-NLS-1$ //$NON-NLS-2$ // pilcrow sign
- badEntities.put("·", "\u00B7"); //$NON-NLS-1$ //$NON-NLS-2$ // middle dot
- badEntities.put("¸", "\u00B8"); //$NON-NLS-1$ //$NON-NLS-2$ // cedilla
- badEntities.put("¹", "\u00B9"); //$NON-NLS-1$ //$NON-NLS-2$ // superscript one
- badEntities.put("º", "\u00BA"); //$NON-NLS-1$ //$NON-NLS-2$ // masculine ordinal indicator
- badEntities.put("»", "\u00BB"); //$NON-NLS-1$ //$NON-NLS-2$ // right-pointing double angle quotation mark
- badEntities.put("¼", "\u00BC"); //$NON-NLS-1$ //$NON-NLS-2$ // vulgar fraction one quarter
- badEntities.put("½", "\u00BD"); //$NON-NLS-1$ //$NON-NLS-2$ // vulgar fraction one half
- badEntities.put("¾", "\u00BE"); //$NON-NLS-1$ //$NON-NLS-2$ // vulgar fraction three quarters
- badEntities.put("¿", "\u00BF"); //$NON-NLS-1$ //$NON-NLS-2$ // inverted question mark
- badEntities.put("À", "\u00C0"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter A with grave
- badEntities.put("Á", "\u00C1"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter A with acute
- badEntities.put("Â", "\u00C2"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter A with circumflex
- badEntities.put("Ã", "\u00C3"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter A with tilde
- badEntities.put("Ä", "\u00C4"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter A with diaeresis
- badEntities.put("Å", "\u00C5"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter A with ring above
- badEntities.put("Æ", "\u00C6"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter AE
- badEntities.put("Ç", "\u00C7"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter C with cedilla
- badEntities.put("È", "\u00C8"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter E with grave
- badEntities.put("É", "\u00C9"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter E with acute
- badEntities.put("Ê", "\u00CA"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter E with circumflex
- badEntities.put("Ë", "\u00CB"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter E with diaeresis
- badEntities.put("Ì", "\u00CC"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter I with grave
- badEntities.put("Í", "\u00CD"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter I with acute
- badEntities.put("Î", "\u00CE"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter I with circumflex
- badEntities.put("Ï", "\u00CF"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter I with diaeresis
- badEntities.put("Ð", "\u00D0"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter ETH
- badEntities.put("Ñ", "\u00D1"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter N with tilde
- badEntities.put("Ò", "\u00D2"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter O with grave
- badEntities.put("Ó", "\u00D3"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter O with acute
- badEntities.put("Ô", "\u00D4"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter O with circumflex
- badEntities.put("Õ", "\u00D5"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter O with tilde
- badEntities.put("Ö", "\u00D6"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter O with diaeresis
- badEntities.put("×", "\u00D7"); //$NON-NLS-1$ //$NON-NLS-2$ // multiplication sign
- badEntities.put("Ø", "\u00D8"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter O with stroke
- badEntities.put("Ù", "\u00D9"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter U with grave
- badEntities.put("Ú", "\u00DA"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter U with acute
- badEntities.put("Û", "\u00DB"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter U with circumflex
- badEntities.put("Ü", "\u00DC"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter U with diaeresis
- badEntities.put("Ý", "\u00DD"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter Y with acute
- badEntities.put("Þ", "\u00DE"); //$NON-NLS-1$ //$NON-NLS-2$ // latin capital letter THORN
- badEntities.put("ß", "\u00DF"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter sharp s
- badEntities.put("à", "\u00E0"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter a with grave
- badEntities.put("á", "\u00E1"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter a with acute
- badEntities.put("â", "\u00E2"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter a with circumflex
- badEntities.put("ã", "\u00E3"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter a with tilde
- badEntities.put("ä", "\u00E4"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter a with diaeresis
- badEntities.put("å", "\u00E5"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter a with ring above
- badEntities.put("æ", "\u00E6"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter ae
- badEntities.put("ç", "\u00E7"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter c with cedilla
- badEntities.put("è", "\u00E8"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter e with grave
- badEntities.put("é", "\u00E9"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter e with acute
- badEntities.put("ê", "\u00EA"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter e with circumflex
- badEntities.put("ë", "\u00EB"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter e with diaeresis
- badEntities.put("ì", "\u00EC"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter i with grave
- badEntities.put("í", "\u00ED"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter i with acute
- badEntities.put("î", "\u00EE"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter i with circumflex
- badEntities.put("ï", "\u00EF"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter i with diaeresis
- badEntities.put("ð", "\u00F0"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter eth
- badEntities.put("ñ", "\u00F1"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter n with tilde
- badEntities.put("ò", "\u00F2"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter o with grave
- badEntities.put("ó", "\u00F3"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter o with acute
- badEntities.put("ô", "\u00F4"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter o with circumflex
- badEntities.put("õ", "\u00F5"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter o with tilde
- badEntities.put("ö", "\u00F6"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter o with diaeresis
- badEntities.put("÷", "\u00F7"); //$NON-NLS-1$ //$NON-NLS-2$ // division sign
- badEntities.put("ø", "\u00F8"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter o with stroke
- badEntities.put("ù", "\u00F9"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter u with grave
- badEntities.put("ú", "\u00FA"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter u with acute
- badEntities.put("û", "\u00FB"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter u with circumflex
- badEntities.put("ü", "\u00FC"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter u with diaeresis
- badEntities.put("ý", "\u00FD"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter y with acute
- badEntities.put("þ", "\u00FE"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter thorn
- badEntities.put("ÿ", "\u00FF"); //$NON-NLS-1$ //$NON-NLS-2$ // latin small letter y with diaeresis
+ badEntities.put(" ", "\u00A0"); // no-break space
+ badEntities.put("¡", "\u00A1"); // inverted exclamation mark
+ badEntities.put("¢", "\u00A2"); // cent sign
+ badEntities.put("£", "\u00A3"); // pound sign
+ badEntities.put("¤", "\u00A4"); // currency sign
+ badEntities.put("¥", "\u00A5"); // yen sign
+ badEntities.put("¦", "\u00A6"); // broken vertical bar
+ badEntities.put("§", "\u00A7"); // section sign
+ badEntities.put("¨", "\u00A8"); // diaeresis
+ badEntities.put("©", "\u00A9"); // copyright sign
+ badEntities.put("ª", "\u00AA"); // feminine ordinal indicator
+ badEntities.put("«", "\u00AB"); // left-pointing double angle quotation mark
+ badEntities.put("¬", "\u00AC"); // not sign
+ badEntities.put("­", "\u00AD"); // soft hyphen
+ badEntities.put("®", "\u00AE"); // registered sign
+ badEntities.put("¯", "\u00AF"); // macron
+ badEntities.put("°", "\u00B0"); // degree sign
+ badEntities.put("±", "\u00B1"); // plus-minus sign
+ badEntities.put("²", "\u00B2"); // superscript two
+ badEntities.put("³", "\u00B3"); // superscript three
+ badEntities.put("´", "\u00B4"); // acute accent
+ badEntities.put("µ", "\u00B5"); // micro sign
+ badEntities.put("¶", "\u00B6"); // pilcrow sign
+ badEntities.put("·", "\u00B7"); // middle dot
+ badEntities.put("¸", "\u00B8"); // cedilla
+ badEntities.put("¹", "\u00B9"); // superscript one
+ badEntities.put("º", "\u00BA"); // masculine ordinal indicator
+ badEntities.put("»", "\u00BB"); // right-pointing double angle quotation mark
+ badEntities.put("¼", "\u00BC"); // vulgar fraction one quarter
+ badEntities.put("½", "\u00BD"); // vulgar fraction one half
+ badEntities.put("¾", "\u00BE"); // vulgar fraction three quarters
+ badEntities.put("¿", "\u00BF"); // inverted question mark
+ badEntities.put("À", "\u00C0"); // latin capital letter A with grave
+ badEntities.put("Á", "\u00C1"); // latin capital letter A with acute
+ badEntities.put("Â", "\u00C2"); // latin capital letter A with circumflex
+ badEntities.put("Ã", "\u00C3"); // latin capital letter A with tilde
+ badEntities.put("Ä", "\u00C4"); // latin capital letter A with diaeresis
+ badEntities.put("Å", "\u00C5"); // latin capital letter A with ring above
+ badEntities.put("Æ", "\u00C6"); // latin capital letter AE
+ badEntities.put("Ç", "\u00C7"); // latin capital letter C with cedilla
+ badEntities.put("È", "\u00C8"); // latin capital letter E with grave
+ badEntities.put("É", "\u00C9"); // latin capital letter E with acute
+ badEntities.put("Ê", "\u00CA"); // latin capital letter E with circumflex
+ badEntities.put("Ë", "\u00CB"); // latin capital letter E with diaeresis
+ badEntities.put("Ì", "\u00CC"); // latin capital letter I with grave
+ badEntities.put("Í", "\u00CD"); // latin capital letter I with acute
+ badEntities.put("Î", "\u00CE"); // latin capital letter I with circumflex
+ badEntities.put("Ï", "\u00CF"); // latin capital letter I with diaeresis
+ badEntities.put("Ð", "\u00D0"); // latin capital letter ETH
+ badEntities.put("Ñ", "\u00D1"); // latin capital letter N with tilde
+ badEntities.put("Ò", "\u00D2"); // latin capital letter O with grave
+ badEntities.put("Ó", "\u00D3"); // latin capital letter O with acute
+ badEntities.put("Ô", "\u00D4"); // latin capital letter O with circumflex
+ badEntities.put("Õ", "\u00D5"); // latin capital letter O with tilde
+ badEntities.put("Ö", "\u00D6"); // latin capital letter O with diaeresis
+ badEntities.put("×", "\u00D7"); // multiplication sign
+ badEntities.put("Ø", "\u00D8"); // latin capital letter O with stroke
+ badEntities.put("Ù", "\u00D9"); // latin capital letter U with grave
+ badEntities.put("Ú", "\u00DA"); // latin capital letter U with acute
+ badEntities.put("Û", "\u00DB"); // latin capital letter U with circumflex
+ badEntities.put("Ü", "\u00DC"); // latin capital letter U with diaeresis
+ badEntities.put("Ý", "\u00DD"); // latin capital letter Y with acute
+ badEntities.put("Þ", "\u00DE"); // latin capital letter THORN
+ badEntities.put("ß", "\u00DF"); // latin small letter sharp s
+ badEntities.put("à", "\u00E0"); // latin small letter a with grave
+ badEntities.put("á", "\u00E1"); // latin small letter a with acute
+ badEntities.put("â", "\u00E2"); // latin small letter a with circumflex
+ badEntities.put("ã", "\u00E3"); // latin small letter a with tilde
+ badEntities.put("ä", "\u00E4"); // latin small letter a with diaeresis
+ badEntities.put("å", "\u00E5"); // latin small letter a with ring above
+ badEntities.put("æ", "\u00E6"); // latin small letter ae
+ badEntities.put("ç", "\u00E7"); // latin small letter c with cedilla
+ badEntities.put("è", "\u00E8"); // latin small letter e with grave
+ badEntities.put("é", "\u00E9"); // latin small letter e with acute
+ badEntities.put("ê", "\u00EA"); // latin small letter e with circumflex
+ badEntities.put("ë", "\u00EB"); // latin small letter e with diaeresis
+ badEntities.put("ì", "\u00EC"); // latin small letter i with grave
+ badEntities.put("í", "\u00ED"); // latin small letter i with acute
+ badEntities.put("î", "\u00EE"); // latin small letter i with circumflex
+ badEntities.put("ï", "\u00EF"); // latin small letter i with diaeresis
+ badEntities.put("ð", "\u00F0"); // latin small letter eth
+ badEntities.put("ñ", "\u00F1"); // latin small letter n with tilde
+ badEntities.put("ò", "\u00F2"); // latin small letter o with grave
+ badEntities.put("ó", "\u00F3"); // latin small letter o with acute
+ badEntities.put("ô", "\u00F4"); // latin small letter o with circumflex
+ badEntities.put("õ", "\u00F5"); // latin small letter o with tilde
+ badEntities.put("ö", "\u00F6"); // latin small letter o with diaeresis
+ badEntities.put("÷", "\u00F7"); // division sign
+ badEntities.put("ø", "\u00F8"); // latin small letter o with stroke
+ badEntities.put("ù", "\u00F9"); // latin small letter u with grave
+ badEntities.put("ú", "\u00FA"); // latin small letter u with acute
+ badEntities.put("û", "\u00FB"); // latin small letter u with circumflex
+ badEntities.put("ü", "\u00FC"); // latin small letter u with diaeresis
+ badEntities.put("ý", "\u00FD"); // latin small letter y with acute
+ badEntities.put("þ", "\u00FE"); // latin small letter thorn
+ badEntities.put("ÿ", "\u00FF"); // latin small letter y with diaeresis
}
/**
@@ -476,17 +476,17 @@
/**
* Pattern for numeric entities.
*/
- private static Pattern validCharacterEntityPattern = Pattern.compile("^&#x?\\d{2,4};"); //$NON-NLS-1$
+ private static Pattern validCharacterEntityPattern = Pattern.compile("^&#x?\\d{2,4};");
/**
* Pattern that negates the allowable XML 4 byte unicode characters. Valid
* are: #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |
* [#x10000-#x10FFFF]
*/
- private static Pattern invalidCharacterPattern = Pattern.compile("[^\t\r\n\u0020-\uD7FF\uE000-\uFFFD]"); //$NON-NLS-1$
+ private static Pattern invalidCharacterPattern = Pattern.compile("[^\t\r\n\u0020-\uD7FF\uE000-\uFFFD]");
/**
* Pattern that matches open <br>,<hr> and <img> tags.
*/
- private static Pattern openHTMLTagPattern = Pattern.compile("<(img|hr|br)([^>]*)(?<!/)>"); //$NON-NLS-1$
+ private static Pattern openHTMLTagPattern = Pattern.compile("<(img|hr|br)([^>]*)(?<!/)>");
}
Modified: trunk/common/src/main/java/org/crosswire/common/xml/XalanProcess.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/XalanProcess.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/main/java/org/crosswire/common/xml/XalanProcess.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -52,13 +52,13 @@
Method main = null;
try {
// Try for 1.4.x
- clazz = ClassUtil.forName("org.apache.xalan.xslt.Process"); //$NON-NLS-1$
- main = clazz.getMethod("main", new Class[] { String[].class}); //$NON-NLS-1$
+ clazz = ClassUtil.forName("org.apache.xalan.xslt.Process");
+ main = clazz.getMethod("main", new Class[] { String[].class});
} catch (ClassNotFoundException e) {
try {
// Try for 1.5.x
- clazz = ClassUtil.forName("com.sun.org.apache.xalan.internal.xslt.Process"); //$NON-NLS-1$
- main = clazz.getMethod("_main", new Class[] { String[].class}); //$NON-NLS-1$
+ clazz = ClassUtil.forName("com.sun.org.apache.xalan.internal.xslt.Process");
+ main = clazz.getMethod("_main", new Class[] { String[].class});
} catch (ClassNotFoundException e1) {
e1.printStackTrace(System.err);
} catch (SecurityException e1) {
Modified: trunk/common/src/test/java/org/crosswire/common/compress/AllTests.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/compress/AllTests.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/compress/AllTests.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -33,7 +33,7 @@
*/
public class AllTests {
public static Test suite() {
- TestSuite suite = new TestSuite("Test for org.crosswire.common.compress"); //$NON-NLS-1$
+ TestSuite suite = new TestSuite("Test for org.crosswire.common.compress");
// $JUnit-BEGIN$
suite.addTest(new TestSuite(LZSSTest.class));
// $JUnit-END$
Modified: trunk/common/src/test/java/org/crosswire/common/compress/LZSSTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/compress/LZSSTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/compress/LZSSTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -97,7 +97,7 @@
public void testCompression() {
InputStream kjvGenesis = null;
try {
- kjvGenesis = ResourceUtil.getResourceAsStream("kjv_genesis.txt"); //$NON-NLS-1$
+ kjvGenesis = ResourceUtil.getResourceAsStream("kjv_genesis.txt");
} catch (MissingResourceException e) {
fail();
} catch (IOException e) {
@@ -122,7 +122,7 @@
}
try {
byte[] back = bosUncompressed.toByteArray();
- String result = new String(back, "UTF-8"); //$NON-NLS-1$
+ String result = new String(back, "UTF-8");
System.out.println(result);
} catch (UnsupportedEncodingException e) {
fail();
Modified: trunk/common/src/test/java/org/crosswire/common/diff/AllTests.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/AllTests.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/AllTests.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -33,7 +33,7 @@
*/
public class AllTests {
public static Test suite() {
- TestSuite suite = new TestSuite("Test for org.crosswire.common.diff"); //$NON-NLS-1$
+ TestSuite suite = new TestSuite("Test for org.crosswire.common.diff");
// $JUnit-BEGIN$
suite.addTest(new TestSuite(BitapTest.class));
suite.addTest(new TestSuite(CommonalityTest.class));
Modified: trunk/common/src/test/java/org/crosswire/common/diff/BitapTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/BitapTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/BitapTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -24,16 +24,16 @@
bitmask.put(new Character('a'), new Integer(4));
bitmask.put(new Character('b'), new Integer(2));
bitmask.put(new Character('c'), new Integer(1));
- Bitap bitap = new Bitap("", "abc", 0); //$NON-NLS-1$ //$NON-NLS-2$
+ Bitap bitap = new Bitap("", "abc", 0);
bitap.alphabet();
- assertEquals("match_alphabet: Unique.", bitmask, bitap.getAlphabet()); //$NON-NLS-1$
+ assertEquals("match_alphabet: Unique.", bitmask, bitap.getAlphabet());
bitmask = new HashMap();
bitmask.put(new Character('a'), new Integer(37));
bitmask.put(new Character('b'), new Integer(18));
bitmask.put(new Character('c'), new Integer(8));
- bitap = new Bitap("", "abcaba", 0); //$NON-NLS-1$ //$NON-NLS-2$
+ bitap = new Bitap("", "abcaba", 0);
bitap.alphabet();
- assertEquals("match_alphabet: Duplicates.", bitmask, bitap.getAlphabet()); //$NON-NLS-1$
+ assertEquals("match_alphabet: Duplicates.", bitmask, bitap.getAlphabet());
}
public void testBitap() {
@@ -42,25 +42,25 @@
Bitap.setThreshold(0.5f);
Bitap.setMinLength(100);
Bitap.setMaxLength(1000);
- assertEquals("match_bitap: Exact match #1.", 5, new Bitap("abcdefghijk", "fgh", 5).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_bitap: Exact match #2.", 5, new Bitap("abcdefghijk", "fgh", 0).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_bitap: Fuzzy match #1.", 4, new Bitap("abcdefghijk", "efxhi", 0).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_bitap: Fuzzy match #2.", 2, new Bitap("abcdefghijk", "cdefxyhijk", 5).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_bitap: Fuzzy match #3.", -1, new Bitap("abcdefghijk", "bxy", 1).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_bitap: Overflow.", 2, new Bitap("123456789xx0", "3456789x0", 2).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("match_bitap: Exact match #1.", 5, new Bitap("abcdefghijk", "fgh", 5).locate());
+ assertEquals("match_bitap: Exact match #2.", 5, new Bitap("abcdefghijk", "fgh", 0).locate());
+ assertEquals("match_bitap: Fuzzy match #1.", 4, new Bitap("abcdefghijk", "efxhi", 0).locate());
+ assertEquals("match_bitap: Fuzzy match #2.", 2, new Bitap("abcdefghijk", "cdefxyhijk", 5).locate());
+ assertEquals("match_bitap: Fuzzy match #3.", -1, new Bitap("abcdefghijk", "bxy", 1).locate());
+ assertEquals("match_bitap: Overflow.", 2, new Bitap("123456789xx0", "3456789x0", 2).locate());
Bitap.setThreshold(0.75f);
- assertEquals("match_bitap: Threshold #1.", 4, new Bitap("abcdefghijk", "efxyhi", 1).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("match_bitap: Threshold #1.", 4, new Bitap("abcdefghijk", "efxyhi", 1).locate());
Bitap.setThreshold(0.1f);
- assertEquals("match_bitap: Threshold #2.", 1, new Bitap("abcdefghijk", "bcdef", 1).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("match_bitap: Threshold #2.", 1, new Bitap("abcdefghijk", "bcdef", 1).locate());
Bitap.setThreshold(0.5f);
- assertEquals("match_bitap: Multiple select #1.", 0, new Bitap("abcdexyzabcde", "abccde", 3).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_bitap: Multiple select #2.", 8, new Bitap("abcdexyzabcde", "abccde", 5).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("match_bitap: Multiple select #1.", 0, new Bitap("abcdexyzabcde", "abccde", 3).locate());
+ assertEquals("match_bitap: Multiple select #2.", 8, new Bitap("abcdexyzabcde", "abccde", 5).locate());
Bitap.setBalance(0.6f); // Strict location, loose accuracy.
- assertEquals("match_bitap: Balance test #1.", -1, new Bitap("abcdefghijklmnopqrstuvwxyz", "abcdefg", 24).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_bitap: Balance test #2.", 0, new Bitap("abcdefghijklmnopqrstuvwxyz", "abcxdxexfgh", 1).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("match_bitap: Balance test #1.", -1, new Bitap("abcdefghijklmnopqrstuvwxyz", "abcdefg", 24).locate());
+ assertEquals("match_bitap: Balance test #2.", 0, new Bitap("abcdefghijklmnopqrstuvwxyz", "abcxdxexfgh", 1).locate());
Bitap.setBalance(0.4f); // Strict accuracy loose location.
- assertEquals("match_bitap: Balance test #3.", 0, new Bitap("abcdefghijklmnopqrstuvwxyz", "abcdefg", 24).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_bitap: Balance test #4.", -1, new Bitap("abcdefghijklmnopqrstuvwxyz", "abcxdxexfgh", 1).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("match_bitap: Balance test #3.", 0, new Bitap("abcdefghijklmnopqrstuvwxyz", "abcdefg", 24).locate());
+ assertEquals("match_bitap: Balance test #4.", -1, new Bitap("abcdefghijklmnopqrstuvwxyz", "abcxdxexfgh", 1).locate());
Bitap.setBalance(0.5f);
}
Modified: trunk/common/src/test/java/org/crosswire/common/diff/CommonalityTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/CommonalityTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/CommonalityTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -16,28 +16,28 @@
public void testPrefix() {
// Detect and remove any common prefix.
- assertEquals("Commonality.prefix: Null case.", 0, Commonality.prefix("abc", "xyz")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Commonality.prefix: Non-null case.", 4, Commonality.prefix("1234abc", "1234xyz")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("Commonality.prefix: Null case.", 0, Commonality.prefix("abc", "xyz"));
+ assertEquals("Commonality.prefix: Non-null case.", 4, Commonality.prefix("1234abc", "1234xyz"));
}
public void testSuffix() {
// Detect and remove any common suffix.
- assertEquals("Commonality.suffix: Null case.", 0, Commonality.suffix("abc", "xyz")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Commonality.suffix: Non-null case.", 4, Commonality.suffix("abc1234", "xyz1234")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("Commonality.suffix: Null case.", 0, Commonality.suffix("abc", "xyz"));
+ assertEquals("Commonality.suffix: Non-null case.", 4, Commonality.suffix("abc1234", "xyz1234"));
}
public void testHalfmatch() {
// Detect a halfmatch.
- assertNull("Commonality.halfMatch: No match.", Commonality.halfMatch("1234567890", "abcdef")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertNull("Commonality.halfMatch: No match.", Commonality.halfMatch("1234567890", "abcdef"));
assertEquals(
- "Commonality.halfMatch: Single Match #1.", new CommonMiddle("12", "90", "a", "z", "345678"), Commonality.halfMatch("1234567890", "a345678z")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ "Commonality.halfMatch: Single Match #1.", new CommonMiddle("12", "90", "a", "z", "345678"), Commonality.halfMatch("1234567890", "a345678z"));
assertEquals(
- "Commonality.halfMatch: Single Match #2.", new CommonMiddle("a", "z", "12", "90", "345678"), Commonality.halfMatch("a345678z", "1234567890")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ "Commonality.halfMatch: Single Match #2.", new CommonMiddle("a", "z", "12", "90", "345678"), Commonality.halfMatch("a345678z", "1234567890"));
assertEquals(
- "Commonality.halfMatch: Multiple Matches #1.", new CommonMiddle("12123", "123121", "a", "z", "1234123451234"), Commonality.halfMatch("121231234123451234123121", "a1234123451234z")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ "Commonality.halfMatch: Multiple Matches #1.", new CommonMiddle("12123", "123121", "a", "z", "1234123451234"), Commonality.halfMatch("121231234123451234123121", "a1234123451234z"));
assertEquals(
- "Commonality.halfMatch: Multiple Matches #2.", new CommonMiddle("", "-=-=-=-=-=", "x", "", "x-=-=-=-=-=-=-="), Commonality.halfMatch("x-=-=-=-=-=-=-=-=-=-=-=-=", "xx-=-=-=-=-=-=-=")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ "Commonality.halfMatch: Multiple Matches #2.", new CommonMiddle("", "-=-=-=-=-=", "x", "", "x-=-=-=-=-=-=-="), Commonality.halfMatch("x-=-=-=-=-=-=-=-=-=-=-=-=", "xx-=-=-=-=-=-=-="));
assertEquals(
- "Commonality.halfMatch: Multiple Matches #3.", new CommonMiddle("-=-=-=-=-=", "", "", "y", "-=-=-=-=-=-=-=y"), Commonality.halfMatch("-=-=-=-=-=-=-=-=-=-=-=-=y", "-=-=-=-=-=-=-=yy")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ "Commonality.halfMatch: Multiple Matches #3.", new CommonMiddle("-=-=-=-=-=", "", "", "y", "-=-=-=-=-=-=-=y"), Commonality.halfMatch("-=-=-=-=-=-=-=-=-=-=-=-=y", "-=-=-=-=-=-=-=yy"));
}
}
Modified: trunk/common/src/test/java/org/crosswire/common/diff/DiffCleanupTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/DiffCleanupTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/DiffCleanupTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -15,56 +15,56 @@
// Cleanup a messy diff
List diffs = diffList();
DiffCleanup.cleanupMerge(diffs);
- assertEquals("DiffCleanup.cleanupMerge: Null case.", diffList(), diffs); //$NON-NLS-1$
+ assertEquals("DiffCleanup.cleanupMerge: Null case.", diffList(), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "b"), new Difference(EditType.INSERT, "c")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "b"), new Difference(EditType.INSERT, "c")});
DiffCleanup.cleanupMerge(diffs);
assertEquals(
- "DiffCleanup.cleanupMerge: No change case.", diffList(new Object[] { new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "b"), new Difference(EditType.INSERT, "c")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "DiffCleanup.cleanupMerge: No change case.", diffList(new Object[] { new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "b"), new Difference(EditType.INSERT, "c")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "a"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.EQUAL, "c")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.EQUAL, "a"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.EQUAL, "c")});
DiffCleanup.cleanupMerge(diffs);
- assertEquals("DiffCleanup.cleanupMerge: Merge equalities.", diffList(new Object[] { new Difference(EditType.EQUAL, "abc")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("DiffCleanup.cleanupMerge: Merge equalities.", diffList(new Object[] { new Difference(EditType.EQUAL, "abc")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "a"), new Difference(EditType.DELETE, "b"), new Difference(EditType.DELETE, "c")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.DELETE, "a"), new Difference(EditType.DELETE, "b"), new Difference(EditType.DELETE, "c")});
DiffCleanup.cleanupMerge(diffs);
- assertEquals("DiffCleanup.cleanupMerge: Merge deletions.", diffList(new Object[] { new Difference(EditType.DELETE, "abc")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("DiffCleanup.cleanupMerge: Merge deletions.", diffList(new Object[] { new Difference(EditType.DELETE, "abc")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.INSERT, "a"), new Difference(EditType.INSERT, "b"), new Difference(EditType.INSERT, "c")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.INSERT, "a"), new Difference(EditType.INSERT, "b"), new Difference(EditType.INSERT, "c")});
DiffCleanup.cleanupMerge(diffs);
- assertEquals("DiffCleanup.cleanupMerge: Merge insertions.", diffList(new Object[] { new Difference(EditType.INSERT, "abc")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("DiffCleanup.cleanupMerge: Merge insertions.", diffList(new Object[] { new Difference(EditType.INSERT, "abc")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "b"), new Difference(EditType.DELETE, "c"), new Difference(EditType.INSERT, "d"), new Difference(EditType.EQUAL, "e"), new Difference(EditType.EQUAL, "f")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "b"), new Difference(EditType.DELETE, "c"), new Difference(EditType.INSERT, "d"), new Difference(EditType.EQUAL, "e"), new Difference(EditType.EQUAL, "f")});
DiffCleanup.cleanupMerge(diffs);
assertEquals(
- "DiffCleanup.cleanupMerge: Merge interweave.", diffList(new Object[] { new Difference(EditType.DELETE, "ac"), new Difference(EditType.INSERT, "bd"), new Difference(EditType.EQUAL, "ef")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "DiffCleanup.cleanupMerge: Merge interweave.", diffList(new Object[] { new Difference(EditType.DELETE, "ac"), new Difference(EditType.INSERT, "bd"), new Difference(EditType.EQUAL, "ef")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "abc"), new Difference(EditType.DELETE, "dc")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "abc"), new Difference(EditType.DELETE, "dc")});
DiffCleanup.cleanupMerge(diffs);
assertEquals(
- "DiffCleanup.cleanupMerge: Prefix and suffix detection.", diffList(new Object[] { new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "d"), new Difference(EditType.INSERT, "b"), new Difference(EditType.EQUAL, "c")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "DiffCleanup.cleanupMerge: Prefix and suffix detection.", diffList(new Object[] { new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "d"), new Difference(EditType.INSERT, "b"), new Difference(EditType.EQUAL, "c")}), diffs);
}
public void testDiffCleanupSemantic() {
// Cleanup semantically trivial equalities
List diffs = diffList();
DiffCleanup.cleanupSemantic(diffs);
- assertEquals("DiffCleanup.cleanupSemantic: Null case.", diffList(), diffs); //$NON-NLS-1$
+ assertEquals("DiffCleanup.cleanupSemantic: Null case.", diffList(), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "b"), new Difference(EditType.EQUAL, "cd"), new Difference(EditType.DELETE, "e")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "b"), new Difference(EditType.EQUAL, "cd"), new Difference(EditType.DELETE, "e")});
DiffCleanup.cleanupSemantic(diffs);
assertEquals(
- "DiffCleanup.cleanupSemantic: No elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "b"), new Difference(EditType.EQUAL, "cd"), new Difference(EditType.DELETE, "e")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "DiffCleanup.cleanupSemantic: No elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "b"), new Difference(EditType.EQUAL, "cd"), new Difference(EditType.DELETE, "e")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "a"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.DELETE, "c")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.DELETE, "a"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.DELETE, "c")});
DiffCleanup.cleanupSemantic(diffs);
assertEquals(
- "DiffCleanup.cleanupSemantic: Simple elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abc"), new Difference(EditType.INSERT, "b")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "DiffCleanup.cleanupSemantic: Simple elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abc"), new Difference(EditType.INSERT, "b")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "ab"), new Difference(EditType.EQUAL, "cd"), new Difference(EditType.DELETE, "e"), new Difference(EditType.EQUAL, "f"), new Difference(EditType.INSERT, "g")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new Difference(EditType.DELETE, "ab"), new Difference(EditType.EQUAL, "cd"), new Difference(EditType.DELETE, "e"), new Difference(EditType.EQUAL, "f"), new Difference(EditType.INSERT, "g")});
DiffCleanup.cleanupSemantic(diffs);
assertEquals(
- "DiffCleanup.cleanupSemantic: Backpass elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abcdef"), new Difference(EditType.INSERT, "cdfg")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "DiffCleanup.cleanupSemantic: Backpass elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abcdef"), new Difference(EditType.INSERT, "cdfg")}), diffs);
}
public void testDiffCleanupEfficiency() {
@@ -72,33 +72,33 @@
DiffCleanup.setEditCost(4);
List diffs = diffList();
DiffCleanup.cleanupEfficiency(diffs);
- assertEquals("DiffCleanup.cleanupEfficiency: Null case.", diffList(), diffs); //$NON-NLS-1$
+ assertEquals("DiffCleanup.cleanupEfficiency: Null case.", diffList(), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "wxyz"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "wxyz"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")});
DiffCleanup.cleanupEfficiency(diffs);
assertEquals(
- "DiffCleanup.cleanupEfficiency: No elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "wxyz"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ "DiffCleanup.cleanupEfficiency: No elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "wxyz"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "xyz"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "xyz"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")});
DiffCleanup.cleanupEfficiency(diffs);
assertEquals(
- "DiffCleanup.cleanupEfficiency: Four-edit elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abxyzcd"), new Difference(EditType.INSERT, "12xyz34")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "DiffCleanup.cleanupEfficiency: Four-edit elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abxyzcd"), new Difference(EditType.INSERT, "12xyz34")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "x"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "x"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")});
DiffCleanup.cleanupEfficiency(diffs);
assertEquals(
- "DiffCleanup.cleanupEfficiency: Three-edit elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "xcd"), new Difference(EditType.INSERT, "12x34")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "DiffCleanup.cleanupEfficiency: Three-edit elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "xcd"), new Difference(EditType.INSERT, "12x34")}), diffs);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "xy"), new Difference(EditType.INSERT, "34"), new Difference(EditType.EQUAL, "z"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "56")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "xy"), new Difference(EditType.INSERT, "34"), new Difference(EditType.EQUAL, "z"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "56")});
DiffCleanup.cleanupEfficiency(diffs);
assertEquals(
- "DiffCleanup.cleanupEfficiency: Backpass elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abxyzcd"), new Difference(EditType.INSERT, "12xy34z56")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "DiffCleanup.cleanupEfficiency: Backpass elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abxyzcd"), new Difference(EditType.INSERT, "12xy34z56")}), diffs);
DiffCleanup.setEditCost(5);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "wxyz"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ new Difference(EditType.DELETE, "ab"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "wxyz"), new Difference(EditType.DELETE, "cd"), new Difference(EditType.INSERT, "34")});
DiffCleanup.cleanupEfficiency(diffs);
assertEquals(
- "DiffCleanup.cleanupEfficiency: High cost elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abwxyzcd"), new Difference(EditType.INSERT, "12wxyz34")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "DiffCleanup.cleanupEfficiency: High cost elimination.", diffList(new Object[] { new Difference(EditType.DELETE, "abwxyzcd"), new Difference(EditType.INSERT, "12wxyz34")}), diffs);
DiffCleanup.setEditCost(4);
}
Modified: trunk/common/src/test/java/org/crosswire/common/diff/DiffTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/DiffTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/DiffTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -22,57 +22,57 @@
public void testDiffMain() {
// Perform a trivial diff
List diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "abc")}); //$NON-NLS-1$
- assertEquals("diff_main: Null case.", diffs, new Diff("abc", "abc", false).compare()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.EQUAL, "abc")});
+ assertEquals("diff_main: Null case.", diffs, new Diff("abc", "abc", false).compare());
diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "ab"), new Difference(EditType.INSERT, "123"), new Difference(EditType.EQUAL, "c")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("diff_main: Simple insertion.", diffs, new Diff("abc", "ab123c", false).compare()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.EQUAL, "ab"), new Difference(EditType.INSERT, "123"), new Difference(EditType.EQUAL, "c")});
+ assertEquals("diff_main: Simple insertion.", diffs, new Diff("abc", "ab123c", false).compare());
diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "123"), new Difference(EditType.EQUAL, "bc")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("diff_main: Simple deletion.", diffs, new Diff("a123bc", "abc", false).compare()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "123"), new Difference(EditType.EQUAL, "bc")});
+ assertEquals("diff_main: Simple deletion.", diffs, new Diff("a123bc", "abc", false).compare());
diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "a"), new Difference(EditType.INSERT, "123"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.INSERT, "456"), new Difference(EditType.EQUAL, "c")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- assertEquals("diff_main: Two insertions.", diffs, new Diff("abc", "a123b456c", false).compare()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.EQUAL, "a"), new Difference(EditType.INSERT, "123"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.INSERT, "456"), new Difference(EditType.EQUAL, "c")});
+ assertEquals("diff_main: Two insertions.", diffs, new Diff("abc", "a123b456c", false).compare());
diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "123"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.DELETE, "456"), new Difference(EditType.EQUAL, "c")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- assertEquals("diff_main: Two deletions.", diffs, new Diff("a123b456c", "abc", false).compare()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "123"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.DELETE, "456"), new Difference(EditType.EQUAL, "c")});
+ assertEquals("diff_main: Two deletions.", diffs, new Diff("a123b456c", "abc", false).compare());
// Perform a real diff
// Switch off the timeout.
// dmp.Diff_Timeout = 0;
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "b")}); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("diff_main: Simple case #1.", diffs, new Diff("a", "b", false).compare()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "b")});
+ assertEquals("diff_main: Simple case #1.", diffs, new Diff("a", "b", false).compare());
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "Apple"), new Difference(EditType.INSERT, "Banana"), new Difference(EditType.EQUAL, "s are a"), new Difference(EditType.INSERT, "lso"), new Difference(EditType.EQUAL, " fruit.")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- assertEquals("diff_main: Simple case #2.", diffs, new Diff("Apples are a fruit.", "Bananas are also fruit.", false).compare()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.DELETE, "Apple"), new Difference(EditType.INSERT, "Banana"), new Difference(EditType.EQUAL, "s are a"), new Difference(EditType.INSERT, "lso"), new Difference(EditType.EQUAL, " fruit.")});
+ assertEquals("diff_main: Simple case #2.", diffs, new Diff("Apples are a fruit.", "Bananas are also fruit.", false).compare());
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "1"), new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "y"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.DELETE, "2"), new Difference(EditType.INSERT, "xab")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- assertEquals("diff_main: Overlap #1.", diffs, new Diff("1ayb2", "abxab", false).compare()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.DELETE, "1"), new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "y"), new Difference(EditType.EQUAL, "b"), new Difference(EditType.DELETE, "2"), new Difference(EditType.INSERT, "xab")});
+ assertEquals("diff_main: Overlap #1.", diffs, new Diff("1ayb2", "abxab", false).compare());
diffs = diffList(new Object[] {
- new Difference(EditType.INSERT, "x"), new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "b"), new Difference(EditType.INSERT, "x"), new Difference(EditType.EQUAL, "c"), new Difference(EditType.DELETE, "y"), new Difference(EditType.INSERT, "xabc")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- assertEquals("diff_main: Overlap #2.", diffs, new Diff("abcy", "xaxcxabc", false).compare()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.INSERT, "x"), new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "b"), new Difference(EditType.INSERT, "x"), new Difference(EditType.EQUAL, "c"), new Difference(EditType.DELETE, "y"), new Difference(EditType.INSERT, "xabc")});
+ assertEquals("diff_main: Overlap #2.", diffs, new Diff("abcy", "xaxcxabc", false).compare());
// Test the linemode speedup
// Must be long to pass the 250 char cutoff.
- String a = "1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n"; //$NON-NLS-1$
- String b = "abcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\n"; //$NON-NLS-1$
- assertEquals("diff_main: Simple.", new Diff(a, b, true).compare(), new Diff(a, b, false).compare()); //$NON-NLS-1$
- a = "1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n"; //$NON-NLS-1$
- b = "abcdefghij\n1234567890\n1234567890\n1234567890\nabcdefghij\n1234567890\n1234567890\n1234567890\nabcdefghij\n1234567890\n1234567890\n1234567890\nabcdefghij\n"; //$NON-NLS-1$
+ String a = "1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n";
+ String b = "abcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\nabcdefghij\n";
+ assertEquals("diff_main: Simple.", new Diff(a, b, true).compare(), new Diff(a, b, false).compare());
+ a = "1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n";
+ b = "abcdefghij\n1234567890\n1234567890\n1234567890\nabcdefghij\n1234567890\n1234567890\n1234567890\nabcdefghij\n1234567890\n1234567890\n1234567890\nabcdefghij\n";
String[] texts_linemode = diff_rebuildtexts(new Diff(a, b, true).compare());
String[] texts_textmode = diff_rebuildtexts(new Diff(a, b, false).compare());
- assertArrayEquals("diff_main: Overlap.", texts_textmode, texts_linemode); //$NON-NLS-1$
+ assertArrayEquals("diff_main: Overlap.", texts_textmode, texts_linemode);
}
public void testDiffXIndex() {
// Translate a location in text1 to text2
List diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "1234"), new Difference(EditType.EQUAL, "xyz")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("diff_xIndex: Translation on equality.", 5, new Diff("", "").xIndex(diffs, 2)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "1234"), new Difference(EditType.EQUAL, "xyz")});
+ assertEquals("diff_xIndex: Translation on equality.", 5, new Diff("", "").xIndex(diffs, 2));
diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "1234"), new Difference(EditType.EQUAL, "xyz")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("diff_xIndex: Translation on deletion.", 1, new Diff("", "").xIndex(diffs, 3)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.EQUAL, "a"), new Difference(EditType.DELETE, "1234"), new Difference(EditType.EQUAL, "xyz")});
+ assertEquals("diff_xIndex: Translation on deletion.", 1, new Diff("", "").xIndex(diffs, 3));
}
private void assertArrayEquals(String error_msg, Object[] a, Object[] b) {
@@ -84,7 +84,7 @@
// Construct the two texts which made up the diff originally.
private static String[] diff_rebuildtexts(List diffs) {
String[] text = {
- "", ""}; //$NON-NLS-1$ //$NON-NLS-2$
+ "", ""};
Iterator iter = diffs.iterator();
while (iter.hasNext()) {
Difference myDiff = (Difference) iter.next();
Modified: trunk/common/src/test/java/org/crosswire/common/diff/DifferenceEngineTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/DifferenceEngineTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/DifferenceEngineTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -25,81 +25,81 @@
DifferenceEngine generator = new DifferenceEngine();
List v_map = new ArrayList();
Set row_set = new HashSet();
- row_set.add("0,0"); //$NON-NLS-1$
+ row_set.add("0,0");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,1");row_set.add("1,0"); //$NON-NLS-1$ //$NON-NLS-2$
+ row_set.add("0,1");row_set.add("1,0");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,2");row_set.add("2,0");row_set.add("2,2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ row_set.add("0,2");row_set.add("2,0");row_set.add("2,2");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,3");row_set.add("2,3");row_set.add("3,0");row_set.add("4,3"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ row_set.add("0,3");row_set.add("2,3");row_set.add("3,0");row_set.add("4,3");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,4");row_set.add("2,4");row_set.add("4,0");row_set.add("4,4");row_set.add("5,3"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ row_set.add("0,4");row_set.add("2,4");row_set.add("4,0");row_set.add("4,4");row_set.add("5,3");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,5");row_set.add("2,5");row_set.add("4,5");row_set.add("5,0");row_set.add("6,3");row_set.add("6,5"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ row_set.add("0,5");row_set.add("2,5");row_set.add("4,5");row_set.add("5,0");row_set.add("6,3");row_set.add("6,5");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,6");row_set.add("2,6");row_set.add("4,6");row_set.add("6,6");row_set.add("7,5"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ row_set.add("0,6");row_set.add("2,6");row_set.add("4,6");row_set.add("6,6");row_set.add("7,5");
v_map.add(row_set);
List diffs = diffList(new Object[] {
- new Difference(EditType.INSERT, "W"), new Difference(EditType.DELETE, "A"), new Difference(EditType.EQUAL, "1"), new Difference(EditType.DELETE, "B"), new Difference(EditType.EQUAL, "2"), new Difference(EditType.INSERT, "X"), new Difference(EditType.DELETE, "C"), new Difference(EditType.EQUAL, "3"), new Difference(EditType.DELETE, "D")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
- assertEquals("diff_path1: Single letters.", diffs, generator.path1(v_map, "A1B2C3D", "W12X3")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.INSERT, "W"), new Difference(EditType.DELETE, "A"), new Difference(EditType.EQUAL, "1"), new Difference(EditType.DELETE, "B"), new Difference(EditType.EQUAL, "2"), new Difference(EditType.INSERT, "X"), new Difference(EditType.DELETE, "C"), new Difference(EditType.EQUAL, "3"), new Difference(EditType.DELETE, "D")});
+ assertEquals("diff_path1: Single letters.", diffs, generator.path1(v_map, "A1B2C3D", "W12X3"));
// Trace a path from front to back.
v_map.remove(v_map.size() - 1);
diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "4"), new Difference(EditType.DELETE, "E"), new Difference(EditType.INSERT, "Y"), new Difference(EditType.EQUAL, "5"), new Difference(EditType.DELETE, "F"), new Difference(EditType.EQUAL, "6"), new Difference(EditType.DELETE, "G"), new Difference(EditType.INSERT, "Z")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- assertEquals("diff_path2: Single letters.", diffs, generator.path2(v_map, "4E5F6G", "4Y56Z")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.EQUAL, "4"), new Difference(EditType.DELETE, "E"), new Difference(EditType.INSERT, "Y"), new Difference(EditType.EQUAL, "5"), new Difference(EditType.DELETE, "F"), new Difference(EditType.EQUAL, "6"), new Difference(EditType.DELETE, "G"), new Difference(EditType.INSERT, "Z")});
+ assertEquals("diff_path2: Single letters.", diffs, generator.path2(v_map, "4E5F6G", "4Y56Z"));
// Double letters
// Trace a path from back to front.
v_map = new ArrayList();
row_set = new HashSet();
- row_set.add("0,0"); //$NON-NLS-1$
+ row_set.add("0,0");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,1");row_set.add("1,0"); //$NON-NLS-1$ //$NON-NLS-2$
+ row_set.add("0,1");row_set.add("1,0");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,2");row_set.add("1,1");row_set.add("2,0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ row_set.add("0,2");row_set.add("1,1");row_set.add("2,0");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,3");row_set.add("1,2");row_set.add("2,1");row_set.add("3,0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ row_set.add("0,3");row_set.add("1,2");row_set.add("2,1");row_set.add("3,0");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,4");row_set.add("1,3");row_set.add("3,1");row_set.add("4,0");row_set.add("4,4"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ row_set.add("0,4");row_set.add("1,3");row_set.add("3,1");row_set.add("4,0");row_set.add("4,4");
v_map.add(row_set);
diffs = diffList(new Object[] {
- new Difference(EditType.INSERT, "WX"), new Difference(EditType.DELETE, "AB"), new Difference(EditType.EQUAL, "12")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("diff_path1: Double letters.", diffs, generator.path1(v_map, "AB12", "WX12")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.INSERT, "WX"), new Difference(EditType.DELETE, "AB"), new Difference(EditType.EQUAL, "12")});
+ assertEquals("diff_path1: Double letters.", diffs, generator.path1(v_map, "AB12", "WX12"));
// Trace a path from front to back.
v_map = new ArrayList();
row_set = new HashSet();
- row_set.add("0,0"); //$NON-NLS-1$
+ row_set.add("0,0");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("0,1");row_set.add("1,0"); //$NON-NLS-1$ //$NON-NLS-2$
+ row_set.add("0,1");row_set.add("1,0");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("1,1");row_set.add("2,0");row_set.add("2,4"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ row_set.add("1,1");row_set.add("2,0");row_set.add("2,4");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("2,1");row_set.add("2,5");row_set.add("3,0");row_set.add("3,4"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ row_set.add("2,1");row_set.add("2,5");row_set.add("3,0");row_set.add("3,4");
v_map.add(row_set);
row_set = new HashSet();
- row_set.add("2,6");row_set.add("3,5");row_set.add("4,4"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ row_set.add("2,6");row_set.add("3,5");row_set.add("4,4");
v_map.add(row_set);
diffs = diffList(new Object[] {
- new Difference(EditType.DELETE, "CD"), new Difference(EditType.EQUAL, "34"), new Difference(EditType.INSERT, "YZ")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("diff_path2: Double letters.", diffs, generator.path2(v_map, "CD34", "34YZ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new Difference(EditType.DELETE, "CD"), new Difference(EditType.EQUAL, "34"), new Difference(EditType.INSERT, "YZ")});
+ assertEquals("diff_path2: Double letters.", diffs, generator.path2(v_map, "CD34", "34YZ"));
}
public void testTimeout() {
@@ -107,7 +107,7 @@
// This test may fail on extremely fast computers. If so, just increase
// the text lengths.
assertNull(
- "diff_main: Timeout.", new DifferenceEngine("`Twas brillig, and the slithy toves\nDid gyre and gimble in the wabe:\nAll mimsy were the borogoves,\nAnd the mome raths outgrabe.", "I am the very model of a modern major general,\nI've information vegetable, animal, and mineral,\nI know the kings of England, and I quote the fights historical,\nFrom Marathon to Waterloo, in order categorical.").generate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "diff_main: Timeout.", new DifferenceEngine("`Twas brillig, and the slithy toves\nDid gyre and gimble in the wabe:\nAll mimsy were the borogoves,\nAnd the mome raths outgrabe.", "I am the very model of a modern major general,\nI've information vegetable, animal, and mineral,\nI know the kings of England, and I quote the fights historical,\nFrom Marathon to Waterloo, in order categorical.").generate());
DifferenceEngine.setTimeout(0);
}
Modified: trunk/common/src/test/java/org/crosswire/common/diff/DifferenceTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/DifferenceTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/DifferenceTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -15,14 +15,14 @@
}
public void testHashCode() {
- assertTrue("Difference.hashCode:", (new Difference(EditType.EQUAL, "a")).hashCode() == (new Difference(EditType.EQUAL, "a")).hashCode()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertFalse("Difference.hashCode:", (new Difference(EditType.EQUAL, "a")).hashCode() == (new Difference(EditType.EQUAL, "ab")).hashCode()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertFalse("Difference.hashCode:", (new Difference(EditType.EQUAL, "a")).hashCode() == (new Difference(EditType.INSERT, "a")).hashCode()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertTrue("Difference.hashCode:", (new Difference(EditType.EQUAL, "a")).hashCode() == (new Difference(EditType.EQUAL, "a")).hashCode());
+ assertFalse("Difference.hashCode:", (new Difference(EditType.EQUAL, "a")).hashCode() == (new Difference(EditType.EQUAL, "ab")).hashCode());
+ assertFalse("Difference.hashCode:", (new Difference(EditType.EQUAL, "a")).hashCode() == (new Difference(EditType.INSERT, "a")).hashCode());
}
public void testEquals() {
// First check that Diff equality works
- assertTrue("Difference.equals:", new Difference(EditType.EQUAL, "a").equals(new Difference(EditType.EQUAL, "a"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Difference.equals:", new Difference(EditType.EQUAL, "a"), new Difference(EditType.EQUAL, "a")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertTrue("Difference.equals:", new Difference(EditType.EQUAL, "a").equals(new Difference(EditType.EQUAL, "a")));
+ assertEquals("Difference.equals:", new Difference(EditType.EQUAL, "a"), new Difference(EditType.EQUAL, "a"));
}
}
Modified: trunk/common/src/test/java/org/crosswire/common/diff/LineMapTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/LineMapTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/LineMapTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -21,41 +21,41 @@
public void testCompile() {
// Convert lines down to characters
ArrayList list = new ArrayList();
- list.add(""); //$NON-NLS-1$
- list.add("alpha\n"); //$NON-NLS-1$
- list.add("beta\n"); //$NON-NLS-1$
- LineMap map = new LineMap("alpha\nbeta\nalpha\n", "beta\nalpha\nbeta\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("new LineMap:", "\u0001\u0002\u0001", map.getSourceMap()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("new LineMap:", "\u0002\u0001\u0002", map.getTargetMap()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("new LineMap:", list, map.getLines()); //$NON-NLS-1$
+ list.add("");
+ list.add("alpha\n");
+ list.add("beta\n");
+ LineMap map = new LineMap("alpha\nbeta\nalpha\n", "beta\nalpha\nbeta\n");
+ assertEquals("new LineMap:", "\u0001\u0002\u0001", map.getSourceMap());
+ assertEquals("new LineMap:", "\u0002\u0001\u0002", map.getTargetMap());
+ assertEquals("new LineMap:", list, map.getLines());
list.clear();
- list.add(""); //$NON-NLS-1$
- list.add("alpha\r\n"); //$NON-NLS-1$
- list.add("beta\r\n"); //$NON-NLS-1$
- list.add("\r\n"); //$NON-NLS-1$
- map = new LineMap("", "alpha\r\nbeta\r\n\r\n\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("new LineMap:", "", map.getSourceMap()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("new LineMap:", "\u0001\u0002\u0003\u0003", map.getTargetMap()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("new LineMap:", list, map.getLines()); //$NON-NLS-1$
+ list.add("");
+ list.add("alpha\r\n");
+ list.add("beta\r\n");
+ list.add("\r\n");
+ map = new LineMap("", "alpha\r\nbeta\r\n\r\n\r\n");
+ assertEquals("new LineMap:", "", map.getSourceMap());
+ assertEquals("new LineMap:", "\u0001\u0002\u0003\u0003", map.getTargetMap());
+ assertEquals("new LineMap:", list, map.getLines());
}
public void testRestore() {
// Convert chars up to lines
List diffs = diffList(new Object[] {
- new Difference(EditType.EQUAL, "\u0001\u0002\u0001"), new Difference(EditType.INSERT, "\u0002\u0001\u0002")}); //$NON-NLS-1$ //$NON-NLS-2$
+ new Difference(EditType.EQUAL, "\u0001\u0002\u0001"), new Difference(EditType.INSERT, "\u0002\u0001\u0002")});
ArrayList list = new ArrayList();
- list.add(""); //$NON-NLS-1$
- list.add("alpha\n"); //$NON-NLS-1$
- list.add("beta\n"); //$NON-NLS-1$
- LineMap map = new LineMap("alpha\nbeta\nalpha\n", "beta\nalpha\nbeta\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ list.add("");
+ list.add("alpha\n");
+ list.add("beta\n");
+ LineMap map = new LineMap("alpha\nbeta\nalpha\n", "beta\nalpha\nbeta\n");
map.restore(diffs);
assertEquals(
- "LineMap.restore:", diffList(new Object[] { new Difference(EditType.EQUAL, "alpha\nbeta\nalpha\n"), new Difference(EditType.INSERT, "beta\nalpha\nbeta\n")}).get(0), diffs.get(0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "LineMap.restore:", diffList(new Object[] { new Difference(EditType.EQUAL, "alpha\nbeta\nalpha\n"), new Difference(EditType.INSERT, "beta\nalpha\nbeta\n")}).get(0), diffs.get(0));
assertEquals(
- "LineMap.restore:", diffList(new Object[] { new Difference(EditType.EQUAL, "alpha\nbeta\nalpha\n"), new Difference(EditType.INSERT, "beta\nalpha\nbeta\n")}).get(diffs.size() - 1), diffs.get(diffs.size() - 1)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "LineMap.restore:", diffList(new Object[] { new Difference(EditType.EQUAL, "alpha\nbeta\nalpha\n"), new Difference(EditType.INSERT, "beta\nalpha\nbeta\n")}).get(diffs.size() - 1), diffs.get(diffs.size() - 1));
assertEquals(
- "LineMap.restore:", diffList(new Object[] { new Difference(EditType.EQUAL, "alpha\nbeta\nalpha\n"), new Difference(EditType.INSERT, "beta\nalpha\nbeta\n")}), diffs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "LineMap.restore:", diffList(new Object[] { new Difference(EditType.EQUAL, "alpha\nbeta\nalpha\n"), new Difference(EditType.INSERT, "beta\nalpha\nbeta\n")}), diffs);
}
// Private function for quickly building lists of diffs.
Modified: trunk/common/src/test/java/org/crosswire/common/diff/MatchTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/MatchTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/MatchTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -8,12 +8,12 @@
}
public void testMatchMain() {
- assertEquals("match_main: Equality.", 0, new Match("abcdef", "abcdef", 1000).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_main: Null text.", -1, new Match("", "abcdef", 1).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_main: Null pattern.", 3, new Match("abcdef", "", 3).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("match_main: Exact match.", 3, new Match("abcdef", "de", 3).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("match_main: Equality.", 0, new Match("abcdef", "abcdef", 1000).locate());
+ assertEquals("match_main: Null text.", -1, new Match("", "abcdef", 1).locate());
+ assertEquals("match_main: Null pattern.", 3, new Match("abcdef", "", 3).locate());
+ assertEquals("match_main: Exact match.", 3, new Match("abcdef", "de", 3).locate());
Bitap.setThreshold(0.7f);
- assertEquals("match_main: Complex match.", 4, new Match("I am the very model of a modern major general.", " that berry ", 5).locate()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("match_main: Complex match.", 4, new Match("I am the very model of a modern major general.", " that berry ", 5).locate());
Bitap.setThreshold(0.5f);
}
Modified: trunk/common/src/test/java/org/crosswire/common/diff/PatchEntryTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/PatchEntryTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/PatchEntryTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -26,45 +26,45 @@
p.setTargetLength(17);
p
.setDifferences(diffList(new Object[] {
- new Difference(EditType.EQUAL, "jump"), new Difference(EditType.DELETE, "s"), new Difference(EditType.INSERT, "ed"), new Difference(EditType.EQUAL, " over "), new Difference(EditType.DELETE, "the"), new Difference(EditType.INSERT, "a"), new Difference(EditType.EQUAL, " laz")})); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- assertEquals("Patch: text1.", "jumps over the laz", p.getSourceText()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Patch: text2.", "jumped over a laz", p.getTargetText()); //$NON-NLS-1$ //$NON-NLS-2$
- String strp = "@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n"; //$NON-NLS-1$
- assertEquals("Patch: toString.", strp, p.toString()); //$NON-NLS-1$
+ new Difference(EditType.EQUAL, "jump"), new Difference(EditType.DELETE, "s"), new Difference(EditType.INSERT, "ed"), new Difference(EditType.EQUAL, " over "), new Difference(EditType.DELETE, "the"), new Difference(EditType.INSERT, "a"), new Difference(EditType.EQUAL, " laz")}));
+ assertEquals("Patch: text1.", "jumps over the laz", p.getSourceText());
+ assertEquals("Patch: text2.", "jumped over a laz", p.getTargetText());
+ String strp = "@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n";
+ assertEquals("Patch: toString.", strp, p.toString());
}
public void testMatchFromText() {
- String strp = "@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n"; //$NON-NLS-1$
- assertEquals("PatchEntry.fromText: #1.", strp, new PatchEntry(strp).toString()); //$NON-NLS-1$
- assertEquals("PatchEntry.fromText: #2.", "@@ -1 +1 @@\n-a\n+b\n", new PatchEntry("@@ -1 +1 @@\n-a\n+b\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("PatchEntry.fromText: #3.", "@@ -1,3 +0,0 @@\n-abc\n", new PatchEntry("@@ -1,3 +0,0 @@\n-abc\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("PatchEntry.fromText: #4.", "@@ -0,0 +1,3 @@\n+abc\n", new PatchEntry("@@ -0,0 +1,3 @@\n+abc\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("PatchEntry.fromText: #5.", "@@ -1,7 +1,6 @@\n foo\n-%0A\n bar\n", new PatchEntry("@@ -1,7 +1,6 @@\n foo\n-%0A\n bar\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("PatchEntry.fromText: #6.", "@@ -1,4 +1,3 @@\n foo\n-%0A\n", new PatchEntry("@@ -1,4 +1,3 @@\n foo\n-%0A\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("PatchEntry.fromText: #7.", "@@ -1,4 +1,3 @@\n-%0A\n foo\n", new PatchEntry("@@ -1,4 +1,3 @@\n-%0A\n foo\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("PatchEntry.fromText: #8.", "@@ -1,3 +1,4 @@\n foo\n+%0A\n", new PatchEntry("@@ -1,3 +1,4 @@\n foo\n+%0A\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("PatchEntry.fromText: #9.", "@@ -1,3 +1,4 @@\n+%0A\n foo\n", new PatchEntry("@@ -1,3 +1,4 @@\n+%0A\n foo\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("PatchEntry.fromText: #10.", "@@ -1,4 +1,4 @@\n-foo%0A\n+%0Afoo\n", new PatchEntry("@@ -1,4 +1,4 @@\n-foo%0A\n+%0Afoo\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("PatchEntry.fromText: #11.", "@@ -1,4 +1,4 @@\n-%0Afoo\n+foo%0A\n", new PatchEntry("@@ -1,4 +1,4 @@\n-%0Afoo\n+foo%0A\n").toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String strp = "@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n";
+ assertEquals("PatchEntry.fromText: #1.", strp, new PatchEntry(strp).toString());
+ assertEquals("PatchEntry.fromText: #2.", "@@ -1 +1 @@\n-a\n+b\n", new PatchEntry("@@ -1 +1 @@\n-a\n+b\n").toString());
+ assertEquals("PatchEntry.fromText: #3.", "@@ -1,3 +0,0 @@\n-abc\n", new PatchEntry("@@ -1,3 +0,0 @@\n-abc\n").toString());
+ assertEquals("PatchEntry.fromText: #4.", "@@ -0,0 +1,3 @@\n+abc\n", new PatchEntry("@@ -0,0 +1,3 @@\n+abc\n").toString());
+ assertEquals("PatchEntry.fromText: #5.", "@@ -1,7 +1,6 @@\n foo\n-%0A\n bar\n", new PatchEntry("@@ -1,7 +1,6 @@\n foo\n-%0A\n bar\n").toString());
+ assertEquals("PatchEntry.fromText: #6.", "@@ -1,4 +1,3 @@\n foo\n-%0A\n", new PatchEntry("@@ -1,4 +1,3 @@\n foo\n-%0A\n").toString());
+ assertEquals("PatchEntry.fromText: #7.", "@@ -1,4 +1,3 @@\n-%0A\n foo\n", new PatchEntry("@@ -1,4 +1,3 @@\n-%0A\n foo\n").toString());
+ assertEquals("PatchEntry.fromText: #8.", "@@ -1,3 +1,4 @@\n foo\n+%0A\n", new PatchEntry("@@ -1,3 +1,4 @@\n foo\n+%0A\n").toString());
+ assertEquals("PatchEntry.fromText: #9.", "@@ -1,3 +1,4 @@\n+%0A\n foo\n", new PatchEntry("@@ -1,3 +1,4 @@\n+%0A\n foo\n").toString());
+ assertEquals("PatchEntry.fromText: #10.", "@@ -1,4 +1,4 @@\n-foo%0A\n+%0Afoo\n", new PatchEntry("@@ -1,4 +1,4 @@\n-foo%0A\n+%0Afoo\n").toString());
+ assertEquals("PatchEntry.fromText: #11.", "@@ -1,4 +1,4 @@\n-%0Afoo\n+foo%0A\n", new PatchEntry("@@ -1,4 +1,4 @@\n-%0Afoo\n+foo%0A\n").toString());
}
public void testMatchAddContext() {
PatchEntry.setMargin(4);
- PatchEntry p = new PatchEntry("@@ -21,4 +21,10 @@\n-jump\n+somersault\n"); //$NON-NLS-1$
- p.addContext("The quick brown fox jumps over the lazy dog."); //$NON-NLS-1$
- assertEquals("PatchEntry.addContext: Simple case.", "@@ -17,12 +17,18 @@\n fox \n-jump\n+somersault\n s ov\n", p.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ PatchEntry p = new PatchEntry("@@ -21,4 +21,10 @@\n-jump\n+somersault\n");
+ p.addContext("The quick brown fox jumps over the lazy dog.");
+ assertEquals("PatchEntry.addContext: Simple case.", "@@ -17,12 +17,18 @@\n fox \n-jump\n+somersault\n s ov\n", p.toString());
- p = new PatchEntry("@@ -21,4 +21,10 @@\n-jump\n+somersault\n"); //$NON-NLS-1$
- p.addContext("The quick brown fox jumps."); //$NON-NLS-1$
- assertEquals("PatchEntry.addContext: Not enough trailing context.", "@@ -17,10 +17,16 @@\n fox \n-jump\n+somersault\n s.\n", p.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ p = new PatchEntry("@@ -21,4 +21,10 @@\n-jump\n+somersault\n");
+ p.addContext("The quick brown fox jumps.");
+ assertEquals("PatchEntry.addContext: Not enough trailing context.", "@@ -17,10 +17,16 @@\n fox \n-jump\n+somersault\n s.\n", p.toString());
- p = new PatchEntry("@@ -3 +3,2 @@\n-e\n+at\n"); //$NON-NLS-1$
- p.addContext("The quick brown fox jumps."); //$NON-NLS-1$
- assertEquals("PatchEntry.addContext: Not enough leading context.", "@@ -1,7 +1,8 @@\n Th\n-e\n+at\n qui\n", p.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ p = new PatchEntry("@@ -3 +3,2 @@\n-e\n+at\n");
+ p.addContext("The quick brown fox jumps.");
+ assertEquals("PatchEntry.addContext: Not enough leading context.", "@@ -1,7 +1,8 @@\n Th\n-e\n+at\n qui\n", p.toString());
- p = new PatchEntry("@@ -3 +3,2 @@\n-e\n+at\n"); //$NON-NLS-1$
- p.addContext("The quick brown fox jumps. The quick brown fox crashes."); //$NON-NLS-1$
- assertEquals("PatchEntry.addContext: Ambiguity.", "@@ -1,27 +1,28 @@\n Th\n-e\n+at\n quick brown fox jumps. \n", p.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ p = new PatchEntry("@@ -3 +3,2 @@\n-e\n+at\n");
+ p.addContext("The quick brown fox jumps. The quick brown fox crashes.");
+ assertEquals("PatchEntry.addContext: Ambiguity.", "@@ -1,27 +1,28 @@\n Th\n-e\n+at\n quick brown fox jumps. \n", p.toString());
}
// Private function for quickly building lists of diffs.
Modified: trunk/common/src/test/java/org/crosswire/common/diff/PatchTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/PatchTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/PatchTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -16,58 +16,58 @@
}
public void testMatchFromText() {
- String strp = "@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n"; //$NON-NLS-1$
- assertEquals("patch_fromText: #1.", strp, new Patch(strp).toText()); //$NON-NLS-1$
- assertEquals("patch_fromText: #2.", "@@ -1 +1 @@\n-a\n+b\n", new Patch("@@ -1 +1 @@\n-a\n+b\n").toText()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("patch_fromText: #3.", "@@ -1,3 +0,0 @@\n-abc\n", new Patch("@@ -1,3 +0,0 @@\n-abc\n").toText()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("patch_fromText: #4.", "@@ -0,0 +1,3 @@\n+abc\n", new Patch("@@ -0,0 +1,3 @@\n+abc\n").toText()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String strp = "@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n";
+ assertEquals("patch_fromText: #1.", strp, new Patch(strp).toText());
+ assertEquals("patch_fromText: #2.", "@@ -1 +1 @@\n-a\n+b\n", new Patch("@@ -1 +1 @@\n-a\n+b\n").toText());
+ assertEquals("patch_fromText: #3.", "@@ -1,3 +0,0 @@\n-abc\n", new Patch("@@ -1,3 +0,0 @@\n-abc\n").toText());
+ assertEquals("patch_fromText: #4.", "@@ -0,0 +1,3 @@\n+abc\n", new Patch("@@ -0,0 +1,3 @@\n+abc\n").toText());
assertEquals(
- "patch_fromText: #5.", "@@ -1,9 +1,9 @@\n-f\n+F\n oo fooba\n@@ -7,9 +7,9 @@\n obar\n-,\n+.\n tes\n", new Patch("@@ -1,9 +1,9 @@\n-f\n+F\n oo fooba\n@@ -7,9 +7,9 @@\n obar\n-,\n+.\n tes\n").toText()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "patch_fromText: #5.", "@@ -1,9 +1,9 @@\n-f\n+F\n oo fooba\n@@ -7,9 +7,9 @@\n obar\n-,\n+.\n tes\n", new Patch("@@ -1,9 +1,9 @@\n-f\n+F\n oo fooba\n@@ -7,9 +7,9 @@\n obar\n-,\n+.\n tes\n").toText());
}
public void testMatchMake() {
- Patch p = new Patch("The quick brown fox jumps over the lazy dog.", "That quick brown fox jumped over a lazy dog."); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("patch_make", "@@ -1,11 +1,12 @@\n Th\n-e\n+at\n quick b\n@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n", p.toText()); //$NON-NLS-1$ //$NON-NLS-2$
- // p = new Patch("`1234567890-=[]\\;',./", "~!@#$%^&*()_+{}|:\"<>?"); //$NON-NLS-1$ //$NON-NLS-2$
- // assertEquals("patch_toString: Character encoding.", "@@ -1,21 +1,21 @@\n-%601234567890-=%5B%5D%5C;',./\n+~!@#$%25%5E&*()_+%7B%7D%7C:%22%3C%3E?\n", p.toText()); //$NON-NLS-1$ //$NON-NLS-2$
- // List diffs = diffList(new Object[] { new Difference(EditType.DELETE, "`1234567890-=[]\\;',./"), new Difference(EditType.INSERT, "~!@#$%^&*()_+{}|:\"<>?")}); //$NON-NLS-1$ //$NON-NLS-2$
- // assertEquals("patch_fromText: Character decoding.", diffs, new Patch("@@ -1,21 +1,21 @@\n-%601234567890-=%5B%5D%5C;',./\n+~!@#$%25%5E&*()_+%7B%7D%7C:%22%3C%3E?\n").get(0).diffs); //$NON-NLS-1$ //$NON-NLS-2$
+ Patch p = new Patch("The quick brown fox jumps over the lazy dog.", "That quick brown fox jumped over a lazy dog.");
+ assertEquals("patch_make", "@@ -1,11 +1,12 @@\n Th\n-e\n+at\n quick b\n@@ -21,18 +22,17 @@\n jump\n-s\n+ed\n over \n-the\n+a\n laz\n", p.toText());
+ // p = new Patch("`1234567890-=[]\\;',./", "~!@#$%^&*()_+{}|:\"<>?");
+ // assertEquals("patch_toString: Character encoding.", "@@ -1,21 +1,21 @@\n-%601234567890-=%5B%5D%5C;',./\n+~!@#$%25%5E&*()_+%7B%7D%7C:%22%3C%3E?\n", p.toText());
+ // List diffs = diffList(new Object[] { new Difference(EditType.DELETE, "`1234567890-=[]\\;',./"), new Difference(EditType.INSERT, "~!@#$%^&*()_+{}|:\"<>?")});
+ // assertEquals("patch_fromText: Character decoding.", diffs, new Patch("@@ -1,21 +1,21 @@\n-%601234567890-=%5B%5D%5C;',./\n+~!@#$%25%5E&*()_+%7B%7D%7C:%22%3C%3E?\n").get(0).diffs);
}
public void testMatchSplitMax() {
// Assumes that Match.getMaxPatternLength() is 32.
- Patch p = new Patch("abcdef1234567890123456789012345678901234567890123456789012345678901234567890uvwxyz", "abcdefuvwxyz"); //$NON-NLS-1$ //$NON-NLS-2$
+ Patch p = new Patch("abcdef1234567890123456789012345678901234567890123456789012345678901234567890uvwxyz", "abcdefuvwxyz");
p.splitMax();
assertEquals(
- "patch_splitMax:", "@@ -3,32 +3,8 @@\n cdef\n-123456789012345678901234\n 5678\n@@ -27,32 +3,8 @@\n cdef\n-567890123456789012345678\n 9012\n@@ -51,30 +3,8 @@\n cdef\n-9012345678901234567890\n uvwx\n", p.toText()); //$NON-NLS-1$ //$NON-NLS-2$
+ "patch_splitMax:", "@@ -3,32 +3,8 @@\n cdef\n-123456789012345678901234\n 5678\n@@ -27,32 +3,8 @@\n cdef\n-567890123456789012345678\n 9012\n@@ -51,30 +3,8 @@\n cdef\n-9012345678901234567890\n uvwx\n", p.toText());
}
public void testMatchApply() {
- Patch p = new Patch("The quick brown fox jumps over the lazy dog.", "That quick brown fox jumped over a lazy dog."); //$NON-NLS-1$ //$NON-NLS-2$
- PatchResults results = p.apply("The quick brown fox jumps over the lazy dog."); //$NON-NLS-1$
+ Patch p = new Patch("The quick brown fox jumps over the lazy dog.", "That quick brown fox jumped over a lazy dog.");
+ PatchResults results = p.apply("The quick brown fox jumps over the lazy dog.");
boolean[] boolArray = results.getResults();
- String resultStr = results.getText() + "\t" + boolArray[0] + "\t" + boolArray[1]; //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("patch_apply: Exact match.", "That quick brown fox jumped over a lazy dog.\ttrue\ttrue", resultStr); //$NON-NLS-1$ //$NON-NLS-2$
- results = p.apply("The quick red rabbit jumps over the tired tiger."); //$NON-NLS-1$
+ String resultStr = results.getText() + "\t" + boolArray[0] + "\t" + boolArray[1];
+ assertEquals("patch_apply: Exact match.", "That quick brown fox jumped over a lazy dog.\ttrue\ttrue", resultStr);
+ results = p.apply("The quick red rabbit jumps over the tired tiger.");
boolArray = results.getResults();
- resultStr = results.getText() + "\t" + boolArray[0] + "\t" + boolArray[1]; //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("patch_apply: Partial match.", "That quick red rabbit jumped over a tired tiger.\ttrue\ttrue", resultStr); //$NON-NLS-1$ //$NON-NLS-2$
- results = p.apply("I am the very model of a modern major general."); //$NON-NLS-1$
+ resultStr = results.getText() + "\t" + boolArray[0] + "\t" + boolArray[1];
+ assertEquals("patch_apply: Partial match.", "That quick red rabbit jumped over a tired tiger.\ttrue\ttrue", resultStr);
+ results = p.apply("I am the very model of a modern major general.");
boolArray = results.getResults();
- resultStr = results.getText() + "\t" + boolArray[0] + "\t" + boolArray[1]; //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("patch_apply: Failed match.", "I am the very model of a modern major general.\tfalse\tfalse", resultStr); //$NON-NLS-1$ //$NON-NLS-2$
+ resultStr = results.getText() + "\t" + boolArray[0] + "\t" + boolArray[1];
+ assertEquals("patch_apply: Failed match.", "I am the very model of a modern major general.\tfalse\tfalse", resultStr);
- p = new Patch("", "test"); //$NON-NLS-1$ //$NON-NLS-2$
- results = p.apply(""); //$NON-NLS-1$
+ p = new Patch("", "test");
+ results = p.apply("");
boolArray = results.getResults();
- resultStr = results.getText() + "\t" + boolArray[0]; //$NON-NLS-1$
- assertEquals("patch_apply: Exact match against empty string.", "test\ttrue", resultStr); //$NON-NLS-1$ //$NON-NLS-2$
+ resultStr = results.getText() + "\t" + boolArray[0];
+ assertEquals("patch_apply: Exact match against empty string.", "test\ttrue", resultStr);
- p = new Patch("test", ""); //$NON-NLS-1$ //$NON-NLS-2$
- results = p.apply("test"); //$NON-NLS-1$
+ p = new Patch("test", "");
+ results = p.apply("test");
boolArray = results.getResults();
- resultStr = results.getText() + "\t" + boolArray[0]; //$NON-NLS-1$
- assertEquals("patch_apply: Exact match against empty string.", "\ttrue", resultStr); //$NON-NLS-1$ //$NON-NLS-2$
+ resultStr = results.getText() + "\t" + boolArray[0];
+ assertEquals("patch_apply: Exact match against empty string.", "\ttrue", resultStr);
}
}
Modified: trunk/common/src/test/java/org/crosswire/common/diff/diff_match_patch_test.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/diff/diff_match_patch_test.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/diff/diff_match_patch_test.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -18,19 +18,19 @@
// public void testDiffAddIndex() {
// // Add an index to each diff tuple
- // List diffs = diffList(new Object[] { new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "wxy"), new Difference(EditType.INSERT, "34"), new Difference(EditType.EQUAL, "z"), new Difference(EditType.DELETE, "bcd"), new Difference(EditType.INSERT, "56") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ // List diffs = diffList(new Object[] { new Difference(EditType.DELETE, "a"), new Difference(EditType.INSERT, "12"), new Difference(EditType.EQUAL, "wxy"), new Difference(EditType.INSERT, "34"), new Difference(EditType.EQUAL, "z"), new Difference(EditType.DELETE, "bcd"), new Difference(EditType.INSERT, "56") });
// dmp.diff_addIndex(diffs);
- // String indexString = ""; //$NON-NLS-1$
+ // String indexString = "";
// for (Diff aDiff : diffs) {
- // indexString += aDiff.index + ","; //$NON-NLS-1$
+ // indexString += aDiff.index + ",";
// }
- // assertEquals("diff_addIndex:", "0,0,2,5,7,8,8,", indexString); //$NON-NLS-1$ //$NON-NLS-2$
+ // assertEquals("diff_addIndex:", "0,0,2,5,7,8,8,", indexString);
// }
// public void testDiffPrettyHtml() {
// // Pretty print
- // List diffs = diffList(new Object[] { new Difference(EditType.EQUAL, "a\n"), new Difference(EditType.DELETE, "<B>b</B>"), new Difference(EditType.INSERT, "c&d") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // assertEquals("diff_prettyHtml:", "<SPAN TITLE=\"i=0\">a¶<BR></SPAN><DEL STYLE=\"background:#FFE6E6;\" TITLE=\"i=2\"><B>b</B></DEL><INS STYLE=\"background:#E6FFE6;\" TITLE=\"i=2\">c&d</INS>", dmp.diff_prettyHtml(diffs)); //$NON-NLS-1$ //$NON-NLS-2$
+ // List diffs = diffList(new Object[] { new Difference(EditType.EQUAL, "a\n"), new Difference(EditType.DELETE, "<B>b</B>"), new Difference(EditType.INSERT, "c&d") });
+ // assertEquals("diff_prettyHtml:", "<SPAN TITLE=\"i=0\">a¶<BR></SPAN><DEL STYLE=\"background:#FFE6E6;\" TITLE=\"i=2\"><B>b</B></DEL><INS STYLE=\"background:#E6FFE6;\" TITLE=\"i=2\">c&d</INS>", dmp.diff_prettyHtml(diffs));
// }
// // Private function for quickly building lists of diffs.
Modified: trunk/common/src/test/java/org/crosswire/common/history/AllTests.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/history/AllTests.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/history/AllTests.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -33,7 +33,7 @@
*/
public class AllTests {
public static Test suite() {
- TestSuite suite = new TestSuite("Test for org.crosswire.common.history"); //$NON-NLS-1$
+ TestSuite suite = new TestSuite("Test for org.crosswire.common.history");
// $JUnit-BEGIN$
suite.addTest(new TestSuite(HistoryTest.class));
// $JUnit-END$
Modified: trunk/common/src/test/java/org/crosswire/common/history/HistoryTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/history/HistoryTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/history/HistoryTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -34,85 +34,85 @@
public void testAdd() {
History history = new History();
assertEquals(null, history.getCurrent());
- history.add("a"); //$NON-NLS-1$
- assertEquals("a", history.getCurrent()); //$NON-NLS-1$
- history.add("b"); //$NON-NLS-1$
- assertEquals("[a, b]", history.getPreviousList().toString()); //$NON-NLS-1$
+ history.add("a");
+ assertEquals("a", history.getCurrent());
+ history.add("b");
+ assertEquals("[a, b]", history.getPreviousList().toString());
// re-adding the current element won't change the list
- history.add("b"); //$NON-NLS-1$
- assertEquals("[a, b]", history.getPreviousList().toString()); //$NON-NLS-1$
- history.add("c"); //$NON-NLS-1$
- assertEquals("[a, b, c]", history.getPreviousList().toString()); //$NON-NLS-1$
+ history.add("b");
+ assertEquals("[a, b]", history.getPreviousList().toString());
+ history.add("c");
+ assertEquals("[a, b, c]", history.getPreviousList().toString());
}
public void testGo() {
History history = new History();
assertEquals(null, history.getCurrent());
- history.add("a"); //$NON-NLS-1$
- history.add("b"); //$NON-NLS-1$
- history.add("c"); //$NON-NLS-1$
- history.add("d"); //$NON-NLS-1$
- assertEquals("[a, b, c, d]", history.getPreviousList().toString()); //$NON-NLS-1$
+ history.add("a");
+ history.add("b");
+ history.add("c");
+ history.add("d");
+ assertEquals("[a, b, c, d]", history.getPreviousList().toString());
history.go(-1);
- assertEquals("[a, b, c]", history.getPreviousList().toString()); //$NON-NLS-1$
- assertEquals("[d]", history.getNextList().toString()); //$NON-NLS-1$
+ assertEquals("[a, b, c]", history.getPreviousList().toString());
+ assertEquals("[d]", history.getNextList().toString());
history.go(-2);
- assertEquals("[a]", history.getPreviousList().toString()); //$NON-NLS-1$
- assertEquals("[b, c, d]", history.getNextList().toString()); //$NON-NLS-1$
+ assertEquals("[a]", history.getPreviousList().toString());
+ assertEquals("[b, c, d]", history.getNextList().toString());
history.go(3);
- assertEquals("[a, b, c, d]", history.getPreviousList().toString()); //$NON-NLS-1$
+ assertEquals("[a, b, c, d]", history.getPreviousList().toString());
history.go(-10);
- assertEquals("[a]", history.getPreviousList().toString()); //$NON-NLS-1$
- assertEquals("[b, c, d]", history.getNextList().toString()); //$NON-NLS-1$
+ assertEquals("[a]", history.getPreviousList().toString());
+ assertEquals("[b, c, d]", history.getNextList().toString());
history.go(10);
- assertEquals("[a, b, c, d]", history.getPreviousList().toString()); //$NON-NLS-1$
+ assertEquals("[a, b, c, d]", history.getPreviousList().toString());
}
public void testNav() {
History history = new History();
assertEquals(null, history.getCurrent());
- history.add("a"); //$NON-NLS-1$
- history.add("b"); //$NON-NLS-1$
- history.add("c"); //$NON-NLS-1$
- history.add("d"); //$NON-NLS-1$
- history.add("e"); //$NON-NLS-1$
- history.add("f"); //$NON-NLS-1$
- history.add("g"); //$NON-NLS-1$
- history.add("h"); //$NON-NLS-1$
- history.add("i"); //$NON-NLS-1$
- assertEquals("[a, b, c, d, e, f, g, h, i]", history.getPreviousList().toString()); //$NON-NLS-1$
+ history.add("a");
+ history.add("b");
+ history.add("c");
+ history.add("d");
+ history.add("e");
+ history.add("f");
+ history.add("g");
+ history.add("h");
+ history.add("i");
+ assertEquals("[a, b, c, d, e, f, g, h, i]", history.getPreviousList().toString());
history.go(-5);
- assertEquals("[a, b, c, d]", history.getPreviousList().toString()); //$NON-NLS-1$
- assertEquals("[e, f, g, h, i]", history.getNextList().toString()); //$NON-NLS-1$
- assertEquals("d", history.getCurrent()); //$NON-NLS-1$
+ assertEquals("[a, b, c, d]", history.getPreviousList().toString());
+ assertEquals("[e, f, g, h, i]", history.getNextList().toString());
+ assertEquals("d", history.getCurrent());
// Adding the current does not change anything
- history.add("d"); //$NON-NLS-1$
- assertEquals("[a, b, c, d]", history.getPreviousList().toString()); //$NON-NLS-1$
- assertEquals("[e, f, g, h, i]", history.getNextList().toString()); //$NON-NLS-1$
+ history.add("d");
+ assertEquals("[a, b, c, d]", history.getPreviousList().toString());
+ assertEquals("[e, f, g, h, i]", history.getNextList().toString());
// Adding the next splits the list
- history.add("e"); //$NON-NLS-1$
- assertEquals("[a, b, c, d, e]", history.getPreviousList().toString()); //$NON-NLS-1$
- assertEquals("[f, g, h, i]", history.getNextList().toString()); //$NON-NLS-1$
+ history.add("e");
+ assertEquals("[a, b, c, d, e]", history.getPreviousList().toString());
+ assertEquals("[f, g, h, i]", history.getNextList().toString());
// Adding the next splits the list
- history.add("h"); //$NON-NLS-1$
- assertEquals("[a, b, c, d, e, h]", history.getPreviousList().toString()); //$NON-NLS-1$
- assertEquals("[i]", history.getNextList().toString()); //$NON-NLS-1$
+ history.add("h");
+ assertEquals("[a, b, c, d, e, h]", history.getPreviousList().toString());
+ assertEquals("[i]", history.getNextList().toString());
history.go(-5);
- assertEquals("[a]", history.getPreviousList().toString()); //$NON-NLS-1$
- assertEquals("[b, c, d, e, h, i]", history.getNextList().toString()); //$NON-NLS-1$
+ assertEquals("[a]", history.getPreviousList().toString());
+ assertEquals("[b, c, d, e, h, i]", history.getNextList().toString());
- history.add("e"); //$NON-NLS-1$
- assertEquals("[a, e]", history.getPreviousList().toString()); //$NON-NLS-1$
- assertEquals("[h, i]", history.getNextList().toString()); //$NON-NLS-1$
+ history.add("e");
+ assertEquals("[a, e]", history.getPreviousList().toString());
+ assertEquals("[h, i]", history.getNextList().toString());
}
}
Modified: trunk/common/src/test/java/org/crosswire/common/icu/AllTests.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/icu/AllTests.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/icu/AllTests.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -33,7 +33,7 @@
*/
public class AllTests {
public static Test suite() {
- TestSuite suite = new TestSuite("Test for org.crosswire.common.icu"); //$NON-NLS-1$
+ TestSuite suite = new TestSuite("Test for org.crosswire.common.icu");
// $JUnit-BEGIN$
suite.addTest(new TestSuite(NumberShaperTest.class));
// $JUnit-END$
Modified: trunk/common/src/test/java/org/crosswire/common/icu/NumberShaperTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/icu/NumberShaperTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/icu/NumberShaperTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -34,11 +34,11 @@
* @author DM Smith [dmsmith555 at yahoo dot com]
*/
public class NumberShaperTest extends TestCase {
- private static final String europeanDigits = "0123456789"; //$NON-NLS-1$
- private static final String easternArabicDigits = "\u06f0\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9"; //$NON-NLS-1$
+ private static final String europeanDigits = "0123456789";
+ private static final String easternArabicDigits = "\u06f0\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9";
public void testShape() {
- NumberShaper shaper = new NumberShaper(new Locale("fa")); //$NON-NLS-1$
+ NumberShaper shaper = new NumberShaper(new Locale("fa"));
assertEquals(easternArabicDigits, shaper.shape(europeanDigits));
// Note: the following depends upon whether icu is on the classpath
if (shaper.canUnshape()) {
Modified: trunk/common/src/test/java/org/crosswire/common/progress/AllTests.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/progress/AllTests.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/progress/AllTests.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -33,7 +33,7 @@
*/
public class AllTests {
public static Test suite() {
- TestSuite suite = new TestSuite("Test for org.crosswire.common.progress"); //$NON-NLS-1$
+ TestSuite suite = new TestSuite("Test for org.crosswire.common.progress");
// $JUnit-BEGIN$
suite.addTest(new TestSuite(JobTest.class));
suite.addTest(new TestSuite(WorkEventTest.class));
Modified: trunk/common/src/test/java/org/crosswire/common/progress/JobTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/progress/JobTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/progress/JobTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -39,7 +39,7 @@
*/
public class JobTest extends TestCase {
- private static final String WIBBLE = "wibble"; //$NON-NLS-1$
+ private static final String WIBBLE = "wibble";
/**
* Constructor for JobTest.
@@ -52,7 +52,7 @@
public void testJob() throws IOException, URISyntaxException {
Progress job;
- File tempfile = File.createTempFile("jobtest", "tmp"); //$NON-NLS-1$ //$NON-NLS-2$
+ File tempfile = File.createTempFile("jobtest", "tmp");
URI uri = new URI(NetUtil.PROTOCOL_FILE, null, tempfile.getAbsolutePath(), null);
job = JobManager.createJob(WIBBLE, false);
Modified: trunk/common/src/test/java/org/crosswire/common/progress/WorkEventTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/progress/WorkEventTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/progress/WorkEventTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -41,7 +41,7 @@
}
public void testGetJob() {
- Progress job = JobManager.createJob("wibble", false); //$NON-NLS-1$
+ Progress job = JobManager.createJob("wibble", false);
WorkEvent ev = new WorkEvent(job);
assertEquals(ev.getJob(), job);
Modified: trunk/common/src/test/java/org/crosswire/common/util/AllTests.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/util/AllTests.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/util/AllTests.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -33,7 +33,7 @@
*/
public class AllTests {
public static Test suite() {
- TestSuite suite = new TestSuite("Test for org.crosswire.common.util"); //$NON-NLS-1$
+ TestSuite suite = new TestSuite("Test for org.crosswire.common.util");
// $JUnit-BEGIN$
suite.addTest(new TestSuite(HelpDeskTest.class));
suite.addTest(new TestSuite(StringUtilTest.class));
Modified: trunk/common/src/test/java/org/crosswire/common/util/StringUtilTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/util/StringUtilTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/util/StringUtilTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -52,25 +52,25 @@
PipedReader in = new PipedReader();
PipedWriter pout = new PipedWriter(in);
PrintWriter out = new PrintWriter(pout, true);
- out.println("a b c d e"); //$NON-NLS-1$
- out.println("f g h i j"); //$NON-NLS-1$
+ out.println("a b c d e");
+ out.println("f g h i j");
out.close();
pout.close();
- assertEquals(StringUtil.read(in), "a b c d e" + StringUtil.NEWLINE + "f g h i j" + StringUtil.NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(StringUtil.read(in), "a b c d e" + StringUtil.NEWLINE + "f g h i j" + StringUtil.NEWLINE);
}
public void testGetInitials() {
- assertEquals(StringUtil.getInitials("Church of England"), "CoE"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(StringUtil.getInitials("Java DataBase Connectivity"), "JDC"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(StringUtil.getInitials(""), ""); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(StringUtil.getInitials("Church of England"), "CoE");
+ assertEquals(StringUtil.getInitials("Java DataBase Connectivity"), "JDC");
+ assertEquals(StringUtil.getInitials(""), "");
}
public void testCreateTitle() {
- assertEquals(StringUtil.createTitle("OneTwo"), "One Two"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(StringUtil.createTitle("one_two"), "One Two"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(StringUtil.createTitle("ONeTWo"), "ONe TWo"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(StringUtil.createTitle("One_Two"), "One Two"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(StringUtil.createTitle("One _Two"), "One Two"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(StringUtil.createTitle("one _Two"), "One Two"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(StringUtil.createTitle("OneTwo"), "One Two");
+ assertEquals(StringUtil.createTitle("one_two"), "One Two");
+ assertEquals(StringUtil.createTitle("ONeTWo"), "ONe TWo");
+ assertEquals(StringUtil.createTitle("One_Two"), "One Two");
+ assertEquals(StringUtil.createTitle("One _Two"), "One Two");
+ assertEquals(StringUtil.createTitle("one _Two"), "One Two");
}
}
Modified: trunk/common/src/test/java/org/crosswire/common/xml/AllTests.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/xml/AllTests.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/xml/AllTests.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -34,7 +34,7 @@
public class AllTests {
public static Test suite() {
- TestSuite suite = new TestSuite("Test for org.crosswire.common.xml"); //$NON-NLS-1$
+ TestSuite suite = new TestSuite("Test for org.crosswire.common.xml");
// $JUnit-BEGIN$
suite.addTestSuite(XMLUtilTest.class);
// $JUnit-END$
Modified: trunk/common/src/test/java/org/crosswire/common/xml/XMLUtilTest.java
===================================================================
--- trunk/common/src/test/java/org/crosswire/common/xml/XMLUtilTest.java 2010-10-23 20:20:56 UTC (rev 1993)
+++ trunk/common/src/test/java/org/crosswire/common/xml/XMLUtilTest.java 2010-10-23 20:24:08 UTC (rev 1994)
@@ -34,69 +34,69 @@
public void testCleanAllEntities() {
assertNull(XMLUtil.cleanAllEntities(null));
- assertEquals("", XMLUtil.cleanAllEntities("")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa", XMLUtil.cleanAllEntities("aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("<aa>", XMLUtil.cleanAllEntities("<aa>")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("<aa>aa", XMLUtil.cleanAllEntities("<aa>aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("<aa>aa;aa", XMLUtil.cleanAllEntities("<aa>aa;aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals(";", XMLUtil.cleanAllEntities(";")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("", XMLUtil.cleanAllEntities(""));
+ assertEquals("aa", XMLUtil.cleanAllEntities("aa"));
+ assertEquals("<aa>", XMLUtil.cleanAllEntities("<aa>"));
+ assertEquals("<aa>aa", XMLUtil.cleanAllEntities("<aa>aa"));
+ assertEquals("<aa>aa;aa", XMLUtil.cleanAllEntities("<aa>aa;aa"));
+ assertEquals(";", XMLUtil.cleanAllEntities(";"));
- assertEquals("aa & aa", XMLUtil.cleanAllEntities("aa & aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &amp aa", XMLUtil.cleanAllEntities("aa & aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &a-mp aa", XMLUtil.cleanAllEntities("aa &a-mp aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa aa", XMLUtil.cleanAllEntities("aa &am; aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &am aa", XMLUtil.cleanAllEntities("aa &am aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &", XMLUtil.cleanAllEntities("aa &")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &amp", XMLUtil.cleanAllEntities("aa &")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa ", XMLUtil.cleanAllEntities("aa &am;")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &am", XMLUtil.cleanAllEntities("aa &am")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &a", XMLUtil.cleanAllEntities("aa &a")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &", XMLUtil.cleanAllEntities("aa &")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("aa & aa", XMLUtil.cleanAllEntities("aa & aa"));
+ assertEquals("aa &amp aa", XMLUtil.cleanAllEntities("aa & aa"));
+ assertEquals("aa &a-mp aa", XMLUtil.cleanAllEntities("aa &a-mp aa"));
+ assertEquals("aa aa", XMLUtil.cleanAllEntities("aa &am; aa"));
+ assertEquals("aa &am aa", XMLUtil.cleanAllEntities("aa &am aa"));
+ assertEquals("aa &", XMLUtil.cleanAllEntities("aa &"));
+ assertEquals("aa &amp", XMLUtil.cleanAllEntities("aa &"));
+ assertEquals("aa ", XMLUtil.cleanAllEntities("aa &am;"));
+ assertEquals("aa &am", XMLUtil.cleanAllEntities("aa &am"));
+ assertEquals("aa &a", XMLUtil.cleanAllEntities("aa &a"));
+ assertEquals("aa &", XMLUtil.cleanAllEntities("aa &"));
- assertEquals("aa \u00A0 aa", XMLUtil.cleanAllEntities("aa aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &nbsp aa", XMLUtil.cleanAllEntities("aa   aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &nb-sp aa", XMLUtil.cleanAllEntities("aa &nb-sp aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa aa", XMLUtil.cleanAllEntities("aa &nb; aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa &nb aa", XMLUtil.cleanAllEntities("aa &nb aa")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("aa \u00A0 aa", XMLUtil.cleanAllEntities("aa aa"));
+ assertEquals("aa &nbsp aa", XMLUtil.cleanAllEntities("aa   aa"));
+ assertEquals("aa &nb-sp aa", XMLUtil.cleanAllEntities("aa &nb-sp aa"));
+ assertEquals("aa aa", XMLUtil.cleanAllEntities("aa &nb; aa"));
+ assertEquals("aa &nb aa", XMLUtil.cleanAllEntities("aa &nb aa"));
- assertEquals("-&-\u00A0-<->-"-\u00A3-\u20AC-", XMLUtil.cleanAllEntities("-&- -<->-"-£-€-")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("-&-\u00A0-<->-"-\u00A3-\u20AC-", XMLUtil.cleanAllEntities("-&- -<->-"-£-€-"));
}
public void testCleanAllTags() {
assertNull(XMLUtil.cleanAllTags(null));
- assertEquals("", XMLUtil.cleanAllTags("")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa", XMLUtil.cleanAllTags("aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("aa & aa", XMLUtil.cleanAllTags("aa & aa")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("", XMLUtil.cleanAllTags(""));
+ assertEquals("aa", XMLUtil.cleanAllTags("aa"));
+ assertEquals("aa & aa", XMLUtil.cleanAllTags("aa & aa"));
- assertEquals("", XMLUtil.cleanAllTags("<a>")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("<aa>")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("</aa>")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("<aa wibble=\"wobble\">")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("<aa>keep</aa>")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("<aa>keep<aa>")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("<aa>ke<aa>ep")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("ke<aa><aa>ep")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep keep", XMLUtil.cleanAllTags("ke<aa><aa>ep<bb> <cc>ke<aa><aa>ep")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("", XMLUtil.cleanAllTags("<a>"));
+ assertEquals("", XMLUtil.cleanAllTags("<aa>"));
+ assertEquals("", XMLUtil.cleanAllTags("</aa>"));
+ assertEquals("", XMLUtil.cleanAllTags("<aa wibble=\"wobble\">"));
+ assertEquals("keep", XMLUtil.cleanAllTags("<aa>keep</aa>"));
+ assertEquals("keep", XMLUtil.cleanAllTags("<aa>keep<aa>"));
+ assertEquals("keep", XMLUtil.cleanAllTags("<aa>ke<aa>ep"));
+ assertEquals("keep", XMLUtil.cleanAllTags("ke<aa><aa>ep"));
+ assertEquals("keep keep", XMLUtil.cleanAllTags("ke<aa><aa>ep<bb> <cc>ke<aa><aa>ep"));
- assertEquals("", XMLUtil.cleanAllTags("<")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("<a")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("<aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("<aa;")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("<\\")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("<\\a")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("<\\aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("<\\aa;")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("< ")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("< a")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("< aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("< aa;")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("", XMLUtil.cleanAllTags("< aa>")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("keep<")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("keep<a")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("keep<aa")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("keep<aa dont=\"want\"")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("keep<aa dont=\"want\" keep")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("keep", XMLUtil.cleanAllTags("keep<aa dont=\"want\" keep>")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("", XMLUtil.cleanAllTags("<"));
+ assertEquals("", XMLUtil.cleanAllTags("<a"));
+ assertEquals("", XMLUtil.cleanAllTags("<aa"));
+ assertEquals("", XMLUtil.cleanAllTags("<aa;"));
+ assertEquals("", XMLUtil.cleanAllTags("<\\"));
+ assertEquals("", XMLUtil.cleanAllTags("<\\a"));
+ assertEquals("", XMLUtil.cleanAllTags("<\\aa"));
+ assertEquals("", XMLUtil.cleanAllTags("<\\aa;"));
+ assertEquals("", XMLUtil.cleanAllTags("< "));
+ assertEquals("", XMLUtil.cleanAllTags("< a"));
+ assertEquals("", XMLUtil.cleanAllTags("< aa"));
+ assertEquals("", XMLUtil.cleanAllTags("< aa;"));
+ assertEquals("", XMLUtil.cleanAllTags("< aa>"));
+ assertEquals("keep", XMLUtil.cleanAllTags("keep<"));
+ assertEquals("keep", XMLUtil.cleanAllTags("keep<a"));
+ assertEquals("keep", XMLUtil.cleanAllTags("keep<aa"));
+ assertEquals("keep", XMLUtil.cleanAllTags("keep<aa dont=\"want\""));
+ assertEquals("keep", XMLUtil.cleanAllTags("keep<aa dont=\"want\" keep"));
+ assertEquals("keep", XMLUtil.cleanAllTags("keep<aa dont=\"want\" keep>"));
}
}
More information about the jsword-svn
mailing list