[ https://issues.apache.org/jira/browse/MAHOUT-1996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trevor Grant resolved MAHOUT-1996. ---------------------------------- Resolution: Won't Fix Jira Cleanup 1/31/24 > AdaptiveLogisticModelParameters can throw NPE > --------------------------------------------- > > Key: MAHOUT-1996 > URL: https://issues.apache.org/jira/browse/MAHOUT-1996 > Project: Mahout > Issue Type: Bug > Components: Classification > Affects Versions: 0.12.2 > Reporter: Hao Zhong > Priority: Major > > The AdaptiveLogisticModelParameters_saveTo method has the following code: > {code} > public void saveTo(OutputStream out) throws IOException { > if (alr != null) { > alr.close(); > } > setTargetCategories(getCsvRecordFactory().getTargetCategories()); > write(new DataOutputStream(out)); > } > {code} > The above code can throw NPE. MAHOUT-1196 fixed a similar bug. Its buggy code > is identical: > {code} > public void saveTo(OutputStream out) throws IOException { > if (alr != null) { > alr.close(); > } > setTargetCategories(getCsvRecordFactory().getTargetCategories()); > write(new DataOutputStream(out)); > } > {code} > The fixed code is as follow: > {code} > public void saveTo(OutputStream out) throws IOException { > Closeables.close(lr, false); > targetCategories = getCsvRecordFactory().getTargetCategories(); > write(new DataOutputStream(out)); > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)