Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed dependency on Apache Commons Logging

  • Loading branch information...
commit f855aa5248f2488048797f1a65b61343383e2938 1 parent 0745a9f
Martin Kleppmann authored
View
9 contrib.xml
@@ -51,15 +51,6 @@ checking its hash, and then unpacking to ${src}
<target name="get-contrib" >
<mkdir dir="${lib}" />
- <!-- Apache commons-logging.jar -->
- <wget id="commons-logging"
- href1="http://archive.apache.org/dist/commons/logging/binaries/commons-logging-1.1.1-bin.tar.gz"
- target="${lib}/commons-logging-1.1.1.jar"
- target.get="${temp.file}"
- unpack1="unpack-tgz"
- unpackloc1="commons-logging-1.1.1/commons-logging-1.1.1.jar"
- sha="2d859791fbf7d880591864bd4004d8442a8a3b81" />
-
<!--- XMLPull API -->
<wget id="xmlpull-api"
href1="http://www.xmlpull.org/v1/download/xmlpull_1_1_3_4c.jar"
View
1  paths/external-se-jars
@@ -1,6 +1,5 @@
# List of path elements in fuego core common pool
# needed to run the software
${fc.contrib}/3dm-0.1.5b1.jar
-${fc.contrib}/commons-logging-1.1.1.jar
${fc.contrib}/junit-3.8.1.jar
${fc.contrib}/xmlpull_1_1_3_4c.jar
View
26 src/fuegocore/util/xas/SaxBridge.java
@@ -13,8 +13,8 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import fc.util.log.Log;
+
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
@@ -27,8 +27,6 @@
// hurry...
public class SaxBridge {
- private static Log log = LogFactory.getLog(SaxReader.class.getName());
-
protected EventSequence es;
@@ -52,9 +50,7 @@ public void output(ContentHandler contentHandler) throws SAXException, IOExcepti
int eventType = e.getType();
switch (eventType) {
case Event.START_DOCUMENT: {
- if (log.isDebugEnabled()) {
- log.debug("START_DOCUMENT");
- }
+ Log.debug("START_DOCUMENT");
if (contentHandler != null) {
contentHandler.startDocument();
}
@@ -65,9 +61,7 @@ public void output(ContentHandler contentHandler) throws SAXException, IOExcepti
String uri = e.getNamespace();
contentHandler.startPrefixMapping(prefix, uri);
prefixMapping.put(uri, prefix);
- if (log.isDebugEnabled()) {
- log.debug("PM(" + e.getNamespace() + ", " + e.getValue() + ")");
- }
+ Log.debug("PM(" + e.getNamespace() + ", " + e.getValue() + ")");
break;
}
case Event.START_ELEMENT: {
@@ -75,9 +69,7 @@ public void output(ContentHandler contentHandler) throws SAXException, IOExcepti
String localName = e.getName();
String prefix = (String) prefixMapping.get(namespace);
AttributesImpl atts = new AttributesImpl();
- if (log.isDebugEnabled()) {
- log.debug("START_TAG(" + namespace + ", " + localName + ")");
- }
+ Log.debug("START_TAG(" + namespace + ", " + localName + ")");
// ctl: Scan attributes; is there any other event that may
// occur inside attributes than COMMENT?
for (Event e2 = null; (e2 = r.advance()) != null;) {
@@ -105,9 +97,7 @@ public void output(ContentHandler contentHandler) throws SAXException, IOExcepti
case Event.END_ELEMENT: {
String namespace = e.getNamespace();
String localName = e.getName();
- if (log.isDebugEnabled()) {
- log.debug("END_TAG(" + namespace + ", " + localName + ")");
- }
+ Log.debug("END_TAG(" + namespace + ", " + localName + ")");
if (contentHandler != null) {
contentHandler.endElement(
makeNameSpace(prefixMapping, namespace, localName),
@@ -118,9 +108,7 @@ public void output(ContentHandler contentHandler) throws SAXException, IOExcepti
}
case Event.CONTENT: {
char[] ch = e.getValue().toString().toCharArray();
- if (log.isDebugEnabled()) {
- log.debug("TEXT(" + new String(ch, textParams[0], textParams[1]) + ")");
- }
+ Log.debug("TEXT(" + new String(ch, textParams[0], textParams[1]) + ")");
if (contentHandler != null) {
contentHandler.characters(ch, 0, ch.length);
}
View
36 src/fuegocore/util/xas/SaxReader.java
@@ -18,6 +18,8 @@
import java.io.InputStream;
import java.io.IOException;
+import fc.util.log.Log;
+
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
import org.xml.sax.ContentHandler;
@@ -29,9 +31,6 @@
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.helpers.AttributesImpl;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -47,8 +46,6 @@
*/
public class SaxReader implements XMLReader {
- private static Log log = LogFactory.getLog(SaxReader.class.getName());
-
private static final String NS_URI = "http://xml.org/sax/features/namespaces";
private static final String NSPRE_URI = "http://xml.org/sax/features/namespace-prefixes";
@@ -169,9 +166,7 @@ public void parse(InputSource input) throws IOException, SAXException {
for (int eventType = parser.getEventType(); eventType != XmlPullParser.END_DOCUMENT; eventType = parser.nextToken()) {
switch (eventType) {
case XmlPullParser.START_DOCUMENT: {
- if (log.isDebugEnabled()) {
- log.debug("START_DOCUMENT");
- }
+ Log.debug("START_DOCUMENT");
if (contentHandler != null) {
contentHandler.startDocument();
}
@@ -183,9 +178,7 @@ public void parse(InputSource input) throws IOException, SAXException {
for (int i = nsStart; i < nsEnd; i++) {
String prefix = parser.getNamespacePrefix(i);
String uri = parser.getNamespaceUri(i);
- if (log.isDebugEnabled()) {
- log.debug("PM(" + prefix + ", " + uri + ")");
- }
+ Log.debug("PM(" + prefix + ", " + uri + ")");
if (contentHandler != null) {
contentHandler.startPrefixMapping(prefix, uri);
}
@@ -196,17 +189,12 @@ public void parse(InputSource input) throws IOException, SAXException {
String localName = parser.getName();
AttributesImpl atts = new AttributesImpl();
int attLen = parser.getAttributeCount();
- if (log.isDebugEnabled()) {
- log.debug("START_TAG(" + namespace + ", " + localName + ", " + attLen +
- ")");
- }
+ Log.debug("START_TAG(" + namespace + ", " + localName + ", " + attLen + ")");
for (int i = 0; i < attLen; i++) {
String aNamespace = parser.getAttributeNamespace(i);
String aName = parser.getAttributeName(i);
String aValue = parser.getAttributeValue(i);
- if (log.isDebugEnabled()) {
- log.debug("A(" + aNamespace + ", " + aName + ", " + aValue + ")");
- }
+ Log.debug("A(" + aNamespace + ", " + aName + ", " + aValue + ")");
String aqName = aName;
String aPrefix = (String) prefixMapping.get(aNamespace);
if (aPrefix != null && aPrefix.length() > 0) {
@@ -230,9 +218,7 @@ public void parse(InputSource input) throws IOException, SAXException {
case XmlPullParser.END_TAG: {
String namespace = parser.getNamespace();
String localName = parser.getName();
- if (log.isDebugEnabled()) {
- log.debug("END_TAG(" + namespace + ", " + localName + ")");
- }
+ Log.debug("END_TAG(" + namespace + ", " + localName + ")");
String qName = localName;
String prefix = (String) prefixMapping.get(namespace);
if (prefix != null && prefix.length() > 0) {
@@ -253,9 +239,7 @@ public void parse(InputSource input) throws IOException, SAXException {
}
case XmlPullParser.TEXT: {
char[] ch = parser.getTextCharacters(textParams);
- if (log.isDebugEnabled()) {
- log.debug("TEXT(" + new String(ch, textParams[0], textParams[1]) + ")");
- }
+ Log.debug("TEXT(" + new String(ch, textParams[0], textParams[1]) + ")");
if (contentHandler != null) {
contentHandler.characters(ch, textParams[0], textParams[1]);
}
@@ -263,9 +247,7 @@ public void parse(InputSource input) throws IOException, SAXException {
}
case XmlPullParser.PROCESSING_INSTRUCTION: {
String target = parser.getText();
- if (log.isDebugEnabled()) {
- log.debug("PI(" + target + ")");
- }
+ Log.debug("PI(" + target + ")");
if (contentHandler != null) {
String data = null;
int i = target.indexOf(' ');
View
39 src/fuegocore/util/xas/SaxWriter.java
@@ -14,14 +14,13 @@
import java.io.OutputStream;
import java.io.IOException;
+import fc.util.log.Log;
+
import org.xml.sax.ContentHandler;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.xmlpull.v1.XmlSerializer;
/**
@@ -33,8 +32,6 @@
*/
public class SaxWriter implements ContentHandler {
- private static Log log = LogFactory.getLog(SaxWriter.class.getName());
-
protected XmlSerializer target;
private Map prefixes = new HashMap();
@@ -45,9 +42,7 @@ public SaxWriter(XmlSerializer target) {
public SaxWriter(XmlSerializer target, OutputStream os) {
- if (log.isDebugEnabled()) {
- log.debug("Constructor: target=" + target + ", os=" + os);
- }
+ Log.debug("Constructor: target=" + target + ", os=" + os);
this.target = target;
if (os != null) {
try {
@@ -67,9 +62,7 @@ public void setDocumentLocator(Locator locator) {
public void startDocument() throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("startDocument()");
- }
+ Log.debug("startDocument()");
if (target != null) {
try {
target.startDocument("ISO-8859-1", null);
@@ -81,9 +74,7 @@ public void startDocument() throws SAXException {
public void endDocument() throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("endDocument()");
- }
+ Log.debug("endDocument()");
if (target != null) {
try {
target.endDocument();
@@ -96,9 +87,7 @@ public void endDocument() throws SAXException {
public void startPrefixMapping(String prefix, String uri) throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("startPrefixMapping(" + prefix + ", " + uri + ")");
- }
+ Log.debug("startPrefixMapping(" + prefix + ", " + uri + ")");
prefixes.put(prefix, uri);
if (target != null) {
try {
@@ -111,18 +100,14 @@ public void startPrefixMapping(String prefix, String uri) throws SAXException {
public void endPrefixMapping(String prefix) throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("endPrefixMapping(" + prefix + ")");
- }
+ Log.debug("endPrefixMapping(" + prefix + ")");
prefixes.remove(prefix);
}
public void startElement(String namespaceURI, String localName, String qName,
Attributes attributes) throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("startElement(" + namespaceURI + ", " + localName + ", " + qName + ")");
- }
+ Log.debug("startElement(" + namespaceURI + ", " + localName + ", " + qName + ")");
if (target != null) {
try {
if (localName == null || localName.equals("")) {
@@ -163,9 +148,7 @@ public void startElement(String namespaceURI, String localName, String qName,
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("endElement(" + namespaceURI + ", " + localName + ", " + qName + ")");
- }
+ Log.debug("endElement(" + namespaceURI + ", " + localName + ", " + qName + ")");
if (target != null) {
try {
if (localName == null || localName.equals("")) {
@@ -187,9 +170,7 @@ public void endElement(String namespaceURI, String localName, String qName) thro
public void characters(char[] ch, int start, int length) throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("characters(" + new String(ch, start, length) + ")");
- }
+ Log.debug("characters(" + new String(ch, start, length) + ")");
if (target != null) {
try {
target.text(ch, start, length);
Please sign in to comment.
Something went wrong with that request. Please try again.