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.

Featured Replies

I'm working on a function to extract text from a .txt.gz file in a container field:

//SM_TextFromGZIP ( containerFieldName )
import java.util.zip.GZIPInputStream;
import java.util.io.*;

GZIPInputStream gunzip = new GZIPInputStream(fmpro.getContainerStream(containerFieldName));
InputStreamReader reader = new InputStreamReader(gunzip);
BufferedReader pr = new BufferedReader(reader);
String line;
String finalOutput = \"\";
while ((line = pr.readLine()) != null)
    finalOutput += line;
return finalOutput;

When I run this, I get this from the SMLastStackTrace function:

java.io.IOException: com.prosc.fmkit.types.FMBinary$FMContainerInputStream.read() returned value out of range -1..255: -117
    at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:250)
    at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:237)
    at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:140)
    at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:56)
    at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:65)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    ...

Any thoughts on a fix or alternative solution?

Try:

 

//SM_TextFromGZIP ( containerFieldName )
import java.util.zip.GZIPInputStream;
import java.util.io.*;

InputStream fieldStream = new BufferedInputStream(fmpro.getContainerStream(containerFieldName));

GZIPInputStream gunzip = new GZIPInputStream(fieldStream);
InputStreamReader reader = new InputStreamReader(gunzip);
BufferedReader pr = new BufferedReader(reader);
String line;
String finalOutput = "";
while ((line = pr.readLine()) != null)
finalOutput += line;
return finalOutput;

 

  • Author

Thank worked. Thanks!

  • 1 year later...
  • Author

This isn't working in FileMaker 16 anymore. Does anyone have any good ideas why?

The full function decompresses the contents of a container field and puts the result in a file:

// SM_DecompressGZIPContainerToFile ( containerFieldName ; resultFilePath )
import java.util.zip.GZIPInputStream;
import java.io.FileOutputStream;
import java.util.io.*;

InputStream fieldStream = new BufferedInputStream(fmpro.getContainerStream(containerFieldName));
GZIPInputStream gunzip = new GZIPInputStream(fieldStream);
FileOutputStream fileOutputStream = new FileOutputStream(resultFilePath);

byte[] buffer = new byte[1024];
int bytes_read;
while ((bytes_read = gunzip.read(buffer)) > 0)
    fileOutputStream.write(buffer, 0, bytes_read);

gunzip.close();
fileOutputStream.close();
return 1;

This worked great until FileMaker 16 and ScriptMaster 5.05. Now it doesn't. I've tried it from the client (16.0.2) on Mac (10.12.6) and Windows (Server 2012 R2), and in server schedules and Perform Script On Server (16.0.2.212). Mac and Windows clients both report this stack trace:

java.lang.IllegalArgumentException: You tried to create a QuadChar with a string of length: 0
    at com.prosc.fmkit.QuadChar.<init>(QuadChar.java:52)
    at com.prosc.fmkit.types.FMBinary.getStreamTypes(FMBinary.java:389)
    at com.prosc.fmkit.types.FMBinary.getBestQuadChar(FMBinary.java:404)
    at com.prosc.fmkit.types.FMBinary.getBestInputStream(FMBinary.java:443)
    at com.prosc.beanshell.FMPro.getContainerStream(FMPro.java:58)
    at com.prosc.beanshell.FMPro$getContainerStream.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
    at Script1.run(Script1.groovy:1)
    at com.prosc.beanshell.GroovyFunction._invoke(GroovyFunction.java:158)
    at com.prosc.beanshell.GroovyFunction.invoke(GroovyFunction.java:136)
    at com.prosc.fmkit.Plugin.invokeFunction(Plugin.java:398)
    at com.prosc.fmkit.RegisterablePlugin.invokeFunction(RegisterablePlugin.java:178)
    at com.prosc.fmkit.Plugin.invokeFunctionNoErrors(Plugin.java:374)
    at com.prosc.fmkit.PluginBridge2$1.run(PluginBridge2.java:1059)
    at com.prosc.fmkit.PluginBridge2.doFunction(PluginBridge2.java:1072)
    at com.prosc.fmkit.PipeChild.lambda$handleMessage$9(PipeChild.java:297)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Server schedules and PSOS both report this, instead:

com.prosc.fmkit.FmCalculationException: 106
at com.prosc.fmkit.PluginContext.evaluateExpression(PluginContext.java:192)
at com.prosc.beanshell.FMPro.getContainerStream(FMPro.java:57)
at com.prosc.beanshell.FMPro$getContainerStream.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at Script1.run(Script1.groovy:1)
at com.prosc.beanshell.GroovyFunction._invoke(GroovyFunction.java:158)
at com.prosc.beanshell.GroovyFunction.invoke(GroovyFunction.java:136)
at com.prosc.fmkit.Plugin.invokeFunction(Plugin.java:398)
at com.prosc.fmkit.RegisterablePlugin.invokeFunction(RegisterablePlugin.java:178)
at com.prosc.fmkit.Plugin.invokeFunctionNoErrors(Plugin.java:374)
at com.prosc.fmkit.PluginBridge2$1.run(PluginBridge2.java:1059)
at com.prosc.fmkit.PluginBridge2.doFunction(PluginBridge2.java:1072)
at com.prosc.fmkit.PipeChild.lambda$handleMessage$9(PipeChild.java:297)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

I get the same results when I reduce the function to just this:

InputStream fieldStream = fmpro.getContainerStream(containerFieldName);
return 1;

Any thoughts?

@jbante

Works as expected on my MacBook with 5.052....

john

 

 

Screen Shot 2017-09-21 at 07.24.02.png

Edited by john renfrew

  • Author

Is there a ScriptMaster version "5.052"? I just downloaded it fresh from 360Works yesterday, and it's only 5.05 (no 2).

In the link download from here, near the ned of this thread...

 

 

  • Author

Now running ScriptMaster v5.052, I get the exact same error in all three contexts (Mac client, Windows client, Windows server).

Hi jbante,

Try our latest development build and let us know if you continue to have issues. You can download it here.

  • Author

The 5.06 build goes back to working normally in my tests on Mac & Windows clients. I'm reluctant to put this on the server without knowing how production-ready this build is.

  • Author

Is there an estimate of when a production version of a new build might be available? Weeks? Months?

I can't say for certain when we will be pushing new versions of the plugins to our website. We have been holding off while we wrapped up the last few issues we had. We have finished those  so we may be pushing new versions within the next week or two.

  • Author

Thank you for the update!

  • 4 weeks later...

Hi!

On 21. September 2017 at 7:56 PM, jbante said:

The 5.06 build goes back to working normally in my tests on Mac & Windows clients. I'm reluctant to put this on the server without knowing how production-ready this build is.

Tried Version 5.06 on my Windows 2012 R2 server. Unfortunately still getting FmCalculationException 106 on fmpro.getContainerStream.

Regards,

Thorsten

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.