Extract Method... broken?

I just did an extract method refactoring and noticed it didn't extract
the return value properly:


The following:

// Extract original message to a byte array.
byte[] originalMessage;
ByteArrayOutputStream baos = new
ByteArrayOutputStream(message.getSize());
message.writeTo(baos);
baos.close();
originalMessage = baos.toByteArray();

extracted to:

private void convertMimeMessageToByteArray(MimeMessage message)
throws IOException {
// Extract original message to a byte array.
byte[] originalMessage;
ByteArrayOutputStream baos = new
ByteArrayOutputStream(message.getSize());
message.writeTo(baos);
baos.close();

originalMessage = baos.toByteArray();
}

without setting the return of originalMessage.

I tried it with or without highlighting the declaration of
originalMessage with the same result, am I missing something subtle
here? It's always worked before...

1 comment
Comment actions Permalink

Mark Derricutt wrote:

I just did an extract method refactoring and noticed it didn't extract
the return value properly:


Ahh forget this, I'd moved the declaration of originalMessage so its
"usage" was now getting an undefined error, so the refactor didn't pick
up its return usage.

doh.

0

Please sign in to leave a comment.