You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Manoj Khangaonkar <kh...@gmail.com> on 2011/08/04 23:07:25 UTC
WildCardPermission toString method implementation
Hi,
The code
WildcardPermission p1 = new WildcardPermission("File:r,w,x:myfile") ;
System.out.println(p1.toString()) ;
prints out [file]:[r, w, x]:[myfile]
I was expecting File:r,w,x:myfile which is the String I passed in the
construction.
Is this by design or is this just a bug ?
I feel toString should return the String passed in via the constructor
or by calling setParts.
toString needs to return parts in the same format that
WildCardPermission expects which is
part:part:part.....
where each part could be subpart,subpart,subpart
The brackets are being printed because the implementation does
buffer.append(part);
where part is a Set.
The current implementation is a problem if I call toString and then
persist the permission as a String to
the a database. Each part will have a bracket around it.
Let me know if I should open a JIRA.
Manoj
--
http://khangaonkar.blogspot.com/
Re: WildCardPermission toString method implementation
Posted by Manoj Khangaonkar <kh...@gmail.com>.
More complete example.
@Test
public void WildCardPermission() {
WildcardPermission p1 = new WildcardPermission("File:r,w,x:myfile") ;
String s1 = p1.toString();
System.out.println(s1) ;
WildcardPermission p2 = new WildcardPermission(s1) ;
String s2 = p2.toString() ;
System.out.println(s2) ;
Assert.assertTrue(p1.implies(p2)) ;
}
This test should pass. But it fails.
On Thu, Aug 4, 2011 at 2:07 PM, Manoj Khangaonkar <kh...@gmail.com> wrote:
> Hi,
>
> The code
>
> WildcardPermission p1 = new WildcardPermission("File:r,w,x:myfile") ;
> System.out.println(p1.toString()) ;
>
> prints out [file]:[r, w, x]:[myfile]
>
> I was expecting File:r,w,x:myfile which is the String I passed in the
> construction.
>
> Is this by design or is this just a bug ?
>
> I feel toString should return the String passed in via the constructor
> or by calling setParts.
>
> toString needs to return parts in the same format that
> WildCardPermission expects which is
>
> part:part:part.....
>
> where each part could be subpart,subpart,subpart
>
> The brackets are being printed because the implementation does
>
> buffer.append(part);
>
> where part is a Set.
>
> The current implementation is a problem if I call toString and then
> persist the permission as a String to
> the a database. Each part will have a bracket around it.
>
> Let me know if I should open a JIRA.
>
> Manoj
>
>
>
> --
> http://khangaonkar.blogspot.com/
>
--
http://khangaonkar.blogspot.com/
Re: WildCardPermission toString method implementation
Posted by Manoj Khangaonkar <kh...@gmail.com>.
More complete example.
@Test
public void WildCardPermission() {
WildcardPermission p1 = new WildcardPermission("File:r,w,x:myfile") ;
String s1 = p1.toString();
System.out.println(s1) ;
WildcardPermission p2 = new WildcardPermission(s1) ;
String s2 = p2.toString() ;
System.out.println(s2) ;
Assert.assertTrue(p1.implies(p2)) ;
}
This test should pass. But it fails.
On Thu, Aug 4, 2011 at 2:07 PM, Manoj Khangaonkar <kh...@gmail.com> wrote:
> Hi,
>
> The code
>
> WildcardPermission p1 = new WildcardPermission("File:r,w,x:myfile") ;
> System.out.println(p1.toString()) ;
>
> prints out [file]:[r, w, x]:[myfile]
>
> I was expecting File:r,w,x:myfile which is the String I passed in the
> construction.
>
> Is this by design or is this just a bug ?
>
> I feel toString should return the String passed in via the constructor
> or by calling setParts.
>
> toString needs to return parts in the same format that
> WildCardPermission expects which is
>
> part:part:part.....
>
> where each part could be subpart,subpart,subpart
>
> The brackets are being printed because the implementation does
>
> buffer.append(part);
>
> where part is a Set.
>
> The current implementation is a problem if I call toString and then
> persist the permission as a String to
> the a database. Each part will have a bracket around it.
>
> Let me know if I should open a JIRA.
>
> Manoj
>
>
>
> --
> http://khangaonkar.blogspot.com/
>
--
http://khangaonkar.blogspot.com/