mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-24 23:17:56 +01:00
Improve mindmap format validation.
This commit is contained in:
parent
c5c47892cb
commit
20b2e8f1e8
@ -36,10 +36,16 @@ abstract public class MindmapUtils {
|
|||||||
throw InvalidMindmapException.invalidFormat(xmlDoc);
|
throw InvalidMindmapException.invalidFormat(xmlDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate that the number of nodes is not bigger 500 nodes.
|
|
||||||
int numberOfTopics = xmlDoc.split("<topic").length;
|
int numberOfTopics = xmlDoc.split("<topic").length;
|
||||||
|
// Any valid map must contain at least a central topic ...
|
||||||
|
if (numberOfTopics == 0) {
|
||||||
|
throw InvalidMindmapException.invalidFormat(xmlDoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate that the number of nodes is not bigger 5000 nodes.
|
||||||
if (numberOfTopics > MAX_SUPPORTED_NODES) {
|
if (numberOfTopics > MAX_SUPPORTED_NODES) {
|
||||||
throw InvalidMindmapException.tooBigMindnap(numberOfTopics);
|
throw InvalidMindmapException.tooBigMindnap(numberOfTopics);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user