felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r707380 - in /felix/trunk/ipojo: core/src/main/java/org/apache/felix/ipojo/util/Logger.java manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
Date Thu, 23 Oct 2008 14:37:55 GMT
Author: clement
Date: Thu Oct 23 07:37:55 2008
New Revision: 707380

URL: http://svn.apache.org/viewvc?rev=707380&view=rev
Log:
Fix issue Felix-787.
The internal logger does no more print messages if a log service is available.

Remove a dependency on Java 1.5 in the manipulator (String.contains(String) is replaced by
a String.indexOf(String)).

Modified:
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Logger.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Logger.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Logger.java?rev=707380&r1=707379&r2=707380&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Logger.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Logger.java Thu Oct 23
07:37:55 2008
@@ -133,35 +133,40 @@
         String message = null;
         switch (level) {
             case DEBUG:
-                message = "[" + m_name + "] DEBUG: " + msg;
+                message = "[DEBUG] " + m_name + " : " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_DEBUG, message);
+                } else {
+                    System.err.println(message);
                 }
-                System.err.println(message); // NOPMD
                 break;
             case ERROR:
-                message = "[" + m_name + "] ERROR: " + msg;
+                message = "[ERROR] " + m_name + " : " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_ERROR, message);
+                } else {
+                    System.err.println(message);
                 }
-                System.err.println(message); //NOPMD
                 break;
             case INFO:
-                message = "[" + m_name + "] INFO: " + msg;
+                message = "[INFO] " + m_name + " : " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_INFO, message);
+                } else {
+                    System.err.println(message);
                 }
-                System.err.println(message); // NOPMD
                 break;
             case WARNING:
-                message = "[" + m_name + "] WARNING: " + msg;
+                message = "[WARNING] " + m_name + " : " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_WARNING, message);
+                } else {
+                    System.err.println(message);
                 }
-                System.err.println(message); // NOPMD
                 break;
             default:
-                System.err.println("[" + m_name + "] UNKNOWN[" + level + "]: " + msg); //
NOPMD
+                message = "[UNKNOWN] " + m_name + " : " + msg;
+                System.err.println(message);
                 break;
         }
         
@@ -187,40 +192,45 @@
         String message = null;
         switch (level) {
             case DEBUG:
-                message = "[" + m_name + "] DEBUG: " + msg;
+                message = "[DEBUG] " + m_name + " : " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_DEBUG, message, exception);
+                } else {
+                    System.err.println(message);
+                    exception.printStackTrace();
                 }
-                System.err.println(message); // NOPMD
-                exception.printStackTrace(); // NOPMD
                 break;
             case ERROR:
-                message = "[" + m_name + "] ERROR: " + msg;
+                message = "[ERROR] " + m_name + " : " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_ERROR, message, exception);
+                } else {
+                    System.err.println(message);
+                    exception.printStackTrace();
                 }
-                System.err.println(message); // NOPMD
-                exception.printStackTrace(System.err); // NOPMD
                 break;
             case INFO:
-                message = "[" + m_name + "] INFO: " + msg;
+                message = "[INFO] " + m_name + " : " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_INFO, message, exception);
+                } else {
+                    System.err.println(message);
+                    exception.printStackTrace();
                 }
-                System.err.println(message); // NOPMD
-                exception.printStackTrace(System.err); // NOPMD
                 break;
             case WARNING:
-                message = "[" + m_name + "] WARNING: " + msg;
+                message = "[WARNING] " + m_name + " : " + msg;
                 if (log != null) {
                     log.log(LogService.LOG_WARNING, message, exception);
+                } else {
+                    System.err.println(message);
+                    exception.printStackTrace();
                 }
-                System.err.println(message); // NOPMD
-                exception.printStackTrace(System.err); // NOPMD
                 break;
             default:
-                System.err.println("[" + m_name + "] UNKNOWN[" + level + "]: " + msg); //
NOPMD
-                exception.printStackTrace(); // NOPMD
+                message = "[UNKNOWN] " + m_name + " : " + msg;
+                System.err.println(message);
+                exception.printStackTrace();
                 break;
         }
         

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java?rev=707380&r1=707379&r2=707380&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
(original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
Thu Oct 23 07:37:55 2008
@@ -255,7 +255,7 @@
      * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
      */
     public void error(SAXParseException saxparseexception) throws SAXException {
-        if (saxparseexception.getMessage().contains("cvc-elt.1")) {
+        if (saxparseexception.getMessage().indexOf("cvc-elt.1") != -1) {
             return; // Do not throw an exception when no schema defined.
         }
         throw saxparseexception;



Mime
View raw message