Changeset 304


Ignore:
Timestamp:
May 11, 2007, 10:42:04 PM (16 years ago)
Author:
Peter Johansson
Message:

added some check if config file is valid fixes #181

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/svndigest.cc

    r303 r304  
    7171      exit(-1);
    7272    }
    73     config.load(is);
     73    try {
     74      config.load(is);
     75    }
     76    catch (std::runtime_error e) {
     77      std::cerr << e.what() << std::endl;
     78      exit(-1);
     79    }
    7480    is.close();
    7581  }
  • trunk/lib/Configuration.cc

    r303 r304  
    8484          std::stringstream mess;
    8585          mess << "svndigest: invalid config file: "
    86                << "in copright-alias section" << key + "defined twice.";
     86               << "in copright-alias section " << key + " defined twice.";
    8787          throw std::runtime_error(mess.str());
    8888        }
     
    9696        getline(ss, tmp);
    9797        std::string value = trim(tmp);
    98         if (key=="trac-ticket"){
    99           std::cerr << "svndigest: warning: config variable trac-ticket "
    100                     << "is deprecated. Use trac-root instead.\n";
    101           trac_root_ = value.substr(0,value.size()-7);
    102         }
    103         if (key=="trac-revision"){
    104           std::cerr << "svndigest: warning: config variable trac-revision "
    105                     << "is deprecated. Use trac-root instead.\n";
    106           trac_root_ = value.substr(0,value.size()-10);
    107         }
    10898        if (key=="trac-root")
    10999          trac_root_=value;
     100        else {
     101          std::stringstream mess;
     102          mess << "svndigest: invalid config file: "
     103               << "in trac section" << key + " is invalid option.";
     104          throw std::runtime_error(mess.str());
     105        }
    110106      }
    111107    }
  • trunk/lib/Configuration.h

    r303 r304  
    5050
    5151    ///
     52    /// throw if stream is not a valid config
     53    ///
    5254    /// @brief load configuration from stream
    5355    ///
Note: See TracChangeset for help on using the changeset viewer.