summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-05-29 13:45:06 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-05-29 13:45:06 (GMT)
commit91c81948221cac182e6f64a939983af2bb7a91b0 (patch)
tree81458a9db1f4664df4896ee8fc4a6d74ba8551c7
parent4799b35d2457f1cfc746701ea347c89ae9887ca9 (diff)
downloaduscxml-91c81948221cac182e6f64a939983af2bb7a91b0.zip
uscxml-91c81948221cac182e6f64a939983af2bb7a91b0.tar.gz
uscxml-91c81948221cac182e6f64a939983af2bb7a91b0.tar.bz2
Fixed issue 141
-rw-r--r--src/uscxml/debug/InterpreterIssue.cpp8
-rw-r--r--src/uscxml/interpreter/InterpreterImpl.cpp1
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp2
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp2
-rw-r--r--test/src/test-validating.cpp18
5 files changed, 27 insertions, 4 deletions
diff --git a/src/uscxml/debug/InterpreterIssue.cpp b/src/uscxml/debug/InterpreterIssue.cpp
index a4d8841..346c0f6 100644
--- a/src/uscxml/debug/InterpreterIssue.cpp
+++ b/src/uscxml/debug/InterpreterIssue.cpp
@@ -147,10 +147,16 @@ std::list<InterpreterIssue> InterpreterIssue::forInterpreter(InterpreterImpl* in
// some things we need to prepare first
if (interpreter->_factory == NULL)
interpreter->_factory = Factory::getInstance();
- interpreter->setupDOM();
std::list<InterpreterIssue> issues;
+ try {
+ interpreter->setupDOM();
+ } catch(Event e) {
+ InterpreterIssue issue("Could not setup SCXML DOM: " + e.data.asJSON(), NULL, InterpreterIssue::USCXML_ISSUE_FATAL);
+ issues.push_back(issue);
+ }
+
if (!interpreter->_scxml) {
InterpreterIssue issue("No SCXML element to be found", NULL, InterpreterIssue::USCXML_ISSUE_FATAL);
issues.push_back(issue);
diff --git a/src/uscxml/interpreter/InterpreterImpl.cpp b/src/uscxml/interpreter/InterpreterImpl.cpp
index f7a46fc..bc8d2b9 100644
--- a/src/uscxml/interpreter/InterpreterImpl.cpp
+++ b/src/uscxml/interpreter/InterpreterImpl.cpp
@@ -315,6 +315,7 @@ SCXML_STOP_SEARCH:
XERCESC_NS::DOMText* scriptText = _document->createTextNode(X(contents));
XERCESC_NS::DOMNode* newNode = _document->importNode(scriptText, true);
script->appendChild(newNode);
+ script->removeAttribute(kXMLCharSource); // remove attribute for validation: see issue 141
}
}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
index 4203305..921f4cf 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
@@ -583,7 +583,7 @@ Data JSCDataModel::getValueAsData(const JSValueRef value) {
char* buf = new char[maxSize];
JSStringGetUTF8CString(stringValue, buf, maxSize);
std::string property(buf);
- if (!isNumeric(property.c_str(), 10))
+ if (!isInteger(property.c_str(), 10))
isArray = false;
propertySet.insert(property);
//JSStringRelease(stringValue); // JSPropertyNameArrayRelease does the job it seems
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
index de3078b..4f78e7d 100644
--- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
@@ -163,7 +163,7 @@ static luabridge::LuaRef getDataAsLua(lua_State* _luaState, const Data& data) {
luaData = luabridge::newTable(_luaState);
std::map<std::string, Data>::const_iterator compoundIter = data.compound.begin();
while(compoundIter != data.compound.end()) {
- if (isNumeric(compoundIter->first.c_str(), 10) && strTo<size_t>(compoundIter->first) > 0) {
+ if (isInteger(compoundIter->first.c_str(), 10) && strTo<size_t>(compoundIter->first) > 0) {
// it makes a difference whether we pass a numeric string or a proper number!
luaData[strTo<size_t>(compoundIter->first)] = getDataAsLua(_luaState, compoundIter->second);
} else {
diff --git a/test/src/test-validating.cpp b/test/src/test-validating.cpp
index e69c07d..ae2a2f5 100644
--- a/test/src/test-validating.cpp
+++ b/test/src/test-validating.cpp
@@ -351,6 +351,22 @@ bool attributeConstraints() {
}
{
+ // source with src and child content, not allowed
+ const char* xml =
+ "<scxml>"
+ " <state id=\"start\">"
+ " <onentry>"
+ " <script src=\"test-validating\"/>"
+ " </onentry>"
+ " </state>"
+ "</scxml>";
+
+ std::set<std::string> issueLocations = issueLocationsForXML(xml);
+ assert(issueLocations.size() == 0);
+ }
+
+
+ {
// invoke with namelist and param, not allowed
const char* xml =
"<scxml>"
@@ -868,7 +884,7 @@ bool syntaxErrors() {
int main(int argc, char** argv) {
factory = Factory::getInstance();
- return EXIT_SUCCESS;
+// return EXIT_SUCCESS;
try {
using namespace XERCESC_NS;