Examples of ManifestException


Examples of org.apache.tools.ant.taskdefs.ManifestException

          // Some jars contain badly formatted manifests.
          System.out.println("Bad manifest");
          continue;
        }
        if (!sectionName.getName().equalsIgnoreCase(ATTRIBUTE_NAME)) {
          throw new ManifestException("Manifest sections should "
              + "start with a \"" + ATTRIBUTE_NAME
              + "\" attribute and not \"" + sectionName.getName()
              + "\"");
        }
        nextSectionName = sectionName.getValue();
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.ManifestException

   *                if the secti0on is not valid.
   */
  public void addConfiguredSection(Section section) throws ManifestException {
    String sectionName = section.getName();
    if (sectionName == null) {
      throw new ManifestException("Sections must have a name");
    }
    sections.put(sectionName, section);
    if (!sectionIndex.contains(sectionName)) {
      sectionIndex.add(sectionName);
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.ManifestException

   *                if the attribute is not valid.
   */
  public void addConfiguredAttribute(Attribute attribute)
      throws ManifestException {
    if (attribute.getKey() == null || attribute.getValue() == null) {
      throw new ManifestException("Attributes must have name and value");
    }
    if (attribute.getKey().equalsIgnoreCase(ATTRIBUTE_MANIFEST_VERSION)) {
      manifestVersion = attribute.getValue();
    } else {
      mainSection.addConfiguredAttribute(attribute);
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.ManifestException

     *             and value
     */
    public void parse(String line) throws ManifestException {
      int index = line.indexOf(": ");
      if (index == -1) {
        throw new ManifestException("Manifest line \"" + line
            + "\" is not valid as it does not "
            + "contain a name and a value separated by ': ' ");
      }
      name = line.substring(0, index);
      setValue(line.substring(index + 2));
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.ManifestException

              // a continuation on the first line is a
              // continuation of the name - concatenate this
              // line and the name
              name += line.substring(1);
            } else {
              throw new ManifestException("Can't start an "
                  + "attribute with a continuation line "
                  + line);
            }
          } else {
            attribute.addContinuation(line);
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.ManifestException

     *             if the sections cannot be merged.
     */
    public void merge(Section section) throws ManifestException {
      if (name == null && section.getName() != null || name != null
          && !(name.equalsIgnoreCase(section.getName()))) {
        throw new ManifestException("Unable to merge sections "
            + "with different names");
      }

      Iterator<String> e = section.getAttributeKeys();
      Attribute classpathAttribute = null;
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.ManifestException

     */
    public void addConfiguredAttribute(Attribute attribute)
        throws ManifestException {
      String check = addAttributeAndCheck(attribute);
      if (check != null) {
        throw new ManifestException(
            "Specify the section name using "
                + "the \"name\" attribute of the <section> element rather "
                + "than using a \"Name\" manifest attribute");
      }
    }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.ManifestException

     *                if the attribute already exists in this section.
     */
    public String addAttributeAndCheck(Attribute attribute)
        throws ManifestException {
      if (attribute.getName() == null || attribute.getValue() == null) {
        throw new ManifestException(
            "Attributes must have name and value");
      }
      if (attribute.getKey().equalsIgnoreCase(ATTRIBUTE_NAME)) {
        warnings
            .add("\""
                + ATTRIBUTE_NAME
                + "\" attributes "
                + "should not occur in the main section and must be the "
                + "first element in all other sections: \""
                + attribute.getName() + ": "
                + attribute.getValue() + "\"");
        return attribute.getValue();
      }

      if (attribute.getKey().startsWith(ATTRIBUTE_FROM.toLowerCase())) {
        warnings.add("Manifest attributes should not start "
            + "with \"" + ATTRIBUTE_FROM + "\" in \""
            + attribute.getName() + ": " + attribute.getValue()
            + "\"");
      } else {
        // classpath attributes go into a vector
        String attributeKey = attribute.getKey();
        if (attributeKey.equalsIgnoreCase(ATTRIBUTE_CLASSPATH)) {
          Attribute classpathAttribute = (Attribute) attributes
              .get(attributeKey);

          if (classpathAttribute == null) {
            storeAttribute(attribute);
          } else {
            warnings.add("Multiple Class-Path attributes "
                + "are supported but violate the Jar "
                + "specification and may not be correctly "
                + "processed in all environments");
            Iterator<String> e = attribute.getValues();
            while (e.hasNext()) {
              String value = e.next();
              classpathAttribute.addValue(value);
            }
          }
        } else if (attributes.containsKey(attributeKey)) {
          throw new ManifestException("The attribute \""
              + attribute.getName() + "\" may not occur more "
              + "than once in the same section");
        } else {
          storeAttribute(attribute);
        }
View Full Code Here

Examples of org.codehaus.plexus.archiver.jar.ManifestException

                            }
                            else if ( ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_CUSTOM.equals( layoutType ) )
                            {
                                if ( layout == null )
                                {
                                    throw new ManifestException( ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_CUSTOM
                                                                     + " layout type was declared, but custom layout expression was not specified. Check your <archive><manifest><customLayout/> element." );
                                }

                                classpath.append( interpolator.interpolate( layout, recursionInterceptor ) );
                            }
                            else
                            {
                                throw new ManifestException( "Unknown classpath layout type: '" + layoutType
                                                                 + "'. Check your <archive><manifest><layoutType/> element." );
                            }
                        }
                        catch ( InterpolationException e )
                        {
                            ManifestException error = new ManifestException(
                                "Error interpolating artifact path for classpath entry: " + e.getMessage() );

                            error.initCause( e );
                            throw error;
                        }
                        finally
                        {
                            for ( ValueSource vs : valueSources )
View Full Code Here

Examples of org.gradle.api.java.archives.ManifestException

        return attributes.get(key);
    }

    public Object put(String key, Object value) {
        if (key == null) {
            throw new ManifestException("The key of a manifest attribute must not be null.");
        }
        if (value == null) {
            throw new ManifestException(String.format("The value of a manifest attribute must not be null (Key=%s).", key));
        }
        try {
            new java.util.jar.Attributes.Name(key);
        } catch (IllegalArgumentException e) {
            throw new ManifestException(String.format("The Key=%s violates the Manifest spec!", key));
        }
        return attributes.put(key, value);
    }
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.