uDIG
  1. uDIG
  2. UDIG-1755

DTED formats dt0 and dt1 DnD fix

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: UDIG 1.2.1
    • Fix Version/s: UDIG 1.5.0.RC1
    • 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 ]
        Hide
        Frank Gasdorf added a comment -
        Provided test cases to verify the current FileConnectionFactory works as expected (see *.test1, *.test2, *.test3 extension definitions https://github.com/uDig/udig-platform/commit/3d8a197748ba3e495066796be568a502a1d6c756).

        Could Justin please provide more details about the Environment? Windows, Linux, etc?

        I expect that every dted extension would work on any of them but not in such a mixed mode.
        Show
        Frank Gasdorf added a comment - Provided test cases to verify the current FileConnectionFactory works as expected (see *.test1, *.test2, *.test3 extension definitions https://github.com/uDig/udig-platform/commit/3d8a197748ba3e495066796be568a502a1d6c756) . Could Justin please provide more details about the Environment? Windows, Linux, etc? I expect that every dted extension would work on any of them but not in such a mixed mode.
        Frank Gasdorf made changes -
        Status In Progress [ 3 ] Analysis [ 10002 ]
        Hide
        Frank Gasdorf added a comment -
        See pull request https://github.com/uDig/udig-platform/pull/95 (formats coming from GDALFormatProvider)
        Show
        Frank Gasdorf added a comment - See pull request https://github.com/uDig/udig-platform/pull/95 (formats coming from GDALFormatProvider)
        Frank Gasdorf made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s UDIG 1.5.0 [ 20961 ]
        Status Analysis [ 10002 ] Resolved [ 5 ]

          People

          • Assignee:
            Frank Gasdorf
            Reporter:
            Jody Garnett

            Dates

            • Created:
              Updated:
              Resolved: