You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2021/07/22 05:39:03 UTC

[pdfbox-jbig2] branch master updated: PDFBOX-4671: remove remaining log statement, delete logger classes

This is an automated email from the ASF dual-hosted git repository.

lehmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git


The following commit(s) were added to refs/heads/master by this push:
     new 92627e8  PDFBOX-4671: remove remaining log statement, delete logger classes
92627e8 is described below

commit 92627e850ac14c7acb49360ace5bebba5fb94770
Author: Andreas Lehmkühler <an...@lehmi.de>
AuthorDate: Thu Jul 22 07:38:46 2021 +0200

    PDFBOX-4671: remove remaining log statement, delete logger classes
---
 .../apache/pdfbox/jbig2/segments/TextRegion.java   |   7 --
 .../apache/pdfbox/jbig2/util/log/JDKLogger.java    | 105 ----------------
 .../pdfbox/jbig2/util/log/JDKLoggerBridge.java     |  28 -----
 .../org/apache/pdfbox/jbig2/util/log/Logger.java   | 134 ---------------------
 .../apache/pdfbox/jbig2/util/log/LoggerBridge.java |  25 ----
 .../pdfbox/jbig2/util/log/LoggerFactory.java       |  62 ----------
 .../org.apache.pdfbox.jbig2.util.log.LoggerBridge  |  18 ---
 .../pdfbox/jbig2/util/LoggerFactoryTest.java       |  43 -------
 8 files changed, 422 deletions(-)

diff --git a/src/main/java/org/apache/pdfbox/jbig2/segments/TextRegion.java b/src/main/java/org/apache/pdfbox/jbig2/segments/TextRegion.java
index 3d834e9..4aaaf49 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/segments/TextRegion.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/segments/TextRegion.java
@@ -38,17 +38,12 @@ import org.apache.pdfbox.jbig2.err.InvalidHeaderValueException;
 import org.apache.pdfbox.jbig2.image.Bitmaps;
 import org.apache.pdfbox.jbig2.io.SubInputStream;
 import org.apache.pdfbox.jbig2.util.CombinationOperator;
-import org.apache.pdfbox.jbig2.util.log.Logger;
-import org.apache.pdfbox.jbig2.util.log.LoggerFactory;
 
 /**
  * This class represented the segment type "Text region", 7.4.3, page 56.
  */
 public class TextRegion implements Region
 {
-
-    private final Logger log = LoggerFactory.getLogger(TextRegion.class);
-
     private SubInputStream subInputStream;
 
     /** Region segment information field, 7.4.1 */
@@ -258,8 +253,6 @@ public class TextRegion implements Region
         long pixels = (long) regionInfo.getBitmapWidth() * (long) regionInfo.getBitmapHeight();
         if (pixels < amountOfSymbolInstances)
         {
-            log.warn("Limiting number of decoded symbol instances to one per pixel (" + pixels
-                    + " instead of " + amountOfSymbolInstances + ")");
             amountOfSymbolInstances = pixels;
         }
     }
diff --git a/src/main/java/org/apache/pdfbox/jbig2/util/log/JDKLogger.java b/src/main/java/org/apache/pdfbox/jbig2/util/log/JDKLogger.java
deleted file mode 100644
index 97002c1..0000000
--- a/src/main/java/org/apache/pdfbox/jbig2/util/log/JDKLogger.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.pdfbox.jbig2.util.log;
-
-import java.util.logging.Level;
-
-public class JDKLogger implements Logger
-{
-    final java.util.logging.Logger wrappedLogger;
-
-    public JDKLogger(java.util.logging.Logger logger)
-    {
-        wrappedLogger = logger;
-    }
-
-    public void debug(String msg)
-    {
-        wrappedLogger.log(Level.FINE, msg);
-    }
-
-    public void debug(String msg, Throwable t)
-    {
-        wrappedLogger.log(Level.FINE, msg, t);
-    }
-
-    public void info(String msg)
-    {
-        wrappedLogger.log(Level.INFO, msg);
-    }
-
-    public void info(String msg, Throwable t)
-    {
-        wrappedLogger.log(Level.INFO, msg, t);
-    }
-
-    public void warn(String msg)
-    {
-        wrappedLogger.log(Level.WARNING, msg);
-    }
-
-    public void warn(String msg, Throwable t)
-    {
-        wrappedLogger.log(Level.WARNING, msg, t);
-    }
-
-    public void fatal(String msg)
-    {
-        wrappedLogger.log(Level.SEVERE, msg);
-    }
-
-    public void fatal(String msg, Throwable t)
-    {
-        wrappedLogger.log(Level.SEVERE, msg, t);
-    }
-
-    public void error(String msg)
-    {
-        wrappedLogger.log(Level.SEVERE, msg);
-    }
-
-    public void error(String msg, Throwable t)
-    {
-        wrappedLogger.log(Level.SEVERE, msg, t);
-    }
-
-    public boolean isDebugEnabled()
-    {
-        return wrappedLogger.isLoggable(Level.FINE);
-    }
-
-    public boolean isInfoEnabled()
-    {
-        return wrappedLogger.isLoggable(Level.INFO);
-    }
-
-    public boolean isWarnEnabled()
-    {
-        return wrappedLogger.isLoggable(Level.WARNING);
-    }
-
-    public boolean isFatalEnabled()
-    {
-        return wrappedLogger.isLoggable(Level.SEVERE);
-    }
-
-    public boolean isErrorEnabled()
-    {
-        return wrappedLogger.isLoggable(Level.SEVERE);
-    }
-}
diff --git a/src/main/java/org/apache/pdfbox/jbig2/util/log/JDKLoggerBridge.java b/src/main/java/org/apache/pdfbox/jbig2/util/log/JDKLoggerBridge.java
deleted file mode 100644
index f096734..0000000
--- a/src/main/java/org/apache/pdfbox/jbig2/util/log/JDKLoggerBridge.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.pdfbox.jbig2.util.log;
-
-public class JDKLoggerBridge implements LoggerBridge
-{
-
-    public Logger getLogger(Class<?> classToBeLogged)
-    {
-        return new JDKLogger(java.util.logging.Logger.getLogger(classToBeLogged.getName()));
-    }
-
-}
diff --git a/src/main/java/org/apache/pdfbox/jbig2/util/log/Logger.java b/src/main/java/org/apache/pdfbox/jbig2/util/log/Logger.java
deleted file mode 100644
index 88d5493..0000000
--- a/src/main/java/org/apache/pdfbox/jbig2/util/log/Logger.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.pdfbox.jbig2.util.log;
-
-public interface Logger
-{
-
-    /**
-     * Log a message at the DEBUG level.
-     * 
-     * @param msg the message string to be logged
-     */
-    public void debug(String msg);
-
-    /**
-     * Log an exception ({@link Throwable}) at the DEBUG level with an accompanying message.
-     * 
-     * @param msg the message accompanying the exception.
-     * @param t the exception ({@link Throwable}) to log.
-     */
-    public void debug(String msg, Throwable t);
-
-    /**
-     * Log a message at the INFO level.
-     * 
-     * @param msg the message string to be logged
-     */
-    public void info(String msg);
-
-    /**
-     * Log an exception ({@link Throwable}) at the INFO level with an accompanying message.
-     * 
-     * @param msg the message accompanying the exception
-     * @param t the exception ({@link Throwable}) to log
-     */
-    public void info(String msg, Throwable t);
-
-    /**
-     * Log a message at the WARN level.
-     * 
-     * @param msg the message string to be logged
-     */
-    public void warn(String msg);
-
-    /**
-     * Log an exception ({@link Throwable}) at the WARN level with an accompanying message.
-     * 
-     * @param msg the message accompanying the exception
-     * @param t the exception ({@link Throwable}) to log
-     */
-    public void warn(String msg, Throwable t);
-
-    /**
-     * Log a message at the WARN level.
-     * 
-     * @param msg the message string to be logged
-     */
-    public void fatal(String msg);
-
-    /**
-     * Log an exception ({@link Throwable}) at the WARN level with an accompanying message.
-     * 
-     * @param msg the message accompanying the exception
-     * @param t the exception ({@link Throwable}) to log
-     */
-    public void fatal(String msg, Throwable t);
-
-    /**
-     * Log a message at the ERROR level.
-     * 
-     * @param msg the message string to be logged
-     */
-    public void error(String msg);
-
-    /**
-     * Log an exception ({@link Throwable}) at the ERROR level with an accompanying message.
-     * 
-     * @param msg the message accompanying the exception
-     * @param t the exception ({@link Throwable}) to log
-     */
-    public void error(String msg, Throwable t);
-
-    /**
-     * Is the logger instance enabled for the DEBUG level?
-     * 
-     * @return True if this Logger is enabled for the DEBUG level, false otherwise.
-     * 
-     */
-    public boolean isDebugEnabled();
-
-    /**
-     * Is the logger instance enabled for the INFO level?
-     * 
-     * @return True if this Logger is enabled for the INFO level, false otherwise.
-     */
-    public boolean isInfoEnabled();
-
-    /**
-     * Is the logger instance enabled for the WARN level?
-     * 
-     * @return True if this Logger is enabled for the WARN level, false otherwise.
-     */
-    public boolean isWarnEnabled();
-
-    /**
-     * Is the logger instance enabled for the FATAL level?
-     * 
-     * @return True if this Logger is enabled for the FATAL level, false otherwise.
-     */
-    public boolean isFatalEnabled();
-
-    /**
-     * Is the logger instance enabled for the ERROR level?
-     * 
-     * @return True if this Logger is enabled for the ERROR level, false otherwise.
-     */
-    public boolean isErrorEnabled();
-
-}
diff --git a/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerBridge.java b/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerBridge.java
deleted file mode 100644
index 034ac43..0000000
--- a/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerBridge.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.pdfbox.jbig2.util.log;
-
-public interface LoggerBridge
-{
-
-    Logger getLogger(Class<?> clazz);
-
-}
diff --git a/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerFactory.java b/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerFactory.java
deleted file mode 100644
index be12015..0000000
--- a/src/main/java/org/apache/pdfbox/jbig2/util/log/LoggerFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.pdfbox.jbig2.util.log;
-
-import java.util.Iterator;
-
-import org.apache.pdfbox.jbig2.util.ServiceLookup;
-
-/**
- * Retrieves a {@link Logger} via registered {@link LoggerBridge} through META-INF/services lookup.
- */
-public class LoggerFactory
-{
-
-    private static LoggerBridge loggerBridge;
-
-    private static ClassLoader clsLoader;
-
-    public static Logger getLogger(Class<?> cls, ClassLoader clsLoader)
-    {
-        if (null == loggerBridge)
-        {
-            final ServiceLookup<LoggerBridge> serviceLookup = new ServiceLookup<LoggerBridge>();
-            final Iterator<LoggerBridge> loggerBridgeServices = serviceLookup
-                    .getServices(LoggerBridge.class, clsLoader);
-
-            if (!loggerBridgeServices.hasNext())
-            {
-                throw new IllegalStateException("No implementation of " + LoggerBridge.class
-                        + " was avaliable using META-INF/services lookup");
-            }
-            loggerBridge = loggerBridgeServices.next();
-        }
-        return loggerBridge.getLogger(cls);
-    }
-
-    public static Logger getLogger(Class<?> cls)
-    {
-        return getLogger(cls, clsLoader != null ? clsLoader : LoggerBridge.class.getClassLoader());
-    }
-
-    public static void setClassLoader(ClassLoader clsLoader)
-    {
-        LoggerFactory.clsLoader = clsLoader;
-    }
-
-}
diff --git a/src/main/resources/META-INF/services/org.apache.pdfbox.jbig2.util.log.LoggerBridge b/src/main/resources/META-INF/services/org.apache.pdfbox.jbig2.util.log.LoggerBridge
deleted file mode 100644
index 03e4159..0000000
--- a/src/main/resources/META-INF/services/org.apache.pdfbox.jbig2.util.log.LoggerBridge
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-#
-
-org.apache.pdfbox.jbig2.util.log.JDKLoggerBridge
\ No newline at end of file
diff --git a/src/test/java/org/apache/pdfbox/jbig2/util/LoggerFactoryTest.java b/src/test/java/org/apache/pdfbox/jbig2/util/LoggerFactoryTest.java
deleted file mode 100644
index 6f40baf..0000000
--- a/src/test/java/org/apache/pdfbox/jbig2/util/LoggerFactoryTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-package org.apache.pdfbox.jbig2.util;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.apache.pdfbox.jbig2.util.log.LoggerBridge;
-import org.apache.pdfbox.jbig2.util.log.LoggerFactory;
-import org.junit.Test;
-
-public class LoggerFactoryTest
-{
-
-    @Test
-    public void testWithDefaultClassLoader()
-    {
-        LoggerFactory.setClassLoader(LoggerBridge.class.getClassLoader());
-        assertNotNull(LoggerFactory.getLogger(LoggerFactoryTest.class));
-    }
-
-    @Test
-    public void testWithContextClassLoader()
-    {
-        LoggerFactory.setClassLoader(Thread.currentThread().getContextClassLoader());
-        assertNotNull(LoggerFactory.getLogger(LoggerFactoryTest.class));
-    }
-
-}