1 17 package org.apache.geronimo.common.propertyeditor; 18 19 import java.io.File ; 20 import java.net.MalformedURLException ; 21 import java.net.URL ; 22 23 28 public class URLEditor extends TextPropertyEditorSupport { 29 34 public Object getValue() { 35 try { 36 URL url = new URL (getAsText().trim()); 38 try { 42 if (url.getProtocol().equals("file")) { 43 return new File (url.getFile()).toURI().toURL(); 47 } 48 } catch (Exception e) { 49 throw new PropertyEditorException(e); 51 } 52 53 return url; 54 } catch (MalformedURLException e) { 55 } 58 59 try { 60 return new File (getAsText()).toURI().toURL(); 64 } catch (MalformedURLException e) { 65 throw new PropertyEditorException(e); 67 } 68 } 69 } 70 | Popular Tags |