Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2018 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

 

Screen Shot 2019-05-26 at 11.42.21 am.png

Posted

Don't use the Sun decoder, use the Java 8+ one... in java.util.Base64.Decoder

 

Base64.getDecoder().decode(encodedString)

Posted
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

 

Posted (edited)

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 by john renfrew
  • Thanks 1

This topic is 2018 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.