Examples of Violation


Examples of com.hp.hpl.jena.iri.Violation

        {
            String msg = "unknown violation from IRI library" ;
            Iterator<Violation> iter = iri.violations(false) ;
            if ( iter.hasNext() )
            {
                Violation viol = iter.next() ;
                msg = viol.getShortMessage() ;
            }
            Log.warn(NodeFunctions.class, "Bad IRI: "+msg+": "+iri) ;
        }
        return Node.createURI(iri.toString()) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.iri.Violation

        IRI iri = factory.create(string);
        if (iri.hasViolation(true)) {
            System.out.println("n: " + string);
            Iterator<Violation> it = iri.violations(true);
            while (it.hasNext()) {
                Violation v = it.next();
                System.out.println(v.getLongMessage());
            }
        } else {
            System.out.println("y: " + string);
        }
    }
View Full Code Here

Examples of com.hp.hpl.jena.iri.Violation

    protected static void checkURI(XMLHandler forErrors, Taint taintMe, IRI rslt)
            throws SAXParseException {
        if (rslt.hasViolation(false)) {
            Iterator<Violation> it = rslt.violations(false);
            while (it.hasNext()) {
                Violation irie = it.next();
                // if (irie.getViolationCode() ==
                // ViolationCodes.REQUIRED_COMPONENT_MISSING)
                String msg = irie.getShortMessage();
                String uri = rslt.toString();
//                if (msg.endsWith(uri)) {
//                    msg = msg.substring(0, msg.length() - uri.length()) + "<"
//                            + uri + ">";
//                } else {
//                    msg = "<" + uri + "> " + msg;
//                }
                if (irie.getViolationCode() == ViolationCodes.REQUIRED_COMPONENT_MISSING
                        && irie.getComponent() == IRIComponents.SCHEME) {
                    if (!forErrors.allowRelativeURIs())
                        forErrors.warning(taintMe, WARN_RELATIVE_URI,
                                "Relative URIs are not permitted in RDF: specifically <"
                                        + rslt.toString() + ">");
View Full Code Here

Examples of com.hp.hpl.jena.iri.Violation

                    sb.append("x-").append(literal);
                    iri = fac.construct(trimHtmlTrailingSpaces(sb.toString()));
                }
            }
        } catch (IRIException e) {
            Violation v = e.getViolation();
            /*
             * Violation codes that are not "known" codes get assigned the
             * dummy value so that handling of them will fall through to
             * the default case.
             */
            KnownViolationCode vc = KnownViolationCode.valueOf("ZZZ_DUMMY_DEFAULT");
            try {
                /*
                 * If this violation code is one of the "known" Jena IRI
                 * violation codes we want to handle specifically, then use it
                 * as-is.
                 */
                vc = KnownViolationCode.valueOf(v.codeName());
            } catch (Exception ex) { }
            switch (vc) {
                case HAS_PASSWORD:
                    if (WARN) {
                        throw newDatatypeException(
                                underbarStringToSentence(v.component())
                                        + " component contains a password.",
                                WARN);
                    } else {
                        return;
                    }
                case NON_INITIAL_DOT_SEGMENT:
                    if (WARN) {
                        throw newDatatypeException(
                                "Path component contains a segment \u201C/../\u201D not at the beginning of a relative reference, or it contains a \u201C/./\u201D. These should be removed.",
                                WARN);
                    } else {
                        return;
                    }
                case PORT_SHOULD_NOT_BE_WELL_KNOWN:
                    if (WARN) {
                        throw newDatatypeException(
                                "Ports under 1024 should be accessed using the appropriate scheme name.",
                                WARN);
                    } else {
                        return;
                    }
                case COMPATIBILITY_CHARACTER:
                    if (WARN) {
                        throw newDatatypeException(
                                underbarStringToSentence(v.codeName()) + " in "
                                        + toAsciiLowerCase(v.component())
                                        + " component.", WARN);
                    } else {
                        return;
                    }
                case DNS_LABEL_DASH_START_OR_END:
                    throw newDatatypeException("Host component contains a DNS name with a \u201C-\u201D (dash) character at the beginning or end.");
                case DOUBLE_WHITESPACE:
                case WHITESPACE:
                    throw newDatatypeException("Whitespace in "
                            + toAsciiLowerCase(v.component()) + " component. "
                            + "Use \u201C%20\u201D in place of spaces.");
                case EMPTY_SCHEME:
                    throw newDatatypeException("Scheme component is empty.");
                case ILLEGAL_PERCENT_ENCODING:
                    throw newDatatypeException(underbarStringToSentence(v.component())
                            + " component contains a percent sign that is not followed by two hexadecimal digits.");
                case IP_V4_HAS_FOUR_COMPONENTS:
                    throw newDatatypeException("Host component is entirely numeric but does not have four components like an IPv4 address.");
                case IP_V4_OCTET_RANGE:
                    throw newDatatypeException("Host component contains a number not in the range 0-255, or a number with a leading zero.");
                case IP_V6_OR_FUTURE_ADDRESS_SYNTAX:
                    throw newDatatypeException("Host component contains an IPv6 (or IPvFuture) syntax violation.");
                case NOT_DNS_NAME:
                    throw newDatatypeException("Host component did not meet the restrictions on DNS names.");
                case REQUIRED_COMPONENT_MISSING:
                    throw newDatatypeException("A component that is required by the scheme is missing.");
                case SCHEME_MUST_START_WITH_LETTER:
                    throw newDatatypeException("Scheme component must start with a letter.");
                case UNREGISTERED_NONIETF_SCHEME_TREE:
                    throw newDatatypeException("Scheme component has a \u201C-\u201D (dash) character, but does not start with \u201Cx-\u201D, and the prefix is not known as the prefix of an alternative tree for URI schemes.");
                case CONTROL_CHARACTER:
                case ILLEGAL_CHARACTER:
                case UNDEFINED_UNICODE_CHARACTER:
                case UNICODE_WHITESPACE:
                    throw newDatatypeException(underbarStringToSentence(v.codeName())
                            + " in "
                            + toAsciiLowerCase(v.component())
                            + " component.");
                default:
                    throw newDatatypeException(v.codeName() + " in "
                            + toAsciiLowerCase(v.component()) + " component.");
            }
        } catch (IOException e) {
            throw newDatatypeException(e.getMessage());
        } catch (RhinoException e) {
            throw newDatatypeException(e.getMessage());
View Full Code Here

Examples of com.lewisd.maven.lint.Violation

  }

  @Override
  public void marshal(Object source, HierarchicalStreamWriter writer,
      MarshallingContext context) {
    Violation violation = (Violation) source;
   
    writer.startNode("violation");
   
    writer.addAttribute("rule", violation.getRule().getIdentifier());
   
    writer.startNode("message");
    writer.setValue(violation.getMessage());
    writer.endNode();
   
    writer.startNode("description");
    writer.setValue(violation.getRule().getDescription());
    writer.endNode();
   
    final InputLocation location = violation.getInputLocation();
   
    writer.startNode("location");
    writer.addAttribute("file", location.getSource().getLocation());
    writer.addAttribute("line", Integer.toString(location.getLineNumber()));
    writer.addAttribute("column", Integer.toString(location.getColumnNumber()));
View Full Code Here

Examples of jodd.vtor.Violation

  /**
   * Adds action violation.
   */
  protected void addViolation(String name, Object invalidValue) {
    prepareValidator();
    vtor.addViolation(new Violation(name, this, invalidValue));
  }
View Full Code Here

Examples of jodd.vtor.Violation

    if (violations == null) {
      return StringPool.EMPTY;
    }
    StringBuilder sb = new StringBuilder().append('[');
    for (int i = 0, violationsSize = violations.size(); i < violationsSize; i++) {
      Violation violation = violations.get(i);
      if (i != 0) {
        sb.append(',');
      }
      sb.append('{');
      sb.append("\"name\":\"").append(violation.getName()).append('"').append(',');
      sb.append("\"msg\":\"").append(resolveValidationMessage(request, violation)).append('"');
      sb.append('}');
    }
    sb.append(']');
    return sb.toString();
View Full Code Here

Examples of org.apache.cocoon.components.jxforms.validation.Violation

            Object[] values = (Object[]) entry.getValue();

            try {
                setValue(path, values);
            } catch (JXPathException ex) {
                Violation v = new Violation();

                v.setPath(path);
                v.setMessage(ex.getMessage());
                pviolations.add(v);
            }
        } // while

        // validate form model
View Full Code Here

Examples of org.apache.cocoon.components.jxforms.validation.Violation

                while (assertIter.hasNext()) {
                    Assert assertion = (Assert) assertIter.next();

                    // add the next assert to the violations set
                    Violation v = new Violation();

                    v.setPath(rule.getContext());
                    v.setMessage(assertion.getMessage());
                    violations.add(v);
                    // System.out.println("        Assert test: " + assertion.getTest() + ", message: " + assertion.getMessage() );
                }

                Iterator reportIter = rule.getReport().iterator();

                while (reportIter.hasNext()) {
                    Report report = (Report) reportIter.next();

                    // add the next report to the violations set
                    Violation v = new Violation();

                    v.setPath(rule.getContext());
                    v.setMessage(report.getMessage());
                    violations.add(v);
                    // System.out.println("        Report test: " + report.getTest() + ", message: " + report.getMessage() );
                }
            }
        }
View Full Code Here

Examples of org.apache.cocoon.components.jxforms.validation.Violation

                        }
                    }
                }
                if (violations != null) {
                    for (Iterator iter = violations.iterator(); iter.hasNext();) {
                        Violation violation = (Violation)iter.next();
                        String path = violation.getPath();
                        if (mypath == null || path.equals(mypath)) {
                            String message = violation.getMessage();
                            AttributesImpl newAttrs =
                                new AttributesImpl(startElement.attributes);
                            newAttrs.addAttribute(null, REF, REF, "CDATA",
                                                  path);
                            consumer.startElement(NS, VIOLATION,
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.