This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: More loading on Android strangeness


On Fri, Nov 21, 2014 at 3:32 AM, Per Bothner <per@bothner.com> wrote:
> On 11/20/2014 03:13 AM, Ben Simon wrote:
> If it's a "massive stack trace" it could a stack overflow.

OK, it's not that massive :-). There appears to be some sort of
buffering going on, so when adb spits out the stack trace, it spits
out multiple copies.

I thought I had code in place to catch any exception being raised by (load ....)

     (try-catch
      (parameterize ((current-activity (this)))
        (load scm))
      (ex java.lang.Throwable
          ((this):setContentView
           (android.widget.TextView (this)
                                    text: (exn->string ex)))))))

But the NPE seems to slip right by.  Any idea what I'm missing here?

> A possible work-around is to wrap the entire body in a begin:

I did this and got a new stack trace that implied something was not
working about the TextView constructor.  I simplified that by
re-writing the code to not use the keyword notion at construction time
(we can debug this some other time).  After making this change, as
well as being more explicit about casting a TextView to a View, I've
gotten rid of all the warnings. But I now get a new NPE.  Here's the
code:

; -------------------------------------------

(begin

  (require 'android-defs)

  (define (logi . messages)
   (android.util.Log:i "on-create.scm" (apply string-append messages)))

  (logi "Starting")

  (let ((t (android.widget.TextView (current-activity))))
   (t:set-text "Hello World")

   (<android.app.Activity>:setContentView
    (current-activity) (as android.view.View t)))

  (logi "Ending"))


; -------------------------------------------

And here's the stack trace - mean anything to anyone?
3): Starting
 java.lang.NullPointerException
     at gnu.expr.ApplyExp.apply(ApplyExp.java:142)
     at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
     at gnu.mapping.CallContext.getFromContext(CallContext.java:264)
     at gnu.expr.Expression.eval(Expression.java:28)
     at gnu.expr.LetExp.evalVariable(LetExp.java:24)
     at gnu.expr.LetExp.apply(LetExp.java:57)
     at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
     at gnu.mapping.CallContext.getFromContext(CallContext.java:264)
     at gnu.expr.Expression.eval(Expression.java:28)
     at gnu.expr.LetExp.evalVariable(LetExp.java:24)
     at gnu.expr.LetExp.apply(LetExp.java:57)
     at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
     at gnu.mapping.CallContext.getFromContext(CallContext.java:264)
     at gnu.expr.Expression.eval(Expression.java:28)
     at gnu.expr.ApplyExp.apply(ApplyExp.java:141)
     at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:302)
     at gnu.expr.ModuleExp.evalModule(ModuleExp.java:219)
     at kawa.Shell.run(Shell.java:291)
     at kawa.Shell.runFile(Shell.java:523)
     at kawa.standard.load.apply2(load.java:67)
     at kawa.standard.load.apply1(load.java:27)
     at com.benjisimon.appdoh.main.doLoad(main.scm:60)
     at com.benjisimon.appdoh.main.onOptionsItemSelected(main.scm:47)
     at android.app.Activity.onMenuItemSelected(Activity.java:2708)
     at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:1110)
     at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
     at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
     at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
     at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:645)
     at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:210)
     at android.view.View.performClick(View.java:4640)
     at android.view.View$PerformClick.run(View.java:19421)
     at android.os.Handler.handleCallback(Handler.java:733)
     at android.os.Handler.dispatchMessage(Handler.java:95)
     at android.os.Looper.loop(Looper.java:136)
     at android.app.ActivityThread.main(ActivityThread.java:5579)
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:515)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
     at dalvik.system.NativeStart.main(Native Method)

Thanks for all the help!

-- 
Have an idea for software?  I can make it happen -
http://www.ideas2executables.com
My Blog: http://www.BlogByBen.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]