From bc5d41baecfe26bdbcac09acd9d81a6b459550b0 Mon Sep 17 00:00:00 2001 From: John DeRegnaucourt Date: Wed, 11 Oct 2023 09:17:29 -0400 Subject: [PATCH] removed all dependencies besides test scope. --- pom.xml | 14 ---------- .../java/com/cedarsoftware/util/Executor.java | 22 ++++++++------- .../util/InetAddressUtilities.java | 9 ++----- .../cedarsoftware/util/UniqueIdGenerator.java | 9 +++---- .../util/UrlInvocationHandler.java | 7 +---- .../util/UrlInvocationHandlerStrategy.java | 1 + .../com/cedarsoftware/util/UrlUtilities.java | 27 ++++++++----------- 7 files changed, 30 insertions(+), 59 deletions(-) diff --git a/pom.xml b/pom.xml index dbe19096..ded288d1 100644 --- a/pom.xml +++ b/pom.xml @@ -18,8 +18,6 @@ - 2.0.9 - 1.4.11 5.10.0 4.14.1 5.6.0 @@ -195,18 +193,6 @@ - - org.slf4j - slf4j-api - ${version.slf4j} - - - - ch.qos.logback - logback-classic - ${version.logback} - - org.junit.jupiter junit-jupiter-api diff --git a/src/main/java/com/cedarsoftware/util/Executor.java b/src/main/java/com/cedarsoftware/util/Executor.java index adec0ac5..19aa78f6 100644 --- a/src/main/java/com/cedarsoftware/util/Executor.java +++ b/src/main/java/com/cedarsoftware/util/Executor.java @@ -1,8 +1,5 @@ package com.cedarsoftware.util; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.File; /** @@ -33,7 +30,6 @@ public class Executor { private String _error; private String _out; - private static final Logger LOG = LoggerFactory.getLogger(Executor.class); public int exec(String command) { @@ -44,7 +40,8 @@ public int exec(String command) } catch (Exception e) { - LOG.warn("Error occurred executing command: " + command, e); + System.err.println("Error occurred executing command: " + command); + e.printStackTrace(System.err); return -1; } } @@ -58,7 +55,8 @@ public int exec(String[] cmdarray) } catch (Exception e) { - LOG.warn("Error occurred executing command: " + cmdArrayToString(cmdarray), e); + System.err.println("Error occurred executing command: " + cmdArrayToString(cmdarray)); + e.printStackTrace(System.err); return -1; } } @@ -72,7 +70,8 @@ public int exec(String command, String[] envp) } catch (Exception e) { - LOG.warn("Error occurred executing command: " + command, e); + System.err.println("Error occurred executing command: " + command); + e.printStackTrace(System.err); return -1; } } @@ -86,7 +85,8 @@ public int exec(String[] cmdarray, String[] envp) } catch (Exception e) { - LOG.warn("Error occurred executing command: " + cmdArrayToString(cmdarray), e); + System.err.println("Error occurred executing command: " + cmdArrayToString(cmdarray)); + e.printStackTrace(System.err); return -1; } } @@ -100,7 +100,8 @@ public int exec(String command, String[] envp, File dir) } catch (Exception e) { - LOG.warn("Error occurred executing command: " + command, e); + System.err.println("Error occurred executing command: " + command); + e.printStackTrace(System.err); return -1; } } @@ -114,7 +115,8 @@ public int exec(String[] cmdarray, String[] envp, File dir) } catch (Exception e) { - LOG.warn("Error occurred executing command: " + cmdArrayToString(cmdarray), e); + System.err.println("Error occurred executing command: " + cmdArrayToString(cmdarray)); + e.printStackTrace(System.err); return -1; } } diff --git a/src/main/java/com/cedarsoftware/util/InetAddressUtilities.java b/src/main/java/com/cedarsoftware/util/InetAddressUtilities.java index 2c262198..3b9801fa 100644 --- a/src/main/java/com/cedarsoftware/util/InetAddressUtilities.java +++ b/src/main/java/com/cedarsoftware/util/InetAddressUtilities.java @@ -1,8 +1,5 @@ package com.cedarsoftware.util; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.net.InetAddress; import java.net.UnknownHostException; @@ -27,8 +24,6 @@ */ public class InetAddressUtilities { - private static final Logger LOG = LoggerFactory.getLogger(InetAddressUtilities.class); - private InetAddressUtilities() { super(); } @@ -44,7 +39,7 @@ public static byte[] getIpAddress() { } catch (Exception e) { - LOG.warn("Failed to obtain computer's IP address", e); + System.err.println("Failed to obtain computer's IP address"); return new byte[] {0,0,0,0}; } } @@ -57,7 +52,7 @@ public static String getHostName() } catch (Exception e) { - LOG.warn("Unable to fetch 'hostname'", e); + System.err.println("Unable to fetch 'hostname'"); return "localhost"; } } diff --git a/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java b/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java index c12287e3..b5ddc184 100644 --- a/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java +++ b/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java @@ -1,8 +1,5 @@ package com.cedarsoftware.util; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.security.SecureRandom; import java.util.Date; import java.util.LinkedHashMap; @@ -46,7 +43,6 @@ public class UniqueIdGenerator { public static final String JAVA_UTIL_CLUSTERID = "JAVA_UTIL_CLUSTERID"; - private static final Logger log = LoggerFactory.getLogger(UniqueIdGenerator.class); private UniqueIdGenerator() { @@ -100,7 +96,7 @@ protected boolean removeEldestEntry(Map.Entry eldest) } } } - log.info("java-util using server id=" + id + " for last two digits of generated unique IDs. Set using " + setVia); + System.out.println("java-util using server id=" + id + " for last two digits of generated unique IDs. Set using " + setVia); serverId = id; } @@ -117,7 +113,8 @@ private static int getServerId(String externalVarName) } catch (NumberFormatException e) { - log.warn("Unable to get unique server id or index from environment variable/system property key-value: " + externalVarName + "=" + id, e); + System.out.println("Unable to get unique server id or index from environment variable/system property key-value: " + externalVarName + "=" + id); + e.printStackTrace(System.err); return -1; } } diff --git a/src/main/java/com/cedarsoftware/util/UrlInvocationHandler.java b/src/main/java/com/cedarsoftware/util/UrlInvocationHandler.java index a88c145e..6dcbc364 100644 --- a/src/main/java/com/cedarsoftware/util/UrlInvocationHandler.java +++ b/src/main/java/com/cedarsoftware/util/UrlInvocationHandler.java @@ -1,8 +1,5 @@ package com.cedarsoftware.util; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -55,10 +52,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@Deprecated public class UrlInvocationHandler implements InvocationHandler { public static final int SLEEP_TIME = 5000; - private final Logger LOG = LoggerFactory.getLogger(UrlInvocationHandler.class); private final UrlInvocationHandlerStrategy _strategy; public UrlInvocationHandler(UrlInvocationHandlerStrategy strategy) @@ -100,7 +97,6 @@ public Object invoke(Object proxy, Method m, Object[] args) throws Throwable } catch (Throwable e) { - LOG.error("Error occurred getting HTTP response from server", e); UrlUtilities.readErrorResponse(c); if (retry-- > 0) { @@ -117,7 +113,6 @@ public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { checkForThrowable(result); } catch (Throwable t) { - LOG.error("Error occurred on server", t); return null; } return result; diff --git a/src/main/java/com/cedarsoftware/util/UrlInvocationHandlerStrategy.java b/src/main/java/com/cedarsoftware/util/UrlInvocationHandlerStrategy.java index 288b14c2..a1e59676 100644 --- a/src/main/java/com/cedarsoftware/util/UrlInvocationHandlerStrategy.java +++ b/src/main/java/com/cedarsoftware/util/UrlInvocationHandlerStrategy.java @@ -25,6 +25,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@Deprecated public interface UrlInvocationHandlerStrategy { URL buildURL(Object proxy, Method m, Object[] args) throws MalformedURLException; diff --git a/src/main/java/com/cedarsoftware/util/UrlUtilities.java b/src/main/java/com/cedarsoftware/util/UrlUtilities.java index 465cf6c2..5e0805cc 100644 --- a/src/main/java/com/cedarsoftware/util/UrlUtilities.java +++ b/src/main/java/com/cedarsoftware/util/UrlUtilities.java @@ -1,8 +1,5 @@ package com.cedarsoftware.util; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import javax.net.ssl.*; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -51,6 +48,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@Deprecated public final class UrlUtilities { private static String globalUserAgent = null; @@ -68,8 +66,7 @@ public final class UrlUtilities public static final char DOT = '.'; private static final Pattern resPattern = Pattern.compile("^res\\:\\/\\/", Pattern.CASE_INSENSITIVE); - private static final Logger LOG = LoggerFactory.getLogger(UrlUtilities.class); - + public static final TrustManager[] NAIVE_TRUST_MANAGER = new TrustManager[] { new X509TrustManager() @@ -115,7 +112,7 @@ public boolean verify(String s, SSLSession sslSession) } catch (Exception e) { - LOG.warn("Failed to build Naive SSLSocketFactory", e); + e.printStackTrace(System.err); } } @@ -187,7 +184,6 @@ public static void readErrorResponse(URLConnection c) { return; } - LOG.warn("HTTP error response: " + ((HttpURLConnection) c).getResponseMessage()); // read the response body ByteArrayOutputStream out = new ByteArrayOutputStream(1024); int count; @@ -196,19 +192,18 @@ public static void readErrorResponse(URLConnection c) { out.write(bytes, 0, count); } - LOG.warn("HTTP error Code: " + error); } catch (ConnectException e) { - LOG.error("Connection exception trying to read HTTP error response", e); + e.printStackTrace(System.err); } catch (IOException e) { - LOG.error("IO Exception trying to read HTTP error response", e); + e.printStackTrace(System.err); } catch (Exception e) { - LOG.error("Exception trying to read HTTP error response", e); + e.printStackTrace(System.err); } finally { @@ -376,7 +371,7 @@ static boolean isNotExpired(String cookieExpires) } catch (ParseException e) { - LOG.info("Parse error on cookie expires value: " + cookieExpires, e); + e.printStackTrace(System.err); return false; } } @@ -490,7 +485,7 @@ public static byte[] getContentFromUrl(String url, Map inCookies, Map outCookies try { return getContentFromUrl(getActualUrl(url),inCookies, outCookies, allowAllCerts); } catch (Exception e) { - LOG.warn("Exception occurred fetching content from url: " + url, e); + e.printStackTrace(System.err); return null; } } @@ -527,13 +522,13 @@ public static byte[] getContentFromUrl(URL url, Map inCookies, Map outCookies, b } catch (SSLHandshakeException e) { // Don't read error response. it will just cause another exception. - LOG.warn("SSL Exception occurred fetching content from url: " + url, e); + e.printStackTrace(System.err); return null; } catch (Exception e) { readErrorResponse(c); - LOG.warn("Exception occurred fetching content from url: " + url, e); + e.printStackTrace(System.err); return null; } finally @@ -626,7 +621,7 @@ public static URLConnection getConnection(URL url, Map inCookies, boolean input, } catch(Exception e) { - LOG.warn("Could not access '" + url.toString() + "'", e); + e.printStackTrace(System.err); } }