It's all about the answers!

Ask a question

JAVA API Client : Null output when using findProcessArea(uri,nulll,null)


Girish Chandra P (953246) | asked Mar 14 '16, 8:53 a.m.
 IProjectArea projectArea= (IProjectArea) processClient.findProcessArea(uri, null, null);
I am getting error Project are not found.
Value of Project Area Is NULL.
Please let me know why this error ?

Accepted answer


permanent link
Girish Chandra P (953246) | answered Mar 14 '16, 11:25 a.m.
Hello Ralph Schoon,

I was giving the uri  as https://xxxxx:9443/jts rather /ccm
I got it now .. Thanks ..
Thanks Again
Ralph Schoon selected this answer as the correct answer

One other answer



permanent link
Ralph Schoon (63.4k33646) | answered Mar 14 '16, 9:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Because it could not find a process area given the URI you specified in which case it returns null as specified in the interface:



Comments
Girish Chandra P commented Mar 14 '16, 10:57 a.m. | edited Mar 14 '16, 4:13 p.m.

Hello Ralph Schoon,

Thanks for reply

I have used the example code available in RSjazz.

I have created the project Ares (Process Area) I have checked  for all project area available.(Also with the alais name)

Here is the code :
    ITeamRepository teamRepository= TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI);
        teamRepository.registerLoginHandler(new LoginHandler(userId, password));
        teamRepository.login(null);
   
        IProcessClientService processClient= (IProcessClientService) teamRepository.getClientLibrary(IProcessClientService.class);
        IAuditableClient auditableClient= (IAuditableClient) teamRepository.getClientLibrary(IAuditableClient.class);
        IWorkItemClient workItemClient= (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);
       
       
        System.out.println(processClient);
      
        URI uri= URI.create(projectAreaName.replaceAll(" ", "%20"));
        System.out.println(projectAreaName);
        System.out.println(uri);
        IProjectArea projectArea= (IProjectArea) processClient.findProcessArea(uri, null, null);
        System.out.println(projectArea);
        if (projectArea == null) {
            System.out.println("Project area not found.");
            return false;
        }



Ralph Schoon commented Mar 14 '16, 11:05 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This is all not useful information, because what really would matter is the String that is passed to create the URI and the URI as string to check if there might be any funny pre or postfix values.

A valid program is not able to work if the input is invalid. I know, my code above works, because I have used it like 30 times already and it works for me. So the only possible data producing issues is the input.


Ralph Schoon commented Mar 14 '16, 11:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

And i believe you created the project areas and the like, but I also believe that you pass the wrong information to the code above, which results in a not found, because what you search for is not there and what is there you don't search for.


Girish Chandra P commented Mar 14 '16, 11:14 a.m.

Hello Ralph Schoon,

I apologise , I  Actually know that code is good as I have tried lot of  the code in your blog and its really good and makes us to learn lot and interesting .But this input I am really trying but do not know  what is the wrong I am doing ...

Thanks again .. I will try it ..


Ralph Schoon commented Mar 14 '16, 11:32 a.m. | edited Mar 14 '16, 11:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Yes, the project areas are managed by the application and not JTS.
Trouble is you don't notice, because the JTS shares some common API with apps like CCM and you can actually log in.

Don't worry, stuff like that happened to probably all of us. Your learning here should be to provide the information for debugging next time. You can obfuscate it a bit, if needed.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.