Skip to content

Commit

Permalink
removed all dependencies besides test scope.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdereg committed Oct 11, 2023
1 parent 358503c commit bc5d41b
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 59 deletions.
14 changes: 0 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
</developers>

<properties>
<version.slf4j>2.0.9</version.slf4j>
<version.logback>1.4.11</version.logback>
<version.junit>5.10.0</version.junit>
<version.json.io>4.14.1</version.json.io> <!-- testing only -->
<version.mockito>5.6.0</version.mockito> <!-- testing only -->
Expand Down Expand Up @@ -195,18 +193,6 @@
</build>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${version.logback}</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
22 changes: 12 additions & 10 deletions src/main/java/com/cedarsoftware/util/Executor.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.cedarsoftware.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

/**
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}
}
Expand All @@ -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;
}
}
Expand All @@ -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;
}
}
Expand All @@ -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;
}
}
Expand All @@ -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;
}
}
Expand All @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.cedarsoftware.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.InetAddress;
import java.net.UnknownHostException;

Expand All @@ -27,8 +24,6 @@
*/
public class InetAddressUtilities
{
private static final Logger LOG = LoggerFactory.getLogger(InetAddressUtilities.class);

private InetAddressUtilities() {
super();
}
Expand All @@ -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};
}
}
Expand All @@ -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";
}
}
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -100,7 +96,7 @@ protected boolean removeEldestEntry(Map.Entry<Long, Long> 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;
}

Expand All @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 11 additions & 16 deletions src/main/java/com/cedarsoftware/util/UrlUtilities.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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()
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit bc5d41b

Please sign in to comment.