diff --git a/dist/Jsonix-all.js b/dist/Jsonix-all.js index d4d4e2d96..3e64d0aa5 100644 --- a/dist/Jsonix-all.js +++ b/dist/Jsonix-all.js @@ -921,6 +921,7 @@ Jsonix.XML.QName.key = function(namespaceURI, localPart) { Jsonix.Util.Ensure.ensureString(localPart); if (namespaceURI) { var colonPosition = localPart.indexOf(':'); + var localName; if (colonPosition > 0 && colonPosition < localPart.length) { localName = localPart.substring(colonPosition + 1); } else { @@ -4901,7 +4902,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { }; return new Jsonix.XML.Calendar(data); } - throw new Error('Value [' + value + '] does not match the xs:date pattern.'); + throw new Error('Value [' + text + '] does not match the xs:date pattern.'); }, parseDate : function(text, context, input, scope) { Jsonix.Util.Ensure.ensureString(text); @@ -4916,7 +4917,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { }; return new Jsonix.XML.Calendar(data); } - throw new Error('Value [' + value + '] does not match the xs:date pattern.'); + throw new Error('Value [' + text + '] does not match the xs:date pattern.'); }, parseTime : function(text, context, input, scope) { Jsonix.Util.Ensure.ensureString(text); @@ -4932,7 +4933,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { }; return new Jsonix.XML.Calendar(data); } - throw new Error('Value [' + value + '] does not match the xs:time pattern.'); + throw new Error('Value [' + text + '] does not match the xs:time pattern.'); }, parseTimezoneString : function(text) { // (('+' | '-') hh ':' mm) | 'Z' @@ -4955,7 +4956,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { var minute = parseInt(results[5], 10); return sign * (hour * 60 + minute); } - throw new Error('Value [' + value + '] does not match the timezone pattern.'); + throw new Error('Value [' + text + '] does not match the timezone pattern.'); } }, print : function(value, context, output, scope) { diff --git a/dist/Jsonix-min.js b/dist/Jsonix-min.js index a809535d9..7ed3f78c7 100644 --- a/dist/Jsonix-min.js +++ b/dist/Jsonix-min.js @@ -331,11 +331,12 @@ return new Jsonix.XML.QName(e,f,g) Jsonix.XML.QName.fromObjectOrString=function(f,d,e){if(Jsonix.Util.Type.isString(f)){return Jsonix.XML.QName.fromString(f,d,e) }else{return Jsonix.XML.QName.fromObject(f) }}; -Jsonix.XML.QName.key=function(f,e){Jsonix.Util.Ensure.ensureString(e); -if(f){var d=e.indexOf(":"); -if(d>0&&d0&&h 0 && colonPosition < localPart.length) { localName = localPart.substring(colonPosition + 1); } else { @@ -4901,7 +4902,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { }; return new Jsonix.XML.Calendar(data); } - throw new Error('Value [' + value + '] does not match the xs:date pattern.'); + throw new Error('Value [' + text + '] does not match the xs:date pattern.'); }, parseDate : function(text, context, input, scope) { Jsonix.Util.Ensure.ensureString(text); @@ -4916,7 +4917,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { }; return new Jsonix.XML.Calendar(data); } - throw new Error('Value [' + value + '] does not match the xs:date pattern.'); + throw new Error('Value [' + text + '] does not match the xs:date pattern.'); }, parseTime : function(text, context, input, scope) { Jsonix.Util.Ensure.ensureString(text); @@ -4932,7 +4933,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { }; return new Jsonix.XML.Calendar(data); } - throw new Error('Value [' + value + '] does not match the xs:time pattern.'); + throw new Error('Value [' + text + '] does not match the xs:time pattern.'); }, parseTimezoneString : function(text) { // (('+' | '-') hh ':' mm) | 'Z' @@ -4955,7 +4956,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { var minute = parseInt(results[5], 10); return sign * (hour * 60 + minute); } - throw new Error('Value [' + value + '] does not match the timezone pattern.'); + throw new Error('Value [' + text + '] does not match the timezone pattern.'); } }, print : function(value, context, output, scope) { diff --git a/nodejs/scripts/tests/xsd.js b/nodejs/scripts/tests/xsd.js index 0263651f8..812d4c173 100644 --- a/nodejs/scripts/tests/xsd.js +++ b/nodejs/scripts/tests/xsd.js @@ -222,6 +222,46 @@ module.exports = test.equal(-733, gd.timezone); test.equal('---06-12:13', Jsonix.Schema.XSD.Calendar.INSTANCE.print(gd)); + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parse('nomatch'); }, + /Value \[nomatch\] does not match xs:dateTime, xs:date, xs:time, xs:gYearMonth, xs:gYear, xs:gMonthDay, xs:gMonth or xs:gDay patterns\./); + + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parseGYearMonth('201002'); }, + /Value \[201002\] does not match the xs:gYearMonth pattern\./); + + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parseGYear('10'); }, + /Value \[10\] does not match the xs:gYear pattern\./); + + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parseGMonthDay('02-10'); }, + /Value \[02-10\] does not match the xs:gMonthDay pattern\./); + + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parseGMonth('02'); }, + /Value \[02\] does not match the xs:gMonth pattern\./); + + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parseGDay('01'); }, + /Value \[01\] does not match the xs:gDay pattern\./); + + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parseDateTime('2010-02-01 12:23:0'); }, + /Value \[2010-02-01 12:23:0\] does not match the xs:date pattern\./); + + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parseDate('20100201'); }, + /Value \[20100201\] does not match the xs:date pattern\./); + + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parseTime('12:23:0'); }, + /Value \[12:23:0\] does not match the xs:time pattern\./); + + test.throws( + function() { Jsonix.Schema.XSD.Calendar.INSTANCE.parseTimezoneString('PDT'); }, + /Value \[PDT\] does not match the timezone pattern\./); + test.done(); }, diff --git a/nodejs/tests/ar/package-lock.json b/nodejs/tests/ar/package-lock.json index e9a951229..79da81e06 100644 --- a/nodejs/tests/ar/package-lock.json +++ b/nodejs/tests/ar/package-lock.json @@ -670,7 +670,7 @@ }, "jsonix": { "version": "file:../../scripts/jsonix-2.4.2-SNAPSHOT.tgz", - "integrity": "sha512-IwkkaE3n7MjlA7LI1HEjGYSQxJoqP+WYk7Uaagkoq9wxbbTSJj43P1qlMR0YxPHXaIYyD7ktUbriqIkfKBpj5w==", + "integrity": "sha512-zhmtN7E2h9bQ8UOUnraOgiOVSuqbG0N39JZaRXe7xcksfijzjyEitjdsSmydRlLLSGjCobH5jBD4+qU7J9kWaw==", "requires": { "amdefine": "0.x.x", "xmldom": ">=0.1.21", diff --git a/nodejs/tests/basic/package-lock.json b/nodejs/tests/basic/package-lock.json index 1ef1e2038..8ae5f686e 100644 --- a/nodejs/tests/basic/package-lock.json +++ b/nodejs/tests/basic/package-lock.json @@ -683,7 +683,7 @@ }, "jsonix": { "version": "file:../../scripts/jsonix-2.4.2-SNAPSHOT.tgz", - "integrity": "sha512-IwkkaE3n7MjlA7LI1HEjGYSQxJoqP+WYk7Uaagkoq9wxbbTSJj43P1qlMR0YxPHXaIYyD7ktUbriqIkfKBpj5w==", + "integrity": "sha512-zhmtN7E2h9bQ8UOUnraOgiOVSuqbG0N39JZaRXe7xcksfijzjyEitjdsSmydRlLLSGjCobH5jBD4+qU7J9kWaw==", "requires": { "amdefine": "0.x.x", "xmldom": ">=0.1.21", diff --git a/nodejs/tests/browserify/package-lock.json b/nodejs/tests/browserify/package-lock.json index 93d1c15ab..2eea0d67c 100644 --- a/nodejs/tests/browserify/package-lock.json +++ b/nodejs/tests/browserify/package-lock.json @@ -669,7 +669,7 @@ }, "jsonix": { "version": "file:../../scripts/jsonix-2.4.2-SNAPSHOT.tgz", - "integrity": "sha512-IwkkaE3n7MjlA7LI1HEjGYSQxJoqP+WYk7Uaagkoq9wxbbTSJj43P1qlMR0YxPHXaIYyD7ktUbriqIkfKBpj5w==", + "integrity": "sha512-zhmtN7E2h9bQ8UOUnraOgiOVSuqbG0N39JZaRXe7xcksfijzjyEitjdsSmydRlLLSGjCobH5jBD4+qU7J9kWaw==", "requires": { "amdefine": "0.x.x", "xmldom": ">=0.1.21", diff --git a/nodejs/tests/po/package-lock.json b/nodejs/tests/po/package-lock.json index 6baa3a86c..fafea5d4b 100644 --- a/nodejs/tests/po/package-lock.json +++ b/nodejs/tests/po/package-lock.json @@ -665,7 +665,7 @@ }, "jsonix": { "version": "file:../../scripts/jsonix-2.4.2-SNAPSHOT.tgz", - "integrity": "sha512-IwkkaE3n7MjlA7LI1HEjGYSQxJoqP+WYk7Uaagkoq9wxbbTSJj43P1qlMR0YxPHXaIYyD7ktUbriqIkfKBpj5w==", + "integrity": "sha512-zhmtN7E2h9bQ8UOUnraOgiOVSuqbG0N39JZaRXe7xcksfijzjyEitjdsSmydRlLLSGjCobH5jBD4+qU7J9kWaw==", "requires": { "amdefine": "0.x.x", "xmldom": ">=0.1.21", diff --git a/nodejs/tests/wps/package-lock.json b/nodejs/tests/wps/package-lock.json index 682ab320a..ce606a37c 100644 --- a/nodejs/tests/wps/package-lock.json +++ b/nodejs/tests/wps/package-lock.json @@ -678,7 +678,7 @@ }, "jsonix": { "version": "file:../../scripts/jsonix-2.4.2-SNAPSHOT.tgz", - "integrity": "sha512-IwkkaE3n7MjlA7LI1HEjGYSQxJoqP+WYk7Uaagkoq9wxbbTSJj43P1qlMR0YxPHXaIYyD7ktUbriqIkfKBpj5w==", + "integrity": "sha512-zhmtN7E2h9bQ8UOUnraOgiOVSuqbG0N39JZaRXe7xcksfijzjyEitjdsSmydRlLLSGjCobH5jBD4+qU7J9kWaw==", "requires": { "amdefine": "0.x.x", "xmldom": ">=0.1.21", diff --git a/scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Schema/XSD/Calendar.js b/scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Schema/XSD/Calendar.js index 9aa22fde5..4736e619c 100644 --- a/scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Schema/XSD/Calendar.js +++ b/scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Schema/XSD/Calendar.js @@ -102,7 +102,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { }; return new Jsonix.XML.Calendar(data); } - throw new Error('Value [' + value + '] does not match the xs:date pattern.'); + throw new Error('Value [' + text + '] does not match the xs:date pattern.'); }, parseDate : function(text, context, input, scope) { Jsonix.Util.Ensure.ensureString(text); @@ -117,7 +117,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { }; return new Jsonix.XML.Calendar(data); } - throw new Error('Value [' + value + '] does not match the xs:date pattern.'); + throw new Error('Value [' + text + '] does not match the xs:date pattern.'); }, parseTime : function(text, context, input, scope) { Jsonix.Util.Ensure.ensureString(text); @@ -133,7 +133,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { }; return new Jsonix.XML.Calendar(data); } - throw new Error('Value [' + value + '] does not match the xs:time pattern.'); + throw new Error('Value [' + text + '] does not match the xs:time pattern.'); }, parseTimezoneString : function(text) { // (('+' | '-') hh ':' mm) | 'Z' @@ -156,7 +156,7 @@ Jsonix.Schema.XSD.Calendar = Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType, { var minute = parseInt(results[5], 10); return sign * (hour * 60 + minute); } - throw new Error('Value [' + value + '] does not match the timezone pattern.'); + throw new Error('Value [' + text + '] does not match the timezone pattern.'); } }, print : function(value, context, output, scope) {