You need to sign in to do that
Don't have an account?
Out of memory while downloading Attachment
Hi,
I am using Sobject in my application and using API version 24. When I try to download the attachments more than 2 MB files I am getting Java out of memory exception. I tried by changing the heap size 512 - 1024MB even then its throwing same error. I am not facing this issue while downloading files less than 1 MB.
Kindly let me know the maximum size of the file I can upload or download using the SObject API.
Also let me know is version 24 is the latest version for chatter Sobject API, if it is not provide the latest version no. and the location of the corresponding wsdl file.
doc:
http://www.salesforce.com/us/developer/docs/api210/Content/sforce_api_objects_contentversion.htm
Hi,
My attachment file size is less than 25MB. As per the API document 25MB + 9.25MB (37%25) is less than 50MB. Even then I am getting the out of memory Exception.
[code]
String query = "SELECT Body, CommentCount, Id, InsertedById, IsDeleted, LikeCount, LinkUrl, ParentId, RelatedRecordId, Title, Type, CreatedDate, ContentData, ContentDescription, ContentFileName, ContentSize, ContentType, Visibility FROM FeedItem WHERE Type = 'ContentPost' ORDER BY CreatedDate DESC";
QueryResult result = conn.connection.query(query);
boolean done = false;
while(!done){
SObject[] records = result.getRecords();
for (int i = 0; i < records.length; ++i) {
HashMap<String, String> mapResult = new HashMap<String, String>();
Iterator<XmlObject> iterator = records[i].getChildren();
while(iterator.hasNext()){
XmlObject xmlObject = iterator.next();
if(!xmlObject.getName().toString().substring(37).equals("type")){
if(xmlObject.getValue()!=null){
if(xmlObject.getName().toString().substring(37).equalsIgnoreCase("ContentData")){
mapResult.put("AttachmentPath", xmlObject.getValue().toString());
}else{
mapResult.put(xmlObject.getName().toString().substring(37), xmlObject.getValue().toString());
}
}else{
mapResult.put(xmlObject.getName().toString().substring(37), null);
}
}
}
response.add(mapResult);
}
if(result.isDone()){
done = true;
}else{
result = conn.connection.queryMore(result.getQueryLocator());
if(result == null || result.getSize() == 0){
done = true;
}
}
}
[/code]