July 29, 20169 yr 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?
July 31, 20169 yr 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;
September 20, 20178 yr 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?
September 21, 20178 yr @jbante Works as expected on my MacBook with 5.052.... john Edited September 21, 20178 yr by john renfrew
September 21, 20178 yr Author Is there a ScriptMaster version "5.052"? I just downloaded it fresh from 360Works yesterday, and it's only 5.05 (no 2).
September 21, 20178 yr Author Now running ScriptMaster v5.052, I get the exact same error in all three contexts (Mac client, Windows client, Windows server).
September 21, 20178 yr Hi jbante, Try our latest development build and let us know if you continue to have issues. You can download it here.
September 21, 20178 yr 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.
September 25, 20178 yr Author Is there an estimate of when a production version of a new build might be available? Weeks? Months?
September 28, 20178 yr 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.
October 23, 20178 yr 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