Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report #21

Open
GoogleCodeExporter opened this issue Aug 29, 2015 · 3 comments
Open

Bug report #21

GoogleCodeExporter opened this issue Aug 29, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1.In application,publish a dataobject via libhagggle api like 
this:h.publishDataObject(dObj);(added several attributes before publish.)

2.Later,I want to delete this DataObject by calling 
h.deleteDataObject(dObj);(dObj here is the same dObj of previous 
"publishDataObject(dObj)",not that I get in onNewDataObject(DataObject 
dObj),notice) 


What is the expected output? What do you see instead?

Unfortunately,I couldn't delete this dataobject ,i analysied haggle.log which 
reported that dataobject id to delete is not in datastore.
For several days,i have been trying to figure it out.
In libhaggle,dataobject's attributes are stored in LIST,while in hagglekernel 
,dataobject will be constructed with its attributes stored in HashMap when 
receive a dataobject expressed in xml from application.

Thus,the call deleteDataObject(dObj) will calculate the dataobject's id and 
send this id to kernel.
But in kernel's dataStore ,id is calculate differently as the libhaggle does.
The order of attributes affects the result of SHA1 algrithm which generates 
dataobject ids.
In hagglekernel,calculate id using iterator of HashMap,result in getting 
different id from libhaggle does.  
So,my conclusion is that it is not correct to use HashMap in the hagglekernel 

(Sorry for my poor Chinese english)


What version of the product are you using? On what operating system?

Haggle-0.4

Please provide any additional information below.

I have tried to fix this bug by modifying Attributes:publish HashMap<> to 
Attributes:publish List<> and change (*it).second to (*it) and something 
else.Compiled but crashed when running.
Recently ,i'm using the Haggle project and I really appreciate your 
works.Thanks.
And I hope that you can fix this bug as soon as possible
I'm Donzell ,Harbin of China.My email lannhaii@126.com .

Original issue reported on code.google.com by Donzell...@gmail.com on 22 May 2011 at 2:30

@GoogleCodeExporter
Copy link
Author

Thank you for the bug report.

I couldn't reproduce this problem. I am running the Java TestApp, which is 
included with the Java bindings, and this application successfully deletes all 
objects it creates. Could you run this application to check whether it deletes 
data objects when you are running it?

Instructions for running TestApp can be found in /src/libhaggle/jni/README. I 
recommend checking the sqlite data base for extra confirmation. Open haggle.db 
(it is located in ~/.Haggle on, e.g., Linux) and input the following query: 
"select * from table_dataobjects;". You should see no data objects in this 
table in case deletion works (this is the result for me). If you do not delete 
data objects in your application (i.e., uncomment the delete call in TestApp), 
you will see that the data objects remain in the table.

Erik

Original comment by erik.nor...@gmail.com on 22 May 2011 at 3:52

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Ok, I think I've been able to reproduce this problem. As you describe, the 
issue is probably the hashing order of attributes. The solution is probably to 
always calculate the SHA1 hash in the order attributes appear in the XML header.

Original comment by erik.nor...@gmail.com on 22 May 2011 at 4:04

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

Yes,dataobjects with multi-attributes will lead to this problem.

Original comment by Donzell...@gmail.com on 23 May 2011 at 7:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant