Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues
Bug 362 - composite names are incorrectly escaped
Summary: composite names are incorrectly escaped
Status: RESOLVED DUPLICATE of bug 231
Alias: None
Product: JacORB
Classification: Unclassified
Component: IDL compiler (show other bugs)
Version: 1.4.1
Hardware: PC Linux
: P2 normal
Assignee: Gerald Brose
URL:
Depends on:
Blocks:
 
Reported: 2003-07-02 00:53 UTC by Eric Malmstrom
Modified: 2003-08-01 16:47 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***