diff --git a/platform/platform-impl/src/com/intellij/openapi/application/ex/DecodeDefaultsUtil.java b/platform/platform-impl/src/com/intellij/openapi/application/ex/DecodeDefaultsUtil.java index 8b4eb180c65f..f57812afca18 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/ex/DecodeDefaultsUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/ex/DecodeDefaultsUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package com.intellij.openapi.application.ex; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.io.URLUtil; +import gnu.trove.THashMap; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; @@ -25,28 +26,27 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Collections; -import java.util.HashMap; import java.util.Map; public class DecodeDefaultsUtil { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.application.ex.DecodeDefaultsUtil"); - private static final Map myResourceCache = Collections.synchronizedMap(new HashMap()); + private static final Map RESOURCE_CACHE = Collections.synchronizedMap(new THashMap()); @NonNls private static final String XML_EXTENSION = ".xml"; public static URL getDefaults(Object requestor, final String componentResourcePath) { - if (myResourceCache.containsKey(componentResourcePath)) { - return myResourceCache.get(componentResourcePath); + if (RESOURCE_CACHE.containsKey(componentResourcePath)) { + return RESOURCE_CACHE.get(componentResourcePath); } URL url = getDefaultsImpl(requestor, componentResourcePath); - myResourceCache.put(componentResourcePath, url); + RESOURCE_CACHE.put(componentResourcePath, url); return url; } private static URL getDefaultsImpl(final Object requestor, final String componentResourcePath) { - boolean isPathAbsoulte = StringUtil.startsWithChar(componentResourcePath, '/'); - if (isPathAbsoulte) { + boolean isPathAbsolute = StringUtil.startsWithChar(componentResourcePath, '/'); + if (isPathAbsolute) { return requestor.getClass().getResource(componentResourcePath + XML_EXTENSION); } else { @@ -54,7 +54,6 @@ public class DecodeDefaultsUtil { } } - @Nullable public static InputStream getDefaultsInputStream(Object requestor, final String componentResourcePath) { try { diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultsStateStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultsStateStorage.java index ebcc6baace25..a8170ea9fbfa 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultsStateStorage.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DefaultsStateStorage.java @@ -41,7 +41,7 @@ class DefaultsStateStorage implements StateStorage { } @Nullable - public Element getState(final Object component, final String componentName) throws StateStorageException { + private Element getState(final Object component, final String componentName) throws StateStorageException { final URL url = DecodeDefaultsUtil.getDefaults(component, componentName); if (url == null) { return null; @@ -50,7 +50,7 @@ class DefaultsStateStorage implements StateStorage { try { Document document = JDOMUtil.loadDocument(url); document = JDOMXIncluder.resolve(document, url.toExternalForm()); - final Element documentElement = document.getRootElement(); + final Element documentElement = document.detachRootElement(); if (myPathMacroManager != null) { myPathMacroManager.expandPaths(documentElement); @@ -78,9 +78,9 @@ class DefaultsStateStorage implements StateStorage { } @Override - @NotNull + @Nullable public ExternalizationSession startExternalization() { - throw new UnsupportedOperationException("Method startExternalization not implemented in " + getClass()); + return null; } @Override