vladimir 2003/08/09 11:56:19
Modified: java/src/org/apache/xindice/xml XMLCompressedOutput.java
SymbolTable.java XMLCompressedInput.java
NodeSource.java NamespaceMap.java
java/src/org/apache/xindice/core/indexer IndexPattern.java
IndexManager.java ValueIndexer.java
java/src/org/apache/xindice/xml/dom ContainerNodeImpl.java
DocumentImpl.java ProcessingInstructionImpl.java
ElementImpl.java DOMParser.java
java/src/org/apache/xindice/core/filer FSFiler.java
BTree.java HashFiler.java BTreeFiler.java
MemFiler.java Paged.java
java/src/org/apache/xindice/core DocumentCache.java
CollectionManager.java FaultCodes.java
Database.java Collection.java
java/src/org/apache/xindice/tools XMLTools.java
java/src/org/apache/xindice/server UglyBrowser.java
java/src/org/apache/xindice/core/data Variant.java Key.java
java/src/org/apache/xindice/xml/dom/traversal
TreeWalkerImpl.java
java/src/org/apache/xindice/xml/sax SAXEventGenerator.java
java/src/org/apache/xindice/core/request URIMapper.java
java/src/org/apache/xindice/util ByteBuffer.java
java/src/org/apache/xindice/core/meta MetaData.java
java/src/org/apache/xindice/core/query
XPathQueryResolver.java
Log:
Some more braces (thanks PMD)
Revision Changes Path
1.5 +7 -6
xml-xindice/java/src/org/apache/xindice/xml/XMLCompressedOutput.java
Index: XMLCompressedOutput.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/XMLCompressedOutput.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLCompressedOutput.java 7 Aug 2003 20:13:25 -0000 1.4
+++ XMLCompressedOutput.java 9 Aug 2003 18:56:18 -0000 1.5
@@ -87,14 +87,15 @@
* @return The optimal size
*/
protected final byte getSizeType(long length) {
- if (length > Short.MAX_VALUE)
+ if (length > Short.MAX_VALUE) {
return Signatures.IntContent;
- else if (length > Byte.MAX_VALUE)
+ } else if (length > Byte.MAX_VALUE) {
return Signatures.ShortContent;
- else if (length > 0)
+ } else if (length > 0) {
return Signatures.ByteContent;
- else
+ } else {
return Signatures.NoContent;
+ }
}
/**
1.8 +9 -7
xml-xindice/java/src/org/apache/xindice/xml/SymbolTable.java
Index: SymbolTable.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/SymbolTable.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SymbolTable.java 9 Aug 2003 05:01:55 -0000 1.7
+++ SymbolTable.java 9 Aug 2003 18:56:18 -0000 1.8
@@ -143,10 +143,11 @@
sb.append(Integer.toString(namespaceURI.hashCode()));
sb.append(':');
int idx = qName.indexOf(':');
- if (idx != -1)
+ if (idx != -1) {
sb.append(qName.substring(idx + 1));
- else
+ } else {
sb.append(qName);
+ }
return sb.toString();
}
@@ -167,9 +168,9 @@
public final short getSymbol(String qname, String namespaceURI, boolean
create) {
String lookupName = getLookupName(qname, namespaceURI);
SymbolInfo info = (SymbolInfo) symbols.get(lookupName);
- if (info != null)
+ if (info != null) {
return info.symbol;
- else if (create) {
+ } else if (create) {
synchronized (symbols) {
short id = ++maxSymbol;
info = new SymbolInfo(qname, namespaceURI, id);
@@ -256,8 +257,9 @@
String qname = elem.getAttribute(NAME);
String namespaceURI = elem.getAttribute(NSURI);
- if (namespaceURI != null && namespaceURI.length() == 0)
+ if (namespaceURI != null && namespaceURI.length() == 0) {
namespaceURI = null;
+ }
Short id = new Short(elem.getAttribute(ID));
if (id.shortValue() > maxSymbol) {
1.6 +6 -5
xml-xindice/java/src/org/apache/xindice/xml/XMLCompressedInput.java
Index: XMLCompressedInput.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/XMLCompressedInput.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLCompressedInput.java 9 Aug 2003 05:01:55 -0000 1.5
+++ XMLCompressedInput.java 9 Aug 2003 18:56:18 -0000 1.6
@@ -113,11 +113,12 @@
case Signatures.Char:
type = (byte) ((signature & 0x20) >>> 0x5);
- if (type == Signatures.CharText)
+ if (type == Signatures.CharText) {
return Node.TEXT_NODE;
- else
+ } else {
return Node.ENTITY_REFERENCE_NODE;
-
+ }
+
case Signatures.Elem:
return Node.ELEMENT_NODE;
1.5 +5 -4
xml-xindice/java/src/org/apache/xindice/xml/NodeSource.java
Index: NodeSource.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/NodeSource.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeSource.java 7 Aug 2003 20:13:25 -0000 1.4
+++ NodeSource.java 9 Aug 2003 18:56:18 -0000 1.5
@@ -98,9 +98,10 @@
}
public String getCanonicalName() {
- if (key != null)
+ if (key != null) {
return collection.getCanonicalDocumentName(key);
- else
+ } else {
return collection.getCanonicalName();
+ }
}
}
1.7 +5 -4
xml-xindice/java/src/org/apache/xindice/xml/NamespaceMap.java
Index: NamespaceMap.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/NamespaceMap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NamespaceMap.java 9 Aug 2003 05:01:55 -0000 1.6
+++ NamespaceMap.java 9 Aug 2003 18:56:18 -0000 1.7
@@ -86,10 +86,11 @@
Iterator i = keySet().iterator();
while (i.hasNext()) {
String pfx = (String) i.next();
- if (pfx.equals(""))
+ if (pfx.equals("")) {
elem.setAttribute("xmlns", (String) get(pfx));
- else
+ } else {
elem.setAttribute("xmlns:" + pfx, (String) get(pfx));
+ }
}
}
return elem;
1.7 +23 -13
xml-xindice/java/src/org/apache/xindice/core/indexer/IndexPattern.java
Index: IndexPattern.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/indexer/IndexPattern.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- IndexPattern.java 7 Aug 2003 20:13:21 -0000 1.6
+++ IndexPattern.java 9 Aug 2003 18:56:18 -0000 1.7
@@ -96,17 +96,20 @@
this.symbols = symbols;
StringTokenizer st = new StringTokenizer(pattern.trim(), "@");
elemName = st.nextToken();
- if (elemName.equals("*"))
+ if (elemName.equals("*")) {
elemID = PATTERN_WILDCARD;
- else
+ } else {
elemID = SymbolTable.getNormalizedSymbol(symbols, elemName,
nsMap, true);
+ }
+
if (st.hasMoreTokens()) {
attrName = st.nextToken();
- if (attrName.equals("*"))
+ if (attrName.equals("*")) {
attrID = PATTERN_WILDCARD;
- else
+ } else {
attrID = elemID == PATTERN_WILDCARD ? PATTERN_NAME
: SymbolTable.getNormalizedSymbol(symbols, attrName,
nsMap, true);
+ }
}
}
@@ -147,12 +150,14 @@
result = (SCORE_WILDCARD << 2);
break;
case PATTERN_NAME:
- if (elemName.equals(p.elemName))
+ if (elemName.equals(p.elemName)) {
result = (SCORE_NAME << 2);
+ }
break;
default:
- if (elemID == p.elemID)
+ if (elemID == p.elemID) {
result = (SCORE_NATURAL << 2);
+ }
}
if (result != 0) {
@@ -160,12 +165,14 @@
case PATTERN_WILDCARD:
return result + SCORE_WILDCARD;
case PATTERN_NAME:
- if (attrName.equals(p.attrName))
+ if (attrName.equals(p.attrName)) {
return result + SCORE_NAME;
+ }
break;
default:
- if (attrID == p.attrID)
+ if (attrID == p.attrID) {
return result + SCORE_NATURAL;
+ }
}
}
@@ -252,13 +259,16 @@
if (obj instanceof IndexPattern) {
IndexPattern p = (IndexPattern) obj;
boolean eq = elemID == p.elemID && attrID == p.attrID;
- if (eq && (elemName != null || p.elemName != null))
+ if (eq && (elemName != null || p.elemName != null)) {
eq = elemName != null && p.elemName != null &&
elemName.equals(p.elemName);
- if (eq && (attrName != null || p.attrName != null))
+ }
+ if (eq && (attrName != null || p.attrName != null)) {
eq = attrName != null && p.attrName != null &&
attrName.equals(p.attrName);
+ }
return eq;
- } else
+ } else {
return false;
+ }
}
}
1.18 +6 -4
xml-xindice/java/src/org/apache/xindice/core/indexer/IndexManager.java
Index: IndexManager.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/indexer/IndexManager.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- IndexManager.java 9 Aug 2003 05:01:56 -0000 1.17
+++ IndexManager.java 9 Aug 2003 18:56:18 -0000 1.18
@@ -181,8 +181,9 @@
config.processChildren(INDEX, new ConfigurationCallback() {
public void process(Configuration cfg) {
try {
- if (cfg.getAttribute(NAME).equals(name))
+ if (cfg.getAttribute(NAME).equals(name)) {
cfg.delete();
+ }
} catch (Exception e) {
log.warn(e);
}
@@ -393,8 +394,9 @@
Iterator enum = indexes.values().iterator();
while (enum.hasNext()) {
IndexerInfo info = (IndexerInfo) enum.next();
- if (info.status != STATUS_READY ||
!info.indexer.getIndexStyle().equals(style))
+ if (info.status != STATUS_READY ||
!info.indexer.getIndexStyle().equals(style)) {
continue;
+ }
int score = pattern.getMatchLevel(info.pattern);
if (score > highScore) {
idx = info.indexer;
1.12 +16 -15
xml-xindice/java/src/org/apache/xindice/core/indexer/ValueIndexer.java
Index: ValueIndexer.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/indexer/ValueIndexer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ValueIndexer.java 9 Aug 2003 05:01:56 -0000 1.11
+++ ValueIndexer.java 9 Aug 2003 18:56:18 -0000 1.12
@@ -149,31 +149,32 @@
// Determine the Index Type
String tv = config.getAttribute(TYPE, STRING_VAL).toLowerCase();
- if (tv.equals(STRING_VAL))
+ if (tv.equals(STRING_VAL)) {
type = STRING;
- else if (tv.equals(TRIMMED_VAL))
+ } else if (tv.equals(TRIMMED_VAL)) {
type = TRIMMED;
- else if (tv.equals(SHORT_VAL))
+ } else if (tv.equals(SHORT_VAL)) {
type = INTEGER;
- else if (tv.equals(INT_VAL))
+ } else if (tv.equals(INT_VAL)) {
type = INTEGER;
- else if (tv.equals(LONG_VAL))
+ } else if (tv.equals(LONG_VAL)) {
type = INTEGER;
- else if (tv.equals(FLOAT_VAL))
+ } else if (tv.equals(FLOAT_VAL)) {
type = FLOAT;
- else if (tv.equals(DOUBLE_VAL))
+ } else if (tv.equals(DOUBLE_VAL)) {
type = FLOAT;
- else if (tv.equals(BYTE_VAL))
+ } else if (tv.equals(BYTE_VAL)) {
type = BYTE;
- else if (tv.equals(CHAR_VAL))
+ } else if (tv.equals(CHAR_VAL)) {
type = CHAR;
- else if (tv.equals(BOOLEAN_VAL))
+ } else if (tv.equals(BOOLEAN_VAL)) {
type = BOOLEAN;
- else {
- if (pattern.indexOf('@') != -1)
+ } else {
+ if (pattern.indexOf('@') != -1) {
type = STRING;
- else
+ } else {
type = TRIMMED;
+ }
}
typeSize = sizes[type];
1.11 +4 -3
xml-xindice/java/src/org/apache/xindice/xml/dom/ContainerNodeImpl.java
Index: ContainerNodeImpl.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/ContainerNodeImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ContainerNodeImpl.java 9 Aug 2003 05:01:55 -0000 1.10
+++ ContainerNodeImpl.java 9 Aug 2003 18:56:18 -0000 1.11
@@ -159,8 +159,9 @@
/* TODO why is it used for? byte signature = */
in.readSignature();
int len = in.readContentSize();
- if (len == 0)
+ if (len == 0) {
len = 1;
+ }
switch (in.getNodeType()) {
1.11 +10 -6
xml-xindice/java/src/org/apache/xindice/xml/dom/DocumentImpl.java
Index: DocumentImpl.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/DocumentImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DocumentImpl.java 9 Aug 2003 05:01:55 -0000 1.10
+++ DocumentImpl.java 9 Aug 2003 18:56:18 -0000 1.11
@@ -144,8 +144,9 @@
}
if (compress) {
- if (symbols == null)
+ if (symbols == null) {
symbols = new SymbolTable();
+ }
data = DOMCompressor.Compress(doc, symbols);
pos = 0;
len = data.length;
@@ -218,8 +219,9 @@
public void expandSource() {
ElementImpl e = (ElementImpl) getDocumentElement();
- if (e != null)
+ if (e != null) {
e.expandSource();
+ }
}
public Node getNodeAtPos(int pos) {
@@ -276,8 +278,9 @@
Iterator enum = childNodes.iterator();
while (enum.hasNext()) {
Node node = (Node) enum.next();
- if (node.getNodeType() == Node.ELEMENT_NODE)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
return (Element) node;
+ }
}
return null;
}
@@ -386,8 +389,9 @@
}
}
n = n.getParentNode();
- if (n.getNodeType() == DOCUMENT_NODE || n.getNodeType() ==
DOCUMENT_FRAGMENT_NODE)
+ if (n.getNodeType() == DOCUMENT_NODE || n.getNodeType() ==
DOCUMENT_FRAGMENT_NODE) {
n = null;
+ }
}
}
}
1.10 +6 -5
xml-xindice/java/src/org/apache/xindice/xml/dom/ProcessingInstructionImpl.java
Index: ProcessingInstructionImpl.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/ProcessingInstructionImpl.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ProcessingInstructionImpl.java 7 Aug 2003 20:13:25 -0000 1.9
+++ ProcessingInstructionImpl.java 9 Aug 2003 18:56:18 -0000 1.10
@@ -97,11 +97,12 @@
}
protected void checkLoaded() {
- if (loaded)
+ if (loaded) {
return;
- else
+ } else {
loaded = true;
-
+ }
+
try {
if (data != null) {
DocumentImpl doc = (DocumentImpl) getOwnerDocument();
1.15 +8 -5
xml-xindice/java/src/org/apache/xindice/xml/dom/ElementImpl.java
Index: ElementImpl.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/ElementImpl.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ElementImpl.java 9 Aug 2003 05:01:55 -0000 1.14
+++ ElementImpl.java 9 Aug 2003 18:56:18 -0000 1.15
@@ -163,8 +163,9 @@
setAttribute(XMLNS_PREFIX + ":" + prefix, NodeSource.SOURCE_NS);
setAttribute(prefix + ":" + NodeSource.SOURCE_COL,
src.getCollection().getCanonicalName());
Key k = src.getKey();
- if (k != null)
+ if (k != null) {
setAttribute(prefix + ":" + NodeSource.SOURCE_KEY,
k.toString());
+ }
}
}
@@ -297,10 +298,12 @@
checkReadOnly();
Attr oldAttr = (Attr) attributes.getNamedItem(newAttr.getName());
DocumentImpl doc = (DocumentImpl) getOwnerDocument();
- if (newAttr.getParentNode().getNodeType() == Node.ELEMENT_NODE)
+ if (newAttr.getParentNode().getNodeType() == Node.ELEMENT_NODE) {
throw EX_INUSE_ATTRIBUTE;
- if (doc != newAttr.getOwnerDocument())
+ }
+ if (doc != newAttr.getOwnerDocument()) {
throw EX_WRONG_DOCUMENT;
+ }
((AttrImpl) newAttr).setParentNode(this);
attributes.setNamedItem(newAttr);
setDirty();
1.10 +6 -4
xml-xindice/java/src/org/apache/xindice/xml/dom/DOMParser.java
Index: DOMParser.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/DOMParser.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DOMParser.java 9 Aug 2003 05:01:55 -0000 1.9
+++ DOMParser.java 9 Aug 2003 18:56:18 -0000 1.10
@@ -244,10 +244,12 @@
setReaderProperty(xr,
"http://xml.org/sax/properties/lexical-handler", this);
setReaderProperty(xr,
"http://xml.org/sax/properties/declaration-handler", this);
- if (errors != null)
+ if (errors != null) {
xr.setErrorHandler(errors);
- if (entities != null)
+ }
+ if (entities != null) {
xr.setEntityResolver(entities);
+ }
return sp;
}
1.13 +6 -4
xml-xindice/java/src/org/apache/xindice/core/filer/FSFiler.java
Index: FSFiler.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/filer/FSFiler.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- FSFiler.java 9 Aug 2003 05:01:55 -0000 1.12
+++ FSFiler.java 9 Aug 2003 18:56:18 -0000 1.13
@@ -122,8 +122,9 @@
if (exts != null && exts.trim().length() > 0) {
extensions = new HashSet();
StringTokenizer st = new StringTokenizer(exts);
- while (st.hasMoreTokens())
+ while (st.hasMoreTokens()) {
extensions.add(st.nextToken());
+ }
}
dir = new File(location);
opened = false;
@@ -136,8 +137,9 @@
}
private void checkReadOnly() throws DBException {
- if (readOnly)
+ if (readOnly) {
throw new FilerException(FaultCodes.COL_COLLECTION_READ_ONLY,
"Filer is read-only");
+ }
}
public boolean close() {
1.17 +4 -3
xml-xindice/java/src/org/apache/xindice/core/filer/BTree.java
Index: BTree.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/filer/BTree.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- BTree.java 9 Aug 2003 05:01:55 -0000 1.16
+++ BTree.java 9 Aug 2003 18:56:18 -0000 1.17
@@ -1049,8 +1049,9 @@
public synchronized void read(DataInputStream dis) throws
IOException {
super.read(dis);
- if (getStatus() == UNUSED)
+ if (getStatus() == UNUSED) {
return;
+ }
valueCount = dis.readShort();
}
1.16 +14 -8
xml-xindice/java/src/org/apache/xindice/core/filer/HashFiler.java
Index: HashFiler.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/filer/HashFiler.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- HashFiler.java 8 Aug 2003 22:40:45 -0000 1.15
+++ HashFiler.java 9 Aug 2003 18:56:18 -0000 1.16
@@ -159,8 +159,9 @@
}
pageNum = ph.getNextCollision();
- if (pageNum == -1)
+ if (pageNum == -1) {
return null;
+ }
}
}
@@ -175,8 +176,9 @@
while (true) {
p = getPage(pageNum);
ph = (HashPageHeader) p.getPageHeader();
- if ((ph.getStatus() == UNUSED || ph.getStatus() == DELETED) ||
(ph.getStatus() == RECORD && ph.getKeyHash() == key.getHash() &&
p.getKey().equals(key)))
+ if ((ph.getStatus() == UNUSED || ph.getStatus() == DELETED) ||
(ph.getStatus() == RECORD && ph.getKeyHash() == key.getHash() &&
p.getKey().equals(key))) {
return p;
+ }
pageNum = ph.getNextCollision();
if (pageNum == -1) {
Page np = getFreePage();
@@ -264,17 +266,20 @@
while (true) {
page = getPage(pageNum);
pageHead = (HashPageHeader) page.getPageHeader();
- if (pageHead.getStatus() == RECORD && pageHead.getKeyHash()
== key.getHash() && page.getKey().equals(key))
+ if (pageHead.getStatus() == RECORD && pageHead.getKeyHash()
== key.getHash() && page.getKey().equals(key)) {
break;
+ }
pageNum = pageHead.getNextCollision();
- if (pageNum == -1)
+ if (pageNum == -1) {
return false;
+ }
prev = page;
prevHead = pageHead;
}
- if (page == null)
+ if (page == null) {
return false;
+ }
if (prev != null) {
prevHead.setNextCollision(pageHead.nextCollision);
@@ -481,8 +486,9 @@
public synchronized void read(DataInputStream dis) throws
IOException {
super.read(dis);
- if (getStatus() == UNUSED)
+ if (getStatus() == UNUSED) {
return;
+ }
created = dis.readLong();
modified = dis.readLong();
1.14 +6 -4
xml-xindice/java/src/org/apache/xindice/core/filer/BTreeFiler.java
Index: BTreeFiler.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/filer/BTreeFiler.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- BTreeFiler.java 8 Aug 2003 22:40:45 -0000 1.13
+++ BTreeFiler.java 9 Aug 2003 18:56:18 -0000 1.14
@@ -181,8 +181,9 @@
BTreeFilerPageHeader ph = (BTreeFilerPageHeader)
p.getPageHeader();
long t = System.currentTimeMillis();
- if (ph.getStatus() == UNUSED)
+ if (ph.getStatus() == UNUSED) {
ph.setCreated(t);
+ }
ph.setModified(t);
ph.setStatus(RECORD);
@@ -364,8 +365,9 @@
public synchronized void read(DataInputStream dis) throws
IOException {
super.read(dis);
- if (getStatus() == UNUSED)
+ if (getStatus() == UNUSED) {
return;
+ }
created = dis.readLong();
modified = dis.readLong();
1.8 +6 -4
xml-xindice/java/src/org/apache/xindice/core/filer/MemFiler.java
Index: MemFiler.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/filer/MemFiler.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MemFiler.java 7 Aug 2003 20:13:21 -0000 1.7
+++ MemFiler.java 9 Aug 2003 18:56:18 -0000 1.8
@@ -106,13 +106,15 @@
}
private void checkOpened() throws DBException {
- if (!opened)
+ if (!opened) {
throw new FilerException(FaultCodes.COL_COLLECTION_CLOSED,
"Filer is closed");
+ }
}
private void checkReadOnly() throws DBException {
- if (readOnly)
+ if (readOnly) {
throw new FilerException(FaultCodes.COL_COLLECTION_READ_ONLY,
"Filer is read-only");
+ }
}
public boolean create() {
1.18 +9 -6
xml-xindice/java/src/org/apache/xindice/core/filer/Paged.java
Index: Paged.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/filer/Paged.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Paged.java 9 Aug 2003 05:01:55 -0000 1.17
+++ Paged.java 9 Aug 2003 18:56:18 -0000 1.18
@@ -256,10 +256,11 @@
// Continue following the list of pages until we get to the end.
nextPage = ph.getNextPage();
- if (nextPage != NO_PAGE)
+ if (nextPage != NO_PAGE) {
p = getPage(nextPage);
- else
+ } else {
break;
+ }
}
// Return a Value with the collected contents of all pages.
@@ -651,10 +652,12 @@
public static long[] deleteArrayLong(long[] vals, int idx) {
long[] newVals = new long[vals.length - 1];
- if (idx > 0)
+ if (idx > 0) {
System.arraycopy(vals, 0, newVals, 0, idx);
- if (idx < newVals.length)
+ }
+ if (idx < newVals.length) {
System.arraycopy(vals, idx + 1, newVals, idx, newVals.length -
idx);
+ }
return newVals;
}
1.9 +6 -4
xml-xindice/java/src/org/apache/xindice/core/DocumentCache.java
Index: DocumentCache.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/DocumentCache.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DocumentCache.java 9 Aug 2003 05:01:55 -0000 1.8
+++ DocumentCache.java 9 Aug 2003 18:56:19 -0000 1.9
@@ -182,14 +182,16 @@
}
public String toString() {
- if (strVal == null)
+ if (strVal == null) {
strVal = col.getCanonicalDocumentName(key);
+ }
return strVal;
}
public int hashCode() {
- if (strVal == null)
+ if (strVal == null) {
strVal = col.getCanonicalDocumentName(key);
+ }
return strVal.hashCode();
}
1.17 +4 -3
xml-xindice/java/src/org/apache/xindice/core/CollectionManager.java
Index: CollectionManager.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/CollectionManager.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- CollectionManager.java 8 Aug 2003 22:38:18 -0000 1.16
+++ CollectionManager.java 9 Aug 2003 18:56:19 -0000 1.17
@@ -211,8 +211,9 @@
colConfig.processChildren(COLLECTION, new
ConfigurationCallback() {
public void process(Configuration cfg) {
try {
- if (cfg.getAttribute(NAME).equals(name))
+ if (cfg.getAttribute(NAME).equals(name)) {
cfg.delete();
+ }
} catch (Exception e) {
log.warn(e);
}
1.15 +9 -6
xml-xindice/java/src/org/apache/xindice/core/FaultCodes.java
Index: FaultCodes.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/FaultCodes.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- FaultCodes.java 9 Aug 2003 05:01:55 -0000 1.14
+++ FaultCodes.java 9 Aug 2003 18:56:19 -0000 1.15
@@ -226,8 +226,9 @@
* @return An XMLDBException instance
*/
public static XMLDBException createXMLDBException(Exception e) {
- if (e instanceof XMLDBException)
+ if (e instanceof XMLDBException) {
return (XMLDBException) e;
+ }
int faultCode = e instanceof RuntimeException ? JAVA_RUNTIME_ERROR :
GEN_UNKNOWN;
return createXMLDBException(faultCode, null, e);
@@ -274,8 +275,9 @@
*/
public static int getFaultCodeType(Exception e) {
int code = 0;
- if (e instanceof DBException)
+ if (e instanceof DBException) {
code = ((DBException) e).faultCode;
+ }
// Strip it to the General series
code = code % 100;
@@ -295,9 +297,10 @@
*/
public static int getFaultCodeSeries(Exception e) {
int code = 0;
- if (e instanceof DBException)
+ if (e instanceof DBException) {
code = ((DBException) e).faultCode;
-
+ }
+
// Strip it to the series
code = code - (code % 100);
return code;
1.27 +6 -4
xml-xindice/java/src/org/apache/xindice/core/Database.java
Index: Database.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/Database.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Database.java 9 Aug 2003 02:56:48 -0000 1.26
+++ Database.java 9 Aug 2003 18:56:19 -0000 1.27
@@ -274,10 +274,12 @@
rec = new TimeRecord(created, modified);
timestamps.put(path, rec);
} else {
- if (created > 0)
+ if (created > 0) {
rec.setCreatedTime(created);
- if (modified > 0)
+ }
+ if (modified > 0) {
rec.setModifiedTime(modified);
+ }
}
}
1.32 +21 -14
xml-xindice/java/src/org/apache/xindice/core/Collection.java
Index: Collection.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/Collection.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- Collection.java 9 Aug 2003 05:01:55 -0000 1.31
+++ Collection.java 9 Aug 2003 18:56:19 -0000 1.32
@@ -638,8 +638,9 @@
return meta;
}
Document doc = getDocument(id);
- if (null == doc)
+ if (null == doc) {
throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND,
"Document " + id + " does not exist");
+ }
MetaSystemCollection metacol = getMetaSystemCollection();
meta = metacol.getDocumentMeta(this, id);
@@ -1303,14 +1304,17 @@
Key objKey = createNewKey(key);
Document oldDoc = getDocument(objKey);
- if (oldDoc != null)
+ if (oldDoc != null) {
indexManager.removeDocument(objKey, oldDoc);
+ }
- if (documentCache != null)
+ if (documentCache != null) {
documentCache.removeDocument(this, objKey);
+ }
- if (!filer.deleteRecord(objKey))
+ if (!filer.deleteRecord(objKey)) {
throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND,
"Document Does Not Exist");
+ }
// update the meta for this collection if necessary
updateCollectionMeta();
@@ -1347,9 +1351,10 @@
return;
}
if (null != meta) {
- if (meta.getType() != MetaData.COLLECTION)
+ if (meta.getType() != MetaData.COLLECTION) {
throw new DBException(FaultCodes.GEN_UNKNOWN, "Mismatch type
of meta data for collection " + getCanonicalName());
-
+ }
+
MetaSystemCollection metacol = getMetaSystemCollection();
metacol.setCollectionMeta(this, meta);
}
@@ -1505,13 +1510,15 @@
return;
}
Document doc = getDocument(id);
- if (null == doc)
+ if (null == doc) {
throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND,
"Document " + id + " does not exist");
+ }
if (null != meta) {
- if (meta.getType() == MetaData.UNKNOWN || meta.getType() ==
MetaData.COLLECTION)
+ if (meta.getType() == MetaData.UNKNOWN || meta.getType() ==
MetaData.COLLECTION) {
throw new DBException(FaultCodes.GEN_UNKNOWN, "Mismatch type
of meta data for document " + getCanonicalDocumentName(id));
-
+ }
+
MetaSystemCollection metacol = getMetaSystemCollection();
metacol.setDocumentMeta(this, id, meta);
}
@@ -1533,8 +1540,7 @@
* @param obj The Object to set
*/
public final void setObject(Object key, XMLSerializable obj) throws
DBException {
- putObject(createNewKey(key), obj /*, false */
- );
+ putObject(createNewKey(key), obj /*, false */ );
}
/**
@@ -1550,8 +1556,9 @@
} catch (DBException e) {
// something strange has happened.. can't get the
// meta data for this collection
- if (log.isWarnEnabled())
+ if (log.isWarnEnabled()) {
log.warn("Error fetching collection meta. " + e);
+ }
return;
}
1.24 +3 -3
xml-xindice/java/src/org/apache/xindice/tools/XMLTools.java
Index: XMLTools.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/tools/XMLTools.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- XMLTools.java 8 Aug 2003 01:05:50 -0000 1.23
+++ XMLTools.java 9 Aug 2003 18:56:19 -0000 1.24
@@ -124,7 +124,7 @@
new XMLTools().process(args);
} catch (Exception e) {
System.out.println(e.getMessage());
- if (verbose == true) {
+ if (verbose) {
e.printStackTrace(System.err);
}
}
1.7 +6 -3
xml-xindice/java/src/org/apache/xindice/server/UglyBrowser.java
Index: UglyBrowser.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/server/UglyBrowser.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- UglyBrowser.java 9 Aug 2003 05:01:56 -0000 1.6
+++ UglyBrowser.java 9 Aug 2003 18:56:19 -0000 1.7
@@ -259,11 +259,14 @@
* Is the given character allowed inside an HTML document?
*/
static public boolean isLegalCharacter(char c) {
+ return (c > 0x07) && (c < 0x80);
+ /* TODO delete if the above works
if ((c <= 0x07) || (c >= 0x80)) {
return false;
} else {
return true;
}
+ */
}
public static class XPathPseudoParser {
1.7 +40 -28
xml-xindice/java/src/org/apache/xindice/core/data/Variant.java
Index: Variant.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/data/Variant.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Variant.java 7 Aug 2003 20:13:21 -0000 1.6
+++ Variant.java 9 Aug 2003 18:56:19 -0000 1.7
@@ -96,7 +96,7 @@
}
public Variant(boolean value) {
- this.value = new Boolean(value);
+ this.value = Boolean.valueOf(value);
type = Types.BOOLEAN;
}
@@ -187,7 +187,7 @@
* @param value The value
*/
public void set(boolean value) {
- this.value = new Boolean(value);
+ this.value = Boolean.valueOf(value);
type = Types.BOOLEAN;
}
@@ -308,10 +308,11 @@
* @return The value
*/
public String getString() {
- if (type == Types.STRING)
+ if (type == Types.STRING) {
return (String) value;
- else
+ } else {
return value.toString();
+ }
}
/**
@@ -320,10 +321,11 @@
* @return The value
*/
public boolean getBoolean() {
- if (type == Types.BOOLEAN)
+ if (type == Types.BOOLEAN) {
return ((Boolean) value).booleanValue();
- else
+ } else {
return "[true][yes][1][y][on]".indexOf("[" +
value.toString().toLowerCase() + "]") != -1;
+ }
}
/**
@@ -332,10 +334,11 @@
* @return The value
*/
public byte getByte() {
- if (type == Types.BYTE)
+ if (type == Types.BYTE) {
return ((Byte) value).byteValue();
- else
+ } else {
return Byte.parseByte(value.toString());
+ }
}
/**
@@ -344,10 +347,11 @@
* @return The value
*/
public char getChar() {
- if (type == Types.CHAR)
+ if (type == Types.CHAR) {
return ((Character) value).charValue();
- else
+ } else {
return value.toString().charAt(0);
+ }
}
/**
@@ -356,10 +360,11 @@
* @return The value
*/
public short getShort() {
- if (type == Types.SHORT)
+ if (type == Types.SHORT) {
return ((Short) value).shortValue();
- else
+ } else {
return Short.parseShort(value.toString());
+ }
}
/**
@@ -368,10 +373,11 @@
* @return The value
*/
public int getInt() {
- if (type == Types.INT)
+ if (type == Types.INT) {
return ((Integer) value).intValue();
- else
+ } else {
return Integer.parseInt(value.toString());
+ }
}
/**
@@ -380,10 +386,11 @@
* @return The value
*/
public long getLong() {
- if (type == Types.LONG)
+ if (type == Types.LONG) {
return ((Long) value).longValue();
- else
+ } else {
return Long.parseLong(value.toString());
+ }
}
/**
@@ -392,10 +399,11 @@
* @return The value
*/
public float getFloat() {
- if (type == Types.FLOAT)
+ if (type == Types.FLOAT) {
return ((Float) value).floatValue();
- else
+ } else {
return Float.parseFloat(value.toString());
+ }
}
/**
@@ -404,10 +412,11 @@
* @return The value
*/
public double getDouble() {
- if (type == Types.DOUBLE)
+ if (type == Types.DOUBLE) {
return ((Double) value).doubleValue();
- else
+ } else {
return Double.parseDouble(value.toString());
+ }
}
/**
@@ -416,10 +425,11 @@
* @return The value
*/
public Element getElement() {
- if (type == Types.ELEMENT)
+ if (type == Types.ELEMENT) {
return (Element) value;
- else
+ } else {
return null;
+ }
}
/**
@@ -428,10 +438,11 @@
* @return The value
*/
public Document getDocument() {
- if (type == Types.DOCUMENT)
+ if (type == Types.DOCUMENT) {
return (Document) value;
- else
+ } else {
return null;
+ }
}
/**
@@ -440,10 +451,11 @@
* @return The value
*/
public DocumentFragment getDocumentFragment() {
- if (type == Types.DOCUMENTFRAGMENT)
+ if (type == Types.DOCUMENTFRAGMENT) {
return (DocumentFragment) value;
- else
+ } else {
return null;
+ }
}
/**
1.5 +9 -6
xml-xindice/java/src/org/apache/xindice/core/data/Key.java
Index: Key.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/data/Key.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Key.java 7 Aug 2003 20:13:21 -0000 1.4
+++ Key.java 9 Aug 2003 18:56:19 -0000 1.5
@@ -95,8 +95,9 @@
}
public int getHash() {
- if (hash == 0)
+ if (hash == 0) {
calculateHash();
+ }
return hash;
}
@@ -105,8 +106,9 @@
Key key = (Key) value;
return getHash() == key.getHash() ? compareTo(key) == 0
: false;
- } else
+ } else {
return super.equals(value);
+ }
}
public int hashCode() {
@@ -114,10 +116,11 @@
}
public boolean equals(Object obj) {
- if (obj instanceof Key)
+ if (obj instanceof Key) {
return equals((Key) obj);
- else
+ } else {
return super.equals(obj);
+ }
}
}
1.6 +8 -6
xml-xindice/java/src/org/apache/xindice/xml/dom/traversal/TreeWalkerImpl.java
Index: TreeWalkerImpl.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/dom/traversal/TreeWalkerImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TreeWalkerImpl.java 9 Aug 2003 05:01:56 -0000 1.5
+++ TreeWalkerImpl.java 9 Aug 2003 18:56:19 -0000 1.6
@@ -353,15 +353,17 @@
*/
public Node nextNode() {
Node result = null;
- if (next != null)
+ if (next != null) {
result = next;
- else
+ } else {
return null;
+ }
+
Node node = next;
while (true) {
- if (node.hasChildNodes())
+ if (node.hasChildNodes()) {
node = node.getFirstChild();
- else {
+ } else {
while (true) {
Node old = node;
node = node.getNextSibling();
1.24 +9 -7
xml-xindice/java/src/org/apache/xindice/xml/sax/SAXEventGenerator.java
Index: SAXEventGenerator.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/sax/SAXEventGenerator.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- SAXEventGenerator.java 9 Aug 2003 05:01:56 -0000 1.23
+++ SAXEventGenerator.java 9 Aug 2003 18:56:19 -0000 1.24
@@ -275,10 +275,11 @@
private final String getLocalName(String qname) {
int idx = qname.indexOf(":");
- if (idx != -1)
+ if (idx != -1) {
return qname.substring(idx + 1);
- else
+ } else {
return qname;
+ }
}
private final boolean isNSAttr(final String qName) {
@@ -396,11 +397,12 @@
XMLCompressedInput tin = new
XMLCompressedInput(tbis, symbols);
tin.readSignature(); // Skip The Signature
- if (type == Node.TEXT_NODE)
+ if (type == Node.TEXT_NODE) {
tin.readContentSize();
- else
+ } else {
tin.readInt();
-
+ }
+
byte[] buf = new byte[tbis.available()];
tin.read(buf);
1.15 +6 -4
xml-xindice/java/src/org/apache/xindice/core/request/URIMapper.java
Index: URIMapper.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/request/URIMapper.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- URIMapper.java 9 Aug 2003 05:01:56 -0000 1.14
+++ URIMapper.java 9 Aug 2003 18:56:19 -0000 1.15
@@ -354,10 +354,12 @@
parseName("/"); // Ignore Slash
parseName("/"); // Ignore Slash
parseName("/:"); // Ignore Host (For Now)
- if (lastChar == ':')
+ if (lastChar == ':') {
parseName("/"); // Ignore Port
- } else
+ }
+ } else {
pos = 1;
+ }
// Database check
tmp = parseName("/");
1.7 +4 -3
xml-xindice/java/src/org/apache/xindice/util/ByteBuffer.java
Index: ByteBuffer.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/util/ByteBuffer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ByteBuffer.java 9 Aug 2003 05:01:55 -0000 1.6
+++ ByteBuffer.java 9 Aug 2003 18:56:19 -0000 1.7
@@ -446,8 +446,9 @@
}
public byte byteAt(int index) {
- if (index < 0 || index >= length)
+ if (index < 0 || index >= length) {
throw new IndexOutOfBoundsException();
+ }
return buffer[index];
}
1.10 +9 -11
xml-xindice/java/src/org/apache/xindice/core/meta/MetaData.java
Index: MetaData.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/meta/MetaData.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- MetaData.java 9 Aug 2003 05:01:56 -0000 1.9
+++ MetaData.java 9 Aug 2003 18:56:19 -0000 1.10
@@ -223,8 +223,9 @@
* @return Enumeration of attributes
*/
public Enumeration getAttributeKeys() {
- if (null == attrs)
+ if (null == attrs) {
return EMPTY;
+ }
return attrs.keys();
}
@@ -254,10 +255,10 @@
if (o instanceof Number) {
Number n = (Number) o;
- return new Boolean(n.intValue() != 0);
+ return Boolean.valueOf(n.intValue() != 0);
}
- return new Boolean(o.toString());
+ return Boolean.valueOf(o.toString());
}
public Integer getAttributeAsInteger(final Object name) {
@@ -507,8 +508,9 @@
Object key = e.nextElement();
Object value = attrs.get(key);
- if (null == key)
+ if (null == key) {
continue;
+ }
Element attrElement = null;
if (!USE_NS) {
@@ -705,11 +707,7 @@
* @return boolean
*/
public boolean hasContext() {
- if (created > 0 || modified > 0) {
- return true;
- } else {
- return false;
- }
+ return (created > 0 || modified > 0);
}
/**
1.20 +41 -28
xml-xindice/java/src/org/apache/xindice/core/query/XPathQueryResolver.java
Index: XPathQueryResolver.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/query/XPathQueryResolver.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- XPathQueryResolver.java 9 Aug 2003 05:01:56 -0000 1.19
+++ XPathQueryResolver.java 9 Aug 2003 18:56:19 -0000 1.20
@@ -261,8 +261,9 @@
// Issue the query using Indexes
try {
Object obj = evaluate(null, 0);
- if (obj instanceof NamedKeys)
+ if (obj instanceof NamedKeys) {
keySet = ((NamedKeys) obj).keys;
+ }
} catch (Exception e) {
log.warn(e);
}
@@ -440,9 +441,9 @@
} else
name = nk.name;
}
- if (nk.keys != null)
+ if (nk.keys != null) {
ks.add(nk.keys);
- else if (name != null) {
+ } else if (name != null) {
// Try to use a NameIndex to resolve the path
component
IndexPattern pattern = new IndexPattern(symbols,
name, nsMap);
Indexer idx =
context.getIndexManager().getBestIndexer(Indexer.STYLE_NODENAME, pattern);
@@ -745,10 +746,11 @@
private Object funcNormalizeSpace(List args) {
if (args.size() == 1) {
Object o = args.get(0);
- if (o instanceof XObject)
+ if (o instanceof XObject) {
return new
XString(QueryEngine.normalizeString(((XObject) o).str()));
- else
+ } else {
return o;
+ }
}
return null;
}
@@ -803,10 +805,11 @@
} else if (o instanceof NamedKeys && s instanceof XObject) {
NamedKeys nk = (NamedKeys) o;
String ps;
- if (nk.attribute && nk.name.indexOf('@') == -1)
+ if (nk.attribute && nk.name.indexOf('@') == -1) {
ps = owner + "@" + nk.name;
- else
+ } else {
ps = nk.name;
+ }
IndexPattern pattern = new IndexPattern(symbols, ps,
nsMap);
@@ -823,10 +826,11 @@
private Object funcString(List args) {
if (args.size() == 1) {
Object o = args.get(0);
- if (o instanceof XObject)
+ if (o instanceof XObject) {
return new XString(((XObject) o).str());
- else
+ } else {
return o;
+ }
}
return null;
}
@@ -834,8 +838,9 @@
private Object funcStringLength(List args) {
if (args.size() == 1) {
Object o = args.get(0);
- if (o instanceof XObject)
+ if (o instanceof XObject) {
return new XNumber(((XObject) o).str().length());
+ }
}
return null;
}
@@ -865,10 +870,11 @@
String val = ((XObject) o).str();
String sub = ((XObject) s).str();
int i = val.indexOf(sub);
- if (i == -1)
+ if (i == -1) {
return new XString("");
- else
+ } else {
return new XString(val.substring(i + sub.length()));
+ }
}
}
return null;
@@ -882,10 +888,11 @@
String val = ((XObject) o).str();
String sub = ((XObject) s).str();
int i = val.indexOf(sub);
- if (i == -1)
+ if (i == -1) {
return new XString("");
- else
+ } else {
return new XString(val.substring(0, i));
+ }
}
}
return null;
@@ -927,9 +934,9 @@
IndexPattern pattern = iq.getPattern();
Indexer idx =
context.getIndexManager().getBestIndexer(Indexer.STYLE_NODEVALUE, pattern);
- if (idx != null)
+ if (idx != null) {
return new NamedKeys(nk.name, nk.attribute,
QueryEngine.getUniqueKeys(idx.queryMatches(iq)));
- else if (autoIndex) {
+ } else if (autoIndex) {
// TODO: This has to *not* be hardcoded
Element e = new DocumentImpl().createElement("index");
e.setAttribute("class",
"org.apache.xindice.core.indexer.ValueIndexer");
@@ -946,14 +953,16 @@
type = "double";
break;
case XObject.CLASS_STRING :
- if (ps.indexOf('@') != -1)
+ if (ps.indexOf('@') != -1) {
type = "string";
- else
+ } else {
type = "trimmed";
+ }
break;
}
- if (type != null)
+ if (type != null) {
e.setAttribute("type", type);
+ }
idxMgr.create(new Configuration(e));
}
@@ -975,17 +984,19 @@
*/
private Object queryComparison(int op, String owner, Object left,
Object right) {
if (!((left instanceof NamedKeys)
- && (right instanceof XObject)
- || (left instanceof XObject)
- && (right instanceof NamedKeys)))
+ && (right instanceof XObject)
+ || (left instanceof XObject)
+ && (right instanceof NamedKeys))) {
return null; // How'd we get here?
+ }
op = OpMap[op - OpCodes.OP_NOTEQUALS];
if (left instanceof XObject) {
// Check if we have to switch the operation
- if (op == IndexQuery.GT || op == IndexQuery.LT || op ==
IndexQuery.GEQ || op == IndexQuery.LEQ)
+ if (op == IndexQuery.GT || op == IndexQuery.LT || op ==
IndexQuery.GEQ || op == IndexQuery.LEQ) {
op = -op;
+ }
// Swap the operands
Object tmp = left;
left = right;
@@ -996,10 +1007,11 @@
XObject obj = (XObject) right;
String ps;
- if (nk.attribute && nk.name.indexOf('@') == -1)
+ if (nk.attribute && nk.name.indexOf('@') == -1) {
ps = owner + "@" + nk.name;
- else
+ } else {
ps = nk.name;
+ }
IndexQuery iq;
IndexPattern pattern = new IndexPattern(symbols, ps, nsMap);
@@ -1102,8 +1114,9 @@
while (keyPos < keySet.length) {
DBDocument d = (DBDocument)
context.getDocument(keySet[keyPos++]);
- if (d == null)
+ if (d == null) {
continue;
+ }
Node n = d.getDocumentElement();