mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-08 09:36:04 +00:00
merged back the RC branch
This commit is contained in:
commit
d32f9e5113
13 files changed
+129
-11
No files matched your search
@@ -1240,6 +1240,31 @@ public class Util {
|
||||
return s==null ? s : s.intern();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the systemId denotes an absolute URI .
|
||||
*
|
||||
* The same algorithm can be seen in {@link URI}, but
|
||||
* implementing this by ourselves allow it to be more lenient about
|
||||
* escaping of URI.
|
||||
*/
|
||||
public static boolean isAbsoluteUri(String uri) {
|
||||
int idx = uri.indexOf(':');
|
||||
if (idx<0) return false; // no ':'. can't be absolute
|
||||
|
||||
// #, ?, and / must not be before ':'
|
||||
return idx<_indexOf(uri, '#') && idx<_indexOf(uri,'?') && idx<_indexOf(uri,'/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Works like {@link String#indexOf(int)} but 'not found' is returned as s.length(), not -1.
|
||||
* This enables more straight-forward comparison.
|
||||
*/
|
||||
private static int _indexOf(String s, char ch) {
|
||||
int idx = s.indexOf(ch);
|
||||
if (idx<0) return s.length();
|
||||
return idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a key/value pair string as {@link Properties}
|
||||
* @since 1.392
|
||||
|
||||
Reference in new issue
Block a user