Author: michiel
Date: 2010-04-03 17:18:20 +0200 (Sat, 03 Apr 2010)
New Revision: 41760

Modified:
   mmbase/trunk/utils/src/main/java/org/mmbase/util/magicfile/XmlDetector.java
Log:
comments only

Modified: 
mmbase/trunk/utils/src/main/java/org/mmbase/util/magicfile/XmlDetector.java
===================================================================
--- mmbase/trunk/utils/src/main/java/org/mmbase/util/magicfile/XmlDetector.java 
2010-04-03 15:05:44 UTC (rev 41759)
+++ mmbase/trunk/utils/src/main/java/org/mmbase/util/magicfile/XmlDetector.java 
2010-04-03 15:18:20 UTC (rev 41760)
@@ -24,6 +24,7 @@
  *
  * @version $Id$
  * @author Michiel Meeuwissen
+ * @since MMBase-1.9.3
  */
 
 public class XmlDetector extends AbstractDetector {
@@ -54,13 +55,19 @@
             parser.setErrorHandler(new ErrorHandler(false, 
ErrorHandler.FATAL_ERROR));
             InputSource source = new InputSource(new 
ByteArrayInputStream(lithmus));
             parser.parse(source);
+
+            // successfully parsed (which is remarkable while the byte array 
is truncated),
+            // but no matches found.
             return false;
         } catch (Matched m) {
+            // Parsing interrupted because of a match!
             log.debug("Matched " + m.getMessage());
             return true;
         } catch (SAXException e) {
+            // probably not XML, probably end of array reached.
             return false;
         } catch (java.io.IOException ioe) {
+            // this really is exceptional, and should not happen
             log.warn(ioe);
             return false;
         }
@@ -74,6 +81,9 @@
         }
     }
 
+    /**
+     * In case a match is found, this exception is thrown and further parsing 
is interrupted.
+     */
     protected class Matched extends RuntimeException {
         public Matched(String mes) {
             super(mes);

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to