uDIG
  1. uDIG
  2. UDIG-1755

DTED formats dt0 and dt1 DnD fix

    Details

    • Type: Bug Bug
    • Status: In Progress In Progress
    • Priority: Major 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

        There are no comments yet on this issue.

          People

          • Assignee:
            Frank Gasdorf
            Reporter:
            Jody Garnett
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: