fix for FELIX-1588
plus tidy up unused code


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@814608 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
index 3050151..08c29a6 100644
--- a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
+++ b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
@@ -103,17 +103,7 @@
         this.project = project;
         bldProjectFile = project.getFile( new Path( SigilCore.SIGIL_PROJECT_FILE ) );
     }
-
-
-    // to aid testing conversion between project file formats
-    public InputStream saveBundle( ISigilBundle b ) throws CoreException
-    {
-        setBundle( b );
-        // FIXME causes NPE in JavaHelper
-        // calculateUses();
-        return buildContents();
-    }
-
+    
 
     public void save( IProgressMonitor monitor ) throws CoreException
     {
@@ -260,9 +250,11 @@
 
     public ISigilBundle getBundle()
     {
-        if ( bundle == null && bldProjectFile != null )
+        ISigilBundle b = null;
+        
+        synchronized ( bldProjectFile )
         {
-            synchronized ( bldProjectFile )
+            if ( bundle == null )
             {
                 try
                 {
@@ -283,14 +275,19 @@
                     SigilCore.error( "Failed to build bundle", e );
                 }
             }
+            
+            b = bundle;
         }
-        return bundle;
+        
+        return b;
     }
 
 
     public void setBundle( ISigilBundle bundle )
     {
-        this.bundle = bundle;
+        synchronized( bldProjectFile ) {
+            this.bundle = bundle;
+        }
     }
 
 
@@ -543,20 +540,6 @@
     }
 
 
-    //    private InputStream buildXMLContents() throws CoreException {
-    //    	Serializer serializer = SigilCore.getDefault().getDescriptorSerializer();
-    //    	
-    //    	ByteArrayOutputStream buf = new ByteArrayOutputStream();
-    //    	
-    //    	try {
-    //    		serializer.serialize(getBundle(), buf);
-    //    	} catch (SerializingException e) {
-    //			throw SigilCore.newCoreException("Failed to serialize " + this, e);
-    //    	}
-    //    	
-    //        return new ByteArrayInputStream(buf.toByteArray());
-    //    }
-
     public String getName()
     {
         return getProject().getName();