Author: scabanovich
Date: 2012-02-27 21:32:24 -0500 (Mon, 27 Feb 2012)
New Revision: 39156
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractXMLFileImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileXMLImpl.java
Log:
JBIDE-11066
https://issues.jboss.org/browse/JBIDE-10787
Prevented loading of entities from internet.
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractXMLFileImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractXMLFileImpl.java 2012-02-27
17:51:23 UTC (rev 39155)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractXMLFileImpl.java 2012-02-28
02:32:24 UTC (rev 39156)
@@ -13,7 +13,6 @@
import java.text.MessageFormat;
import java.util.*;
import org.jboss.tools.common.model.markers.ResourceMarkers;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.XModelObjectConstants;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.RecognizedFileImpl;
@@ -54,7 +53,12 @@
}
protected final void setErrors(String body, boolean checkDTD, boolean checkSchema) {
- String[] errors = (body.length() == 0) ? null : XMLUtil.getXMLErrors(new
java.io.StringReader(body), checkDTD, checkSchema);
+ String[] errors = (body.length() == 0) ? null
+ //do not compute errors for unrecognized files.
+ : "FileXML".equals(getModelEntity().getName()) ? null //$NON-NLS-1$
+ //do not compute errors for files in jars
+ : (getParent() instanceof JarFolderImpl) ? null
+ : XMLUtil.getXMLErrors(new java.io.StringReader(body), checkDTD, checkSchema);
if(errors == null || errors.length == 0) {
if(loaderError != null) errors = new String[]{loaderError};
}
@@ -85,7 +89,7 @@
// but use similar format to mention io exception.
// ModelPlugin.getPluginLog().logError(e);
}
- String ep = MessageFormat.format("ERROR: {0} {1}",
FindObjectHelper.makeRef(getPath() + ":" + ln1, ln + ":" + pos), er);
//$NON-NLS-2$ //$NON-NLS-3$
+ String ep = MessageFormat.format("ERROR: {0} {1}",
FindObjectHelper.makeRef(getPath() + ":" + ln1, ln + ":" + pos), er);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if(iln < 0) markers.lines.remove(ep);
else markers.lines.put(ep, Integer.valueOf(iln));
sb.append(ep).append('\n');
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileXMLImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileXMLImpl.java 2012-02-27
17:51:23 UTC (rev 39155)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileXMLImpl.java 2012-02-28
02:32:24 UTC (rev 39156)
@@ -31,7 +31,8 @@
if(name.equals("_hasErrors_")) { //$NON-NLS-1$
return super.get(XModelObjectConstants.ATTR_NAME_IS_INCORRECT);
}
- if(!markersReset && isActive()) {
+ if(!markersReset && isActive()
+ && !"NAME".equals(name) &&
!"EXTENSION".equals(name) && !"overlapped".equals(name)) {
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
updateMarkers(super.get(XModelObjectConstants.ATTR_NAME_BODY));
}
return super.get(name);