Package org.olat.core.logging

Examples of org.olat.core.logging.OLATRuntimeException


   * @param f
   * @param sb
   */
  private void renderFormSubmit(Form f, StringOutput sb, Translator translator) {
    // Submit buttons
    if (f.getSubmitKeysi18n().size() == 0) throw new OLATRuntimeException(null,
        "Submit key in form is undefined. Use setSubmitKey(\"save\"); to set key in the form.", null);
    int counter = 0;
    for (Iterator iter_I18nKeys = f.getSubmitKeysi18n().iterator(); iter_I18nKeys.hasNext();) {
      String i18nKey = (String) iter_I18nKeys.next();
      String name = Form.SUBMIT_IDENTIFICATION + "_" + counter;
View Full Code Here


        renderCheckBoxes(f, me, translator, sb);
      } else if (fe instanceof LinkElement) {
        LinkElement le = (LinkElement) fe;
        renderLink(f, le, translator, sb);
      } else {
        throw new OLATRuntimeException("Unknown for element::" + fe.getName() + " " + fe.getClass().getCanonicalName(), null);
      }

      if(fe.getVisualMarked()){
        sb.append("</span\">");
      }
View Full Code Here

    List<String> allBundles = new ArrayList<String>(I18nModule.getBundleNamesContainingI18nFiles());
    for (String bundleName : allBundles) {
      for (String refLangKey : referenceLanguages) {
        Properties properties = i18nMgr.getPropertiesWithoutResolvingRecursively(i18nMgr.getLocaleOrNull(refLangKey), bundleName);
        if (properties == null) {
          throw new OLATRuntimeException("Invalid reference language::" + refLangKey, null);
        } else {
          for (Object keyObj : properties.keySet()) {
            String key = (String) keyObj;
            String combinedKey = bundleName + ":" + key;
            validCombinedKeys.add(combinedKey);
View Full Code Here

        //get valid keys from ref langs and this bundle
        Set<String> allValidKeys = new HashSet<String>();
        for (String refLangKey : referenceLanguages) {
          Properties properties = i18nMgr.getPropertiesWithoutResolvingRecursively(i18nMgr.getLocaleOrNull(refLangKey), bundleName);
          if (properties == null) {
            throw new OLATRuntimeException("Invalid reference language::" + refLangKey, null);
          } else {
            for (Object keyObj : properties.keySet()) {
              String key = (String) keyObj;
              allValidKeys.add(key);
            }           
View Full Code Here

    msg.setDomReplaceable(false);
   
    Version v = (Version) CoreSpringFactory.getBean("org.olat.core.Version");
    msg.contextPut("buildversion", v.getVersion());

    OLATRuntimeException o3e;
   
    if (th == null){
      o3e = new OLATRuntimeException("Error Screen with a Throwable == null", null);
    } else if (!(th instanceof OLATRuntimeException)) {
      o3e = new OLATRuntimeException(th.getMessage(), th);
    } else {
      o3e = (OLATRuntimeException) th;
    }

    String detailedmessage = null;
    // translate user message if available
    if (o3e.getUsrMsgKey() != null && o3e.getUsrMsgPackage() != null) {
      PackageTranslator usrMsgTrans = new PackageTranslator(o3e.getUsrMsgPackage(), ureq.getLocale());
      if (o3e.getUsrMsgArgs() == null) {
        detailedmessage = usrMsgTrans.translate(o3e.getUsrMsgKey());
      } else {
        detailedmessage = usrMsgTrans.translate(o3e.getUsrMsgKey(), o3e.getUsrMsgArgs());
      }
    }
    // fix detailed message
    if (detailedmessage == null) {
      if (o3e instanceof StaleObjectRuntimeException) {
        StaleObjectRuntimeException soe = (StaleObjectRuntimeException) o3e;
        detailedmessage = trans.translate("error.staleobjectexception") + "<br />(" + soe.getKey() + " : " + soe.getPersClassName() + ")";
      }
      else detailedmessage = "-";
    }

    // fetch more info
    // get the latest window which caused this exception
    String componentListenerInfo = "";
    Windows ws = Windows.getWindows(ureq);
   
    Window window = ws.getWindow(ureq);
    if (window != null) {
      Component target = window.getAndClearLatestDispatchedComponent();
      if (target != null) {
        // there was a component id given, and a matching target could be found
        componentListenerInfo = "<dispatchinfo>\n\t<componentinfo>\n\t\t<compname>" + target.getComponentName() + "</compname>\n\t\t<compclass>"
            + target.getClass().getName() + "</compclass>\n\t\t<extendedinfo>" + target.getExtendedDebugInfo()
            + "</extendedinfo>\n\t\t<event>";
        Event latestEv = target.getAndClearLatestFiredEvent();
        if (latestEv != null) {
          componentListenerInfo += "\n\t\t\t<class>"+latestEv.getClass().getName()+"</class>\n\t\t\t<command>"+latestEv.getCommand()+"</command>\n\t\t\t<tostring>"+latestEv+"</tostring>";
        }
        componentListenerInfo += "\n\t\t</event>\n\t</componentinfo>\n\t<controllerinfo>";
        Controller c = target.getLatestDispatchedController();
        if (c != null) {
          // can be null if the error occured in the component itself
          // componentListenerInfo += c.toString();
          //WindowControl control = c.getWindowControl();
          // sorry, getting windowcontrol on a controller which does not have one (all should have one, legacy) throws an exception
          try {
           
            WindowControlInfo wci = c.getWindowControlForDebug().getWindowControlInfo();
            while (wci != null) {
              String cName = wci.getControllerClassName();
              componentListenerInfo += "\n\t\t<controllername>" + cName + "</controllername>";
              wci = wci.getParentWindowControlInfo();
            }
          } catch (Exception e) {
            componentListenerInfo += "no info, probably no windowcontrol set: "+e.getClass().getName()+", "+e.getMessage();
          }
        }
        componentListenerInfo += "\n\t</controllerinfo>\n</dispatchinfo>";
      }
    }

    if(o3e instanceof KnownIssueException){
      KnownIssueException kie = (KnownIssueException)o3e;
      msg.contextPut("knownissuelink", kie.getJiraLink());
    }
   
    // TODO: DB.getInstance().hasTransaction() TODO: log db transaction id if in
    // transaction
    long refNum = Tracing.logError("**RedScreen** "+o3e.getLogMsg() + " ::_::" + componentListenerInfo + " ::_::", o3e, o3e.getThrowingClazz());
    // only if debug
    if (Settings.isDebuging()) {
      msg.contextPut("debug", Boolean.TRUE);
    } else {
      msg.contextPut("debug", Boolean.FALSE);     
View Full Code Here

        // write to file file now
        fileStream = new FileOutputStream(propertiesFile);
        properties.store(fileStream, null);
        fileStream.flush();
      } catch (FileNotFoundException e) {
        throw new OLATRuntimeException("Could not save or update to file::" + propertiesFile.getAbsolutePath(), e);
      } catch (IOException e) {
        throw new OLATRuntimeException("Could not save or update to file::" + propertiesFile.getAbsolutePath()
            + ", maybe permission denied? Check your directory permissions", e);
      } finally {
        try {
          if (fileStream != null) fileStream.close();
        } catch (IOException e) {
View Full Code Here

                  foundBundles.add(libBundleName);
                }
              }
            }
          } catch (IOException e) {
            throw new OLATRuntimeException("Error when looking up i18n files in jar::" + jarFile.getAbsolutePath(), e);
          }
        }
      }
    }
    // 4) For jUnit tests, add also the I18n test dir
View Full Code Here

                null);
          }
        }
      }
    } catch (IOException e) {
      throw new OLATRuntimeException("Error when looking up i18n files in jar::" + jarFile.getAbsolutePath(), e);
    }
    return foundLanguages;
  }
View Full Code Here

            break;
          }
        }
      }
    } catch (IOException e) {
      throw new OLATRuntimeException("Error when copying up i18n files from a jar::" + jarFile.getAbsolutePath(), e);
    }   
  }
View Full Code Here

      // write to file file now
      fileStream = new FileOutputStream(newPropertiesFile);
      newProperties.store(fileStream, null);
      fileStream.flush();
    } catch (FileNotFoundException e) {
      throw new OLATRuntimeException("Could not create new language file::" + newPropertiesFile.getAbsolutePath(), e);
    } catch (IOException e) {
      throw new OLATRuntimeException("Could not create new language file::" + newPropertiesFile.getAbsolutePath()
          + ", maybe permission denied? Check your directory permissions", e);
    } finally {
      try {
        if (fileStream != null) fileStream.close();
      } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.olat.core.logging.OLATRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.