On 6 Jan 2010, at 12:09, Cyril Concolato wrote:
Le 06/01/2010 11:22, Scott Wilson a écrit :Thanks for the info, but I'm not sure I understand. If you take the algorithm:On 6 Jan 2010, at 08:56, Cyril Concolato wrote:[snip] 1 fails because we don't implement SNIFF. I don't know if we will. [snip]Actually you don't need to implement SNIFF to pass that particular test, as it only requires you do the extension-processing part of the algorithm.1. nothing to do 2. content-type = empty 3. extension = empty 4. name = 'fail' 5. Not applicable (not starting with a full stop) 6. Not applicable (no full stop in the name) 7. Not applicable (no full stop in the name) 8. extension is empty so you go to 10. 10. Process the file according to SNIFF. Am I wrong?
No, you're correct - I'd misremembered the test details.
Your algorithm returns null even if the file is of a supported media type. In this case, it's fine, it gives the right result but if the 'fail' file did not contain garbage data but say real PNG data, your algorithm would give the wrong result.See, e.g.: https://svn.apache.org/repos/asf/incubator/wookie/trunk/src/org/apache/wookie/util/ContentTypeUtils.java As you can see we've put a TODO for SNIFF but the code as it stands passes the test fine.Anyway, thanks. I did not want to give the impression that I passed this test since SNIFF was not implemented but I will probably do something similar to you because I can actually give the right result for this test, which is what's needed for the report. However, the test suite should include one test really checking SNIFF support to see how many implementations do implement it.
I agree, we will need to have a test that exercises SNIFF properly, however the longer we put it off the better :-)
Cyril PS: In your code I noticed that line:"if (filename.startsWith(",") && filename.lastIndexOf(".")==0) return null;"Are you sure the "," shouldn't be a "." ?
D'oh! Good catch - thanks!
-- Cyril Concolato Maître de Conférences/Associate Professor Groupe Mutimedia/Multimedia Group Telecom ParisTech 46 rue Barrault 75 013 Paris, France http://concolato.blog.telecom-paristech.fr/
smime.p7s
Description: S/MIME cryptographic signature