git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Jonas Fonseca <jonas.fonseca@gmail.com>
Cc: Robin Rosenberg <robin.rosenberg@dewire.com>, git@vger.kernel.org
Subject: Re: [JGIT PATCH 2/5] Fix UnpackedObjectLoader.getBytes to return a copy
Date: Thu, 9 Oct 2008 14:49:26 -0700	[thread overview]
Message-ID: <20081009214926.GA8203@spearce.org> (raw)
In-Reply-To: <2c6b72b30810091446y22cb2e00te7a25676ee21ddac@mail.gmail.com>

Jonas Fonseca <jonas.fonseca@gmail.com> wrote:
> On Wed, Oct 1, 2008 at 03:31, Shawn O. Pearce <spearce@spearce.org> wrote:
> > diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectLoader.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectLoader.java
> > index 5282491..87e861f 100644
> > --- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectLoader.java
> > +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectLoader.java
> > @@ -105,7 +105,12 @@ protected void setId(final ObjectId id) {
> >         * @throws IOException
> >         *             the object cannot be read.
> >         */
> > -       public abstract byte[] getBytes() throws IOException;
> > +       public final byte[] getBytes() throws IOException {
> > +               final byte[] data = getCachedBytes();
> > +               final byte[] copy = new byte[data.length];
> > +               System.arraycopy(data, 0, copy, 0, data.length);
> > +               return data;
> > +       }
> 
> If I understand correctly, shouldn't this return the copy variable?

F&@!#*@#&@!#*@!@!&#@#@*@!

Yes.  :-)

I think its already committed to master too.  Can you send a patch
along to fix, and point out how stupid I am?

-- 
Shawn.

  reply	other threads:[~2008-10-09 21:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-01  1:31 [JGIT PATCH 0/5] Support receive.fsckobjects Shawn O. Pearce
2008-10-01  1:31 ` [JGIT PATCH 1/5] Expose RawParseUtils.match to application callers Shawn O. Pearce
2008-10-01  1:31   ` [JGIT PATCH 2/5] Fix UnpackedObjectLoader.getBytes to return a copy Shawn O. Pearce
2008-10-01  1:31     ` [JGIT PATCH 3/5] Object validation tests for "jgit fsck" Shawn O. Pearce
2008-10-01  1:31       ` [JGIT PATCH 4/5] Expose the critical receive configuration options to JGit Shawn O. Pearce
2008-10-01  1:31         ` [JGIT PATCH 5/5] Honor receive.fsckobjects during any fetch connection Shawn O. Pearce
2008-10-01 20:54         ` [JGIT PATCH 4/5] Expose the critical receive configuration options to JGit Robin Rosenberg
2008-10-02 22:46           ` Shawn O. Pearce
2008-10-09 21:46     ` [JGIT PATCH 2/5] Fix UnpackedObjectLoader.getBytes to return a copy Jonas Fonseca
2008-10-09 21:49       ` Shawn O. Pearce [this message]
2008-10-09 22:09         ` [JGIT PATCH] Fix ObjectLoader.getBytes to really return the created copy Jonas Fonseca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081009214926.GA8203@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=jonas.fonseca@gmail.com \
    --cc=robin.rosenberg@dewire.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).