[ome-users] NegativeSizeException using getUserDetails

Mario Valle mvalle at cscs.ch
Mon Dec 22 04:51:42 GMT 2008


Good morning Chris!

Chris Allan wrote:
> Hi guys,
>
> In case you haven't already Mario, NegativeSizeException's do imply a 
> client/server mismatch. Best to check that before you go digging any 
> deeper.
Could be. I downloaded OMERO source from svn trunk. Which is the correct 
svn tag to be aligned with Beta 3.2?

Thanks!
                   mario
>
> Ciao.
>
> -Chris
>
> On 17 Dec 2008, at 13:49, Bernhard Voigt wrote:
>
>> Dear Mario!
>>
>> I compiled your code and it works fine for me under Beta 3.1.1.
>>
>> By the way, you need to adapt the check of the returned map, the map 
>> will always have keys that you've originally passed to the query 
>> method. It will have null pointers or objects as values. The objects 
>> need to be casted, before you have access to the methods - this is 
>> Ice-specific:
>>
>> for(im=m.begin(); im != m.end(); ++im) {
>>       cout << im->first;
>>       omero::model::ExperimenterIPtr user = 
>> omero::model::ExperimenterIPtr::dynamicCast(im->second);
>>       if (user) {
>>     cout << " id: " << user->getId();
>>       } else {
>>     cout << " not found";
>>       }
>>       cout << endl;
>>     }
>>
>> Best wishes! Bernhard
>>
>>
>> On Tue, Dec 16, 2008 at 4:13 PM, Mario Valle <mvalle at cscs.ch> wrote:
>> I'm expanding the simple client to try to learn OmeroCpp.
>> The example below works (and obviously returns no result) if you 
>> comment the line marked //1
>> Otherwise it crashes in the getUserDetails() call with:
>> terminate called after throwing an instance of 
>> 'Ice::NegativeSizeException'
>>   what():  /Users/mvalle/Ice-3.3.0/cpp/include/Ice/BasicStream.h:360:
>> Ice::NegativeSizeException:
>> protocol error: negative size for sequence, dictionary, etc.
>>
>> The code is translated (hopefully correctly) from the shoola 
>> OMEROGateway.java file around
>> line 1015.
>>
>> Anyway, is anyone around that have any OmeroCpp client code to share?
>>
>> Thanks!
>>        mario
>>
>> #include <omero/client.h>
>> #include <iostream>
>>
>> using namespace std;
>>
>> int main(int argc, char* argv[])
>> {
>>     //
>>     // Connect to OMERO
>>     //
>>     cout << "--- Connect ---" << endl;
>>     omero::client omero(argc, argv);
>>     omero::api::ServiceFactoryPrx sf = omero.createSession();
>>     sf->closeOnDestroy();
>>
>>     //
>>     // Try the Pojos services
>>     //
>>     cout << "--- Pojos ---" << endl;
>>
>>     omero::api::IPojosPrx pojo = omero.getSession()->getPojosService();
>>
>>     omero::api::StringSet list;
>>     list.push_back("mvalle");  //1
>>
>>     omero::sys::ParamMap options;
>>     omero::api::UserMap m;
>>
>>     m = pojo->getUserDetails(list, options);
>>
>>     //
>>     // Look at the results
>>     //
>>     cout << "--- getUserDetails ---" << endl;
>>     cout << m.size() << endl;
>>
>>     omero::api::UserMap::const_iterator im;
>>     for(im=m.begin(); im != m.end(); ++im) cout << im->first << endl;
>>
>>     //
>>     // Check the IAdmin interface
>>     //
>>     cout << "--- Admin ---" << endl;
>>
>>     // IAdmin is responsible for all user/group creation, password 
>> changing, etc.
>>     omero::api::IAdminPrx  admin = 
>> omero.getSession()->getAdminService();
>>
>>     // Who you are logged in as.
>>     cout << admin->getEventContext()->userName << endl;
>>
>>     return 0;
>> }
>> ~
>>
>>
>>
>> -- 
>> Ing. Mario Valle
>> Data Analysis Group                              | 
>> http://www.cscs.ch/~mvalle
>> Swiss National Supercomputing Centre (CSCS)      | Tel:  +41 (91) 
>> 610.82.60
>> v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 
>> 610.82.82
>> _______________________________________________
>> ome-users mailing list
>> ome-users at lists.openmicroscopy.org.uk
>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>>
>> _______________________________________________
>> ome-users mailing list
>> ome-users at lists.openmicroscopy.org.uk
>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>


-- 
Ing. Mario Valle
Data Analysis Group                              | http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)      | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82




More information about the ome-users mailing list