Browse Source

Pull request #55: REPORT-65118 REPORT-64392 这个任务再看下产品端报错侧有没有能优化的

Merge in PG/plugin-report-doc-demo from ~ZACK/plugin-report-doc-demo:release/10.0 to release/10.0

* commit 'e79e8f895ea2dd09ce23ee3e202456770743b1a5':
  1
  REPORT-65118 REPORT-64392 这个任务再看下产品端报错侧有没有能优化的
pull/6/head
zack 3 years ago
parent
commit
60609d03e9
  1. 14
      src/main/java/com/fr/demo/NewReadFrmFromDatabase.java
  2. 4
      src/main/java/com/fr/demo/ReadFromDatabase.java
  3. 8
      src/main/java/com/fr/demo/ReadfrmFromDatabase.java

14
src/main/java/com/fr/demo/NewReadFrmFromDatabase.java

@ -1,16 +1,18 @@
package com.fr.demo; package com.fr.demo;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.web.weblet.DBFormlet;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.web.session.SessionLocalManager;
import com.fr.web.weblet.DBFormlet;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream; import java.io.InputStream;
import java.sql.Blob; import java.sql.Blob;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.Map; import java.util.Map;
@ -26,7 +28,7 @@ public class NewReadFrmFromDatabase extends DBFormlet {
@Override @Override
public Form createForm(String reportName) { public Form createForm(String reportName) {
Form form = new Form(); Form form = null;
Connection connection = null; Connection connection = null;
try { try {
connection = getConnection(); connection = getConnection();
@ -43,12 +45,12 @@ public class NewReadFrmFromDatabase extends DBFormlet {
return form; return form;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); throw SessionLocalManager.createLogPackedException(e);
}finally { }finally {
DBUtils.closeConnection(connection); DBUtils.closeConnection(connection);
} }
return null; return form;
} }
private static Connection getConnection() throws ClassNotFoundException, SQLException { private static Connection getConnection() throws ClassNotFoundException, SQLException {

4
src/main/java/com/fr/demo/ReadFromDatabase.java

@ -5,6 +5,8 @@ import com.fr.main.impl.WorkBook;
import com.fr.web.core.Reportlet; import com.fr.web.core.Reportlet;
import com.fr.web.request.ReportletRequest; import com.fr.web.request.ReportletRequest;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.web.session.SessionLocalManager;
import java.io.InputStream; import java.io.InputStream;
import java.sql.Blob; import java.sql.Blob;
import java.sql.Connection; import java.sql.Connection;
@ -40,7 +42,7 @@ public class ReadFromDatabase extends Reportlet {
workbook.readStream(ins); workbook.readStream(ins);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); throw SessionLocalManager.createLogPackedException(e);
} }
return workbook; return workbook;
} }

8
src/main/java/com/fr/demo/ReadfrmFromDatabase.java

@ -1,10 +1,12 @@
package com.fr.demo; package com.fr.demo;
import com.fr.form.main.Form;
import com.fr.io.utils.ResourceIOUtils; import com.fr.io.utils.ResourceIOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.web.session.SessionLocalManager;
import com.fr.web.weblet.Formlet; import com.fr.web.weblet.Formlet;
import com.fr.form.main.Form;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.fr.log.FineLoggerFactory;
import java.io.InputStream; import java.io.InputStream;
import java.sql.Blob; import java.sql.Blob;
import java.sql.Connection; import java.sql.Connection;
@ -42,7 +44,7 @@ public class ReadfrmFromDatabase extends Formlet {
form.readStream(ins); form.readStream(ins);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); throw SessionLocalManager.createLogPackedException(e);
} }
System.out.println(ResourceIOUtils.getRealPath("assets")); System.out.println(ResourceIOUtils.getRealPath("assets"));
return form; return form;

Loading…
Cancel
Save