Skip to content

Commit 4b0197a

Browse files
committed
made updates to align with Java 1.6
1 parent f7e9cd4 commit 4b0197a

File tree

19 files changed

+48
-42
lines changed

19 files changed

+48
-42
lines changed

Desktop/build.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Build file for OpenSextant Desktop
1111
<!-- Name of the project -->
1212
<property name="project.name" value="OpenSextantDesktop" />
1313
<property name="project.version" value="1.0" />
14-
<property name="java_level" value="1.7" />
14+
<property name="java_level" value="1.6" />
1515

1616
<property file="${basedir}/build.properties" />
1717

Xponents/PoLi/build.xml

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
destdir="${build}"
5656
classpathref="compile.classpath"
5757
debug="yes"
58+
source="1.6"
5859
deprecation="yes"
5960
encoding="utf-8"
6061
includeantruntime='true' >

Xponents/PoLi/src/main/java/org/mitre/opensextant/poli/TestScript.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public CsvMapWriter open(String file) throws IOException {
114114
*/
115115
protected Map<String, Object> createResultRow(PatternTestCase t, TextMatch m) {
116116

117-
Map<String, Object> row = new HashMap<>();
117+
Map<String, Object> row = new HashMap<String, Object>();
118118

119119
if (t != null) {
120120
row.put(header[0], t.id);

Xponents/XCoord/build.xml

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<javac srcdir="${basedir}/src/main/java"
5656
destdir="${build}"
5757
classpathref="compile.classpath"
58+
source="1.6"
5859
debug="yes"
5960
deprecation="yes"
6061
encoding="utf-8"

Xponents/XCoord/src/main/java/org/mitre/xcoord/DMSOrdinate.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public DMSOrdinate(java.util.Map<String, String> elements, boolean islat, String
117117
normalize_hemisphere(text, _elements, islat);
118118

119119
boolean _parse_state = false;
120-
_normal = new HashMap<>();
120+
_normal = new HashMap<String, String>();
121121

122122
is_latitude = islat;
123123

@@ -497,7 +497,7 @@ public boolean hasSymbols() {
497497
/**
498498
*
499499
*/
500-
public final static String[] COORDINATE_SYMBOLS = {"°", "º", "'", "\"", ":", "lat", "lon", "geo", "coord", "deg"};
500+
public final static String[] COORDINATE_SYMBOLS = {"��", "��", "'", "\"", ":", "lat", "lon", "geo", "coord", "deg"};
501501
private String coord_symbol = null;
502502

503503
/**

Xponents/XCoord/src/main/java/org/mitre/xcoord/GeocoordMatch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public String gridzone() {
237237
*/
238238
public void addOtherInterpretation(GeocoordMatch m2) {
239239
if (interpretations == null) {
240-
interpretations = new ArrayList<>();
240+
interpretations = new ArrayList<GeocoordMatch>();
241241
}
242242
interpretations.add(m2);
243243
}

Xponents/XCoord/src/main/java/org/mitre/xcoord/MGRSFilter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class MGRSFilter implements MatchFilter {
6666
public int CURRENT_YY = 0;
6767
/**
6868
*/
69-
public Set<String> IGNORE_SEQ = new HashSet<>();
69+
public Set<String> IGNORE_SEQ = new HashSet<String>();
7070

7171
/**
7272
*

Xponents/XCoord/src/main/java/org/mitre/xcoord/TestScript.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ protected void focusedTests() {
465465

466466
int count = 0;
467467

468-
List<String> tests = new ArrayList<>();
468+
List<String> tests = new ArrayList<String>();
469469
if (dd) {
470470
tests.addAll(Arrays.asList(ddtest));
471471
}

Xponents/XCoord/src/main/java/org/mitre/xcoord/TestUtility.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class TestUtility {
6363
"matchtext", "lat", "lon", "mgrs", "precision", "offset"};
6464

6565
protected static Map<String,Object> getEmptyRow() {
66-
Map<String,Object> blank = new HashMap<>();
66+
Map<String,Object> blank = new HashMap<String,Object>();
6767
blank.put(header[0], "");
6868
blank.put(header[1], "");
6969
blank.put(header[2], false);
@@ -153,7 +153,7 @@ public Map<String,Object> createTestCase(TestCase t) {
153153
}
154154
// This happens when the TestCases are well defined.
155155

156-
Map<String,Object> row = new HashMap<>();
156+
Map<String,Object> row = new HashMap<String,Object>();
157157
row.put(header[0], t.id);
158158
row.put(header[1], t.family);
159159
row.put(header[2], t.true_positive);

Xponents/XCoord/src/main/java/org/mitre/xcoord/XConstants.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ public final class XConstants {
9595
/**
9696
*
9797
*/
98-
protected final static Map<String,Integer> familyInt = new HashMap<>();
98+
protected final static Map<String,Integer> familyInt = new HashMap<String,Integer>();
9999
/**
100100
*
101101
*/
102-
protected final static Map<Integer,String> familyLabel = new HashMap<>();
102+
protected final static Map<Integer,String> familyLabel = new HashMap<Integer,String>();
103103

104104
static {
105105

Xponents/XCoord/src/main/java/org/mitre/xcoord/XCoord.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public TextMatchResultSet extract_coordinates(String text, String text_id, int f
248248

249249
TextMatchResultSet results = new TextMatchResultSet();
250250
results.result_id = text_id;
251-
results.matches = new ArrayList<>();
251+
results.matches = new ArrayList<TextMatch>();
252252

253253
for (RegexPattern repat : patterns.get_patterns()) {
254254

Xponents/XTemporal/build.xml

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
description="Compiles XTemporal package.">
5353
<javac srcdir="${basedir}/src/main/java"
5454
destdir="${build}"
55+
source="1.6"
5556
classpathref="compile.classpath"
5657
debug="yes"
5758
deprecation="yes"

Xponents/XTemporal/src/main/java/org/mitre/xtemporal/DateNormalization.java

+14-19
Original file line numberDiff line numberDiff line change
@@ -228,26 +228,21 @@ public static int normalize_time(java.util.Map<String, String> elements, String
228228
return -1;
229229
}
230230

231-
switch (tmField) {
232-
case "hh":
233-
if (val < 24) {
234-
return val;
235-
}
236-
break;
237-
238-
case "mm":
239-
if (val < 60) {
240-
return val;
241-
}
242-
break;
243-
case "ss":
244-
if (val < 60) {
245-
return val;
246-
}
247-
break;
248-
default:
249-
// Unknown field;
231+
if ("hh".equals("tmField")) {
232+
if (val < 24) {
250233
return val;
234+
}
235+
} else if ("mm".equals("tmField")) {
236+
if (val < 60) {
237+
return val;
238+
}
239+
} else if ("ss".equals("tmField")) {
240+
if (val < 60) {
241+
return val;
242+
}
243+
} else {
244+
// Unknown field;
245+
return val;
251246
}
252247

253248
return -1;

Xponents/XTemporal/src/main/java/org/mitre/xtemporal/XTTestUtility.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void save_result(TextMatchResultSet results) throws IOException {
105105
if (! results.matches.isEmpty()) {
106106
for (TextMatch tm : results.matches) {
107107

108-
row = new HashMap<>();
108+
row = new HashMap<String, Object>();
109109
row.put(header[0], results.result_id);
110110
row.put(header[1], "PASS");
111111

@@ -125,7 +125,7 @@ public void save_result(TextMatchResultSet results) throws IOException {
125125
report.write(row, header, xtempResultsSpec);
126126
}
127127
} else {
128-
row = new HashMap<>();
128+
row = new HashMap<String, Object>();
129129
row.put(header[0], results.result_id);
130130
row.put(header[1], "FAIL");
131131
row.put(header[2], results.get_trace());

Xponents/XTemporal/src/main/java/org/mitre/xtemporal/XTemporal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void setMatchWidth(int w) {
150150
public TextMatchResultSet extract_dates(String text, String text_id) {
151151

152152
TextMatchResultSet results = new TextMatchResultSet();
153-
results.matches = new ArrayList<>();
153+
results.matches = new ArrayList<TextMatch>();
154154
results.result_id = text_id;
155155

156156
for (RegexPattern pat : patterns.get_patterns()) {

Xponents/XText/build.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<target name="compile" depends="setup,dependencies"
5656
description="Compiles XText package.">
5757
<javac srcdir="${basedir}/src/main/java"
58-
source="1.7"
58+
source="1.6"
5959
destdir="${basedir}/build"
6060
classpathref="compile.classpath"
6161
debug="yes"

Xponents/XText/src/main/java/org/mitre/xtext/ConvertedDocument.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public final class ConvertedDocument {
6565
"filesize",
6666
"textsize"
6767
};
68-
public final static Set<String> valid_fields = new HashSet<>(Arrays.asList(fields));
68+
public final static Set<String> valid_fields = new HashSet<String>(Arrays.asList(fields));
6969
public String filepath = null;
7070
public String filename = null;
7171
public Date filetime = null;

Xponents/XText/src/main/java/org/mitre/xtext/XText.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ public final class XText implements iFilter, iConvert {
7979
protected String inputNode = null;
8080
public boolean save_in_folder = false;
8181
public boolean save_in_archive_root = false; // save to the archive root rather than in the directory the file came from
82-
protected Set<String> archive_types = new HashSet<>();
82+
protected Set<String> archive_types = new HashSet<String>();
8383
/**
8484
*
8585
*/
86-
public static Map<String, iConvert> converters = new HashMap<>();
86+
public static Map<String, iConvert> converters = new HashMap<String, iConvert>();
8787
private iConvert defaultConversion;
88-
private Set<String> requested_types = new HashSet<>();
89-
private Set<String> ignore_types = new HashSet<>();
88+
private Set<String> requested_types = new HashSet<String>();
89+
private Set<String> ignore_types = new HashSet<String>();
9090

9191
/**
9292
*/

Xponents/XText/src/test/java/org/mitre/xtext/test/Tests.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package org.mitre.xtext.test;
1717

1818
import java.io.*;
19-
import java.nio.file.Files;
2019
import java.util.*;
2120

2221
import org.apache.commons.io.FileUtils;
@@ -39,7 +38,15 @@ public class Tests {
3938

4039
@BeforeClass
4140
public static void createPlayground() throws IOException {
42-
tempDir = Files.createTempDirectory("xtext_test").toFile();
41+
42+
// change to a temp directory that is java 1.6 compliant
43+
//tempDir = Files.createTempDirectory("xtext_test").toFile();
44+
File t = File.createTempFile("xtext_text","");
45+
tempDir = new File(t.getAbsolutePath() + "_d");
46+
tempDir.mkdir();
47+
t.delete();
48+
49+
4350
doc = new File(tempDir, "Asia_Fdn_Afghanistan_2009.pdf");
4451
FileUtils.copyInputStreamToFile(Tests.class.getResourceAsStream("/Asia_Fdn_Afghanistan_2009.pdf"), doc);
4552
}
@@ -142,4 +149,5 @@ public static void main(String[] args) {
142149
ioerr.printStackTrace();
143150
}
144151
}
152+
145153
}

0 commit comments

Comments
 (0)