Revision 2440
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/URLUtils.java | ||
---|---|---|
31 | 31 |
import java.net.MalformedURLException; |
32 | 32 |
import java.net.URISyntaxException; |
33 | 33 |
import java.net.URL; |
34 |
import org.apache.commons.lang3.StringUtils; |
|
34 | 35 |
|
35 | 36 |
/** |
36 | 37 |
* |
... | ... | |
101 | 102 |
return null; |
102 | 103 |
} |
103 | 104 |
try { |
104 |
return url.toURI().getPath(); |
|
105 |
String path; |
|
106 |
if( StringUtils.contains(url.getPath(), "<%=") ) { |
|
107 |
path = url.getPath(); |
|
108 |
} else { |
|
109 |
path = url.toURI().getPath(); |
|
110 |
} |
|
111 |
return path; |
|
105 | 112 |
} catch (URISyntaxException ex) { |
106 | 113 |
throw new IllegalArgumentException(ex); |
107 | 114 |
} |
... | ... | |
112 | 119 |
return null; |
113 | 120 |
} |
114 | 121 |
try { |
115 |
String path = url.toURI().getPath(); |
|
122 |
String path; |
|
123 |
if( StringUtils.contains(url.getPath(), "<%=") ) { |
|
124 |
path = url.getPath(); |
|
125 |
} else { |
|
126 |
path = url.toURI().getPath(); |
|
127 |
} |
|
116 | 128 |
return new File(path); |
117 | 129 |
} catch (URISyntaxException ex) { |
118 | 130 |
throw new IllegalArgumentException(ex); |
... | ... | |
125 | 137 |
} |
126 | 138 |
URL url; |
127 | 139 |
try { |
128 |
url = f.toURI().toURL(); |
|
140 |
if( StringUtils.contains(f.getAbsolutePath(), "<%=") ) { |
|
141 |
url = new URL("file", null, f.getAbsolutePath()); |
|
142 |
} else { |
|
143 |
url = f.toURI().toURL(); |
|
144 |
} |
|
129 | 145 |
} catch (MalformedURLException ex) { |
130 | 146 |
throw new IllegalArgumentException(ex); |
131 | 147 |
} |
Also available in: Unified diff