File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
testingapps/thepulper/src/main/java/com/javafortesters/pulp/reader Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -42,16 +42,17 @@ v1.4 - split into multiple pom.xnl
42
42
moved to 1.2 snapshot to work on a v1 to v2 toggle where v2 has ids, classes etc for automating
43
43
version 1.2.0 pulper 4 different versions, with help file
44
44
version 1.2.1 pulper v5 has an XHTTP request on author create
45
+ 1.2.2 has operating system independent resource loading i.e. it didn't work on windows
45
46
-->
46
- <thepulper .version>1-2-1 </thepulper .version>
47
+ <thepulper .version>1-2-2 </thepulper .version>
47
48
48
49
<!-- COLLECTED APPS -->
49
50
<!-- 1-2-0 has the pulper with CRUD and formatting-->
50
51
<!-- 1-3-0 has the pulper with 4 switchable versions with different capabilities as shown in help file-->
51
52
<!-- 1-3-1 has the pulper with v5 - fetch javascript create on author
52
53
and Selenium Test pages has the search engine page fix for cookies
53
54
-->
54
- <collectedapp .version>1-3-1 </collectedapp .version>
55
+ <collectedapp .version>1-3-2 </collectedapp .version>
55
56
56
57
57
58
<herokumaven .version>1.2.0</herokumaven .version>
Original file line number Diff line number Diff line change @@ -11,7 +11,11 @@ public CsvReader(String resourcePath) {
11
11
12
12
public void read () {
13
13
this .data = new ResourceReader ().asString (resourcePath );
14
- this .lines = data .split ("\n " );
14
+ String splitter = "\n " ;
15
+ if (data .contains ("\r \n " )){
16
+ splitter = "\r \n " ;
17
+ }
18
+ this .lines = data .split (splitter );
15
19
}
16
20
17
21
public int numberOfLines () {
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public class ResourceReader {
12
12
public String asString (String resourceName ){
13
13
14
14
try {
15
- InputStream in = this .getClass ().getResourceAsStream (resourceName );
15
+ InputStream in = this .getClass ().getResourceAsStream (osIndependentResourcePath ( resourceName ) );
16
16
17
17
// http://web.archive.org/web/20140531042945/https://weblogs.java.net/blog/pat/archive/2004/10/stupid_scanner_1.html
18
18
Scanner scanner = new Scanner (in ).useDelimiter ("\\ A" );
@@ -29,10 +29,14 @@ public String asString(String resourceName){
29
29
}
30
30
}
31
31
32
+ private String osIndependentResourcePath (String path ){
33
+ return path .replaceAll ("\\ \\ " ,"/" );
34
+ }
35
+
32
36
public boolean doesResourceExist (final String path ) {
33
37
try {
34
38
35
- InputStream in = this .getClass ().getResourceAsStream (path );
39
+ InputStream in = this .getClass ().getResourceAsStream (osIndependentResourcePath ( path ) );
36
40
if (in ==null ){
37
41
return false ;
38
42
}
You can’t perform that action at this time.
0 commit comments