commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Griffin DeJohn (JIRA)" <>
Subject [jira] Commented: (LANG-307) CloneUtils - utility class to enable cloning via various different mechanisms
Date Fri, 10 Dec 2010 06:16:01 GMT


Griffin DeJohn commented on LANG-307:

BufferedImage can't be cloned this way, it simply fails. No danger there. Its constructors
either can't be successfully invoked because they have abstract parameters, or they're picky
and throw an exception when passed the default values for primitives. If an instance of that
class is present in the object graph, my method would try to find a way around it. Failing
that, it'll just throw an exception. Could you give a working example and explain the problem?

Socket can't be cloned this way, either. But as for File, which does work, and classes in
general that manage system resources, that's a problem no matter what. If you check out the
examples page at the site you linked to, it specifically warns, "Cloning objects that contain
references to system resources might be dangerous." So, using that library doesn't solve anything.
Actually, looking at the source code in the Cloner class, they're doing the same thing I'm
doing, but not as well (for example, they're just calling Class.newInstance to create the
clone, which will fail for anything lacking a nullary constructor). It's the exact same recursive
algorithm, though, so it's not any faster, or more specialized, whatever that means.

> CloneUtils - utility class to enable cloning via various different mechanisms
> -----------------------------------------------------------------------------
>                 Key: LANG-307
>                 URL:
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Henri Yandell
>             Fix For: 3.1
>         Attachments:, lang-307.patch
> Taken from the tasks.html. No idea if we want to do it or not.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message