I think this code is copy-pasted from the HadoopInputFormatWrapper.
Can you move it to method used by both Wrappers?