commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject Re: [fileupload] FileItem.getName() IE prefix
Date Tue, 11 Apr 2006 21:55:02 GMT
Martin Cooper wrote:
> Well, they've already got Commons IO, since FileUpload depends on that, and
> that has FileNameUtils.getName() to get just the file name, so do we really
> need to add another method in FileUpload that just wraps that call?
> 
> String filename = FileNameUtils.getName(item.getName());
> instead of:
> String file name = item.getName();
> doesn't seem so onerous.

The point is not that this code is onerous, but that it is knowledge 
about fileuploading that we have not encapsulated in [fileupload].

As a user of [fileupload] I should be presented with the fact that I 
have to make a choice in the API. At the very least, the javadoc for 
getName() should provide a full description of the problem.

I think I prefer getNameNoPath() as the method name. The reason is that 
it will appear next to getName() in IDE auto-complete, thus causing 
casual users to stop and think.

I volunteer to code this (or apply an external patch ;-) if it won't be 
-1'ed.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message