|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ContentRemover | Line # 6 | 13 | 0% | 3 | 18 | 0% |
0.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | package org.springframework.beans; | |
| 2 | ||
| 3 | import java.io.File; | |
| 4 | import java.util.Set; | |
| 5 | ||
| 6 | public class ContentRemover { | |
| 7 | ||
| 8 | 0 |
public boolean removeContent(File file, Set<String> contentsToRemove) { |
| 9 | 0 | String content = CopyrightHandlerTest.read(file); |
| 10 | 0 | content = CopyrightHandlerTest.flatten(content); |
| 11 | ||
| 12 | 0 | boolean updated = false; |
| 13 | 0 | for (String contentToRemove : contentsToRemove) { |
| 14 | 0 | int pos = content.indexOf(contentToRemove); |
| 15 | 0 | if (pos != -1) { |
| 16 | 0 | content = content.replace(contentToRemove, ""); |
| 17 | 0 | updated = true; |
| 18 | } | |
| 19 | } | |
| 20 | 0 | if (!updated) { |
| 21 | 0 | return false; |
| 22 | } else { | |
| 23 | 0 | content = CopyrightHandlerTest.unflatten(content); |
| 24 | 0 | CopyrightHandlerTest.write(file, content); |
| 25 | 0 | return true; |
| 26 | } | |
| 27 | } | |
| 28 | ||
| 29 | } | |
|
||||||||||||