Nothing wrong ;-) but I'd would prefer to also refactor:

System.setProperty("java.ext.dirs", testJavaExtDirs);

Not in my code like this:

this.setJavaExtDirs(saveJavaExtDirs);

But in SystemUtils like this:

SystemUtils.setJavaExtDirs(saveJavaExtDirs);

Which would also avoid having to call SystemUtils.reloadProperties() in the
first place. So, from my one example's POV, the ugliness gets x2. The
reloadProperties is still useful of course to workaround other setProperty
call sites not in the control of the developer.

Gary


> -----Original Message-----
> From: Todd V. Jonker [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 16, 2004 13:59
> To: Jakarta Commons Developers List
> Subject: RE: [lang][proposal] SystemUtils property out of sync problem;
> add set methods.
> 
> What's wrong with the changes inlined below?
> 
> >     public void testJavaExtDirDoesNotExist() {
> >         String saveJavaExtDirs = SystemUtils.JAVA_EXT_DIRS;
> >         try {
> >             String testJavaExtDirs = "...";
> >             System.setProperty("java.ext.dirs", testJavaExtDirs);
>               SystemUtils.reloadProperties();
> >             // The real test starts here...
> >         } finally {
> >             System.setProperty("java.ext.dirs", saveJavaExtDirs);
>               SystemUtils.reloadProperties();
> >         }
> >     }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to