Java Code Examples for com.sun.corba.se.impl.orbutil.RepositoryIdInterface#getClassFromType()

The following examples show how to use com.sun.corba.se.impl.orbutil.RepositoryIdInterface#getClassFromType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CDRInputStream_1_0.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string and expected type.  The first
 * attempt is to find the class locally, falling back
 * on the URL that came with the value.  The second
 * attempt is to use a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL,
                                 Class expectedType)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    try {
        try {
            // First try to load the class locally, then use
            // the provided URL (if it isn't null)
            return repositoryID.getClassFromType(expectedType,
                                                 codebaseURL);
        } catch (ClassNotFoundException cnfeOuter) {

            try {

                if (getCodeBase() == null) {
                    return null; // class cannot be loaded remotely.
                }

                // Get a URL from the remote CodeBase and retry
                codebaseURL = getCodeBase().implementation(repositoryIDString);

                // Don't bother trying to find it locally again if
                // we got a null URL
                if (codebaseURL == null)
                    return null;

                return repositoryID.getClassFromType(expectedType,
                                                     codebaseURL);
            } catch (ClassNotFoundException cnfeInner) {
                dprintThrowable(cnfeInner);
                // Failed to load the class
                return null;
            }
        }
    } catch (MalformedURLException mue) {
        // Always report a bad URL
        throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
            mue, repositoryIDString, codebaseURL ) ;
    }
}
 
Example 2
Source File: CDRInputStream_1_0.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string and expected type.  The first
 * attempt is to find the class locally, falling back
 * on the URL that came with the value.  The second
 * attempt is to use a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL,
                                 Class expectedType)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    try {
        try {
            // First try to load the class locally, then use
            // the provided URL (if it isn't null)
            return repositoryID.getClassFromType(expectedType,
                                                 codebaseURL);
        } catch (ClassNotFoundException cnfeOuter) {

            try {

                if (getCodeBase() == null) {
                    return null; // class cannot be loaded remotely.
                }

                // Get a URL from the remote CodeBase and retry
                codebaseURL = getCodeBase().implementation(repositoryIDString);

                // Don't bother trying to find it locally again if
                // we got a null URL
                if (codebaseURL == null)
                    return null;

                return repositoryID.getClassFromType(expectedType,
                                                     codebaseURL);
            } catch (ClassNotFoundException cnfeInner) {
                dprintThrowable(cnfeInner);
                // Failed to load the class
                return null;
            }
        }
    } catch (MalformedURLException mue) {
        // Always report a bad URL
        throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
            mue, repositoryIDString, codebaseURL ) ;
    }
}
 
Example 3
Source File: CDRInputStream_1_0.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private Class readClass() {

        String codebases = null, classRepId = null;

        if (orb == null ||
            ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
            ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {

            codebases = (String)read_value(java.lang.String.class);
            classRepId = (String)read_value(java.lang.String.class);
        } else {
            // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
            // and codebase strings in the wrong order.
            classRepId = (String)read_value(java.lang.String.class);
            codebases = (String)read_value(java.lang.String.class);
        }

        if (debug) {
            dprint("readClass codebases: "
                   + codebases
                   + " rep Id: "
                   + classRepId);
        }

        Class cl = null;

        RepositoryIdInterface repositoryID
            = repIdStrs.getFromString(classRepId);

        try {
            cl = repositoryID.getClassFromType(codebases);
        } catch(ClassNotFoundException cnfe) {
            throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
                cnfe, repositoryID.getClassName() ) ;
        } catch(MalformedURLException me) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                me, repositoryID.getClassName(), codebases ) ;
        }

        return cl;
    }
 
Example 4
Source File: CDRInputStream_1_0.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string.  At most, three attempts are made:
 * Try to find it locally, through the provided URL, and
 * finally, via a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    for (int i = 0; i < 3; i++) {

        try {

            switch (i)
            {
                case 0:
                    // First try to load the class locally
                    return repositoryID.getClassFromType();
                case 1:
                    // Try to load the class using the provided
                    // codebase URL (falls out below)
                    break;
                case 2:
                    // Try to load the class using a URL from the
                    // remote CodeBase
                    codebaseURL = getCodeBase().implementation(repositoryIDString);
                    break;
            }

            // Don't bother if the codebaseURL is null
            if (codebaseURL == null)
                continue;

            return repositoryID.getClassFromType(codebaseURL);

        } catch(ClassNotFoundException cnfe) {
            // Will ultimately return null if all three
            // attempts fail, but don't do anything here.
        } catch (MalformedURLException mue) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                mue, repositoryIDString, codebaseURL ) ;
        }
    }

    // If we get here, we have failed to load the class
    dprint("getClassFromString failed with rep id "
           + repositoryIDString
           + " and codebase "
           + codebaseURL);

    return null;
}
 
Example 5
Source File: CDRInputStream_1_0.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string and expected type.  The first
 * attempt is to find the class locally, falling back
 * on the URL that came with the value.  The second
 * attempt is to use a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL,
                                 Class expectedType)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    try {
        try {
            // First try to load the class locally, then use
            // the provided URL (if it isn't null)
            return repositoryID.getClassFromType(expectedType,
                                                 codebaseURL);
        } catch (ClassNotFoundException cnfeOuter) {

            try {

                if (getCodeBase() == null) {
                    return null; // class cannot be loaded remotely.
                }

                // Get a URL from the remote CodeBase and retry
                codebaseURL = getCodeBase().implementation(repositoryIDString);

                // Don't bother trying to find it locally again if
                // we got a null URL
                if (codebaseURL == null)
                    return null;

                return repositoryID.getClassFromType(expectedType,
                                                     codebaseURL);
            } catch (ClassNotFoundException cnfeInner) {
                dprintThrowable(cnfeInner);
                // Failed to load the class
                return null;
            }
        }
    } catch (MalformedURLException mue) {
        // Always report a bad URL
        throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
            mue, repositoryIDString, codebaseURL ) ;
    }
}
 
Example 6
Source File: CDRInputStream_1_0.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private Class readClass() {

        String codebases = null, classRepId = null;

        if (orb == null ||
            ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
            ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {

            codebases = (String)read_value(java.lang.String.class);
            classRepId = (String)read_value(java.lang.String.class);
        } else {
            // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
            // and codebase strings in the wrong order.
            classRepId = (String)read_value(java.lang.String.class);
            codebases = (String)read_value(java.lang.String.class);
        }

        if (debug) {
            dprint("readClass codebases: "
                   + codebases
                   + " rep Id: "
                   + classRepId);
        }

        Class cl = null;

        RepositoryIdInterface repositoryID
            = repIdStrs.getFromString(classRepId);

        try {
            cl = repositoryID.getClassFromType(codebases);
        } catch(ClassNotFoundException cnfe) {
            throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
                cnfe, repositoryID.getClassName() ) ;
        } catch(MalformedURLException me) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                me, repositoryID.getClassName(), codebases ) ;
        }

        return cl;
    }
 
Example 7
Source File: CDRInputStream_1_0.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private Class readClass() {

        String codebases = null, classRepId = null;

        if (orb == null ||
            ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
            ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {

            codebases = (String)read_value(java.lang.String.class);
            classRepId = (String)read_value(java.lang.String.class);
        } else {
            // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
            // and codebase strings in the wrong order.
            classRepId = (String)read_value(java.lang.String.class);
            codebases = (String)read_value(java.lang.String.class);
        }

        if (debug) {
            dprint("readClass codebases: "
                   + codebases
                   + " rep Id: "
                   + classRepId);
        }

        Class cl = null;

        RepositoryIdInterface repositoryID
            = repIdStrs.getFromString(classRepId);

        try {
            cl = repositoryID.getClassFromType(codebases);
        } catch(ClassNotFoundException cnfe) {
            throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
                cnfe, repositoryID.getClassName() ) ;
        } catch(MalformedURLException me) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                me, repositoryID.getClassName(), codebases ) ;
        }

        return cl;
    }
 
Example 8
Source File: CDRInputStream_1_0.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string and expected type.  The first
 * attempt is to find the class locally, falling back
 * on the URL that came with the value.  The second
 * attempt is to use a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL,
                                 Class expectedType)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    try {
        try {
            // First try to load the class locally, then use
            // the provided URL (if it isn't null)
            return repositoryID.getClassFromType(expectedType,
                                                 codebaseURL);
        } catch (ClassNotFoundException cnfeOuter) {

            try {

                if (getCodeBase() == null) {
                    return null; // class cannot be loaded remotely.
                }

                // Get a URL from the remote CodeBase and retry
                codebaseURL = getCodeBase().implementation(repositoryIDString);

                // Don't bother trying to find it locally again if
                // we got a null URL
                if (codebaseURL == null)
                    return null;

                return repositoryID.getClassFromType(expectedType,
                                                     codebaseURL);
            } catch (ClassNotFoundException cnfeInner) {
                dprintThrowable(cnfeInner);
                // Failed to load the class
                return null;
            }
        }
    } catch (MalformedURLException mue) {
        // Always report a bad URL
        throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
            mue, repositoryIDString, codebaseURL ) ;
    }
}
 
Example 9
Source File: CDRInputStream_1_0.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private Class readClass() {

        String codebases = null, classRepId = null;

        if (orb == null ||
            ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
            ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {

            codebases = (String)read_value(java.lang.String.class);
            classRepId = (String)read_value(java.lang.String.class);
        } else {
            // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
            // and codebase strings in the wrong order.
            classRepId = (String)read_value(java.lang.String.class);
            codebases = (String)read_value(java.lang.String.class);
        }

        if (debug) {
            dprint("readClass codebases: "
                   + codebases
                   + " rep Id: "
                   + classRepId);
        }

        Class cl = null;

        RepositoryIdInterface repositoryID
            = repIdStrs.getFromString(classRepId);

        try {
            cl = repositoryID.getClassFromType(codebases);
        } catch(ClassNotFoundException cnfe) {
            throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
                cnfe, repositoryID.getClassName() ) ;
        } catch(MalformedURLException me) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                me, repositoryID.getClassName(), codebases ) ;
        }

        return cl;
    }
 
Example 10
Source File: CDRInputStream_1_0.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string.  At most, three attempts are made:
 * Try to find it locally, through the provided URL, and
 * finally, via a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    for (int i = 0; i < 3; i++) {

        try {

            switch (i)
            {
                case 0:
                    // First try to load the class locally
                    return repositoryID.getClassFromType();
                case 1:
                    // Try to load the class using the provided
                    // codebase URL (falls out below)
                    break;
                case 2:
                    // Try to load the class using a URL from the
                    // remote CodeBase
                    codebaseURL = getCodeBase().implementation(repositoryIDString);
                    break;
            }

            // Don't bother if the codebaseURL is null
            if (codebaseURL == null)
                continue;

            return repositoryID.getClassFromType(codebaseURL);

        } catch(ClassNotFoundException cnfe) {
            // Will ultimately return null if all three
            // attempts fail, but don't do anything here.
        } catch (MalformedURLException mue) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                mue, repositoryIDString, codebaseURL ) ;
        }
    }

    // If we get here, we have failed to load the class
    dprint("getClassFromString failed with rep id "
           + repositoryIDString
           + " and codebase "
           + codebaseURL);

    return null;
}
 
Example 11
Source File: CDRInputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private Class readClass() {

        String codebases = null, classRepId = null;

        if (orb == null ||
            ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
            ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {

            codebases = (String)read_value(java.lang.String.class);
            classRepId = (String)read_value(java.lang.String.class);
        } else {
            // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
            // and codebase strings in the wrong order.
            classRepId = (String)read_value(java.lang.String.class);
            codebases = (String)read_value(java.lang.String.class);
        }

        if (debug) {
            dprint("readClass codebases: "
                   + codebases
                   + " rep Id: "
                   + classRepId);
        }

        Class cl = null;

        RepositoryIdInterface repositoryID
            = repIdStrs.getFromString(classRepId);

        try {
            cl = repositoryID.getClassFromType(codebases);
        } catch(ClassNotFoundException cnfe) {
            throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
                cnfe, repositoryID.getClassName() ) ;
        } catch(MalformedURLException me) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                me, repositoryID.getClassName(), codebases ) ;
        }

        return cl;
    }
 
Example 12
Source File: CDRInputStream_1_0.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string and expected type.  The first
 * attempt is to find the class locally, falling back
 * on the URL that came with the value.  The second
 * attempt is to use a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL,
                                 Class expectedType)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    try {
        try {
            // First try to load the class locally, then use
            // the provided URL (if it isn't null)
            return repositoryID.getClassFromType(expectedType,
                                                 codebaseURL);
        } catch (ClassNotFoundException cnfeOuter) {

            try {

                if (getCodeBase() == null) {
                    return null; // class cannot be loaded remotely.
                }

                // Get a URL from the remote CodeBase and retry
                codebaseURL = getCodeBase().implementation(repositoryIDString);

                // Don't bother trying to find it locally again if
                // we got a null URL
                if (codebaseURL == null)
                    return null;

                return repositoryID.getClassFromType(expectedType,
                                                     codebaseURL);
            } catch (ClassNotFoundException cnfeInner) {
                dprintThrowable(cnfeInner);
                // Failed to load the class
                return null;
            }
        }
    } catch (MalformedURLException mue) {
        // Always report a bad URL
        throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
            mue, repositoryIDString, codebaseURL ) ;
    }
}
 
Example 13
Source File: CDRInputStream_1_0.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string.  At most, three attempts are made:
 * Try to find it locally, through the provided URL, and
 * finally, via a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    for (int i = 0; i < 3; i++) {

        try {

            switch (i)
            {
                case 0:
                    // First try to load the class locally
                    return repositoryID.getClassFromType();
                case 1:
                    // Try to load the class using the provided
                    // codebase URL (falls out below)
                    break;
                case 2:
                    // Try to load the class using a URL from the
                    // remote CodeBase
                    codebaseURL = getCodeBase().implementation(repositoryIDString);
                    break;
            }

            // Don't bother if the codebaseURL is null
            if (codebaseURL == null)
                continue;

            return repositoryID.getClassFromType(codebaseURL);

        } catch(ClassNotFoundException cnfe) {
            // Will ultimately return null if all three
            // attempts fail, but don't do anything here.
        } catch (MalformedURLException mue) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                mue, repositoryIDString, codebaseURL ) ;
        }
    }

    // If we get here, we have failed to load the class
    dprint("getClassFromString failed with rep id "
           + repositoryIDString
           + " and codebase "
           + codebaseURL);

    return null;
}
 
Example 14
Source File: CDRInputStream_1_0.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string and expected type.  The first
 * attempt is to find the class locally, falling back
 * on the URL that came with the value.  The second
 * attempt is to use a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL,
                                 Class expectedType)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    try {
        try {
            // First try to load the class locally, then use
            // the provided URL (if it isn't null)
            return repositoryID.getClassFromType(expectedType,
                                                 codebaseURL);
        } catch (ClassNotFoundException cnfeOuter) {

            try {

                if (getCodeBase() == null) {
                    return null; // class cannot be loaded remotely.
                }

                // Get a URL from the remote CodeBase and retry
                codebaseURL = getCodeBase().implementation(repositoryIDString);

                // Don't bother trying to find it locally again if
                // we got a null URL
                if (codebaseURL == null)
                    return null;

                return repositoryID.getClassFromType(expectedType,
                                                     codebaseURL);
            } catch (ClassNotFoundException cnfeInner) {
                dprintThrowable(cnfeInner);
                // Failed to load the class
                return null;
            }
        }
    } catch (MalformedURLException mue) {
        // Always report a bad URL
        throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
            mue, repositoryIDString, codebaseURL ) ;
    }
}
 
Example 15
Source File: CDRInputStream_1_0.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private Class readClass() {

        String codebases = null, classRepId = null;

        if (orb == null ||
            ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
            ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {

            codebases = (String)read_value(java.lang.String.class);
            classRepId = (String)read_value(java.lang.String.class);
        } else {
            // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
            // and codebase strings in the wrong order.
            classRepId = (String)read_value(java.lang.String.class);
            codebases = (String)read_value(java.lang.String.class);
        }

        if (debug) {
            dprint("readClass codebases: "
                   + codebases
                   + " rep Id: "
                   + classRepId);
        }

        Class cl = null;

        RepositoryIdInterface repositoryID
            = repIdStrs.getFromString(classRepId);

        try {
            cl = repositoryID.getClassFromType(codebases);
        } catch(ClassNotFoundException cnfe) {
            throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
                cnfe, repositoryID.getClassName() ) ;
        } catch(MalformedURLException me) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                me, repositoryID.getClassName(), codebases ) ;
        }

        return cl;
    }
 
Example 16
Source File: CDRInputStream_1_0.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string.  At most, three attempts are made:
 * Try to find it locally, through the provided URL, and
 * finally, via a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    for (int i = 0; i < 3; i++) {

        try {

            switch (i)
            {
                case 0:
                    // First try to load the class locally
                    return repositoryID.getClassFromType();
                case 1:
                    // Try to load the class using the provided
                    // codebase URL (falls out below)
                    break;
                case 2:
                    // Try to load the class using a URL from the
                    // remote CodeBase
                    codebaseURL = getCodeBase().implementation(repositoryIDString);
                    break;
            }

            // Don't bother if the codebaseURL is null
            if (codebaseURL == null)
                continue;

            return repositoryID.getClassFromType(codebaseURL);

        } catch(ClassNotFoundException cnfe) {
            // Will ultimately return null if all three
            // attempts fail, but don't do anything here.
        } catch (MalformedURLException mue) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                mue, repositoryIDString, codebaseURL ) ;
        }
    }

    // If we get here, we have failed to load the class
    dprint("getClassFromString failed with rep id "
           + repositoryIDString
           + " and codebase "
           + codebaseURL);

    return null;
}
 
Example 17
Source File: CDRInputStream_1_0.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string and expected type.  The first
 * attempt is to find the class locally, falling back
 * on the URL that came with the value.  The second
 * attempt is to use a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL,
                                 Class expectedType)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    try {
        try {
            // First try to load the class locally, then use
            // the provided URL (if it isn't null)
            return repositoryID.getClassFromType(expectedType,
                                                 codebaseURL);
        } catch (ClassNotFoundException cnfeOuter) {

            try {

                if (getCodeBase() == null) {
                    return null; // class cannot be loaded remotely.
                }

                // Get a URL from the remote CodeBase and retry
                codebaseURL = getCodeBase().implementation(repositoryIDString);

                // Don't bother trying to find it locally again if
                // we got a null URL
                if (codebaseURL == null)
                    return null;

                return repositoryID.getClassFromType(expectedType,
                                                     codebaseURL);
            } catch (ClassNotFoundException cnfeInner) {
                dprintThrowable(cnfeInner);
                // Failed to load the class
                return null;
            }
        }
    } catch (MalformedURLException mue) {
        // Always report a bad URL
        throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
            mue, repositoryIDString, codebaseURL ) ;
    }
}
 
Example 18
Source File: CDRInputStream_1_0.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private Class readClass() {

        String codebases = null, classRepId = null;

        if (orb == null ||
            ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
            ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {

            codebases = (String)read_value(java.lang.String.class);
            classRepId = (String)read_value(java.lang.String.class);
        } else {
            // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
            // and codebase strings in the wrong order.
            classRepId = (String)read_value(java.lang.String.class);
            codebases = (String)read_value(java.lang.String.class);
        }

        if (debug) {
            dprint("readClass codebases: "
                   + codebases
                   + " rep Id: "
                   + classRepId);
        }

        Class cl = null;

        RepositoryIdInterface repositoryID
            = repIdStrs.getFromString(classRepId);

        try {
            cl = repositoryID.getClassFromType(codebases);
        } catch(ClassNotFoundException cnfe) {
            throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
                cnfe, repositoryID.getClassName() ) ;
        } catch(MalformedURLException me) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                me, repositoryID.getClassName(), codebases ) ;
        }

        return cl;
    }
 
Example 19
Source File: CDRInputStream_1_0.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private Class readClass() {

        String codebases = null, classRepId = null;

        if (orb == null ||
            ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
            ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {

            codebases = (String)read_value(java.lang.String.class);
            classRepId = (String)read_value(java.lang.String.class);
        } else {
            // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
            // and codebase strings in the wrong order.
            classRepId = (String)read_value(java.lang.String.class);
            codebases = (String)read_value(java.lang.String.class);
        }

        if (debug) {
            dprint("readClass codebases: "
                   + codebases
                   + " rep Id: "
                   + classRepId);
        }

        Class cl = null;

        RepositoryIdInterface repositoryID
            = repIdStrs.getFromString(classRepId);

        try {
            cl = repositoryID.getClassFromType(codebases);
        } catch(ClassNotFoundException cnfe) {
            throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
                cnfe, repositoryID.getClassName() ) ;
        } catch(MalformedURLException me) {
            throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
                me, repositoryID.getClassName(), codebases ) ;
        }

        return cl;
    }
 
Example 20
Source File: CDRInputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Attempts to find the class described by the given
 * repository ID string and expected type.  The first
 * attempt is to find the class locally, falling back
 * on the URL that came with the value.  The second
 * attempt is to use a URL from the remote CodeBase.
 */
private Class getClassFromString(String repositoryIDString,
                                 String codebaseURL,
                                 Class expectedType)
{
    RepositoryIdInterface repositoryID
        = repIdStrs.getFromString(repositoryIDString);

    try {
        try {
            // First try to load the class locally, then use
            // the provided URL (if it isn't null)
            return repositoryID.getClassFromType(expectedType,
                                                 codebaseURL);
        } catch (ClassNotFoundException cnfeOuter) {

            try {

                if (getCodeBase() == null) {
                    return null; // class cannot be loaded remotely.
                }

                // Get a URL from the remote CodeBase and retry
                codebaseURL = getCodeBase().implementation(repositoryIDString);

                // Don't bother trying to find it locally again if
                // we got a null URL
                if (codebaseURL == null)
                    return null;

                return repositoryID.getClassFromType(expectedType,
                                                     codebaseURL);
            } catch (ClassNotFoundException cnfeInner) {
                dprintThrowable(cnfeInner);
                // Failed to load the class
                return null;
            }
        }
    } catch (MalformedURLException mue) {
        // Always report a bad URL
        throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
            mue, repositoryIDString, codebaseURL ) ;
    }
}