DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36921>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36921

           Summary: (Websphere/Solaris) referecing
                    org.apache.xpath.compiler.FunctionTable.m_functions
                    throws java.lang.IllegalAccessError
           Product: Security
           Version: Java 1.2
          Platform: Other
        OS/Version: Solaris
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: Signature
        AssignedTo: security-dev@xml.apache.org
        ReportedBy: [EMAIL PROTECTED]


Hi,
(1) We use Websphere 5.1.1.3 on Solaris platform. The JVM implementation of 
the FunctionTable class does not have the field m_functions, and we got this 
stacktrace:

java.lang.IllegalAccessError: tried to access field 
org.apache.xpath.compiler.FunctionTable.m_functions from class 
org.apache.xml.security.Init
        at org.apache.xml.security.Init.init(Unknown Source)
        at 
ariba.util.xmlsignature.implementation.XMLSignatureFactorySpiImpl.<cl

init>(XMLSignatureFactorySpiImpl.java:167)
...


(2) There has been a problem prior to Java 1.2 because older xmlsec.jar 
version assumes m_functions to be public which is not true for some JVM 
implementations. This is fixed in Java 1.2 (and also 1.2.1) by using 
reflection, but the assumption that FunctionTable class contains the 
m_functions instance variable still applies. When the JVM implementation 
(Websphere/Solaris in this case) removes that instance variable from 
FunctionTable, the fix in Java 1.2 and 1.2.1 does not work.

Here's the code of question in org.apache.xml.security.Init:

            /* The following tweak by "Eric Olson" <[EMAIL PROTECTED]>
             * is to enable xml-security to play with JDK 1.4 which
             * unfortunately bundles an old version of Xalan
             */
            FuncLoader funcHereLoader = new FuncHereLoader();

            try {
                java.lang.reflect.Field mFunctions = 
FunctionTable.class.getField("m_functions");
                FuncLoader[] m_functions = (FuncLoader[]) mFunctions.get(null);

                for (int i = 0; i < m_functions.length; i++) {
                    FuncLoader loader = m_functions[i];

                    if (loader != null) {
                    if (log.isDebugEnabled())
                        log.debug("Func " + i + " " + loader.getName());

                        if (loader.getName().equals(funcHereLoader.getName())) 
{
                            m_functions[i] = funcHereLoader;
                        }
                    }
                }
            } catch (java.lang.NoSuchFieldException e) {
                log.info("Unable to patch xalan function table.", e);
        } catch (Exception e) {
            log.info("Unable to patch xalan function table.", e);
        } 

>From the comments, it seems that the code is added to work around some old 
Xalan libraries when used with JDK 1.4. It appears that an earlier call to 
FunctionTable.installFunction (not shown here) would work for newer versions 
of Xalan. So my questions are:
(a) Is the above code to modify m_functions still needed?
(b) If needed, would it be possible to configure the xmlsec library so that we 
do the reflection conditionally?

(3) Here's the javap invoked on the JVM that has the problem. You can see that 
m_functions is absent.

(a) java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (IBM build 1.4.2_04-b05 
20040627)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
IBM Java ORB build orb1420-20040626
XML build XSLT4J Java 2.6.1
XML build XmlCommonsExternal 1.2.02
XML build XML4J 4.3.1

(b) javap org.apache.xpath.compiler.FunctionTable
Compiled from "FunctionTable.java"
public class org.apache.xpath.compiler.FunctionTable extends java.lang.Object{
    public static final int FUNC_CURRENT;
    public static final int FUNC_LAST;
    public static final int FUNC_POSITION;
    public static final int FUNC_COUNT;
    public static final int FUNC_ID;
    public static final int FUNC_KEY;
    public static final int FUNC_LOCAL_PART;
    public static final int FUNC_NAMESPACE;
    public static final int FUNC_QNAME;
    public static final int FUNC_GENERATE_ID;
    public static final int FUNC_NOT;
    public static final int FUNC_TRUE;
    public static final int FUNC_FALSE;
    public static final int FUNC_BOOLEAN;
    public static final int FUNC_NUMBER;
    public static final int FUNC_FLOOR;
    public static final int FUNC_CEILING;
    public static final int FUNC_ROUND;
    public static final int FUNC_SUM;
    public static final int FUNC_STRING;
    public static final int FUNC_STARTS_WITH;
    public static final int FUNC_CONTAINS;
    public static final int FUNC_SUBSTRING_BEFORE;
    public static final int FUNC_SUBSTRING_AFTER;
    public static final int FUNC_NORMALIZE_SPACE;
    public static final int FUNC_TRANSLATE;
    public static final int FUNC_CONCAT;
    public static final int FUNC_SUBSTRING;
    public static final int FUNC_STRING_LENGTH;
    public static final int FUNC_SYSTEM_PROPERTY;
    public static final int FUNC_LANG;
    public static final int FUNC_EXT_FUNCTION_AVAILABLE;
    public static final int FUNC_EXT_ELEM_AVAILABLE;
    public static final int FUNC_UNPARSED_ENTITY_URI;
    public static final int FUNC_DOCLOCATION;
    static int m_funcNextFreeIndex;
    public org.apache.xpath.compiler.FunctionTable();
    static java.lang.String getFunctionName(int);
    public static org.apache.xpath.functions.Function getFunction(int);
       throws javax/xml/transform/TransformerException
    public static int installFunction
(java.lang.String,org.apache.xpath.Expression);
    public static void installFunction(org.apache.xpath.Expression,int);
    static {};
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to