Re: PageStore serializes more than needed ?

2007-07-05 Thread Jean-Baptiste Quenot
* Matej Knopp:

 indeed, (2)  was a bug  and it  should be fixed  now. Thanks for
 spotting it.

Any JIRA issue  for this, or it's  a very minor bug  that does not
deserve to be part of the formal change log?
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/


Re: FileUploadField closing input streams behind my back

2007-07-05 Thread Eelco Hillenius

For that matter, why aren't you using Commons?  The very problem (file
uploading) you are dickering with is precisely one that we addressed in
Commons years ago.  The core code is in Commons I/O:

http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/ap
ache/commons/io/


We have been using commons-io from the start, but the code grew in a
different direction due to various reasons.

Eelco


Re: FileUploadField closing input streams behind my back

2007-07-05 Thread Igor Vaynberg

On 7/5/07, Noel J. Bergman [EMAIL PROTECTED] wrote:


a/org/apache/commons/fileupload/

Sorry if this comes across as being snarky, but rewriting the wheel is bad
enough;  getting it wrong is worse.

--- Noel




actually if you take a look you will see that our upload code does come from
commons-fileupload. we just took what little pieces we needed instead of
adding a dependency on the entire thing.

-igor


IComponentInheritedModel IWrapModel just to get the component in model

2007-07-05 Thread Vincent Demay

Hi

I have a custom model where i need to access to the component. The only 
method I found seems me a little bit overkill :
my model should implement IComponentInheritedModel and I also need to 
declare a new class implementing IWrapModel to return on 
wrapOnInheritance. Furthermore all this stuff is not really oriented to 
simply get the component in the model. (maybe there is a better way?)


I thought about a very simple way :
Just creating a new interface :
IComponentAwareModel{ void setComponent(Component component)}
and adding in component.class
if (model instanceof IComponentAwareModel){ 
((IComponentAwareModel)model.setComponent(this))}


I think it also avoid to write 40 code lines just to get the component 
in the model.


WDYT?

--
Vincent Demay




RE: FileUploadField closing input streams behind my back

2007-07-05 Thread Noel J. Bergman
 Do we really need to go around and aggressively clean up these
 InputStreams? Can't we do that in a finalize() method somewhere?

NO!!  NEVER use finalize(), especially not server-side.

If you need to automatically cleanup resources when they are unused, without
having to call explicit cleanup, use phantom references.  That is why they
exist.  If you don't know how to use phantom references, review the
FileCleaner that I contributed to Commons.

For that matter, why aren't you using Commons?  The very problem (file
uploading) you are dickering with is precisely one that we addressed in
Commons years ago.  The core code is in Commons I/O:

http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/ap
ache/commons/io/

and there are servlet and portlet drivers for it in Commons FileUpload (gee,
need a hint as to what problem the code solves?):

http://svn.apache.org/viewvc/jakarta/commons/proper/fileupload/trunk/src/jav
a/org/apache/commons/fileupload/

Sorry if this comes across as being snarky, but rewriting the wheel is bad
enough;  getting it wrong is worse.

--- Noel




Re: IComponentInheritedModel IWrapModel just to get the component in model

2007-07-05 Thread Jean-Baptiste Quenot
* Vincent Demay:

 I think  it also avoid  to write 40 code  lines just to  get the
 component in the model.

I also  find it utterly complicated.   Is there a reason  for this
that we are overlooking?
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/


Re: IComponentInheritedModel IWrapModel just to get the component in model

2007-07-05 Thread Matej Knopp

Perhaps you are looking for IComponentAssignedModel ?

-Matej

On 7/5/07, Jean-Baptiste Quenot [EMAIL PROTECTED] wrote:

* Vincent Demay:

 I think  it also avoid  to write 40 code  lines just to  get the
 component in the model.

I also  find it utterly complicated.   Is there a reason  for this
that we are overlooking?
--
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/



RE: FileUploadField closing input streams behind my back

2007-07-05 Thread Noel J. Bergman
OK, I went looking and found:

http://svn.apache.org/viewvc/incubator/wicket/tags/wicket-1.3.0-beta2/jdk-1.
4/wicket/src/main/java/org/apache/wicket/util/file/

So you do have an old version of the FileCleaner, albeit prior to
enhancements that have been added to the current version in Commons, and you
have added some support for it to
org/apache/wicket/util/upload/DiskFileItem.java, but you also have a bogus
finalizer in DiskFileItem, and you're lacking the support code from Commons
File Upload.

I understand we just took what little pieces we needed instead of adding a
dependency on the entire thing, but what is meant by the code grew in a
different direction due to various reasons?

--- Noel

-Original Message-
From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 05, 2007 12:56
To: wicket-dev@incubator.apache.org
Subject: Re: FileUploadField closing input streams behind my back


On 7/5/07, Noel J. Bergman [EMAIL PROTECTED] wrote:

 a/org/apache/commons/fileupload/

 Sorry if this comes across as being snarky, but rewriting the wheel is bad
 enough;  getting it wrong is worse.

 --- Noel


actually if you take a look you will see that our upload code does come from
commons-fileupload. we just took what little pieces we needed instead of
adding a dependency on the entire thing.

-igor

-Original Message-
From: Eelco Hillenius [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 05, 2007 12:58
To: wicket-dev@incubator.apache.org
Subject: Re: FileUploadField closing input streams behind my back


 For that matter, why aren't you using Commons?  The very problem (file
 uploading) you are dickering with is precisely one that we addressed in
 Commons years ago.  The core code is in Commons I/O:


http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/ap
 ache/commons/io/

We have been using commons-io from the start, but the code grew in a
different direction due to various reasons.

Eelco




Re: IComponentInheritedModel IWrapModel just to get the component in model

2007-07-05 Thread Igor Vaynberg

On 7/5/07, Jean-Baptiste Quenot [EMAIL PROTECTED] wrote:


* Vincent Demay:

 I think  it also avoid  to write 40 code  lines just to  get the
 component in the model.

I also  find it utterly complicated.   Is there a reason  for this
that we are overlooking?
--



yes, there is. the interface you are proposing would only support a single
model instance per component relationship, where in reality it is often the
case that a single instance of imodel is assigned to multiple components.

-igor




Jean-Baptiste Quenot

aka  John Banana   Qwerty
http://caraldi.com/jbq/



Re: FileUploadField closing input streams behind my back

2007-07-05 Thread Eelco Hillenius

I understand we just took what little pieces we needed instead of adding a
dependency on the entire thing, but what is meant by the code grew in a
different direction due to various reasons?


We started using commons-io as just a dependency, but after a while we
needed some tweaks to better let it integrate with Wicket (at least
that's what I remember) and later on, when we tried to cut down on
dependencies we went from a 'patched' version to just taking the
classes we needed.

Eelco