This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 29390 - NPE while applying Unified diff
Summary: NPE while applying Unified diff
Status: CLOSED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Diff (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-08 19:30 UTC by _ mihmax
Modified: 2003-06-30 17:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The diff by Gabriele Carcassi for issue #26996 (774 bytes, patch)
2002-12-08 19:35 UTC, _ mihmax
Details | Diff
The exception, that I got during the reproduction process. (784 bytes, text/plain)
2002-12-09 20:05 UTC, Martin Entlicher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ mihmax 2002-12-08 19:30:35 UTC
testcase'll be attached
Comment 1 _ mihmax 2002-12-08 19:35:24 UTC
Created attachment 8209 [details]
The diff by Gabriele Carcassi for issue #26996
Comment 2 _ mihmax 2002-12-08 19:38:24 UTC
That diff was to be applied to rev. 1.7.24.1 (or 1.7) of
JavaFastImport.java file:

http://www.netbeans.org/source/browse/editor/libsrc/org/netbeans/editor/ext/java/JavaFastImport.java?rev=1.7.24.1&content-type=text/x-cvsweb-markup
Comment 3 Martin Entlicher 2002-12-09 20:04:19 UTC
You're right! I was able to reproduce the problem.
Comment 4 Martin Entlicher 2002-12-09 20:05:33 UTC
Created attachment 8244 [details]
The exception, that I got during the reproduction process.
Comment 5 Martin Entlicher 2002-12-09 20:25:14 UTC
The NPE was caused by the empty line at the end of the patch file.
The fix is quite simple and works for me.

/cvs/diff/src/org/netbeans/modules/diff/builtin/Patch.java,v  <-- 
Patch.java
new revision: 1.10; previous revision: 1.9

Can this be integrated into release341?
Comment 6 _ mihmax 2002-12-09 20:55:59 UTC
Eee, maybe you should simply undo the Applying of Unified diffs in
3.4.1 at all?

I mean issue 24523

If it's that unstable ;-)
Comment 7 _ mihmax 2002-12-09 21:01:46 UTC
Ouch!, sorry for the last comment, I didn't read IZ to the end (some
connection trouble).

Tested the diff, it works now, thanks.
Maybe I may act as veryfier? ;-) If anyone volunteers too, no problem
Comment 8 Jiri Kovalsky 2002-12-10 08:31:30 UTC
Sure, so can you verify this Max ?
Comment 9 Martin Entlicher 2002-12-10 09:53:09 UTC
I don't think, that applying unified diff patches is unstable. I've
heavily tested the feature without problems. However this issue shows,
that you can never be 100% sure. This NPE was caused by the editing of
the diff in an editor (this is apparent from the ^M at the end of the
diff). This introduced the last empty line, which does not occur if
you redirect cvs diff into a file (this is why I didn't discover the
bug earlier).

So this fix adds more robustness to the patch algorithm. I don't think
this is a reason to remove the whole feature. But you may disagree of
course, you're the release coordinator.
Comment 10 _ mihmax 2002-12-10 15:53:06 UTC
2 Martin:
I already said sorry for saying of unstableness ;-)
Comment 11 _ mihmax 2002-12-10 15:58:27 UTC
2 Jiri:
Verified (I just applyied the Gabrielle's patch, huge Thanks!)

Please commit to release341 branch
Comment 12 Martin Entlicher 2002-12-10 16:04:22 UTC
O.K. it's there:
/cvs/diff/src/org/netbeans/modules/diff/builtin/Patch.java,v  <-- 
Patch.java
new revision: 1.6.16.3; previous revision: 1.6.16.2
Comment 13 _ mihmax 2002-12-10 16:15:20 UTC
Thank a lot, Martin.
Double sorry for saying such wierd things about my favorite IDE's
useful (I mean useful) module.
Comment 14 Jiri Kovalsky 2002-12-10 16:18:32 UTC
Okay, I am verifying this. Thank you both guys.
Comment 15 Martin Entlicher 2002-12-10 16:28:47 UTC
2 Maxym: it's O.K., nobody write 100% perfect code ;-( I'm sorry, that
my commit to 3.4.1 introduced another bug. It's hard to test it
throughoutfully enough ;-)

Comment 16 Quality Engineering 2003-06-30 17:41:10 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.