You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stefan Bodewig <bo...@apache.org> on 2015/01/11 19:58:11 UTC

Re: svn commit: r1650632 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip: ZipArchiveEntry.java ZipArchiveOutputStream.java

On 2015-01-09, <kr...@apache.org> wrote:

> @@ -336,20 +338,48 @@ public class ZipArchiveEntry extends jav
>       * @since 1.1
>       */
>      public ZipExtraField[] getExtraFields(boolean includeUnparseable) {
>+        return includeUnparseable ?
>+                getAllExtraFields() :
>+                getParseableExtraFields();
>+    }

This is inconsistent WRT copying arrays or returning the internal
structure.  getAllExtraFields will create a copy of extraFields (unless
there has been unparseable data), but getParseableExtraFields() does
not.

I think it would be good to always create copies here, maybe call the
no-arg version of getExtraFields instead of getParseableExtraFields?

Stefan

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


Re: svn commit: r1650632 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip: ZipArchiveEntry.java ZipArchiveOutputStream.java

Posted by Kristian Rosenvold <kr...@gmail.com>.
I see you fixed this. Thanks.


Kristian


2015-01-11 19:58 GMT+01:00 Stefan Bodewig <bo...@apache.org>:
> On 2015-01-09, <kr...@apache.org> wrote:
>
>> @@ -336,20 +338,48 @@ public class ZipArchiveEntry extends jav
>>       * @since 1.1
>>       */
>>      public ZipExtraField[] getExtraFields(boolean includeUnparseable) {
>>+        return includeUnparseable ?
>>+                getAllExtraFields() :
>>+                getParseableExtraFields();
>>+    }
>
> This is inconsistent WRT copying arrays or returning the internal
> structure.  getAllExtraFields will create a copy of extraFields (unless
> there has been unparseable data), but getParseableExtraFields() does
> not.
>
> I think it would be good to always create copies here, maybe call the
> no-arg version of getExtraFields instead of getParseableExtraFields?
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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