I want to create a file with null character in its name on mac. filename like - abc\0ds.txt I tried creating a file with name 'abc\0ahd.txt' but \0 in the name is not really unicode null character. It is some other character. I want to create a file with null character in its name because I want to reproduce a scenario for integration tests of my application which uses fileItemStream.getName() (org.apache.commons.fileupload.FileUploadBase) to get filename and then it should throw InvalidFileNameException exception (org.apache.commons.fileupload.InvalidFileNameException)
We get such scenarios in production and get logs like "org.apache.commons.fileupload.InvalidFileNameException: Invalid file name: uploadertest.asp\0.png" but I can't reproduce this by uploading a file from my system or integrations tests but it is reproducible from unit tests when I send byte stream like this.
byte[] formData = getFormData(boundary, defaultFormParams, invalidFileNameWithNullCharacter);
MockHttpServletRequestBuilder request = getRequest(boundary, formData);