diff --git a/java/src/main/java/com/genexus/webpanels/GXWebPanel.java b/java/src/main/java/com/genexus/webpanels/GXWebPanel.java index 82aac6b95..d48eb6649 100644 --- a/java/src/main/java/com/genexus/webpanels/GXWebPanel.java +++ b/java/src/main/java/com/genexus/webpanels/GXWebPanel.java @@ -100,43 +100,19 @@ public boolean isAjaxCallMode() public void addString(String value) { httpContext.GX_webresponse.addString(value); } - + public GXMasterPage createMasterPage(int remoteHandle, String fullClassName) { - - String masterPage = this.context.getPreferences().getProperty("MasterPage", ""); - if (fullClassName.equals("(default)")) // Is the default - { - if (masterPage.isEmpty()) - { - logger.error("The default master page is not present on the client.cfg file, please add the MasterPage key to the client.cfg."); - return null; - } - String namespace = this.context.getPreferences().getProperty("NAME_SPACE", ""); - fullClassName = namespace.isEmpty() ? masterPage.toLowerCase() + "_impl" : namespace.trim() + "." + masterPage.toLowerCase() + "_impl"; - } - if (fullClassName.equals("(none)")) // none Master Page - { - return new NoneMasterPage((HttpContext) this.context.getHttpContext()); - } - else{ - fullClassName = fullClassName + "_impl"; - } + fullClassName = fullClassName + "_impl"; try { Class masterPageClass = Class.forName(fullClassName); return (GXMasterPage) masterPageClass.getConstructor(new Class[] {int.class, ModelContext.class}).newInstance(remoteHandle, context.copy()); } catch (ClassNotFoundException e) { - logger.error("MasterPage not found: " + fullClassName); - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); + logger.error("MasterPage class not found: " + fullClassName, e); + throw new RuntimeException(e); + } catch (Exception e) { + logger.error("MasterPage could not be loaded: " + fullClassName, e); + throw new RuntimeException(e); } - return null; } @@ -147,11 +123,15 @@ protected Object dyncall(String MethodName) logger.error("DynCall - Method not found: " + MethodName); return null; } + Class[] pars = m.getParameterTypes(); int ParmsCount = pars.length; Object[] convertedparms = new Object[ParmsCount]; - for (int i = 0; i < ParmsCount; i++) + + for (int i = 0; i < ParmsCount; i++) { convertedparms[i] = convertparm(pars, i, WebUtils.decryptParm(httpContext.GetNextPar(), "")); + } + try { return m.invoke(this, convertedparms); @@ -159,8 +139,9 @@ protected Object dyncall(String MethodName) catch (java.lang.Exception e) { logger.error("DynCall - Invoke error " + MethodName, e); - return null; } + + return null; } protected Object convertparm(Class[] pars, int i, Object value) {