Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

java.lang.NoSuchMethodError: com.atlassian.stash.repository.ref.restriction.AccessGrantSearchRequest$Builder.restrictionId

Johannes Heger (CD) July 23, 2015

Hello,

I'm writing a plugin which uses methode restrictionId() of class AccessGrantSearchRequest.Builder:

AccessGrantSearchRequest accessGrantSearchRequest = new 
AccessGrantSearchRequest.Builder( repository ).restrictionId( id 
).build();
PageaccessGrants = 
refRestrictionService.search(accessGrantSearchRequest, pageRequest);

This leads tot he following Error: java.lang.NoSuchMethodError:

java.lang.NoSuchMethodError: com.atlassian.stash.repository.ref.restriction.AccessGrantSearchRequest$Builder.restrictionId(I)Lcom/atlassian/stash/repository/ref/restriction/AccessGrantSearchRequest$Builder;

        at jh.atlassian.stash.permissionbranchinfo.BranchInfoProvider$1.perform(BranchInfoProvider.java:59) ~[na:na]

        at jh.atlassian.stash.permissionbranchinfo.BranchInfoProvider$1.perform(BranchInfoProvider.java:1) ~[na:na]

 

Calling AccessGrantSearchRequest.Builder without restrictionId() does not throw any Error:

AccessGrantSearchRequest accessGrantSearchRequest = new AccessGrantSearchRequest.Builder( repository ).build();

 

That error is thrown on a staging Stash server 3.11.0. But that error is not thrown on an local atlas-run Stash 3.11.0. The methode restrictionId() is contained in stash-branch-permissions-3.11.0.jar, (on stagig stash) seen with javap.

How to use restrictionId() without error?

B.t.w, using AccessGrantSearchRequest.Builder only with the repository, but without restictionId(), delivers 0 results. So without restrctionId() the search seems to be useless?

Kind regards, Johannes

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Johannes Heger (CD) July 23, 2015

Hi Felix, yes compiling for 3.11 works for both questions!

(I compiled for 3.10 and deployed to 3.11.)

It works now, thank you very much,

kind regards, Johannes

0 votes
Felix
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2015

Hi @Johannes Heger (CD),

I believe you might be running into an issue resulting from a slight change in the API that was made to fix STASH-7510 (and STASH-7607). In Stash 3.10.2 the restrictionId method's signature was changed from an int to an Integer. 

The fact that you are seeing zero results being returned for an AccessGrant search without a restrictionId, indicates that you are running on a version pre-3.10.2 or using a jar compiled against a pre-3.10.2 source. 

Recompiling your plugin against the latest version of Stash should solve both the NoSuchMethodError as well as the AccessGrant search returning zero results when executed without a restrictionId.

I hope this helps,

Felix Haehnel
Stash Developer 

 

TAGS
AUG Leaders

Atlassian Community Events