Exemple #1
0
 public OperationApplicationException(java.lang.Throwable arg0)
     : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.content.OperationApplicationException.staticClass, global::android.content.OperationApplicationException._OperationApplicationException1734, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     Init(@__env, handle);
 }
Exemple #2
0
 public InflateException(java.lang.Throwable arg0)
     : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.view.InflateException.staticClass, global::android.view.InflateException._InflateException8765, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     Init(@__env, handle);
 }
Exemple #3
0
        internal static void writeObject(Exception x, ObjectOutputStream s)
        {
#if !FIRST_PASS
            lock (x)
            {
                ObjectOutputStream.PutField fields = s.putFields();
                Throwable _thisJava = x as Throwable;
                if (_thisJava == null)
                {
                    fields.put("detailMessage", x.Message);
                    fields.put("cause", x.InnerException);
                    // suppressed exceptions are not supported on CLR exceptions
                    fields.put("suppressedExceptions", null);
                    fields.put("stackTrace", getOurStackTrace(x));
                }
                else
                {
                    fields.put("detailMessage", _thisJava.detailMessage);
                    fields.put("cause", _thisJava.cause);
                    fields.put("suppressedExceptions", _thisJava.suppressedExceptions);
                    getOurStackTrace(x);
                    fields.put("stackTrace", _thisJava.stackTrace ?? java.lang.ThrowableHelper.SentinelHolder.STACK_TRACE_SENTINEL);
                }
                s.writeFields();
            }
#endif
        }
Exemple #4
0
        internal static void addSuppressed(Exception _this, Exception x)
        {
#if !FIRST_PASS
            lock (_this)
            {
                if (_this == x)
                {
                    throw new java.lang.IllegalArgumentException("Self-suppression not permitted", x);
                }
                if (x == null)
                {
                    throw new java.lang.NullPointerException("Cannot suppress a null exception.");
                }
                Throwable _thisJava = _this as Throwable;
                if (_thisJava == null)
                {
                    // we ignore suppressed exceptions for non-Java exceptions
                }
                else
                {
                    if (_thisJava.suppressedExceptions == null)
                    {
                        return;
                    }
                    if (_thisJava.suppressedExceptions == Throwable.SUPPRESSED_SENTINEL)
                    {
                        _thisJava.suppressedExceptions = new java.util.ArrayList();
                    }
                    _thisJava.suppressedExceptions.add(x);
                }
            }
#endif
        }
Exemple #5
0
        internal static Exception[] getSuppressed(Exception _this)
        {
#if FIRST_PASS
            return(null);
#else
            lock (_this)
            {
                Throwable _thisJava = _this as Throwable;
                if (_thisJava == null)
                {
                    // we ignore suppressed exceptions for non-Java exceptions
                    return(EMPTY_THROWABLE_ARRAY);
                }
                else
                {
                    if (_thisJava.suppressedExceptions == Throwable.SUPPRESSED_SENTINEL ||
                        _thisJava.suppressedExceptions == null)
                    {
                        return(EMPTY_THROWABLE_ARRAY);
                    }
                    return((Exception[])_thisJava.suppressedExceptions.toArray(EMPTY_THROWABLE_ARRAY));
                }
            }
#endif
        }
Exemple #6
0
        private static void SetStackTraceImpl(Exception x, StackTraceElement[] stackTrace)
        {
#if !FIRST_PASS
            Throwable _this = x as Throwable;
            if (_this == null)
            {
                ExceptionInfoHelper eih  = new ExceptionInfoHelper(stackTrace);
                IDictionary         data = x.Data;
                if (data != null && !data.IsReadOnly)
                {
                    lock (data.SyncRoot)
                    {
                        data[EXCEPTION_DATA_KEY] = eih;
                    }
                }
            }
            else
            {
                lock (_this)
                {
                    if (_this.stackTrace == null && _this.tracePart1 == null && _this.tracePart2 == null)
                    {
                        return;
                    }
                    _this.stackTrace = stackTrace;
                }
            }
#endif
        }
        internal static string getLocalizedMessage(Exception x)
        {
#if FIRST_PASS
            return(null);
#else
            return(Throwable.instancehelper_getMessage(x));
#endif
        }
        internal static void readObject(Exception x, ObjectInputStream s)
        {
#if !FIRST_PASS
            ObjectInputStream.GetField fields = s.readFields();
            initThrowable(x, fields.get("detailMessage", null), fields.get("cause", null));
            StackTraceElement[] stackTrace = (StackTraceElement[])fields.get("stackTrace", null);
            Throwable.instancehelper_setStackTrace(x, stackTrace == null ? new StackTraceElement[0] : stackTrace);
#endif
        }
Exemple #9
0
        public static java.lang.Throwable TranslateException(java.lang.Throwable exc)
        {
            System.Exception newExc = null;

            if (exc is system.Exception)
            {
                return(exc);
            }

            var dlg = (ExceptionTranslator)exceptionMap.get(
                ((java.lang.Object)(object) exc).getClass());

            if (dlg != null)
            {
                newExc = dlg(exc);
            }

            if (newExc == null)
            {
                if (exc is java.lang.NullPointerException)
                {
                    newExc = new System.NullReferenceException();
                }

                /*if (exc is java.lang.IllegalArgumentException)
                 *  newExc = new System.ArgumentException();*/

                if (exc is java.lang.ArithmeticException && exc.getMessage() == "/ by zero")
                {
                    newExc = new System.DivideByZeroException(); // "Attempted to divide by zero."
                }
                // also: IndexOutOfRangeException.  define in Array?  not necessarily.
                // fixme:  move these to specialized exceptionMap ?

                if (newExc == null)
                {
                    return(exc);
                }

                /*if (newExc == null)
                 * {
                 *  // any throwable not deriving from system.Exception is assumed
                 *  // to be coming from the JVM or java code.  If it was not mapped
                 *  // to some known .NET exception, wrap it in an ExternalException
                 *  // newExc = new Exception("Java exception: " + exc.GetType());
                 *  // fixme System.Runtime.InteropServices.ExternalException ???
                 *  Console.WriteLine("Created New Exception: ");
                 *  Console.WriteLine(newExc);
                 *  Console.WriteLine("Continuing...");
                 * }*/
            }

            java.lang.Throwable newThrowable = (java.lang.Throwable)newExc;
            newThrowable.setStackTrace(exc.getStackTrace());
            return(newThrowable);
        }
        private static List <String> BuildStackTrace(Exception x)
        {
            List <String> list = new List <String>();

            list.Add(x.ToString());
            StackTraceElement[] stack = Throwable.instancehelper_getStackTrace(x);
            for (int i = 0; i < stack.Length; i++)
            {
                list.Add("\tat " + stack[i]);
            }
            Exception cause = Throwable.instancehelper_getCause(x);

            while (cause != null)
            {
                list.Add("Caused by: " + cause);

                // Cause stacktrace
                StackTraceElement[] parentStack = stack;
                stack = Throwable.instancehelper_getStackTrace(cause);
                bool equal = false;                 // Is rest of stack equal to parent frame?
                for (int i = 0; i < stack.Length && !equal; i++)
                {
                    // Check if we already printed the rest of the stack
                    // since it was the tail of the parent stack
                    int remaining     = stack.Length - i;
                    int element       = i;
                    int parentElement = parentStack.Length - remaining;
                    equal = parentElement >= 0 && parentElement < parentStack.Length;
                    while (equal && element < stack.Length)
                    {
                        if (stack[element].equals(parentStack[parentElement]))
                        {
                            element++;
                            parentElement++;
                        }
                        else
                        {
                            equal = false;
                        }
                    }
                    // Print stacktrace element or indicate the rest is equal
                    if (!equal)
                    {
                        list.Add("\tat " + stack[i]);
                    }
                    else
                    {
                        list.Add("\t... " + remaining + " more");
                        break;                         // from stack printing for loop
                    }
                }
                cause = Throwable.instancehelper_getCause(cause);
            }
            return(list);
        }
Exemple #11
0
 public virtual global::java.lang.Throwable initCause(java.lang.Throwable arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallObjectMethod(this.JvmHandle, global::java.lang.Throwable._initCause13410, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.Throwable);
     }
     else
     {
         return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallNonVirtualObjectMethod(this.JvmHandle, global::java.lang.Throwable.staticClass, global::java.lang.Throwable._initCause13410, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.Throwable);
     }
 }
        internal static StackTraceElement[] getOurStackTrace(Exception x)
        {
#if FIRST_PASS
            return(null);
#else
#if !WINRT
            Throwable _this = x as Throwable;
            if (_this == null)
            {
                lock (x)
                {
                    ExceptionInfoHelper eih  = null;
                    IDictionary         data = x.Data;
                    if (data != null && !data.IsReadOnly)
                    {
                        lock (data.SyncRoot)
                        {
                            eih = (ExceptionInfoHelper)data[EXCEPTION_DATA_KEY];
                        }
                    }
                    if (eih == null)
                    {
                        return(Throwable.UNASSIGNED_STACK);
                    }
                    return(eih.get_StackTrace(x));
                }
            }
            else
            {
                lock (_this)
                {
                    if (_this.stackTrace == Throwable.UNASSIGNED_STACK ||
                        (_this.stackTrace == null && (_this.tracePart1 != null || _this.tracePart2 != null)))
                    {
#if false
                        ExceptionInfoHelper eih = new ExceptionInfoHelper(_this.tracePart1, _this.tracePart2);
                        _this.stackTrace = eih.get_StackTrace(x);
                        _this.tracePart1 = null;
                        _this.tracePart2 = null;
#else
                        throw new NotImplementedException("e.h");
#endif
                    }
                }
                return(_this.stackTrace ?? Throwable.UNASSIGNED_STACK);
            }
#else
            //throw new NotImplementedException("3");
            System.Diagnostics.Debug.WriteLine(x);
            return(Throwable.UNASSIGNED_STACK);
#endif
#endif
        }
Exemple #13
0
 public virtual void uncaughtException(java.lang.Thread arg0, java.lang.Throwable arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::java.lang.ThreadGroup._uncaughtException13379, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::java.lang.ThreadGroup.staticClass, global::java.lang.ThreadGroup._uncaughtException13379, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
Exemple #14
0
 public virtual void stop(java.lang.Throwable arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::java.lang.Thread._stop13344, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::java.lang.Thread.staticClass, global::java.lang.Thread._stop13344, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
 }
Exemple #15
0
        private void _UnhandledExceptionHandler(java.lang.Thread thread,
                                                java.lang.Throwable exc)
        {
            exc = system.Util.TranslateException(exc);
            var evt = _UnhandledExceptionEvent;

            if (evt != null)
            {
                var args = new UnhandledExceptionEventArgs(exc, true);
                evt(theInstance, args);
            }
            exc.printStackTrace();
        }
        internal static string toString(Exception x)
        {
#if FIRST_PASS
            return(null);
#else
            string message = Throwable.instancehelper_getLocalizedMessage(x);
            if (message == null)
            {
                return(java.lang.Object.instancehelper_getClass(x).getName());
            }
            return(java.lang.Object.instancehelper_getClass(x).getName() + ": " + message);
#endif
        }
Exemple #17
0
        public void Deserialise(Corba.DataInputStream stream)
        {
            stream.read_octet();   // ignore format version: java RMI specific
            stream.read_boolean(); // ignore default read object: java RMI specific

            m_cause = (java.lang.Throwable)stream.read_ValueOfType(typeof(java.lang.Throwable));
            m_msg   = stream.read_WStringValue();

            object boxedTrace = stream.read_Value();

            if (boxedTrace != null)
            {
                m_trace = (StackTraceElement[])((BoxedValueBase)boxedTrace).Unbox();
            }
        }
        internal static void writeObject(Exception x, ObjectOutputStream s)
        {
#if !FIRST_PASS
            lock (x)
            {
                ObjectOutputStream.PutField fields = s.putFields();
                fields.put("detailMessage", Throwable.instancehelper_getMessage(x));
                Exception cause = Throwable.instancehelper_getCause(x);
                if (cause == null && x is Throwable)
                {
                    cause = ((Throwable)x).cause;
                }
                fields.put("cause", cause);
                fields.put("stackTrace", Throwable.instancehelper_getStackTrace(x));
                s.writeFields();
            }
#endif
        }
Exemple #19
0
        internal static StackTraceElement[] getOurStackTrace(Exception x)
        {
#if FIRST_PASS
            return(null);
#else
            Throwable _this = x as Throwable;
            if (_this == null)
            {
                lock (x)
                {
                    ExceptionInfoHelper eih  = null;
                    IDictionary         data = x.Data;
                    if (data != null && !data.IsReadOnly)
                    {
                        lock (data.SyncRoot)
                        {
                            eih = (ExceptionInfoHelper)data[EXCEPTION_DATA_KEY];
                        }
                    }
                    if (eih == null)
                    {
                        return(Throwable.UNASSIGNED_STACK);
                    }
                    return(eih.get_StackTrace(x));
                }
            }
            else
            {
                lock (_this)
                {
                    if (_this.stackTrace == Throwable.UNASSIGNED_STACK ||
                        (_this.stackTrace == null && (_this.tracePart1 != null || _this.tracePart2 != null)))
                    {
                        ExceptionInfoHelper eih = new ExceptionInfoHelper(_this.tracePart1, _this.tracePart2);
                        _this.stackTrace = eih.get_StackTrace(x);
                        _this.tracePart1 = null;
                        _this.tracePart2 = null;
                    }
                }
                return(_this.stackTrace ?? Throwable.UNASSIGNED_STACK);
            }
#endif
        }
Exemple #20
0
 public Throwable(java.lang.Throwable arg0)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv         @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.lang.Throwable.staticClass, global::java.lang.Throwable._Throwable13419, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     Init(@__env, handle);
 }
        internal static T MapException <T>(Exception x, bool remap, bool unused)
            where T : Exception
        {
#if FIRST_PASS
            return(null);
#else
            Exception org = x;
            bool      nonJavaException = !(x is Throwable);
            if (nonJavaException && remap)
            {
                if (x is TypeInitializationException)
                {
                    return((T)MapTypeInitializeException((TypeInitializationException)x, typeof(T)));
                }
                object    obj      = exceptions.get(x);
                Exception remapped = (Exception)obj;
                if (remapped == null)
                {
                    remapped = Throwable.__mapImpl(x);
                    if (remapped == x)
                    {
                        exceptions.put(x, NOT_REMAPPED);
                    }
                    else
                    {
                        exceptions.put(x, remapped);
                        x = remapped;
                    }
                }
                else if (remapped != NOT_REMAPPED)
                {
                    x = remapped;
                }
            }

            if (IsInstanceOfType <T>(x, remap))
            {
                Throwable t = x as Throwable;
                if (t != null)
                {
                    if (!unused && t.tracePart1 == null && t.tracePart2 == null && t.stackTrace == Throwable.UNASSIGNED_STACK)
                    {
#if !WINRT
                        t.tracePart1 = new StackTrace(org, true);
                        t.tracePart2 = new StackTrace(true);
#else
#endif
                    }
                    if (t != org)
                    {
                        t.original = org;
                        exceptions.remove(org);
                    }

                    //[email protected]("About to try to replace stacktrace in remap");
                    if (t.stackTraceString == null && org.StackTrace != null)
                    {
                        //[email protected]("Replacing stack trace");
                        t.stackTraceString = org.StackTrace;
                    }
                    else if (t.stackTraceString != null)
                    {
                        //[email protected]("t stack trace is not null");
                        t.stackTraceString += "\nOriginating from:\nMessage=" + org.Message + "\n" + org.StackTrace;
                    }
                }
                else
                {
                    IDictionary data = x.Data;
                    if (data != null && !data.IsReadOnly)
                    {
                        lock (data.SyncRoot)
                        {
                            if (!data.Contains(EXCEPTION_DATA_KEY))
                            {
                                data.Add(EXCEPTION_DATA_KEY, new ExceptionInfoHelper(x, true));
                            }
                        }
                    }
                }

                if (nonJavaException && !remap)
                {
                    exceptions.put(x, NOT_REMAPPED);
                }
                return((T)x);
            }
            return(null);
#endif
        }
Exemple #22
0
        internal static void readObject(Exception x, ObjectInputStream s)
        {
#if !FIRST_PASS
            lock (x)
            {
                // when you serialize a .NET exception it gets replaced by a com.sun.xml.internal.ws.developer.ServerSideException,
                // so we know that Exception is always a Throwable
                Throwable _this = (Throwable)x;

                // this the equivalent of s.defaultReadObject();
                ObjectInputStream.GetField fields = s.readFields();
                object          detailMessage     = fields.get("detailMessage", null);
                object          cause             = fields.get("cause", null);
                ConstructorInfo ctor = typeof(Throwable).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(string), typeof(Exception), typeof(bool), typeof(bool) }, null);
                if (cause == _this)
                {
                    ctor.Invoke(_this, new object[] { detailMessage, null, false, false });
                    _this.cause = _this;
                }
                else
                {
                    ctor.Invoke(_this, new object[] { detailMessage, cause, false, false });
                }
                _this.stackTrace           = (StackTraceElement[])fields.get("stackTrace", null);
                _this.suppressedExceptions = (java.util.List)fields.get("suppressedExceptions", null);

                // this is where the rest of the Throwable.readObject() code starts
                if (_this.suppressedExceptions != null)
                {
                    java.util.List suppressed = null;
                    if (_this.suppressedExceptions.isEmpty())
                    {
                        suppressed = Throwable.SUPPRESSED_SENTINEL;
                    }
                    else
                    {
                        suppressed = new java.util.ArrayList(1);
                        for (int i = 0; i < _this.suppressedExceptions.size(); i++)
                        {
                            Exception entry = (Exception)_this.suppressedExceptions.get(i);
                            if (entry == null)
                            {
                                throw new java.lang.NullPointerException("Cannot suppress a null exception.");
                            }
                            if (entry == _this)
                            {
                                throw new java.lang.IllegalArgumentException("Self-suppression not permitted");
                            }
                            suppressed.add(entry);
                        }
                    }
                    _this.suppressedExceptions = suppressed;
                }

                if (_this.stackTrace != null)
                {
                    if (_this.stackTrace.Length == 0)
                    {
                        _this.stackTrace = new StackTraceElement[0];
                    }
                    else if (_this.stackTrace.Length == 1 &&
                             java.lang.ThrowableHelper.SentinelHolder.STACK_TRACE_ELEMENT_SENTINEL.equals(_this.stackTrace[0]))
                    {
                        _this.stackTrace = null;
                    }
                    else
                    {
                        foreach (StackTraceElement elem in _this.stackTrace)
                        {
                            if (elem == null)
                            {
                                throw new java.lang.NullPointerException("null StackTraceElement in serial stream. ");
                            }
                        }
                    }
                }
                else
                {
                    _this.stackTrace = new StackTraceElement[0];
                }
            }
#endif
        }
 public OperationCanceledException(java.lang.String arg0, java.lang.Throwable arg1)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv         @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.accounts.OperationCanceledException.staticClass, global::android.accounts.OperationCanceledException._OperationCanceledException135, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     Init(@__env, handle);
 }
 public __StackTrace()
 {
     this.t = new java.lang.Throwable();
 }
        public __StackTrace()
        {
            this.t = new java.lang.Throwable();

        }
Exemple #26
0
 public RuntimeException(java.lang.Throwable arg0)  : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
 {
     global::MonoJavaBridge.JNIEnv         @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.lang.RuntimeException.staticClass, global::java.lang.RuntimeException._RuntimeException13110, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     Init(@__env, handle);
 }
        public void Deserialise(Corba.DataInputStream stream) {
            stream.read_octet(); // ignore format version: java RMI specific
            stream.read_boolean(); // ignore default read object: java RMI specific
            
            m_cause = (java.lang.Throwable)stream.read_ValueOfType(typeof(java.lang.Throwable));
            m_msg = stream.read_WStringValue();

            object boxedTrace = stream.read_Value();
            if (boxedTrace != null) {
                m_trace = (StackTraceElement[])((BoxedValueBase) boxedTrace).Unbox();
            }
       }
Exemple #28
0
 public static global::java.lang.String getStackTraceString(java.lang.Throwable arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallStaticObjectMethod(android.util.Log.staticClass, global::android.util.Log._getStackTraceString8539, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.String);
 }
Exemple #29
0
 public static int d(java.lang.String arg0, java.lang.String arg1, java.lang.Throwable arg2)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     return(@__env.CallStaticIntMethod(android.util.Log.staticClass, global::android.util.Log._d8533, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2)));
 }
Exemple #30
0
        // X:\jsc.svn\core\ScriptCoreLibAndroidNDK\ScriptCoreLibAndroidNDK\SystemHeaders\android\log.cs

        // X:\jsc.svn\examples\c\android\Test\TestNDK\TestNDK\xNativeActivity.cs
        // "X:\opensource\android-ndk-r10c\platforms\android-21\arch-arm\usr\include\android\log.h"

        public static string getStackTraceString(java.lang.Throwable t)
        {
            return(default(string));
        }
Exemple #31
0
        internal static T MapException <T>(Exception x, bool remap, bool unused)
            where T : Exception
        {
#if FIRST_PASS
            return(null);
#else
            Exception org = x;
            bool      nonJavaException = !(x is Throwable);
            if (nonJavaException && remap)
            {
                if (x is TypeInitializationException)
                {
                    return((T)MapTypeInitializeException((TypeInitializationException)x, typeof(T)));
                }
                object    obj      = exceptions.get(x);
                Exception remapped = (Exception)obj;
                if (remapped == null)
                {
                    remapped = Throwable.__mapImpl(x);
                    if (remapped == x)
                    {
                        exceptions.put(x, NOT_REMAPPED);
                    }
                    else
                    {
                        exceptions.put(x, remapped);
                        x = remapped;
                    }
                }
                else if (remapped != NOT_REMAPPED)
                {
                    x = remapped;
                }
            }

            if (IsInstanceOfType <T>(x, remap))
            {
                Throwable t = x as Throwable;
                if (t != null)
                {
                    if (!unused && t.tracePart1 == null && t.tracePart2 == null && t.stackTrace == Throwable.UNASSIGNED_STACK)
                    {
                        t.tracePart1 = new StackTrace(org, true);
                        t.tracePart2 = new StackTrace(true);
                    }
                    if (t != org)
                    {
                        t.original = org;
                        exceptions.remove(org);
                    }
                }
                else
                {
                    IDictionary data = x.Data;
                    if (data != null && !data.IsReadOnly)
                    {
                        lock (data.SyncRoot)
                        {
                            if (!data.Contains(EXCEPTION_DATA_KEY))
                            {
                                data.Add(EXCEPTION_DATA_KEY, new ExceptionInfoHelper(x, true));
                            }
                        }
                    }
                }

                if (nonJavaException && !remap)
                {
                    exceptions.put(x, NOT_REMAPPED);
                }
                return((T)x);
            }
            return(null);
#endif
        }
        internal static void printStackTrace(Exception x)
        {
#if !FIRST_PASS
            Throwable.instancehelper_printStackTrace(x, java.lang.System.err);
#endif
        }