IDEMPIERE-1160 Hide potentially dangerous stuff from non-admin users / fix a NPE shown on logout after a non-access exception is thrown when opening window

This commit is contained in:
Carlos Ruiz 2013-08-07 14:04:42 -05:00
parent e7d2a7a293
commit bc2f43b356
2 changed files with 9 additions and 2 deletions

View File

@ -24,7 +24,9 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.desktop.IDesktop;
import org.adempiere.webui.exception.ApplicationException;
import org.adempiere.webui.part.AbstractUIPart;
import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MImage;
@ -88,7 +90,12 @@ public class ADWindow extends AbstractUIPart
this.adWindowId = adWindowId;
windowNo = SessionManager.getAppDesktop().registerWindow(this);
this.query = query;
init();
try {
init();
} catch (Exception e) {
SessionManager.getAppDesktop().unregisterWindow(windowNo);
throw new ApplicationException(e.getMessage(), e);
}
}
private void init()

View File

@ -602,7 +602,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
if (windows != null) {
for (int idx = 0; idx < windows.size(); idx++) {
Object ad = windows.get(idx);
if (ad != null && ad instanceof ADWindow) {
if (ad != null && ad instanceof ADWindow && ((ADWindow)ad).getADWindowContent() != null) {
if ( ((ADWindow)ad).getADWindowContent().isPendingChanges()) {
return true;
}