Skip to content

Commit

Permalink
Merge pull request #4 from DanielCoutoVale/remove-warnings
Browse files Browse the repository at this point in the history
Remove warnings (unclosed readers/writers and unsafe varargs)
  • Loading branch information
mwhite14850 committed Feb 6, 2015
2 parents 59642fd + 78516ed commit da8eb17
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/opennlp/ccg/grammar/RuleGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ public void loadSupercatRuleCombos(URL url) throws IOException {
supercatRuleCombos.add(new SupercatRuleCombo(tokens[0], tokens[1], tokens[2]));
}
}
in.close();
}


Expand Down
1 change: 1 addition & 0 deletions src/opennlp/ccg/ngrams/SRILM_FactoredScorerMaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ protected void writeFoldSpecFile(File tmpDir, int foldNum) throws IOException {
}
}
out.close();
br.close();
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/opennlp/ccg/parse/Chart.java
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,10 @@ public void loadChartEntries(File file) throws IOException {
_size = _table.length;
_numUnpackingEdges = 0;
} catch (ClassNotFoundException e) {
in.close();
throw (RuntimeException) new RuntimeException().initCause(e);
}
in.close();
}


Expand Down
1 change: 1 addition & 0 deletions src/opennlp/ccg/parse/postagger/ml/POSPriorModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public POSPriorModel(String flmFile, String vocabFile) throws IOException {
for (String posTag : allSupertags) {
posVocab[cnt++] = posTag.intern();
}
br.close();
}

/** Get the prior probability of this POS/word combo. */
Expand Down
1 change: 1 addition & 0 deletions src/opennlp/ccg/parse/supertagger/ml/STPriorModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public STPriorModel(String flmFile, String vocabFile, STTaggerPOSDictionary posD
st = st.trim().split("-")[1];
}
}
br.close();

// initialize the arrays to this size.
stagVocab = new String[cnt];
Expand Down
1 change: 1 addition & 0 deletions src/opennlp/ccg/util/CompositeFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public CompositeFilter() {
* Creates a new composite filter made up of the specified filters.
* @see #CompositeFilter(Collection)
*/
@SafeVarargs
public CompositeFilter(Filter<? super E>... edgeFilters) {
this(Arrays.asList(edgeFilters));
}
Expand Down
1 change: 1 addition & 0 deletions src/opennlp/ccgbank/convert/ApposTally.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public void openCueFile(String fileName) throws IOException {
cueList.add(line);
//System.out.println(line);
}
br.close();
}

//Proc which traps, stores id of each sentence in a global var
Expand Down
8 changes: 5 additions & 3 deletions src/opennlp/ccgbank/convert/InfoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public static void readBBNAuxfiles(String sect){
bbnSpans.put(sentId,spanList);

}
inp.close();
}
}
catch(IOException e){
Expand Down Expand Up @@ -120,7 +121,7 @@ public static void readQuoteAuxfiles(String sect){
quotedText=quotedText.trim();
quoteInfo.put(key,quotedText);
}

inp.close();
}
}
catch(IOException e){
Expand Down Expand Up @@ -164,6 +165,7 @@ else if(label.equals("TPC")){
}
}
}
inp.close();
}
}
catch(IOException e){
Expand Down Expand Up @@ -191,7 +193,7 @@ public static void readTreeAuxfiles(String sect){
String catId=treeParts[2];
treeInfo.put(key,catId);
}

inp.close();
}

}
Expand Down Expand Up @@ -602,7 +604,7 @@ public void printBBNClasses(){
print_writer.print("\"/>");
print_writer.flush();
}

print_writer.close();
}
catch (Exception e){
System.err.println ("Error writing info to file");
Expand Down
2 changes: 2 additions & 0 deletions src/opennlp/ccgbank/convert/MorphLookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public static void init(File wordsFile, File stemsFile) throws IOException {
stemMap.put(key, stem);
stemMap.put(key2, stem);
}
wordsReader.close();
stemsReader.close();
}

/** Returns the stem for the given word and pos, or the empty string if none. */
Expand Down
2 changes: 1 addition & 1 deletion src/opennlp/ccgbank/extract/DebugHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void readInfo() {
//System.out.println(tagInfo);
//System.out.println(tagInfo.size());
init = false;

inp.close();
}

catch (IOException e) {
Expand Down
1 change: 1 addition & 0 deletions src/opennlp/ccgbank/extract/RulesTally.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public static void printTally(File directory) throws FileNotFoundException{
output.println("</body>");
output.println("</html>");
output.flush();
output.close();
}


Expand Down

0 comments on commit da8eb17

Please sign in to comment.