Error with Worksheet.fillWithArray()

6 views
Skip to first unread message

ludovi...@gmail.com

unread,
Mar 28, 2018, 5:14:38 PM3/28/18
to JExcel Forum
Hello,

I have an Error while I fill the worksheet with an Array or Variant:

16:48:26 [http-bio-8080-exec-4] ERROR com.jniwrapper.win32.automation.types.SafeArray(69) - Failed to release SafeArray object by handle: 6308280' in Thread: http-bio-8080-exec-4
com.jniwrapper.FunctionExecutionException: c0000005
 at com.jniwrapper.Function.invokeCFunc(Native Method) ~[jniwrap-3.11.jar:?]
 at com.jniwrapper.FunctionCall.a(SourceFile:127) ~[jniwrap-3.11.jar:?]
 at com.jniwrapper.FunctionCall.call(SourceFile:35) ~[jniwrap-3.11.jar:?]
 at com.jniwrapper.Function.invoke(SourceFile:188) ~[jniwrap-3.11.jar:?]
 at com.jniwrapper.Function.invoke(SourceFile:212) ~[jniwrap-3.11.jar:?]
 at com.jniwrapper.win32.be.b(SourceFile:1270) [comfyj-2.13.jar:?]
 at com.jniwrapper.win32.automation.types.SafeArray.release(SourceFile:958) [comfyj-2.13.jar:?]
 at com.jniwrapper.win32.jexcel.Worksheet.fillWithArray(Unknown Source) [jexcel-1.8.jar:?]



Every Variant created has the setAutoDelete(false).

Even if I had this error, the Excel file is complete and there is no issue with the content, the fillWithArray never throw this exception

The code look like:

List<Variant[]> al = new ArrayList<Variant[]>();


//Foreach row in db:
while (rsData.next()) {
 
Variant[] all = new Variant[5];
 
Variant variant = new Variant("Text");
 variant
.setAutoDelete(false);
 all
[0] = variant;
 
// same for all[1] to all[4]
 al
.add(all);
}


Variant tmpa[][] = new Variant[26280][5];
for (int c = 0; c < 26280; c++)
 
System.arraycopy(al.get(c), 0, tmpa[c], 0, 5);


//logging: filling-> A6:E26285
logger
.trace("filling-> A6:" + Character.toString((char) (65 + 5 - 1)) + Integer.toString(alSize + 5));


sheet
.fillWithArray("A6:" + Character.toString((char) (65 + 5 - 1)) + Integer.toString(alSize + 5), tmpa);

the stdout display another error too:
WARNING in native method: JNI call made with exception pending
 at com
.jniwrapper.Function.invokeCFunc(Native Method)
 at com
.jniwrapper.FunctionCall.a(SourceFile:127)
 at com
.jniwrapper.FunctionCall.call(SourceFile:35)
 at com
.jniwrapper.Function.invoke(SourceFile:188)
 at com
.jniwrapper.Function.invoke(SourceFile:212)
 at com
.jniwrapper.win32.be.b(SourceFile:1270)
 at com
.jniwrapper.win32.automation.types.SafeArray.release(SourceFile:958)
 at com
.jniwrapper.win32.jexcel.Worksheet.fillWithArray(Unknown Source)

Is it something I should care about ?

Anna Dolbina

unread,
Mar 29, 2018, 9:34:09 AM3/29/18
to Ludo, JExcel Forum
Hi,

The exceptions that you have provided are related to the automatic memory management in JExcel.

The Variant.setAutoDelete(false) method called in your code indicates that this Variant is not released automatically and should be released in your code when it is not necessary anymore.
It is possible that this is the cause of the memory management issue in your case.

Could you please try removing the variant.setAutoDelete(false) call from your implementation and let me know if this resolves the issue?
If the issue persists, could you please provide a complete Java sample that can be used to reproduce it?


Sincerely,
Anna


--
You received this message because you are subscribed to the Google Groups "JExcel Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jexcel-forum+unsubscribe@teamdev.com.
To view this discussion on the web visit https://groups.google.com/a/teamdev.com/d/msgid/jexcel-forum/5fe80409-52f2-461f-aede-73b59dbf6ac1%40teamdev.com.

Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages