Index: trunk/quest-plugin-jfc/src/main/java/de/ugoe/cs/quest/plugin/jfc/JFCTraceCorrector.java
===================================================================
--- trunk/quest-plugin-jfc/src/main/java/de/ugoe/cs/quest/plugin/jfc/JFCTraceCorrector.java	(revision 832)
+++ trunk/quest-plugin-jfc/src/main/java/de/ugoe/cs/quest/plugin/jfc/JFCTraceCorrector.java	(revision 833)
@@ -1,4 +1,5 @@
 package de.ugoe.cs.quest.plugin.jfc;
 
+import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -10,5 +11,7 @@
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.xml.parsers.ParserConfigurationException;
@@ -68,8 +71,9 @@
     /**
      * <p>
-     * the list of all sources parsed in a file
-     * </p>
-     */
-    private List<Source> allSources = new ArrayList<Source>();
+     * the list of all sources parsed in a file identified through their <code>toString</code>
+     * representation
+     * </p>
+     */
+    private Map<String, List<Source>> allSources = new HashMap<String, List<Source>>();
 
     /**
@@ -176,5 +180,5 @@
         
         try {
-            outFile = new PrintStream(new FileOutputStream(resultFile));
+            outFile = new PrintStream(new BufferedOutputStream(new FileOutputStream(resultFile)));
             outFile.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
         }
@@ -348,5 +352,45 @@
      */
     private void rememberSource(Source source) {
-        allSources.add(source);
+        String toStringValue = getToStringParam(source);
+        
+        List<Source> sources = allSources.get(toStringValue);
+        
+        if (sources == null) {
+            sources = new ArrayList<Source>();
+            allSources.put(toStringValue, sources);
+        }
+        
+        sources.add(source);
+    }
+
+    /**
+     * <p>
+     * convenience method to find a source based on its <code>toString</code> parameter value.
+     * The method only returns sources, which match the provided <code>toString</code>
+     * representation and which have a valid list of components.
+     * </p>
+     *
+     * @param toStringValue the value of the <code>toString</code> parameter the source to find
+     *                      must have
+     * 
+     * @return the source matching the parameter and having a valid list of components or null if
+     *         none is found
+     */
+    private Source findSource(String toStringValue) {
+        Source existingSource = null;
+        
+        List<Source> candidates = allSources.get(toStringValue);
+        
+        if (candidates != null) {
+            for (Source candidate : candidates) {
+                if (toStringValue.equals(getToStringParam(candidate)) &&
+                        (candidate.components != null) && (candidate.components.size() > 0))
+                {
+                    existingSource = candidate;
+                }
+            }
+        }
+        
+        return existingSource;
     }
 
@@ -395,11 +439,5 @@
         
         if (toStringValue != null) {
-            for (Source candidate : allSources) {
-                if (toStringValue.equals(getToStringParam(candidate)) &&
-                    (candidate.components != null) && (candidate.components.size() > 0))
-                {
-                    existingSource = candidate;
-                }
-            }
+            existingSource = findSource(toStringValue);
         }
         
