svn commit: r14523 - trunk/src/argouml-app/src/org/argouml/persistence/ZargoFilePersister.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: euluis
Date: 2008-04-29 16:51:03-0700
New Revision: 14523

Modified:
   trunk/src/argouml-app/src/org/argouml/persistence/ZargoFilePersister.java

Log:
issue 4946: documented potential error related to hacking the loading order by forcing first XMI (model); style changes

Modified: trunk/src/argouml-app/src/org/argouml/persistence/ZargoFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/persistence/ZargoFilePersister.java?view=diff&rev=14523&p1=trunk/src/argouml-app/src/org/argouml/persistence/ZargoFilePersister.java&p2=trunk/src/argouml-app/src/org/argouml/persistence/ZargoFilePersister.java&r1=14522&r2=14523
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/persistence/ZargoFilePersister.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/persistence/ZargoFilePersister.java	2008-04-29 16:51:03-0700
@@ -250,7 +250,7 @@
     }
 
     private Project loadFromZargo(File file, ProgressMgr progressMgr)
-            throws OpenException {
+        throws OpenException {
 
         Project p = ProjectFactory.getInstance().createProject(file.toURI());
         try {
@@ -267,6 +267,10 @@
             LOG.info(memberList.size() + " members");
 
             // Load .xmi file before any PGML files
+            // FIXME: the following is loading the model before anything else.
+            // Due to the Zargo containing the profiles, currently we have 
+            // removed this hack in UmlFilePersister and I think it should be 
+            // removed from here also.
             String xmiEntry = getEntryNames(file, ".xmi").iterator().next();
             MemberFilePersister persister = getMemberFilePersister("xmi");
             persister.load(p, makeZipEntryUrl(toURL(file), xmiEntry));
@@ -304,7 +308,8 @@
 
 
     private File zargoToUml(File file, ProgressMgr progressMgr)
-            throws OpenException, InterruptedException {
+        throws OpenException, InterruptedException {
+        
         File combinedFile = null;
         try {
             combinedFile = File.createTempFile("combinedzargo_", ".uml");
@@ -350,8 +355,8 @@
 
     
     private void copyArgo(File file, String encoding, PrintWriter writer)
-            throws IOException, MalformedURLException, OpenException,
-            UnsupportedEncodingException {
+        throws IOException, MalformedURLException, OpenException,
+        UnsupportedEncodingException {
         
         int pgmlCount = getPgmlCount(file);
         boolean containsToDo = containsTodo(file);
@@ -415,11 +420,12 @@
     }
 
     private void copyXmi(File file, String encoding, PrintWriter writer)
-            throws IOException, MalformedURLException,
-            UnsupportedEncodingException {
+        throws IOException, MalformedURLException,
+        UnsupportedEncodingException {
 
         ZipInputStream zis = openZipStreamAt(toURL(file), ".xmi");
-        BufferedReader reader = new BufferedReader(new InputStreamReader(zis, encoding));
+        BufferedReader reader = new BufferedReader(
+                new InputStreamReader(zis, encoding));
         // Skip 1 lines
         reader.readLine();
 
@@ -431,7 +437,7 @@
 
     
     private void copyDiagrams(File file, String encoding, PrintWriter writer)
-            throws IOException {
+        throws IOException {
         
         // Loop round loading the diagrams
         ZipInputStream zis = new ZipInputStream(toURL(file).openStream());
@@ -462,9 +468,9 @@
     }
     
     
-    private void copyMember(File file, String tag, String outputEncoding, PrintWriter writer)
-            throws IOException, MalformedURLException,
-            UnsupportedEncodingException {
+    private void copyMember(File file, String tag, String outputEncoding, 
+            PrintWriter writer) throws IOException, MalformedURLException,
+                UnsupportedEncodingException {
 
         ZipInputStream zis = openZipStreamAt(toURL(file), "." + tag);
         
@@ -533,12 +539,12 @@
     }
 
     private InputStream openZipEntry(URL url, String entryName)
-            throws MalformedURLException, IOException {
+        throws MalformedURLException, IOException {
         return makeZipEntryUrl(url, entryName).openStream();
     }
 
     private URL makeZipEntryUrl(URL url, String entryName)
-            throws MalformedURLException {
+        throws MalformedURLException {
         String entryURL = "jar:" + url + "!/" + entryName;
         return new URL(entryURL);
     }
@@ -599,7 +605,8 @@
      * If the extension is null, all entries are returned.
      */
     private List<String> getEntryNames(File file, String extension)
-            throws IOException, MalformedURLException {
+        throws IOException, MalformedURLException {
+        
         ZipInputStream zis = new ZipInputStream(toURL(file).openStream());
         List<String> result = new ArrayList<String>();
         ZipEntry entry = zis.getNextEntry();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.