Skip to content
Snippets Groups Projects
Commit 618aaad5 authored by Georg Graßnick's avatar Georg Graßnick :thinking:
Browse files

Improve logging verbosity

parent 731f9fb1
No related branches found
No related tags found
1 merge request!36Bug/file path issues
......@@ -47,25 +47,26 @@ public final class GeneralResource {
* @throws IOException If the given path neither determines a valid external file, nor a valid resource.
*/
public GeneralResource(final String resourcePath, final String searchPath) throws IOException {
mLogger.debug("Requested GeneralResource for path \"" + resourcePath + "\" with search path \"" + searchPath + "\"");
File checkFile = new File(resourcePath);
mLogger.debug("Checking referenced path: " + checkFile);
mLogger.trace("Checking referenced path: " + checkFile);
if (checkFile.isFile()) {
mLogger.trace("Interpreting path as file: " + checkFile.getCanonicalPath());
mLogger.debug("Interpreting path as file: " + checkFile.getCanonicalPath());
mResourcePath = checkFile.getCanonicalPath();
mValidExternalFile = true;
}
checkFile = checkFile.getAbsoluteFile();
mLogger.debug("Checking referenced path as absolute path: " + checkFile);
mLogger.trace("Checking referenced path as absolute path: " + checkFile);
if (checkFile.isFile()) {
mLogger.trace("Interpreting path as absolute file: " + checkFile.getCanonicalPath());
mLogger.debug("Interpreting path as absolute file: " + checkFile.getCanonicalPath());
mResourcePath = checkFile.getCanonicalPath();
mValidExternalFile = true;
}
if (Objects.nonNull(searchPath)) {
checkFile = new File(searchPath + File.separator + resourcePath);
mLogger.debug("Looking for referenced path in search path: " + checkFile);
mLogger.trace("Looking for referenced path in search path: " + checkFile);
if (checkFile.isFile()) {
mLogger.trace("Interpreting path as search path relative file: " + checkFile.getCanonicalPath());
mLogger.debug("Interpreting path as search path relative file: " + checkFile.getCanonicalPath());
mResourcePath = checkFile.getCanonicalPath();
mValidExternalFile = true;
}
......@@ -77,9 +78,9 @@ public final class GeneralResource {
String resourceClassPath = stripJarPath(resourcePath);
resourceClassPath = resourceClassPath.replace(File.separator, "/"); // class paths are always separated by forward slash
InputStream checkStream = getClass().getClassLoader().getResourceAsStream(resourceClassPath);
mLogger.debug("Checking referenced path as resource: " + resourceClassPath);
mLogger.trace("Checking referenced path as resource: " + resourceClassPath);
if (Objects.nonNull(checkStream)) {
mLogger.trace("Interpreting path as resource stream: " + resourceClassPath);
mLogger.debug("Interpreting path as resource stream: " + resourceClassPath);
mResourcePath = resourceClassPath;
mValidPackedResource = true;
}
......@@ -87,9 +88,9 @@ public final class GeneralResource {
String relativeResourcePath = new File(resourceSearchPath + File.separator + resourceClassPath).toPath().normalize().toString();
relativeResourcePath = relativeResourcePath.replace("\\", "/");
checkStream = getClass().getClassLoader().getResourceAsStream(relativeResourcePath);
mLogger.debug("Checking referenced path as search path relative resource: " + relativeResourcePath);
mLogger.trace("Checking referenced path as search path relative resource: " + relativeResourcePath);
if (Objects.nonNull(checkStream)) {
mLogger.trace("Interpreting path as resource stream: " + relativeResourcePath);
mLogger.debug("Interpreting path as resource stream: " + relativeResourcePath);
mResourcePath = relativeResourcePath;
mValidPackedResource = true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment