com.sun.corba.se.spi.orb.ORBVersion Java Examples

The following examples show how to use com.sun.corba.se.spi.orb.ORBVersion. 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: InputStreamHook.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
 
Example #2
Source File: InputStreamHook.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
 
Example #3
Source File: InputStreamHook.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
 
Example #4
Source File: ORBVersionImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean equals( Object obj )
{
    if (!(obj instanceof ORBVersion))
        return false ;

    ORBVersion version = (ORBVersion)obj ;
    return version.getORBType() == orbType ;
}
 
Example #5
Source File: GIOPVersion.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This chooses the appropriate GIOP version.
 *
 * @return the GIOP version 13.00 if Java serialization is enabled, or
 *         smallest(profGIOPVersion, orbGIOPVersion)
 */
public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {

    GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
    IIOPProfile prof = ior.getProfile() ;
    GIOPVersion profVersion = prof.getGIOPVersion();

    // Check if the profile is from a legacy Sun ORB.

    ORBVersion targetOrbVersion = prof.getORBVersion();
    if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) &&
            targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) {
        // we are dealing with a SUN legacy orb which emits 1.1 IORs,
        // in spite of being able to handle only GIOP 1.0 messages.
        return V1_0;
    }

    // Now the target has to be (FOREIGN | NEWER*)

    byte prof_major = profVersion.getMajor();
    byte prof_minor = profVersion.getMinor();

    byte orb_major = orbVersion.getMajor();
    byte orb_minor = orbVersion.getMinor();

    if (orb_major < prof_major) {
        return orbVersion;
    } else if (orb_major > prof_major) {
        return profVersion;
    } else { // both major version are the same
        if (orb_minor <= prof_minor) {
            return orbVersion;
        } else {
            return profVersion;
        }
    }
}
 
Example #6
Source File: ORBVersionImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public int compareTo(Object obj) {
    // The Comparable interface says that this
    // method throws a ClassCastException if the
    // given object's type prevents it from being
    // compared.
    return getORBType() - ((ORBVersion)obj).getORBType();
}
 
Example #7
Source File: ORBImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void setORBVersion(ORBVersion verObj)
{
    synchronized (this) {
            checkShutdownState();
    }
    orbVersionThreadLocal.set(verObj);
}
 
Example #8
Source File: ORBVersionImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public int compareTo(Object obj) {
    // The Comparable interface says that this
    // method throws a ClassCastException if the
    // given object's type prevents it from being
    // compared.
    return getORBType() - ((ORBVersion)obj).getORBType();
}
 
Example #9
Source File: GIOPVersion.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This chooses the appropriate GIOP version.
 *
 * @return the GIOP version 13.00 if Java serialization is enabled, or
 *         smallest(profGIOPVersion, orbGIOPVersion)
 */
public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {

    GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
    IIOPProfile prof = ior.getProfile() ;
    GIOPVersion profVersion = prof.getGIOPVersion();

    // Check if the profile is from a legacy Sun ORB.

    ORBVersion targetOrbVersion = prof.getORBVersion();
    if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) &&
            targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) {
        // we are dealing with a SUN legacy orb which emits 1.1 IORs,
        // in spite of being able to handle only GIOP 1.0 messages.
        return V1_0;
    }

    // Now the target has to be (FOREIGN | NEWER*)

    byte prof_major = profVersion.getMajor();
    byte prof_minor = profVersion.getMinor();

    byte orb_major = orbVersion.getMajor();
    byte orb_minor = orbVersion.getMinor();

    if (orb_major < prof_major) {
        return orbVersion;
    } else if (orb_major > prof_major) {
        return profVersion;
    } else { // both major version are the same
        if (orb_minor <= prof_minor) {
            return orbVersion;
        } else {
            return profVersion;
        }
    }
}
 
Example #10
Source File: ORBVersionFactory.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private static ORBVersion byteToVersion( byte value )
{
    /* Throwing an exception here would cause this version to be
    * incompatible with future versions of the ORB, to the point
    * that this version could
    * not even unmarshal objrefs from a newer version that uses
    * extended versioning.  Therefore, we will simply treat all
    * unknown versions as the latest version.
    if (value < 0)
        throw new INTERNAL() ;
    */

    /**
     * Update: If we treat all unknown versions as the latest version
     * then when we send an IOR with a PEORB version to an ORB that
     * doesn't know the PEORB version it will treat it as whatever
     * its idea of the latest version is.  Then, if that IOR is
     * sent back to the server and compared with the original
     * the equality check will fail because the versions will be
     * different.
     *
     * Instead, just capture the version bytes.
     */

    switch (value) {
        case ORBVersion.FOREIGN : return ORBVersionImpl.FOREIGN ;
        case ORBVersion.OLD : return ORBVersionImpl.OLD ;
        case ORBVersion.NEW : return ORBVersionImpl.NEW ;
        case ORBVersion.JDK1_3_1_01: return ORBVersionImpl.JDK1_3_1_01 ;
        case ORBVersion.NEWER : return ORBVersionImpl.NEWER ;
        case ORBVersion.PEORB : return ORBVersionImpl.PEORB ;
        default : return new ORBVersionImpl(value);
    }
}
 
Example #11
Source File: GIOPVersion.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This chooses the appropriate GIOP version.
 *
 * @return the GIOP version 13.00 if Java serialization is enabled, or
 *         smallest(profGIOPVersion, orbGIOPVersion)
 */
public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {

    GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
    IIOPProfile prof = ior.getProfile() ;
    GIOPVersion profVersion = prof.getGIOPVersion();

    // Check if the profile is from a legacy Sun ORB.

    ORBVersion targetOrbVersion = prof.getORBVersion();
    if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) &&
            targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) {
        // we are dealing with a SUN legacy orb which emits 1.1 IORs,
        // in spite of being able to handle only GIOP 1.0 messages.
        return V1_0;
    }

    // Now the target has to be (FOREIGN | NEWER*)

    byte prof_major = profVersion.getMajor();
    byte prof_minor = profVersion.getMinor();

    byte orb_major = orbVersion.getMajor();
    byte orb_minor = orbVersion.getMinor();

    if (orb_major < prof_major) {
        return orbVersion;
    } else if (orb_major > prof_major) {
        return profVersion;
    } else { // both major version are the same
        if (orb_minor <= prof_minor) {
            return orbVersion;
        } else {
            return profVersion;
        }
    }
}
 
Example #12
Source File: ORBVersionImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public boolean equals( Object obj )
{
    if (!(obj instanceof ORBVersion))
        return false ;

    ORBVersion version = (ORBVersion)obj ;
    return version.getORBType() == orbType ;
}
 
Example #13
Source File: ORBImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ORBVersion getORBVersion()
{
    synchronized (this) {
            checkShutdownState();
    }
    return (ORBVersion)(orbVersionThreadLocal.get()) ;
}
 
Example #14
Source File: OldPOAObjectKeyTemplate.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public ORBVersion getORBVersion()
{
    if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
        return ORBVersionFactory.getOLD() ;
    else if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
        return ORBVersionFactory.getNEW() ;
    else
        throw new INTERNAL() ;
}
 
Example #15
Source File: GIOPVersion.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This chooses the appropriate GIOP version.
 *
 * @return the GIOP version 13.00 if Java serialization is enabled, or
 *         smallest(profGIOPVersion, orbGIOPVersion)
 */
public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {

    GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
    IIOPProfile prof = ior.getProfile() ;
    GIOPVersion profVersion = prof.getGIOPVersion();

    // Check if the profile is from a legacy Sun ORB.

    ORBVersion targetOrbVersion = prof.getORBVersion();
    if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) &&
            targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) {
        // we are dealing with a SUN legacy orb which emits 1.1 IORs,
        // in spite of being able to handle only GIOP 1.0 messages.
        return V1_0;
    }

    // Now the target has to be (FOREIGN | NEWER*)

    byte prof_major = profVersion.getMajor();
    byte prof_minor = profVersion.getMinor();

    byte orb_major = orbVersion.getMajor();
    byte orb_minor = orbVersion.getMinor();

    if (orb_major < prof_major) {
        return orbVersion;
    } else if (orb_major > prof_major) {
        return profVersion;
    } else { // both major version are the same
        if (orb_minor <= prof_minor) {
            return orbVersion;
        } else {
            return profVersion;
        }
    }
}
 
Example #16
Source File: ORBVersionFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static ORBVersion byteToVersion( byte value )
{
    /* Throwing an exception here would cause this version to be
    * incompatible with future versions of the ORB, to the point
    * that this version could
    * not even unmarshal objrefs from a newer version that uses
    * extended versioning.  Therefore, we will simply treat all
    * unknown versions as the latest version.
    if (value < 0)
        throw new INTERNAL() ;
    */

    /**
     * Update: If we treat all unknown versions as the latest version
     * then when we send an IOR with a PEORB version to an ORB that
     * doesn't know the PEORB version it will treat it as whatever
     * its idea of the latest version is.  Then, if that IOR is
     * sent back to the server and compared with the original
     * the equality check will fail because the versions will be
     * different.
     *
     * Instead, just capture the version bytes.
     */

    switch (value) {
        case ORBVersion.FOREIGN : return ORBVersionImpl.FOREIGN ;
        case ORBVersion.OLD : return ORBVersionImpl.OLD ;
        case ORBVersion.NEW : return ORBVersionImpl.NEW ;
        case ORBVersion.JDK1_3_1_01: return ORBVersionImpl.JDK1_3_1_01 ;
        case ORBVersion.NEWER : return ORBVersionImpl.NEWER ;
        case ORBVersion.PEORB : return ORBVersionImpl.PEORB ;
        default : return new ORBVersionImpl(value);
    }
}
 
Example #17
Source File: ORBVersionFactory.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static ORBVersion byteToVersion( byte value )
{
    /* Throwing an exception here would cause this version to be
    * incompatible with future versions of the ORB, to the point
    * that this version could
    * not even unmarshal objrefs from a newer version that uses
    * extended versioning.  Therefore, we will simply treat all
    * unknown versions as the latest version.
    if (value < 0)
        throw new INTERNAL() ;
    */

    /**
     * Update: If we treat all unknown versions as the latest version
     * then when we send an IOR with a PEORB version to an ORB that
     * doesn't know the PEORB version it will treat it as whatever
     * its idea of the latest version is.  Then, if that IOR is
     * sent back to the server and compared with the original
     * the equality check will fail because the versions will be
     * different.
     *
     * Instead, just capture the version bytes.
     */

    switch (value) {
        case ORBVersion.FOREIGN : return ORBVersionImpl.FOREIGN ;
        case ORBVersion.OLD : return ORBVersionImpl.OLD ;
        case ORBVersion.NEW : return ORBVersionImpl.NEW ;
        case ORBVersion.JDK1_3_1_01: return ORBVersionImpl.JDK1_3_1_01 ;
        case ORBVersion.NEWER : return ORBVersionImpl.NEWER ;
        case ORBVersion.PEORB : return ORBVersionImpl.PEORB ;
        default : return new ORBVersionImpl(value);
    }
}
 
Example #18
Source File: ORBVersionImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public int compareTo(Object obj) {
    // The Comparable interface says that this
    // method throws a ClassCastException if the
    // given object's type prevents it from being
    // compared.
    return getORBType() - ((ORBVersion)obj).getORBType();
}
 
Example #19
Source File: ORBImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void setORBVersion(ORBVersion verObj)
{
    synchronized (this) {
            checkShutdownState();
    }
    orbVersionThreadLocal.set(verObj);
}
 
Example #20
Source File: ORBImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void setORBVersion(ORBVersion verObj)
{
    synchronized (this) {
            checkShutdownState();
    }
    orbVersionThreadLocal.set(verObj);
}
 
Example #21
Source File: ORBVersionFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static ORBVersion byteToVersion( byte value )
{
    /* Throwing an exception here would cause this version to be
    * incompatible with future versions of the ORB, to the point
    * that this version could
    * not even unmarshal objrefs from a newer version that uses
    * extended versioning.  Therefore, we will simply treat all
    * unknown versions as the latest version.
    if (value < 0)
        throw new INTERNAL() ;
    */

    /**
     * Update: If we treat all unknown versions as the latest version
     * then when we send an IOR with a PEORB version to an ORB that
     * doesn't know the PEORB version it will treat it as whatever
     * its idea of the latest version is.  Then, if that IOR is
     * sent back to the server and compared with the original
     * the equality check will fail because the versions will be
     * different.
     *
     * Instead, just capture the version bytes.
     */

    switch (value) {
        case ORBVersion.FOREIGN : return ORBVersionImpl.FOREIGN ;
        case ORBVersion.OLD : return ORBVersionImpl.OLD ;
        case ORBVersion.NEW : return ORBVersionImpl.NEW ;
        case ORBVersion.JDK1_3_1_01: return ORBVersionImpl.JDK1_3_1_01 ;
        case ORBVersion.NEWER : return ORBVersionImpl.NEWER ;
        case ORBVersion.PEORB : return ORBVersionImpl.PEORB ;
        default : return new ORBVersionImpl(value);
    }
}
 
Example #22
Source File: ORBVersionImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public int compareTo(Object obj) {
    // The Comparable interface says that this
    // method throws a ClassCastException if the
    // given object's type prevents it from being
    // compared.
    return getORBType() - ((ORBVersion)obj).getORBType();
}
 
Example #23
Source File: ORBImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ORBVersion getORBVersion()
{
    synchronized (this) {
            checkShutdownState();
    }
    return (ORBVersion)(orbVersionThreadLocal.get()) ;
}
 
Example #24
Source File: ORBVersionServiceContext.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public ORBVersionServiceContext( ORBVersion ver )
{
    this.version = ver ;
}
 
Example #25
Source File: ORBVersionFactory.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static ORBVersion getFOREIGN()
{
    return ORBVersionImpl.FOREIGN ;
}
 
Example #26
Source File: IIOPProfileImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return the ORBVersion associated with the object key in the IOR.
 */
public ORBVersion getORBVersion() {
    return oktemp.getORBVersion();
}
 
Example #27
Source File: NewObjectKeyTemplateBase.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected void setORBVersion( InputStream is )
{
    ORBVersion version = ORBVersionFactory.create( is ) ;
    setORBVersion( version ) ;
}
 
Example #28
Source File: ORBVersionImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public boolean lessThan(ORBVersion version) {
    return orbType < version.getORBType();
}
 
Example #29
Source File: WireObjectKeyTemplate.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public ORBVersion getORBVersion()
{
    return ORBVersionFactory.getFOREIGN() ;
}
 
Example #30
Source File: ORBVersionFactory.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public static ORBVersion getPEORB()
{
    return ORBVersionImpl.PEORB ;
}