Uploaded image for project: 'JSword'
  1. JSword
  2. JS-212

Android 4 incompatibility in CallContext (fixed applied locally)

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7
    • Component/s: o.c.common.util
    • Labels:
      None

      Description

      I had to amend my version of CallContext before a recent And Bible release because of an incompatibility with the latest version of Android (4.0/ICS) that prevented And Bible from starting up.

      Android 4.0 does not return anything from getClassContext() so using the default JSword code causes Exception on start up. For now I commented out the call and replaced it with a reference to Thread.getStackTrace(). I did this about a month ago and some of the detail now escapes me but I stopped CallContext extending SecurityManager and replaced getCallingClass with the following.

      public static Class<?> getCallingClass(int i) {
      try {
      // Android 4.0 does not return anything from getClassContext() so using the default JSword code causes Exception in Initializer resulting from an NPE
      return Class.forName(Thread.currentThread().getStackTrace()[CALL_CONTEXT_OFFSET + i].getClassName());
      // return instance().getClassContext()[CALL_CONTEXT_OFFSET + i];

      It is a bit messy but I thought it best to include the live version. I have also attached the actual class I now use. There may be an inefficiency in the above so it may be that we need to differentiate between Android and other environments if JSword is updated.

      The above problem was a bit of a surprise because it works fine in all versions of Android until 4.0

        Attachments

          Activity

            People

            • Assignee:
              dmsmith DM Smith
              Reporter:
              mjdenham Martin Denham
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: