Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 82367

FilePermission exception in custom Java action

$
0
0

Hi all,

I am writing a custom CSV download in which the user has more flexibility than in Mendix. I want to make sure that the CSV is UTF-8 'signed' so it opens in Excel with special characters showing properly. This is a common problem in Java CSV exporting and importing in Excel. I found a solution on stackoverflow to add some characters in the outputstream before the stringwriter adds the content. So, the first line below creates the stacktrace after it:

 

	    FileOutputStream os = new FileOutputStream(fileName);
	    os.write(0xef);
	    os.write(0xbb);
	    os.write(0xbf);

 

In this Java code, Mendix blocks me from writing to an already created file (fed as inputparameter to Java action) and throws an exception with stacktrace:

com.mendix.modules.microflowengine.MicroflowException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.security.AccessControlException: access denied ("java.io.FilePermission" "Custom CSV with sorted subset of columns.csv" "write")
    at OQL_modeler.IVK_parseCSV_FromList (JavaAction : 'JA_parseCSV_FromList')

Advanced stacktrace:
    at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:143)

Caused by: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.security.AccessControlException: access denied ("java.io.FilePermission" "Custom CSV with sorted subset of columns.csv" "write")
    at com.mendix.basis.component.InternalCore.execute(InternalCore.java:535)

Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.security.AccessControlException: access denied ("java.io.FilePermission" "Custom CSV with sorted subset of columns.csv" "write")
    at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.java:178)

Entity access is configured and the user has all CRUD priviliges on that entity.

Does anybody know how to fix this?

Another workaround would also be appreciated ;).


Viewing all articles
Browse latest Browse all 82367

Trending Articles