Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8292140

(fs) Needless instanceof check in RegistryFileTypeDetector

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 20
    • None
    • core-libs
    • b11

      Type of file parameter is known to be Path. And instanceof only checks if it's null or not.

       public String implProbeContentType(Path file) throws IOException {
           if (!(file instanceof Path))
               return null;

      Before implProbeContentType method is called, parameter is checked for null in sun.nio.fs.AbstractFileTypeDetector#probeContentType. It means null check is redundant too.

            aturbanov Andrey Turbanov
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: