Tiny fixes from coverity; fix SuppressWarnings for deprecation; just one Java 7 build now

This commit is contained in:
Sean Owen 2015-01-11 16:15:14 +00:00
parent 61f7f9f196
commit 0fc1a267c0
4 changed files with 11 additions and 10 deletions

View file

@ -2,12 +2,11 @@ language: java
before_install: sudo pip install codecov before_install: sudo pip install codecov
script: mvn -Pjacoco test script: mvn -Pjacoco test
jdk: jdk:
- oraclejdk7
- openjdk7 - openjdk7
- oraclejdk8 - oraclejdk8
cache: cache:
directories: directories:
- $HOME/.m2 - $HOME/.m2
git: git:
depth: 1 depth: 3
after_success: codecov after_success: codecov

View file

@ -67,12 +67,12 @@ public final class DataMatrixWriter implements Writer {
if (requestedShape != null) { if (requestedShape != null) {
shape = requestedShape; shape = requestedShape;
} }
@SuppressWarnings("deprecated") @SuppressWarnings("deprecation")
Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE); Dimension requestedMinSize = (Dimension) hints.get(EncodeHintType.MIN_SIZE);
if (requestedMinSize != null) { if (requestedMinSize != null) {
minSize = requestedMinSize; minSize = requestedMinSize;
} }
@SuppressWarnings("deprecated") @SuppressWarnings("deprecation")
Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE); Dimension requestedMaxSize = (Dimension) hints.get(EncodeHintType.MAX_SIZE);
if (requestedMaxSize != null) { if (requestedMaxSize != null) {
maxSize = requestedMaxSize; maxSize = requestedMaxSize;

View file

@ -36,9 +36,10 @@ public final class CalendarParsedResultTestCase extends Assert {
private static final double EPSILON = 0.0000000001; private static final double EPSILON = 0.0000000001;
private static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'", Locale.ENGLISH); private static DateFormat makeGMTFormat() {
static { DateFormat format = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'", Locale.ENGLISH);
DATE_TIME_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); format.setTimeZone(TimeZone.getTimeZone("GMT"));
return format;
} }
@Before @Before
@ -229,8 +230,9 @@ public final class CalendarParsedResultTestCase extends Assert {
assertEquals(description, calResult.getDescription()); assertEquals(description, calResult.getDescription());
assertEquals(summary, calResult.getSummary()); assertEquals(summary, calResult.getSummary());
assertEquals(location, calResult.getLocation()); assertEquals(location, calResult.getLocation());
assertEquals(startString, DATE_TIME_FORMAT.format(calResult.getStart())); DateFormat dateFormat = makeGMTFormat();
assertEquals(endString, calResult.getEnd() == null ? null : DATE_TIME_FORMAT.format(calResult.getEnd())); assertEquals(startString, dateFormat.format(calResult.getStart()));
assertEquals(endString, calResult.getEnd() == null ? null : dateFormat.format(calResult.getEnd()));
assertEquals(organizer, calResult.getOrganizer()); assertEquals(organizer, calResult.getOrganizer());
assertArrayEquals(attendees, calResult.getAttendees()); assertArrayEquals(attendees, calResult.getAttendees());
assertEqualOrNaN(latitude, calResult.getLatitude()); assertEqualOrNaN(latitude, calResult.getLatitude());

View file

@ -125,7 +125,7 @@ public final class ContactInfoGenerator implements GeneratorSource {
} }
private static void maybeAppendMECARD(StringBuilder output, String prefix, String value) { private static void maybeAppendMECARD(StringBuilder output, String prefix, String value) {
if (!value.isEmpty()) { if (value != null && !value.isEmpty()) {
value = value.replaceAll("([\\\\:;])", "\\\\$1"); value = value.replaceAll("([\\\\:;])", "\\\\$1");
value = value.replaceAll("\\n", ""); value = value.replaceAll("\\n", "");
output.append(prefix).append(':').append(value).append(';'); output.append(prefix).append(':').append(value).append(';');