javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Fri May 14 15:47:24 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Thu May 27 12:49:31 2010 +0300
@@ -367,28 +367,34 @@
* </ul>
*/
public Image(Device device, String filename) {
+ this(device, filename, true);
+ }
+
+ private Image(Device device, String filename, boolean securityCheck) {
this(device);
if (filename == null) {
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
init();
-
- // Drop the "file:///" prefix
- String trimmedFileName = filename.trim();
- final String prefix = "file:///";
- if(trimmedFileName.startsWith(prefix)) {
- trimmedFileName = trimmedFileName.substring(prefix.length());
- }
- filename = trimmedFileName;
+
+ if (securityCheck == true) {
+ // Drop the "file:///" prefix
+ String trimmedFileName = filename.trim();
+ final String prefix = "file:///";
+ if (trimmedFileName.startsWith(prefix)) {
+ trimmedFileName = trimmedFileName.substring(prefix.length());
+ }
+ filename = trimmedFileName;
- boolean canRead = false;
- try {
- canRead = Compatibility.canOpenFile(filename);
- } catch (SecurityException e) {
- SWT.error(SWT.ERROR_IO);
- }
- if (!canRead) {
- SWT.error(SWT.ERROR_IO);
+ boolean canRead = false;
+ try {
+ canRead = Compatibility.canOpenFile(filename);
+ } catch (SecurityException e) {
+ SWT.error(SWT.ERROR_IO);
+ }
+ if (!canRead) {
+ SWT.error(SWT.ERROR_IO);
+ }
}
org.eclipse.swt.internal.qt.graphics.ImageLoader loader = new org.eclipse.swt.internal.qt.graphics.ImageLoader();
@@ -423,6 +429,10 @@
SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
}
}
+
+ static Image createImageWithoutSecurityCheck(Device device, String filename) {
+ return new Image(device, filename, false);
+ }
/**
* Disposes of the operating system resources associated with the image.