You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2002/04/10 18:45:52 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs XSDeclarationPool.java
elena 02/04/10 09:45:52
Modified: java/src/org/apache/xerces/impl/xs XSDeclarationPool.java
Log:
Use an array length to determine if resizing is necessary.
Revision Changes Path
1.4 +20 -31 xml-xerces/java/src/org/apache/xerces/impl/xs/XSDeclarationPool.java
Index: XSDeclarationPool.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XSDeclarationPool.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSDeclarationPool.java 3 Apr 2002 23:48:26 -0000 1.3
+++ XSDeclarationPool.java 10 Apr 2002 16:45:52 -0000 1.4
@@ -67,7 +67,7 @@
* Note: The cashing mechanism is not implemented yet.
*
* @author Elena Litani, IBM
- * @version $Id: XSDeclarationPool.java,v 1.3 2002/04/03 23:48:26 elena Exp $
+ * @version $Id: XSDeclarationPool.java,v 1.4 2002/04/10 16:45:52 elena Exp $
*/
public final class XSDeclarationPool {
/** Chunk shift (8). */
@@ -195,12 +195,10 @@
// in the pool.
private boolean ensureElementDeclCapacity(int chunk) {
- try {
- return fElementDecl[chunk][0] == null;
- } catch (ArrayIndexOutOfBoundsException ex) {
+ if (chunk >= fElementDecl.length) {
fElementDecl = resize(fElementDecl, fElementDecl.length * 2);
- } catch (NullPointerException ex) {
- // ignore
+ } else if (fElementDecl[chunk] != null) {
+ return false;
}
fElementDecl[chunk] = new XSElementDecl[CHUNK_SIZE];
@@ -214,12 +212,10 @@
}
private boolean ensureParticleDeclCapacity(int chunk) {
- try {
- return fParticleDecl[chunk][0] == null;
- } catch (ArrayIndexOutOfBoundsException ex) {
+ if (chunk >= fParticleDecl.length) {
fParticleDecl = resize(fParticleDecl, fParticleDecl.length * 2);
- } catch (NullPointerException ex) {
- // ignore
+ } else if (fParticleDecl[chunk] != null) {
+ return false;
}
fParticleDecl[chunk] = new XSParticleDecl[CHUNK_SIZE];
@@ -234,12 +230,10 @@
private boolean ensureAttrDeclCapacity(int chunk) {
- try {
- return fAttrDecl[chunk][0] == null;
- } catch (ArrayIndexOutOfBoundsException ex) {
+ if (chunk >= fAttrDecl.length) {
fAttrDecl = resize(fAttrDecl, fAttrDecl.length * 2);
- } catch (NullPointerException ex) {
- // ignore
+ } else if (fAttrDecl[chunk] != null) {
+ return false;
}
fAttrDecl[chunk] = new XSAttributeDecl[CHUNK_SIZE];
@@ -253,12 +247,10 @@
}
private boolean ensureAttributeUseCapacity(int chunk) {
- try {
- return fAttributeUse[chunk][0] == null;
- } catch (ArrayIndexOutOfBoundsException ex) {
+ if (chunk >= fAttributeUse.length) {
fAttributeUse = resize(fAttributeUse, fAttributeUse.length * 2);
- } catch (NullPointerException ex) {
- // ignore
+ } else if (fAttributeUse[chunk] != null) {
+ return false;
}
fAttributeUse[chunk] = new XSAttributeUse[CHUNK_SIZE];
@@ -272,12 +264,10 @@
}
private boolean ensureSTDeclCapacity(int chunk) {
- try {
- return fSTDecl[chunk][0] == null;
- } catch (ArrayIndexOutOfBoundsException ex) {
+ if (chunk >= fSTDecl.length) {
fSTDecl = resize(fSTDecl, fSTDecl.length * 2);
- } catch (NullPointerException ex) {
- // ignore
+ } else if (fSTDecl[chunk] != null) {
+ return false;
}
fSTDecl[chunk] = new XSSimpleTypeDecl[CHUNK_SIZE];
@@ -291,12 +281,11 @@
}
private boolean ensureCTDeclCapacity(int chunk) {
- try {
- return fCTDecl[chunk][0] == null;
- } catch (ArrayIndexOutOfBoundsException ex) {
+
+ if (chunk >= fCTDecl.length) {
fCTDecl = resize(fCTDecl, fCTDecl.length * 2);
- } catch (NullPointerException ex) {
- // ignore
+ } else if (fCTDecl[chunk] != null){
+ return false;
}
fCTDecl[chunk] = new XSComplexTypeDecl[CHUNK_SIZE];
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org