Using getRemoteApplications( commUuid ) runs into an java.lang.OutOfMemoryError: Java heap space error
Closed this issue · 2 comments
NiklasA commented
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 commented
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.
NiklasA commented
Thank you Paul!