Hi,

I have the following problem in using barcode4j.jar along with fop.jar/xmlgraphicscommons.jar.

When my application trying to parse 'image/gif' or 'image/bmp' mime types through barcode4j image loader, it is returning the fatal error 'Content is not allowed in prolog'.
I have XMLGraphicsCommons project jar file in my classpath to handle the other mime-types along with barcode4J project jar. I am packing all these jars in a EAR file to be deployed in my application server (say JBOSS).

When there is a 'image/gif' or 'image/bmp' file is being used in my fop rendering process, the barcode4j image loader is trying to load the image first and fails to parse that 'GIF' or 'BMP' image and returns a FATAL ERROR to the jboss console.
I want to get rid of this error message 'Content is not allowd in prolog' from my jboss console, because the other image loaders will take care of this, when failed to parse through barcode4J.

I went through the barcode4j source code little bit, the method 'preloadImage' in the class 'PreloaderBarcode.java' is being used to load the image, not checking whether the mime-type will be supported or not. I thought of adding a simple method, where it can check for the supported mime-types by the barcode4J and returns 'null' in case it doesn't support the given mime-type, like the following...

public ImageInfo preloadImage(String uri, Source src, ImageContext context)
            throws IOException {
        ImageInfo info = null;
        System.out.println("Coming here in preloadImage1::src="+src);
        if (!isSupportedSource(src)) {
            System.out.println("Coming here in preloadImage2::src="+src);
            return null;
        }

        //Get the content type
        String mime_type = null;
        URL u = new URL(uri);
        URLConnection uc = null;
        uc = u.openConnection();
        mime_type = uc.getContentType();
        System.out.println("The content type is "+mime_type);
        if (!mime_type.equalsIgnoreCase(MimeTypes.MIME_SVG)){
             return null;
        }


        info = getImage(uri, src, context);
        if (info != null) {
            ImageUtil.closeQuietly(src); //Image is fully read
        }
        return info;
    }

The blue and bolded source code in the above method is inserted to handle the problem, which is working fine for me. I have very little idea about the barcode4J source code (just subscribed to barcode4j mailing lists).
I want to check the given mime-type is supported by barcode4J, so that I can return 'null' in other cases instead of returning an error.

Please answer me the following:

1. Is there any other method already exists in barcode4J for this purpose?
2. If I need to create a method something like 'isInSupportedMimeTypes(mime-type)', what are the other mime-types that I need to check here?
    (means except SVG's, what are the other mime-types can be supported by barcode4J)
3. If I change any code, how do I send my patch to the barcode4J-developers?

Please reply me back as early as possible, I need to close this issue asap.

Thanks,
Venkat.