summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/kitfox/svg/xml
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/kitfox/svg/xml')
-rw-r--r--src/main/java/com/kitfox/svg/xml/StyleAttribute.java11
-rw-r--r--src/main/java/com/kitfox/svg/xml/XMLParseUtil.java82
-rw-r--r--src/main/java/com/kitfox/svg/xml/cpx/CPXInputStream.java13
-rw-r--r--src/main/java/com/kitfox/svg/xml/cpx/CPXTest.java11
4 files changed, 68 insertions, 49 deletions
diff --git a/src/main/java/com/kitfox/svg/xml/StyleAttribute.java b/src/main/java/com/kitfox/svg/xml/StyleAttribute.java
index dd1fc3c..2566724 100644
--- a/src/main/java/com/kitfox/svg/xml/StyleAttribute.java
+++ b/src/main/java/com/kitfox/svg/xml/StyleAttribute.java
@@ -36,9 +36,12 @@
package com.kitfox.svg.xml;
+import com.kitfox.svg.SVGConst;
import java.awt.*;
import java.io.*;
import java.net.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import java.util.regex.*;
/**
@@ -202,7 +205,7 @@ public class StyleAttribute implements Serializable
}
catch (Exception e)
{
- e.printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
return null;
}
}
@@ -217,7 +220,7 @@ public class StyleAttribute implements Serializable
}
catch (Exception e)
{
- e.printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
return null;
}
}
@@ -275,7 +278,7 @@ public class StyleAttribute implements Serializable
}
catch (Exception e)
{
- e.printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
return null;
}
}
@@ -296,7 +299,7 @@ public class StyleAttribute implements Serializable
}
catch (Exception e)
{
- e.printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
}
}
}
diff --git a/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java b/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java
index c8900b9..6254279 100644
--- a/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java
+++ b/src/main/java/com/kitfox/svg/xml/XMLParseUtil.java
@@ -36,12 +36,15 @@
package com.kitfox.svg.xml;
+import com.kitfox.svg.SVGConst;
import org.w3c.dom.*;
import java.awt.*;
import java.net.*;
import java.util.*;
import java.util.regex.*;
import java.lang.reflect.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author Mark McKay
@@ -148,8 +151,8 @@ public class XMLParseUtil
}
catch (StringIndexOutOfBoundsException e)
{
- System.err.println("XMLParseUtil: regex parse problem: '" + val + "'");
- e.printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+ "XMLParseUtil: regex parse problem: '" + val + "'", e);
}
val = fpMatch.group(1);
@@ -545,8 +548,15 @@ public class XMLParseUtil
if (!ele.getTagName().equals(name)) continue;
ReadableXMLElement newObj = null;
- try { newObj = (ReadableXMLElement)classType.newInstance(); }
- catch (Exception e) { e.printStackTrace(); continue; }
+ try
+ {
+ newObj = (ReadableXMLElement)classType.newInstance();
+ }
+ catch (Exception e)
+ {
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
+ continue;
+ }
newObj.read(ele, docRoot);
if (newObj == null) continue;
@@ -575,13 +585,6 @@ public class XMLParseUtil
HashMap retMap = new HashMap();
-/*
- Class[] params = {Element.class, URL.class};
- Method loadMethod = null;
- try { loadMethod = classType.getMethod("load", params); }
- catch (Exception e) { e.printStackTrace(); return null; }
-
- */
NodeList nl = root.getChildNodes();
int size = nl.getLength();
for (int i = 0; i < size; i++)
@@ -592,16 +595,17 @@ public class XMLParseUtil
if (!ele.getTagName().equals(name)) continue;
ReadableXMLElement newObj = null;
- try { newObj = (ReadableXMLElement)classType.newInstance(); }
- catch (Exception e) { e.printStackTrace(); continue; }
+ try
+ {
+ newObj = (ReadableXMLElement)classType.newInstance();
+ }
+ catch (Exception e)
+ {
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
+ continue;
+ }
newObj.read(ele, docRoot);
-/*
- Object[] args = {ele, source};
- Object obj = null;
- try { obj = loadMethod.invoke(null, args); }
- catch (Exception e) { e.printStackTrace(); }
- */
if (newObj == null) continue;
String keyVal = getAttribString(ele, key);
@@ -623,13 +627,6 @@ public class XMLParseUtil
HashSet retSet = new HashSet();
- /*
- Class[] params = {Element.class, URL.class};
- Method loadMethod = null;
- try { loadMethod = classType.getMethod("load", params); }
- catch (Exception e) { e.printStackTrace(); return null; }
- */
-
NodeList nl = root.getChildNodes();
int size = nl.getLength();
for (int i = 0; i < size; i++)
@@ -640,17 +637,21 @@ public class XMLParseUtil
if (!ele.getTagName().equals(name)) continue;
ReadableXMLElement newObj = null;
- try { newObj = (ReadableXMLElement)classType.newInstance(); }
- catch (Exception e) { e.printStackTrace(); continue; }
+ try
+ {
+ newObj = (ReadableXMLElement)classType.newInstance();
+ }
+ catch (Exception e)
+ {
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
+ continue;
+ }
newObj.read(ele, docRoot);
- /*
- Object[] args = {ele, source};
- Object obj = null;
- try { obj = loadMethod.invoke(null, args); }
- catch (Exception e) { e.printStackTrace(); }
- */
- if (newObj == null) continue;
+ if (newObj == null)
+ {
+ continue;
+ }
retSet.add(newObj);
}
@@ -680,8 +681,15 @@ public class XMLParseUtil
if (!ele.getTagName().equals(name)) continue;
ReadableXMLElement newObj = null;
- try { newObj = (ReadableXMLElement)classType.newInstance(); }
- catch (Exception e) { e.printStackTrace(); continue; }
+ try
+ {
+ newObj = (ReadableXMLElement)classType.newInstance();
+ }
+ catch (Exception e)
+ {
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
+ continue;
+ }
newObj.read(ele, docRoot);
elementCache.addLast(newObj);
diff --git a/src/main/java/com/kitfox/svg/xml/cpx/CPXInputStream.java b/src/main/java/com/kitfox/svg/xml/cpx/CPXInputStream.java
index 5e453cd..1c1cae3 100644
--- a/src/main/java/com/kitfox/svg/xml/cpx/CPXInputStream.java
+++ b/src/main/java/com/kitfox/svg/xml/cpx/CPXInputStream.java
@@ -36,10 +36,13 @@
package com.kitfox.svg.xml.cpx;
+import com.kitfox.svg.SVGConst;
import java.io.*;
import java.util.*;
import java.util.zip.*;
import java.security.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.crypto.*;
/**
@@ -209,24 +212,26 @@ public class CPXInputStream extends FilterInputStream implements CPXConsts {
}
catch (Exception e)
{
- e.printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
return -1;
}
if (!inflater.finished())
{
- new Exception("Inflation incomplete").printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
+ "Inflation imncomplete");
}
return numRead == 0 ? -1 : numRead;
}
- try {
+ try
+ {
return inflater.inflate(b, off, len);
}
catch (DataFormatException e)
{
- e.printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
return -1;
}
}
diff --git a/src/main/java/com/kitfox/svg/xml/cpx/CPXTest.java b/src/main/java/com/kitfox/svg/xml/cpx/CPXTest.java
index 5b84304..cf790a8 100644
--- a/src/main/java/com/kitfox/svg/xml/cpx/CPXTest.java
+++ b/src/main/java/com/kitfox/svg/xml/cpx/CPXTest.java
@@ -36,8 +36,10 @@
package com.kitfox.svg.xml.cpx;
+import com.kitfox.svg.SVGConst;
import java.io.*;
-import java.net.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author Mark McKay
@@ -73,7 +75,7 @@ public class CPXTest {
}
catch (Exception e)
{
- e.printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
}
}
@@ -95,14 +97,15 @@ public class CPXTest {
}
catch (Exception e)
{
- e.printStackTrace();
+ Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, null, e);
}
}
/**
* @param args the command line arguments
*/
- public static void main(String[] args) {
+ public static void main(String[] args)
+ {
new CPXTest();
}