BZ-1051469 - NPE when building project with kbase or ksession that are not in xsd:ID format

(cherry picked from commit 2f2cc6cdb1c17a494786c8746f549812e6b67c98)