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

FastClonerTreeMap Comparator Bug #3

Closed
GoogleCodeExporter opened this issue Mar 14, 2015 · 15 comments
Closed

FastClonerTreeMap Comparator Bug #3

GoogleCodeExporter opened this issue Mar 14, 2015 · 15 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

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

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Thanks for the quick response!  Happy to help.

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

@GoogleCodeExporter
Copy link
Author

Cheers Jason

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

@GoogleCodeExporter
Copy link
Author

>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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

Thank you!

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

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