File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
spring-beans/src/main/java/org/springframework/beans/propertyeditors Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -78,8 +78,10 @@ public void setAsText(String text) throws IllegalArgumentException {
78
78
if (nioPathCandidate && !text .startsWith ("/" )) {
79
79
try {
80
80
URI uri = ResourceUtils .toURI (text );
81
- if (uri .getScheme () != null ) {
82
- nioPathCandidate = false ;
81
+ String scheme = uri .getScheme ();
82
+ if (scheme != null ) {
83
+ // No NIO candidate except for "C:" style drive letters
84
+ nioPathCandidate = (scheme .length () == 1 );
83
85
// Let's try NIO file system providers via Paths.get(URI)
84
86
setValue (Paths .get (uri ).normalize ());
85
87
return ;
@@ -109,7 +111,8 @@ else if (nioPathCandidate && !resource.exists()) {
109
111
setValue (resource .getFile ().toPath ());
110
112
}
111
113
catch (IOException ex ) {
112
- throw new IllegalArgumentException ("Failed to retrieve file for " + resource , ex );
114
+ throw new IllegalArgumentException (
115
+ "Could not retrieve file for " + resource + ": " + ex .getMessage ());
113
116
}
114
117
}
115
118
}
You can’t perform that action at this time.
0 commit comments