Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2013-06-03 04:21:11 -0400
committerGreg Wilkins2013-06-03 04:21:11 -0400
commit7bb3a7be282de6cc2996f8065f98aff1b26ad236 (patch)
treec1b686cef02f266e0cc6618d76b00d5298fbf812 /jetty-osgi/jetty-osgi-boot/src
parent952f8442e5f07bde3f747a799d4bc56a42a1a0bf (diff)
downloadorg.eclipse.jetty.project-7bb3a7be282de6cc2996f8065f98aff1b26ad236.tar.gz
org.eclipse.jetty.project-7bb3a7be282de6cc2996f8065f98aff1b26ad236.tar.xz
org.eclipse.jetty.project-7bb3a7be282de6cc2996f8065f98aff1b26ad236.zip
409556 Resource files not closed
Made Resource a closeable so that it is easier to close in a try(){} block. Deprecated release() and made it close() instead. FileResource no longer extends URLResource as it can more efficiently implement all the methods with pure File operations and have no connections or streams that need to be release/closed
Diffstat (limited to 'jetty-osgi/jetty-osgi-boot/src')
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractContextProvider.java25
1 files changed, 6 insertions, 19 deletions
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractContextProvider.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractContextProvider.java
index b15d6179db..f056bfb47d 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractContextProvider.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractContextProvider.java
@@ -169,7 +169,7 @@ public abstract class AbstractContextProvider extends AbstractLifeCycle implemen
jettyHome = jettyHome.substring(0,jettyHome.length()-1);
res = getFileAsResource(jettyHome, _contextFile);
- if (LOG.isDebugEnabled()) LOG.debug("jetty home context file:"+res);
+ LOG.debug("jetty home context file: {}",res);
}
}
}
@@ -179,8 +179,11 @@ public abstract class AbstractContextProvider extends AbstractLifeCycle implemen
{
if (bundleOverrideLocation != null)
{
- res = getFileAsResource(Resource.newResource(bundleOverrideLocation).getFile(), _contextFile);
- if (LOG.isDebugEnabled()) LOG.debug("Bundle override location context file:"+res);
+ try(Resource location=Resource.newResource(bundleOverrideLocation))
+ {
+ res=location.addPath(_contextFile);
+ }
+ LOG.debug("Bundle override location context file: {}",res);
}
}
@@ -295,22 +298,6 @@ public abstract class AbstractContextProvider extends AbstractLifeCycle implemen
}
return r;
}
-
- private Resource getFileAsResource (File dir, String file)
- {
- Resource r = null;
- try
- {
- File asFile = new File (dir, file);
- if (asFile.exists())
- r = Resource.newResource(asFile);
- }
- catch (Exception e)
- {
- r = null;
- }
- return r;
- }
}
/* ------------------------------------------------------------ */

Back to the top