Skip to Content.
Sympa Menu

grouper-dev - Re: [grouper-dev] System property java.io.tmpdir deleted

Subject: Grouper Developers Forum

List archive

Re: [grouper-dev] System property java.io.tmpdir deleted


Chronological Thread 
  • From: Arnaud Deman <>
  • To: Chris Hyzer <>
  • Cc: Grouper Dev <>
  • Subject: Re: [grouper-dev] System property java.io.tmpdir deleted
  • Date: Wed, 1 Feb 2012 10:28:03 +0100

Hello Chris,

The versions are : Grouper 1.6.3, Java Sun jdk 64 bits 1.6.0_24 and Tomcat 6.


The correction I made was to delete the static member ORIGINAL_TMP_DIR
in the class EhcacheController and to use a local variable instead in
the methods :
EhcacheController::initialize()
and
Hib3DAO::initHibernateIfNotInitted()

With this correction the property is not deleted but if I have well
understood
these methods are called when the Grouper API (via web service in ou case) is
used at the first time.
So I wonder if there is not still a problem if another processus uses the
java.io.tmpdir
property at the same time.

Thanks,
Arnaud.

Example for EhcacheController::initialize() :

public void initialize() {
if (this.mgr == null) {
synchronized(EhcacheController.class) {
final String prevTmpDir = System.getProperty(JAVA_IO_TMPDIR);
if (this.mgr == null) {
URL url = this.getClass().getResource("/grouper.ehcache.xml");
if (url == null) {
throw new RuntimeException("Cant find resourse
/grouper.ehcache.xml, " +
"make sure it is on the classpath");
}

//trying to avoid warning of using the same dir
try {
String newTmpdir = StringUtils.trimToEmpty(prevTmpDir);
if (!newTmpdir.endsWith("\\") && !newTmpdir.endsWith("/")) {
newTmpdir += File.separator;
}
newTmpdir += "grouper_ehcache_auto_" + GrouperUtil.uniqueId();
System.setProperty(JAVA_IO_TMPDIR, newTmpdir);

synchronized(CacheManager.class) {
//now it should be using a unique directory
this.mgr = new CacheManager(url);
}
} finally {
//put tmpdir back
if (prevTmpDir == null) {
System.clearProperty(JAVA_IO_TMPDIR);
} else {
System.setProperty(JAVA_IO_TMPDIR, prevTmpDir);
}
}

}
}
}
}



Le mardi 31 janvier 2012 à 05:43:57, Chris Hyzer a écrit :
> Can you tell me which version and which lines of code you changed from what
> to what?
>
> Thanks,
> Chris
>
> -----Original Message-----
> From:
>
>
> [mailto:]
> On Behalf Of Arnaud Deman
> Sent: Tuesday, January 31, 2012 12:35 PM
> To: Grouper Dev
> Subject: [grouper-dev] System property java.io.tmpdir deleted
>
> Hello,
>
> I have noticed that the system property java.io.tmpdir is deleted by
> the Grouper API. I think it occures because the static member
> ORIGINAL_TMP_DIR in the
> class EhcacheController is null. I have removed the references of this
> member in EhcacheController and Hib3DAO and it seems to correct the pb.
>
> We are using the grouper web service, uPortal and many portlets in the
> same tomcat and it caused very stange bugs. For instance the apache
> library commons-fileupload uses this system property to create temp
> files and the result was java IO exceptions.
>
> Best regards,
> Arnaud.
>
>
> --
> Arnaud Deman
> 04 91 28 85 25
> DOSI - Aix Marseille Université
> Avenue Escadrille Normandie-Niemen
> 13397 MARSEILLE CEDEX 20
>

--
Arnaud Deman
04 91 28 85 25
DOSI - Aix Marseille Université
Avenue Escadrille Normandie-Niemen
13397 MARSEILLE CEDEX 20




Archive powered by MHonArc 2.6.16.

Top of Page