Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues

Bug 362

Summary: composite names are incorrectly escaped
Product: JacORB Reporter: Eric Malmstrom <emalmstrom>
Component: IDL compilerAssignee: Gerald Brose <gerald.brose>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 1.4.1   
Hardware: PC   
OS: Linux   

Description Eric Malmstrom 2003-07-02 00:53:52 UTC
I am working with a set of idls, which contains an idl PackageComponent.idl,
which in turn defines a PackageModule with an interface Package. 

Since <X>Package is a reserved format, org.jacorb.idl.lexer will allow 'Package'
to pass unescaped, but anything of the form 'XPackage' will be escaped. However,
org.jacorb.idl.ScopedName will submit the name 'PackageModule.Package' to
lexer.strictJavaEscapeCheck(), which will return true denoting the need to
escape the name, and then check to see if the name is composite, eventually
generating the name 'PackageModule._Package'. 

I believe the following is a sufficient fix for the problem:

  In ScopedName
    public void escapeName()
    {
        // new esm 7/1/03
        String checkName = typeName;
        if( typeName.indexOf( '.' ) > 0 ) {
          checkName = typeName.substring( typeName.lastIndexOf( '.' ) + 1 );
        }
        // end new

        if( !name.startsWith( "_" ) &&
                lexer.strictJavaEscapeCheck( checkName ) )
//                lexer.strictJavaEscapeCheck( typeName ) )
        {
            // if the type name is not a simple name, then insert the escape
            // char after the last dot
            if( typeName.indexOf( '.' ) > 0 )
            {
                typeName =
                        typeName.substring( 0, typeName.lastIndexOf( '.' ) + 1 ) +
                        "_" + typeName.substring( typeName.lastIndexOf( '.' ) + 1 );
            }
            else
            {
                typeName = "_" + typeName;
            }
            Environment.output( 3, "ScopedName.escapeName " + typeName );
        }
    }
Comment 1 Nick Cross 2003-08-01 16:47:44 UTC

*** This bug has been marked as a duplicate of 231 ***