Increase coverage for Env module
[aaf/authz.git] / misc / env / src / main / java / org / onap / aaf / misc / env / impl / JavaUtilLogTarget.java
index 84a78bf..ac3e8b4 100644 (file)
@@ -1,90 +1,90 @@
-/**
- * ============LICENSE_START====================================================
- * org.onap.aaf
- * ===========================================================================
- * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- * ===========================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END====================================================
- *
- */
-
-package org.onap.aaf.misc.env.impl;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.onap.aaf.misc.env.LogTarget;
-
-/**
- * This LogTarget Implementation is included mostly because the JavaUtil based logging is included in the
- * JDK.  This makes the default implementation independent of any external Jars.
- * 
- *  Log4j is often considered more Enterprise capable.  See Log4JLogTarget for that implementation
- * 
- * @author Jonathan
- *
- */
-public class JavaUtilLogTarget implements LogTarget {
-       private Level level;
-       private Logger log;
-
-       public JavaUtilLogTarget(Logger logger, Level theLevel) {
-               log = logger;
-               level = theLevel;
-       }
-
-       public boolean isLoggable() {
-               return log.isLoggable(level);
-       }
-
-       public void log(Object ... msgs) {
-               if(log.isLoggable(level)) {
-                       StringBuilder sb = new StringBuilder();
-                       String msg;
-                       for(int i=0;i<msgs.length;++i) {
-                               msg = msgs[i].toString();
-                               if(msg!=null && msg.length()>0) {
-                                       int sbl = sb.length();
-                                       if(sbl>0) {
-                                               char last = sb.charAt(sbl-1);
-                                               if(" (.".indexOf(last)<0 && "().".indexOf(msg.charAt(0))<0)sb.append(' ');
-                                       }
-                                       sb.append(msg);
-                               }
-                       }
-                       log.log(level, sb.toString());
-               }
-       }
-
-       public void log(Throwable e, Object ... msgs) {
-               String str = e.getLocalizedMessage();
-               if(str==null) {
-                       str = e.getMessage();
-               }
-               if(str==null) {
-                       str = e.getClass().getName();
-               }
-               log.log(level,str,msgs);
-       }
-
-       /* (non-Javadoc)
-        * @see com.att.inno.env.LogTarget#printf(java.lang.String, java.lang.String[])
-        */
-       @Override
-       public void printf(String fmt, Object ... vars) {
-               if(log.isLoggable(level)) {
-                       log.log(level,String.format(fmt,vars));
-               }
-       }
-}      
+/**\r
+ * ============LICENSE_START====================================================\r
+ * org.onap.aaf\r
+ * ===========================================================================\r
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ===========================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END====================================================\r
+ *\r
+ */\r
+\r
+package org.onap.aaf.misc.env.impl;\r
+\r
+import java.util.logging.Level;\r
+import java.util.logging.Logger;\r
+\r
+import org.onap.aaf.misc.env.LogTarget;\r
+\r
+/**\r
+ * This LogTarget Implementation is included mostly because the JavaUtil based logging is included in the\r
+ * JDK.  This makes the default implementation independent of any external Jars.\r
+ * \r
+ *  Log4j is often considered more Enterprise capable.  See Log4JLogTarget for that implementation\r
+ * \r
+ * @author Jonathan\r
+ *\r
+ */\r
+public class JavaUtilLogTarget implements LogTarget {\r
+       private Level level;\r
+       private Logger log;\r
+\r
+       public JavaUtilLogTarget(Logger logger, Level theLevel) {\r
+               log = logger;\r
+               level = theLevel;\r
+       }\r
+\r
+       public boolean isLoggable() {\r
+               return log.isLoggable(level);\r
+       }\r
+\r
+       public void log(Object ... msgs) {\r
+               if(log.isLoggable(level)) {\r
+                       StringBuilder sb = new StringBuilder();\r
+                       String msg;\r
+                       for(int i=0;i<msgs.length;++i) {\r
+                               msg = msgs[i].toString();\r
+                               if(msg!=null && msg.length()>0) {\r
+                                       int sbl = sb.length();\r
+                                       if(sbl>0) {\r
+                                               char last = sb.charAt(sbl-1);\r
+                                               if(" (.".indexOf(last)<0 && "().".indexOf(msg.charAt(0))<0)sb.append(' ');\r
+                                       }\r
+                                       sb.append(msg);\r
+                               }\r
+                       }\r
+                       log.log(level, sb.toString());\r
+               }\r
+       }\r
+\r
+       public void log(Throwable e, Object ... msgs) {\r
+               String str = e.getLocalizedMessage();\r
+               if(str==null) {\r
+                       str = e.getMessage();\r
+               }\r
+               if(str==null) {\r
+                       str = e.getClass().getName();\r
+               }\r
+               log.log(level,str,msgs);\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see com.att.inno.env.LogTarget#printf(java.lang.String, java.lang.String[])\r
+        */\r
+       @Override\r
+       public void printf(String fmt, Object ... vars) {\r
+               if(log.isLoggable(level)) {\r
+                       log.log(level,String.format(fmt,vars));\r
+               }\r
+       }\r
+}      \r