On 6 July 2015 at 15:15, Tim Cronin <[email protected]> wrote: > AuxDiskCache is throwing error that it can't create the directory but it > already exists. > > localhost-startStop-1 2015-07-06 14:01:30,006 ERROR > org.apache.commons.jcs.auxiliary.disk.AbstractDiskCacheAttributes - Failed > to create directory C:\java\tomcat\temp\oeserver-cache > > I tested mkdirs and it follows what the javadoc says > <http://docs.oracle.com/javase/8/docs/api/java/io/File.html#mkdirs-->. the > code needs to check if the dir already exists: > > the function should be as follows: > > /** > * Sets the diskPath attribute of the DiskCacheAttributes object > * <p> > * @param diskPath The new diskPath value > */ > public void setDiskPath( File diskPath ) > { > this.diskPath = diskPath; > > if(!this.diskPath.exists()) > { > boolean result = this.diskPath.mkdirs(); > > if (!result) > { > log.error("Failed to create directory " + diskPath); > } > } > }
That can still theoretically fail if something else creates the directory in the meantime. Also exists() will return true for a file as well as a directory. Please see: https://issues.apache.org/jira/browse/JCI-67 > > > > On Mon, Jul 6, 2015 at 8:37 AM, Tim Cronin <[email protected]> wrote: > >> is there any documentation on migrating from 1.3 to 2? >> >> the JCSAdmin.jsp the FAQ link is broken. moved due to package change >> <http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/admin/JCSAdmin.jsp?view=log> >> >> >> On Mon, Jul 6, 2015 at 7:37 AM, Tim Cronin <[email protected]> wrote: >> >>> i understand that 1.3 is old and the 2 branch will be the way going >>> forward but... >>> >>> this happens on our production server and really don't want to run beta >>> code on it. >>> >>> i've played with the beta code and it requires code changes on our side >>> as well. >>> >>> On Sun, Jul 5, 2015 at 10:25 AM, Thomas Vandahl <[email protected]> wrote: >>> >>>> On 02.07.15 15:13, Tim Cronin wrote: >>>> > JCS 1.3 >>>> > >>>> > i periodically get the above error. >>>> > >>>> > what do i need to do to recover from this? >>>> > >>>> >>>> First of all I'd suggest to try out commons-jcs 2.0-beta1. It contains >>>> numerous fixes and cleans up the lifecycle of most of the JCS manager >>>> classes. If that doesn't help, come back and ask again as this would >>>> require deeper digging. >>>> >>>> Bye, Thomas. >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
