IDEMPIERE-5107 Can't 2pack zip for Window Role - improve showing error messages (#1066)

This commit is contained in:
Carlos Ruiz 2021-12-20 04:25:59 +01:00 committed by GitHub
parent a05a81154e
commit c4c3e348b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 19 deletions

View File

@ -2,6 +2,7 @@ package org.adempiere.pipo2.handler;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.logging.Level; import java.util.logging.Level;
@ -129,7 +130,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
if(pstm.executeUpdate()<0){ if(pstm.executeUpdate()<0){
throw new SAXException(); throw new SAXException();
} }
} catch (Exception e) { } catch (SQLException e) {
throw new DBException(e); throw new DBException(e);
} finally { } finally {
DB.close(pstm); DB.close(pstm);

View File

@ -18,6 +18,7 @@ package org.adempiere.pipo2.handler;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
@ -120,7 +121,7 @@ public class ImpFormatElementHandler extends AbstractElementHandler {
createImpFormatRow(ctx, document, rs createImpFormatRow(ctx, document, rs
.getInt("AD_ImpFormat_Row_ID")); .getInt("AD_ImpFormat_Row_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
log.log(Level.SEVERE, "ImpFormat", e); log.log(Level.SEVERE, "ImpFormat", e);
throw new DatabaseAccessException("Failed to export Import Format.", e); throw new DatabaseAccessException("Failed to export Import Format.", e);
} finally { } finally {

View File

@ -19,6 +19,7 @@ package org.adempiere.pipo2.handler;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
@ -157,7 +158,7 @@ public class MenuElementHandler extends AbstractElementHandler {
oldseqNo = seqNo; oldseqNo = seqNo;
} }
} catch (Exception e) { } catch (SQLException e) {
throw new DBException(e); throw new DBException(e);
} finally { } finally {
DB.close(rs, pstmt); DB.close(rs, pstmt);

View File

@ -19,6 +19,7 @@ package org.adempiere.pipo2.handler;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
@ -160,7 +161,7 @@ public class PrintFormatElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createItem(ctx, document, rs.getInt("AD_PrintFormatItem_ID")); createItem(ctx, document, rs.getInt("AD_PrintFormatItem_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
throw new DBException(e); throw new DBException(e);
} finally { } finally {
DB.close(rs, pstmt); DB.close(rs, pstmt);

View File

@ -18,11 +18,13 @@ package org.adempiere.pipo2.handler;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.DBException;
import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element; import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.ElementHandler; import org.adempiere.pipo2.ElementHandler;
@ -129,8 +131,8 @@ public class ReportViewElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createReportViewCol(ctx, document, rs.getInt("AD_ReportView_Col_ID")); createReportViewCol(ctx, document, rs.getInt("AD_ReportView_Col_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
throw new AdempiereException(e); throw new DBException(e);
} finally { } finally {
DB.close(rs, pstmt); DB.close(rs, pstmt);
} }
@ -145,8 +147,8 @@ public class ReportViewElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createReportViewColumn(ctx, document, AD_ReportView_ID, rs.getInt("AD_Column_ID")); createReportViewColumn(ctx, document, AD_ReportView_ID, rs.getInt("AD_Column_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
throw new AdempiereException(e); throw new DBException(e);
} finally { } finally {
DB.close(rs, pstmt); DB.close(rs, pstmt);
} }

View File

@ -18,6 +18,7 @@ package org.adempiere.pipo2.handler;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
@ -131,7 +132,7 @@ public class RoleElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createOrgAccess(ctx, document, rs.getInt("AD_Org_ID"), rs.getInt("AD_Role_ID")); createOrgAccess(ctx, document, rs.getInt("AD_Org_ID"), rs.getInt("AD_Role_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
log.log(Level.SEVERE, "AD_Role_OrgAccess", e); log.log(Level.SEVERE, "AD_Role_OrgAccess", e);
throw new DatabaseAccessException("Failed to export organization role access."); throw new DatabaseAccessException("Failed to export organization role access.");
} finally { } finally {
@ -150,7 +151,7 @@ public class RoleElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createUserRole(ctx, document, rs.getInt("AD_User_ID"), rs.getInt("AD_Role_ID"), rs.getInt("AD_Org_ID")); createUserRole(ctx, document, rs.getInt("AD_User_ID"), rs.getInt("AD_Role_ID"), rs.getInt("AD_Org_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
log.log(Level.SEVERE, "AD_User_Roles", e); log.log(Level.SEVERE, "AD_User_Roles", e);
throw new DatabaseAccessException("Failed to export user role assignment."); throw new DatabaseAccessException("Failed to export user role assignment.");
} finally { } finally {
@ -168,7 +169,7 @@ public class RoleElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createWindowAccess(ctx, document, rs.getInt("AD_Window_ID"), rs.getInt("AD_Role_ID")); createWindowAccess(ctx, document, rs.getInt("AD_Window_ID"), rs.getInt("AD_Role_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
log.log(Level.SEVERE, "AD_Window_Access", e); log.log(Level.SEVERE, "AD_Window_Access", e);
throw new DatabaseAccessException("Failed to export window access."); throw new DatabaseAccessException("Failed to export window access.");
} finally { } finally {
@ -185,7 +186,7 @@ public class RoleElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createProcessAccess(ctx, document, rs.getInt("AD_Process_ID"), rs.getInt("AD_Role_ID")); createProcessAccess(ctx, document, rs.getInt("AD_Process_ID"), rs.getInt("AD_Role_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
log.log(Level.SEVERE, "AD_Process_Access", e); log.log(Level.SEVERE, "AD_Process_Access", e);
throw new DatabaseAccessException("Failed to export process access."); throw new DatabaseAccessException("Failed to export process access.");
} finally { } finally {
@ -202,7 +203,7 @@ public class RoleElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createFormAccess(ctx, document, rs.getInt("AD_Form_ID"), rs.getInt("AD_Role_ID")); createFormAccess(ctx, document, rs.getInt("AD_Form_ID"), rs.getInt("AD_Role_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
log.log(Level.SEVERE, "AD_Form_Access", e); log.log(Level.SEVERE, "AD_Form_Access", e);
throw new DatabaseAccessException("Failed to export form access."); throw new DatabaseAccessException("Failed to export form access.");
} finally { } finally {
@ -219,7 +220,7 @@ public class RoleElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createWorkflowAccess(ctx, document, rs.getInt("AD_Workflow_ID"), rs.getInt("AD_Role_ID")); createWorkflowAccess(ctx, document, rs.getInt("AD_Workflow_ID"), rs.getInt("AD_Role_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
log.log(Level.SEVERE, "AD_Workflow_Access", e); log.log(Level.SEVERE, "AD_Workflow_Access", e);
throw new DatabaseAccessException("Failed to export workflow access."); throw new DatabaseAccessException("Failed to export workflow access.");
} finally { } finally {
@ -236,7 +237,7 @@ public class RoleElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createTaskAccess(ctx, document, rs.getInt("AD_Task_ID"), rs.getInt("AD_Role_ID")); createTaskAccess(ctx, document, rs.getInt("AD_Task_ID"), rs.getInt("AD_Role_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
log.log(Level.SEVERE, "AD_Task_Access", e); log.log(Level.SEVERE, "AD_Task_Access", e);
throw new DatabaseAccessException("Failed to export task access."); throw new DatabaseAccessException("Failed to export task access.");
} finally { } finally {
@ -253,7 +254,7 @@ public class RoleElementHandler extends AbstractElementHandler {
while (rs.next()) { while (rs.next()) {
createInfoWindowAccess(ctx, document, rs.getInt("AD_InfoWindow_ID"), rs.getInt("AD_Role_ID")); createInfoWindowAccess(ctx, document, rs.getInt("AD_InfoWindow_ID"), rs.getInt("AD_Role_ID"));
} }
} catch (Exception e) { } catch (SQLException e) {
log.log(Level.SEVERE, "AD_InfoWindow_Access", e); log.log(Level.SEVERE, "AD_InfoWindow_Access", e);
throw new DatabaseAccessException("Failed to export InfoWindow access."); throw new DatabaseAccessException("Failed to export InfoWindow access.");
} finally { } finally {

View File

@ -18,6 +18,7 @@ package org.adempiere.pipo2.handler;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
@ -138,7 +139,7 @@ public class TabElementHandler extends AbstractElementHandler {
createField(ctx, document, rs.getInt("AD_Field_ID")); createField(ctx, document, rs.getInt("AD_Field_ID"));
} }
} }
catch (Exception e) catch (SQLException e)
{ {
log.log(Level.SEVERE,e.getLocalizedMessage(), e); log.log(Level.SEVERE,e.getLocalizedMessage(), e);
throw new DatabaseAccessException("Failed to export window tab", e); throw new DatabaseAccessException("Failed to export window tab", e);

View File

@ -23,7 +23,6 @@ import java.util.Set;
import org.adempiere.base.IGridTabExporter; import org.adempiere.base.IGridTabExporter;
import org.adempiere.base.equinox.EquinoxExtensionLocator; import org.adempiere.base.equinox.EquinoxExtensionLocator;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.AdempiereWebUI; import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.adwindow.AbstractADWindowContent; import org.adempiere.webui.adwindow.AbstractADWindowContent;
@ -342,7 +341,7 @@ public class ExportAction implements EventListener<Event>
media = new AMedia(exporter.getSuggestedFileName(panel.getActiveGridTab()), null, exporter.getContentType(), file, true); media = new AMedia(exporter.getSuggestedFileName(panel.getActiveGridTab()), null, exporter.getContentType(), file, true);
Filedownload.save(media); Filedownload.save(media);
} catch (Exception e) { } catch (Exception e) {
throw new AdempiereException(e); FDialog.error(0, winExportFile, e.getLocalizedMessage());
} finally { } finally {
if (winExportFile != null) if (winExportFile != null)
winExportFile.onClose(); winExportFile.onClose();