June 21, 20169 yr I am getting an error when i try to save to: access denied ("java.lang.reflect.ReflectPermission" "suppressAccessChecks") public void saveUserProfiles(Script script) { try { FileOutputStream fileOut = new FileOutputStream(script.getDirectoryData() + USER_FILE); PrintStream printStream = new PrintStream(fileOut); fileOut.close(); printStream.print(json.toJson(profiles)); printStream.close(); } catch (Exception e) { script.logger.debug(e.getMessage()); } } /** * The user profiles file */ public static final String USER_FILE = "user_profiles.dat"; Edited June 21, 20169 yr by Optimum Scripts
June 22, 20169 yr Does the error really belong to this code? Seems like you are using reflection... I doubt that is has anything to do with this code.
June 22, 20169 yr My guess is that you're using an external library to parse JSON? And that library probably uses reflection, which requires the -allow reflection argument when opening the client. But if this is the case, ext. libraries aren't copied to the SDN regardless
June 22, 20169 yr Author Does the error really belong to this code? Seems like you are using reflection... I doubt that is has anything to do with this code. If you mean reflection client mode, I've tried both clients My guess is that you're using an external library to parse JSON? And that library probably uses reflection, which requires the -allow reflection argument when opening the client. But if this is the case, ext. libraries aren't copied to the SDN regardless Actually i'm using GSON's original source code within my application, no library. But all json is doing is parsing the object, not writing the file
June 22, 20169 yr If you mean reflection client mode, I've tried both clients Actually i'm using GSON's original source code within my application, no library. But all json is doing is parsing the object, not writing the file GSON probably uses reflection somewhere, even if you dont use that particular method, if the classloader sees that any of your classes use it, it will act up.
June 22, 20169 yr Author GSON probably uses reflection somewhere, even if you dont use that particular method, if the classloader sees that any of your classes use it, it will act up. Had to resort to serializeable objects
June 22, 20169 yr Had to resort to serializeable objects That won't fly with the SDN either. Method names and class members have their identifiers changed by the obfuscator (including serialVersionUID) In other words, you wont be able to load objects serialized by an earlier osbot client version Edited June 22, 20169 yr by FrostBug
June 22, 20169 yr Author That won't fly with the SDN either. Method names and class members have their identifiers changed by the obfuscator (including serialVersionUID) In other words, you wont be able to load objects serialized by an earlier osbot client version Any recommendations ?
June 22, 20169 yr Any recommendations ? Well, there aren't rly many good options left. I personally made some API around java 'Properties'
Create an account or sign in to comment