From: "Shawn O. Pearce" <spearce@spearce.org>
To: Nigel Magnay <nigel.magnay@gmail.com>
Cc: Git ML <git@vger.kernel.org>
Subject: Re: [JGIT PATCH] 1/2 : (reworked) Externalizable/Serializable Items
Date: Wed, 18 Feb 2009 08:30:02 -0800 [thread overview]
Message-ID: <20090218163002.GB22848@spearce.org> (raw)
In-Reply-To: <320075ff0902161212s1980cd70r8cdc4c21550333ee@mail.gmail.com>
Nigel Magnay <nigel.magnay@gmail.com> wrote:
> +public class ObjectId extends AnyObjectId implements Serializable {
We should define our own serialVersionUID:
private static final long serialVersionUID = 1L;
is good enough to make Java happy.
> @@ -269,4 +273,20 @@ protected ObjectId(final AnyObjectId src) {
> public ObjectId toObjectId() {
> return this;
> }
> +
> + private void writeObject(ObjectOutputStream os) throws IOException {
> + private void readObject(ObjectInputStream ois) throws IOException {
Minor nit: Only 1 space between ) and throws, please.
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteConfig.java
> b/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteConfig.java
> index 5bbf664..899f73f 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteConfig.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteConfig.java
> @@ -53,7 +57,7 @@
> * describing how refs should be transferred between this repository and the
> * remote repository.
> */
> -public class RemoteConfig {
> +public class RemoteConfig implements Serializable {
Please set a serialVersionUID.
> @@ -382,4 +386,77 @@ public TagOpt getTagOpt() {
> public void setTagOpt(final TagOpt option) {
> tagopt = option != null ? option : TagOpt.AUTO_FOLLOW;
> }
> +
> + private void writeObject(ObjectOutputStream os) throws IOException {
> +
> + // Name
> + os.writeUTF(name);
> +
> + // Key, Value pairs
> + for (URIish uri : uris) {
> + os.writeUTF(KEY_URL);
> + os.writeUTF(uri.toPrivateString());
> + }
> +
> + for (RefSpec refspec : fetch) {
There is some sort of whitespace damage here, the second for loop
is not lined up at the same starting column as the first for loop.
My guess is, you have tabs in here. We only indent with spaces.
> + os.writeUTF(KEY_FETCH);
> + os.writeUTF(refspec.toString());
> + }
> +
> + for (RefSpec refspec : push) {
> + os.writeUTF(KEY_PUSH);
> + os.writeUTF(refspec.toString());
> + }
Should we maybe allow RefSpec to serialize itself with
os.writeObject() rather than using writeUTF() directly?
FWIW, I did find this new implementation to be much easier to read.
Thanks.
--
Shawn.
next prev parent reply other threads:[~2009-02-18 16:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-16 20:12 [JGIT PATCH] 1/2 : (reworked) Externalizable/Serializable Items Nigel Magnay
2009-02-16 20:16 ` Johannes Schindelin
2009-02-18 16:30 ` Shawn O. Pearce [this message]
2009-02-18 20:59 ` Robin Rosenberg
2009-02-18 21:48 ` Shawn O. Pearce
2009-02-18 22:19 ` Sverre Rabbelier
2009-02-18 23:21 ` Robin Rosenberg
2009-02-18 23:27 ` Shawn O. Pearce
[not found] ` <320075ff0902200127m3e516621m60a608bc891ab992@mail.gmail.com>
2009-02-20 9:28 ` Nigel Magnay
2009-02-20 20:32 ` Shawn O. Pearce
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=20090218163002.GB22848@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=nigel.magnay@gmail.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).