diff options
author | Oleg Besedin | 2006-05-03 21:11:20 +0000 |
---|---|---|
committer | Oleg Besedin | 2006-05-03 21:11:20 +0000 |
commit | 718bc3ca0785a02a8bac5981a8f8cdfd81701175 (patch) | |
tree | d5579e434e7ab8ca0e84588afb9f3c15ade71124 | |
parent | 5984a25c2b6db0c2cc1d3e0ad503bf8e903c334a (diff) | |
download | rt.equinox.bundles-718bc3ca0785a02a8bac5981a8f8cdfd81701175.tar.gz rt.equinox.bundles-718bc3ca0785a02a8bac5981a8f8cdfd81701175.tar.xz rt.equinox.bundles-718bc3ca0785a02a8bac5981a8f8cdfd81701175.zip |
3 files changed, 15 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java index ca2fb41f7..08f168996 100644 --- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java +++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java @@ -18,6 +18,8 @@ import org.eclipse.core.runtime.Status; * to BundleContext properties (if available) or System properties otherwise. */ public class RegistryProperties { + + public static final String empty = ""; //$NON-NLS-1$ private static Properties registryProperties = new Properties(); private static Object context = null; // BundleContext, but specified as Object to avoid class loading @@ -34,6 +36,11 @@ public class RegistryProperties { return getContextProperty(propertyName); } + public static String getProperty(String property, String defaultValue) { + String result = RegistryProperties.getProperty(property); + return result == null ? defaultValue : result; + } + public static void setProperty(String propertyName, String propertyValue) { registryProperties.setProperty(propertyName, propertyValue); } diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java index 5a4e95b68..0cffc3fe5 100644 --- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java +++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java @@ -28,7 +28,7 @@ public class TableReader { // Version 2 -> 3: added namespace index and the table of contributors // Version 3 -> 4: offset table saved in a binary form (performance) // Version 4 -> 5: remove support added in version 4 to save offset table in a binary form (performance) - + //Informations representing the MAIN file static final String MAIN = ".mainData"; //$NON-NLS-1$ BufferedRandomInputStream mainDataFile = null; @@ -153,9 +153,9 @@ public class TableReader { boolean validTime = (expectedTimestamp == 0 || expectedTimestamp == registryStamp); boolean validInstall = (installStamp == registry.computeState()); - boolean validOS = (osStamp.equals(RegistryProperties.getProperty(IRegistryConstants.PROP_OS))); - boolean validWS = (windowsStamp.equals(RegistryProperties.getProperty(IRegistryConstants.PROP_WS))); - boolean validNL = (localeStamp.equals(RegistryProperties.getProperty(IRegistryConstants.PROP_NL))); + boolean validOS = (osStamp.equals(RegistryProperties.getProperty(IRegistryConstants.PROP_OS, RegistryProperties.empty))); + boolean validWS = (windowsStamp.equals(RegistryProperties.getProperty(IRegistryConstants.PROP_WS, RegistryProperties.empty))); + boolean validNL = (localeStamp.equals(RegistryProperties.getProperty(IRegistryConstants.PROP_NL, RegistryProperties.empty))); if (!validTime || !validInstall || !validOS || !validWS || !validNL) return false; diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java index 9297865cc..96c3b409f 100644 --- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java +++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java @@ -272,9 +272,9 @@ public class TableWriter { output.writeLong(contributorsFile.length()); output.writeLong(namespacesFile.length()); output.writeLong(orphansFile.length()); - output.writeUTF(RegistryProperties.getProperty(IRegistryConstants.PROP_OS)); - output.writeUTF(RegistryProperties.getProperty(IRegistryConstants.PROP_WS)); - output.writeUTF(RegistryProperties.getProperty(IRegistryConstants.PROP_NL)); + output.writeUTF(RegistryProperties.getProperty(IRegistryConstants.PROP_OS, RegistryProperties.empty)); + output.writeUTF(RegistryProperties.getProperty(IRegistryConstants.PROP_WS, RegistryProperties.empty)); + output.writeUTF(RegistryProperties.getProperty(IRegistryConstants.PROP_NL, RegistryProperties.empty)); } private void saveArray(int[] array, DataOutputStream out) throws IOException { @@ -356,7 +356,7 @@ public class TableWriter { } for (int i = 0; i < exts.length; i++) { - if (!((ExtensionHandle)exts[i]).shouldPersist()) + if (!((ExtensionHandle) exts[i]).shouldPersist()) continue; IConfigurationElement[] ces = exts[i].getConfigurationElements(); int countCElements = 0; |