[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jacorb-developer
Subject:    [jacorb-developer] ClassFormatException when applet mode + bidir + HTTPS
From:       Sebastien Brugalieres <Sebastien.Brugalieres () alcatel ! fr>
Date:       2002-10-24 17:00:02
Message-ID: 3DB80A47.563A96AE () nmu ! alcatel ! fr
[Download RAW message or body]

Hi,

In last June I have submitted a problem about a ClassNotFoundException
which is displayed by JacORB when my client application uses the
Bidirectionality and it receives a CORBA user exception returned by my
server.

This problem wasn't blocking because it was just a trace and my user
exception was successfully received in my client application. I have put
the preceding mails about this subject at the end of the mail.

Today this problem is blocking because my client application is an
applet and the applet's jar files are downloaded via HTTPS.
When HTTPS is used the ClassFormatError exception is raised instead of
the ClassNotFoundException. This exception is not caught by JacORB and
as a consequence my client application receives this exception instead
of my user exception !

I don't know why the ClassFormatError is raised instead of the
ClassNotFoundException when HTTPS is used maybe it is due to the Java
Plug-In 1.3.1 ? When I use HTTP it works and the ClassNotFoundException
is raised like expected.

To solve this problem JacORB should catch the ClassFormatError in the
ApplicationExceptionHelper.java class when it tries to find the
exception class.

In addition, this method should be improved to find the exception class,
it will avoid both the ClassFormatError and the ClassNotFoundException.

The problem of this class is the following.

from the string like :

IDL:component.project.company.com/TgcPnmUsmServerIdlModule/ExecutionFailure:1.0

it builds the following class name :

component.project.company.com.TgcPnmUsmServerIdlModule.ExecutionFailure
component.project.company.com.TgcPnmUsmServerIdlModulePackage.ExecutionFailure

but it should build the following class name :
com.company.project.component.TgcPnmUsmServerIdlModule.ExecutionFailure
com.company.project.component.TgcPnmUsmServerIdlModulePackage.ExecutionFailure

because component.project.company.com is in fact defined in the IDL as

#pragma prefix "component.project.company.com"

When the idl is generated the class have the following path :

com/company/project/component

which is the reverse of the prefix name !


I have coded a fix and it works for me. Something similar to the
following code should be implemented in JacORB for the
ApplicationExceptionHelper.java

/*
 *        JacORB - a free Java ORB
 *
 *   Copyright (C) 1999-2002 Gerald Brose
 *
 *   This library is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU Library General Public
 *   License as published by the Free Software Foundation; either
 *   version 2 of the License, or (at your option) any later version.
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *   Library General Public License for more details.
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this library; if not, write to the Free
 *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */
package org.jacorb.orb;

import org.omg.CORBA.*;
import org.omg.CORBA.portable.*;
import java.lang.reflect.*;

/**
 * This class provides a method for inserting an arbirtary
 * application exception into an any.
 *
 * @author Nicolas Noffke
 * @version $Id: ApplicationExceptionHelper.java,v 1.1.1.1 2002/07/24
08:18:26 steve Exp $
 */

public class ApplicationExceptionHelper
{

    /**
     * This method tries to insert the given ApplicationException into
the
     * given any by deriving the helper name from object id. <br>
     * All exceptions are propagated upward to be handled there.
     */

    public static void insert(org.omg.CORBA.Any any,
ApplicationException  s)
        throws ClassNotFoundException,
        NoSuchMethodException,
        IllegalAccessException,
        InvocationTargetException
    {

        String name = s.getId();
        org.jacorb.util.Debug.output(2, "Trying to build Helper for >>"
+ name +
                                     "<< (" + s.getClass().getName() +
")");

        StringBuffer name_strbuf = new StringBuffer( name );

        //strip trailing version ":1.0"
        name_strbuf.delete( name.lastIndexOf(':'), name.length() );

        //strip leading "IDL:"
        name_strbuf.delete( 0, name.indexOf(':') + 1);

        name = name_strbuf.toString();

 String prefix = "";
 String reversePrefix = "";
 String exceptionName;

 int indexPrefix = name.indexOf('/');

 if (indexPrefix != -1) {
     prefix = name.substring(0, indexPrefix) + ".";

     exceptionName = name.substring(indexPrefix + 1);
     exceptionName = exceptionName.replace ('/', '.');

     int index     = 0;
     int currIndex = -1;

     while ((currIndex = prefix.indexOf('.', index)) != -1) {
  reversePrefix = prefix.substring(index, currIndex) + "." +
reversePrefix;
  index = currIndex + 1;
     }

 } else {
     // even if no prefix we must replace "/" with "."
     exceptionName = name.replace ('/', '.');
 }


        Class _helper = null;

        //first, try with unmodified name

 name = prefix + exceptionName;
        try
        {
         _helper = Class.forName( name + "Helper" );
        }
        catch( ClassNotFoundException cnf )
        {
        }
        catch( ClassFormatError cfe )
        {
        }

 // second, try with the reverse prefix. Example : omg.org becomes
org.omg

         if( _helper == null )
  {
   name = reversePrefix + exceptionName;

   try
   {
       _helper = Class.forName( name + "Helper" );
   }
   catch( ClassNotFoundException cnf )
   {
   }
   catch( ClassFormatError cfe )
   {
   }
  }

        //not found, try with "Package" inserted
 //with unmodified name

 if ( _helper == null )
 {
  name = prefix + exceptionName;

         StringBuffer name_strbufPackage = new StringBuffer( name );

  name_strbufPackage.insert( name.lastIndexOf( '.' ),
        "Package" );

  name = name_strbufPackage.toString();

  try
  {
      _helper = Class.forName( name + "Helper" );
  }
  catch( ClassNotFoundException cnf )
  {
  }
  catch( ClassFormatError cfe )
  {
  }
 }

        //not found, try with "Package" inserted
 //with reverse prefix

 if ( _helper == null )
 {
  name = reversePrefix + exceptionName;

         StringBuffer name_strbufPackage = new StringBuffer( name );

  name_strbufPackage.insert( name.lastIndexOf( '.' ),
        "Package" );

  name = name_strbufPackage.toString();

  //don't try-catch here, so the exception will make this
  //method return with a ClassNotFoundException
  // ClassFormatError exception is converted into a
classNotFoundException
  try
         {
      _helper = Class.forName( name + "Helper" );
  }
  catch ( ClassFormatError cfe )
  {
      throw new java.lang.ClassNotFoundException(name + " class not
found");
  }
 }

        //_helper must not be null from here on

        //get read method from helper and invoke it,
        //i.e. read the object from the stream
        Method _read =
            _helper.getMethod( "read",
                               new Class[]{

Class.forName("org.omg.CORBA.portable.InputStream")
                               }
                               );
        java.lang.Object _user_ex =
            _read.invoke(null, new java.lang.Object[]{
s.getInputStream() } );

        //get insert method and insert exception into any
        Method _insert =
            _helper.getMethod("insert",
                              new Class[]{
Class.forName("org.omg.CORBA.Any"),
                                           Class.forName( name ) }
                              );
        _insert.invoke( null, new java.lang.Object[]{any, _user_ex} );
    }
} // ApplicationExceptionHelper


//-------------------------------------------------------------------------

//-------------------------------------------------------------------------

Here, the previous discussion about the ClassNotFoundException


Hello Sebastien,
you can only get rid of the exception by removing the offending line
from the code:
1.) Open src/org/jacorb/orb/Delegate.java
2.) Search for "ApplicationExceptionHelper.insert"
3.) Comment the "Debug.output()" statement in the catch-clause below.
4.) Recompile jacorb by doing an "ant" in jacorbs root dir.

An alternative would be to copy the attached file into
src/org/jacorb/orb and
rebuild jacorb (see 4.) This fixes the bug that causes the exception to
be thrown.

Hope that helps,
   Nicolas

Sebastien Brugalieres wrote:
> Hello Nicolas,
>
> Finally I found the source of the problem ! I'm not using the portable
interceptors but the exception is raised only when I use
> the bidirectional IIOP.
> The Bidirectional IIOP uses probably the portable interceptors since I
must set the following properties for BIDIR IIOP :
>
>  props.put(
"org.omg.PortableInterceptor.ORBInitializerClass.bidir_init",
>
"org.jacorb.orb.connection.BiDirConnectionInitializer" );
>
> Is it possible to remove this exception whithout having to change the
verbosity ? Is it a bug ? Thanks for your help and your
> good advices. Regards,
>
>     Sebastien.
>
> Nicolas Noffke wrote:
>
>
>>Hello Sebastien,
>>I assume you're using portable interceptors. When a remote invocation
returns
>>with a user exception, the exception is supposed to be put into an any
to be
>>inspected by the interceptors. The problem here is that to insert the
exception
>>into an any, you need the helper class of the exception, because the
GIOP
>>message only contains the type id and the real exception is net thrown
until
>>control returns to the generated stub. Unfortunately, the package name
of the
>>exception doesn't necessarily equal the type id, i.e. when the
exception is
>>declared inside of an interface declaration, it's package is the fully
qualified
>>name of the interface plus the postfix "Package" appended. Therefore,
in order
>>to get the helpers class object we have to try with various strings
where
>>"Package" is inserted at different spots. When all strings tried fail
to
>>generate a class object, the ClassNotFoundException you see is thrown
to
>>indicate this failure.
>>
>>I have to check if there's something wrong with our code, but to get
rid of the
>>message, you have to set the verbosity level to less than 2. If you
don't want
>>to inspect the exception, it's safe to ignore it and it doesn't do no
harm.
>>
>>Hope that helps,
>>   Nicolas
>>
>>Sebastien Brugalieres wrote:
>>
>>>Hi,
>>>
>>>I have a JacORB application which calls a method on the server and
the
>>>server raises a User Exception (ExecutionFailure). When my
application
>>>receives this exception JacORB displays a *Class Not Found Exception*

>>>message on standard error and then it raises successfully the
exception
>>>in my application code. Next the exception (ExecutionFailure) is
>>>successfully processed in my code.
>>>I don't understand why JacORB display this *Class Not Found
Exception*
>>>message and how can I remove it ?
>>>
>>>When the following code is executed :
>>>
>>> try {
>>>
>>>       TgcCorbaMainOperations mainOp =
>>>(TgcCorbaMainOperations)interf.getImplementation();
>>>
>>>     TgcIdlMain tgcMain = mainOp.getCorbaObject();
>>>*     main_.performAction(actionId, selectionList, tgcMain); -> The
>>>exception ExecutionFailure is raised by the server*
>>>   }
>>> catch (ExecutionFailure ex) {
>>>     throw new TgcExecutionFailureException(ex.errorLabel); -> My
>>>application process the exception here !
>>>     }
>>> catch (org.omg.CORBA.SystemException ex) {
>>>     // This exception can occurs in two cases :
>>>     // - the server is shutdowned,
>>>     // - the server has sent an obsolete request before, but we
don't
>>>care if it generate
>>>     // an exception !
>>>     System.err.println("CORBA System Exception");
>>>     ex.printStackTrace();
>>>     throw new TgcCommunicationException("performAction() has
failed");
>>> }
>>>
>>>JacORB displays the following exception before the end of
performAction() :
>>>
>>>[ ConnectionManager: found conn to target 139.54.31.51:2372 ]
>>>[ Trying to build Helper for
>>>
>>IDL:tgc.almap.alcatel.com/TgcPnmUsmServerIdlModule/ExecutionFailure:1.0<<
(org.omg.CORBA.portable.ApplicationException) ]
>>>############################ StackTrace ############################
>>>j*ava.lang.ClassNotFoundException*
>>>        at org.jacorb.orb.ApplicationExceptionHelper.insert(Unknown
Source)
>>>        at org.jacorb.orb.Delegate.invoke(Unknown Source)
>>>        at
org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:459)
>>>        at
>>>com.alcatel.almap.tgc.TgcPnmUsmServerIdlModule._PuIdlMainStub.performAction(_PuIdlMainStub.java:34)

>>>
>>>        at
>>>com.alcatel.almap.tgc.util.kernel.TgcCorbaSession.doAction(TgcCorbaSession.java:271)

>>>
>>>
>>>Do you have any idea ? Thanks a lot. Regards,
>>>
>>>    Sebastien.
>>>
>>
>>_______________________________________________
>>jacorb-developer maillist  -
jacorb-developer@lists.spline.inf.fu-berlin.de
>>http://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer

>
>
>





/*
 *        JacORB - a free Java ORB
 *
 *   Copyright (C) 1999-2002 Gerald Brose
 *
 *   This library is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU Library General Public
 *   License as published by the Free Software Foundation; either
 *   version 2 of the License, or (at your option) any later version.
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *   Library General Public License for more details.
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this library; if not, write to the Free
 *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */
package org.jacorb.orb;

import org.omg.CORBA.*;
import org.omg.CORBA.portable.*;
import java.lang.reflect.*;

/**
 * This class provides a method for inserting an arbirtary
 * application exception into an any.
 *
 * @author Nicolas Noffke
 * @version $Id: ApplicationExceptionHelper.java,v 1.7 2002/07/01
07:54:16 nicolas Exp $
 */

public class ApplicationExceptionHelper
{

    /**
     * This method tries to insert the given ApplicationException into
the
     * given any by deriving the helper name from object id. <br>
     * All exceptions are propagated upward to be handled there.
     */

    public static void insert(org.omg.CORBA.Any any,
ApplicationException  s)
        throws ClassNotFoundException,
        NoSuchMethodException,
        IllegalAccessException,
        InvocationTargetException
    {

        String name = s.getId();
        org.jacorb.util.Debug.output(2, "Trying to build Helper for >>"
+ name +
                                     "<< (" + s.getClass().getName() +
")");

        //for some reason, StringBuffers don't have a replace method
        name = name.replace ('/', '.');


        StringBuffer name_strbuf = new StringBuffer( name );

        //strip trailing version ":1.0"
        name_strbuf.delete( name.lastIndexOf(':'), name.length() );

        //strip leading "IDL:"
        name_strbuf.delete( 0, name.indexOf(':') + 1);

        Class _helper = null;

        name = name_strbuf.toString();

        //first, try with unmodified name
        try
        {
            _helper = Class.forName( name + "Helper" );
        }
        catch( ClassNotFoundException cnf )
        {
        }

        //not found, try with "Package" inserted
        if( _helper == null )
        {
            name_strbuf.insert( name.lastIndexOf( '.' ),
                                "Package" );

            name = name_strbuf.toString();

            //don't try-catch here, so the exception will make this
            //method return
            _helper = Class.forName( name + "Helper" );
        }

        //_helper must not be null from here on

        //get read method from helper and invoke it,
        //i.e. read the object from the stream
        Method _read =
            _helper.getMethod( "read",
                               new Class[]{

Class.forName("org.omg.CORBA.portable.InputStream")
                               }
                               );
        java.lang.Object _user_ex =
            _read.invoke(null, new java.lang.Object[]{
s.getInputStream() } );

        //get insert method and insert exception into any
        Method _insert =
            _helper.getMethod("insert",
                              new Class[]{
Class.forName("org.omg.CORBA.Any"),
                                           Class.forName( name ) }
                              );
        _insert.invoke( null, new java.lang.Object[]{any, _user_ex} );
    }
} // ApplicationExceptionHelper


--
_____________________________________________

ALCATEL - Network Management Unit -
BRUGALIERES Sebastien
Phone : 01-69-63-40-63
mailto:Sebastien.brugalieres@nmu.alcatel.fr
_____________________________________________



[Attachment #3 (text/html)]

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>In last June I have submitted a problem about a ClassNotFoundException
which is displayed by JacORB when my client application uses the Bidirectionality
and it receives a CORBA user exception returned by my server.
<p>This problem wasn't blocking because it was just a trace and my user
exception was successfully received in my client application. I have put
the preceding mails about this subject at the end of the mail.
<p>Today this problem is blocking because my client application is an applet
and the applet's jar files are downloaded via HTTPS.
<br>When HTTPS is used the ClassFormatError exception is raised instead
of the ClassNotFoundException. This exception is not caught by JacORB and
as a consequence my client application receives this exception instead
of my user exception !
<p>I don't know why the ClassFormatError is raised instead of the \
ClassNotFoundException when HTTPS is used maybe it is due to the Java Plug-In 1.3.1 ? \
When I use HTTP it works and the ClassNotFoundException is raised like expected.
<p>To solve this problem JacORB should catch the ClassFormatError in the
ApplicationExceptionHelper.java class when it tries to find the exception
class.
<p>In addition, this method should be improved to find the exception class,
it will avoid both the ClassFormatError and the ClassNotFoundException.
<p>The problem of this class is the following.
<p>from the string like :
<p>IDL:component.project.company.com/TgcPnmUsmServerIdlModule/ExecutionFailure:1.0
<p>it builds the following class name :
<p>component.project.company.com.TgcPnmUsmServerIdlModule.ExecutionFailure
<br>component.project.company.com.TgcPnmUsmServerIdlModulePackage.ExecutionFailure
<p>but it should build the following class name :
<br>com.company.project.component.TgcPnmUsmServerIdlModule.ExecutionFailure
<br>com.company.project.component.TgcPnmUsmServerIdlModulePackage.ExecutionFailure
<p>because component.project.company.com is in fact defined in the IDL
as
<p>#pragma prefix "component.project.company.com"
<p>When the idl is generated the class have the following path :
<p>com/company/project/component
<p>which is the reverse of the prefix name !
<br>&nbsp;
<p>I have coded a fix and it works for me. Something similar to the following
code should be implemented in JacORB for the ApplicationExceptionHelper.java
<p>/*
<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JacORB - a free Java
ORB
<br>&nbsp;*
<br>&nbsp;*&nbsp;&nbsp; Copyright (C) 1999-2002 Gerald Brose
<br>&nbsp;*
<br>&nbsp;*&nbsp;&nbsp; This library is free software; you can redistribute
it and/or
<br>&nbsp;*&nbsp;&nbsp; modify it under the terms of the GNU Library General
Public
<br>&nbsp;*&nbsp;&nbsp; License as published by the Free Software Foundation;
either
<br>&nbsp;*&nbsp;&nbsp; version 2 of the License, or (at your option) any
later version.
<br>&nbsp;*
<br>&nbsp;*&nbsp;&nbsp; This library is distributed in the hope that it
will be useful,
<br>&nbsp;*&nbsp;&nbsp; but WITHOUT ANY WARRANTY; without even the implied
warranty of
<br>&nbsp;*&nbsp;&nbsp; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp;
See the GNU
<br>&nbsp;*&nbsp;&nbsp; Library General Public License for more details.
<br>&nbsp;*
<br>&nbsp;*&nbsp;&nbsp; You should have received a copy of the GNU Library
General Public
<br>&nbsp;*&nbsp;&nbsp; License along with this library; if not, write
to the Free
<br>&nbsp;*&nbsp;&nbsp; Software Foundation, Inc., 675 Mass Ave, Cambridge,
MA 02139, USA.
<br>&nbsp;*
<br>&nbsp;*/
<br>package org.jacorb.orb;
<p>import org.omg.CORBA.*;
<br>import org.omg.CORBA.portable.*;
<br>import java.lang.reflect.*;
<p>/**
<br>&nbsp;* This class provides a method for inserting an arbirtary
<br>&nbsp;* application exception into an any.
<br>&nbsp;*
<br>&nbsp;* @author Nicolas Noffke
<br>&nbsp;* @version $Id: ApplicationExceptionHelper.java,v 1.1.1.1 2002/07/24
08:18:26 steve Exp $
<br>&nbsp;*/
<p>public class ApplicationExceptionHelper
<br>{
<p>&nbsp;&nbsp;&nbsp; /**
<br>&nbsp;&nbsp;&nbsp;&nbsp; * This method tries to insert the given \
ApplicationException into the
<br>&nbsp;&nbsp;&nbsp;&nbsp; * given any by deriving the helper name from
object id. &lt;br>
<br>&nbsp;&nbsp;&nbsp;&nbsp; * All exceptions are propagated upward to
be handled there.
<br>&nbsp;&nbsp;&nbsp;&nbsp; */
<p>&nbsp;&nbsp;&nbsp; public static void insert(org.omg.CORBA.Any any,
ApplicationException&nbsp; s)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throws ClassNotFoundException,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoSuchMethodException,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IllegalAccessException,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InvocationTargetException
<br>&nbsp;&nbsp;&nbsp; {
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String name = s.getId();
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; org.jacorb.util.Debug.output(2,
"Trying to build Helper for >>" + name +
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "&lt;&lt; (" + s.getClass().getName() + ")");
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StringBuffer name_strbuf
= new StringBuffer( name );
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //strip trailing version
":1.0"
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name_strbuf.delete( \
name.lastIndexOf(':'), name.length() );
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //strip leading "IDL:"
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name_strbuf.delete( 0, \
name.indexOf(':') + 1);
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = name_strbuf.toString();
<p>&nbsp;String prefix = "";
<br>&nbsp;String reversePrefix = "";
<br>&nbsp;String exceptionName;
<p>&nbsp;int indexPrefix = name.indexOf('/');
<p>&nbsp;if (indexPrefix != -1) {
<br>&nbsp;&nbsp;&nbsp;&nbsp; prefix = name.substring(0, indexPrefix) +
".";
<p>&nbsp;&nbsp;&nbsp;&nbsp; exceptionName = name.substring(indexPrefix
+ 1);
<br>&nbsp;&nbsp;&nbsp;&nbsp; exceptionName = exceptionName.replace ('/',
'.');
<p>&nbsp;&nbsp;&nbsp;&nbsp; int index&nbsp;&nbsp;&nbsp;&nbsp; = 0;
<br>&nbsp;&nbsp;&nbsp;&nbsp; int currIndex = -1;
<p>&nbsp;&nbsp;&nbsp;&nbsp; while ((currIndex = prefix.indexOf('.', index))
!= -1) {
<br>&nbsp; reversePrefix = prefix.substring(index, currIndex) + "." + reversePrefix;
<br>&nbsp; index = currIndex + 1;
<br>&nbsp;&nbsp;&nbsp;&nbsp; }
<p>&nbsp;} else {
<br>&nbsp;&nbsp;&nbsp;&nbsp; // even if no prefix we must replace "/" with
"."
<br>&nbsp;&nbsp;&nbsp;&nbsp; exceptionName = name.replace ('/', '.');
<br>&nbsp;}
<br>&nbsp;
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Class _helper = null;
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //first, try with unmodified
name
<p>&nbsp;name = prefix + exceptionName;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _helper = Class.forName(
name + "Helper" );
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch( ClassNotFoundException
cnf )
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch( ClassFormatError
cfe )
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<p>&nbsp;// second, try with the reverse prefix. Example : omg.org becomes
org.omg
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( _helper == null
)
<br>&nbsp; {
<br>&nbsp;&nbsp; name = reversePrefix + exceptionName;
<p>&nbsp;&nbsp; try
<br>&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _helper = Class.forName( name
+ "Helper" );
<br>&nbsp;&nbsp; }
<br>&nbsp;&nbsp; catch( ClassNotFoundException cnf )
<br>&nbsp;&nbsp; {
<br>&nbsp;&nbsp; }
<br>&nbsp;&nbsp; catch( ClassFormatError cfe )
<br>&nbsp;&nbsp; {
<br>&nbsp;&nbsp; }
<br>&nbsp; }
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //not found, try with "Package"
inserted
<br>&nbsp;//with unmodified name
<p>&nbsp;if ( _helper == null )
<br>&nbsp;{
<br>&nbsp; name = prefix + exceptionName;
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StringBuffer name_strbufPackage
= new StringBuffer( name );
<p>&nbsp; name_strbufPackage.insert( name.lastIndexOf( '.' ),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Package" );
<br>&nbsp;
<br>&nbsp; name = name_strbufPackage.toString();
<p>&nbsp; try
<br>&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _helper = Class.forName( name + "Helper"
);
<br>&nbsp; }
<br>&nbsp; catch( ClassNotFoundException cnf )
<br>&nbsp; {
<br>&nbsp; }
<br>&nbsp; catch( ClassFormatError cfe )
<br>&nbsp; {
<br>&nbsp; }
<br>&nbsp;}
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //not found, try with "Package"
inserted
<br>&nbsp;//with reverse prefix
<p>&nbsp;if ( _helper == null )
<br>&nbsp;{
<br>&nbsp; name = reversePrefix + exceptionName;
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StringBuffer name_strbufPackage
= new StringBuffer( name );
<p>&nbsp; name_strbufPackage.insert( name.lastIndexOf( '.' ),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Package" );
<br>&nbsp;
<br>&nbsp; name = name_strbufPackage.toString();
<p>&nbsp; //don't try-catch here, so the exception will make this
<br>&nbsp; //method return with a ClassNotFoundException
<br>&nbsp; // ClassFormatError exception is converted into a classNotFoundException
<br>&nbsp; try
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _helper = Class.forName( name + "Helper"
);
<br>&nbsp; }
<br>&nbsp; catch ( ClassFormatError cfe )
<br>&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new java.lang.ClassNotFoundException(name
+ " class not found");
<br>&nbsp; }
<br>&nbsp;}
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //_helper must not be null
from here on
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //get read method from helper
and invoke it,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //i.e. read the object from
the stream
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method _read =
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_helper.getMethod( "read",
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 new Class[]{
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 Class.forName("org.omg.CORBA.portable.InputStream")
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 );
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java.lang.Object _user_ex
=
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_read.invoke(null, new java.lang.Object[]{ s.getInputStream() } );
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //get insert method and
insert exception into any
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method _insert =
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_helper.getMethod("insert",
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 new Class[]{ Class.forName("org.omg.CORBA.Any"),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Class.forName( name ) } \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 );
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _insert.invoke( null, new
java.lang.Object[]{any, _user_ex} );
<br>&nbsp;&nbsp;&nbsp; }
<br>} // ApplicationExceptionHelper
<br>&nbsp;
<p>//-------------------------------------------------------------------------
<br>//-------------------------------------------------------------------------
<p>Here, the previous discussion about the ClassNotFoundException
<br>&nbsp;
<p>Hello Sebastien,
<br>you can only get rid of the exception by removing the offending line
from the code:
<br>1.) Open src/org/jacorb/orb/Delegate.java
<br>2.) Search for "ApplicationExceptionHelper.insert"
<br>3.) Comment the "Debug.output()" statement in the catch-clause below.
<br>4.) Recompile jacorb by doing an "ant" in jacorbs root dir.
<p>An alternative would be to copy the attached file into src/org/jacorb/orb
and
<br>rebuild jacorb (see 4.) This fixes the bug that causes the exception
to be thrown.
<p>Hope that helps,
<br>&nbsp;&nbsp; Nicolas
<p>Sebastien Brugalieres wrote:
<br>> Hello Nicolas,
<br>>
<br>> Finally I found the source of the problem ! I'm not using the portable
interceptors but the exception is raised only when I use
<br>> the bidirectional IIOP.
<br>> The Bidirectional IIOP uses probably the portable interceptors since
I must set the following properties for BIDIR IIOP :
<br>>
<br>>&nbsp; props.put( "org.omg.PortableInterceptor.ORBInitializerClass.bidir_init",
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "org.jacorb.orb.connection.BiDirConnectionInitializer" );
<br>>
<br>> Is it possible to remove this exception whithout having to change
the verbosity ? Is it a bug ? Thanks for your help and your
<br>> good advices. Regards,
<br>>
<br>>&nbsp;&nbsp;&nbsp;&nbsp; Sebastien.
<br>>
<br>> Nicolas Noffke wrote:
<br>>
<br>>
<br>>>Hello Sebastien,
<br>>>I assume you're using portable interceptors. When a remote invocation
returns
<br>>>with a user exception, the exception is supposed to be put into an
any to be
<br>>>inspected by the interceptors. The problem here is that to insert
the exception
<br>>>into an any, you need the helper class of the exception, because
the GIOP
<br>>>message only contains the type id and the real exception is net thrown
until
<br>>>control returns to the generated stub. Unfortunately, the package
name of the
<br>>>exception doesn't necessarily equal the type id, i.e. when the exception
is
<br>>>declared inside of an interface declaration, it's package is the
fully qualified
<br>>>name of the interface plus the postfix "Package" appended. Therefore,
in order
<br>>>to get the helpers class object we have to try with various strings
where
<br>>>"Package" is inserted at different spots. When all strings tried
fail to
<br>>>generate a class object, the ClassNotFoundException you see is thrown
to
<br>>>indicate this failure.
<br>>>
<br>>>I have to check if there's something wrong with our code, but to
get rid of the
<br>>>message, you have to set the verbosity level to less than 2. If you
don't want
<br>>>to inspect the exception, it's safe to ignore it and it doesn't do
no harm.
<br>>>
<br>>>Hope that helps,
<br>>>&nbsp;&nbsp; Nicolas
<br>>>
<br>>>Sebastien Brugalieres wrote:
<br>>>
<br>>>>Hi,
<br>>>>
<br>>>>I have a JacORB application which calls a method on the server and
the
<br>>>>server raises a User Exception (ExecutionFailure). When my application
<br>>>>receives this exception JacORB displays a *Class Not Found Exception*
<br>>>>message on standard error and then it raises successfully the exception
<br>>>>in my application code. Next the exception (ExecutionFailure) is
<br>>>>successfully processed in my code.
<br>>>>I don't understand why JacORB display this *Class Not Found Exception*
<br>>>>message and how can I remove it ?
<br>>>>
<br>>>>When the following code is executed :
<br>>>>
<br>>>> try {
<br>>>>
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TgcCorbaMainOperations mainOp
=
<br>>>>(TgcCorbaMainOperations)interf.getImplementation();
<br>>>>
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; TgcIdlMain tgcMain = mainOp.getCorbaObject();
<br>>>>*&nbsp;&nbsp;&nbsp;&nbsp; main_.performAction(actionId, selectionList,
tgcMain); -> The
<br>>>>exception ExecutionFailure is raised by the server*
<br>>>>&nbsp;&nbsp; }
<br>>>> catch (ExecutionFailure ex) {
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; throw new \
                TgcExecutionFailureException(ex.errorLabel);
-> My
<br>>>>application process the exception here !
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; }
<br>>>> catch (org.omg.CORBA.SystemException ex) {
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; // This exception can occurs in two cases
> 
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; // - the server is shutdowned,
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; // - the server has sent an obsolete request
before, but we don't
<br>>>>care if it generate
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; // an exception !
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; System.err.println("CORBA System Exception");
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; ex.printStackTrace();
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp; throw new TgcCommunicationException("performAction()
has failed");
<br>>>> }
<br>>>>
<br>>>>JacORB displays the following exception before the end of performAction()
> 
<br>>>>
<br>>>>[ ConnectionManager: found conn to target 139.54.31.51:2372 ]
<br>>>>[ Trying to build Helper for
<br>>>> >>IDL:tgc.almap.alcatel.com/TgcPnmUsmServerIdlModule/ExecutionFailure:1.0&lt;&lt;
 (org.omg.CORBA.portable.ApplicationException) ]
<br>>>>############################ StackTrace ############################
<br>>>>j*ava.lang.ClassNotFoundException*
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jacorb.orb.ApplicationExceptionHelper.insert(Unknown Source)
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jacorb.orb.Delegate.invoke(Unknown Source)
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at \
org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:459) \
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at \
<br>>>>com.alcatel.almap.tgc.TgcPnmUsmServerIdlModule._PuIdlMainStub.performAction(_PuIdlMainStub.java:34)
 <br>>>>
<br>>>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
<br>>>>com.alcatel.almap.tgc.util.kernel.TgcCorbaSession.doAction(TgcCorbaSession.java:271)
 <br>>>>
<br>>>>
<br>>>>Do you have any idea ? Thanks a lot. Regards,
<br>>>>
<br>>>>&nbsp;&nbsp;&nbsp; Sebastien.
<br>>>>
<br>>>
<br>>>_______________________________________________
<br>>>jacorb-developer maillist&nbsp; -&nbsp; \
jacorb-developer@lists.spline.inf.fu-berlin.de <br>>><A \
HREF="http://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer">http://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer</A>
 <br>>
<br>>
<br>>
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p>/*
<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JacORB - a free Java
ORB
<br>&nbsp;*
<br>&nbsp;*&nbsp;&nbsp; Copyright (C) 1999-2002 Gerald Brose
<br>&nbsp;*
<br>&nbsp;*&nbsp;&nbsp; This library is free software; you can redistribute
it and/or
<br>&nbsp;*&nbsp;&nbsp; modify it under the terms of the GNU Library General
Public
<br>&nbsp;*&nbsp;&nbsp; License as published by the Free Software Foundation;
either
<br>&nbsp;*&nbsp;&nbsp; version 2 of the License, or (at your option) any
later version.
<br>&nbsp;*
<br>&nbsp;*&nbsp;&nbsp; This library is distributed in the hope that it
will be useful,
<br>&nbsp;*&nbsp;&nbsp; but WITHOUT ANY WARRANTY; without even the implied
warranty of
<br>&nbsp;*&nbsp;&nbsp; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp;
See the GNU
<br>&nbsp;*&nbsp;&nbsp; Library General Public License for more details.
<br>&nbsp;*
<br>&nbsp;*&nbsp;&nbsp; You should have received a copy of the GNU Library
General Public
<br>&nbsp;*&nbsp;&nbsp; License along with this library; if not, write
to the Free
<br>&nbsp;*&nbsp;&nbsp; Software Foundation, Inc., 675 Mass Ave, Cambridge,
MA 02139, USA.
<br>&nbsp;*
<br>&nbsp;*/
<br>package org.jacorb.orb;
<p>import org.omg.CORBA.*;
<br>import org.omg.CORBA.portable.*;
<br>import java.lang.reflect.*;
<p>/**
<br>&nbsp;* This class provides a method for inserting an arbirtary
<br>&nbsp;* application exception into an any.
<br>&nbsp;*
<br>&nbsp;* @author Nicolas Noffke
<br>&nbsp;* @version $Id: ApplicationExceptionHelper.java,v 1.7 2002/07/01
07:54:16 nicolas Exp $
<br>&nbsp;*/
<p>public class ApplicationExceptionHelper
<br>{
<p>&nbsp;&nbsp;&nbsp; /**
<br>&nbsp;&nbsp;&nbsp;&nbsp; * This method tries to insert the given \
ApplicationException into the
<br>&nbsp;&nbsp;&nbsp;&nbsp; * given any by deriving the helper name from
object id. &lt;br>
<br>&nbsp;&nbsp;&nbsp;&nbsp; * All exceptions are propagated upward to
be handled there.
<br>&nbsp;&nbsp;&nbsp;&nbsp; */
<p>&nbsp;&nbsp;&nbsp; public static void insert(org.omg.CORBA.Any any,
ApplicationException&nbsp; s)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throws ClassNotFoundException,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoSuchMethodException,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IllegalAccessException,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InvocationTargetException
<br>&nbsp;&nbsp;&nbsp; {
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String name = s.getId();
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; org.jacorb.util.Debug.output(2,
"Trying to build Helper for >>" + name +
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "&lt;&lt; (" + s.getClass().getName() + ")");
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //for some reason, StringBuffers
don't have a replace method
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = name.replace ('/',
'.');
<br>&nbsp;
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StringBuffer name_strbuf
= new StringBuffer( name );
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //strip trailing version
":1.0"
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name_strbuf.delete( \
name.lastIndexOf(':'), name.length() );
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //strip leading "IDL:"
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name_strbuf.delete( 0, \
name.indexOf(':') + 1);
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Class _helper = null;
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = name_strbuf.toString();
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //first, try with unmodified
name
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_helper = Class.forName( name + "Helper" );
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch( ClassNotFoundException
cnf )
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //not found, try with "Package"
inserted
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( _helper == null )
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
name_strbuf.insert( name.lastIndexOf( '.' ),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 "Package" );
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
name = name_strbuf.toString();
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//don't try-catch here, so the exception will make this
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//method return
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_helper = Class.forName( name + "Helper" );
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //_helper must not be null
from here on
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //get read method from helper
and invoke it,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //i.e. read the object from
the stream
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method _read =
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_helper.getMethod( "read",
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 new Class[]{
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 Class.forName("org.omg.CORBA.portable.InputStream")
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 );
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java.lang.Object _user_ex
=
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_read.invoke(null, new java.lang.Object[]{ s.getInputStream() } );
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //get insert method and
insert exception into any
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method _insert =
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_helper.getMethod("insert",
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 new Class[]{ Class.forName("org.omg.CORBA.Any"),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Class.forName( name ) } \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 );
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _insert.invoke( null, new
java.lang.Object[]{any, _user_ex} );
<br>&nbsp;&nbsp;&nbsp; }
<br>} // ApplicationExceptionHelper
<br>&nbsp;
<pre>--&nbsp;
_____________________________________________

ALCATEL - Network Management Unit -&nbsp;
BRUGALIERES Sebastien
Phone : 01-69-63-40-63
<A HREF="mailto:Sebastien.brugalieres@nmu.alcatel.fr">mailto:Sebastien.brugalieres@nmu.alcatel.fr</A>
 _____________________________________________</pre>
&nbsp;</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic