Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb17bbb1

Browse files
committed
fixes#115
1 parent57df629 commitb17bbb1

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

‎java-diff-utils/src/main/java/com/github/difflib/patch/AbstractDelta.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public DeltaType getType() {
5454
* @param target
5555
* @throws PatchFailedException
5656
*/
57-
protectedvoidverifyChunk(List<T>target)throwsPatchFailedException {
58-
getSource().verify(target);
57+
protectedVerifyChunkverifyChunkToFitTarget(List<T>target)throwsPatchFailedException {
58+
returngetSource().verifyChunk(target);
5959
}
6060

6161
publicabstractvoidapplyTo(List<T>target)throwsPatchFailedException;

‎java-diff-utils/src/main/java/com/github/difflib/patch/Chunk.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ public Chunk(int position, T[] lines) {
9292
* @param target the sequence to verify against.
9393
* @throws com.github.difflib.patch.PatchFailedException
9494
*/
95-
publicvoidverify(List<T>target)throwsPatchFailedException {
95+
publicVerifyChunkverifyChunk(List<T>target)throwsPatchFailedException {
9696
if (position >target.size() ||last() >target.size()) {
97-
thrownewPatchFailedException("Incorrect Chunk: the position of chunk > target size");
97+
returnVerifyChunk.POSITION_OUT_OF_TARGET;
9898
}
9999
for (inti =0;i <size();i++) {
100100
if (!target.get(position +i).equals(lines.get(i))) {
101-
thrownewPatchFailedException(
102-
"Incorrect Chunk: the chunk content doesn't match the target");
101+
returnVerifyChunk.CONTENT_DOES_NOT_MATCH_TARGET;
103102
}
104103
}
104+
returnVerifyChunk.OK;
105105
}
106106

107107
/**
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2021 java-diff-utils.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
packagecom.github.difflib.patch;
17+
18+
/**
19+
*
20+
* @author tw
21+
*/
22+
publicenumVerifyChunk {
23+
OK,
24+
POSITION_OUT_OF_TARGET,
25+
CONTENT_DOES_NOT_MATCH_TARGET
26+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp