commons-issues mailing list archives

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


Joerg Schaible commented on LANG-307:

Well, maybe you should have a second look at that library, because it can clone *ANY* Java
object. It uses [Objenesis|] to create
Java objects without calling a constructor. Additionally they have special functionality to
configure the cloning process especially to leave out _critical_ objects. This is why I call
this library _specialized_. However, I am not interested in getting *this* functionality into
lang, simply because it is based on undocumented stuff.

The problem with a BufferedImage: The critical data structure is not the BufferedImage itself
but one of the data structures it contains (IIRC it is a member of the contained Raster).
When you clone such a thing you will have in the end two objects pointing to the same memory
and when one of it is freed, the memory management is corrupted and you get all kind of nice
effects. And worse, this does normally not happen because a user is clonging an image, it
happens because they believe it is quite smart to clone AWT frames and Swing dialogs that
contain thumbnails and icons. This happened before and it is not hypothitic.

So, if we add your patch, I simply want to be sure that all committers know, what can of worms
we might open. It will certainly have a special need for documentation. And I am completely
confident, if your clone mechanism is *not* capable of silently processing _dangerous_ objects.

> 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