зеркало из https://github.com/mono/ikvm-fork.git
- More filtering regression fixes.
- Synchronize on SyncRoot for Exception.Data collection access.
This commit is contained in:
Родитель
9085b75ad8
Коммит
82730f124b
|
@ -154,19 +154,23 @@ namespace IKVM.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// skip java.lang.Throwable.__<map>
|
else
|
||||||
|
{
|
||||||
|
// Skip java.lang.Throwable.__<map> and other mapping methods, because we need to be able to remove the frame
|
||||||
|
// that called map (if it is the same as where the exception was caught).
|
||||||
while (tracePart2.FrameCount > skip && IsHideFromJava(tracePart2.GetFrame(skip).GetMethod()))
|
while (tracePart2.FrameCount > skip && IsHideFromJava(tracePart2.GetFrame(skip).GetMethod()))
|
||||||
{
|
{
|
||||||
skip++;
|
skip++;
|
||||||
}
|
}
|
||||||
if (tracePart1 != null &&
|
if (tracePart1.FrameCount > 0 &&
|
||||||
tracePart1.FrameCount > 0 &&
|
|
||||||
tracePart2.FrameCount > skip &&
|
tracePart2.FrameCount > skip &&
|
||||||
tracePart1.GetFrame(tracePart1.FrameCount - 1).GetMethod() == tracePart2.GetFrame(skip).GetMethod())
|
tracePart1.GetFrame(tracePart1.FrameCount - 1).GetMethod() == tracePart2.GetFrame(skip).GetMethod())
|
||||||
{
|
{
|
||||||
|
// skip the caller of the map method
|
||||||
skip++;
|
skip++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Append(list, tracePart2, skip);
|
Append(list, tracePart2, skip);
|
||||||
}
|
}
|
||||||
if (cleanStackTrace && list.Count > 0)
|
if (cleanStackTrace && list.Count > 0)
|
||||||
|
@ -200,7 +204,6 @@ namespace IKVM.Internal
|
||||||
(typeof(MethodBase).IsAssignableFrom(type)
|
(typeof(MethodBase).IsAssignableFrom(type)
|
||||||
|| type == typeof(RuntimeMethodHandle)
|
|| type == typeof(RuntimeMethodHandle)
|
||||||
|| (type == typeof(Throwable) && m.Name == "instancehelper_fillInStackTrace")
|
|| (type == typeof(Throwable) && m.Name == "instancehelper_fillInStackTrace")
|
||||||
|| (type == typeof(ikvm.runtime.Util) && m.Name == "mapException")
|
|
||||||
|| (m.Name == "ToJava" && typeof(RetargetableJavaException).IsAssignableFrom(type))
|
|| (m.Name == "ToJava" && typeof(RetargetableJavaException).IsAssignableFrom(type))
|
||||||
|| IsHideFromJava(m)
|
|| IsHideFromJava(m)
|
||||||
|| IsPrivateScope(m))) // NOTE we assume that privatescope methods are always stubs that we should exclude
|
|| IsPrivateScope(m))) // NOTE we assume that privatescope methods are always stubs that we should exclude
|
||||||
|
@ -290,7 +293,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
private static bool IsHideFromJava(MethodBase mb)
|
private static bool IsHideFromJava(MethodBase mb)
|
||||||
{
|
{
|
||||||
return NativeCode.sun.reflect.Reflection.IsHideFromJava(mb);
|
return NativeCode.sun.reflect.Reflection.IsHideFromJava(mb) || (mb.DeclaringType == typeof(ikvm.runtime.Util) && mb.Name == "mapException");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string getClassNameFromType(Type type)
|
private static string getClassNameFromType(Type type)
|
||||||
|
@ -571,7 +574,7 @@ namespace IKVM.Internal
|
||||||
IDictionary data = x.Data;
|
IDictionary data = x.Data;
|
||||||
if (data != null && !data.IsReadOnly)
|
if (data != null && !data.IsReadOnly)
|
||||||
{
|
{
|
||||||
lock (data)
|
lock (data.SyncRoot)
|
||||||
{
|
{
|
||||||
eih = (ExceptionInfoHelper)data[EXCEPTION_DATA_KEY];
|
eih = (ExceptionInfoHelper)data[EXCEPTION_DATA_KEY];
|
||||||
}
|
}
|
||||||
|
@ -610,7 +613,7 @@ namespace IKVM.Internal
|
||||||
IDictionary data = x.Data;
|
IDictionary data = x.Data;
|
||||||
if (data != null && !data.IsReadOnly)
|
if (data != null && !data.IsReadOnly)
|
||||||
{
|
{
|
||||||
lock (data)
|
lock (data.SyncRoot)
|
||||||
{
|
{
|
||||||
data[EXCEPTION_DATA_KEY] = eih;
|
data[EXCEPTION_DATA_KEY] = eih;
|
||||||
}
|
}
|
||||||
|
@ -619,6 +622,7 @@ namespace IKVM.Internal
|
||||||
}
|
}
|
||||||
|
|
||||||
// this method is *only* for .NET exceptions (i.e. types not derived from java.lang.Throwable)
|
// this method is *only* for .NET exceptions (i.e. types not derived from java.lang.Throwable)
|
||||||
|
[HideFromJava]
|
||||||
internal static void fillInStackTrace(Exception x)
|
internal static void fillInStackTrace(Exception x)
|
||||||
{
|
{
|
||||||
#if !FIRST_PASS
|
#if !FIRST_PASS
|
||||||
|
@ -628,7 +632,7 @@ namespace IKVM.Internal
|
||||||
IDictionary data = x.Data;
|
IDictionary data = x.Data;
|
||||||
if (data != null && !data.IsReadOnly)
|
if (data != null && !data.IsReadOnly)
|
||||||
{
|
{
|
||||||
lock (data)
|
lock (data.SyncRoot)
|
||||||
{
|
{
|
||||||
data[EXCEPTION_DATA_KEY] = eih;
|
data[EXCEPTION_DATA_KEY] = eih;
|
||||||
}
|
}
|
||||||
|
@ -645,7 +649,6 @@ namespace IKVM.Internal
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// also used by ikvm.extensions.ExtensionMethods.printStackTrace()
|
|
||||||
internal static Exception UnmapException(Exception x)
|
internal static Exception UnmapException(Exception x)
|
||||||
{
|
{
|
||||||
#if FIRST_PASS
|
#if FIRST_PASS
|
||||||
|
@ -762,7 +765,7 @@ namespace IKVM.Internal
|
||||||
IDictionary data = x.Data;
|
IDictionary data = x.Data;
|
||||||
if (data != null && !data.IsReadOnly)
|
if (data != null && !data.IsReadOnly)
|
||||||
{
|
{
|
||||||
lock (data)
|
lock (data.SyncRoot)
|
||||||
{
|
{
|
||||||
if (!data.Contains(EXCEPTION_DATA_KEY))
|
if (!data.Contains(EXCEPTION_DATA_KEY))
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче