Skip to content
Snippets Groups Projects
Commit b9af0dbc authored by jlanuti's avatar jlanuti
Browse files

[179728] fix for zip file size exceptions on wars

parent a499de05
No related branches found
No related tags found
No related merge requests found
......@@ -106,80 +106,64 @@ public abstract class Location implements ILocation
}
/**
* Answers <code>true</code> if the path ends in ".jar", ".zip", ".ear", or
* ".war".
* Answers <code>true</code> if the path ends in ".jar", ".zip", or ".ear"
* <p>
* This code has been optimized to within an inch of its life.
*
* @param path
* The path of the file
* @return boolean <code>true</code> if the path represents a jar, zip, ear,
* or war file.
* @return boolean <code>true</code> if the path represents a jar, zip, ear
*/
public static boolean isArchive(String path)
{
if (path == null)
return false;
if (path.length() < 5)
return false;
int index = path.length() - 1;
char extChar = path.charAt(index--);
switch (extChar)
{
case 'p' :
case 'P' :
if (path.endsWith(".zip"))
{
return true;
}
break;
case 'r' :
case 'R' :
extChar = path.charAt(index--);
switch (extChar)
{
case 'a' :
case 'A' :
extChar = path.charAt(index--);
switch (extChar)
{
case 'j' :
case 'J' :
if (path.charAt(index) == '.')
{
return true;
}
break;
case 'w' :
case 'W' :
if (path.charAt(index) == '.')
{
return true;
}
break;
case 'e' :
case 'E' :
if (path.charAt(index) == '.')
{
return true;
}
break;
}
}
break;
}
return false;
}
public static boolean isArchive(String path) {
if (path == null)
return false;
if (path.length() < 5)
return false;
int index = path.length() - 1;
char extChar = path.charAt(index--);
switch (extChar) {
case 'p':
case 'P':
if (path.endsWith(".zip")) {
return true;
}
break;
case 'r':
case 'R':
extChar = path.charAt(index--);
switch (extChar) {
case 'a':
case 'A':
extChar = path.charAt(index--);
switch (extChar) {
case 'j':
case 'J':
if (path.charAt(index) == '.') {
return true;
}
break;
case 'e':
case 'E':
if (path.charAt(index) == '.') {
return true;
}
break;
}
}
break;
}
return false;
}
/**
* Answers the extension of the given path. An extension is normally a three
* character addition to the end of a filename separated from the filename by
* the '.' character.
*
* @param path
* a file path, not <code>null</code>
* @return String the extension of the path
*/
* Answers the extension of the given path. An extension is normally a three
* character addition to the end of a filename separated from the filename
* by the '.' character.
*
* @param path
* a file path, not <code>null</code>
* @return String the extension of the path
*/
public static String getExtension(String path)
{
int index = path.lastIndexOf('.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment