Skip to content
Permalink
Browse files

test: do not throw exceptions in utilities

  • Loading branch information...
rhwood committed Aug 7, 2019
1 parent 35418e8 commit 2a5f737cf2651ffbfdb6b5b1c52c60525a465fb7
Showing with 9 additions and 7 deletions.
  1. +9 −7 java/test/jmri/util/JUnitUtil.java
@@ -607,14 +607,16 @@ static public boolean fasterWaitFor(ReleaseUntil condition) {
* {@link jmri.util.FileUtilSupport} object (used by
* {@link jmri.util.FileUtil}) to the default settings/user files path for
* tests of {@code git-working-copy/temp}.
* @throws java.lang.NoSuchFieldException if unable to reset
* @throws java.lang.IllegalAccessException if unable to reset
*/
public static void resetFileUtilSupport() throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
Field field = FileUtilSupport.class.getDeclaredField("defaultInstance");
field.setAccessible(true);
field.set(null, null);
FileUtilSupport.getDefault().setUserFilesPath(ProfileManager.getDefault().getActiveProfile(), FileUtil.getPreferencesPath());
public static void resetFileUtilSupport() {
try {
Field field = FileUtilSupport.class.getDeclaredField("defaultInstance");
field.setAccessible(true);
field.set(null, null);
FileUtilSupport.getDefault().setUserFilesPath(ProfileManager.getDefault().getActiveProfile(), FileUtil.getPreferencesPath());
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
log.error("Exception resetting FileUtilSupport", ex);
}
}

static public interface ReleaseUntil {

0 comments on commit 2a5f737

Please sign in to comment.
You can’t perform that action at this time.