* A specific match for the given mimetype is tried first and
- * if none is found a wildcard of "*" is tried.
+ * if none is found a wildcard of "*" is tried, if still not found
+ * defaults value will be used
*
* @param mimetype String
- * @return the found limits or null
+ * @return the found limits or default values
*/
protected MetadataExtracterLimits getLimits(String mimetype)
{
if (mimetypeLimits == null)
{
- return null;
+ return new MetadataExtracterLimits();
}
MetadataExtracterLimits limits = null;
limits = mimetypeLimits.get(mimetype);
if (limits == null)
{
limits = mimetypeLimits.get("*");
- }
+ }
+ if (limits == null)
+ {
+ limits = new MetadataExtracterLimits();
+ }
+
return limits;
}
@@ -2027,6 +2045,19 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
{
super(cause);
}
+ }
+
+ /**
+ * Exception wrapper to handle exceeded limits imposed by {@link MetadataExtracterLimits}
+ * {@link AbstractMappingMetadataExtracter#extractRaw(ContentReader, MetadataExtracterLimits)}
+ */
+ private class LimitExceededException extends Exception
+ {
+ private static final long serialVersionUID = 702554119174770130L;
+ public LimitExceededException(String message)
+ {
+ super(message);
+ }
}
/**
@@ -2049,12 +2080,34 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
private Map