Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SysViewContentHandler improvements #55

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;

Expand All @@ -67,7 +65,7 @@ class SysViewContentHandler extends DefaultHandler {
// the propElem in process
PropElemData currentPropElem;
// the valueElem in process
protected StringBuffer currentValue;
protected StringBuilder currentValue;
// prefix mapping data
protected Map<String, String> prefixes;
// if the first node is yet treated
Expand All @@ -89,7 +87,7 @@ class SysViewContentHandler extends DefaultHandler {

/**
* Constructor
* @param path Thepath to the root node of the tree to be exported.
* @param path The path to the root node of the tree to be exported.
* @param session The session used.
* @param skipBinary Boolean if the binary properties are not exported.
* @param noRecurse Boolean if only the root node of the tree should be exported.
Expand Down Expand Up @@ -252,7 +250,7 @@ else if (qName.equals(svProperty)) {

else if (qName.equals(svValue)) {
// init
currentValue = new StringBuffer();
currentValue = new StringBuilder();
}
else {
// invalid element name is used
Expand Down Expand Up @@ -427,7 +425,7 @@ private void checkAllProps(NodeElemData nodeElem, boolean skipBinary)
List<PropElemData> propElems = nodeElem.propElems;

// no props exported
if (propElems.size() == 0) {
if (propElems.isEmpty()) {
// if node has properties they should be of Binary type and skipBinary should be true
if (node.hasProperties()) {
if (skipBinary) {
Expand Down Expand Up @@ -562,22 +560,18 @@ private void checkAllProps(NodeElemData nodeElem, boolean skipBinary)
private void checkChildren(NodeElemData nodeElem, boolean noRecurse)
throws RepositoryException, SAXException {

Hashtable<String, ChildNodeElem> childElemsFound = nodeElem.childNodeElemNames;
boolean totalSumOk = false;
Map<String, ChildNodeElem> childElemsFound = nodeElem.childNodeElemNames;
boolean totalSumOk;
boolean partialSumOk = true;
if (noRecurse) {
totalSumOk = (childElemsFound.size() == 0);
}
else {
if (!noRecurse) {
// all children found if number of node.getNodes(name) is the same as found
// in childElemsFound and if sum(number of nodeGetNodes(names))
// == number of node.getNodes()
long childrenFound = 0;
NodeIterator nodeIter = nodeElem.node.getNodes();

long children = getSize(nodeIter);
for (Enumeration<ChildNodeElem> e = childElemsFound.elements(); e.hasMoreElements();) {
ChildNodeElem child = e.nextElement();
for (ChildNodeElem child : childElemsFound.values()) {
String name = child.name;
long number = child.number;

Expand Down Expand Up @@ -654,7 +648,7 @@ private class NodeElemData {
int position = 0;
// the childNodeElems (stored are key: name and
// value: number of the same name siblings)
Hashtable<String, ChildNodeElem> childNodeElemNames = new Hashtable<String, ChildNodeElem>();
Map<String, ChildNodeElem> childNodeElemNames = new HashMap<String, ChildNodeElem>();
}

/**
Expand Down