atom feed4 messages in net.sourceforge.lists.saxon-help[saxon] Bug relating to BuiltInAtomic...
FromSent OnAttachments
Mike RutterMay 5, 2008 4:03 pm 
Michael KayMay 5, 2008 4:18 pm 
Mike RutterMay 6, 2008 8:55
Michael KayMay 7, 2008 3:40 am 
Subject:[saxon] Bug relating to BuiltInAtomicType and SequenceType static initialization
From:Mike Rutter (
Date:May 5, 2008 4:03:33 pm

I have run into a bug relating to the static initialization of variables in net.sf.saxon.value.SequenceType that rely on net.sf.saxon.type.BuiltInAtomicType.

I have run into this issue with an application where the class loader started loading SequenceType before Configuration, which cascades down to the SequenceType variables getting initialized before BuiltInAtomicType.init() gets called.

My suggestion is to refactor BuiltInAtomicClass so that the proper initialization of SequenceType doesn't rely on the order in which the classes are loaded. This can be achieved with the following refactors:

- change init() to use a boolean flag to check whether or not it has been called instead of checking whether or not ANY_ATOMIC is null. - Initialize the static instances (ANY_ATOMIC, NUMERIC, etc.) with the appropriate fingerprints upon declaration. - change the method 'BuiltInAtomicType makeAtomicType(int, SimpleType)' to 'void initAtomicType(BuiltInAtomicType, int, SimpleType)' and have it perform it's login on the passed in atomic type instead of a newly created BuiltInAtomicType.

Thanks, Mike