IDEMPIERE-3618 Support OFX 2 in org.compiere.impexp.OFXFileBankStatementLoader
This commit is contained in:
parent
36985e7096
commit
2cf832fc43
|
@ -202,6 +202,10 @@ public abstract class OFXBankStatementHandler extends DefaultHandler
|
||||||
m_errorMessage = new StringBuffer("ErrorInitializingParser");
|
m_errorMessage = new StringBuffer("ErrorInitializingParser");
|
||||||
m_errorDescription = new StringBuffer("Unable to initialize SAX parser: ").append(e.getMessage());
|
m_errorDescription = new StringBuffer("Unable to initialize SAX parser: ").append(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
closeBufferedReader();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
|
@ -256,6 +260,7 @@ public abstract class OFXBankStatementHandler extends DefaultHandler
|
||||||
{
|
{
|
||||||
m_errorMessage = new StringBuffer("ErrorReadingData");
|
m_errorMessage = new StringBuffer("ErrorReadingData");
|
||||||
m_errorDescription = new StringBuffer(e.getMessage());
|
m_errorDescription = new StringBuffer(e.getMessage());
|
||||||
|
closeBufferedReader();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,11 +327,22 @@ public abstract class OFXBankStatementHandler extends DefaultHandler
|
||||||
{
|
{
|
||||||
m_errorMessage = new StringBuffer("ErrorReadingData");
|
m_errorMessage = new StringBuffer("ErrorReadingData");
|
||||||
m_errorDescription = new StringBuffer(e.getMessage());
|
m_errorDescription = new StringBuffer(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
closeBufferedReader();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
} // loadLines
|
} // loadLines
|
||||||
|
|
||||||
|
private void closeBufferedReader() {
|
||||||
|
if (m_reader != null)
|
||||||
|
try {
|
||||||
|
m_reader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getDateLastRun
|
* Method getDateLastRun
|
||||||
* @return Timestamp
|
* @return Timestamp
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.compiere.impexp;
|
package org.compiere.impexp;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.compiere.model.MBankStatementLoader;
|
import org.compiere.model.MBankStatementLoader;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -38,6 +37,9 @@ public final class OFXFileBankStatementLoader extends OFXBankStatementHandler im
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @see org.compiere.impexp.BankStatementLoaderInterface#init(MBankStatementLoader)
|
* @see org.compiere.impexp.BankStatementLoaderInterface#init(MBankStatementLoader)
|
||||||
*/
|
*/
|
||||||
|
//m_stream is not closed because the BufferedReader in the parent class is closed and according to the Java docs:
|
||||||
|
//Calling close() on the BufferedReader closes the underlying stream by default implementation
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public boolean init(MBankStatementLoader controller)
|
public boolean init(MBankStatementLoader controller)
|
||||||
{
|
{
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
@ -72,13 +74,6 @@ public final class OFXFileBankStatementLoader extends OFXBankStatementHandler im
|
||||||
{
|
{
|
||||||
m_errorMessage = new StringBuffer("ErrorReadingData");
|
m_errorMessage = new StringBuffer("ErrorReadingData");
|
||||||
m_errorDescription = new StringBuffer();
|
m_errorDescription = new StringBuffer();
|
||||||
}finally{
|
|
||||||
if (m_stream != null)
|
|
||||||
try {
|
|
||||||
m_stream.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue