- Common ways to obtain UsageException
private void myMethod () {}
public void setType(TYPE_NODE type) { if (type == TYPE_NODE.RUNTIME) throw new UsageException("can't set type to RUNTIME"); this.type = type; }
public static Artifact toArtifact(String def) { if (def == null) return null; if (def.startsWith("mvn:")) { String[] parts = def.substring(4).split("/"); return new Artifact(parts[0], parts[1], parts[2], parts.length > 3 ? parts[3] : null); } if (def.startsWith("wrap:")) { int p = def.indexOf('$'); if (p > 0) def = def.substring(0, p); String[] parts = def.substring(5).split("/"); return new Artifact(parts[0], parts[1], parts[2], parts.length > 3 ? parts[3] : null); } if (def.indexOf('/') > -1) { String[] parts = def.split("/"); return new Artifact(parts[0], parts[1], parts[2], parts.length > 3 ? parts[3] : null); } if (def.indexOf(':') > -1) { String[] parts = def.split(":"); return new Artifact(parts[0], parts[1], parts[3], parts[2]); } throw new UsageException("Unknown format"); }
public void createXml(Element xml) { if (!xml.getNodeName().equals("bpmn2:process")) throw new UsageException("not a bpmn2:process node");
in = in.substring(3); int p = in.indexOf(':'); if (p < 0) throw new UsageException("key id not found"); String keyId = in.substring(0, p); in = in.substring(p+1);
public void load(Element xml) { if (!xml.getNodeName().equals("bpmn2:process")) throw new UsageException("not a bpmn2:process node");