File tree Expand file tree Collapse file tree 7 files changed +22
-15
lines changed
cxx-checks/src/main/java/org/sonar/cxx/checks Expand file tree Collapse file tree 7 files changed +22
-15
lines changed Original file line number Diff line number Diff line change 2020package org .sonar .cxx .checks ;
2121
2222import java .io .IOException ;
23- import java .nio .file .Files ;
2423import java .nio .charset .Charset ;
2524import java .util .Iterator ;
2625import java .util .List ;
2726
27+ import com .google .common .io .Files ;
28+
2829import org .sonar .check .Priority ;
2930import org .sonar .check .Rule ;
3031import org .sonar .check .RuleProperty ;
@@ -98,15 +99,15 @@ public void visitFile(AstNode astNode) {
9899 if (isRegularExpression ) {
99100 String fileContent ;
100101 try {
101- fileContent = new String ( Files .readAllBytes (getContext ().getFile (). toPath () ), charset );
102+ fileContent = Files .toString (getContext ().getFile (), charset );
102103 } catch (IOException e ) {
103104 throw new AnalysisException (e );
104105 }
105106 checkRegularExpression (fileContent );
106107 } else {
107108 List <String > lines ;
108109 try {
109- lines = Files .readAllLines (getContext ().getFile (). toPath (), charset );
110+ lines = Files .readLines (getContext ().getFile (), charset );
110111 } catch (IOException e ) {
111112 throw new IllegalStateException (e );
112113 }
Original file line number Diff line number Diff line change 2020package org .sonar .cxx .checks ;
2121
2222import java .io .IOException ;
23- import java .nio .file .Files ;
2423import java .nio .charset .Charset ;
2524import java .util .List ;
2625import java .util .Stack ;
2726
27+ import com .google .common .io .Files ;
28+
2829import org .sonar .check .Priority ;
2930import org .sonar .check .Rule ;
3031import org .sonar .check .RuleProperty ;
@@ -148,7 +149,7 @@ public void leaveFile(AstNode node) {
148149 private int getTabColumn (Token token ) {
149150 if (fileLines == null ) {
150151 try {
151- fileLines = Files .readAllLines (getContext ().getFile (). toPath (), charset );
152+ fileLines = Files .readLines (getContext ().getFile (), charset );
152153 } catch (IOException e ) {
153154 throw new IllegalStateException (e );
154155 }
Original file line number Diff line number Diff line change 2020package org .sonar .cxx .checks ;
2121
2222import java .io .IOException ;
23- import java .nio .file .Files ;
2423import java .nio .charset .Charset ;
2524import java .util .List ;
2625import java .util .regex .Matcher ;
2726import java .util .regex .Pattern ;
2827import java .util .regex .PatternSyntaxException ;
2928
29+ import com .google .common .io .Files ;
30+
3031import org .sonar .check .Priority ;
3132import org .sonar .check .Rule ;
3233import org .sonar .check .RuleProperty ;
@@ -107,7 +108,7 @@ public void visitFile(AstNode fileNode) {
107108 if (compare (invertFilePattern , matchFile ())) {
108109 List <String > lines ;
109110 try {
110- lines = Files .readAllLines (getContext ().getFile (). toPath (), charset );
111+ lines = Files .readLines (getContext ().getFile (), charset );
111112 } catch (IOException e ) {
112113 throw new IllegalStateException (e );
113114 }
Original file line number Diff line number Diff line change 2020package org .sonar .cxx .checks ;
2121
2222import java .io .IOException ;
23- import java .nio .file .Files ;
2423import java .nio .charset .Charset ;
2524import java .util .List ;
2625
26+ import com .google .common .io .Files ;
27+
2728import org .sonar .check .Priority ;
2829import org .sonar .check .Rule ;
2930import org .sonar .cxx .api .CxxKeyword ;
@@ -61,7 +62,7 @@ public void init() {
6162 public void visitFile (AstNode astNode ) {
6263 List <String > lines ;
6364 try {
64- lines = Files .readAllLines (getContext ().getFile (). toPath (), charset );
65+ lines = Files .readLines (getContext ().getFile (), charset );
6566 } catch (IOException e ) {
6667 throw new IllegalStateException (e );
6768 }
Original file line number Diff line number Diff line change 2020package org .sonar .cxx .checks ;
2121
2222import java .io .IOException ;
23- import java .nio .file .Files ;
2423import java .nio .charset .Charset ;
2524import java .util .List ;
2625
26+ import com .google .common .io .Files ;
27+
2728import org .sonar .check .Priority ;
2829import org .sonar .check .Rule ;
2930import org .sonar .cxx .visitors .CxxCharsetAwareVisitor ;
@@ -68,7 +69,7 @@ public void setCharset(Charset charset) {
6869 public void visitFile (AstNode astNode ) {
6970 List <String > lines ;
7071 try {
71- lines = Files .readAllLines (getContext ().getFile (). toPath (), charset );
72+ lines = Files .readLines (getContext ().getFile (), charset );
7273 } catch (IOException e ) {
7374 throw new IllegalStateException (e );
7475 }
Original file line number Diff line number Diff line change 2020package org .sonar .cxx .checks ;
2121
2222import java .io .IOException ;
23- import java .nio .file .Files ;
2423import java .nio .charset .Charset ;
2524import java .util .List ;
2625
26+ import com .google .common .io .Files ;
27+
2728import org .sonar .check .Priority ;
2829import org .sonar .check .Rule ;
2930import org .sonar .check .RuleProperty ;
@@ -75,7 +76,7 @@ public void setCharset(Charset charset) {
7576 public void visitFile (AstNode astNode ) {
7677 List <String > lines ;
7778 try {
78- lines = Files .readAllLines (getContext ().getFile (). toPath (), charset );
79+ lines = Files .readLines (getContext ().getFile (), charset );
7980 } catch (IOException e ) {
8081 throw new IllegalStateException (e );
8182 }
Original file line number Diff line number Diff line change 2020package org .sonar .cxx .checks ;
2121
2222import java .io .IOException ;
23- import java .nio .file .Files ;
2423import java .nio .charset .Charset ;
2524import java .util .List ;
2625import java .util .regex .Pattern ;
2726
27+ import com .google .common .io .Files ;
28+
2829import org .sonar .check .Priority ;
2930import org .sonar .check .Rule ;
3031import org .sonar .cxx .visitors .CxxCharsetAwareVisitor ;
@@ -70,7 +71,7 @@ public void init() {
7071 public void visitFile (AstNode astNode ) {
7172 List <String > lines ;
7273 try {
73- lines = Files .readAllLines (getContext ().getFile (). toPath (), charset );
74+ lines = Files .readLines (getContext ().getFile (), charset );
7475 } catch (IOException e ) {
7576 throw new IllegalStateException (e );
7677 }
You can’t perform that action at this time.
0 commit comments