Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Uncaught NoninvertibleTransformException

1 view
Skip to first unread message

Andres Q

unread,
Apr 28, 2020, 7:51:26 PM4/28/20
to pl...@googlegroups.com
Hi,

I saw a couple of error logs from users, and was also able to reproduce locally (both in java & android backend) the following error (unfortunately I was unable to reproduce it consistently, it just happened a couple of times)

pythagoras.util.NoninvertibleTransformException: affine [+0.0 +0.0 +0.0 +0.0 +265.349+101.852]
  at pythagoras.f.AffineTransform.inverseTransform(AffineTransform.java:339)
  at playn.scene.LayerUtil.parentToLayer(LayerUtil.java:105)
  at playn.scene.LayerUtil.screenToLayer(LayerUtil.java:87)
  at playn.scene.Interaction.dispatch(Interaction.java:116)
  at playn.scene.Pointer$Dispatcher.onEmit(Pointer.java:87)
  at playn.scene.Pointer$Dispatcher.onEmit(Pointer.java:68)
  at react.AbstractSignal$4.notify(AbstractSignal.java:87)
  at react.Reactor.notify(Reactor.java:139)
  at react.AbstractSignal.notifyEmit(AbstractSignal.java:82)
  at react.Signal.emit(Signal.java:25)
  at playn.core.Platform.dispatchEvent(Platform.java:110)
  at playn.core.Pointer.forward(Pointer.java:149)
  at playn.core.Pointer$1TouchConverter$2.onEmit(Pointer.java:95)
  at playn.core.Pointer$1TouchConverter$2.onEmit(Pointer.java:92)
  at react.AbstractSignal$4.notify(AbstractSignal.java:87)
  at react.Reactor.notify(Reactor.java:139)
  at react.AbstractSignal.notifyEmit(AbstractSignal.java:82)
  at react.Signal.emit(Signal.java:25)
  at playn.android.GameActivity.onWindowFocusChanged(GameActivity.java:86)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged(PhoneWindow.java:2462)
  at android.view.View.dispatchWindowFocusChanged(View.java:7578)
  at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:962)
  at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3115)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:5103)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:525)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  at dalvik.system.NativeStart.main(Native Method)

Looking at the code, I see that Interaction.dispatch (line 116) is calling LayerUtil.screenToLayer without wrapping it in a try/catch (like it's done in GroupLayer.hitTestDefault, for example)

Is this maybe a bug in PlayN?

Michael Bayne

unread,
Apr 29, 2020, 2:32:38 PM4/29/20
to pl...@googlegroups.com
In the GroupLayer case, it is scanning its children to see which of them is "hit" by a point. So if one of the children has a non-invertible matrix, there might still be other children that are actually hit by the point, so it makes sense to ignore the weird child and move on.

In the case of Interaction, we have already decided that some Layer is the "hit" layer, and now we're just translating the pointer coordinates into the coordinates of the Layer before processing the interaction handler. If that process somehow fails due to a non-invertible matrix, we cannot translate the coordinates and have nothing to supply to the interaction handler for those values.

I would not want to provide bogus values to the interaction handler because it should be able to trust that if it is given coordinates, they are valid. So instead an exception is thrown, which is caught by Platform.dispatchEvent and logged, and the interaction is effectively dropped. We could drop the interaction "silently" instead by catching NonInvertibleTransformException in Interaction.dispatch and then just returning without processing the interaction, but we would not be improving things. We'd just be hiding an error from the developer. The game doesn't "crash" in either case, the pointer event is simply ignored. But at least with the logged exception you know something is going wrong and can try to fix it.

The most common case for non-invertible matrices is if one or the other of a layer's scale components is 0. So you can check to see if that can happen in your code.

--

---
You received this message because you are subscribed to the Google Groups "PlayN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to playn+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/playn/CAJrxdruqN1EdgT62jzX02YXLmte_guG0sXS20kJv4DRCtVEZig%40mail.gmail.com.


--

Andres Q

unread,
Apr 29, 2020, 3:36:15 PM4/29/20
to pl...@googlegroups.com
I'll check because I was able to reproduce it on the game over part where all the emojis scale to zero and disappear.

The problem I'm facing is that I'm using ACRA (https://github.com/ACRA/acra) to allow the player to send a report if an unhandled exception is thrown by the game, and I see this exception on the logs quite some time (in the tens). So now I'm puzzled as to why is this error being captured by ACRA if it's catched by Platform.dispatchEvent
Reply all
Reply to author
Forward
0 new messages