view test/RH1195203.java @ 3252:4c2bd990d28a

PR2800: Files are missing from resources.jar 2016-07-26 Andrew John Hughes <gnu.andrew@redhat.com> PR2800: Files are missing from resources.jar * Makefile.am: (MIME_TYPE_CHECK_BUILD_DIR): Add build directory for mime type check. (MIME_TYPE_CHECK_SRCS): Specify sources for mime type check. (EXTRA_DIST): Distribute mime type check sources. (check-local): Depend on check-mimetype. (clean-tests): Depend on clean-check-mimetype. (clean-local): Depend on clean-mimetypecheck. (.PHONY): Depend on clean-check-mimetype, clean-mimetypecheck, clean-add-mime-types-file, clean-add-mime-types-file-debug and clean-add-mime-types-file-boot. (icedtea-against-icedtea): Depend on add-mime-types-file. (clean-icedtea-against-icedtea): Depend on clean-add-mime-types-file. (icedtea-debug-against-icedtea): Depend on add-mime-types-file-debug. (clean-icedtea-debug-against-icedtea): Depend on clean-add-mime-types-file-debug. (add-mime-types-file): Add a symlink to the system mime.types file if found. (clean-add-mime-types-file): Remove symlink to the system mime types file. (add-mime-types-file-debug): Add a symlink to the system mime.types file, if found, in the debug build. (clean-add-mime-types-file-debug): Remove symlink to the system mime types file in the debug build. (icedtea-against-ecj): Depend on add-mime-types-file-boot. (clean-icedtea-against-ecj): Depend on clean-add-mime-types-file-boot. (add-mime-types-file-boot): Add a symlink to the system mime.types file, if found, in the bootstrap build. (clean-add-mime-types-file-boot): Remove symlink to the system mime types file in the bootstrap build. (check-mimetype): Check that we can recognise a HTML file and (if system mime.types is available) a Java file. (clean-check-mimetype): Cleanup after check-mimetype. (mimetypecheck): Build the MIME type check. (clean-mimetypecheck): Remove MIME type check build. (install-data-local): Install the mime.types symlink. * acinclude.m4: (IT_CHECK_FOR_MIME_TYPES): Check for a system mime.types file and define MIME_TYPES_FILE_FOUND if located. * configure.ac: Invoke IT_CHECK_FOR_MIME_TYPES. * test/RH1195203.java: Testcase to get Java to print the MIME type of a file. 2015-05-16 Andrew John Hughes <gnu_andrew@member.fsf.org> PR2800: Files are missing from resources.jar * Makefile.am: (BUILD_SDK_DIR): Added. (BUILD_JRE_DIR): Likewise. (BUILD_JRE_ARCH_DIR): Redefine using BUILD_SDK_DIR. (BUILD_DEBUG_SDK_DIR): Added. (BUILD_DEBUG_JRE_DIR): Likewise. (BUILD_DEBUG_JRE_ARCH_DIR): Redefine using BUILD_DEBUG_SDK_DIR. (BUILD_BOOT_SDK_DIR): Added. (BUILD_BOOT_JRE_DIR): Likewise. (BUILD_BOOT_JRE_ARCH_DIR): Redefine using BUILD_BOOT_SDK_DIR. 2015-06-03 Andrew John Hughes <gnu.andrew@member.fsf.org> PR2800: Files are missing from resources.jar * Makefile.am: (BUILD_BOOT_JRE_ARCH_DIR): Added.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Mon, 15 Aug 2016 05:37:57 +0100
parents
children
line wrap: on
line source

/* RH1195203 -- Check correct recognition of mime types.
   Copyright (C) 2015 Red Hat, Inc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import javax.activation.MimetypesFileTypeMap;

public class RH1195203
{
    public static void main(String[] args)
    {
        if (args.length == 0)
        {
            System.err.println("No file specified.");
            System.exit(-1);
        }

        System.out.println(MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType(args[0]));
    }
}