[Cs5500] Strange behavior of FullyQualifiedClassName.print

Ahmed Abdelmeged ahmed.mohsen at gmail.com
Tue Mar 1 17:50:37 EST 2011


Hi Rashmi,
  Thanks for pointing this out.

The extra space is inserted by the "*s" below. This code is taken from
java.lib.cd

nogen List(X) = Cons(X) | Empty(X).
nogen Cons(X) = <first> X *s <rest> List(X).
nogen Empty(X)= .

Unfortunately, we cannot change *s to "." in this definition because this
will change the way Lists are written throughout the whole application. List
is also used for Requests, Responses, and ProtocolSpecs.

DotSeparatedList(X) = DotSeparatedCons(X) | DotSeparatedEmpty(X).
DotSeparatedCons(X) = <first> X "." <rest> DotSeparatedList(X).
DotSeparatedEmpty(X)= .

and use:

FullyQualifiedClassName = <name> DotSeparatedList(Ident).


The downside is that we can no longer use the standard set of List
functions. But we don't need them for this case.

The .trim() was essentially a "hack" that I made.



On Tue, Mar 1, 2011 at 4:46 PM, rashmi nayak <rashmin at ccs.neu.edu> wrote:

> Hi all,
>
> The code below:
>
> FullyQualifiedClassName fcn = FullyQualifiedClassName.parse(
> "hsr.protocol.Positive");
> System.out.println(fcn.print());
>
> gives:
> "hsr.protocol .Positive"
>
> Note the space after protocol. Because of this behavior the finishParse()
> method of Claim gives a ClassNotFoundException as it cannot find a class
> with qualified name "hsr.protocol .Positive". as protocol class name.
>
> However the definition of FullyQualifiedClassName in scg.cd looks fine.
>
> FullyQualifiedClassName = <name> ident <rest> List(Qualifier).
> Qualifier = "." <name> ident.
>
> So my temporary solution was to change the part of finishParse() method in
> claim from
>
> String className = getProtocolClassName().print().trim();
>
> to
>
> String className = getProtocolClassName().print().replaceAll(" ", "");
>
> Please let me know if anyone is facing similar problem or if I have
> misunderstood something.
>
> Thanks,
> Rashmi
>
> _______________________________________________
> Cs5500 mailing list
> Cs5500 at lists.ccs.neu.edu
> https://lists.ccs.neu.edu/bin/listinfo/cs5500
>
>


-- 
Ahmed
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the Cs5500 mailing list