Package com.dotmarketing.exception

Examples of com.dotmarketing.exception.DotRuntimeException


        if(!InodeUtils.isSet(hostId)){
            try {
                hostId = APILocator.getIdentifierAPI().find(this.identifier).getHostId();
            } catch (Exception e) {
                Logger.error(Folder.class, "Unable to get Identifier", e);
                throw new DotRuntimeException(e.getMessage(), e);
            }
        }
        this.hostId = hostId;
    }
View Full Code Here


        try {
            return APILocator.getHostAPI().findParentHost(this, systemUser, false);
        } catch (DotSecurityException e) {
            Logger.error(Folder.class, e.getMessage(), e);
            throw new DotRuntimeException(e.getMessage(), e);
        }
    }
View Full Code Here

    UserProxy up;
    try {
      up = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxyByLongLiveCookie(_dotCMSID,APILocator.getUserAPI().getSystemUser(), false);
    } catch (Exception e) {
      Logger.error(this, e.getMessage(), e);
      throw new DotRuntimeException(e.getMessage(), e);
    }

    if (UtilMethods.isSet(up) &&  UtilMethods.isSet(up.getUserId())) {
      try {
        return APILocator.getUserAPI().loadUserById(up.getUserId(),APILocator.getUserAPI().getSystemUser(),false);
View Full Code Here

    if(instance == null){
      init();
      if(instance == null){
        Logger.fatal(FactoryLocator.class,"CACHE IS NOT INITIALIZED : THIS SHOULD NEVER HAPPEN");
        throw new DotRuntimeException("CACHE IS NOT INITIALIZED : THIS SHOULD NEVER HAPPEN");
      }
    }

    Object serviceRef = instance.getServiceInstance(index);
View Full Code Here

      if (structure != null && UtilMethods.isSet(structure.getDetailPage())) {
        Identifier ident;
        try {
          ident = APILocator.getIdentifierAPI().find(structure.getDetailPage());
          if(ident ==null || ! UtilMethods.isSet(ident.getInode())){
            throw new DotRuntimeException("No valid detail page for structure '" + structure.getName() + "'. Looking for detail page id=" + structure.getDetailPage());
          }

         
          if((cons != null && cons.size() > 0) || !urlFallthrough){
           
View Full Code Here

    };
    try {
      runOnce = TaskLocatorUtil.getStartupRunOnceTaskClasses();
      runAlways = TaskLocatorUtil.getStartupRunAlwaysTaskClasses();
    } catch (Exception e) {
      throw new DotRuntimeException(e.getMessage(), e);
    }
    Collections.sort(runOnce, comparator);
    Collections.sort(runAlways, comparator);
    Logger.debug(this.getClass(), "Locking db_version table");
    setupSQL();
    //Integer currentVersion = null;
    PreparedStatement update = null;
    Statement s = null;
    ResultSet rs = null;
    Connection conn = null;
    try {
      conn = DbConnectionFactory.getDataSource().getConnection();

      conn.setAutoCommit(false);
      s = conn.createStatement();
      update = conn
          .prepareStatement("INSERT INTO db_version (db_version,date_update) VALUES (?,?)");
      s.execute(lock);
      rs = s
          .executeQuery(select);
      rs.next();
      Config.DB_VERSION = rs.getInt("db_version");
    } catch (SQLException e) {
      // Maybe the table doesn't exist?
      Logger.debug(this.getClass(), "Trying to create db_version table");
      try {
        conn.rollback();
        if(DbConnectionFactory.isMySql()){
          s.execute("SET storage_engine=INNODB");
        }
        s.execute(create);
        if(update==null) {
            // looks like H2 do an early table name check
            update = conn.prepareStatement("INSERT INTO db_version (db_version,date_update) VALUES (?,?)");
        }
        update.setInt(1, 0);
        Date date = new Date(Calendar.getInstance().getTimeInMillis());
        update.setDate(2, date);
        update.execute();
        conn.commit();

        Logger
            .debug(this.getClass(),
                "Table db_version created.  Trying to lock db_table again.");
        s.execute(lock);
        rs = s
            .executeQuery(select);

        rs.next();
        Config.DB_VERSION = rs.getInt("db_version");

      } catch (SQLException e2) {
        Logger.fatal(this.getClass(),
            "Locking of db_version table failed: "
                + e2.getMessage());
        throw new DotRuntimeException(
            "Locking of db_version table failed: "
                + e2.getMessage(), e2);
      }

    }
    Logger.debug(this.getClass(), "Locking db_version succeeded");

    boolean firstTimeStart = false;
    String name = null;
    try {
      Logger.info(this, "Starting startup tasks.");
      HibernateUtil.startTransaction();

      for (Class<?> c : runAlways) {
        name = c.getCanonicalName();
        name = name.substring(name.lastIndexOf(".") + 1);
        if (StartupTask.class.isAssignableFrom(c)) {
          StartupTask task;
          try {
            task = (StartupTask) c.newInstance();
          } catch (Exception e) {
            throw new DotRuntimeException(e.getMessage(), e);
          }
          HibernateUtil.startTransaction();
          if (task.forceRun()) {
            HibernateUtil.commitTransaction();
            HibernateUtil.startTransaction();
            Logger.info(this, "Running: " + name);
            task.executeUpgrade();
            if(name.equals("Task00001LoadSchema")){
              firstTimeStart = true;
            }
          } else {
            Logger.info(this, "Not running: " + name);
          }
          HibernateUtil.commitTransaction();
        }
      }
      Logger.info(this, "Finishing startup tasks.");
    } catch (Exception e) {
      HibernateUtil.rollbackTransaction();
      Logger.fatal(this, "Unable to execute the upgrade task : " + name, e);
    } finally {
      // This will commit the changes and close the connection
      HibernateUtil.closeSession();
      try {
          update.close();
//          conn.close();
      } catch(Exception exx) { /* Ignore this */ }
    }

    Logger.info(this, "Starting upgrade tasks.");

    Logger.info(this, "Database version: " + Config.DB_VERSION);

    name = null;
    //HibernateUtil.startTransaction();
    try {
      if(runOnce.size() > 0)
        ReindexThread.stopThread();
      for (Class<?> c : runOnce) {
        name = c.getCanonicalName();
        name = name.substring(name.lastIndexOf(".") + 1);
        String id = name.substring(4, 9);
        try {
          int taskId = Integer.parseInt(id);
          if (StartupTask.class.isAssignableFrom(c)
              && taskId > Config.DB_VERSION) {
            StartupTask task;
            try {
              task = (StartupTask) c.newInstance();
            } catch (Exception e) {
              throw new DotRuntimeException(e.getMessage(), e);
            }
            //HibernateUtil.startTransaction();

            if (!firstTimeStart && task.forceRun()) {
              HibernateUtil.commitTransaction();
View Full Code Here

      }
      mu = userAPI.loadUserById(file.getModUser(), userAPI.getSystemUser(), true);
    }catch (Exception e) {
      Logger.error(this, e.getMessage(), e);
      Logger.error(this, "User doesn't have permissions to get PHP filesystem.");
      throw new DotRuntimeException(e.getMessage(),e);
    }
    try {
      if(!Config.getBooleanProperty("ENABLE_SCRIPTING", false)){
        Logger.error(this, "User doesn't have permissions to get PHP filesystem.");
        throw new DotRuntimeException("Last Mod User does not have Scripting Developer role");
      }
      if(!APILocator.getRoleAPI().doesUserHaveRole(mu, APILocator.getRoleAPI().loadRoleByKey("Scripting Developer"))){
        Logger.error(this, "User doesn't have permissions to get PHP filesystem.");
        throw new DotRuntimeException("Last Mod User does not have Scripting Developer role");
      }
    } catch (DotDataException e) {
      Logger.error(this, "User doesn't have permissions to get PHP filesystem.");
      throw new DotRuntimeException("Last Mod User does not have Scripting Developer role");
    }

    if(!UtilMethods.isSet(realPath)){
      _file = new File(FileUtil.getRealPath(assetPath + uri));
    }else{
View Full Code Here



    }
    catch(Exception e){
      throw new DotRuntimeException("Cannot find the inode of the file : " + e.getMessage());
    }
  }
View Full Code Here

          try {
            HibernateUtil.delete(formBean);
          } catch (DotHibernateException e1) {
            Logger.error(EmailFactory.class, e1.getMessage(), e1);           
          }
          throw new DotRuntimeException("sendForm: couldn't saved the submitted file into the cms = " + fileName, e);
        }

      } else if (paramValue instanceof String)
        value = (String)paramValue;

      List<String> cFields = new ArrayList<String>();
      if (predefinedFields.indexOf(":" + key + ":") < 0
          && ignoreString.indexOf(":" + key + ":") < 0
          && UtilMethods.isSet(value)) {
        value = value.replaceAll("\\|", " ").replaceAll("=", " ");
        if(key.equals("ccNumber"))
          value = UtilMethods.obfuscateCreditCard(value);

        String capKey = UtilMethods.capitalize(key);
        int aux = 2;
        String capKeyAux = capKey;
        while (cFields.contains(capKeyAux)) {
          capKeyAux = capKey + aux;
          ++aux;
        }
        cFields.add(capKeyAux);
        String cField = capKeyAux + "=" + value;
        customFields.append(cField + "|");
      }
    }

    customFields.append("Files=" + filesLinks);

    //Setting the custom fields and saving them
    formBean.setCustomFields(customFields.toString());
    formBean.setSubmitDate(new Date());

    if(UtilMethods.isSet(formType)){
      try {
        HibernateUtil.saveOrUpdate(formBean);
      } catch (DotHibernateException e) {
        throw new DotRuntimeException("Webform Save Failed");
      }
    }
    else{
      Logger.debug(EmailFactory.class, "The web form doesn't have the required formType field, the form data will not be saved in the database.");
    }
View Full Code Here

      UserProxy userproxy;
      try {
        userproxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);
      } catch (Exception e) {
        Logger.error(EmailFactory.class, e.getMessage(), e);
        throw new DotRuntimeException(e.getMessage(), e);
     
      finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(&lt;))/varLastMessage(>|(&gt;))", "");
      finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(&lt;))varLastMessage(\")?( )*/*( )*(>|(&gt;))", (userproxy.getLastMessage()!=null) ? userproxy.getLastMessage() : "");

      finalMessageStr = finalMessageStr.replaceAll("(?i)(<|(&lt;))/varAddress1(>|(&gt;))", "");
View Full Code Here

TOP

Related Classes of com.dotmarketing.exception.DotRuntimeException

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.