Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Using getRemoteApplications( commUuid ) runs into an java.lang.OutOfMemoryError: Java heap space error #1728

Closed
NiklasA opened this issue Nov 10, 2015 · 2 comments
Labels

Comments

@NiklasA
Copy link

NiklasA commented Nov 10, 2015

Hi Paul,

I am trying to get the remote applications of a community. Therefore I try the following code:

String communityUuid = "67e6 ... 1317";
CommunityService aCommunityService = new CommunityService( endpoint );
EntityList<RemoteApplication> bar =
      aCommunityService.getRemoteApplications( communityUuid );

But I only get the following log message:

java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2367)
    at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
    at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:587)
    at java.lang.StringBuilder.append(StringBuilder.java:214)
    at com.ibm.commons.runtime.util.URLEncoding.encodeURIString(URLEncoding.java:75)
    at com.ibm.sbt.services.client.base.NamedUrlPart.<init>(NamedUrlPart.java:35)
    at com.ibm.sbt.services.client.connections.communities.CommunityUrls.getCommunityUuid(CommunityUrls.java:47)
    at com.ibm.sbt.services.client.connections.communities.CommunityService.getRemoteApplications(CommunityService.java:852)
...

This is your SBT code ("1.1.10.20151002-1200"):

    /**
     * To retrieve a list of remote applications associated with a community, use the remote applications link in the community entry Atom document.
     * 
     * @param communityUuid
     * @return
     */
    public EntityList<RemoteApplication> getRemoteApplications(String communityUuid) {
        return getRemoteApplications(communityUuid, null);
    }

    /**
     * To retrieve a list of remote applications associated with a community, use the remote applications link in the community entry Atom document.
     * 
     * @param communityUuid
     * @param parameters
     * @return
     */
    public EntityList<RemoteApplication> getRemoteApplications(String communityUuid, Map<String, String> parameters) {
        String url = CommunityUrls.COMMUNITY_INSTANCE.format(this, CommunityUrls.getCommunityUuid(communityUuid));
        return getRemoteApplications(url, parameters);
    }

For me it seems like that it builds an endless loop, because I cannot find any end condition (recursive method calls itself the whole time with no break).

Do you have any idea how I can fix this issue?

Best regards,

Niklas

@prb112 prb112 added the bug label Nov 10, 2015
@prb112
Copy link
Contributor

prb112 commented Nov 10, 2015

Found a few bugs with the request. It loops over getRemoteApplications recursively, and generates a loop that ends up with an outofmemory. I've changed the code to be correct. It'll be in the next release.

@prb112 prb112 closed this as completed Nov 10, 2015
@NiklasA
Copy link
Author

NiklasA commented Nov 10, 2015

Thank you Paul!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants