Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Commit 1757a42

Browse files
committed
Added source jar to pom, Bugfixes
1 parent b0ca17d commit 1757a42

3 files changed

Lines changed: 25 additions & 20 deletions

File tree

pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,21 @@
159159
<executions>
160160
<execution>
161161
<id>attach-javadocs</id>
162+
<phase>verify</phase>
163+
<goals>
164+
<goal>jar</goal>
165+
</goals>
166+
</execution>
167+
</executions>
168+
</plugin>
169+
<plugin>
170+
<groupId>org.apache.maven.plugins</groupId>
171+
<artifactId>maven-source-plugin</artifactId>
172+
<version>3.0.1</version>
173+
<executions>
174+
<execution>
175+
<id>attach-sources</id>
176+
<phase>verify</phase>
162177
<goals>
163178
<goal>jar</goal>
164179
</goals>

src/main/java/com/github/difflib/patch/ChangeDelta.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
import java.util.List;
2323

2424
/**
25-
* Describes the change-delta between original and revised texts.
26-
* <p>
27-
* T The type of the compared elements in the 'lines'.
25+
* Describes the change-delta between original and revised texts. <p> T The type of the compared elements in the 'lines'.
2826
*
2927
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
3028
*/
@@ -71,7 +69,6 @@ public void restore(List<T> target) {
7169

7270
@Override
7371
public String toString() {
74-
return "[ChangeDelta, position: " + getOriginal().getPosition() + ", lines: "
75-
+ getOriginal().getLines() + " to " + getRevised().getLines() + "]";
72+
return "[ChangeDelta, position: " + getOriginal().getPosition() + ", lines: " + getOriginal().getLines() + " to " + getRevised().getLines() + "]";
7673
}
7774
}

src/main/java/com/github/difflib/patch/Chunk.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@
2424
import java.util.List;
2525

2626
/**
27-
* Holds the information about the part of text involved in the diff process
28-
* <p>
29-
* Text is represented as <code>Object[]</code> because the diff engine is capable of handling more
30-
* than plain ascci. In fact, arrays or lists of any type that implements
31-
* {@link java.lang.Object#hashCode hashCode()} and {@link java.lang.Object#equals equals()}
32-
* correctly can be subject to differencing using this library.
33-
* </p>
34-
* T The type of the compared elements in the 'lines'.
27+
* Holds the information about the part of text involved in the diff process <p> Text is represented as <code>Object[]</code> because the diff engine is capable
28+
* of handling more than plain ascci. In fact, arrays or lists of any type that implements {@link java.lang.Object#hashCode hashCode()} and
29+
* {@link java.lang.Object#equals equals()} correctly can be subject to differencing using this library. </p> T The type of the compared elements in the
30+
* 'lines'.
3531
*
3632
* @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a>
3733
* @author <a href="ch.sontag@gmail.com">Christopher Sontag</a>
@@ -76,17 +72,16 @@ public void verify(List<T> target) throws PatchFailedException {
7672
}
7773
for (int i = 0; i < size(); i++) {
7874
if (!target.get(position + i).equals(lines.get(i))) {
79-
throw new PatchFailedException(
80-
"Incorrect Chunk: the chunk content doesn't match the target");
75+
throw new PatchFailedException("Incorrect Chunk: the chunk content doesn't match the target");
8176
}
8277
}
83-
for (int i = 0; i < before.size(); i++) {
84-
if (!before.get(i).equals(target.get(position - before.size() + i))) {
78+
for (int i = before.size(); i > 0; i--) {
79+
if (!before.get(before.size() - i).equals(target.get(position - i))) {
8580
throw new PatchFailedException("Incorrect Chunk: the chunk's surroundings (before) doesn't match the target");
8681
}
8782
}
8883
for (int i = 0; i < after.size(); i++) {
89-
if (!after.get(i).equals(target.get(last() + after.size() - i))) {
84+
if (!after.get(i).equals(target.get(last() + i + 1))) {
9085
throw new PatchFailedException("Incorrect Chunk: the chunk's surroundings (after) doesn't match the target");
9186
}
9287
}
@@ -157,7 +152,6 @@ public void setAfter(List<T> after) {
157152

158153
/*
159154
* (non-Javadoc)
160-
*
161155
* @see java.lang.Object#hashCode()
162156
*/
163157
@Override
@@ -172,7 +166,6 @@ public int hashCode() {
172166

173167
/*
174168
* (non-Javadoc)
175-
*
176169
* @see java.lang.Object#equals(java.lang.Object)
177170
*/
178171
@Override

0 commit comments

Comments
 (0)