svn commit: r18232 - trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2010-04-09 09:29:48-0700
New Revision: 18232

Modified:
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java

Log:
Remove dead code.  Only copy input when needed.

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java?view=diff&pathrev=18232&r1=18231&r2=18232
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java	2010-04-09 09:29:48-0700
@@ -1,12 +1,14 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2005,2010 Contributors - see below
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
+ *    Bob Tarling
+ *    Tom Morris
  *    euluis
  *****************************************************************************
  *
@@ -45,7 +47,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -221,9 +222,14 @@
 
             try {
                 String systemId = inputSource.getSystemId();
-                File file = copySource(inputSource);
-                systemId = file.toURI().toURL().toExternalForm();
-                inputSource = new InputSource(systemId);
+                // If we've got a streaming input, copy it to make sure we'll
+                // be able to rewind it if necessary
+                if (inputSource.getByteStream() != null
+                        || inputSource.getCharacterStream() != null) {
+                    File file = copySource(inputSource);
+                    systemId = file.toURI().toURL().toExternalForm();
+                    inputSource = new InputSource(systemId);
+                }
                 MDRepository repository = modelImpl.getRepository();
                 
                 // Use a transaction to avoid the performance penalty (3x) of 
@@ -321,19 +327,6 @@
         return newElements;
     }
 
-    
-    private void deleteElements(Collection<RefObject> elements) {
-        Collection<RefObject> toDelete = new ArrayList<RefObject>(elements);
-        for (RefObject refObject : toDelete) {
-            try {
-                refObject.refDelete();
-            } catch (InvalidObjectException e) {
-                // Just continue.  We tried to delete something 
-                // twice, probably because it was contained in 
-                // another element that we already deleted.
-            }
-        }
-    }
 
     private Collection<RefObject> convertAndLoadUml13(String systemId,
             RefPackage extent, XMIReader xmiReader, InputSource input)

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2534319

To unsubscribe from this discussion, e-mail: [[email protected]].
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.