From 04d7c9dfb452bded1c7ba9c0694ade8ecc5e9ec6 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Fri, 22 Jan 2016 18:55:46 +0000
Subject: [PATCH] identicon: Add build.xml Add i2p notes Remove commons-logging
 dependency

---
 apps/imagegen/identicon/README-i2p.txt        |   8 ++
 apps/imagegen/identicon/build.xml             | 110 ++++++++++++++++++
 .../docuverse/identicon/IdenticonUtil.java    |   9 +-
 3 files changed, 120 insertions(+), 7 deletions(-)
 create mode 100644 apps/imagegen/identicon/README-i2p.txt
 create mode 100644 apps/imagegen/identicon/build.xml

diff --git a/apps/imagegen/identicon/README-i2p.txt b/apps/imagegen/identicon/README-i2p.txt
new file mode 100644
index 0000000000..29bddb0a9e
--- /dev/null
+++ b/apps/imagegen/identicon/README-i2p.txt
@@ -0,0 +1,8 @@
+The main identicon code is here.
+The webapp example code is in ../imagegen and adopted for our use.
+There are minor modifications to remove dependencies on commons-logging
+and the org.cache2k package.
+We've added a build.xml for ant.
+
+Pulled from https://github.com/PauloMigAlmeida/identicon on Jan. 4, 2016,
+rev 96902d3c7c9733d9da4cce9c5ed424557fc2ec3c dated April 10, 2015.
diff --git a/apps/imagegen/identicon/build.xml b/apps/imagegen/identicon/build.xml
new file mode 100644
index 0000000000..64f97ee9c5
--- /dev/null
+++ b/apps/imagegen/identicon/build.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." default="all" name="identicon">
+    <target name="all" depends="clean, build" />
+    <target name="build" depends="builddep, jar" />
+    <target name="builddep">
+        <!-- run from top level build.xml to get dependencies built -->
+    </target>
+    <condition property="depend.available">
+        <typefound name="depend" />
+    </condition>
+    <target name="depend" if="depend.available">
+        <depend
+            cache="../../../build"
+            srcdir="./core/src/main/java" 
+            destdir="./build/obj" >
+        </depend>
+    </target>
+
+    <!-- only used if not set by a higher build.xml -->
+    <property name="javac.compilerargs" value="" />
+    <property name="javac.version" value="1.6" />
+
+    <target name="compile" depends="depend">
+        <mkdir dir="./build" />
+        <mkdir dir="./build/obj" />
+        <javac srcdir="./core/src/main/java" debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
+               includeAntRuntime="false"
+               destdir="./build/obj" >
+            <compilerarg line="${javac.compilerargs}" />
+        </javac>
+    </target>
+
+    <target name="compileTest" depends="jar">
+	<mkdir dir="./buildTest" />
+	<mkdir dir="./buildTest/obj" />
+        <javac
+            srcdir="./test/junit"
+            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
+            includeAntRuntime="false"
+            destdir="./buildTest/obj"
+            classpath="./build/identicon.jar" >
+            <compilerarg line="${javac.compilerargs}" />
+        </javac>
+    </target>
+
+    <target name="jarTest" depends="jar, compileTest">
+        <jar destfile="./build/identiconTest.jar" basedir="./buildTest/obj" includes="**/*.class" update="true" />
+    </target>
+
+    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
+        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="list" />
+            <arg value="changed" />
+            <arg value="." />
+        </exec>
+        <!-- \n in an attribute value generates an invalid manifest -->
+        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
+            <arg value="-s" />
+            <arg value="[:space:]" />
+            <arg value="," />
+        </exec>
+    </target>
+
+    <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
+        <!-- set if unset -->
+        <property name="workspace.changes.tr" value="" />
+        <jar destfile="./build/identicon.jar" basedir="./build/obj" includes="**/*.class" >
+            <manifest>
+                <attribute name="Implementation-Version" value="${full.version}" />
+                <attribute name="Built-By" value="${build.built-by}" />
+                <attribute name="Build-Date" value="${build.timestamp}" />
+                <attribute name="Base-Revision" value="${workspace.version}" />
+                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
+            </manifest>
+        </jar>
+    </target>
+
+    <target name="jarUpToDate">
+        <uptodate property="jar.uptodate" targetfile="build/identicon.jar" >
+            <srcfiles dir= "." includes="build/obj/**/*.class" />
+        </uptodate>
+        <condition property="shouldListChanges" >
+            <and>
+                <not>
+                    <isset property="jar.uptodate" />
+                </not>
+                <isset property="mtn.available" />
+            </and>
+        </condition>
+    </target>
+    
+    <target name="javadoc">
+        <mkdir dir="./build" />
+        <mkdir dir="./build/javadoc" />
+        <javadoc 
+            sourcepath="./core/src/main/java" destdir="./build/javadoc" 
+            packagenames="*" 
+            use="true" 
+            splitindex="true" 
+            windowtitle="identicon library" />
+    </target>
+    <target name="clean">
+        <delete dir="./build" />
+	<delete dir="./buildTest" />
+    </target>
+    <target name="cleandep" depends="clean">
+    </target>
+    <target name="distclean" depends="clean">
+    </target>
+</project>
diff --git a/apps/imagegen/identicon/core/src/main/java/com/docuverse/identicon/IdenticonUtil.java b/apps/imagegen/identicon/core/src/main/java/com/docuverse/identicon/IdenticonUtil.java
index cfbef5c540..a5c91308bb 100644
--- a/apps/imagegen/identicon/core/src/main/java/com/docuverse/identicon/IdenticonUtil.java
+++ b/apps/imagegen/identicon/core/src/main/java/com/docuverse/identicon/IdenticonUtil.java
@@ -3,9 +3,6 @@ package com.docuverse.identicon;
 import java.net.InetAddress;
 import java.security.MessageDigest;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 /**
  * Utility methods useful for implementing identicon functionality. Methods are
  * class methods for convenience.
@@ -19,8 +16,6 @@ import org.apache.commons.logging.LogFactory;
  * @author don
  */
 public class IdenticonUtil {
-	private static final Log log = LogFactory.getLog(IdenticonUtil.class);
-
 	private static final int DEFAULT_IDENTICON_SIZE = 16;
 
 	private static final int MINIMUM_IDENTICON_SIZE = 15;
@@ -134,7 +129,7 @@ public class IdenticonUtil {
 						.getByName(remoteAddr));
 			}
 		} catch (Exception e) {
-			log.error(e);
+			e.printStackTrace();
 		}
 		return code;
 	}
@@ -151,7 +146,7 @@ public class IdenticonUtil {
 					size = MAXIMUM_IDENTICON_SIZE;
 			}
 		} catch (Exception e) {
-			log.error(e);
+			e.printStackTrace();
 		}
 		return size;
 	}
-- 
GitLab