Browse Source

axmlrpc: Remove unused/dead code/imports.

pull/350/head
Felipe Barriga Richards 8 years ago
parent
commit
098be2d419
  1. 99
      app/src/main/java/de/timroes/axmlrpc/XMLUtil.java
  2. 5
      app/src/main/java/de/timroes/axmlrpc/serializer/ArraySerializer.java
  3. 2
      app/src/main/java/de/timroes/axmlrpc/serializer/Base64Serializer.java
  4. 2
      app/src/main/java/de/timroes/axmlrpc/serializer/BooleanSerializer.java
  5. 3
      app/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java
  6. 2
      app/src/main/java/de/timroes/axmlrpc/serializer/DoubleSerializer.java
  7. 2
      app/src/main/java/de/timroes/axmlrpc/serializer/IntSerializer.java
  8. 2
      app/src/main/java/de/timroes/axmlrpc/serializer/LongSerializer.java
  9. 2
      app/src/main/java/de/timroes/axmlrpc/serializer/NullSerializer.java
  10. 2
      app/src/main/java/de/timroes/axmlrpc/serializer/Serializer.java
  11. 2
      app/src/main/java/de/timroes/axmlrpc/serializer/SerializerHandler.java
  12. 2
      app/src/main/java/de/timroes/axmlrpc/serializer/StringSerializer.java
  13. 4
      app/src/main/java/de/timroes/axmlrpc/serializer/StructSerializer.java

99
app/src/main/java/de/timroes/axmlrpc/XMLUtil.java

@ -1,9 +1,6 @@ @@ -1,9 +1,6 @@
package de.timroes.axmlrpc;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* This class provides some utility methods for the use with the Java DOM parser.
@ -12,102 +9,6 @@ import org.w3c.dom.NodeList; @@ -12,102 +9,6 @@ import org.w3c.dom.NodeList;
*/
public class XMLUtil {
/**
* Returns the only child element in a given NodeList.
* Will throw an error if there is more then one child element or any other
* child that is not an element or an empty text string (whitespace are normal).
*
* @param list A NodeList of children nodes.
* @return The only child element in the given node list.
* @throws XMLRPCException Will be thrown if there is more then one child element
* except empty text nodes.
*/
public static Element getOnlyChildElement(NodeList list) throws XMLRPCException {
Element e = null;
Node n;
for(int i = 0; i < list.getLength(); i++) {
n = list.item(i);
// Strip only whitespace text elements and comments
if((n.getNodeType() == Node.TEXT_NODE
&& n.getNodeValue().trim().length() <= 0)
|| n.getNodeType() == Node.COMMENT_NODE)
continue;
// Check if there is anything else than an element node.
if(n.getNodeType() != Node.ELEMENT_NODE) {
throw new XMLRPCException("Only element nodes allowed.");
}
// If there was already an element, throw exception.
if(e != null) {
throw new XMLRPCException("Element has more than one children.");
}
e = (Element)n;
}
return e;
}
/**
* Returns the text node from a given NodeList. If the list contains
* more then just text nodes, an exception will be thrown.
*
* @param list The given list of nodes.
* @return The text of the given node list.
* @throws XMLRPCException Will be thrown if there is more than just one
* text node within the list.
*/
public static String getOnlyTextContent(NodeList list) throws XMLRPCException {
StringBuilder builder = new StringBuilder();
Node n;
for(int i = 0; i < list.getLength(); i++) {
n = list.item(i);
// Skip comments inside text tag.
if(n.getNodeType() == Node.COMMENT_NODE) {
continue;
}
if(n.getNodeType() != Node.TEXT_NODE) {
throw new XMLRPCException("Element must contain only text elements.");
}
builder.append(n.getNodeValue());
}
return builder.toString();
}
/**
* Checks if the given {@link NodeList} contains a child element.
*
* @param list The {@link NodeList} to check.
* @return Whether the {@link NodeList} contains children.
*/
public static boolean hasChildElement(NodeList list) {
Node n;
for(int i = 0; i < list.getLength(); i++) {
n = list.item(i);
if(n.getNodeType() == Node.ELEMENT_NODE) {
return true;
}
}
return false;
}
/**
* Creates an xml tag with a given type and content.
*

5
app/src/main/java/de/timroes/axmlrpc/serializer/ArraySerializer.java

@ -2,12 +2,7 @@ package de.timroes.axmlrpc.serializer; @@ -2,12 +2,7 @@ package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLRPCRuntimeException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
*

2
app/src/main/java/de/timroes/axmlrpc/serializer/Base64Serializer.java

@ -1,10 +1,8 @@ @@ -1,10 +1,8 @@
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import de.timroes.base64.Base64;
import org.w3c.dom.Element;
/**
*

2
app/src/main/java/de/timroes/axmlrpc/serializer/BooleanSerializer.java

@ -1,9 +1,7 @@ @@ -1,9 +1,7 @@
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import org.w3c.dom.Element;
/**
*

3
app/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java

@ -1,11 +1,8 @@ @@ -1,11 +1,8 @@
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import org.w3c.dom.Element;
/**
*

2
app/src/main/java/de/timroes/axmlrpc/serializer/DoubleSerializer.java

@ -1,10 +1,8 @@ @@ -1,10 +1,8 @@
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import java.math.BigDecimal;
import org.w3c.dom.Element;
/**
* This serializer is responsible for floating point numbers.

2
app/src/main/java/de/timroes/axmlrpc/serializer/IntSerializer.java

@ -1,9 +1,7 @@ @@ -1,9 +1,7 @@
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import org.w3c.dom.Element;
/**
*

2
app/src/main/java/de/timroes/axmlrpc/serializer/LongSerializer.java

@ -1,9 +1,7 @@ @@ -1,9 +1,7 @@
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import org.w3c.dom.Element;
/**
*

2
app/src/main/java/de/timroes/axmlrpc/serializer/NullSerializer.java

@ -1,8 +1,6 @@ @@ -1,8 +1,6 @@
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import org.w3c.dom.Element;
/**
*

2
app/src/main/java/de/timroes/axmlrpc/serializer/Serializer.java

@ -1,8 +1,6 @@ @@ -1,8 +1,6 @@
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import org.w3c.dom.Element;
/**
* A Serializer is responsible to serialize a specific type of data to

2
app/src/main/java/de/timroes/axmlrpc/serializer/SerializerHandler.java

@ -3,7 +3,6 @@ package de.timroes.axmlrpc.serializer; @@ -3,7 +3,6 @@ package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCClient;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLRPCRuntimeException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import java.io.BufferedReader;
@ -17,7 +16,6 @@ import java.util.Calendar; @@ -17,7 +16,6 @@ import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.SimpleTimeZone;

2
app/src/main/java/de/timroes/axmlrpc/serializer/StringSerializer.java

@ -1,9 +1,7 @@ @@ -1,9 +1,7 @@
package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import org.w3c.dom.Element;
/**
*

4
app/src/main/java/de/timroes/axmlrpc/serializer/StructSerializer.java

@ -2,12 +2,8 @@ package de.timroes.axmlrpc.serializer; @@ -2,12 +2,8 @@ package de.timroes.axmlrpc.serializer;
import de.timroes.axmlrpc.XMLRPCException;
import de.timroes.axmlrpc.XMLRPCRuntimeException;
import de.timroes.axmlrpc.XMLUtil;
import de.timroes.axmlrpc.xmlcreator.XmlElement;
import java.util.HashMap;
import java.util.Map;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
*

Loading…
Cancel
Save