Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Error with Base64 conversion new Scriptmaster Plugin and FMP18

Featured Replies

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

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

 

Base64.getDecoder().decode(encodedString)

  • 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

 

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

  • Author

Thanks John

You are a legend! Problem solved.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.