You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mahout.apache.org by "Hao Zhong (JIRA)" <ji...@apache.org> on 2017/07/04 02:24:00 UTC
[jira] [Created] (MAHOUT-1996) AdaptiveLogisticModelParameters can
throw NPE
Hao Zhong created MAHOUT-1996:
---------------------------------
Summary: 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
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
(v6.4.14#64029)