Details
-
Type:
Bug
-
Status:
In Progress
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: UDIG 1.2.1
-
Fix Version/s: None
-
Component/s: file format
-
Labels:None
Description
From email:
Hello,
We noticed a bug in udig were certain supported file types could not be drag into udig. An example of this is dted while dt2 would load dt0 and dt1 would not. We tracked this down to the plugin 'net.refractions.udig.catalog.ui''s file 'net.refractions.udig.catalog.ui.FileConnectionFactory'. The method public URL createConnectionURL( Object context ) needs to be changed to the following.
I have also attached the file.
Thanks,
Justin
Here is the provided code:
public URL createConnectionURL( Object context ) { URL url = CatalogPlugin.locateURL(context); if (url == null) { return null; } url = checkedURL(url); if (url == null || url.getFile() == null) { return null; } // Checks whether file is acceptable based on extension. String fileExt = url.getFile().substring(url.getFile().lastIndexOf('.') + 1); if (fileExt != null) fileExt = fileExt.toLowerCase(); for( String extensionsForFile : getExtensionList() ) { extensionsForFile = extensionsForFile.toLowerCase(); String[] validExtensions = extensionsForFile.split(","); for (String validExtension : validExtensions) { if (fileExt.equals(validExtension.substring(validExtension.lastIndexOf('.') + 1))) { // actually do a test File f = URLUtils.urlToFile(url); if (f.exists()) return url; } } } return null; }
Activity
Jody Garnett
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Attachment | FileConnectionFactory.java [ 53913 ] |
Frank Gasdorf
made changes -
| Assignee | Frank Gasdorf [ fgdrf1976 ] |
Frank Gasdorf
made changes -
| Status | Open [ 1 ] | In Progress [ 3 ] |