Examples of InvalidConfigurationFileException


Examples of it.unina.seclab.jafimon.exceptions.InvalidConfigurationFileException

     
      // Controllo che sia giusto
      if (! root.getTagName().equalsIgnoreCase(XML_ROOT_ELEMENT_NAME)) {
        logger.error("Root element is \"" + root.getTagName() + "\" should be \"" + XML_ROOT_ELEMENT_NAME + "\"");
        res = null;
        throw new InvalidConfigurationFileException("Root element is \"" + root.getTagName() + "\" should be \"" + XML_ROOT_ELEMENT_NAME + "\"");
      }
     
      // Controllo la versione
      try {
        cfgVer = Double.parseDouble(root.getAttribute(XML_ROOT_ATTRIBUTE_VERSION_NAME));
        if (cfgVer > MAX_SUPPORTED_VERSION) {
          res = null;
          logger.error("Configuration version is not supported. Max supported version is " + MAX_SUPPORTED_VERSION + ". Found " + cfgVer);
          throw new InvalidConfigurationFileException("Configuration version is not supported. Max supported version is " + MAX_SUPPORTED_VERSION + ". Found " + cfgVer);
        }
      } catch (NumberFormatException nfe) {
        logger.error("Attribute \"" + XML_ROOT_ATTRIBUTE_VERSION_NAME + "\" for root element has invalid value. Max supported version is " + MAX_SUPPORTED_VERSION);
        res = null;
        throw new InvalidConfigurationFileException("Attribute \"" + XML_ROOT_ATTRIBUTE_VERSION_NAME + "\" for root element has invalid value. Max supported version is " + MAX_SUPPORTED_VERSION);
      }
     
      // Verifico i nodi
      if (root.getElementsByTagName(MONITOR_ELEMENT_NAME).getLength() <= 0) {
        res = null;
        logger.error("Configuration file is invalid. \"" + MONITOR_ELEMENT_NAME + "\" element not found");
        throw new InvalidConfigurationFileException("Configuration file is invalid. \"" + MONITOR_ELEMENT_NAME + "\" element not found");
      } else
        logger.debug("Found \"" + MONITOR_ELEMENT_NAME + "\" element");
     
      if (root.getElementsByTagName(INJECTOR_ELEMENT_NAME).getLength() <= 0) {
        res = null;
        logger.error("Configuration file is invalid. \"" + INJECTOR_ELEMENT_NAME + "\" element not found");
        throw new InvalidConfigurationFileException("Configuration file is invalid. \"" + INJECTOR_ELEMENT_NAME + "\" element not found");
      } else
        logger.debug("Found \"" + INJECTOR_ELEMENT_NAME + "\" element");
     
    } catch (ParserConfigurationException pce) {
      logger.error("Could not locate a JAXP parser");
          throw new GenericConfigurationParsingException("Could not locate a JAXP parser");

    } catch (IOException e) {
      logger.error("IOException occourred during parsing for \"" + is.toString() + "\" file. Message is: \"" + e.getLocalizedMessage() + "\"");
          throw new GenericConfigurationParsingException("IOException occourred during parsing for \"" + is.toString() + "\" file. Message is: \"" + e.getLocalizedMessage() + "\"");
   
    } catch (SAXException e) {
      logger.error("XML document \"" + is.toString() + "\" is not well-formed");
      throw new InvalidConfigurationFileException("XML document \"" + is.toString() + "\" is not well-formed");
    }

    return res;
   
  }
View Full Code Here

Examples of kameleon.exception.InvalidConfigurationFileException

  @SuppressWarnings("unchecked")
  public static List<PlugInInfo> readList(String source)
      throws FileReadingException, InvalidConfigurationFileException {
    Object obj = IOObject.readObjectFromFile(source) ;
    if (!(obj instanceof List<?>)) {
      throw new InvalidConfigurationFileException(new File(source)) ;
    }// if
    List<?> readList = (List<?>) obj ;
    if (!readList.isEmpty() && !(readList.get(0) instanceof PlugInInfo)) {
      throw new InvalidConfigurationFileException(new File(source)) ;
    }// if
    return (List<PlugInInfo>) readList ;
  }// readList(String, List<PlugInInfo>)
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

            int counter = 1;
            for (ModelProblem problem : e.getProblems()) {
                sb.append(counter++).append("/ ").append(problem).append("\n");
            }

            throw new InvalidConfigurationFileException(sb.toString());
        }

        // get and update model
        Model model = result.getEffectiveModel();
        this.model = model;
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

            Validate.isReadable(resolvedPath, "Path to the settings.xml ('" + pathToSettingsXmlFile
                    + "') must be defined and accessible");
        }
        // rewrap exception
        catch (IllegalArgumentException e) {
            throw new InvalidConfigurationFileException(e.getMessage());
        }
        this.settingsXmlFile = new File(resolvedPath);
    }
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

            Validate.isReadable(settingsXmlFile, "Path to the settings.xml ('" + settingsXmlFile
                    + "') must be defined and accessible");
        }
        // rewrap exception
        catch (IllegalArgumentException e) {
            throw new InvalidConfigurationFileException(e.getMessage());
        }

        final MavenWorkingSession newSession = session.configureSettingsFromFile(null, settingsXmlFile);
        return newSession.regenerateSession();
    }
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

    }

    private String getMaster() throws SecDispatcherException, InvalidConfigurationFileException {

        if (securitySettings == null) {
            throw new InvalidConfigurationFileException(
                    "Unable to get security configuration from " + securitySettingsPath.getPath()
                            + ". Please define path to the settings-security.xml file via -D" +
                            MavenSettingsBuilder.ALT_SECURITY_SETTINGS_XML_LOCATION
                            + ", or put it the the default location defined by Maven.");
        }
        String master = securitySettings.getMaster();

        if (master == null) {
            throw new InvalidConfigurationFileException("Security configuration from " + securitySettingsPath.getPath()
                    + " does not contain master password");
        }

        try {
            return cipher.decryptDecorated(master, DEFAULT_PASSPHRASE);
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

                        }
                    }
                    final String topLevel = reader.getLocalName();

                    if (!"settings".equals(topLevel)) {
                        throw new InvalidConfigurationFileException("Invalid format settings.xml found: "
                                + userSettingsFile);
                    }
                } catch (final FileNotFoundException e) {
                    // Ignore at this level
                } catch (final XMLStreamException xmlse) {
                    throw new RuntimeException("Could not check file format of specified settings.xml: "
                            + userSettingsFile, xmlse);
                }

            }

            result = builder.build(request);
        }
        // wrap exception message
        catch (SettingsBuildingException e) {
            StringBuilder sb = new StringBuilder("Found ").append(e.getProblems().size())
                    .append(" problems while building settings.xml model from both global Maven configuration file")
                    .append(request.getGlobalSettingsFile()).append(" and/or user configuration file: ")
                    .append(request.getUserSettingsFile()).append("\n");

            int counter = 1;
            for (SettingsProblem problem : e.getProblems()) {
                sb.append(counter++).append("/ ").append(problem).append("\n");
            }

            throw new InvalidConfigurationFileException(sb.toString());
        }

        // get settings object and update it according to property values
        Settings settings = result.getEffectiveSettings();
        settings = enrichWithLocalRepository(settings);
View Full Code Here

Examples of org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

            int counter = 1;
            for (SettingsProblem problem : result.getProblems()) {
                sb.append(counter++).append("/ ").append(problem).append("\n");
            }

            throw new InvalidConfigurationFileException(sb.toString());
        }

        settings.setProxies(result.getProxies());
        settings.setServers(result.getServers());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.