Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2002-06-07 13:54:10 -0400
committerAndre Weinand2002-06-07 13:54:10 -0400
commit355f654bec143502a8c8a19d5e6feacf697d73e5 (patch)
tree94b372d22c34f9734419a326eec1cc1ffdcba3a1
parent2481e09d04cb920a6ed5803895ac612bd3d3448d (diff)
downloadeclipse.platform.team-355f654bec143502a8c8a19d5e6feacf697d73e5.tar.gz
eclipse.platform.team-355f654bec143502a8c8a19d5e6feacf697d73e5.tar.xz
eclipse.platform.team-355f654bec143502a8c8a19d5e6feacf697d73e5.zip
#18807: Compare with patch fails due to missing LF
-rw-r--r--bundles/org.eclipse.compare/buildnotes_compare.html2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java15
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java1
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java15
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java15
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java1
7 files changed, 43 insertions, 8 deletions
diff --git a/bundles/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/buildnotes_compare.html
index 14d6b37a0..28405b0d4 100644
--- a/bundles/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/buildnotes_compare.html
@@ -30,9 +30,9 @@ Known deficiencies</h2>
<h2>
Problem reports fixed</h2>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18807">#18807</a>: Compare with patch fails due to missing LF<br>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13730">#13730</a>: Entire zipfiles content sent prior when computing synchronization view content<br>
-
<h2>
Problem reports closed</h2>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
index 98026451e..053e3b99a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
@@ -15,12 +15,18 @@ import org.eclipse.jface.util.Assert;
private int fLastChar;
private boolean fSawEOF= false;
private BufferedReader fReader;
+ private boolean fIgnoreSingleCR= false;
+
/* package */ LineReader(BufferedReader reader) {
fReader= reader;
Assert.isNotNull(reader);
}
+ void ignoreSingleCR() {
+ fIgnoreSingleCR= true;
+ }
+
/**
* Reads a line of text. A line is considered to be terminated by any one
* of a line feed ('\n'), a carriage return ('\r'), or a carriage return
@@ -51,8 +57,13 @@ import org.eclipse.jface.util.Assert;
break; // EOF
}
if (c != '\n') {
- fHaveChar= true;
- fLastChar= c;
+ if (fIgnoreSingleCR) {
+ sb.append((char)c);
+ continue;
+ } else {
+ fHaveChar= true;
+ fLastChar= c;
+ }
} else
sb.append((char)c);
break;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
index 51e0b65cd..9fe7f3752 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
@@ -143,6 +143,7 @@ public class Patcher {
String fileName= null;
LineReader lr= new LineReader(reader);
+ lr.ignoreSingleCR();
// read leading garbage
while (true) {
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
index 14d6b37a0..28405b0d4 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
@@ -30,9 +30,9 @@ Known deficiencies</h2>
<h2>
Problem reports fixed</h2>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=18807">#18807</a>: Compare with patch fails due to missing LF<br>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=13730">#13730</a>: Entire zipfiles content sent prior when computing synchronization view content<br>
-
<h2>
Problem reports closed</h2>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java
index 98026451e..053e3b99a 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Attic/LineReader.java
@@ -15,12 +15,18 @@ import org.eclipse.jface.util.Assert;
private int fLastChar;
private boolean fSawEOF= false;
private BufferedReader fReader;
+ private boolean fIgnoreSingleCR= false;
+
/* package */ LineReader(BufferedReader reader) {
fReader= reader;
Assert.isNotNull(reader);
}
+ void ignoreSingleCR() {
+ fIgnoreSingleCR= true;
+ }
+
/**
* Reads a line of text. A line is considered to be terminated by any one
* of a line feed ('\n'), a carriage return ('\r'), or a carriage return
@@ -51,8 +57,13 @@ import org.eclipse.jface.util.Assert;
break; // EOF
}
if (c != '\n') {
- fHaveChar= true;
- fLastChar= c;
+ if (fIgnoreSingleCR) {
+ sb.append((char)c);
+ continue;
+ } else {
+ fHaveChar= true;
+ fLastChar= c;
+ }
} else
sb.append((char)c);
break;
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
index 98026451e..053e3b99a 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
@@ -15,12 +15,18 @@ import org.eclipse.jface.util.Assert;
private int fLastChar;
private boolean fSawEOF= false;
private BufferedReader fReader;
+ private boolean fIgnoreSingleCR= false;
+
/* package */ LineReader(BufferedReader reader) {
fReader= reader;
Assert.isNotNull(reader);
}
+ void ignoreSingleCR() {
+ fIgnoreSingleCR= true;
+ }
+
/**
* Reads a line of text. A line is considered to be terminated by any one
* of a line feed ('\n'), a carriage return ('\r'), or a carriage return
@@ -51,8 +57,13 @@ import org.eclipse.jface.util.Assert;
break; // EOF
}
if (c != '\n') {
- fHaveChar= true;
- fLastChar= c;
+ if (fIgnoreSingleCR) {
+ sb.append((char)c);
+ continue;
+ } else {
+ fHaveChar= true;
+ fLastChar= c;
+ }
} else
sb.append((char)c);
break;
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
index 51e0b65cd..9fe7f3752 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
@@ -143,6 +143,7 @@ public class Patcher {
String fileName= null;
LineReader lr= new LineReader(reader);
+ lr.ignoreSingleCR();
// read leading garbage
while (true) {

Back to the top