@@ -78,15 +78,16 @@ private CachedRepresentationManager(File cacheDirectory) {
7878
7979 private void init () {
8080 if (!this .cacheDirectory .exists ()) {
81- this .cacheDirectory .mkdirs ();
82- this . created = true ;
83- LOGGER . debug ( "Created cache directory {}" , this . cacheDirectory . getAbsolutePath ());
84- } else if (!this .cacheDirectory .isDirectory ()) {
81+ this .created = this . cacheDirectory .mkdirs ();
82+ }
83+
84+ if (! this . created && !this .cacheDirectory .isDirectory ()) {
8585 LOGGER .debug ("Path {} cannot be used as cache directory. Resorting to default temp directory {}" ,this .cacheDirectory .getAbsolutePath (),FileUtils .getTempDirectoryPath ());
8686 this .cacheDirectory =FileUtils .getTempDirectory ();
87- this .created =false ;
88- } else {
89- this .created =false ;
87+ }
88+
89+ if (this .created ){
90+ LOGGER .debug ("Created cache directory {}" ,this .cacheDirectory .getAbsolutePath ());
9091 }
9192 }
9293
@@ -153,10 +154,10 @@ String get(String resource) throws IOException {
153154 }
154155
155156 void dispose () {
156- LOGGER .debug ("Disposing resources persisted at {}..." ,this .cacheDirectory );
157+ LOGGER .debug ("Disposing representations cached at {}..." ,this .cacheDirectory );
157158 for (ContentEntry entry :this .loadedResources .values ()) {
158159 if (entry .file ().exists ()) {
159- LOGGER .debug ("- Deleting resource {} ({})..." ,entry .resource (),entry .file ());
160+ LOGGER .debug ("- Deleting representation for resource {} ({})..." ,entry .resource (),entry .file ());
160161 if (!entry .file ().delete ()) {
161162 entry .file ().deleteOnExit ();
162163 LOGGER .debug (" + Could not delete {}. Scheduling for deletion on exit." ,entry .resource ());
@@ -172,7 +173,7 @@ void dispose() {
172173 LOGGER .debug (" + Could not delete cache directory: {}" ,e .getMessage ());
173174 }
174175 }
175- LOGGER .debug ("Resources persisted at {} deleted." ,this .cacheDirectory );
176+ LOGGER .debug ("Representations cached at {} deleted." ,this .cacheDirectory );
176177 }
177178
178179 static CachedRepresentationManager create (File cacheDirectory ) {
0 commit comments