String mimeType = null;
for (URL resource : resources) {
if ("file".equals(resource.getProtocol())) {
isFile = true;
}
URLConnection resourceConn = resource.openConnection();
if (resourceConn.getLastModified() > lastModified) {
lastModified = resourceConn.getLastModified();
}
String currentMimeType = getServletContext().getMimeType(resource.getPath());
if (currentMimeType == null) {
String extension = resource.getPath().substring(resource.getPath().lastIndexOf('.'));
currentMimeType = DEFAULT_MIME_TYPES.get(extension);
}
if (mimeType == null) {
mimeType = currentMimeType;
} else if (!mimeType.equals(currentMimeType)) {
throw new MalformedURLException("Combined resource path: " + rawResourcePath
+ " is invalid. All resources in a combined resource path must be of the same mime type.");
}
contentLength += resourceConn.getContentLength();
try {
resourceConn.getInputStream().close();
} catch (Exception e) {
/*ignore, just trying to free resources*/
}
try {
resourceConn.getOutputStream().close();
} catch (Exception e) {
/*ignore, just trying to free resources*/
}
}