May 26, 20196 yr I just upgraded to FMP18. I use Scriptmaster to convert Base64 for electronic message delivery via PDF. This has been working perfectly with version 4.42 using the following: EvaluateGroovy( "File tempFile = File.createTempFile(\"/base64\", suffix);" & ¶ & "FileOutputStream stream = new FileOutputStream(tempFile);" & ¶ & "stream.write( new sun.misc.BASE64Decoder().decodeBuffer(encodedText) );" & ¶ & "stream.close();" & ¶ & "return tempFile.toURL();" ) In the new version of the plugin, when this same script runs I now get the following error: "Compliation failed: startup failed: Script1.groovy: 3: unable to resolve class sun.misc.BASE64Decoder @ line 3, column 15. stream.write( new sun.misc.BASE64Decoder().decodedBuffer(encodedText) ); ^ 1 error" When I load the old plugin into FMP18, I get the no certificate error but once accepted and loaded, the older plugin works fine in FMP18. Any suggestions would be greatly appreciated.
May 26, 20196 yr Don't use the Sun decoder, use the Java 8+ one... in java.util.Base64.Decoder Base64.getDecoder().decode(encodedString)
May 26, 20196 yr Author 6 hours ago, john renfrew said: Don't use the Sun decoder, use the Java 8+ one... in java.util.Base64.Decoder Base64.getDecoder().decode(encodedString) Thanks for the response but could I bother you to please write what I need to code exactly. I have tried various forms of what you have suggested above and keep getting error's. EvaluateGroovy( "File tempFile = File.createTempFile(\"/base64\", suffix);" & ¶ & "FileOutputStream stream = new FileOutputStream(tempFile);" & ¶ & "stream.write( new java.util.Base64.Decoder.Base64.getDecoder().decode(encodedText) );" & ¶ & "stream.close();" & ¶ & "return tempFile.toURL();" ) Thanks Spiro
May 26, 20196 yr Dont use stream as the FOS name, its a reserved word.. What are you expecting to get back from the function??? I get something like base6417434013292067398887.txt Do you already know the path to this file?? What do you expect the contents to be? a byte array or something else?? tempFile = File.createTempFile('base64', suffix) fos = new FileOutputStream(tempFile) fos.write(Base64.getDecoder().decode(encodedString)) fos.close() return tempFile.toURL() Edited May 26, 20196 yr by john renfrew
Create an account or sign in to comment