Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
1. Fixed user-reported core-dump for JSON-to-XML conversion.
2. Now also using getNameAsString() in PlanIterator.
3. Normalizing whitespace for JSound constraint error messages so they print 
better.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/211848

1. Fixed user-reported core-dump for JSON-to-XML conversion.
2. Now also using getNameAsString() in PlanIterator.
3. Normalizing whitespace for JSound constraint error messages so they print 
better.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/211848
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/base/plan_iterator.cpp'
--- src/runtime/base/plan_iterator.cpp	2014-02-25 00:14:59 +0000
+++ src/runtime/base/plan_iterator.cpp	2014-03-20 02:10:46 +0000
@@ -232,7 +232,7 @@
     else
       std::cout << "next (" << iter;
 
-    std::cout << " = " << typeid (*iter).name()
+    std::cout << " = " << iter->getNameAsString() // typeid (*iter).name()
               << ") -> "
               << "status: " << status << " -> "
               << ((status && result != NULL) ? result->show().c_str() : "null")

=== modified file 'src/runtime/json/snelson.cpp'
--- src/runtime/json/snelson.cpp	2013-12-27 15:11:16 +0000
+++ src/runtime/json/snelson.cpp	2014-03-20 02:10:46 +0000
@@ -186,6 +186,7 @@
       ADD_PAIR_ELEMENT( value_item->getStringValue() );
       PUSH_ITEM( xml );
       value_item = json_item->getObjectValue( value_item );
+      ZORBA_ASSERT( !!value_item );
       added_pair_element = true;
     }
 
@@ -246,6 +247,7 @@
         ADD_TYPE_ATTRIBUTE( "array" );
         ADD_ITEM_ELEMENT( "array" );
         PUSH_STATE( in_array );
+        PUSH_ITEM( json );
         PUSH_ITERATOR( cur_iter );
         cur_iter = value_item->getArrayValues();
         cur_iter->open();

=== modified file 'src/runtime/jsound/jsound_util.cpp'
--- src/runtime/jsound/jsound_util.cpp	2014-03-14 22:38:03 +0000
+++ src/runtime/jsound/jsound_util.cpp	2014-03-20 02:10:46 +0000
@@ -1951,13 +1951,15 @@
   it->open();
   while ( it->next( item ) ) {
     ASSERT_TYPE( item, "constraint", XS_STRING );
-    zstring const constraint_str( item->getStringValue() );
+    zstring constraint_str( item->getStringValue() );
     try {
       unique_ptr<constraint> c( new constraint( constraint_str ) );
       constraints_.push_back( c.get() );
       c.release();
     }
     catch ( ZorbaException const &e ) {
+      ascii::replace_all( constraint_str, '\n', ' ' );
+      ascii::normalize_space( constraint_str );
       throw XQUERY_EXCEPTION(
         jse::ILLEGAL_FACET_VALUE,
         ERROR_PARAMS(

=== added file 'test/rbkt/ExpQueryResults/zorba/json/json-snelson-j2x-object-06.xml.res'
--- test/rbkt/ExpQueryResults/zorba/json/json-snelson-j2x-object-06.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/json/json-snelson-j2x-object-06.xml.res	2014-03-20 02:10:46 +0000
@@ -0,0 +1,8 @@
+<json xmlns="http://john.snelson.org.uk/parsing-json-into-xquery"; type="object">
+  <pair name="x" type="object">
+    <pair name="a" type="array">
+      <item type="number">1</item>
+    </pair>
+    <pair name="b" type="number">2</pair>
+  </pair>
+</json>

=== added file 'test/rbkt/Queries/zorba/json/json-snelson-j2x-object-06.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-j2x-object-06.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-j2x-object-06.xq	2014-03-20 02:10:46 +0000
@@ -0,0 +1,12 @@
+import module namespace jx = "http://zorba.io/modules/json-xml";;
+
+let $json :=
+  {
+    "x" : {
+      "a" : [ 1 ],
+      "b" : 2
+    }
+  }
+return jx:json-to-xml( $json )
+
+(: vim:set et sw=2 ts=2: :)

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to