public static String getBoundary(final String contentType, final int line)
     throws BatchDeserializerException {
   final ContentType type = parseContentType(contentType, ContentType.MULTIPART_MIXED, line);
   final Map<String, String> parameters = type.getParameters();
   for (final Map.Entry<String, String> entries : parameters.entrySet()) {
     if (BOUNDARY.equalsIgnoreCase(entries.getKey())) {
       final String boundary = entries.getValue().trim();
       if (boundary.matches(PATTERN_BOUNDARY)) {
         return trimQuotes(boundary);
       } else {
         throw new BatchDeserializerException(
             "Invalid boundary format",
             BatchDeserializerException.MessageKeys.INVALID_BOUNDARY,
             Integer.toString(line));
       }
     }
   }
   throw new BatchDeserializerException(
       "Missing boundary.",
       BatchDeserializerException.MessageKeys.MISSING_BOUNDARY_DELIMITER,
       Integer.toString(line));
 }