From f56a0fff1a336635c966bffc25e16af9a4e6e988 Mon Sep 17 00:00:00 2001 From: Tor Norbye Date: Mon, 6 May 2013 10:36:42 -0700 Subject: Snapshot 36a7a0702ddda30083713c9b8f140495d5f09d32 from master branch of git://git.jetbrains.org/idea/community.git Change-Id: Ia9068e36d373808400a123a395b037bdb6940a17 --- .../generic/GenericCompilerPersistentData.java | 49 ++++++++++++---------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'java/compiler') diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerPersistentData.java b/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerPersistentData.java index 513be6c798f4..86c6803d6977 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerPersistentData.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerPersistentData.java @@ -16,6 +16,7 @@ package com.intellij.compiler.impl.generic; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.util.io.FileUtil; import com.intellij.util.io.IOUtil; import gnu.trove.TIntHashSet; import org.jetbrains.annotations.NotNull; @@ -46,32 +47,38 @@ public class GenericCompilerPersistentData { return; } - DataInputStream input = new DataInputStream(new BufferedInputStream(new FileInputStream(myFile))); try { - final int dataVersion = input.readInt(); - if (dataVersion != VERSION) { - LOG.info("Version of compiler info file (" + myFile.getAbsolutePath() + ") changed: " + dataVersion + " -> " + VERSION); - myVersionChanged = true; - return; - } + DataInputStream input = new DataInputStream(new BufferedInputStream(new FileInputStream(myFile))); + try { + final int dataVersion = input.readInt(); + if (dataVersion != VERSION) { + LOG.info("Version of compiler info file (" + myFile.getAbsolutePath() + ") changed: " + dataVersion + " -> " + VERSION); + myVersionChanged = true; + return; + } - final int savedCompilerVersion = input.readInt(); - if (savedCompilerVersion != compilerVersion) { - LOG.info("Compiler caches version changed (" + myFile.getAbsolutePath() + "): " + savedCompilerVersion + " -> " + compilerVersion); - myVersionChanged = true; - return; - } + final int savedCompilerVersion = input.readInt(); + if (savedCompilerVersion != compilerVersion) { + LOG.info("Compiler caches version changed (" + myFile.getAbsolutePath() + "): " + savedCompilerVersion + " -> " + compilerVersion); + myVersionChanged = true; + return; + } - int size = input.readInt(); - while (size-- > 0) { - final String target = IOUtil.readString(input); - final int id = input.readInt(); - myTarget2Id.put(target, id); - myUsedIds.add(id); + int size = input.readInt(); + while (size-- > 0) { + final String target = IOUtil.readString(input); + final int id = input.readInt(); + myTarget2Id.put(target, id); + myUsedIds.add(id); + } + } + finally { + input.close(); } } - finally { - input.close(); + catch (IOException e) { + FileUtil.delete(myFile); + throw e; } } -- cgit v1.2.3