summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-05-26 13:46:42 (EDT)
committer pelder2006-05-26 13:46:42 (EDT)
commitbc511de29f3e07c5baa8e87e8c20f829fbb0babb (patch)
tree6eca488021cc7c506fe7e17f964318a9ae5a0d72
parent54a3b698f5a74747b90133031db83bc959e0f16c (diff)
downloadorg.eclipse.jet-bc511de29f3e07c5baa8e87e8c20f829fbb0babb.zip
org.eclipse.jet-bc511de29f3e07c5baa8e87e8c20f829fbb0babb.tar.gz
org.eclipse.jet-bc511de29f3e07c5baa8e87e8c20f829fbb0babb.tar.bz2
[144005] Fix NPE when no saved state information is found.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/builder/JET2Builder.java71
1 files changed, 37 insertions, 34 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/builder/JET2Builder.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/builder/JET2Builder.java
index 0eb1316..87ec0af 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/builder/JET2Builder.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/builder/JET2Builder.java
@@ -308,50 +308,53 @@ public class JET2Builder extends IncrementalProjectBuilder implements SavedState
compilerState = null;
- if (DEBUG)
- System.out.println("JET2Builder: startupOnInitialize " + getProject()); //$NON-NLS-1$
+ if (DEBUG) System.out.println("JET2Builder: startupOnInitialize " + getProject()); //$NON-NLS-1$
try
{
IPath fileLocation = savedStateManager.addSaveSaver(this, getProject());
- File savedStateFile = fileLocation.toFile();
- try
+ if (fileLocation != null)
{
- ObjectInputStream ois = new ObjectInputStream(new java.io.FileInputStream(savedStateFile));
- compilerState = (JETCompilerState)ois.readObject();
- ois.close();
- if(DEBUG)
+ File savedStateFile = fileLocation.toFile();
+ try
{
- System.out.println(" loaded compilerState from saved state"); //$NON-NLS-1$
- System.out.print(" taglibs : ["); //$NON-NLS-1$
- String[] ids = compilerState.getAllReferencedTagLibraryIds();
- for (int i = 0; i < ids.length; i++)
+ ObjectInputStream ois = new ObjectInputStream(new java.io.FileInputStream(savedStateFile));
+ compilerState = (JETCompilerState)ois.readObject();
+ ois.close();
+ if (DEBUG)
{
- if(i != 0) System.out.print(", "); //$NON-NLS-1$
- System.out.print(ids[i]);
+ System.out.println(" loaded compilerState from saved state"); //$NON-NLS-1$
+ System.out.print(" taglibs : ["); //$NON-NLS-1$
+ String[] ids = compilerState.getAllReferencedTagLibraryIds();
+ for (int i = 0; i < ids.length; i++)
+ {
+ if (i != 0)
+ System.out.print(", "); //$NON-NLS-1$
+ System.out.print(ids[i]);
+ }
+ System.out.println("]"); //$NON-NLS-1$
+ System.out.println(" templates : " + compilerState.getTemplateMap()); //$NON-NLS-1$
}
- System.out.println("]"); //$NON-NLS-1$
- System.out.println(" templates : " + compilerState.getTemplateMap()); //$NON-NLS-1$
}
- }
- catch (FileNotFoundException e)
- {
- // nothing to do, the state was not saved for some reason.
- JETActivatorWrapper.INSTANCE.log(e);
- }
- catch (IOException e)
- {
- // error reading the file, assume state is unrecoverable.
- // remove the state file.
- JETActivatorWrapper.INSTANCE.log(e);
- savedStateFile.delete();
- }
- catch (ClassNotFoundException e)
- {
- // error in deserializing the file. This should not happen. Log an error, for the record...
- InternalJET2Platform.logError("Could not deserialize JET2Builder State", e); //$NON-NLS-1$
- }
+ catch (FileNotFoundException e)
+ {
+ // nothing to do, the state was not saved for some reason.
+ JETActivatorWrapper.INSTANCE.log(e);
+ }
+ catch (IOException e)
+ {
+ // error reading the file, assume state is unrecoverable.
+ // remove the state file.
+ JETActivatorWrapper.INSTANCE.log(e);
+ savedStateFile.delete();
+ }
+ catch (ClassNotFoundException e)
+ {
+ // error in deserializing the file. This should not happen. Log an error, for the record...
+ InternalJET2Platform.logError("Could not deserialize JET2Builder State", e); //$NON-NLS-1$
+ }
+ }
}
finally
{