Author: scabanovich
Date: 2007-09-20 09:27:07 -0400 (Thu, 20 Sep 2007)
New Revision: 3733
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/FileTLDRecognizer.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppRecognizer.java
Log:
JBIDE-898
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/FileTLDRecognizer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/FileTLDRecognizer.java 2007-09-20
13:22:34 UTC (rev 3732)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/tld/model/FileTLDRecognizer.java 2007-09-20
13:27:07 UTC (rev 3733)
@@ -32,10 +32,19 @@
public FileTLDRecognizer() {}
public String getEntityName(String ext, String body) {
- return (body == null || !"tld".equals(ext)) ? null :
- (body.indexOf(TLD_DOC_PUBLICID_1_1) >= 0) ? "FileTLD_PRO" :
- (body.indexOf(TLD_DOC_PUBLICID_1_2) >= 0) ? "FileTLD_1_2" :
- (body.indexOf("<taglib") >= 0
+ if((body == null || !"tld".equals(ext))) return null;
+ int i = body.indexOf("<!DOCTYPE");
+ if(i >= 0) {
+ int j = body.indexOf(">", i);
+ if(j < 0) return null;
+ String dt = body.substring(i, j);
+ if(dt.indexOf("taglib") < 0) return null;
+ if(dt.indexOf(TLD_DOC_PUBLICID_1_1) > 0) return "FileTLD_PRO";
+ if(dt.indexOf(TLD_DOC_PUBLICID_1_2) > 0) return "FileTLD_1_2";
+ if(dt.indexOf("SYSTEM") > 0 &&
dt.indexOf("web-jsptaglibrary_1_1.dtd") > 0) return "FileTLD_PRO";
+ if(dt.indexOf("SYSTEM") > 0 &&
dt.indexOf("web-jsptaglibrary_1_2.dtd") > 0) return "FileTLD_1_2";
+ }
+ return (body.indexOf("<taglib") >= 0
&& body.indexOf(VERSION_2_0) > 0
&& body.indexOf("xmlns=" + XMLNS_2_0) > 0) ?
"FileTLD_2_0" :
(isTLD20WithNamespace(body, VERSION_2_0, XMLNS_2_0)) ? "FileTLD_2_0"
:
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppRecognizer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppRecognizer.java 2007-09-20
13:22:34 UTC (rev 3732)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppRecognizer.java 2007-09-20
13:27:07 UTC (rev 3733)
@@ -27,10 +27,19 @@
}
public String getEntityName(String ext, String body) {
- return (body == null || !"xml".equals(ext)) ? null :
- (body.indexOf(WebAppConstants.DOC_PUBLICID) >= 0 ||
- body.indexOf(WebAppConstants.DOC_PUBLICID_2_3) >= 0) ?
"FileWebApp" :
- (body.indexOf("<web-app") >= 0
+ if((body == null || !"xml".equals(ext))) return null;
+ int i = body.indexOf("<!DOCTYPE");
+ if(i >= 0) {
+ int j = body.indexOf(">", i);
+ if(j < 0) return null;
+ String dt = body.substring(i, j);
+ if(dt.indexOf("web-app") < 0) return null;
+ if(dt.indexOf(WebAppConstants.DOC_PUBLICID) > 0) return
"FileWebApp";
+ if(dt.indexOf(WebAppConstants.DOC_PUBLICID_2_3) > 0) return
"FileWebApp";
+ if(dt.indexOf("SYSTEM") > 0 &&
dt.indexOf("web-app_2_3.dtd") > 0) return "FileWebApp";
+ }
+
+ return (body.indexOf("<web-app") >= 0
&& body.indexOf("version=\"2.4\"") > 0
&&
body.indexOf("xmlns=\"http://java.sun.com/xml/ns/j2ee\"&qu... > 0) ?
"FileWebApp24" :
(body.indexOf("<web-app") >= 0