akshayyn / cloning

Automatically exported from code.google.com/p/cloning
Other
0 stars 0 forks source link

FastClonerTreeMap Comparator Bug #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When cloning TreeMaps or TreeSets of objects that do not implement Comparable, 
a ClassCastException occurs.

This can be fixed by changing FastClonerTreeMap line 19 from:
final TreeMap result = new TreeMap();

to

final TreeMap result = new TreeMap(m.comparator());

This is an issue in two situations:
1) The above mentioned issue where the Map/Set contains objects that do not 
implement Comparable, but the client has passed in a Comparator in the 
constructor of the Map/Set.
2) The Map/Set does contain objects that implement Comparable, but the client 
wishes to order the elements differently with a separate Comparator.  The 
cloned object will iterate over objects in their natural order instead of the 
specified order in the Comparator.  This difference may lead to unintended 
consequences.

Please let me know if there is a better solution to this problem.

Thanks,
Jason Lee

Original issue reported on code.google.com by jasondanlee on 5 Dec 2011 at 10:35

GoogleCodeExporter commented 8 years ago
Thanks Jason, fixed in 1.7.8. Unfortunately maven can't be used to download 
this dependency since I don't have access to the maven repo right now.

I implemented the suggested solution.

Original comment by kostas.k...@googlemail.com on 6 Dec 2011 at 8:36

GoogleCodeExporter commented 8 years ago

Original comment by kostas.k...@googlemail.com on 6 Dec 2011 at 8:37

GoogleCodeExporter commented 8 years ago
Thanks for the quick response!  Happy to help.

Original comment by jasondanlee on 6 Dec 2011 at 9:01

GoogleCodeExporter commented 8 years ago
Cheers Jason

Original comment by kostas.k...@googlemail.com on 6 Dec 2011 at 11:43

GoogleCodeExporter commented 8 years ago
>Thanks Jason, fixed in 1.7.8. Unfortunately maven can't be used to download 
this dependency since I don't have access to the maven repo right now.

If company was changed or something - upload this project to maven repo with 
new path (company name). Ability to download artefacts from maven repo is very 
important.

Original comment by alexander.lipatov@gmail.com on 19 Dec 2011 at 9:25

GoogleCodeExporter commented 8 years ago
Alexander, just managed to upload a new version in a maven repo, please check 
maven wiki.

Original comment by kostas.k...@googlemail.com on 17 Jan 2012 at 11:13

GoogleCodeExporter commented 8 years ago
Currently it does not work for me:

[ERROR] Failed to execute goal on project website: Could not resolve 
dependencies for project website:war:1.0-SNAPSHOT: Failed to collect 
dependencies for [uk.com.robust-it:cloning:jar:1.7.9 (compile), 
org.apache.wicket:wicket-core:jar:1.5.3 (compile), 
org.slf4j:slf4j-log4j12:jar:1.6.2 (compile), log4j:log4j:jar:1.2.16 (compile), 
junit:junit:jar:4.8.1 (test), javax.activation:activation:jar:1.1 (compile), 
javax.mail:mail:jar:1.4.1 (compile), 
org.eclipse.jetty.aggregate:jetty-all-server:jar:7.5.0.v20110901 (provided)]: 
Failed to read artifact descriptor for uk.com.robust-it:cloning:jar:1.7.9: 
Could not transfer artifact uk.com.robust-it:cloning:pom:1.7.9 from/to 
sonatype-staging 
(https://oss.sonatype.org/service/local/staging/deploy/maven2/): Access denied 
to: 
https://oss.sonatype.org/service/local/staging/deploy/maven2/uk/com/robust-it/cl
oning/1.7.9/cloning-1.7.9.pom -> [Help 1]

Original comment by alexander.lipatov@gmail.com on 17 Jan 2012 at 11:54

GoogleCodeExporter commented 8 years ago
Did you added the additional maven repo?

http://code.google.com/p/cloning/wiki/Maven_Dependency

Original comment by kostas.k...@googlemail.com on 18 Jan 2012 at 7:36

GoogleCodeExporter commented 8 years ago
Yes, additional maven repo was added.

As you can see from error message, link 
"https://oss.sonatype.org/service/local/staging/deploy/maven2/uk/com/robust-it/c
loning/1.7.9/cloning-1.7.9.pom" is not accessible. Try to navigate it using 
browser. My browser is asking for username and password.

Original comment by alexander.lipatov@gmail.com on 19 Jan 2012 at 9:13

GoogleCodeExporter commented 8 years ago
Hmm, probably I had to close the staging repository. It should be ok soon but 
still that link doesn't work.

Original comment by kostas.k...@googlemail.com on 19 Jan 2012 at 9:03

GoogleCodeExporter commented 8 years ago
this url works in the browser and doesn't require password:

https://oss.sonatype.org/content/repositories/ukcomrobust-it-167/uk/com/robust-i
t/cloning/1.7.9/

I'm confused with sonatype, I still don't understand how it works.

Original comment by kostas.k...@googlemail.com on 19 Jan 2012 at 9:08

GoogleCodeExporter commented 8 years ago
I don't know correct this link or not. But it works!
<repository>
    <id>sonatype-staging</id>
    <url>https://oss.sonatype.org/content/repositories/ukcomrobust-it-167</url></repository>

Original comment by alexander.lipatov@gmail.com on 20 Jan 2012 at 8:00

GoogleCodeExporter commented 8 years ago
Probably this will do for a while. I've just "released" the staging repository. 
I believe this means it will be sync'd with central, which in turn means that 
the dependency can be downloaded without any extra repository. I would think it 
would take a couple of days.

Original comment by kostas.k...@googlemail.com on 21 Jan 2012 at 10:35

GoogleCodeExporter commented 8 years ago
the url should now be 

https://oss.sonatype.org/content/repositories/releases/

until it is sync'd with central

Original comment by kostas.k...@googlemail.com on 24 Jan 2012 at 9:36

GoogleCodeExporter commented 8 years ago
Thank you!

Original comment by alexander.lipatov@gmail.com on 24 Jan 2012 at 9:38