Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BraillePlot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Graßnick
BraillePlot
Commits
618aaad5
Commit
618aaad5
authored
5 years ago
by
Georg Graßnick
Browse files
Options
Downloads
Patches
Plain Diff
Improve logging verbosity
parent
731f9fb1
No related branches found
Branches containing commit
No related tags found
1 merge request
!36
Bug/file path issues
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tudresden/inf/mci/brailleplot/util/GeneralResource.java
+11
-10
11 additions, 10 deletions
...e/tudresden/inf/mci/brailleplot/util/GeneralResource.java
with
11 additions
and
10 deletions
src/main/java/de/tudresden/inf/mci/brailleplot/util/GeneralResource.java
+
11
−
10
View file @
618aaad5
...
...
@@ -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
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment