File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
src/main/java/org/scm4j/commons Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -39,24 +39,27 @@ public void loadFromYamlUrls(String... separatedUrls) throws IOException {
3939 if (map != null ) {
4040 this .content .putAll (map );
4141 }
42-
4342 }
4443 }
4544 }
4645 }
4746
4847 String prependOmapIfNeed (String content , Yaml yaml ) throws IOException {
49- if (isNotEmptyAndHasNoOMAPTag (content )) {
50- StringReader sr = new StringReader (content );
51- Node node = yaml .compose (sr );
52- if (node .getNodeId ().equals (NodeId .sequence )) {
48+ if (isSequence (content , yaml )) {
49+ if (noOMAPTag (content )) {
5350 return OMAP_TAG + "\r \n " + content ;
5451 }
5552 }
5653 return content ;
5754 }
5855
59- private boolean isNotEmptyAndHasNoOMAPTag (String content ) throws IOException {
56+ boolean isSequence (String content , Yaml yaml ) {
57+ StringReader sr = new StringReader (content );
58+ Node node = yaml .compose (sr );
59+ return node != null && node .getNodeId ().equals (NodeId .sequence );
60+ }
61+
62+ boolean noOMAPTag (String content ) throws IOException {
6063 StringReader sr = new StringReader (content );
6164 BufferedReader br = new BufferedReader (sr );
6265 String line = br .readLine ();
@@ -67,7 +70,7 @@ private boolean isNotEmptyAndHasNoOMAPTag(String content) throws IOException {
6770 }
6871 line = br .readLine ();
6972 }
70- return false ;
73+ return true ;
7174 }
7275
7376 @ SuppressWarnings ("unchecked" )
You can’t perform that action at this time.
0 commit comments