if (schemaType == XMLGrammarDescription.XML_SCHEMA) {
++freeSchemaValidatorIndex;
if (schemaValidators.length == freeSchemaValidatorIndex) {
// resize size of the validators
schemaValidatorsCurrentSize += SIZE;
SoftReference newarray[] = new SoftReference[schemaValidatorsCurrentSize];
System.arraycopy(schemaValidators, 0, newarray, 0, schemaValidators.length);
schemaValidators = newarray;
}
SoftReference ref = schemaValidators[freeSchemaValidatorIndex];
if (ref != null) {
RevalidationHandlerHolder holder = (RevalidationHandlerHolder) ref.get();
if (holder != null) {
holder.handler = validator;
return;
}
}
schemaValidators[freeSchemaValidatorIndex] = new SoftReference(new RevalidationHandlerHolder(validator));
}
else if (schemaType == XMLGrammarDescription.XML_DTD) {
// release an instance of XML11DTDValidator
if ("1.1".equals(xmlVersion)) {
++freeXML11DTDValidatorIndex;
if (xml11DTDValidators.length == freeXML11DTDValidatorIndex) {
// resize size of the validators
xml11DTDValidatorsCurrentSize += SIZE;
SoftReference [] newarray = new SoftReference[xml11DTDValidatorsCurrentSize];
System.arraycopy(xml11DTDValidators, 0, newarray, 0, xml11DTDValidators.length);
xml11DTDValidators = newarray;
}
SoftReference ref = xml11DTDValidators[freeXML11DTDValidatorIndex];
if (ref != null) {
RevalidationHandlerHolder holder = (RevalidationHandlerHolder) ref.get();
if (holder != null) {
holder.handler = validator;
return;
}
}
xml11DTDValidators[freeXML11DTDValidatorIndex] = new SoftReference(new RevalidationHandlerHolder(validator));
}
// release an instance of XMLDTDValidator
else {
++freeXML10DTDValidatorIndex;
if (xml10DTDValidators.length == freeXML10DTDValidatorIndex) {
// resize size of the validators
xml10DTDValidatorsCurrentSize += SIZE;
SoftReference [] newarray = new SoftReference[xml10DTDValidatorsCurrentSize];
System.arraycopy(xml10DTDValidators, 0, newarray, 0, xml10DTDValidators.length);
xml10DTDValidators = newarray;
}
SoftReference ref = xml10DTDValidators[freeXML10DTDValidatorIndex];
if (ref != null) {
RevalidationHandlerHolder holder = (RevalidationHandlerHolder) ref.get();
if (holder != null) {
holder.handler = validator;
return;
}
}
xml10DTDValidators[freeXML10DTDValidatorIndex] = new SoftReference(new RevalidationHandlerHolder(validator));
}
}
}