[Laszlo-checkins] r5896 - openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler
pbr@openlaszlo.org
pbr at openlaszlo.org
Wed Aug 1 10:28:42 PDT 2007
Author: pbr
Date: 2007-08-01 10:28:36 -0700 (Wed, 01 Aug 2007)
New Revision: 5896
Modified:
openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java
openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java
Log:
Change 20070731-Philip-4 by Philip at Philip-DC on 2007-07-31 17:09:38 EST
in /cygdrive/f/laszlo/svn/src/svn/openlaszlo/branches/wafflecone
for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
Summary: Wafflecone: Only write 'validate' attribute if explicitly defined by th
e user
New Features:
Bugs Fixed: LPP-3988
Technical Reviewer: ptw
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
A canvas or library can define an attribute called 'validate' to bypass XML vali
dation. If the user does not explicitly define it, validate is set to true. With
binary libraries, validate was unconditionally written to the output. This caus
es warning messages like the ones mentioned in LPP-3988. The fix is to write the
validate attribute only when explicitly defined inside a library.
CompilationEnvironment.java
Define a new property, e_validate, that is defined only when the user explicit
ly defines the validate attribute.
ToplevelCompiler.java
Modified setValidateProperty() to set e_validate if the user specified the val
idate attribute in the canvas or library.
LibraryWriter.java
Writes validate attribute only if e_validate and validate are defined properti
es.
Tests:
See test file attached to LPP-3988.lzx. When run without this patch, a warning
is generated when lpp3988.lzx is run. No warning is reported when the patch is
applied. You can also look inside the two binary compiled files to see that 'val
idate' is only written when explicitly specified.
Files:
M WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.jav
a
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20070731-Philip-4.tar
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java 2007-08-01 16:46:29 UTC (rev 5895)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java 2007-08-01 17:28:36 UTC (rev 5896)
@@ -33,6 +33,8 @@
public static final String PROFILE_PROPERTY = "profile";
public static final String LINK_PROPERTY = "link";
public static final String VALIDATE_PROPERTY = "validate";
+ // e_validate is defined if a user explicitly defined validate attribute
+ public static final String VALIDATE_EXPLICIT_PROPERTY = "e_validate";
public static final String CSSFILE_PROPERTY = "cssfile";
// Log all debug.write messages back to the server
public static final String LOGDEBUG_PROPERTY = "logdebug";
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java 2007-08-01 16:46:29 UTC (rev 5895)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java 2007-08-01 17:28:36 UTC (rev 5896)
@@ -99,10 +99,13 @@
}
private void exportAttributes() {
- // Write out the validate attribute of the source library
- String property = CompilationEnvironment.VALIDATE_PROPERTY;
- String validate = mEnv.getProperty(property, null);
- if (validate != null) {
+ // Write out the validate attribute of the source library, but only if
+ // it was explicitly defined by the user
+ String property = CompilationEnvironment.VALIDATE_PROPERTY;
+ String e_property = CompilationEnvironment.VALIDATE_EXPLICIT_PROPERTY;
+ String validate = mEnv.getProperty(property, null);
+ String e_validate = mEnv.getProperty(e_property, null);
+ if (e_validate != null && validate != null) {
out.println("<attribute name='" + property + "' value='" + validate + "' />");
}
}
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java 2007-08-01 16:46:29 UTC (rev 5895)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java 2007-08-01 17:28:36 UTC (rev 5896)
@@ -84,8 +84,11 @@
*/
void setValidateProperty(Element root , CompilationEnvironment env) {
String validate = CompilationEnvironment.VALIDATE_PROPERTY;
+ String e_validate = CompilationEnvironment.VALIDATE_EXPLICIT_PROPERTY;
// Look for canvas attribute
if (root.getAttributeValue(validate) != null) {
+ // Record that the user explicitly defined validate
+ env.setProperty(e_validate, true);
if ("false".equals(root.getAttributeValue("validate"))) {
env.setProperty(validate, false);
} else {
@@ -99,6 +102,8 @@
Element child = (Element) iter.next();
if (child.getName().equals("attribute")
&& validate.equals(child.getAttributeValue("name"))) {
+ // Record that the user explicitly defined validate
+ env.setProperty(e_validate, true);
if ("false".equals(child.getAttributeValue("value"))) {
env.setProperty(validate, false);
}
More information about the Laszlo-checkins
mailing list