strict mode

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

User avatar
mw_playstudios
Posts: 3
Joined: 28 Jan 2019, 16:30

strict mode

Postby mw_playstudios » 28 Jan 2019, 16:34

I have StrictMode enabled in my Android project.
It is complaining about many sfs2x problems.
In particular, sfs2x.client.util.ByteArray the Deflater does not 'end' in 'compress' method, and Inflater does not 'end' in 'uncompress' method.
User avatar
Lapo
Site Admin
Posts: 20900
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: strict mode

Postby Lapo » 28 Jan 2019, 16:43

Hi,
I am not sure what you mean by "Strict Mode". Are you referring to this?
https://developer.android.com/reference ... StrictMode
In particular, sfs2x.client.util.ByteArray the Deflater does not 'end' in 'compress' method, and Inflater does not 'end' in 'uncompress' method.

I don't know what this means. Can you provide more details?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
mw_playstudios
Posts: 3
Joined: 28 Jan 2019, 16:30

Re: strict mode

Postby mw_playstudios » 29 Jan 2019, 07:41

Yes, that strict mode.
We are checking for memory leaks amongst other things.
It is logging the following:

Code: Select all

D/StrictMode: StrictMode policy violation: android.os.strictmode.LeakedClosableViolation: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
        at android.os.StrictMode$AndroidCloseGuardReporter.report(StrictMode.java:1786)
        at dalvik.system.CloseGuard.warnIfOpen(CloseGuard.java:264)
        at java.util.zip.Inflater.finalize(Inflater.java:398)
        at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250)
        at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237)
        at java.lang.Daemons$Daemon.run(Daemons.java:103)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.Throwable: Explicit termination method 'end' not called
        at dalvik.system.CloseGuard.open(CloseGuard.java:221)
        at java.util.zip.Inflater.<init>(Inflater.java:114)
        at java.util.zip.Inflater.<init>(Inflater.java:121)
        at sfs2x.client.util.ByteArray.uncompress(ByteArray.java:98)
        at sfs2x.client.core.SFSIOHandler.uncompress(SFSIOHandler.java:534)
        at sfs2x.client.core.SFSIOHandler.handlePacketData(SFSIOHandler.java:319)
        at sfs2x.client.core.SFSIOHandler.onDataRead(SFSIOHandler.java:144)
        at sfs2x.client.bitswarm.BitSwarmClient.onSocketData(BitSwarmClient.java:408)
        at sfs2x.client.bitswarm.BitSwarmClient.access$2(BitSwarmClient.java:402)
        at sfs2x.client.bitswarm.BitSwarmClient$3.dispatch(BitSwarmClient.java:117)
        at sfs2x.client.core.EventDispatcher.dispatchEvent(EventDispatcher.java:60)
        at sfs2x.client.core.sockets.TCPSocketLayer.callOnData(TCPSocketLayer.java:195)
        at sfs2x.client.core.sockets.TCPSocketLayer.handleBinaryData(TCPSocketLayer.java:188)
        at sfs2x.client.core.sockets.TCPSocketLayer.access$7(TCPSocketLayer.java:186)
        at sfs2x.client.core.sockets.TCPSocketLayer$NettyIOHandler.messageReceived(TCPSocketLayer.java:359)
        at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
        at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:350)
        at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281)
        at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201)
        at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
        at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764) 


We are more than happy to patch this for you if we could have access to the sources,,,
User avatar
Lapo
Site Admin
Posts: 20900
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: strict mode

Postby Lapo » 29 Jan 2019, 10:30

Thanks for clarifying.
You can download an update of the specific JAR file from here.
Just replace the old jar file you're currently using with this one, and let us know if it solves the problem. If it does we'll release an official update.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
mw_playstudios
Posts: 3
Joined: 28 Jan 2019, 16:30

Re: strict mode

Postby mw_playstudios » 29 Jan 2019, 13:49

tx, seems to have resolved.

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 1 guest