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 27436 - "Apply Patch" can not apply patches to files with Windows' line endings.
Summary: "Apply Patch" can not apply patches to files with Windows' line endings.
Status: VERIFIED 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-09-19 10:00 UTC by Jiri Kovalsky
Modified: 2003-12-11 14:20 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exception thrown instead of patch application. (1.22 KB, text/plain)
2002-09-19 10:01 UTC, Jiri Kovalsky
Details
File that should be patched. (19.46 KB, application/octet-stream)
2002-09-19 10:03 UTC, Jiri Kovalsky
Details
File with "better" code that was used to create the patch. (16.75 KB, application/octet-stream)
2002-09-19 10:04 UTC, Jiri Kovalsky
Details
Patch file created from textual diff using command-line client. (3.25 KB, application/octet-stream)
2002-09-19 10:06 UTC, Jiri Kovalsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Kovalsky 2002-09-19 10:00:33 UTC
Development build #200209190100 of NetBeans 4.0
Windows 2000 with JDK 1.4.1 RC build #21

Description:
============
Could you please take a look at the steps below
and the attached files ? I am convinced that there
is no reason to say that patch is not applicable.
I was very sad about the fact that I am the one
who must apply the patch ... :-(

Steps to reproduce:
===================
1. Place both java files into one directory and
select them.
2. Invoke "Tools|Diff" and then choose
"Command-line Diff" engine.
3. Choose "Textual Diff Viewer" visualizer.
4. Select whole text, press CTRL+C, paste
somewhere and save it as "Patch.txt" file.
5. Select "VCSWizardAdvanced" node and invoke
"Tools|Apply Patch..." action.
6. Browse to your "Patch.txt" file and push
"Patch" button.
7. Below attached exception is thrown.
Comment 1 Jiri Kovalsky 2002-09-19 10:01:31 UTC
Created attachment 7451 [details]
Exception thrown instead of patch application.
Comment 2 Jiri Kovalsky 2002-09-19 10:03:09 UTC
Created attachment 7452 [details]
File that should be patched.
Comment 3 Jiri Kovalsky 2002-09-19 10:04:58 UTC
Created attachment 7453 [details]
File with "better" code that was used to create the patch.
Comment 4 Jiri Kovalsky 2002-09-19 10:06:02 UTC
Created attachment 7454 [details]
Patch file created from textual diff using command-line client.
Comment 5 Martin Entlicher 2003-03-02 22:46:29 UTC
Scheduling for NB 4.0.
Comment 6 Martin Entlicher 2003-07-31 12:16:47 UTC
I was trying to reproduce that on Solaris and yes, it said that the
patch was inapplicable.
But even /usr/bin/patch has complaied:
bash-2.03$ patch -i Patch_UNIX.txt VCSWizardAdvanced.java
  Looks like a normal diff.
Hunk #2 failed at line 24.
Hunk #3 failed at line 29.
Hunk #4 failed at line 33.
Hunk #5 failed at line 91.
Hunk #6 failed at line 384.
5 out of 6 hunks failed: saving rejects to VCSWizardAdvanced.java.rej
done

I found that it failed due to Windows line endings in the file.
Even on Windows the files with Windows' line endings fail, but after
they are converted to UNIX line endings the patch is applied
successfully.

I've changed the subject to describe better the problem.
Comment 7 Martin Entlicher 2003-07-31 18:12:52 UTC
Fixed in dev and projects builds:

Checking in Patch.java;
/cvs/diff/src/org/netbeans/modules/diff/builtin/Patch.java,v  <-- 
Patch.java
new revision: 1.13; previous revision: 1.12
done

Checking in Patch.java;
/cvs/diff/src/org/netbeans/modules/diff/builtin/Patch.java,v  <-- 
Patch.java
new revision: 1.12.6.2; previous revision: 1.12.6.1
done

It should work O.K. now regardless on the line endings.
Comment 8 Jiri Kovalsky 2003-08-11 17:42:56 UTC
Cool, the patch application finished successfully. Verified in
development build #200308060100 of NetBeans 4.0.