-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write timeout socket / Add the ability to provide own scheduled executor
- Loading branch information
1 parent
2dc4167
commit bcace35
Showing
10 changed files
with
1,051 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
providers/angus-mail/src/test/java/com/sun/mail/test/ReflectionUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.sun.mail.test; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
public final class ReflectionUtil { | ||
private ReflectionUtil() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
public static Field setFieldValue(Object object, | ||
String fieldName, | ||
Object valueTobeSet) throws NoSuchFieldException, IllegalAccessException { | ||
Field field = getField(object.getClass(), fieldName); | ||
field.setAccessible(true); | ||
field.set(object, valueTobeSet); | ||
return field; | ||
} | ||
|
||
public static Object getPrivateFieldValue(Object object, | ||
String fieldName) throws NoSuchFieldException, IllegalAccessException { | ||
Field field = getField(object.getClass(), fieldName); | ||
field.setAccessible(true); | ||
return field.get(object); | ||
} | ||
|
||
private static Field getField(Class mClass, String fieldName) throws NoSuchFieldException { | ||
try { | ||
return mClass.getDeclaredField(fieldName); | ||
} catch (NoSuchFieldException e) { | ||
Class superClass = mClass.getSuperclass(); | ||
if (superClass == null) { | ||
throw e; | ||
} else { | ||
return getField(superClass, fieldName); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.