Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…y-4J into develop
  • Loading branch information
Adri7 committed May 30, 2017
2 parents 3cb5c49 + cc3a392 commit 954ab44
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 8 deletions.
22 changes: 21 additions & 1 deletion src/main/java/com/easyinnova/tiff/model/TagValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,27 @@ public int getCardinality() {
*/
public long getFirstNumericValue() {
String val = (value != null) ? value.get(0).toString() : readValue.get(0).toString();
return Long.parseLong(val);
if (isInteger(val)) {
return Long.parseLong(val);
} else {
return 0;
}
}

boolean isInteger(String s) {
return isInteger(s,10);
}

boolean isInteger(String s, int radix) {
if(s.isEmpty()) return false;
for(int i = 0; i < s.length(); i++) {
if(i == 0 && s.charAt(i) == '-') {
if(s.length() == 1) return false;
else continue;
}
if(Character.digit(s.charAt(i),radix) < 0) return false;
}
return true;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/tifftags/ColorMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"description": "",
"source": "",
"created": "18/05/2015",
"modified": "18/05/2015"
"modified": "18/05/2015",
"forceDescription": ""
}
3 changes: 2 additions & 1 deletion src/main/resources/tifftags/ColorMatrix1.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"description": "",
"source": "",
"created": "18/05/2015",
"modified": "18/05/2015"
"modified": "18/05/2015",
"forceDescription": ""
}
3 changes: 2 additions & 1 deletion src/main/resources/tifftags/ColorMatrix2.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"description": "",
"source": "",
"created": "18/05/2015",
"modified": "18/05/2015"
"modified": "18/05/2015",
"forceDescription": ""
}
3 changes: 2 additions & 1 deletion src/main/resources/tifftags/JPEGTables.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"description": "",
"source": "",
"created": "18/05/2015",
"modified": "18/05/2015"
"modified": "18/05/2015",
"forceDescription": ""
}
3 changes: 2 additions & 1 deletion src/main/resources/tifftags/ReductionMatrix1.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"description": "",
"source": "",
"created": "18/05/2015",
"modified": "18/05/2015"
"modified": "18/05/2015",
"forceDescription": ""
}
3 changes: 2 additions & 1 deletion src/main/resources/tifftags/ReductionMatrix2.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"description": "",
"source": "",
"created": "18/05/2015",
"modified": "18/05/2015"
"modified": "18/05/2015",
"forceDescription": ""
}
3 changes: 2 additions & 1 deletion src/main/resources/tifftags/TransferFunction.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"description": "",
"source": "",
"created": "18/05/2015",
"modified": "18/05/2015"
"modified": "18/05/2015",
"forceDescription": ""
}

0 comments on commit 954ab44

Please sign in to comment.