From 522ef999957e145065af718e6fcb9484defc265b Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 1 Oct 2013 12:29:43 +0200 Subject: [PATCH] Cleanup (single usage inlined) --- .../openapi/vfs/impl/jar/JarHandlerBase.java | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandlerBase.java b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandlerBase.java index 49291d85ded6..7176ebbf1077 100644 --- a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandlerBase.java +++ b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandlerBase.java @@ -75,31 +75,6 @@ public class JarHandlerBase { } } - @NotNull - protected Map initEntries() { - synchronized (lock) { - Map map = myRelPathsToEntries != null ? myRelPathsToEntries.get() : null; - if (map == null) { - final JarFile zip = getJar(); - - map = new THashMap(); - if (zip != null) { - map.put("", new EntryInfo("", null, true)); - final Enumeration entries = zip.entries(); - while (entries.hasMoreElements()) { - JarFile.JarEntry entry = entries.nextElement(); - final String name = entry.getName(); - final boolean isDirectory = StringUtil.endsWithChar(name, '/'); - getOrCreate(isDirectory ? name.substring(0, name.length() - 1) : name, isDirectory, map); - } - - myRelPathsToEntries = new SoftReference>(map); - } - } - return map; - } - } - public File getMirrorFile(@NotNull File originalFile) { return originalFile; } @@ -267,7 +242,27 @@ public class JarHandlerBase { @NotNull protected Map getEntriesMap() { - return initEntries(); + synchronized (lock) { + Map map = myRelPathsToEntries != null ? myRelPathsToEntries.get() : null; + if (map == null) { + final JarFile zip = getJar(); + + map = new THashMap(); + if (zip != null) { + map.put("", new EntryInfo("", null, true)); + final Enumeration entries = zip.entries(); + while (entries.hasMoreElements()) { + JarFile.JarEntry entry = entries.nextElement(); + final String name = entry.getName(); + final boolean isDirectory = StringUtil.endsWithChar(name, '/'); + getOrCreate(isDirectory ? name.substring(0, name.length() - 1) : name, isDirectory, map); + } + + myRelPathsToEntries = new SoftReference>(map); + } + } + return map; + } } @NotNull