Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BMP error : net.sf.jmimemagic.MagicMatchNotFoundException: null #23

Open
ahll opened this issue Oct 21, 2014 · 0 comments
Open

BMP error : net.sf.jmimemagic.MagicMatchNotFoundException: null #23

ahll opened this issue Oct 21, 2014 · 0 comments

Comments

@ahll
Copy link

ahll commented Oct 21, 2014

I get a byte array from a url, then test it with magic class. And it has thrown a MagicMatchNotFoundException.

Code:

public static String getMimeType(byte[] bytes) throws MagicParseException, MagicMatchNotFoundException, MagicException {
Magic parser = new Magic();
MagicMatch match = parser.getMagicMatch(bytes);
return match.getMimeType();
}

Test code:

String bmpUrl = "https://raw.githubusercontent.com/arimus/jmimemagic/master/test_docs/test.bmp";

byte[] bmpFIle = IOUtils.toByteArray((new URL(bmpUrl)).openStream());
assertThat(FileHelper.getMimeType(bmpFIle)).isEqualTo("image/bmp");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant