Exception Fact Sheet for "argouml-app"

The goal of an Exception Fact Sheet is to reveal the design of exception handling in an application.

--Maxence, Martin

For feedback, please contact Martin

Table of contents

Basic Statistics

Number of Classes 1522
Number of Domain Exception Types (Thrown or Caught) 11
Number of Domain Checked Exception Types 11
Number of Domain Runtime Exception Types 0
Number of Domain Unknown Exception Types 0
nTh = Number of Throw 464
nTh = Number of Throw in Catch 124
Number of Catch-Rethrow (may not be correct) 25
nC = Number of Catch 497
nCTh = Number of Catch with Throw 120
Number of Empty Catch (really Empty) 25
Number of Empty Catch (with comments) 21
Number of Empty Catch 46
nM = Number of Methods 8795
nbFunctionWithCatch = Number of Methods with Catch 309 / 8795
nbFunctionWithThrow = Number of Methods with Throw 295 / 8795
nbFunctionWithThrowS = Number of Methods with ThrowS 247 / 8795
nbFunctionTransmitting = Number of Methods with "Throws" but NO catch, NO throw (only transmitting) 143 / 8795
P1 = nCTh / nC 24.1% (0.241)
P2 = nMC / nM 3.5% (0.035)
P3 = nbFunctionWithThrow / nbFunction 3.4% (0.034)
P4 = nbFunctionTransmitting / nbFunction 1.6% (0.016)
P5 = nbThrowInCatch / nbThrow 26.7% (0.267)
R2 = nCatch / nThrow 1.071
A1 = Number of Caught Exception Types From External Libraries 47
A2 = Number of Reused Exception Types From External Libraries (thrown from application code) 20

W1 is a rough estimation of the richness of the exception model. It does not take into account the inheritance relationships between domain exceptions.

Proportion P1 measures the overall exception flow. According to our experience, it varies from 5% to 70%. Early-catch design generally yields a low P1, libraries that must warn clients about errors (e.g. databases) generally have a high P1.

Proportion P2 measures the dispersion of catch blocks in the application. According to our experience, it varies from 2% to 15%. A small P2 indicates a rather centralized management of errors.

R1 shows how many exceptions types from libraries (incl. JDK) are thrown from application code. For instance, IllegalArgumentException comes from the JDK but is used in many applications.

A1 measures the awareness of the application to library exceptions. A high value of A1 means either that the application is polluted with checked exceptions or that it is able to apply specific recovery depending on the library exception.

Exception Hierachy

Exception Map

Each exception that is used at least once in the project is a dot. A orange dot represents a domain exception that is defined in the application. A blue dot exception is defined in the JDK or in a library. The x-axis represents the number of times an exception is caught, the y-axis the number of times an exception is thrown.

Exceptions With State

State means fields. Number of exceptions with state: 1
InterruptedIOException
              package org.argouml.persistence;class InterruptedIOException extends IOException {
    
    private static final long serialVersionUID = 5654808047803205851L;
    
    private InterruptedException cause;
    
    public InterruptedIOException(InterruptedException theCause) {
        cause = theCause;
    }
    
    public InterruptedException getInterruptedException() {
        return cause;
    }
}
            

Thrown Exceptions Summary

A (Domain) exception is defined in the application. A (Lib) exception is defined in the JDK or in a library. An exception can be thrown, thrown from within a catch, or declared in the signature of a method (usually for checked exceptions). Hovering over a number triggers showing code snippets from the application code.

Type Exception Thrown Thrown
from Catch
Declared
- Unknown 30
              
//in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
throw e;

              
//in src/org/argouml/moduleloader/ModuleLoader2.java
throw (ClassNotFoundException) e;

              
//in src/org/argouml/uml/ui/TabConstraints.java
throw pe;

              
//in src/org/argouml/uml/ui/TabConstraints.java
throw pe1;

              
//in src/org/argouml/uml/ui/TabConstraints.java
throw oclExc;

              
//in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
throw e;

              
//in src/org/argouml/profile/internal/ProfileManagerImpl.java
throw e;

              
//in src/org/argouml/application/security/ArgoAwtExceptionHandler.java
throw t;

              
//in src/org/argouml/cognitive/ResolvedCritic.java
throw ure;

              
//in src/org/argouml/cognitive/ResolvedCritic.java
throw (new UnresolvableException("Critic is null"));

              
//in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
throw pre;

              
//in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
throw pre;

              
//in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
throw pex;

              
//in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
throw pre;

              
//in src/org/argouml/notation/providers/uml/OperationNotationUml.java
throw pex;

              
//in src/org/argouml/notation/providers/uml/OperationNotationUml.java
throw pre;

              
//in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
throw pre;

              
//in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
throw pex;

              
//in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
throw pre;

              
//in src/org/argouml/persistence/XmiFilePersister.java
throw exc;

              
//in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
throw (OpenException) e;

              
//in src/org/argouml/persistence/TodoListMemberFilePersister.java
throw (OpenException) e;

              
//in src/org/argouml/persistence/ModelMemberFilePersister.java
throw e;

              
//in src/org/argouml/persistence/ArgoParser.java
throw e;

              
//in src/org/argouml/persistence/ArgoParser.java
throw e;

              
//in src/org/argouml/persistence/UmlFilePersister.java
throw (InterruptedException) e;

              
//in src/org/argouml/persistence/UmlFilePersister.java
throw e;

              
//in src/org/argouml/persistence/UmlFilePersister.java
throw e;

              
//in src/org/argouml/persistence/UmlFilePersister.java
throw e;

              
//in src/org/argouml/persistence/DiagramMemberFilePersister.java
throw (OpenException) e;

            
- -
- Builder 1
              
// in src/org/argouml/cognitive/ResolvedCritic.java
throw (new UnresolvableException("Critic is null"));

            
- -
- Variable 29
              
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
throw e;

              
// in src/org/argouml/moduleloader/ModuleLoader2.java
throw (ClassNotFoundException) e;

              
// in src/org/argouml/uml/ui/TabConstraints.java
throw pe;

              
// in src/org/argouml/uml/ui/TabConstraints.java
throw pe1;

              
// in src/org/argouml/uml/ui/TabConstraints.java
throw oclExc;

              
// in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
throw e;

              
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
throw e;

              
// in src/org/argouml/application/security/ArgoAwtExceptionHandler.java
throw t;

              
// in src/org/argouml/cognitive/ResolvedCritic.java
throw ure;

              
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
throw pre;

              
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
throw pre;

              
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
throw pex;

              
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
throw pre;

              
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
throw pex;

              
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
throw pre;

              
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
throw pre;

              
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
throw pex;

              
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
throw pre;

              
// in src/org/argouml/persistence/XmiFilePersister.java
throw exc;

              
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
throw (OpenException) e;

              
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
throw (OpenException) e;

              
// in src/org/argouml/persistence/ModelMemberFilePersister.java
throw e;

              
// in src/org/argouml/persistence/ArgoParser.java
throw e;

              
// in src/org/argouml/persistence/ArgoParser.java
throw e;

              
// in src/org/argouml/persistence/UmlFilePersister.java
throw (InterruptedException) e;

              
// in src/org/argouml/persistence/UmlFilePersister.java
throw e;

              
// in src/org/argouml/persistence/UmlFilePersister.java
throw e;

              
// in src/org/argouml/persistence/UmlFilePersister.java
throw e;

              
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
throw (OpenException) e;

            
- -
(Lib) IllegalArgumentException 129
              
// in src/org/argouml/ui/CheckboxTableModel.java
public Object getValueAt(int row, int col) { if (row < elements.length && col < 3) { return elements[row][col]; } else { throw new IllegalArgumentException("Index out of bounds"); } }
// in src/org/argouml/ui/StylePanelFig.java
protected Rectangle parseBBox() { Fig target = getPanelTarget(); // Get the text in the field, and don't do anything if the // field is // empty. String bboxStr = bboxField.getText().trim(); if (bboxStr.length() == 0) { return null; } // Parse the string as if // possible Rectangle res = new Rectangle(); java.util.StringTokenizer st = new java.util.StringTokenizer(bboxStr, ", "); try { boolean changed = false; if (!st.hasMoreTokens()) { return target.getBounds(); } res.x = Integer.parseInt(st.nextToken()); if (!st.hasMoreTokens()) { res.y = target.getBounds().y; res.width = target.getBounds().width; res.height = target.getBounds().height; return res; } res.y = Integer.parseInt(st.nextToken()); if (!st.hasMoreTokens()) { res.width = target.getBounds().width; res.height = target.getBounds().height; return res; } res.width = Integer.parseInt(st.nextToken()); // TODO: What does the magic number 6000 represent here? // Put it in an explanatory literal! - tfm - 20071205 if ((res.width + res.x) > 6000) { res.width = 6000 - res.x; changed = true; } if (!st.hasMoreTokens()) { res.width = target.getBounds().width; return res; } res.height = Integer.parseInt(st.nextToken()); // TODO: What does the magic number 6000 represent here? // Put it in an explanatory literal! - tfm - 20071205 if ((res.height + res.y) > 6000) { res.height = 6000 - res.y; changed = true; } if (res.x < 0 || res.y < 0) { // TODO: This exception will be thrown during autoscrolling // when the edge of the canvas is reached causing either // the width or height to be "adjusted" to a negative value LOG.warn("Part of bounding box is off screen " + res); } if (res.width < 0 || res.height < 0) { // TODO: This exception will be thrown during autoscrolling // when the edge of the canvas is reached causing either // the width or height to be "adjusted" to a negative value throw new IllegalArgumentException( "Bounding box has negative size " + res); } if (changed) { StringBuffer sb = new StringBuffer(); sb.append(Integer.toString(res.x)); sb.append(","); sb.append(Integer.toString(res.y)); sb.append(","); sb.append(Integer.toString(res.width)); sb.append(","); sb.append(Integer.toString(res.height)); bboxField.setText(sb.toString()); } } catch (NumberFormatException ex) { bboxField.setBackground(Color.RED); return null; } catch (IllegalArgumentException iae) { bboxField.setBackground(Color.RED); return null; } bboxField.setBackground(null); return res; }
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
private List<Object> reorderChildren(ExplorerTreeNode node) { List<Object> childUserObjects = new ArrayList<Object>(); List<ExplorerTreeNode> reordered = new ArrayList<ExplorerTreeNode>(); // Enumerate the current children of node to find out which now sorts // in different order, since these must be moved Enumeration enChld = node.children(); Object lastObj = null; while (enChld.hasMoreElements()) { Object child = enChld.nextElement(); if (child instanceof ExplorerTreeNode) { Object obj = ((ExplorerTreeNode) child).getUserObject(); if (lastObj != null && order.compare(lastObj, obj) > 0) { /* * If a node to be moved is currently selected, * move its predecessors instead so don't lose selection. * This fixes issue 3249. * NOTE: this does not deal with the case where * multiple nodes are selected and they are out * of order with respect to each other, but I * don't think more than one node is ever reordered * at a time - tfm */ if (!tree.isPathSelected(new TreePath( getPathToRoot((ExplorerTreeNode) child)))) { reordered.add((ExplorerTreeNode) child); } else { ExplorerTreeNode prev = (ExplorerTreeNode) ((ExplorerTreeNode) child) .getPreviousSibling(); while (prev != null && (order.compare(prev.getUserObject(), obj) >= 0)) { reordered.add(prev); childUserObjects.remove(childUserObjects.size() - 1); prev = (ExplorerTreeNode) prev.getPreviousSibling(); } childUserObjects.add(obj); lastObj = obj; } } else { childUserObjects.add(obj); lastObj = obj; } } else { throw new IllegalArgumentException( "Incomprehencible child node " + child.toString()); } } for (ExplorerTreeNode child : reordered) { // Avoid our deinitialization here // The node will be added back to the tree again super.removeNodeFromParent(child); } // For each reordered node, find it's new position among the current // children and move it there for (ExplorerTreeNode child : reordered) { Object obj = child.getUserObject(); int ip = Collections.binarySearch(childUserObjects, obj, order); if (ip < 0) { ip = -(ip + 1); } // Avoid our initialization here super.insertNodeInto(child, node, ip); childUserObjects.add(ip, obj); } return childUserObjects; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
private String getDescriptionInternal(String name) { Map.Entry<ModuleInterface, ModuleStatus> entry = findModule(name); if (entry == null) { throw new IllegalArgumentException("Module does not exist."); } ModuleInterface module = entry.getKey(); StringBuffer sb = new StringBuffer(); String desc = module.getInfo(ModuleInterface.DESCRIPTION); if (desc != null) { sb.append(desc); sb.append("\n\n"); } String author = module.getInfo(ModuleInterface.AUTHOR); if (author != null) { sb.append("Author: ").append(author); sb.append("\n"); } String version = module.getInfo(ModuleInterface.VERSION); if (version != null) { sb.append("Version: ").append(version); sb.append("\n"); } return sb.toString(); }
// in src/org/argouml/ocl/OCLUtil.java
public static Object getInnerMostEnclosingNamespace (Object me) { if (Model.getFacade().isAFeature(me)) { me = Model.getFacade().getOwner(me); } if (!Model.getFacade().isANamespace(me)) { throw new IllegalArgumentException(); } return me; }
// in src/org/argouml/uml/ui/TabTaggedValuesModel.java
public void setTarget(Object t) { if (LOG.isDebugEnabled()) { LOG.debug("Set target to " + t); } if (t != null && !Model.getFacade().isAModelElement(t)) { throw new IllegalArgumentException(); } if (target != t) { if (target != null) { Model.getPump().removeModelEventListener(this, target); } target = t; if (t != null) { Model.getPump().addModelEventListener(this, t, new String[] {"taggedValue", "referenceTag"}); } } // always fire changes in the case something has changed in the // composition of the taggedValues collection. fireTableDataChanged(); }
// in src/org/argouml/uml/ui/TabTaggedValuesModel.java
public Object getValueAt(int row, int col) { Collection tvs = Model.getFacade().getTaggedValuesCollection(target); if (row > tvs.size() || col > 1) { throw new IllegalArgumentException(); } // If the row is past the end of our current collection, // return an empty string so they can add a new value if (row == tvs.size()) { return ""; } Object[] tva = tvs.toArray(); Object tv = tva[row]; if (col == 0) { Object n = Model.getFacade().getTagDefinition(tv); if (n == null) { return ""; } return n; } if (col == 1) { if (Model.getFacade().getUmlVersion().charAt(0) == '1') { String be = Model.getFacade().getValueOfTag(tv); if (be == null) { return ""; } return be; } else { Object value = Model.getFacade().getValueOfTag(target, tv); if (value instanceof Collection) { // handle multivalued tagged value int n = -1; for (int i = 0; i <= row; i++) { if (tva[i] == tv) { n++; } } if (n != -1) { value = ((Collection) value).toArray()[n]; } else { value = ""; } } return value.toString(); } } return "TV-" + row * 2 + col; // for debugging }
// in src/org/argouml/uml/ui/PropPanel.java
public JLabel addFieldAfter(String label, Component component, Component afterComponent) { int nComponent = getComponentCount(); for (int i = 0; i < nComponent; ++i) { if (getComponent(i) == afterComponent) { JLabel jlabel = createLabelFor(label, component); component.setFont(stdFont); add(jlabel, ++i); add(component, ++i); return jlabel; } } throw new IllegalArgumentException("Component not found"); }
// in src/org/argouml/uml/ui/PropPanel.java
public JLabel addFieldBefore(String label, Component component, Component beforeComponent) { int nComponent = getComponentCount(); for (int i = 0; i < nComponent; ++i) { if (getComponent(i) == beforeComponent) { JLabel jlabel = createLabelFor(label, component); component.setFont(stdFont); add(jlabel, i - 1); add(component, i++); return jlabel; } } throw new IllegalArgumentException("Component not found"); }
// in src/org/argouml/uml/ui/ActionClassDiagram.java
Override public ArgoDiagram createDiagram(Object ns, DiagramSettings settings) { if (isValidNamespace(ns)) { return DiagramFactory.getInstance().create( DiagramFactory.DiagramType.Class, ns, settings); } LOG.error("No namespace as argument"); LOG.error(ns); throw new IllegalArgumentException( "The argument " + ns + "is not a namespace."); }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
protected void setElements(Collection elements) { if (elements != null) { ArrayList toBeRemoved = new ArrayList(); for (Object o : objects) { if (!elements.contains(o) && !(isClearable // Check against "" is needed for backward // compatibility. Don't remove without // checking subclasses and warning downstream // developers - tfm - 20081211 && ("".equals(o) || CLEARED.equals(o)))) { toBeRemoved.add(o); } } removeAll(toBeRemoved); addAll(elements); if (isClearable && !elements.contains(CLEARED)) { addElement(CLEARED); } if (!objects.contains(selectedObject)) { selectedObject = null; } } else { throw new IllegalArgumentException("In setElements: may not set " + "elements to null collection"); } }
// in src/org/argouml/uml/ui/ActionDeploymentDiagram.java
public ArgoDiagram createDiagram(Object namespace) { // a deployment diagram shows something about the whole model // according to the UML spec, but we rely on the caller to enforce // that if desired. if (!Model.getFacade().isANamespace(namespace)) { LOG.error("No namespace as argument"); LOG.error(namespace); throw new IllegalArgumentException( "The argument " + namespace + "is not a namespace."); } return DiagramFactory.getInstance().createDiagram( DiagramFactory.DiagramType.Deployment, namespace, null); }
// in src/org/argouml/uml/ui/ActionDeploymentDiagram.java
public boolean isValidNamespace(Object namespace) { // a deployment diagram shows something about the whole model // according to the uml spec if (!Model.getFacade().isANamespace(namespace)) { LOG.error("No namespace as argument"); LOG.error(namespace); throw new IllegalArgumentException( "The argument " + namespace + "is not a namespace."); } // may only occur as child of the model or in a package if (Model.getFacade().isAPackage(namespace)) { return true; } return false; }
// in src/org/argouml/uml/ui/behavior/common_behavior/ActionNewReception.java
public void actionPerformed(ActionEvent e) { super.actionPerformed(e); Object classifier = TargetManager.getInstance().getModelTarget(); if (!Model.getFacade().isAClassifier(classifier)) { throw new IllegalArgumentException( "Argument classifier is null or not a classifier. Got: " + classifier); } Object reception = Model.getCommonBehaviorFactory().buildReception(classifier); TargetManager.getInstance().setTarget(reception); }
// in src/org/argouml/uml/ui/TabConstraints.java
public void setName( final String sName, final EditingUtilities euHelper) { if (theMMcConstraint != null) { // Check name for consistency with spec if (!euHelper.isValidConstraintName(sName)) { throw new IllegalArgumentException( "Please specify a valid name."); } // Set name Object mcOld = Model.getCoreFactory().createConstraint(); Model.getCoreHelper().setName(mcOld, Model.getFacade().getName(theMMcConstraint)); Object constraintBody = Model.getFacade().getBody(theMMcConstraint); Model.getCoreHelper().setBody(mcOld, Model.getDataTypesFactory() .createBooleanExpression( "OCL", (String) Model.getFacade().getBody( constraintBody))); Model.getCoreHelper().setName(theMMcConstraint, sName); fireConstraintNameChanged(theMNIdx, mcOld, theMMcConstraint); // Also set name in constraint body -- Added 03/14/2001 try { OclTree tree = null; Object mmeContext = OCLUtil .getInnerMostEnclosingNamespace(theMMmeiTarget); constraintBody = Model.getFacade().getBody(theMMcConstraint); tree = euHelper.parseAndCheckConstraint( (String) Model.getFacade().getBody( constraintBody), new ArgoFacade(mmeContext)); if (tree != null) { tree.apply(new DepthFirstAdapter() { private int nameID = 0; public void caseAConstraintBody( AConstraintBody node) { // replace name if (nameID == 0) { node.setName(new TName(sName)); } else { node.setName(new TName( sName + "_" + nameID)); } nameID++; } }); setData(tree.getExpression(), euHelper); } } catch (Throwable t) { // OK, so that didn't work out... Just ignore // any problems and don't set the name in the // constraint body better had log it. LOG.error("some unidentified problem", t); } }
// in src/org/argouml/uml/ui/ActionUseCaseDiagram.java
Override public ArgoDiagram createDiagram(Object namespace, DiagramSettings settings) { if (!Model.getFacade().isANamespace(namespace)) { LOG.error("No namespace as argument"); LOG.error(namespace); throw new IllegalArgumentException( "The argument " + namespace + "is not a namespace."); } return DiagramFactory.getInstance().create( DiagramFactory.DiagramType.UseCase, namespace, settings); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
public void setVisible(boolean visible) { if (!visible && !invisibleAllowed) { throw new IllegalArgumentException( "Visibility of a FigNode should never be false"); } }
// in src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java
private void constructFigs(FigClassAssociationClass classBoxFig, Fig ownerFig) { LOG.info("FigEdgeAssociationClass constructor"); if (classBoxFig == null) { throw new IllegalArgumentException("No class box found while " + "creating FigEdgeAssociationClass"); } if (ownerFig == null) { throw new IllegalArgumentException("No association edge found " + "while creating FigEdgeAssociationClass"); } setDestFigNode(classBoxFig); setDestPortFig(classBoxFig); final FigNode port; if (ownerFig instanceof FigEdgeModelElement) { ((FigEdgeModelElement) ownerFig).makeEdgePort(); port = ((FigEdgeModelElement) ownerFig).getEdgePort(); } else { port = (FigNode) ownerFig; } setSourcePortFig(port); setSourceFigNode(port); computeRoute(); }
// in src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java
Override public void setDestFigNode(FigNode fn) { if (!(fn instanceof FigClassAssociationClass)) { throw new IllegalArgumentException( "The dest of an association class dashed link can " + "only be a FigClassAssociationClass"); } super.setDestFigNode(fn); }
// in src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java
Override public void setSourceFigNode(FigNode fn) { if (!(fn instanceof FigEdgePort || fn instanceof FigNodeAssociation)) { throw new IllegalArgumentException( "The source of an association class dashed link can " + "only be a FigEdgePort"); } super.setSourceFigNode(fn); }
// in src/org/argouml/uml/diagram/ui/FigCompartment.java
Override public void addFig(Fig fig) { if (fig != getBigPort() && !(fig instanceof CompartmentFigText) && !(fig instanceof FigSeparator)) { LOG.error("Illegal Fig added to a FigEditableCompartment"); throw new IllegalArgumentException( "A FigEditableCompartment can only " + "contain CompartmentFigTexts, " + "received a " + fig.getClass().getName()); } super.addFig(fig); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private void initOwner(Object element) { if (element != null) { if (!Model.getFacade().isAUMLElement(element)) { throw new IllegalArgumentException( "The owner must be a model element - got a " + element.getClass().getName()); } super.setOwner(element); if (edgePort != null) { edgePort.setOwner(getOwner()); } if (Model.getFacade().isANamedElement(element)) { NotationName nn = Notation.findNotation( settings.getNotationSettings().getNotationLanguage()); notationProviderName = NotationProviderFactory2.getInstance().getNotationProvider( getNotationProviderType(), element, this, nn); } addElementListener(element, "remove"); } }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private Fig getNoEdgePresentationFor(Object element) { if (element == null) { throw new IllegalArgumentException("Can't search for a null owner"); } List contents = PgmlUtility.getContentsNoEdges(getLayer()); int figCount = contents.size(); for (int figIndex = 0; figIndex < figCount; ++figIndex) { Fig fig = (Fig) contents.get(figIndex); if (fig.getOwner() == element) { return fig; } } throw new IllegalStateException("Can't find a FigNode representing " + Model.getFacade().getName(element)); }
// in src/org/argouml/uml/diagram/DiagramSettings.java
public void setDefaultStereotypeView(final int newView) { StereotypeStyle sv = StereotypeStyle.getEnum(newView); if (sv == null) { throw new IllegalArgumentException("Bad argument " + newView); } setDefaultStereotypeView(sv); }
// in src/org/argouml/uml/diagram/DiagramFactory.java
private ArgoDiagram createInternal(final DiagramType type, final Object namespace, final Object machine, DiagramSettings settings) { final ArgoDiagram diagram; if (settings == null) { throw new IllegalArgumentException( "DiagramSettings may not be null"); } Object factory = factories.get(type); if (factory != null) { Object owner; if (machine != null) { owner = machine; } else { owner = namespace; } if (factory instanceof DiagramFactoryInterface2) { diagram = ((DiagramFactoryInterface2) factory).createDiagram( owner, (String) null, settings); } else if (factory instanceof DiagramFactoryInterface) { diagram = ((DiagramFactoryInterface) factory).createDiagram( namespace, machine); diagram.setDiagramSettings(settings); } else { // This shouldn't be possible, but just in case throw new IllegalStateException( "Unknown factory type registered"); } } else { if ((type == DiagramType.State || type == DiagramType.Activity) && machine == null) { diagram = createDiagram(diagramClasses.get(type), null, namespace); } else { diagram = createDiagram(diagramClasses.get(type), namespace, machine); } diagram.setDiagramSettings(settings); } return diagram; }
// in src/org/argouml/uml/diagram/DiagramFactory.java
Deprecated private ArgoDiagram createDiagram(Class type, Object namespace, Object machine) { ArgoDiagram diagram = null; Class diType = null; // TODO: Convert all to use standard factory registration if (type == UMLClassDiagram.class) { diagram = new UMLClassDiagram(namespace); diType = ClassDiagram.class; } else if (type == UMLUseCaseDiagram.class) { diagram = new UMLUseCaseDiagram(namespace); diType = UseCaseDiagram.class; } else if (type == UMLStateDiagram.class) { diagram = new UMLStateDiagram(namespace, machine); diType = StateDiagram.class; } else if (type == UMLDeploymentDiagram.class) { diagram = new UMLDeploymentDiagram(namespace); diType = DeploymentDiagram.class; } else if (type == UMLCollaborationDiagram.class) { diagram = new UMLCollaborationDiagram(namespace); diType = CollaborationDiagram.class; } else if (type == UMLActivityDiagram.class) { diagram = new UMLActivityDiagram(namespace, machine); diType = ActivityDiagram.class; } if (diagram == null) { throw new IllegalArgumentException ("Unknown diagram type"); } if (Model.getDiagramInterchangeModel() != null) { // TODO: This is never executed as Ludos DI work was never // finished. diagram.getGraphModel().addGraphEventListener( GraphChangeAdapter.getInstance()); /* * The diagram are always owned by the model * in this first implementation. */ DiDiagram dd = GraphChangeAdapter.getInstance() .createDiagram(diType, namespace); ((UMLMutableGraphSupport) diagram.getGraphModel()).setDiDiagram(dd); } return diagram; }
// in src/org/argouml/uml/diagram/deployment/ui/UMLDeploymentDiagram.java
public void setNamespace(Object handle) { if (!Model.getFacade().isANamespace(handle)) { LOG.error( "Illegal argument. Object " + handle + " is not a namespace"); throw new IllegalArgumentException( "Illegal argument. Object " + handle + " is not a namespace"); } Object m = handle; boolean init = (null == getNamespace()); super.setNamespace(m); DeploymentDiagramGraphModel gm = createGraphModel(); gm.setHomeModel(m); if (init) { LayerPerspective lay = new LayerPerspectiveMutable(Model.getFacade().getName(m), gm); DeploymentDiagramRenderer rend = new DeploymentDiagramRenderer(); lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); } }
// in src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java
public void setNamespace(Object ns) { if (!Model.getFacade().isANamespace(ns)) { LOG.error("Illegal argument. " + "Object " + ns + " is not a namespace"); throw new IllegalArgumentException("Illegal argument. " + "Object " + ns + " is not a namespace"); } boolean init = (null == getNamespace()); super.setNamespace(ns); ClassDiagramGraphModel gm = (ClassDiagramGraphModel) getGraphModel(); gm.setHomeModel(ns); if (init) { LayerPerspective lay = new LayerPerspectiveMutable(Model.getFacade().getName(ns), gm); ClassDiagramRenderer rend = new ClassDiagramRenderer(); // singleton lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); } }
// in src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java
public FigNode getFigNodeFor(GraphModel gm, Layer lay, Object node, Map styleAttributes) { FigNodeModelElement figNode = null; if (node == null) { throw new IllegalArgumentException("A node must be supplied"); } // Although not generally true for GEF, for Argo we know that the layer // is a LayerPerspective which knows the associated diagram Diagram diag = ((LayerPerspective) lay).getDiagram(); if (diag instanceof UMLDiagram && ((UMLDiagram) diag).doesAccept(node)) { figNode = (FigNodeModelElement) ((UMLDiagram) diag) .drop(node, null); } else { LOG.error("TODO: ClassDiagramRenderer getFigNodeFor " + node); throw new IllegalArgumentException( "Node is not a recognised type. Received " + node.getClass().getName()); } lay.add(figNode); figNode.setDiElement( GraphChangeAdapter.getInstance().createElement(gm, node)); return figNode; }
// in src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java
public FigEdge getFigEdgeFor(GraphModel gm, Layer lay, Object edge, Map styleAttribute) { if (LOG.isDebugEnabled()) { LOG.debug("making figedge for " + edge); } if (edge == null) { throw new IllegalArgumentException("A model edge must be supplied"); } assert lay instanceof LayerPerspective; final FigEdge newEdge; // Although not generally true for GEF, for Argo we know that the layer // is a LayerPerspective which knows the associated diagram Diagram diag = ((LayerPerspective) lay).getDiagram(); if (diag instanceof UMLDiagram && ((UMLDiagram) diag).doesAccept(edge)) { newEdge = (FigEdge) ((UMLDiagram) diag) .drop(edge, null); } else { LOG.error("TODO: ClassDiagramRenderer getFigEdgeFor " + edge); throw new IllegalArgumentException( "Edge is not a recognised type. Received " + edge.getClass().getName()); } addEdge(lay, newEdge, edge); return newEdge; }
// in src/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java
Override public void addEdge(Object edge) { if (edge == null) { throw new IllegalArgumentException("Cannot add a null edge"); } if (getDestPort(edge) == null || getSourcePort(edge) == null) { throw new IllegalArgumentException( "The source and dest port should be provided on an edge"); } if (LOG.isInfoEnabled()) { LOG.info("Adding an edge of type " + edge.getClass().getName() + " to class diagram."); } if (!canAddEdge(edge)) { LOG.info("Attempt to add edge rejected"); return; } getEdges().add(edge); // TODO: assumes public // TODO: This is probably an undesirable side effect unless the user // confirms it. Placing an element on a second diagram is going to // potentially change its namespace. - tfm 20061208 if (Model.getFacade().isAModelElement(edge) && Model.getFacade().getNamespace(edge) == null && !Model.getFacade().isAAssociationEnd(edge)) { Model.getCoreHelper().addOwnedElement(getHomeModel(), edge); } fireEdgeAdded(edge); }
// in src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java
public FigNode getFigNodeFor(GraphModel gm, Layer lay, Object node, Map styleAttributes) { FigNode figNode = null; assert node != null; // Although not generally true for GEF, for Argo we know that the layer // is a LayerPerspective which knows the associated diagram Diagram diag = ((LayerPerspective) lay).getDiagram(); if (diag instanceof UMLDiagram && ((UMLDiagram) diag).doesAccept(node)) { figNode = (FigNode) ((UMLDiagram) diag).drop(node, null); } else { LOG.error("TODO: CollabDiagramRenderer getFigNodeFor"); throw new IllegalArgumentException( "Node is not a recognised type. Received " + node.getClass().getName()); } lay.add(figNode); return figNode; }
// in src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java
public FigEdge getFigEdgeFor(GraphModel gm, Layer lay, Object edge, Map styleAttributes) { if (LOG.isDebugEnabled()) { LOG.debug("making figedge for " + edge); } if (edge == null) { throw new IllegalArgumentException("A model edge must be supplied"); } assert lay instanceof LayerPerspective; ArgoDiagram diag = (ArgoDiagram) ((LayerPerspective) lay).getDiagram(); DiagramSettings settings = diag.getDiagramSettings(); FigEdge newEdge = null; if (Model.getFacade().isAAssociationRole(edge) || Model.getFacade().isAConnector(edge)) { Object[] associationEnds = Model.getFacade().getConnections(edge).toArray(); newEdge = new FigAssociationRole( new DiagramEdgeSettings( edge, associationEnds[0], associationEnds[1]), settings); FigNode sourceFig = getFigNodeForAssociationEnd(diag, associationEnds[0]); FigNode destFig = getFigNodeForAssociationEnd(diag, associationEnds[1]); newEdge.setSourceFigNode(sourceFig); newEdge.setSourcePortFig(sourceFig); newEdge.setDestFigNode(destFig); newEdge.setDestPortFig(destFig); } else if (Model.getFacade().isAGeneralization(edge)) { newEdge = new FigGeneralization(edge, settings); } else if (Model.getFacade().isADependency(edge)) { newEdge = new FigDependency(edge , settings); } else if (edge instanceof CommentEdge) { newEdge = new FigEdgeNote(edge, settings); // TODO -> settings } addEdge(lay, newEdge, edge); return newEdge; }
// in src/org/argouml/uml/diagram/collaboration/ui/UMLCollaborationDiagram.java
public void setNamespace(Object handle) { if (!Model.getFacade().isANamespace(handle)) { LOG.error( "Illegal argument. Object " + handle + " is not a namespace"); throw new IllegalArgumentException( "Illegal argument. Object " + handle + " is not a namespace"); } super.setNamespace(handle); CollabDiagramGraphModel gm = createGraphModel(); gm.setCollaboration(handle); LayerPerspective lay = new LayerPerspectiveMutable(Model.getFacade().getName(handle), gm); CollabDiagramRenderer rend = new CollabDiagramRenderer(); // singleton lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); }
// in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
public void setCollaboration(Object collaboration) { try { if (collaboration == null) { throw new IllegalArgumentException( "A null collaboration was supplied"); } if (!(Model.getFacade().isACollaboration(collaboration))) { throw new IllegalArgumentException( "Expected a collaboration. The type received was " + collaboration.getClass().getName()); } } catch (IllegalArgumentException e) { LOG.error("Illegal Argument to setCollaboration", e); throw e; } setHomeModel(collaboration); }
// in src/org/argouml/uml/diagram/UmlDiagramRenderer.java
protected void addEdge(Layer lay, FigEdge newEdge, Object edge) { if (newEdge == null) { throw new IllegalArgumentException( "Don't know how to create FigEdge for model type " + edge.getClass().getName()); } setPorts(lay, newEdge); assert newEdge != null : "There has been no FigEdge created"; // newEdge.setDiElement( // GraphChangeAdapter.getInstance().createElement(gm, edge)); assert newEdge != null : "There has been no FigEdge created"; assert (newEdge.getDestFigNode() != null) : "The FigEdge has no dest node"; assert (newEdge.getDestPortFig() != null) : "The FigEdge has no dest port"; assert (newEdge.getSourceFigNode() != null) : "The FigEdge has no source node"; assert (newEdge.getSourcePortFig() != null) : "The FigEdge has no source port"; lay.add(newEdge); }
// in src/org/argouml/uml/diagram/state/ui/StateDiagramRenderer.java
public FigNode getFigNodeFor(GraphModel gm, Layer lay, Object node, Map styleAttributes) { assert node != null; FigNode figNode = null; // Although not generally true for GEF, for Argo we know that the layer // is a LayerPerspective which knows the associated diagram Diagram diag = ((LayerPerspective) lay).getDiagram(); if (diag instanceof UMLDiagram && ((UMLDiagram) diag).doesAccept(node)) { figNode = (FigNode) ((UMLDiagram) diag).drop(node, null); } else { LOG.debug("TODO: StateDiagramRenderer getFigNodeFor"); throw new IllegalArgumentException( "Node is not a recognised type. Received " + node.getClass().getName()); } lay.add(figNode); return figNode; }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
Deprecated public UMLStateDiagram(Object ns, Object machine) { this(); if (!Model.getFacade().isAStateMachine(machine)) { throw new IllegalStateException( "No StateMachine given to create a Statechart diagram"); } if (ns == null) { ns = getNamespaceFromMachine(machine); } if (!Model.getFacade().isANamespace(ns)) { throw new IllegalArgumentException(); } nameDiagram(ns); setup(ns, machine); }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
public void setStateMachine(Object sm) { if (!Model.getFacade().isAStateMachine(sm)) { throw new IllegalArgumentException("This is not a StateMachine"); } ((StateDiagramGraphModel) getGraphModel()).setMachine(sm); }
// in src/org/argouml/uml/diagram/state/StateDiagramGraphModel.java
public void setMachine(Object sm) { if (!Model.getFacade().isAStateMachine(sm)) { throw new IllegalArgumentException(); } if (sm != null) { machine = sm; } }
// in src/org/argouml/uml/diagram/state/StateDiagramGraphModel.java
public void addEdge(Object edge) { LOG.debug("adding statechart/activity diagram edge!!!!!!"); if (edge == null) { throw new IllegalArgumentException("Cannot add a null edge"); } if (getDestPort(edge) == null || getSourcePort(edge) == null) { throw new IllegalArgumentException( "The source and dest port should be provided on an edge"); } if (LOG.isInfoEnabled()) { LOG.info("Adding an edge of type " + edge.getClass().getName() + " to class diagram."); } if (!canAddEdge(edge)) { LOG.info("Attempt to add edge rejected"); return; } getEdges().add(edge); fireEdgeAdded(edge); }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
public void setNamespace(Object ns) { if (!Model.getFacade().isANamespace(ns)) { LOG.error("Not a namespace"); LOG.error(ns); throw new IllegalArgumentException("Given object not a namespace"); } if ((namespace != null) && (namespace != ns)) { Model.getPump().removeModelEventListener(this, namespace); } Object oldNs = namespace; namespace = ns; firePropertyChange(NAMESPACE_KEY, oldNs, ns); // Add the diagram as a listener to the namespace so // that when the namespace is removed the diagram is deleted also. /* Listening only to "remove" events does not work... * TODO: Check if this works now with new event pump - tfm */ Model.getPump().addModelEventListener(this, namespace, "remove"); }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
public void setHomeModel(Object ns) { if (!Model.getFacade().isANamespace(ns)) { throw new IllegalArgumentException(); } homeModel = ns; }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
public CommentEdge buildCommentConnection(Object from, Object to) { if (from == null || to == null) { throw new IllegalArgumentException("Either fromNode == null " + "or toNode == null"); } Object comment = null; Object annotatedElement = null; if (Model.getFacade().isAComment(from)) { comment = from; annotatedElement = to; } else { if (Model.getFacade().isAComment(to)) { comment = to; annotatedElement = from; } else { return null; } } CommentEdge connection = new CommentEdge(from, to); Model.getCoreHelper().addAnnotatedElement(comment, annotatedElement); return connection; }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
Deprecated public UMLActivityDiagram(Object namespace, Object agraph) { this(); if (namespace == null) { namespace = Model.getFacade().getNamespace(agraph); } if (!Model.getFacade().isANamespace(namespace) || !Model.getFacade().isAActivityGraph(agraph)) { throw new IllegalArgumentException(); } if (Model.getFacade().getName(namespace) != null) { if (!Model.getFacade().getName(namespace).trim().equals("")) { String name = Model.getFacade().getName(namespace) + " activity " + (Model.getFacade().getBehaviors(namespace).size()); try { setName(name); } catch (PropertyVetoException pve) { // no action required } } } setup(namespace, agraph); }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
public void setup(Object namespace, Object agraph) { if (!Model.getFacade().isANamespace(namespace) || !Model.getFacade().isAActivityGraph(agraph)) { throw new IllegalArgumentException(); } setNamespace(namespace); theActivityGraph = agraph; ActivityDiagramGraphModel gm = createGraphModel(); gm.setHomeModel(namespace); if (theActivityGraph != null) { gm.setMachine(theActivityGraph); } ActivityDiagramRenderer rend = new ActivityDiagramRenderer(); LayerPerspective lay = new LayerPerspectiveMutable( Model.getFacade().getName(namespace), gm); lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); /* Listen to activitygraph deletion, * delete this diagram. */ Model.getPump().addModelEventListener(this, theActivityGraph, new String[] {"remove", "namespace"}); }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
public void setStateMachine(Object sm) { if (!Model.getFacade().isAStateMachine(sm)) { throw new IllegalArgumentException(); } ((ActivityDiagramGraphModel) getGraphModel()).setMachine(sm); }
// in src/org/argouml/uml/diagram/use_case/ui/UMLUseCaseDiagram.java
Override public void setNamespace(Object handle) { if (!Model.getFacade().isANamespace(handle)) { LOG.error( "Illegal argument. Object " + handle + " is not a namespace"); throw new IllegalArgumentException( "Illegal argument. Object " + handle + " is not a namespace"); } Object m = handle; super.setNamespace(m); UseCaseDiagramGraphModel gm = (UseCaseDiagramGraphModel) getGraphModel(); gm.setHomeModel(m); LayerPerspective lay = new LayerPerspectiveMutable(Model.getFacade().getName(m), gm); UseCaseDiagramRenderer rend = new UseCaseDiagramRenderer(); lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); // The renderer should be a singleton }
// in src/org/argouml/uml/diagram/use_case/ui/UseCaseDiagramRenderer.java
public FigEdge getFigEdgeFor(GraphModel gm, Layer lay, Object edge, Map styleAttributes) { if (LOG.isDebugEnabled()) { LOG.debug("making figedge for " + edge); } if (edge == null) { throw new IllegalArgumentException("A model edge must be supplied"); } assert lay instanceof LayerPerspective; ArgoDiagram diag = (ArgoDiagram) ((LayerPerspective) lay).getDiagram(); DiagramSettings settings = diag.getDiagramSettings(); FigEdge newEdge = null; if (Model.getFacade().isAAssociation(edge)) { final Object[] associationEnds = Model.getFacade().getConnections(edge).toArray(); newEdge = new FigAssociation( new DiagramEdgeSettings( edge, associationEnds[0], associationEnds[1]), settings); final FigNode sourceFig = getFigNodeForAssociationEnd(diag, associationEnds[0]); final FigNode destFig = getFigNodeForAssociationEnd(diag, associationEnds[1]); newEdge.setSourceFigNode(sourceFig); newEdge.setSourcePortFig(sourceFig); newEdge.setDestFigNode(destFig); newEdge.setDestPortFig(destFig); } else if (Model.getFacade().isAGeneralization(edge)) { newEdge = new FigGeneralization(edge, settings); } else if (Model.getFacade().isAExtend(edge)) { newEdge = new FigExtend(edge, settings); // The nodes at the two ends Object base = Model.getFacade().getBase(edge); Object extension = Model.getFacade().getExtension(edge); // The figs for the two end nodes FigNode baseFN = (FigNode) lay.presentationFor(base); FigNode extensionFN = (FigNode) lay.presentationFor(extension); // Link the new extend relationship in to the ends. Remember we // draw from the extension use case to the base use case. newEdge.setSourcePortFig(extensionFN); newEdge.setSourceFigNode(extensionFN); newEdge.setDestPortFig(baseFN); newEdge.setDestFigNode(baseFN); } else if (Model.getFacade().isAInclude(edge)) { newEdge = new FigInclude(edge, settings); Object base = Model.getFacade().getBase(edge); Object addition = Model.getFacade().getAddition(edge); // The figs for the two end nodes FigNode baseFN = (FigNode) lay.presentationFor(base); FigNode additionFN = (FigNode) lay.presentationFor(addition); // Link the new include relationship in to the ends newEdge.setSourcePortFig(baseFN); newEdge.setSourceFigNode(baseFN); newEdge.setDestPortFig(additionFN); newEdge.setDestFigNode(additionFN); } else if (Model.getFacade().isADependency(edge)) { newEdge = new FigDependency(edge, settings); // Where there is more than one supplier or client, take the first // element in each case. There really ought to be a check that // there are some here for safety. Object supplier = ((Model.getFacade().getSuppliers(edge).toArray())[0]); Object client = ((Model.getFacade().getClients(edge).toArray())[0]); // The figs for the two end nodes FigNode supplierFN = (FigNode) lay.presentationFor(supplier); FigNode clientFN = (FigNode) lay.presentationFor(client); // Link the new dependency in to the ends newEdge.setSourcePortFig(clientFN); newEdge.setSourceFigNode(clientFN); newEdge.setDestPortFig(supplierFN); newEdge.setDestFigNode(supplierFN); } else if (edge instanceof CommentEdge) { newEdge = new FigEdgeNote(edge, settings); } addEdge(lay, newEdge, edge); return newEdge; }
// in src/org/argouml/uml/diagram/use_case/UseCaseDiagramGraphModel.java
Override public void addEdge(Object edge) { if (edge == null) { throw new IllegalArgumentException("Cannot add a null edge"); } if (getDestPort(edge) == null || getSourcePort(edge) == null) { throw new IllegalArgumentException( "The source and dest port should be provided on an edge"); } if (LOG.isInfoEnabled()) { LOG.info("Adding an edge of type " + edge.getClass().getName() + " to use case diagram."); } if (!canAddEdge(edge)) { LOG.info("Attempt to add edge rejected"); return; } // Add the element and place it in the namespace of the model getEdges().add(edge); // TODO: assumes public if (Model.getFacade().isAUMLElement(edge) && Model.getFacade().getNamespace(edge) == null) { Model.getCoreHelper().addOwnedElement(getHomeModel(), edge); } // Tell GEF fireEdgeAdded(edge); }
// in src/org/argouml/uml/CommentEdge.java
public void setDestination(Object destination) { if (destination == null) { throw new IllegalArgumentException( "The destination of a comment edge cannot be null"); } if (!(Model.getFacade().isAModelElement(destination))) { throw new IllegalArgumentException( "The destination of the CommentEdge cannot be a " + destination.getClass().getName()); } dest = destination; }
// in src/org/argouml/uml/CommentEdge.java
public void setSource(Object theSource) { if (theSource == null) { throw new IllegalArgumentException( "The source of a comment edge cannot be null"); } if (!(Model.getFacade().isAModelElement(theSource))) { throw new IllegalArgumentException( "The source of the CommentEdge cannot be a " + theSource.getClass().getName()); } this.source = theSource; }
// in src/org/argouml/uml/CommentEdge.java
public void setAnnotatedElement(Object theAnnotatedElement) { if (theAnnotatedElement == null) { throw new IllegalArgumentException( "An annotated element must be supplied"); } if (Model.getFacade().isAComment(theAnnotatedElement)) { throw new IllegalArgumentException( "An annotated element cannot be a comment"); } this.annotatedElement = theAnnotatedElement; }
// in src/org/argouml/uml/CommentEdge.java
public void setComment(Object theComment) { if (theComment == null) { throw new IllegalArgumentException("A comment must be supplied"); } if (!Model.getFacade().isAComment(theComment)) { throw new IllegalArgumentException("A comment cannot be a " + theComment.getClass().getName()); } this.comment = theComment; }
// in src/org/argouml/uml/ChildGenRelated.java
public Enumeration gen(Object o) { // This is carried over from previous implementation // not sure why we don't want contents of package - tfm - 20060214 if (Model.getFacade().isAPackage(o)) { return null; } if (o instanceof Diagram) { List res = new ArrayList(); Diagram d = (Diagram) o; res.add(d.getGraphModel().getNodes()); res.add(d.getGraphModel().getEdges()); return Collections.enumeration(res); } // For all other model elements, return any elements // associated in any way if (Model.getFacade().isAUMLElement(o)) { return Collections.enumeration(Model.getFacade() .getModelElementAssociated(o)); } throw new IllegalArgumentException("Unknown element type " + o); }
// in src/org/argouml/uml/cognitive/critics/WizOperName.java
Override public void doAction(int oldStep) { if (!possibleConstructor) { super.doAction(oldStep); return; } switch (oldStep) { case 1: int choice = -1; if (step1 != null) { choice = step1.getSelectedIndex(); } switch (choice) { case -1: throw new IllegalArgumentException( "nothing selected, should not get here"); case 0: stereotypePathChosen = true; Object oper = getModelElement(); // We need to find the stereotype with the name // "create" and the base class BehavioralFeature in // the model. If there is none then we create one and // put it there. Object m = Model.getFacade().getRoot(oper); Object theStereotype = null; for (Iterator iter = Model.getFacade().getOwnedElements(m).iterator(); iter.hasNext();) { Object candidate = iter.next(); if (!(Model.getFacade().isAStereotype(candidate))) { continue; } if (!("create".equals( Model.getFacade().getName(candidate)))) { continue; } Collection baseClasses = Model.getFacade().getBaseClasses(candidate); Iterator iter2 = baseClasses != null ? baseClasses.iterator() : null; if (iter2 == null || !("BehavioralFeature".equals( iter2.next()))) { continue; } theStereotype = candidate; break; } if (theStereotype == null) { theStereotype = Model.getExtensionMechanismsFactory() .buildStereotype("create", m); Model.getCoreHelper().setName(theStereotype, "create"); // theStereotype.setStereotype(???); Model.getExtensionMechanismsHelper() .addBaseClass(theStereotype, "BehavioralFeature"); Object targetNS = findNamespace(Model.getFacade().getNamespace(oper), Model.getFacade().getRoot(oper)); Model.getCoreHelper() .addOwnedElement(targetNS, theStereotype); } try { createStereotype = theStereotype; Model.getCoreHelper().addStereotype(oper, theStereotype); ProjectManager.getManager().updateRoots(); addedCreateStereotype = true; } catch (Exception pve) { LOG.error("could not set stereotype", pve); } return; case 1: // Nothing to do. stereotypePathChosen = false; return; default: } return; case 2: if (!stereotypePathChosen) { super.doAction(1); } return; default: } }
// in src/org/argouml/uml/cognitive/critics/WizManyNames.java
public void setModelElements(List elements) { int mSize = elements.size(); for (int i = 0; i < 3 && i < mSize; ++i) { if (!Model.getFacade().isAModelElement(elements.get(i))) { throw new IllegalArgumentException( "The list should contain model elements in " + "the first 3 positions"); } } mes = elements; }
// in src/org/argouml/uml/cognitive/UMLToDoItem.java
Override protected void checkArgument(Object dm) { if (!Model.getFacade().isAUMLElement(dm) && !(dm instanceof Fig) && !(dm instanceof Diagram)) { throw new IllegalArgumentException( "The offender must be a model element, " + "a Fig or a Diagram"); } }
// in src/org/argouml/profile/internal/ModelUtils.java
public static Object findTypeInModel(String s, Object model) { if (!Model.getFacade().isANamespace(model)) { throw new IllegalArgumentException( "Looking for the classifier " + s + " in a non-namespace object of " + model + ". A namespace was expected."); } Collection allClassifiers = Model.getModelManagementHelper() .getAllModelElementsOfKind(model, Model.getMetaTypes().getClassifier()); for (Object classifier : allClassifiers) { if (Model.getFacade().getName(classifier) != null && Model.getFacade().getName(classifier).equals(s)) { return classifier; } } return null; }
// in src/org/argouml/application/helpers/ResourceLoaderWrapper.java
public Icon lookupIcon(Object value) { if (value == null) { throw new IllegalArgumentException( "Attempted to get an icon given a null key"); } if (value instanceof String) { return null; } Icon icon = iconCache.get(value.getClass()); try { if (Model.getFacade().isAPseudostate(value)) { Object kind = Model.getFacade().getKind(value); DataTypesHelper helper = Model.getDataTypesHelper(); if (helper.equalsINITIALKind(kind)) { icon = initialStateIcon; } if (helper.equalsDeepHistoryKind(kind)) { icon = deepIcon; } if (helper.equalsShallowHistoryKind(kind)) { icon = shallowIcon; } if (helper.equalsFORKKind(kind)) { icon = forkIcon; } if (helper.equalsJOINKind(kind)) { icon = joinIcon; } if (helper.equalsCHOICEKind(kind)) { icon = branchIcon; } if (helper.equalsJUNCTIONKind(kind)) { icon = junctionIcon; } // if (MPseudostateKind.FINAL.equals(kind)) // icon = _FinalStateIcon; } if (Model.getFacade().isAAbstraction(value)) { icon = realizeIcon; } if (Model.getFacade().isAException(value)) { icon = exceptionIcon; } else { // needs more work: sending and receiving icons if (Model.getFacade().isASignal(value)) { icon = signalIcon; } } if (Model.getFacade().isAComment(value)) { icon = commentIcon; } if (icon == null) { String cName = Model.getMetaTypes().getName(value); icon = lookupIconResource(cName); if (icon == null) { LOG.debug("Can't find icon for " + cName); } else { synchronized (iconCache) { iconCache.put(value.getClass(), icon); } } } } catch (InvalidElementException e) { LOG.debug("Attempted to get icon for deleted element"); return null; } return icon; }
// in src/org/argouml/cognitive/critics/ui/TableModelCritics.java
public String getColumnName(int c) { if (c == 0) { return Translator.localize("dialog.browse.column-name.active"); } if (c == 1) { return Translator.localize("dialog.browse.column-name.headline"); } if (c == 2) { return Translator.localize("dialog.browse.column-name.snoozed"); } if (c == 3) { return Translator.localize("dialog.browse.column-name.priority"); } if (c == 4) { return Translator.localize( "dialog.browse.column-name.supported-decision"); } if (c == 5) { return Translator.localize( "dialog.browse.column-name.knowledge-type"); } throw new IllegalArgumentException(); }
// in src/org/argouml/cognitive/critics/ui/TableModelCritics.java
public Class< ? > getColumnClass(int c) { if (c == 0) { return Boolean.class; } if (c == 1) { return String.class; } if (c == 2) { return String.class; } if (c == 3) { return Integer.class; } if (c == 4) { return String.class; } if (c == 5) { return String.class; } throw new IllegalArgumentException(); }
// in src/org/argouml/cognitive/critics/ui/TableModelCritics.java
public Object getValueAt(int row, int col) { Critic cr = critics.get(row); if (col == 0) { return cr.isEnabled() ? Boolean.TRUE : Boolean.FALSE; } if (col == 1) { return cr.getHeadline(); } if (col == 2) { return cr.isActive() ? "no" : "yes"; } if (col == 3) { return cr.getPriority(); } if (col == 4) { return listToString(cr.getSupportedDecisions()); } if (col == 5) { return listToString(cr.getKnowledgeTypes()); } throw new IllegalArgumentException(); }
// in src/org/argouml/cognitive/ToDoItem.java
private void checkOffs(ListSet offs) { if (offs == null) { throw new IllegalArgumentException( "A ListSet of offenders must be supplied."); } Object offender = CollectionUtil.getFirstItemOrNull(offs); if (offender != null) { checkArgument(offender); } if (offs.size() >= 2) { offender = offs.get(1); checkArgument(offender); } }
// in src/org/argouml/kernel/ProfileConfiguration.java
public static Object findTypeInModel(String s, Object model) { if (!Model.getFacade().isANamespace(model)) { throw new IllegalArgumentException( "Looking for the classifier " + s + " in a non-namespace object of " + model + ". A namespace was expected."); } Collection allClassifiers = Model.getModelManagementHelper() .getAllModelElementsOfKind(model, Model.getMetaTypes().getClassifier()); Object[] classifiers = allClassifiers.toArray(); Object classifier = null; for (int i = 0; i < classifiers.length; i++) { classifier = classifiers[i]; if (Model.getFacade().getName(classifier) != null && Model.getFacade().getName(classifier).equals(s)) { return classifier; } } return null; }
// in src/org/argouml/kernel/ProjectImpl.java
public void addMember(Object m) { if (m == null) { throw new IllegalArgumentException( "A model member must be supplied"); } else if (m instanceof ArgoDiagram) { LOG.info("Adding diagram member"); addDiagramMember((ArgoDiagram) m); } else if (m instanceof ProjectMemberTodoList) { LOG.info("Adding todo member"); addTodoMember((ProjectMemberTodoList) m); } else if (Model.getFacade().isAModel(m)) { LOG.info("Adding model member"); addModelMember(m); } else if (Model.getFacade().isAProfile(m)) { LOG.info("Adding profile model member"); addModelMember(m); } else { throw new IllegalArgumentException( "The member must be a UML model todo member or diagram." + "It is " + m.getClass().getName()); } LOG.info("There are now " + members.size() + " members"); }
// in src/org/argouml/kernel/ProjectImpl.java
private void addModelMember(final Object m) { boolean memberFound = false; Object currentMember = members.get(0); if (currentMember instanceof ProjectMemberModel) { Object currentModel = ((ProjectMemberModel) currentMember).getModel(); if (currentModel == m) { memberFound = true; } } if (!memberFound) { if (!models.contains(m)) { addModel(m); } // got past the veto, add the member ProjectMember pm = new ProjectMemberModel(m, this); LOG.info("Adding model member to start of member list"); members.add(pm); } else { LOG.info("Attempted to load 2 models"); throw new IllegalArgumentException( "Attempted to load 2 models"); } }
// in src/org/argouml/kernel/ProjectImpl.java
public void addModel(final Object model) { if (!Model.getFacade().isAModel(model) && !Model.getFacade().isAProfile(model)) { throw new IllegalArgumentException(); } if (!models.contains(model)) { setRoot(model); } }
// in src/org/argouml/kernel/ProjectImpl.java
public Object findTypeInModel(String typeName, Object namespace) { if (typeName == null) { throw new IllegalArgumentException("typeName must be non-null"); } if (!Model.getFacade().isANamespace(namespace)) { throw new IllegalArgumentException( "Looking for the classifier " + typeName + " in a non-namespace object of " + namespace + ". A namespace was expected."); } Collection allClassifiers = Model.getModelManagementHelper() .getAllModelElementsOfKind(namespace, Model.getMetaTypes().getClassifier()); for (Object classifier : allClassifiers) { if (typeName.equals(Model.getFacade().getName(classifier))) { return classifier; } } return null; }
// in src/org/argouml/kernel/ProjectImpl.java
public int getPresentationCountFor(Object me) { if (!Model.getFacade().isAUMLElement(me)) { throw new IllegalArgumentException(); } int presentations = 0; for (ArgoDiagram d : diagrams) { presentations += d.getLayer().presentationCountFor(me); } return presentations; }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
public static String generateMultiplicity(Object element, boolean showSingularMultiplicity) { Object multiplicity; if (Model.getFacade().isAMultiplicity(element)) { multiplicity = element; } else if (Model.getFacade().isAUMLElement(element)) { multiplicity = Model.getFacade().getMultiplicity(element); } else { throw new IllegalArgumentException(); } // it can still be null if the UML element // did not have a multiplicity defined. if (multiplicity != null) { int upper = Model.getFacade().getUpper(multiplicity); int lower = Model.getFacade().getLower(multiplicity); if (lower != 1 || upper != 1 || showSingularMultiplicity) { // TODO: I18N return Model.getFacade().toString(multiplicity); } } return ""; }
// in src/org/argouml/i18n/Translator.java
public static String localize(String key) { /* This is needed for the JUnit tests. * Otherwise a "assert initialized" would suffice. */ if (!initialized) { init("en"); } if (key == null) { throw new IllegalArgumentException("null"); } String name = getName(key); if (name == null) { return Localizer.localize("UMLMenu", key); } loadBundle(name); ResourceBundle bundle = bundles.get(name); if (bundle == null) { LOG.debug("Bundle (" + name + ") for resource " + key + " not found."); return key; } try { return bundle.getString(key); } catch (MissingResourceException e) { LOG.debug("Resource " + key + " not found."); return key; } }
// in src/org/argouml/persistence/PgmlUtility.java
public static String getId(Fig f) { if (f == null) { throw new IllegalArgumentException("A fig must be supplied"); } if (f.getGroup() != null) { String groupId = f.getGroup().getId(); if (f.getGroup() instanceof FigGroup) { FigGroup group = (FigGroup) f.getGroup(); return groupId + "." + (group.getFigs()).indexOf(f); } else if (f.getGroup() instanceof FigEdge) { FigEdge edge = (FigEdge) f.getGroup(); return groupId + "." + (((List) edge.getPathItemFigs()).indexOf(f) + 1); } else { return groupId + ".0"; } } Layer layer = f.getLayer(); if (layer == null) { return "LAYER_NULL"; } List c = layer.getContents(); int index = c.indexOf(f); return "Fig" + index; }
// in src/org/argouml/persistence/ArgoParser.java
public void readProject(Project theProject, InputSource source) throws SAXException { if (source == null) { throw new IllegalArgumentException( "An InputSource must be supplied"); } preRead(theProject); try { parse(source); } catch (SAXException e) { logError(source.toString(), e); throw e; } }
// in src/org/argouml/persistence/ArgoParser.java
public void readProject(Project theProject, Reader reader) throws SAXException { if (reader == null) { throw new IllegalArgumentException( "A reader must be supplied"); } preRead(theProject); try { parse(reader); } catch (SAXException e) { logError(reader.toString(), e); throw e; } }
0 9
              
// in src/org/argouml/uml/diagram/ui/ArgoFigText.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/profile/Profile.java
protected final void addProfileDependency(Profile p) throws IllegalArgumentException { addProfileDependency(p.getProfileIdentifier()); }
// in src/org/argouml/gefext/ArgoFigRRect.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigSpline.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigLine.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigCircle.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigPoly.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigRect.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigInk.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
(Lib) ParseException 83
              
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
protected void parseAssociationEnd(Object role, String text) throws ParseException { MyTokenizer st; String name = null; StringBuilder stereotype = null; String token; boolean derived = false; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.association-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else { if (name != null) { String msg = "parsing.error.association-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); } catch (ParseException pre) { throw pre; } dealWithDerived(role, derived); if (name != null) { name = name.trim(); } if (name != null && name.startsWith("+")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPublic()); } if (name != null && name.startsWith("-")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPrivate()); } if (name != null && name.startsWith("#")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getProtected()); } if (name != null && name.startsWith("~")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPackage()); } if (name != null) { Model.getCoreHelper().setName(role, name); } StereotypeUtility.dealWithStereotypes(role, stereotype, true); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
protected Object parseObjectFlowState1(Object objectFlowState, String s) throws ParseException { Object c = Model.getActivityGraphsHelper() .findClassifierByName(objectFlowState, s); if (c != null) { /* Great! The class already existed - just use it. */ Model.getCoreHelper().setType(objectFlowState, c); return objectFlowState; } /* Let's create a class with the given name, otherwise * the user will not understand why we refuse his input! */ if (s != null && s.length() > 0) { Object topState = Model.getFacade().getContainer(objectFlowState); if (topState != null) { Object machine = Model.getFacade().getStateMachine(topState); if (machine != null) { Object ns = Model.getFacade().getNamespace(machine); if (ns != null) { Object clazz = Model.getCoreFactory().buildClass(s, ns); Model.getCoreHelper().setType(objectFlowState, clazz); return objectFlowState; } } } } String msg = "parsing.error.object-flow-type.classifier-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
protected Object parseTransition(Object trans, String s) throws ParseException { s = s.trim(); int a = s.indexOf("["); int b = s.indexOf("]"); int c = s.indexOf("/"); if (((a < 0) && (b >= 0)) || ((b < 0) && (a >= 0)) || (b < a)) { String msg = "parsing.error.transition.no-matching-square-brackets"; throw new ParseException(Translator.localize(msg), 0); } if ((c >= 0) && (c < b) && (c > a) && (a > 0)) { String msg = "parsing.error.transition.found-bracket-instead-slash"; throw new ParseException(Translator.localize(msg), 0); } String[] s1 = s.trim().split("/", 2); String eg = s1[0].trim(); String[] s2 = eg.split("\\[", 2); if (s2[0].trim().length() > 0) { parseTrigger(trans, s2[0].trim()); } if (s2.length > 1) { if (s2[1].trim().endsWith("]")) { String g = s2[1].trim(); g = g.substring(0, g.length() - 1).trim(); if (g.length() > 0) { parseGuard(trans, g); } } } if (s1.length > 1) { if (s1[1].trim().length() > 0) { parseEffect(trans, s1[1].trim()); } } return trans; }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
private void parseTrigger(Object trans, String trigger) throws ParseException { // let's look for a TimeEvent, ChangeEvent, CallEvent or SignalEvent String s = ""; boolean timeEvent = false; boolean changeEvent = false; boolean callEvent = false; boolean signalEvent = false; trigger = trigger.trim(); StringTokenizer tokenizer = new StringTokenizer(trigger, "()"); String name = tokenizer.nextToken().trim(); if (name.equalsIgnoreCase("after")) { timeEvent = true; } else if (name.equalsIgnoreCase("when")) { changeEvent = true; } else { // the part after the || is for when there's nothing between the () if (tokenizer.hasMoreTokens() || (trigger.indexOf("(") > 0) || (trigger.indexOf(")") > 1)) { callEvent = true; if (!trigger.endsWith(")") || !(trigger.indexOf("(") > 0)) { String msg = "parsing.error.transition.no-matching-brackets"; throw new ParseException( Translator.localize(msg), 0); } } else { signalEvent = true; } } if (timeEvent || changeEvent || callEvent) { if (tokenizer.hasMoreTokens()) { s = tokenizer.nextToken().trim(); } // else the empty s will do } /* * We can distinguish between 4 cases: * 1. A trigger is given. None exists yet. * 2. The trigger was present, and it is the same type, * or a different type, and its text is changed, or the same. * 3. A trigger is not given. None exists yet. * 4. The name of the trigger was present, but is removed. * The reaction in these cases should be: * 1. Find the referred trigger (issue 5988) or create a new one, and hook it to the transition. * 2. Rename the trigger. * 3. Nop. * 4. Unhook and erase the existing trigger. */ Object evt = Model.getFacade().getTrigger(trans); /* It is safe to give a null to the next function, * since a statemachine is always composed by a model anyhow. */ Object ns = Model.getStateMachinesHelper() .findNamespaceForEvent(trans, null); StateMachinesFactory sMFactory = Model.getStateMachinesFactory(); boolean weHaveAnEvent = false; if (trigger.length() > 0) { // case 1 and 2 if (evt == null) { // case 1 if (timeEvent) { // after(...) evt = findOrBuildTimeEvent(s, ns); /* Do not set the name. */ } if (changeEvent) { // when(...) evt = findOrBuildChangeEvent(s, ns); /* Do not set the name. */ } if (callEvent) { // operation(paramlist) String triggerName = trigger.indexOf("(") > 0 ? trigger.substring(0, trigger.indexOf("(")).trim() : trigger; /* This case is a bit different, because of the parameters. * If the event already exists, the parameters are ignored. */ evt = findCallEvent(triggerName, ns); if (evt == null) { evt = sMFactory.buildCallEvent(trans, triggerName, ns); // and parse the parameter list NotationUtilityUml.parseParamList(evt, s, 0); } } if (signalEvent) { // signalname evt = findOrBuildSignalEvent(trigger, ns); } weHaveAnEvent = true; } else { // case 2 if (timeEvent) { if (Model.getFacade().isATimeEvent(evt)) { /* Just change the time expression */ Object timeExpr = Model.getFacade().getWhen(evt); if (timeExpr == null) { // we have an event without expression timeExpr = Model.getDataTypesFactory().createTimeExpression("", s); Model.getStateMachinesHelper().setWhen(evt, timeExpr); } else { Model.getDataTypesHelper().setBody(timeExpr, s); } } else { /* It's a time-event now, * but was of another type before! */ delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildTimeEvent(s, ns); weHaveAnEvent = true; } } if (changeEvent) { if (Model.getFacade().isAChangeEvent(evt)) { /* Just change the ChangeExpression */ Object changeExpr = Model.getFacade().getChangeExpression(evt); if (changeExpr == null) { /* Create a new expression: */ changeExpr = Model.getDataTypesFactory() .createBooleanExpression("", s); Model.getStateMachinesHelper().setExpression(evt, changeExpr); } else { Model.getDataTypesHelper().setBody(changeExpr, s); } } else { /* The parsed text describes a change-event, * but the model contains another type! */ delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildChangeEvent(s, ns); weHaveAnEvent = true; } } if (callEvent) { if (Model.getFacade().isACallEvent(evt)) { /* Just change the Name and linked operation */ String triggerName = trigger.indexOf("(") > 0 ? trigger.substring(0, trigger.indexOf("(")).trim() : trigger; if (!Model.getFacade().getName(evt) .equals(triggerName)) { Model.getCoreHelper().setName(evt, triggerName); } /* TODO: Change the linked operation. */ } else { delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildCallEvent(trans, trigger, ns); // and parse the parameter list NotationUtilityUml.parseParamList(evt, s, 0); weHaveAnEvent = true; } } if (signalEvent) { if (Model.getFacade().isASignalEvent(evt)) { /* Just change the Name and linked signal */ if (!Model.getFacade().getName(evt).equals(trigger)) { Model.getCoreHelper().setName(evt, trigger); } /* TODO: link to the Signal. */ } else { delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildSignalEvent(trigger, ns); weHaveAnEvent = true; } } } if (weHaveAnEvent && (evt != null)) { Model.getStateMachinesHelper().setEventAsTrigger(trans, evt); } } else { // case 3 and 4 if (evt == null) { /* case 3 */ } else { // case 4 delete(evt); // erase it } } }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
protected void parseRole(Object role, String text) throws ParseException { String token; boolean hasColon = false; boolean hasSlash = false; String rolestr = null; String basestr = null; MyTokenizer st = new MyTokenizer(text, " ,\t,/,:"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { /* Do nothing. */ } else if ("/".equals(token)) { hasSlash = true; hasColon = false; } else if (":".equals(token)) { hasColon = true; hasSlash = false; } else if (hasColon) { if (basestr != null) { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } basestr = token; } else if (hasSlash) { if (rolestr != null) { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } rolestr = token; } else { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } } if (basestr == null) { /* If no base was typed, then only set the name: */ if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } /* If the base was not changed, then only set the name: */ Object currentBase = Model.getFacade().getBase(role); if (currentBase != null) { String currentBaseStr = Model.getFacade().getName(currentBase); if (currentBaseStr == null) { /* TODO: Is this needed? */ currentBaseStr = ""; } if (currentBaseStr.equals(basestr)) { if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } } Collection c = Model.getCollaborationsHelper().getAllPossibleBases(role); Iterator i = c.iterator(); while (i.hasNext()) { Object candidate = i.next(); if (basestr.equals(Model.getFacade().getName(candidate))) { if (Model.getFacade().getBase(role) != candidate) { /* If the base is already set to this assoc, * then do not set it again. * This check is needed, otherwise the setbase() * below gives an exception.*/ Model.getCollaborationsHelper().setBase(role, candidate); } /* Only set the name if the base was found: */ if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } } String msg = "parsing.error.association-role.base-not-found"; throw new ParseException(Translator.localize(msg), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
Deprecated protected Object parseMultiplicity(final Object multiplicityOwner, final String s1) throws ParseException { String s = s1.trim(); Object multi = null; try { multi = Model.getDataTypesFactory().createMultiplicity(s); } catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); } setMultiplicity(multiplicityOwner, s1); return multi; }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
protected void setMultiplicity(final Object multiplicityOwner, final String arg) throws ParseException { try { Model.getCoreHelper().setMultiplicity(multiplicityOwner, arg); } catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); } }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
protected static void parseModelElement(Object me, String text) throws ParseException { MyTokenizer st; List<String> path = null; String name = null; StringBuilder stereotype = null; String token; try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>,::"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.model-element-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else if ("::".equals(token)) { if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.anon-qualifiers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (path == null) { path = new ArrayList<String>(); } if (name != null) { path.add(name); } name = null; } else { if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.must-end-with-name"; throw new ParseException(Translator.localize(msg), 0); } if (name != null && name.startsWith("+")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPublic()); } if (name != null && name.startsWith("-")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPrivate()); } if (name != null && name.startsWith("#")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getProtected()); } if (name != null && name.startsWith("~")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPackage()); } if (name != null) { Model.getCoreHelper().setName(me, name); } StereotypeUtility.dealWithStereotypes(me, stereotype, false); if (path != null) { Object nspe = Model.getModelManagementHelper().getElement( path, Model.getFacade().getRoot(me)); if (nspe == null || !(Model.getFacade().isANamespace(nspe))) { String msg = "parsing.error.model-element-name.namespace-unresolved"; throw new ParseException(Translator.localize(msg), 0); } if (!Model.getCoreHelper().isValidNamespace(me, nspe)) { String msg = "parsing.error.model-element-name.namespace-invalid"; throw new ParseException(Translator.localize(msg), 0); } Model.getCoreHelper().addOwnedElement(nspe, me); } }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
static void parseParamList(Object op, String param, int paramOffset) throws ParseException { MyTokenizer st = new MyTokenizer(param, " ,\t,:,=,\\,", parameterCustomSep); // Copy returned parameters because it will be a live collection for MDR Collection origParam = new ArrayList(Model.getFacade().getParameters(op)); Object ns = Model.getFacade().getRoot(op); if (Model.getFacade().isAOperation(op)) { Object ow = Model.getFacade().getOwner(op); if (ow != null && Model.getFacade().getNamespace(ow) != null) { ns = Model.getFacade().getNamespace(ow); } } Iterator it = origParam.iterator(); while (st.hasMoreTokens()) { String kind = null; String name = null; String tok; String type = null; StringBuilder value = null; Object p = null; boolean hasColon = false; boolean hasEq = false; while (it.hasNext() && p == null) { p = it.next(); if (Model.getFacade().isReturn(p)) { p = null; } } while (st.hasMoreTokens()) { tok = st.nextToken(); if (",".equals(tok)) { break; } else if (" ".equals(tok) || "\t".equals(tok)) { if (hasEq) { value.append(tok); } } else if (":".equals(tok)) { hasColon = true; hasEq = false; } else if ("=".equals(tok)) { if (value != null) { String msg = "parsing.error.notation-utility.two-default-values"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } hasEq = true; hasColon = false; value = new StringBuilder(); } else if (hasColon) { if (type != null) { String msg = "parsing.error.notation-utility.two-types"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') { String msg = "parsing.error.notation-utility.type-quoted"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '(') { String msg = "parsing.error.notation-utility.type-expr"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } type = tok; } else if (hasEq) { value.append(tok); } else { if (name != null && kind != null) { String msg = "parsing.error.notation-utility.extra-text"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') { String msg = "parsing.error.notation-utility.name-kind-quoted"; throw new ParseException( Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '(') { String msg = "parsing.error.notation-utility.name-kind-expr"; throw new ParseException( Translator.localize(msg), paramOffset + st.getTokenIndex()); } kind = name; name = tok; } } if (p == null) { /* Leave the type undefined (see issue 6145): */ p = Model.getCoreFactory().buildParameter(op, null); } if (name != null) { Model.getCoreHelper().setName(p, name.trim()); } if (kind != null) { setParamKind(p, kind.trim()); } if (type != null) { Model.getCoreHelper().setType(p, getType(type.trim(), ns)); } if (value != null) { // TODO: Find a better default language // TODO: We should know the notation language, since it is us Project project = ProjectManager.getManager().getCurrentProject(); ProjectSettings ps = project.getProjectSettings(); String notationLanguage = ps.getNotationLanguage(); Object initExpr = Model.getDataTypesFactory() .createExpression( notationLanguage, value.toString().trim()); Model.getCoreHelper().setDefaultValue(p, initExpr); } } while (it.hasNext()) { Object p = it.next(); if (!Model.getFacade().isReturn(p)) { Model.getCoreHelper().removeParameter(op, p); Model.getUmlFactory().delete(p); } } }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
protected void parseEnumerationLiteral(String text, Object literal) throws ParseException { text = text.trim(); if (text.length() == 0) { return; } // strip any trailing semi-colons if (text.charAt(text.length() - 1) == ';') { text = text.substring(0, text.length() - 2); } MyTokenizer st; String name = null; StringBuilder stereotype = null; String token; try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.model-element-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else { if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (name != null) { Model.getCoreHelper().setName(literal, name); } StereotypeUtility.dealWithStereotypes(literal, stereotype, false); return; }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
private void parseError(String message, int offset) throws ParseException { throw new ParseException( Translator.localize("parsing.error." + message), offset); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
private List<String> tokenOpenBrace(MyTokenizer st, List<String> properties) throws ParseException { String token; StringBuilder propname = new StringBuilder(); String propvalue = null; if (properties == null) { properties = new ArrayList<String>(); } while (true) { token = st.nextToken(); if (",".equals(token) || "}".equals(token)) { if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } propname = new StringBuilder(); propvalue = null; if ("}".equals(token)) { break; } } else if ("=".equals(token)) { if (propvalue != null) { String msg = "parsing.error.operation.prop-stereotypes"; Object[] args = {propname}; throw new ParseException( Translator.localize(msg, args), st.getTokenIndex()); } propvalue = ""; } else if (propvalue == null) { propname.append(token); } else { propvalue += token; } } if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } return properties; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void parseMessage(Object umlMessage, String s) throws ParseException { String fname = null; // the condition or iteration expression (recurrence): StringBuilder guard = null; String paramExpr = null; String token; StringBuilder varname = null; List<List> predecessors = new ArrayList<List>(); List<Integer> seqno = null; List<Integer> currentseq = new ArrayList<Integer>(); // List<String> args = null; boolean mustBePre = false; boolean mustBeSeq = false; boolean parallell = false; boolean iterative = false; boolean mayDeleteExpr = false; boolean refindOperation = false; boolean hasPredecessors = false; currentseq.add(null); currentseq.add(null); try { MyTokenizer st = new MyTokenizer(s, " ,\t,*,[,],.,:,=,/,\\,", MyTokenizer.PAREN_EXPR_STRING_SEPARATOR); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { if (currentseq == null) { if (varname != null && fname == null) { varname.append(token); } } } else if ("[".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-unqualified"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (guard != null) { String msg = "parsing.error.message.several-specs"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } guard = new StringBuilder(); while (true) { token = st.nextToken(); if ("]".equals(token)) { break; } guard.append(token); } } else if ("*".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-unqualified"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (currentseq != null) { iterative = true; } } else if (".".equals(token)) { if (currentseq == null) { String msg = "parsing.error.message.unexpected-dot"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { currentseq.add(null); currentseq.add(null); } } else if (":".equals(token)) { if (st.hasMoreTokens()) { String t = st.nextToken(); if ("=".equals(t)) { st.putToken(":="); continue; } st.putToken(t); } if (mustBePre) { String msg = "parsing.error.message.pred-colon"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (currentseq != null) { if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } seqno = currentseq; currentseq = null; mayDeleteExpr = true; } } else if ("/".equals(token)) { if (st.hasMoreTokens()) { String t = st.nextToken(); if ("/".equals(t)) { st.putToken("//"); continue; } st.putToken(t); } if (mustBeSeq) { String msg = "parsing.error.message.sequence-slash"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBePre = false; mustBeSeq = true; if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { predecessors.add(currentseq); currentseq = new ArrayList<Integer>(); currentseq.add(null); currentseq.add(null); } hasPredecessors = true; } else if ("//".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-parallelized"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (currentseq != null) { parallell = true; } } else if (",".equals(token)) { if (currentseq != null) { if (mustBeSeq) { String msg = "parsing.error.message.many-numbers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBePre = true; if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { predecessors.add(currentseq); currentseq = new ArrayList<Integer>(); currentseq.add(null); currentseq.add(null); } hasPredecessors = true; } else { if (varname == null && fname != null) { varname = new StringBuilder(fname + token); fname = null; } else if (varname != null && fname == null) { varname.append(token); } else { String msg = "parsing.error.message.found-comma"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } } } else if ("=".equals(token) || ":=".equals(token)) { if (currentseq == null) { if (varname == null) { varname = new StringBuilder(fname); fname = ""; } else { fname = ""; } } } else if (currentseq == null) { if (paramExpr == null && token.charAt(0) == '(') { if (token.charAt(token.length() - 1) != ')') { String msg = "parsing.error.message.malformed-parameters"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (fname == null || "".equals(fname)) { String msg = "parsing.error.message.function-not-found"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (varname == null) { varname = new StringBuilder(); } paramExpr = token.substring(1, token.length() - 1); } else if (varname != null && fname == null) { varname.append(token); } else if (fname == null || fname.length() == 0) { fname = token; } else { String msg = "parsing.error.message.unexpected-token"; Object[] parseExcArgs = {token}; throw new ParseException( Translator.localize(msg, parseExcArgs), st.getTokenIndex()); } } else { boolean hasVal = currentseq.get(currentseq.size() - 2) != null; boolean hasOrd = currentseq.get(currentseq.size() - 1) != null; boolean assigned = false; int bp = findMsgOrderBreak(token); if (!hasVal && !assigned && bp == token.length()) { try { currentseq.set( currentseq.size() - 2, Integer.valueOf( token)); assigned = true; } catch (NumberFormatException nfe) { } } if (!hasOrd && !assigned && bp == 0) { try { currentseq.set( currentseq.size() - 1, Integer.valueOf( parseMsgOrder(token))); assigned = true; } catch (NumberFormatException nfe) { } } if (!hasVal && !hasOrd && !assigned && bp > 0 && bp < token.length()) { Integer nbr, ord; try { nbr = Integer.valueOf(token.substring(0, bp)); ord = Integer.valueOf( parseMsgOrder(token.substring(bp))); currentseq.set(currentseq.size() - 2, nbr); currentseq.set(currentseq.size() - 1, ord); assigned = true; } catch (NumberFormatException nfe) { } } if (!assigned) { String msg = "parsing.error.message.unexpected-token"; Object[] parseExcArgs = {token}; throw new ParseException( Translator.localize(msg, parseExcArgs), st.getTokenIndex()); } } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); } catch (ParseException pre) { throw pre; } List<String> args = parseArguments(paramExpr, mayDeleteExpr); printDebugInfo(s, fname, guard, paramExpr, varname, predecessors, seqno, parallell, iterative); /* Now apply the changes to the model: */ buildAction(umlMessage); handleGuard(umlMessage, guard, parallell, iterative); fname = fillBlankFunctionName(umlMessage, fname, mayDeleteExpr); varname = fillBlankVariableName(umlMessage, varname, mayDeleteExpr); refindOperation = handleFunctionName(umlMessage, fname, varname, refindOperation); refindOperation = handleArguments(umlMessage, args, refindOperation); refindOperation = handleSequenceNumber(umlMessage, seqno, refindOperation); handleOperation(umlMessage, fname, refindOperation); handlePredecessors(umlMessage, predecessors, hasPredecessors); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void handlePredecessors(Object umlMessage, List<List> predecessors, boolean hasPredecessors) throws ParseException { // Predecessors used to be not implemented, because it // caused some problems that I've not found an easy way to handle yet, // d00mst. The specific problem is that the notation currently is // ambiguous on second message after a thread split. // Why not implement it anyway? d00mst // TODO: Document this ambiguity and the choice made. if (hasPredecessors) { Collection roots = findCandidateRoots( Model.getFacade().getMessages( Model.getFacade().getInteraction(umlMessage)), null, null); List<Object> pre = new ArrayList<Object>(); predfor: for (int i = 0; i < predecessors.size(); i++) { for (Object root : roots) { Object msg = walkTree(root, predecessors.get(i)); if (msg != null && msg != umlMessage) { if (isBadPreMsg(umlMessage, msg)) { String parseMsg = "parsing.error.message.one-pred"; throw new ParseException( Translator.localize(parseMsg), 0); } pre.add(msg); continue predfor; } } String parseMsg = "parsing.error.message.pred-not-found"; throw new ParseException(Translator.localize(parseMsg), 0); } MsgPtr ptr = new MsgPtr(); recCountPredecessors(umlMessage, ptr); if (ptr.message != null && !pre.contains(ptr.message)) { pre.add(ptr.message); } Model.getCollaborationsHelper().setPredecessors(umlMessage, pre); } }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected boolean handleSequenceNumber(Object umlMessage, List<Integer> seqno, boolean refindOperation) throws ParseException { int i; if (seqno != null) { Object/* MMessage */root; // Find the preceding message, if any, on either end of the // association. StringBuilder pname = new StringBuilder(); StringBuilder mname = new StringBuilder(); String gname = generateMessageNumber(umlMessage); boolean swapRoles = false; int majval = 0; if (seqno.get(seqno.size() - 2) != null) { majval = Math.max((seqno.get(seqno.size() - 2)).intValue() - 1, 0); } int minval = 0; if (seqno.get(seqno.size() - 1) != null) { minval = Math.max((seqno.get(seqno.size() - 1)).intValue(), 0); } for (i = 0; i + 1 < seqno.size(); i += 2) { int bv = 1; if (seqno.get(i) != null) { bv = Math.max((seqno.get(i)).intValue(), 1); } int sv = 0; if (seqno.get(i + 1) != null) { sv = Math.max((seqno.get(i + 1)).intValue(), 0); } if (i > 0) { mname.append("."); } mname.append(Integer.toString(bv) + (char) ('a' + sv)); if (i + 3 < seqno.size()) { if (i > 0) { pname.append("."); } pname.append(Integer.toString(bv) + (char) ('a' + sv)); } } root = null; if (pname.length() > 0) { root = findMsg(Model.getFacade().getSender(umlMessage), pname.toString()); if (root == null) { root = findMsg(Model.getFacade().getReceiver(umlMessage), pname.toString()); if (root != null) { swapRoles = true; } } } else if (!hasMsgWithActivator(Model.getFacade().getSender(umlMessage), null) && hasMsgWithActivator(Model.getFacade().getReceiver(umlMessage), null)) { swapRoles = true; } if (compareMsgNumbers(mname.toString(), gname.toString())) { // Do nothing } else if (isMsgNumberStartOf(gname.toString(), mname.toString())) { String msg = "parsing.error.message.subtree-rooted-self"; throw new ParseException(Translator.localize(msg), 0); } else if (Model.getFacade().getPredecessors(umlMessage).size() > 1 && Model.getFacade().getSuccessors(umlMessage).size() > 1) { String msg = "parsing.error.message.start-end-many-threads"; throw new ParseException(Translator.localize(msg), 0); } else if (root == null && pname.length() > 0) { String msg = "parsing.error.message.activator-not-found"; throw new ParseException(Translator.localize(msg), 0); } else if (swapRoles && Model.getFacade().getActivatedMessages(umlMessage).size() > 0 && (Model.getFacade().getSender(umlMessage) != Model.getFacade().getReceiver(umlMessage))) { String msg = "parsing.error.message.reverse-direction-message"; throw new ParseException(Translator.localize(msg), 0); } else { /* Disconnect the message from the call graph * Make copies of returned live collections * since we're modifying */ Collection c = new ArrayList( Model.getFacade().getPredecessors(umlMessage)); Collection c2 = new ArrayList( Model.getFacade().getSuccessors(umlMessage)); Iterator it; it = c2.iterator(); while (it.hasNext()) { Model.getCollaborationsHelper().removeSuccessor(umlMessage, it.next()); } it = c.iterator(); while (it.hasNext()) { Iterator it2 = c2.iterator(); Object pre = /* (MMessage) */it.next(); Model.getCollaborationsHelper().removePredecessor(umlMessage, pre); while (it2.hasNext()) { Model.getCollaborationsHelper().addPredecessor( it2.next(), pre); } } // Connect the message at a new spot Model.getCollaborationsHelper().setActivator(umlMessage, root); if (swapRoles) { Object/* MClassifierRole */r = Model.getFacade().getSender(umlMessage); Model.getCollaborationsHelper().setSender(umlMessage, Model.getFacade().getReceiver(umlMessage)); Model.getCommonBehaviorHelper().setReceiver(umlMessage, r); } if (root == null) { c = filterWithActivator( Model.getFacade().getSentMessages( Model.getFacade().getSender(umlMessage)), null); } else { c = Model.getFacade().getActivatedMessages(root); } c2 = findCandidateRoots(c, root, umlMessage); it = c2.iterator(); // If c2 is empty, then we're done (or there is a // cycle in the message graph, which would be bad) If // c2 has more than one element, then the model is // crappy, but we'll just use one of them anyway if (majval <= 0) { while (it.hasNext()) { Model.getCollaborationsHelper().addSuccessor(umlMessage, /* (MMessage) */it.next()); } } else if (it.hasNext()) { Object/* MMessage */pre = walk(/* (MMessage) */it.next(), majval - 1, false); Object/* MMessage */post = successor(pre, minval); if (post != null) { Model.getCollaborationsHelper() .removePredecessor(post, pre); Model.getCollaborationsHelper() .addPredecessor(post, umlMessage); } insertSuccessor(pre, umlMessage, minval); } refindOperation = true; } } return refindOperation; }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
protected Object parseObjectFlowState2(Object objectFlowState, String s) throws ParseException { s = s.trim(); /* Let's not be picky about the brackets - just remove them: */ if (s.startsWith("[")) { s = s.substring(1); } if (s.endsWith("]")) { s = s.substring(0, s.length() - 1); } s = s.trim(); Object c = Model.getFacade().getType(objectFlowState); // get the // classifier if (c != null) { if (Model.getFacade().isAClassifierInState(c)) { Object classifier = Model.getFacade().getType(c); if ((s == null) || "".equals(s)) { // the State of a ClassifierInState is removed, // so let's reduce it to a Classifier. Model.getCoreHelper().setType(objectFlowState, classifier); delete(c); Model.getCoreHelper().setType(objectFlowState, classifier); return objectFlowState; // the model is changed - job done } Collection states = new ArrayList(Model.getFacade() .getInStates(c)); Collection statesToBeRemoved = new ArrayList(states); Collection namesToBeAdded = new ArrayList(); // Strings StringTokenizer tokenizer = new StringTokenizer(s, ","); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); boolean found = false; Iterator i = states.iterator(); while (i.hasNext()) { Object state = i.next(); if (Model.getFacade().getName(state) == nextToken) { found = true; statesToBeRemoved.remove(state); } } if (!found) { namesToBeAdded.add(nextToken); } } /* Remove the states that did not match. */ states.removeAll(statesToBeRemoved); Iterator i = namesToBeAdded.iterator(); while (i.hasNext()) { String name = (String) i.next(); /* * Now we have to see if any state in any statemachine of * classifier is named [name]. If so, then we only have to * link the state to c. */ Object state = Model.getActivityGraphsHelper() .findStateByName(classifier, name); if (state != null) { states.add(state); // the model is changed - our job is done } else { // no state named s is found, so we have to // reject the user's input String msg = "parsing.error.object-flow-state.state-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); } } /* Finally, do the adaptations: */ Model.getActivityGraphsHelper().setInStates(c, states); } else { // then c is a "normal" Classifier Collection statesToBeAdded = new ArrayList(); // UML states StringTokenizer tokenizer = new StringTokenizer(s, ","); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); Object state = Model.getActivityGraphsHelper() .findStateByName(c, nextToken); if (state != null) { statesToBeAdded.add(state); } else { // no state with the given name is found, so we have to // reject the complete user's input String msg = "parsing.error.object-flow-state.state-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); } } // let's create a new ClassifierInState with the correct links Object cis = Model.getActivityGraphsFactory() .buildClassifierInState(c, statesToBeAdded); Model.getCoreHelper().setType(objectFlowState, cis); // the model is changed - our job is done } } else { // if no classifier has been set, then entering a state is // not useful, so the user's input has to be rejected. String msg = "parsing.error.object-flow-state.classifier-not-found"; throw new ParseException(Translator.localize(msg), 0); } return objectFlowState; }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
protected Object parseClassifierRole(Object cls, String s) throws ParseException { String name = null; String token; String role = null; String base = null; List<String> bases = null; boolean hasColon = false; boolean hasSlash = false; try { MyTokenizer st = new MyTokenizer(s, " ,\t,/,:,\\,"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { /* Do nothing. */ } else if ("/".equals(token)) { hasSlash = true; hasColon = false; if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } base = null; } else if (":".equals(token)) { hasColon = true; hasSlash = false; if (bases == null) { bases = new ArrayList<String>(); } if (base != null) { bases.add(base); } base = null; } else if (",".equals(token)) { if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } base = null; } else if (hasColon) { if (base != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } base = token; } else if (hasSlash) { if (role != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } role = token; } else { if (name != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); } if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } // TODO: What to do about object name??? // if (name != null) // ; if (role != null) { Model.getCoreHelper().setName(cls, role.trim()); } if (bases != null) { // Remove bases that aren't there anymore // copy - can't iterate modify live collection while iterating it Collection b = new ArrayList(Model.getFacade().getBases(cls)); Iterator it = b.iterator(); Object c; Object ns = Model.getFacade().getNamespace(cls); if (ns != null && Model.getFacade().getNamespace(ns) != null) { ns = Model.getFacade().getNamespace(ns); } else { ns = Model.getFacade().getRoot(cls); } while (it.hasNext()) { c = it.next(); if (!bases.contains(Model.getFacade().getName(c))) { Model.getCollaborationsHelper().removeBase(cls, c); } } it = bases.iterator(); addBases: while (it.hasNext()) { String d = ((String) it.next()).trim(); Iterator it2 = b.iterator(); while (it2.hasNext()) { c = it2.next(); if (d.equals(Model.getFacade().getName(c))) { continue addBases; } } c = NotationUtilityUml.getType(d, ns); if (Model.getFacade().isACollaboration( Model.getFacade().getNamespace(c))) { Model.getCoreHelper().setNamespace(c, ns); } Model.getCollaborationsHelper().addBase(cls, c); } } return cls; }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
protected Object parseCallState(Object callState, String s1) throws ParseException { String s = s1.trim(); int a = s.indexOf("("); int b = s.indexOf(")"); if (((a < 0) && (b >= 0)) || ((b < 0) && (a >= 0)) || (b < a)) { throw new ParseException("No matching brackets () found.", 0); } /* First we decode the string: */ String newClassName = null; String newOperationName = null; StringTokenizer tokenizer = new StringTokenizer(s, "("); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); if (nextToken.endsWith(")")) { newClassName = nextToken.substring(0, nextToken.length() - 1); } else { newOperationName = nextToken.trim(); } } /* Secondly we check the previous model structure: */ String oldOperationName = null; String oldClassName = null; Object entry = Model.getFacade().getEntry(callState); Object operation = null; Object clazz = null; if (Model.getFacade().isACallAction(entry)) { operation = Model.getFacade().getOperation(entry); if (Model.getFacade().isAOperation(operation)) { oldOperationName = Model.getFacade().getName(operation); clazz = Model.getFacade().getOwner(operation); oldClassName = Model.getFacade().getName(clazz); } } /* And 3rd, we adapt the model: */ boolean found = false; if ((newClassName != null) && newClassName.equals(oldClassName) && (newOperationName != null) && !newOperationName.equals(oldOperationName)) { // Same class, other operation for ( Object op : Model.getFacade().getOperations(clazz)) { if (newOperationName.equals( Model.getFacade().getName(op))) { Model.getCommonBehaviorHelper().setOperation(entry, op); found = true; break; } } if (!found) { throw new ParseException( "Operation " + newOperationName + " not found in " + newClassName + ".", 0); } } else if ((newClassName != null) && !newClassName.equals(oldClassName) && (newOperationName != null)) { // Other class Object model = ProjectManager.getManager().getCurrentProject().getRoot(); Collection c = Model.getModelManagementHelper(). getAllModelElementsOfKind(model, Model.getMetaTypes().getClassifier()); Iterator i = c.iterator(); Object classifier = null; while (i.hasNext()) { Object cl = i.next(); String cn = Model.getFacade().getName(cl); if (cn.equals(newClassName)) { classifier = cl; break; } } if (classifier == null) { throw new ParseException( "Classifier " + newClassName + " not found.", 0); } // We found the classifier, now go find the operation: if (classifier != null) { Collection ops = Model.getFacade().getOperations(classifier); Iterator io = ops.iterator(); while (io.hasNext()) { Object op = io.next(); if (newOperationName.equals( Model.getFacade().getName(op))) { /* Here we located the new classifier * with its operation. */ found = true; if (!Model.getFacade().isACallAction(entry)) { entry = Model.getCommonBehaviorFactory() .buildCallAction(op, "ca"); Model.getStateMachinesHelper().setEntry( callState, entry); } else { Model.getCommonBehaviorHelper().setOperation( entry, op); } break; } } if (!found) { throw new ParseException( "Operation " + newOperationName + " not found in " + newClassName + ".", 0); } } } if (!found) { throw new ParseException( "Incompatible input found.", 0); } return callState; }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
protected void parseAttribute( String text, Object attribute) throws ParseException { StringBuilder multiplicity = null; String name = null; List<String> properties = null; StringBuilder stereotype = null; // This is null as until // the first stereotype declaration is seen. // After that it is non-null. String token; String type = null; StringBuilder value = null; String visibility = null; boolean derived = false; boolean hasColon = false; boolean hasEq = false; int multindex = -1; MyTokenizer st; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } /* Handle Visibility: */ if (text.length() > 0 && NotationUtilityUml.VISIBILITYCHARS.indexOf(text.charAt(0)) >= 0) { visibility = text.substring(0, 1); text = text.substring(1); } try { st = new MyTokenizer(text, " ,\t,<<,\u00AB,\u00BB,>>,[,],:,=,{,},\\,", NotationUtilityUml.attributeCustomSep); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token) || ",".equals(token)) { if (hasEq) { value.append(token); } } else if ("<<".equals(token) || "\u00AB".equals(token)) { if (hasEq) { value.append(token); } else { if (stereotype != null) { String msg = "parsing.error.attribute.two-sets-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } } else if ("[".equals(token)) { if (hasEq) { value.append(token); } else { if (multiplicity != null) { String msg = "parsing.error.attribute.two-multiplicities"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } multiplicity = new StringBuilder(); multindex = st.getTokenIndex() + 1; while (true) { token = st.nextToken(); if ("]".equals(token)) { break; } multiplicity.append(token); } } } else if ("{".equals(token)) { StringBuilder propname = new StringBuilder(); String propvalue = null; if (properties == null) { properties = new ArrayList<String>(); } while (true) { token = st.nextToken(); if (",".equals(token) || "}".equals(token)) { if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } propname = new StringBuilder(); propvalue = null; if ("}".equals(token)) { break; } } else if ("=".equals(token)) { if (propvalue != null) { String msg = "parsing.error.attribute.prop-two-values"; Object[] args = {propvalue}; throw new ParseException(Translator.localize( msg, args), st.getTokenIndex()); } propvalue = ""; } else if (propvalue == null) { propname.append(token); } else { propvalue += token; } } if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } } else if (":".equals(token)) { hasColon = true; hasEq = false; } else if ("=".equals(token)) { if (value != null) { String msg = "parsing.error.attribute.two-default-values"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } value = new StringBuilder(); hasColon = false; hasEq = true; } else { if (hasColon) { if (type != null) { String msg = "parsing.error.attribute.two-types"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { String msg = "parsing.error.attribute.quoted"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { String msg = "parsing.error.attribute.is-expr"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } type = token; } else if (hasEq) { value.append(token); } else { if (name != null && visibility != null) { String msg = "parsing.error.attribute.extra-text"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { String msg = "parsing.error.attribute.name-quoted"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { String msg = "parsing.error.attribute.name-expr"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (name == null && visibility == null && token.length() > 1 && NotationUtilityUml.VISIBILITYCHARS .indexOf(token.charAt(0)) >= 0) { visibility = token.substring(0, 1); token = token.substring(1); } if (name != null) { visibility = name; name = token; } else { name = token; } } } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); } // catch & rethrow is not necessary if we don't do nothing (penyaskito) // catch (ParseException pre) { // throw pre; // } if (LOG.isDebugEnabled()) { LOG.debug("ParseAttribute [name: " + name + " visibility: " + visibility + " type: " + type + " value: " + value + " stereo: " + stereotype + " mult: " + multiplicity); if (properties != null) { for (int i = 0; i + 1 < properties.size(); i += 2) { LOG.debug("\tProperty [name: " + properties.get(i) + " = " + properties.get(i + 1) + "]"); } } } dealWithDerived(attribute, derived); dealWithVisibility(attribute, visibility); dealWithName(attribute, name); dealWithType(attribute, type); dealWithValue(attribute, value); dealWithMultiplicity(attribute, multiplicity, multindex); dealWithProperties(attribute, properties); StereotypeUtility.dealWithStereotypes(attribute, stereotype, true); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
private void dealWithMultiplicity(Object attribute, StringBuilder multiplicity, int multindex) throws ParseException { if (multiplicity != null) { try { Model.getCoreHelper().setMultiplicity(attribute, multiplicity.toString()); } catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); } } }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
static void parseModelElement(Object modelElement, String text) throws ParseException { MyTokenizer st; boolean abstrac = false; boolean fina = false; boolean publi = false; boolean privat = false; boolean protect = false; String token; List<String> path = null; String name = null; try { st = new MyTokenizer(text, " ,.,abstract,final,public,private,protected"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token)) { /* skip spaces */ } else if ("abstract".equals(token)) { abstrac = true; } else if ("final".equals(token)) { fina = true; } else if ("public".equals(token)) { publi = true; } else if ("private".equals(token)) { privat = true; } else if ("protected".equals(token)) { protect = true; } else if (".".equals(token)) { if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.anon-qualifiers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (path == null) { path = new ArrayList<String>(); } if (name != null) { path.add(name); } name = null; } else { // the name itself if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.must-end-with-name"; throw new ParseException(Translator.localize(msg), 0); } /* Check the name for validity: */ if (!isValidJavaClassName(name)) { throw new ParseException( "Invalid class name for Java: " + name, 0); } if (path != null) { Object nspe = Model.getModelManagementHelper().getElement( path, Model.getFacade().getRoot(modelElement)); if (nspe == null || !(Model.getFacade().isANamespace(nspe))) { String msg = "parsing.error.model-element-name.namespace-unresolved"; throw new ParseException(Translator.localize(msg), 0); } if (!Model.getCoreHelper().isValidNamespace( modelElement, nspe)) { String msg = "parsing.error.model-element-name.namespace-invalid"; throw new ParseException(Translator.localize(msg), 0); } Model.getCoreHelper().addOwnedElement(nspe, modelElement); } Model.getCoreHelper().setName(modelElement, name); if (abstrac) { Model.getCoreHelper().setAbstract(modelElement, abstrac); } if (fina) { Model.getCoreHelper().setLeaf(modelElement, fina); } if (publi) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getPublic()); } if (privat) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getPrivate()); } if (protect) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getProtected()); } }
10
              
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
29
              
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
protected void parseAssociationEnd(Object role, String text) throws ParseException { MyTokenizer st; String name = null; StringBuilder stereotype = null; String token; boolean derived = false; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.association-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else { if (name != null) { String msg = "parsing.error.association-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); } catch (ParseException pre) { throw pre; } dealWithDerived(role, derived); if (name != null) { name = name.trim(); } if (name != null && name.startsWith("+")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPublic()); } if (name != null && name.startsWith("-")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPrivate()); } if (name != null && name.startsWith("#")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getProtected()); } if (name != null && name.startsWith("~")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPackage()); } if (name != null) { Model.getCoreHelper().setName(role, name); } StereotypeUtility.dealWithStereotypes(role, stereotype, true); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
protected Object parseObjectFlowState1(Object objectFlowState, String s) throws ParseException { Object c = Model.getActivityGraphsHelper() .findClassifierByName(objectFlowState, s); if (c != null) { /* Great! The class already existed - just use it. */ Model.getCoreHelper().setType(objectFlowState, c); return objectFlowState; } /* Let's create a class with the given name, otherwise * the user will not understand why we refuse his input! */ if (s != null && s.length() > 0) { Object topState = Model.getFacade().getContainer(objectFlowState); if (topState != null) { Object machine = Model.getFacade().getStateMachine(topState); if (machine != null) { Object ns = Model.getFacade().getNamespace(machine); if (ns != null) { Object clazz = Model.getCoreFactory().buildClass(s, ns); Model.getCoreHelper().setType(objectFlowState, clazz); return objectFlowState; } } } } String msg = "parsing.error.object-flow-type.classifier-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
protected Object parseTransition(Object trans, String s) throws ParseException { s = s.trim(); int a = s.indexOf("["); int b = s.indexOf("]"); int c = s.indexOf("/"); if (((a < 0) && (b >= 0)) || ((b < 0) && (a >= 0)) || (b < a)) { String msg = "parsing.error.transition.no-matching-square-brackets"; throw new ParseException(Translator.localize(msg), 0); } if ((c >= 0) && (c < b) && (c > a) && (a > 0)) { String msg = "parsing.error.transition.found-bracket-instead-slash"; throw new ParseException(Translator.localize(msg), 0); } String[] s1 = s.trim().split("/", 2); String eg = s1[0].trim(); String[] s2 = eg.split("\\[", 2); if (s2[0].trim().length() > 0) { parseTrigger(trans, s2[0].trim()); } if (s2.length > 1) { if (s2[1].trim().endsWith("]")) { String g = s2[1].trim(); g = g.substring(0, g.length() - 1).trim(); if (g.length() > 0) { parseGuard(trans, g); } } } if (s1.length > 1) { if (s1[1].trim().length() > 0) { parseEffect(trans, s1[1].trim()); } } return trans; }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
private void parseTrigger(Object trans, String trigger) throws ParseException { // let's look for a TimeEvent, ChangeEvent, CallEvent or SignalEvent String s = ""; boolean timeEvent = false; boolean changeEvent = false; boolean callEvent = false; boolean signalEvent = false; trigger = trigger.trim(); StringTokenizer tokenizer = new StringTokenizer(trigger, "()"); String name = tokenizer.nextToken().trim(); if (name.equalsIgnoreCase("after")) { timeEvent = true; } else if (name.equalsIgnoreCase("when")) { changeEvent = true; } else { // the part after the || is for when there's nothing between the () if (tokenizer.hasMoreTokens() || (trigger.indexOf("(") > 0) || (trigger.indexOf(")") > 1)) { callEvent = true; if (!trigger.endsWith(")") || !(trigger.indexOf("(") > 0)) { String msg = "parsing.error.transition.no-matching-brackets"; throw new ParseException( Translator.localize(msg), 0); } } else { signalEvent = true; } } if (timeEvent || changeEvent || callEvent) { if (tokenizer.hasMoreTokens()) { s = tokenizer.nextToken().trim(); } // else the empty s will do } /* * We can distinguish between 4 cases: * 1. A trigger is given. None exists yet. * 2. The trigger was present, and it is the same type, * or a different type, and its text is changed, or the same. * 3. A trigger is not given. None exists yet. * 4. The name of the trigger was present, but is removed. * The reaction in these cases should be: * 1. Find the referred trigger (issue 5988) or create a new one, and hook it to the transition. * 2. Rename the trigger. * 3. Nop. * 4. Unhook and erase the existing trigger. */ Object evt = Model.getFacade().getTrigger(trans); /* It is safe to give a null to the next function, * since a statemachine is always composed by a model anyhow. */ Object ns = Model.getStateMachinesHelper() .findNamespaceForEvent(trans, null); StateMachinesFactory sMFactory = Model.getStateMachinesFactory(); boolean weHaveAnEvent = false; if (trigger.length() > 0) { // case 1 and 2 if (evt == null) { // case 1 if (timeEvent) { // after(...) evt = findOrBuildTimeEvent(s, ns); /* Do not set the name. */ } if (changeEvent) { // when(...) evt = findOrBuildChangeEvent(s, ns); /* Do not set the name. */ } if (callEvent) { // operation(paramlist) String triggerName = trigger.indexOf("(") > 0 ? trigger.substring(0, trigger.indexOf("(")).trim() : trigger; /* This case is a bit different, because of the parameters. * If the event already exists, the parameters are ignored. */ evt = findCallEvent(triggerName, ns); if (evt == null) { evt = sMFactory.buildCallEvent(trans, triggerName, ns); // and parse the parameter list NotationUtilityUml.parseParamList(evt, s, 0); } } if (signalEvent) { // signalname evt = findOrBuildSignalEvent(trigger, ns); } weHaveAnEvent = true; } else { // case 2 if (timeEvent) { if (Model.getFacade().isATimeEvent(evt)) { /* Just change the time expression */ Object timeExpr = Model.getFacade().getWhen(evt); if (timeExpr == null) { // we have an event without expression timeExpr = Model.getDataTypesFactory().createTimeExpression("", s); Model.getStateMachinesHelper().setWhen(evt, timeExpr); } else { Model.getDataTypesHelper().setBody(timeExpr, s); } } else { /* It's a time-event now, * but was of another type before! */ delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildTimeEvent(s, ns); weHaveAnEvent = true; } } if (changeEvent) { if (Model.getFacade().isAChangeEvent(evt)) { /* Just change the ChangeExpression */ Object changeExpr = Model.getFacade().getChangeExpression(evt); if (changeExpr == null) { /* Create a new expression: */ changeExpr = Model.getDataTypesFactory() .createBooleanExpression("", s); Model.getStateMachinesHelper().setExpression(evt, changeExpr); } else { Model.getDataTypesHelper().setBody(changeExpr, s); } } else { /* The parsed text describes a change-event, * but the model contains another type! */ delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildChangeEvent(s, ns); weHaveAnEvent = true; } } if (callEvent) { if (Model.getFacade().isACallEvent(evt)) { /* Just change the Name and linked operation */ String triggerName = trigger.indexOf("(") > 0 ? trigger.substring(0, trigger.indexOf("(")).trim() : trigger; if (!Model.getFacade().getName(evt) .equals(triggerName)) { Model.getCoreHelper().setName(evt, triggerName); } /* TODO: Change the linked operation. */ } else { delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildCallEvent(trans, trigger, ns); // and parse the parameter list NotationUtilityUml.parseParamList(evt, s, 0); weHaveAnEvent = true; } } if (signalEvent) { if (Model.getFacade().isASignalEvent(evt)) { /* Just change the Name and linked signal */ if (!Model.getFacade().getName(evt).equals(trigger)) { Model.getCoreHelper().setName(evt, trigger); } /* TODO: link to the Signal. */ } else { delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildSignalEvent(trigger, ns); weHaveAnEvent = true; } } } if (weHaveAnEvent && (evt != null)) { Model.getStateMachinesHelper().setEventAsTrigger(trans, evt); } } else { // case 3 and 4 if (evt == null) { /* case 3 */ } else { // case 4 delete(evt); // erase it } } }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
protected void parseRole(Object role, String text) throws ParseException { String token; boolean hasColon = false; boolean hasSlash = false; String rolestr = null; String basestr = null; MyTokenizer st = new MyTokenizer(text, " ,\t,/,:"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { /* Do nothing. */ } else if ("/".equals(token)) { hasSlash = true; hasColon = false; } else if (":".equals(token)) { hasColon = true; hasSlash = false; } else if (hasColon) { if (basestr != null) { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } basestr = token; } else if (hasSlash) { if (rolestr != null) { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } rolestr = token; } else { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } } if (basestr == null) { /* If no base was typed, then only set the name: */ if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } /* If the base was not changed, then only set the name: */ Object currentBase = Model.getFacade().getBase(role); if (currentBase != null) { String currentBaseStr = Model.getFacade().getName(currentBase); if (currentBaseStr == null) { /* TODO: Is this needed? */ currentBaseStr = ""; } if (currentBaseStr.equals(basestr)) { if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } } Collection c = Model.getCollaborationsHelper().getAllPossibleBases(role); Iterator i = c.iterator(); while (i.hasNext()) { Object candidate = i.next(); if (basestr.equals(Model.getFacade().getName(candidate))) { if (Model.getFacade().getBase(role) != candidate) { /* If the base is already set to this assoc, * then do not set it again. * This check is needed, otherwise the setbase() * below gives an exception.*/ Model.getCollaborationsHelper().setBase(role, candidate); } /* Only set the name if the base was found: */ if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } } String msg = "parsing.error.association-role.base-not-found"; throw new ParseException(Translator.localize(msg), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
Deprecated protected Object parseMultiplicity(final Object multiplicityOwner, final String s1) throws ParseException { String s = s1.trim(); Object multi = null; try { multi = Model.getDataTypesFactory().createMultiplicity(s); } catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); } setMultiplicity(multiplicityOwner, s1); return multi; }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
protected void setMultiplicity(final Object multiplicityOwner, final String arg) throws ParseException { try { Model.getCoreHelper().setMultiplicity(multiplicityOwner, arg); } catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); } }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
protected void parseAssociationName(Object modelElement, String text) throws ParseException { boolean derived = false; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } NotationUtilityUml.setDerived(modelElement, derived); NotationUtilityUml.parseModelElement(modelElement, text); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
protected static void parseModelElement(Object me, String text) throws ParseException { MyTokenizer st; List<String> path = null; String name = null; StringBuilder stereotype = null; String token; try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>,::"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.model-element-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else if ("::".equals(token)) { if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.anon-qualifiers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (path == null) { path = new ArrayList<String>(); } if (name != null) { path.add(name); } name = null; } else { if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.must-end-with-name"; throw new ParseException(Translator.localize(msg), 0); } if (name != null && name.startsWith("+")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPublic()); } if (name != null && name.startsWith("-")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPrivate()); } if (name != null && name.startsWith("#")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getProtected()); } if (name != null && name.startsWith("~")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPackage()); } if (name != null) { Model.getCoreHelper().setName(me, name); } StereotypeUtility.dealWithStereotypes(me, stereotype, false); if (path != null) { Object nspe = Model.getModelManagementHelper().getElement( path, Model.getFacade().getRoot(me)); if (nspe == null || !(Model.getFacade().isANamespace(nspe))) { String msg = "parsing.error.model-element-name.namespace-unresolved"; throw new ParseException(Translator.localize(msg), 0); } if (!Model.getCoreHelper().isValidNamespace(me, nspe)) { String msg = "parsing.error.model-element-name.namespace-invalid"; throw new ParseException(Translator.localize(msg), 0); } Model.getCoreHelper().addOwnedElement(nspe, me); } }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
static void parseParamList(Object op, String param, int paramOffset) throws ParseException { MyTokenizer st = new MyTokenizer(param, " ,\t,:,=,\\,", parameterCustomSep); // Copy returned parameters because it will be a live collection for MDR Collection origParam = new ArrayList(Model.getFacade().getParameters(op)); Object ns = Model.getFacade().getRoot(op); if (Model.getFacade().isAOperation(op)) { Object ow = Model.getFacade().getOwner(op); if (ow != null && Model.getFacade().getNamespace(ow) != null) { ns = Model.getFacade().getNamespace(ow); } } Iterator it = origParam.iterator(); while (st.hasMoreTokens()) { String kind = null; String name = null; String tok; String type = null; StringBuilder value = null; Object p = null; boolean hasColon = false; boolean hasEq = false; while (it.hasNext() && p == null) { p = it.next(); if (Model.getFacade().isReturn(p)) { p = null; } } while (st.hasMoreTokens()) { tok = st.nextToken(); if (",".equals(tok)) { break; } else if (" ".equals(tok) || "\t".equals(tok)) { if (hasEq) { value.append(tok); } } else if (":".equals(tok)) { hasColon = true; hasEq = false; } else if ("=".equals(tok)) { if (value != null) { String msg = "parsing.error.notation-utility.two-default-values"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } hasEq = true; hasColon = false; value = new StringBuilder(); } else if (hasColon) { if (type != null) { String msg = "parsing.error.notation-utility.two-types"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') { String msg = "parsing.error.notation-utility.type-quoted"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '(') { String msg = "parsing.error.notation-utility.type-expr"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } type = tok; } else if (hasEq) { value.append(tok); } else { if (name != null && kind != null) { String msg = "parsing.error.notation-utility.extra-text"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') { String msg = "parsing.error.notation-utility.name-kind-quoted"; throw new ParseException( Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '(') { String msg = "parsing.error.notation-utility.name-kind-expr"; throw new ParseException( Translator.localize(msg), paramOffset + st.getTokenIndex()); } kind = name; name = tok; } } if (p == null) { /* Leave the type undefined (see issue 6145): */ p = Model.getCoreFactory().buildParameter(op, null); } if (name != null) { Model.getCoreHelper().setName(p, name.trim()); } if (kind != null) { setParamKind(p, kind.trim()); } if (type != null) { Model.getCoreHelper().setType(p, getType(type.trim(), ns)); } if (value != null) { // TODO: Find a better default language // TODO: We should know the notation language, since it is us Project project = ProjectManager.getManager().getCurrentProject(); ProjectSettings ps = project.getProjectSettings(); String notationLanguage = ps.getNotationLanguage(); Object initExpr = Model.getDataTypesFactory() .createExpression( notationLanguage, value.toString().trim()); Model.getCoreHelper().setDefaultValue(p, initExpr); } } while (it.hasNext()) { Object p = it.next(); if (!Model.getFacade().isReturn(p)) { Model.getCoreHelper().removeParameter(op, p); Model.getUmlFactory().delete(p); } } }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
protected void parseStateBody(Object st, String s) throws ParseException { boolean foundEntry = false; boolean foundExit = false; boolean foundDo = false; /* Generate all the existing internal transitions, * so that we can compare them as text with the newly entered ones. */ ModelElementInfoList internalsInfo = new ModelElementInfoList( Model.getFacade().getInternalTransitions(st)); StringTokenizer lines = new StringTokenizer(s, "\n\r"); while (lines.hasMoreTokens()) { String line = lines.nextToken().trim(); /* Now let's check if the new line is already present in * the old list of internal transitions; if it is, then * mark the old one to be retained (i.e. do not create a new one), * if it isn't, continue with parsing: */ if (!internalsInfo.checkRetain(line)) { if (line.toLowerCase().startsWith("entry") && line.substring(5).trim().startsWith("/")) { parseStateEntryAction(st, line); foundEntry = true; } else if (line.toLowerCase().startsWith("exit") && line.substring(4).trim().startsWith("/")) { parseStateExitAction(st, line); foundExit = true; } else if (line.toLowerCase().startsWith("do") && line.substring(2).trim().startsWith("/")) { parseStateDoAction(st, line); foundDo = true; } else { Object t = Model.getStateMachinesFactory() .buildInternalTransition(st); if (t == null) { continue; } /* TODO: If the next line trows an exception, then what * do we do with the remainder of the * parsed/to be parsed lines? */ /* TODO: Is this a good way of handling nested notation? * The following fails the tests: * new TransitionNotationUml(t).parse(line); */ new TransitionNotationUml(t).parseTransition(t, line); /* Add this new one, and mark it to be retained: */ internalsInfo.add(t, true); } } } if (!foundEntry) { delete(Model.getFacade().getEntry(st)); } if (!foundExit) { delete(Model.getFacade().getExit(st)); } if (!foundDo) { delete(Model.getFacade().getDoActivity(st)); } /* Process the final list of internal transitions, * and hook it to the state: */ Model.getStateMachinesHelper().setInternalTransitions(st, internalsInfo.finalisedList()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
protected void parseEnumerationLiteralFig( Object enumeration, Object literal, String text) throws ParseException { if (enumeration == null || literal == null) { return; } Project project = ProjectManager.getManager().getCurrentProject(); ParseException pex = null; int start = 0; int end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); if (end == -1) { /* No text. We may remove the literal. */ project.moveToTrash(literal); return; } String s = text.substring(start, end).trim(); if (s.length() == 0) { /* No non-white chars in text? remove literal! */ project.moveToTrash(literal); return; } parseEnumerationLiteral(s, literal); int i = Model.getFacade().getEnumerationLiterals(enumeration) .indexOf(literal); // check for more literals (';' separated): start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); while (end > start && end <= text.length()) { s = text.substring(start, end).trim(); if (s.length() > 0) { // yes, there are more: Object newLiteral = Model.getCoreFactory().createEnumerationLiteral(); if (newLiteral != null) { try { if (i != -1) { Model.getCoreHelper().addLiteral( enumeration, ++i, newLiteral); } else { Model.getCoreHelper().addLiteral( enumeration, 0, newLiteral); } parseEnumerationLiteral(s, newLiteral); } catch (ParseException ex) { if (pex == null) { pex = ex; } } } } start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); } if (pex != null) { throw pex; } }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
protected void parseEnumerationLiteral(String text, Object literal) throws ParseException { text = text.trim(); if (text.length() == 0) { return; } // strip any trailing semi-colons if (text.charAt(text.length() - 1) == ';') { text = text.substring(0, text.length() - 2); } MyTokenizer st; String name = null; StringBuilder stereotype = null; String token; try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.model-element-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else { if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (name != null) { Model.getCoreHelper().setName(literal, name); } StereotypeUtility.dealWithStereotypes(literal, stereotype, false); return; }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
public void parseOperationFig( Object classifier, Object operation, String text) throws ParseException { if (classifier == null || operation == null) { return; } ParseException pex = null; int start = 0; int end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); Project currentProject = ProjectManager.getManager().getCurrentProject(); if (end == -1) { //no text? remove op! currentProject.moveToTrash(operation); return; } String s = text.substring(start, end).trim(); if (s.length() == 0) { //no non-whitechars in text? remove op! currentProject.moveToTrash(operation); return; } parseOperation(s, operation); int i = Model.getFacade().getFeatures(classifier).indexOf(operation); // check for more operations (';' separated): start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); while (end > start && end <= text.length()) { s = text.substring(start, end).trim(); if (s.length() > 0) { // yes, there are more: Object returnType = currentProject.getDefaultReturnType(); Object newOp = Model.getCoreFactory() .buildOperation(classifier, returnType); if (newOp != null) { try { parseOperation(s, newOp); //newOp.setOwnerScope(op.getOwnerScope()); // //not needed in case of operation if (i != -1) { Model.getCoreHelper().addFeature( classifier, ++i, newOp); } else { Model.getCoreHelper().addFeature( classifier, newOp); } } catch (ParseException ex) { if (pex == null) { pex = ex; } } } } start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); } if (pex != null) { throw pex; } }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
public void parseOperation(String s, Object op) throws ParseException { MyTokenizer st; boolean hasColon = false; String name = null; String parameterlist = null; StringBuilder stereotype = null; String token; String type = null; String visibility = null; List<String> properties = null; int paramOffset = 0; s = s.trim(); if (s.length() > 0 && NotationUtilityUml.VISIBILITYCHARS.indexOf(s.charAt(0)) >= 0) { visibility = s.substring(0, 1); s = s.substring(1); } try { st = new MyTokenizer(s, " ,\t,<<,\u00AB,\u00BB,>>,:,=,{,},\\,", NotationUtilityUml.operationCustomSep); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token) || ",".equals(token)) { continue; // Do nothing } else if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { parseError("operation.stereotypes", st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else if ("{".equals(token)) { properties = tokenOpenBrace(st, properties); } else if (":".equals(token)) { hasColon = true; } else if ("=".equals(token)) { parseError("operation.default-values", st.getTokenIndex()); } else if (token.charAt(0) == '(' && !hasColon) { if (parameterlist != null) { parseError("operation.two-parameter-lists", st.getTokenIndex()); } parameterlist = token; } else { if (hasColon) { if (type != null) { parseError("operation.two-types", st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { parseError("operation.type-quoted", st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { parseError("operation.type-expr", st.getTokenIndex()); } type = token; } else { if (name != null && visibility != null) { parseError("operation.extra-text", st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { parseError("operation.name-quoted", st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { parseError("operation.name-expr", st.getTokenIndex()); } if (name == null && visibility == null && token.length() > 1 && NotationUtilityUml.VISIBILITYCHARS.indexOf( token.charAt(0)) >= 0) { visibility = token.substring(0, 1); token = token.substring(1); } if (name != null) { visibility = name; name = token; } else { name = token; } } } } // end while loop } catch (NoSuchElementException nsee) { parseError("operation.unexpected-end-operation", s.length()); } catch (ParseException pre) { throw pre; } if (parameterlist != null) { // parameterlist is guaranteed to contain at least "(" if (parameterlist.charAt(parameterlist.length() - 1) != ')') { parseError("operation.parameter-list-incomplete", paramOffset + parameterlist.length() - 1); } paramOffset++; parameterlist = parameterlist.substring(1, parameterlist.length() - 1); NotationUtilityUml.parseParamList(op, parameterlist, paramOffset); } if (visibility != null) { Model.getCoreHelper().setVisibility(op, NotationUtilityUml.getVisibility(visibility.trim())); } if (name != null) { Model.getCoreHelper().setName(op, name.trim()); } else if (Model.getFacade().getName(op) == null || "".equals(Model.getFacade().getName(op))) { Model.getCoreHelper().setName(op, "anonymous"); } if (type != null) { Object ow = Model.getFacade().getOwner(op); Object ns = null; if (ow != null && Model.getFacade().getNamespace(ow) != null) { ns = Model.getFacade().getNamespace(ow); } else { ns = Model.getFacade().getRoot(op); } Object mtype = NotationUtilityUml.getType(type.trim(), ns); setReturnParameter(op, mtype); } if (properties != null) { NotationUtilityUml.setProperties(op, properties, NotationUtilityUml.operationSpecialStrings); } // Don't create a stereotype for <<signal>> on a Reception // but create any other parsed stereotypes as needed if (!Model.getFacade().isAReception(op) || !RECEPTION_KEYWORD.equals(stereotype.toString())) { StereotypeUtility.dealWithStereotypes(op, stereotype, true); } }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
private void parseError(String message, int offset) throws ParseException { throw new ParseException( Translator.localize("parsing.error." + message), offset); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
private List<String> tokenOpenBrace(MyTokenizer st, List<String> properties) throws ParseException { String token; StringBuilder propname = new StringBuilder(); String propvalue = null; if (properties == null) { properties = new ArrayList<String>(); } while (true) { token = st.nextToken(); if (",".equals(token) || "}".equals(token)) { if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } propname = new StringBuilder(); propvalue = null; if ("}".equals(token)) { break; } } else if ("=".equals(token)) { if (propvalue != null) { String msg = "parsing.error.operation.prop-stereotypes"; Object[] args = {propname}; throw new ParseException( Translator.localize(msg, args), st.getTokenIndex()); } propvalue = ""; } else if (propvalue == null) { propname.append(token); } else { propvalue += token; } } if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } return properties; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void parseMessage(Object umlMessage, String s) throws ParseException { String fname = null; // the condition or iteration expression (recurrence): StringBuilder guard = null; String paramExpr = null; String token; StringBuilder varname = null; List<List> predecessors = new ArrayList<List>(); List<Integer> seqno = null; List<Integer> currentseq = new ArrayList<Integer>(); // List<String> args = null; boolean mustBePre = false; boolean mustBeSeq = false; boolean parallell = false; boolean iterative = false; boolean mayDeleteExpr = false; boolean refindOperation = false; boolean hasPredecessors = false; currentseq.add(null); currentseq.add(null); try { MyTokenizer st = new MyTokenizer(s, " ,\t,*,[,],.,:,=,/,\\,", MyTokenizer.PAREN_EXPR_STRING_SEPARATOR); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { if (currentseq == null) { if (varname != null && fname == null) { varname.append(token); } } } else if ("[".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-unqualified"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (guard != null) { String msg = "parsing.error.message.several-specs"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } guard = new StringBuilder(); while (true) { token = st.nextToken(); if ("]".equals(token)) { break; } guard.append(token); } } else if ("*".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-unqualified"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (currentseq != null) { iterative = true; } } else if (".".equals(token)) { if (currentseq == null) { String msg = "parsing.error.message.unexpected-dot"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { currentseq.add(null); currentseq.add(null); } } else if (":".equals(token)) { if (st.hasMoreTokens()) { String t = st.nextToken(); if ("=".equals(t)) { st.putToken(":="); continue; } st.putToken(t); } if (mustBePre) { String msg = "parsing.error.message.pred-colon"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (currentseq != null) { if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } seqno = currentseq; currentseq = null; mayDeleteExpr = true; } } else if ("/".equals(token)) { if (st.hasMoreTokens()) { String t = st.nextToken(); if ("/".equals(t)) { st.putToken("//"); continue; } st.putToken(t); } if (mustBeSeq) { String msg = "parsing.error.message.sequence-slash"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBePre = false; mustBeSeq = true; if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { predecessors.add(currentseq); currentseq = new ArrayList<Integer>(); currentseq.add(null); currentseq.add(null); } hasPredecessors = true; } else if ("//".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-parallelized"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (currentseq != null) { parallell = true; } } else if (",".equals(token)) { if (currentseq != null) { if (mustBeSeq) { String msg = "parsing.error.message.many-numbers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBePre = true; if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { predecessors.add(currentseq); currentseq = new ArrayList<Integer>(); currentseq.add(null); currentseq.add(null); } hasPredecessors = true; } else { if (varname == null && fname != null) { varname = new StringBuilder(fname + token); fname = null; } else if (varname != null && fname == null) { varname.append(token); } else { String msg = "parsing.error.message.found-comma"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } } } else if ("=".equals(token) || ":=".equals(token)) { if (currentseq == null) { if (varname == null) { varname = new StringBuilder(fname); fname = ""; } else { fname = ""; } } } else if (currentseq == null) { if (paramExpr == null && token.charAt(0) == '(') { if (token.charAt(token.length() - 1) != ')') { String msg = "parsing.error.message.malformed-parameters"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (fname == null || "".equals(fname)) { String msg = "parsing.error.message.function-not-found"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (varname == null) { varname = new StringBuilder(); } paramExpr = token.substring(1, token.length() - 1); } else if (varname != null && fname == null) { varname.append(token); } else if (fname == null || fname.length() == 0) { fname = token; } else { String msg = "parsing.error.message.unexpected-token"; Object[] parseExcArgs = {token}; throw new ParseException( Translator.localize(msg, parseExcArgs), st.getTokenIndex()); } } else { boolean hasVal = currentseq.get(currentseq.size() - 2) != null; boolean hasOrd = currentseq.get(currentseq.size() - 1) != null; boolean assigned = false; int bp = findMsgOrderBreak(token); if (!hasVal && !assigned && bp == token.length()) { try { currentseq.set( currentseq.size() - 2, Integer.valueOf( token)); assigned = true; } catch (NumberFormatException nfe) { } } if (!hasOrd && !assigned && bp == 0) { try { currentseq.set( currentseq.size() - 1, Integer.valueOf( parseMsgOrder(token))); assigned = true; } catch (NumberFormatException nfe) { } } if (!hasVal && !hasOrd && !assigned && bp > 0 && bp < token.length()) { Integer nbr, ord; try { nbr = Integer.valueOf(token.substring(0, bp)); ord = Integer.valueOf( parseMsgOrder(token.substring(bp))); currentseq.set(currentseq.size() - 2, nbr); currentseq.set(currentseq.size() - 1, ord); assigned = true; } catch (NumberFormatException nfe) { } } if (!assigned) { String msg = "parsing.error.message.unexpected-token"; Object[] parseExcArgs = {token}; throw new ParseException( Translator.localize(msg, parseExcArgs), st.getTokenIndex()); } } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); } catch (ParseException pre) { throw pre; } List<String> args = parseArguments(paramExpr, mayDeleteExpr); printDebugInfo(s, fname, guard, paramExpr, varname, predecessors, seqno, parallell, iterative); /* Now apply the changes to the model: */ buildAction(umlMessage); handleGuard(umlMessage, guard, parallell, iterative); fname = fillBlankFunctionName(umlMessage, fname, mayDeleteExpr); varname = fillBlankVariableName(umlMessage, varname, mayDeleteExpr); refindOperation = handleFunctionName(umlMessage, fname, varname, refindOperation); refindOperation = handleArguments(umlMessage, args, refindOperation); refindOperation = handleSequenceNumber(umlMessage, seqno, refindOperation); handleOperation(umlMessage, fname, refindOperation); handlePredecessors(umlMessage, predecessors, hasPredecessors); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void handlePredecessors(Object umlMessage, List<List> predecessors, boolean hasPredecessors) throws ParseException { // Predecessors used to be not implemented, because it // caused some problems that I've not found an easy way to handle yet, // d00mst. The specific problem is that the notation currently is // ambiguous on second message after a thread split. // Why not implement it anyway? d00mst // TODO: Document this ambiguity and the choice made. if (hasPredecessors) { Collection roots = findCandidateRoots( Model.getFacade().getMessages( Model.getFacade().getInteraction(umlMessage)), null, null); List<Object> pre = new ArrayList<Object>(); predfor: for (int i = 0; i < predecessors.size(); i++) { for (Object root : roots) { Object msg = walkTree(root, predecessors.get(i)); if (msg != null && msg != umlMessage) { if (isBadPreMsg(umlMessage, msg)) { String parseMsg = "parsing.error.message.one-pred"; throw new ParseException( Translator.localize(parseMsg), 0); } pre.add(msg); continue predfor; } } String parseMsg = "parsing.error.message.pred-not-found"; throw new ParseException(Translator.localize(parseMsg), 0); } MsgPtr ptr = new MsgPtr(); recCountPredecessors(umlMessage, ptr); if (ptr.message != null && !pre.contains(ptr.message)) { pre.add(ptr.message); } Model.getCollaborationsHelper().setPredecessors(umlMessage, pre); } }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void handleOperation(Object umlMessage, String fname, boolean refindOperation) throws ParseException { if (fname != null && refindOperation) { Object role = Model.getFacade().getReceiver(umlMessage); List ops = getOperation( Model.getFacade().getBases(role), fname.trim(), Model.getFacade().getActualArguments( Model.getFacade().getAction(umlMessage)).size()); Object callAction = Model.getFacade().getAction(umlMessage); if (Model.getFacade().isACallAction(callAction)) { if (ops.size() > 0) { // If there are more than one suitable operation, // then we pick the first one. Model.getCommonBehaviorHelper().setOperation(callAction, ops.get(0)); } else { Model.getCommonBehaviorHelper().setOperation( callAction, null); } } } }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected boolean handleSequenceNumber(Object umlMessage, List<Integer> seqno, boolean refindOperation) throws ParseException { int i; if (seqno != null) { Object/* MMessage */root; // Find the preceding message, if any, on either end of the // association. StringBuilder pname = new StringBuilder(); StringBuilder mname = new StringBuilder(); String gname = generateMessageNumber(umlMessage); boolean swapRoles = false; int majval = 0; if (seqno.get(seqno.size() - 2) != null) { majval = Math.max((seqno.get(seqno.size() - 2)).intValue() - 1, 0); } int minval = 0; if (seqno.get(seqno.size() - 1) != null) { minval = Math.max((seqno.get(seqno.size() - 1)).intValue(), 0); } for (i = 0; i + 1 < seqno.size(); i += 2) { int bv = 1; if (seqno.get(i) != null) { bv = Math.max((seqno.get(i)).intValue(), 1); } int sv = 0; if (seqno.get(i + 1) != null) { sv = Math.max((seqno.get(i + 1)).intValue(), 0); } if (i > 0) { mname.append("."); } mname.append(Integer.toString(bv) + (char) ('a' + sv)); if (i + 3 < seqno.size()) { if (i > 0) { pname.append("."); } pname.append(Integer.toString(bv) + (char) ('a' + sv)); } } root = null; if (pname.length() > 0) { root = findMsg(Model.getFacade().getSender(umlMessage), pname.toString()); if (root == null) { root = findMsg(Model.getFacade().getReceiver(umlMessage), pname.toString()); if (root != null) { swapRoles = true; } } } else if (!hasMsgWithActivator(Model.getFacade().getSender(umlMessage), null) && hasMsgWithActivator(Model.getFacade().getReceiver(umlMessage), null)) { swapRoles = true; } if (compareMsgNumbers(mname.toString(), gname.toString())) { // Do nothing } else if (isMsgNumberStartOf(gname.toString(), mname.toString())) { String msg = "parsing.error.message.subtree-rooted-self"; throw new ParseException(Translator.localize(msg), 0); } else if (Model.getFacade().getPredecessors(umlMessage).size() > 1 && Model.getFacade().getSuccessors(umlMessage).size() > 1) { String msg = "parsing.error.message.start-end-many-threads"; throw new ParseException(Translator.localize(msg), 0); } else if (root == null && pname.length() > 0) { String msg = "parsing.error.message.activator-not-found"; throw new ParseException(Translator.localize(msg), 0); } else if (swapRoles && Model.getFacade().getActivatedMessages(umlMessage).size() > 0 && (Model.getFacade().getSender(umlMessage) != Model.getFacade().getReceiver(umlMessage))) { String msg = "parsing.error.message.reverse-direction-message"; throw new ParseException(Translator.localize(msg), 0); } else { /* Disconnect the message from the call graph * Make copies of returned live collections * since we're modifying */ Collection c = new ArrayList( Model.getFacade().getPredecessors(umlMessage)); Collection c2 = new ArrayList( Model.getFacade().getSuccessors(umlMessage)); Iterator it; it = c2.iterator(); while (it.hasNext()) { Model.getCollaborationsHelper().removeSuccessor(umlMessage, it.next()); } it = c.iterator(); while (it.hasNext()) { Iterator it2 = c2.iterator(); Object pre = /* (MMessage) */it.next(); Model.getCollaborationsHelper().removePredecessor(umlMessage, pre); while (it2.hasNext()) { Model.getCollaborationsHelper().addPredecessor( it2.next(), pre); } } // Connect the message at a new spot Model.getCollaborationsHelper().setActivator(umlMessage, root); if (swapRoles) { Object/* MClassifierRole */r = Model.getFacade().getSender(umlMessage); Model.getCollaborationsHelper().setSender(umlMessage, Model.getFacade().getReceiver(umlMessage)); Model.getCommonBehaviorHelper().setReceiver(umlMessage, r); } if (root == null) { c = filterWithActivator( Model.getFacade().getSentMessages( Model.getFacade().getSender(umlMessage)), null); } else { c = Model.getFacade().getActivatedMessages(root); } c2 = findCandidateRoots(c, root, umlMessage); it = c2.iterator(); // If c2 is empty, then we're done (or there is a // cycle in the message graph, which would be bad) If // c2 has more than one element, then the model is // crappy, but we'll just use one of them anyway if (majval <= 0) { while (it.hasNext()) { Model.getCollaborationsHelper().addSuccessor(umlMessage, /* (MMessage) */it.next()); } } else if (it.hasNext()) { Object/* MMessage */pre = walk(/* (MMessage) */it.next(), majval - 1, false); Object/* MMessage */post = successor(pre, minval); if (post != null) { Model.getCollaborationsHelper() .removePredecessor(post, pre); Model.getCollaborationsHelper() .addPredecessor(post, umlMessage); } insertSuccessor(pre, umlMessage, minval); } refindOperation = true; } } return refindOperation; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
private List getOperation(Collection classifiers, String name, int params) throws ParseException { List<Object> operations = new ArrayList<Object>(); if (name == null || name.length() == 0) { return operations; } for (Object clf : classifiers) { Collection oe = Model.getFacade().getFeatures(clf); for (Object operation : oe) { if (!(Model.getFacade().isAOperation(operation))) { continue; } if (!name.equals(Model.getFacade().getName(operation))) { continue; } if (params != countParameters(operation)) { continue; } operations.add(operation); } } if (operations.size() > 0) { return operations; } Iterator it = classifiers.iterator(); if (it.hasNext()) { StringBuilder expr = new StringBuilder(name + "("); int i; for (i = 0; i < params; i++) { if (i > 0) { expr.append(", "); } expr.append("param" + (i + 1)); } expr.append(")"); // Jaap Branderhorst 2002-23-09 added next lines to link // parameters and operations to the figs that represent // them Object cls = it.next(); Object returnType = ProjectManager.getManager() .getCurrentProject().getDefaultReturnType(); Object op = Model.getCoreFactory().buildOperation(cls, returnType); new OperationNotationUml(op).parseOperation( expr.toString(), op); operations.add(op); } return operations; }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
protected Object parseObjectFlowState2(Object objectFlowState, String s) throws ParseException { s = s.trim(); /* Let's not be picky about the brackets - just remove them: */ if (s.startsWith("[")) { s = s.substring(1); } if (s.endsWith("]")) { s = s.substring(0, s.length() - 1); } s = s.trim(); Object c = Model.getFacade().getType(objectFlowState); // get the // classifier if (c != null) { if (Model.getFacade().isAClassifierInState(c)) { Object classifier = Model.getFacade().getType(c); if ((s == null) || "".equals(s)) { // the State of a ClassifierInState is removed, // so let's reduce it to a Classifier. Model.getCoreHelper().setType(objectFlowState, classifier); delete(c); Model.getCoreHelper().setType(objectFlowState, classifier); return objectFlowState; // the model is changed - job done } Collection states = new ArrayList(Model.getFacade() .getInStates(c)); Collection statesToBeRemoved = new ArrayList(states); Collection namesToBeAdded = new ArrayList(); // Strings StringTokenizer tokenizer = new StringTokenizer(s, ","); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); boolean found = false; Iterator i = states.iterator(); while (i.hasNext()) { Object state = i.next(); if (Model.getFacade().getName(state) == nextToken) { found = true; statesToBeRemoved.remove(state); } } if (!found) { namesToBeAdded.add(nextToken); } } /* Remove the states that did not match. */ states.removeAll(statesToBeRemoved); Iterator i = namesToBeAdded.iterator(); while (i.hasNext()) { String name = (String) i.next(); /* * Now we have to see if any state in any statemachine of * classifier is named [name]. If so, then we only have to * link the state to c. */ Object state = Model.getActivityGraphsHelper() .findStateByName(classifier, name); if (state != null) { states.add(state); // the model is changed - our job is done } else { // no state named s is found, so we have to // reject the user's input String msg = "parsing.error.object-flow-state.state-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); } } /* Finally, do the adaptations: */ Model.getActivityGraphsHelper().setInStates(c, states); } else { // then c is a "normal" Classifier Collection statesToBeAdded = new ArrayList(); // UML states StringTokenizer tokenizer = new StringTokenizer(s, ","); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); Object state = Model.getActivityGraphsHelper() .findStateByName(c, nextToken); if (state != null) { statesToBeAdded.add(state); } else { // no state with the given name is found, so we have to // reject the complete user's input String msg = "parsing.error.object-flow-state.state-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); } } // let's create a new ClassifierInState with the correct links Object cis = Model.getActivityGraphsFactory() .buildClassifierInState(c, statesToBeAdded); Model.getCoreHelper().setType(objectFlowState, cis); // the model is changed - our job is done } } else { // if no classifier has been set, then entering a state is // not useful, so the user's input has to be rejected. String msg = "parsing.error.object-flow-state.classifier-not-found"; throw new ParseException(Translator.localize(msg), 0); } return objectFlowState; }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
protected Object parseClassifierRole(Object cls, String s) throws ParseException { String name = null; String token; String role = null; String base = null; List<String> bases = null; boolean hasColon = false; boolean hasSlash = false; try { MyTokenizer st = new MyTokenizer(s, " ,\t,/,:,\\,"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { /* Do nothing. */ } else if ("/".equals(token)) { hasSlash = true; hasColon = false; if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } base = null; } else if (":".equals(token)) { hasColon = true; hasSlash = false; if (bases == null) { bases = new ArrayList<String>(); } if (base != null) { bases.add(base); } base = null; } else if (",".equals(token)) { if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } base = null; } else if (hasColon) { if (base != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } base = token; } else if (hasSlash) { if (role != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } role = token; } else { if (name != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); } if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } // TODO: What to do about object name??? // if (name != null) // ; if (role != null) { Model.getCoreHelper().setName(cls, role.trim()); } if (bases != null) { // Remove bases that aren't there anymore // copy - can't iterate modify live collection while iterating it Collection b = new ArrayList(Model.getFacade().getBases(cls)); Iterator it = b.iterator(); Object c; Object ns = Model.getFacade().getNamespace(cls); if (ns != null && Model.getFacade().getNamespace(ns) != null) { ns = Model.getFacade().getNamespace(ns); } else { ns = Model.getFacade().getRoot(cls); } while (it.hasNext()) { c = it.next(); if (!bases.contains(Model.getFacade().getName(c))) { Model.getCollaborationsHelper().removeBase(cls, c); } } it = bases.iterator(); addBases: while (it.hasNext()) { String d = ((String) it.next()).trim(); Iterator it2 = b.iterator(); while (it2.hasNext()) { c = it2.next(); if (d.equals(Model.getFacade().getName(c))) { continue addBases; } } c = NotationUtilityUml.getType(d, ns); if (Model.getFacade().isACollaboration( Model.getFacade().getNamespace(c))) { Model.getCoreHelper().setNamespace(c, ns); } Model.getCollaborationsHelper().addBase(cls, c); } } return cls; }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
protected Object parseCallState(Object callState, String s1) throws ParseException { String s = s1.trim(); int a = s.indexOf("("); int b = s.indexOf(")"); if (((a < 0) && (b >= 0)) || ((b < 0) && (a >= 0)) || (b < a)) { throw new ParseException("No matching brackets () found.", 0); } /* First we decode the string: */ String newClassName = null; String newOperationName = null; StringTokenizer tokenizer = new StringTokenizer(s, "("); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); if (nextToken.endsWith(")")) { newClassName = nextToken.substring(0, nextToken.length() - 1); } else { newOperationName = nextToken.trim(); } } /* Secondly we check the previous model structure: */ String oldOperationName = null; String oldClassName = null; Object entry = Model.getFacade().getEntry(callState); Object operation = null; Object clazz = null; if (Model.getFacade().isACallAction(entry)) { operation = Model.getFacade().getOperation(entry); if (Model.getFacade().isAOperation(operation)) { oldOperationName = Model.getFacade().getName(operation); clazz = Model.getFacade().getOwner(operation); oldClassName = Model.getFacade().getName(clazz); } } /* And 3rd, we adapt the model: */ boolean found = false; if ((newClassName != null) && newClassName.equals(oldClassName) && (newOperationName != null) && !newOperationName.equals(oldOperationName)) { // Same class, other operation for ( Object op : Model.getFacade().getOperations(clazz)) { if (newOperationName.equals( Model.getFacade().getName(op))) { Model.getCommonBehaviorHelper().setOperation(entry, op); found = true; break; } } if (!found) { throw new ParseException( "Operation " + newOperationName + " not found in " + newClassName + ".", 0); } } else if ((newClassName != null) && !newClassName.equals(oldClassName) && (newOperationName != null)) { // Other class Object model = ProjectManager.getManager().getCurrentProject().getRoot(); Collection c = Model.getModelManagementHelper(). getAllModelElementsOfKind(model, Model.getMetaTypes().getClassifier()); Iterator i = c.iterator(); Object classifier = null; while (i.hasNext()) { Object cl = i.next(); String cn = Model.getFacade().getName(cl); if (cn.equals(newClassName)) { classifier = cl; break; } } if (classifier == null) { throw new ParseException( "Classifier " + newClassName + " not found.", 0); } // We found the classifier, now go find the operation: if (classifier != null) { Collection ops = Model.getFacade().getOperations(classifier); Iterator io = ops.iterator(); while (io.hasNext()) { Object op = io.next(); if (newOperationName.equals( Model.getFacade().getName(op))) { /* Here we located the new classifier * with its operation. */ found = true; if (!Model.getFacade().isACallAction(entry)) { entry = Model.getCommonBehaviorFactory() .buildCallAction(op, "ca"); Model.getStateMachinesHelper().setEntry( callState, entry); } else { Model.getCommonBehaviorHelper().setOperation( entry, op); } break; } } if (!found) { throw new ParseException( "Operation " + newOperationName + " not found in " + newClassName + ".", 0); } } } if (!found) { throw new ParseException( "Incompatible input found.", 0); } return callState; }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
public void parseAttributeFig( Object classifier, Object attribute, String text) throws ParseException { if (classifier == null || attribute == null) { return; } /* TODO: We should have all the information that is required in the * NotationSettings object */ Project project = ProjectManager.getManager().getCurrentProject(); ParseException pex = null; int start = 0; int end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); if (end == -1) { //no text? remove attr! project.moveToTrash(attribute); return; } String s = text.substring(start, end).trim(); if (s.length() == 0) { //no non-whitechars in text? remove attr! project.moveToTrash(attribute); return; } parseAttribute(s, attribute); int i = Model.getFacade().getFeatures(classifier).indexOf(attribute); // check for more attributes (';' separated): start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); while (end > start && end <= text.length()) { s = text.substring(start, end).trim(); if (s.length() > 0) { // yes, there are more: Object attrType = project.getDefaultAttributeType(); Object newAttribute = Model.getUmlFactory().buildNode( Model.getMetaTypes().getAttribute()); Model.getCoreHelper().setType(newAttribute, attrType); if (newAttribute != null) { /* We need to set the namespace/owner * of the new attribute before parsing: */ if (i != -1) { Model.getCoreHelper().addFeature( classifier, ++i, newAttribute); } else { Model.getCoreHelper().addFeature( classifier, newAttribute); } try { parseAttribute(s, newAttribute); /* If the 1st attribute is static, * then the new ones, too. */ Model.getCoreHelper().setStatic( newAttribute, Model.getFacade().isStatic(attribute)); } catch (ParseException ex) { if (pex == null) { pex = ex; } } } } start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); } if (pex != null) { throw pex; } }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
protected void parseAttribute( String text, Object attribute) throws ParseException { StringBuilder multiplicity = null; String name = null; List<String> properties = null; StringBuilder stereotype = null; // This is null as until // the first stereotype declaration is seen. // After that it is non-null. String token; String type = null; StringBuilder value = null; String visibility = null; boolean derived = false; boolean hasColon = false; boolean hasEq = false; int multindex = -1; MyTokenizer st; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } /* Handle Visibility: */ if (text.length() > 0 && NotationUtilityUml.VISIBILITYCHARS.indexOf(text.charAt(0)) >= 0) { visibility = text.substring(0, 1); text = text.substring(1); } try { st = new MyTokenizer(text, " ,\t,<<,\u00AB,\u00BB,>>,[,],:,=,{,},\\,", NotationUtilityUml.attributeCustomSep); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token) || ",".equals(token)) { if (hasEq) { value.append(token); } } else if ("<<".equals(token) || "\u00AB".equals(token)) { if (hasEq) { value.append(token); } else { if (stereotype != null) { String msg = "parsing.error.attribute.two-sets-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } } else if ("[".equals(token)) { if (hasEq) { value.append(token); } else { if (multiplicity != null) { String msg = "parsing.error.attribute.two-multiplicities"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } multiplicity = new StringBuilder(); multindex = st.getTokenIndex() + 1; while (true) { token = st.nextToken(); if ("]".equals(token)) { break; } multiplicity.append(token); } } } else if ("{".equals(token)) { StringBuilder propname = new StringBuilder(); String propvalue = null; if (properties == null) { properties = new ArrayList<String>(); } while (true) { token = st.nextToken(); if (",".equals(token) || "}".equals(token)) { if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } propname = new StringBuilder(); propvalue = null; if ("}".equals(token)) { break; } } else if ("=".equals(token)) { if (propvalue != null) { String msg = "parsing.error.attribute.prop-two-values"; Object[] args = {propvalue}; throw new ParseException(Translator.localize( msg, args), st.getTokenIndex()); } propvalue = ""; } else if (propvalue == null) { propname.append(token); } else { propvalue += token; } } if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } } else if (":".equals(token)) { hasColon = true; hasEq = false; } else if ("=".equals(token)) { if (value != null) { String msg = "parsing.error.attribute.two-default-values"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } value = new StringBuilder(); hasColon = false; hasEq = true; } else { if (hasColon) { if (type != null) { String msg = "parsing.error.attribute.two-types"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { String msg = "parsing.error.attribute.quoted"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { String msg = "parsing.error.attribute.is-expr"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } type = token; } else if (hasEq) { value.append(token); } else { if (name != null && visibility != null) { String msg = "parsing.error.attribute.extra-text"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { String msg = "parsing.error.attribute.name-quoted"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { String msg = "parsing.error.attribute.name-expr"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (name == null && visibility == null && token.length() > 1 && NotationUtilityUml.VISIBILITYCHARS .indexOf(token.charAt(0)) >= 0) { visibility = token.substring(0, 1); token = token.substring(1); } if (name != null) { visibility = name; name = token; } else { name = token; } } } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); } // catch & rethrow is not necessary if we don't do nothing (penyaskito) // catch (ParseException pre) { // throw pre; // } if (LOG.isDebugEnabled()) { LOG.debug("ParseAttribute [name: " + name + " visibility: " + visibility + " type: " + type + " value: " + value + " stereo: " + stereotype + " mult: " + multiplicity); if (properties != null) { for (int i = 0; i + 1 < properties.size(); i += 2) { LOG.debug("\tProperty [name: " + properties.get(i) + " = " + properties.get(i + 1) + "]"); } } } dealWithDerived(attribute, derived); dealWithVisibility(attribute, visibility); dealWithName(attribute, name); dealWithType(attribute, type); dealWithValue(attribute, value); dealWithMultiplicity(attribute, multiplicity, multindex); dealWithProperties(attribute, properties); StereotypeUtility.dealWithStereotypes(attribute, stereotype, true); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
private void dealWithMultiplicity(Object attribute, StringBuilder multiplicity, int multindex) throws ParseException { if (multiplicity != null) { try { Model.getCoreHelper().setMultiplicity(attribute, multiplicity.toString()); } catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); } } }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
static void parseModelElement(Object modelElement, String text) throws ParseException { MyTokenizer st; boolean abstrac = false; boolean fina = false; boolean publi = false; boolean privat = false; boolean protect = false; String token; List<String> path = null; String name = null; try { st = new MyTokenizer(text, " ,.,abstract,final,public,private,protected"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token)) { /* skip spaces */ } else if ("abstract".equals(token)) { abstrac = true; } else if ("final".equals(token)) { fina = true; } else if ("public".equals(token)) { publi = true; } else if ("private".equals(token)) { privat = true; } else if ("protected".equals(token)) { protect = true; } else if (".".equals(token)) { if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.anon-qualifiers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (path == null) { path = new ArrayList<String>(); } if (name != null) { path.add(name); } name = null; } else { // the name itself if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.must-end-with-name"; throw new ParseException(Translator.localize(msg), 0); } /* Check the name for validity: */ if (!isValidJavaClassName(name)) { throw new ParseException( "Invalid class name for Java: " + name, 0); } if (path != null) { Object nspe = Model.getModelManagementHelper().getElement( path, Model.getFacade().getRoot(modelElement)); if (nspe == null || !(Model.getFacade().isANamespace(nspe))) { String msg = "parsing.error.model-element-name.namespace-unresolved"; throw new ParseException(Translator.localize(msg), 0); } if (!Model.getCoreHelper().isValidNamespace( modelElement, nspe)) { String msg = "parsing.error.model-element-name.namespace-invalid"; throw new ParseException(Translator.localize(msg), 0); } Model.getCoreHelper().addOwnedElement(nspe, modelElement); } Model.getCoreHelper().setName(modelElement, name); if (abstrac) { Model.getCoreHelper().setAbstract(modelElement, abstrac); } if (fina) { Model.getCoreHelper().setLeaf(modelElement, fina); } if (publi) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getPublic()); } if (privat) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getPrivate()); } if (protect) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getProtected()); } }
(Lib) UnsupportedOperationException 37
              
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Deprecated public void setProject(Project project) { throw new UnsupportedOperationException(); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Deprecated public void setOwner(Object owner) { if (owner != getOwner()) { throw new UnsupportedOperationException( "Owner must be set in constructor and left unchanged"); } }
// in src/org/argouml/uml/diagram/ui/PathItemPlacement.java
public void setClosestPoint(Point newPoint) { throw new UnsupportedOperationException(); }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
public Object connect(Object fromPort, Object toPort) { throw new UnsupportedOperationException( "The connect method is not supported"); }
// in src/org/argouml/profile/internal/ocl/uml14/HashBag.java
public boolean retainAll(Collection c) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/ui/AbstractGoList2.java
public Object getRoot() { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/ListSet.java
public T set(int arg0, T o) { throw new UnsupportedOperationException("set() method not supported"); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public List<Decision> getSupportedDecisions() { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public void addSupportedDecision(Decision d) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public List<Goal> getSupportedGoals() { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public void addSupportedGoal(Goal g) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public void addKnowledgeType(String type) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public String expand(String desc, ListSet offs) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public Icon getClarifier() { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public ToDoItem toDoItem(Object dm, Designer dsgr) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public <T> T[] toArray(T[] a) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean containsAll(Collection< ? > arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean addAll(Collection< ? extends ProjectMember> arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean addAll(int arg0, Collection< ? extends ProjectMember> arg1) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean removeAll(Collection< ? > arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean retainAll(Collection< ? > arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public ProjectMember set(int arg0, ProjectMember arg1) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public void add(int arg0, ProjectMember arg1) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public ProjectMember remove(int arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public int indexOf(Object arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public int lastIndexOf(Object arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public List<ProjectMember> subList(int arg0, int arg1) { throw new UnsupportedOperationException(); }
// in src/org/argouml/gefext/DeferredBufferedImage.java
public WritableRaster copyData(WritableRaster outRaster) { throw new UnsupportedOperationException(); // This needs to iterate to fill entire output raster if implemented // return image.copyData(outRaster); }
// in src/org/argouml/util/EnumerationIterator.java
public void remove() { throw new UnsupportedOperationException(); }
// in src/org/argouml/util/SingleElementIterator.java
public void remove() { throw new UnsupportedOperationException(); }
0 0
(Domain) SaveException 34
              
// in src/org/argouml/persistence/XmiFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream stream = null; try { stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } progressMgr.nextPhase(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public void doSave(Project project, File file) throws SaveException, InterruptedException { LOG.info("Saving"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } ZipOutputStream stream = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); stream = new ZipOutputStream(new FileOutputStream(file)); for (ProjectMember projectMember : project.getMembers()) { if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + projectMember.getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { stream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void save(ProjectMember member, OutputStream stream) throws SaveException { PrintWriter w; try { w = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); } catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); } saveProjectMember(member, w); w.flush(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private void saveProjectMember(ProjectMember member, PrintWriter w) throws SaveException { try { if (member instanceof ProfileConfiguration) { ProfileConfiguration pc = (ProfileConfiguration) member; w.println("<?xml version = \"1.0\" encoding = \"UTF-8\" ?>"); // TODO: This DTD doesn't exist, so we can't tell readers to // look for it // w.println("<!DOCTYPE profile SYSTEM \"profile.dtd\" >"); // but we need a 2nd line to make the funky UML persister work w.println(""); // remove this line if the above is uncommented w.println("<profile>"); for (Profile profile : pc.getProfiles()) { if (profile instanceof UserDefinedProfile) { UserDefinedProfile uprofile = (UserDefinedProfile) profile; w.println("\t\t<userDefined>"); w.println("\t\t\t<filename>" + uprofile.getModelFile().getName() + "</filename>"); w.println("\t\t\t<model>"); printModelXMI(w, uprofile.getProfilePackages()); w.println("\t\t\t</model>"); w.println("\t\t</userDefined>"); } else { w.println("\t\t<plugin>"); w.println("\t\t\t" + profile.getProfileIdentifier()); w.println("\t\t</plugin>"); } } w.println("</profile>"); } } catch (Exception e) { e.printStackTrace(); throw new SaveException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void save(ProjectMember member, OutputStream outStream) throws SaveException { OCLExpander expander; try { expander = new OCLExpander(TemplateReader.getInstance() .read(TO_DO_TEE)); } catch (ExpansionException e) { throw new SaveException(e); } PrintWriter pw; try { pw = new PrintWriter(new OutputStreamWriter(outStream, "UTF-8")); } catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); } try { Designer.disableCritiquing(); // WARNING: The GEF implementation of the OutputStream version of // this method doesn't work - tfm - 20070531 expander.expand(pw, member); } catch (ExpansionException e) { throw new SaveException(e); } finally { pw.flush(); // pw.close(); Designer.enableCritiquing(); } }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void save(ProjectMember member, OutputStream outStream) throws SaveException { ProjectMemberModel pmm = (ProjectMemberModel) member; Object model = pmm.getModel(); try { XmiWriter xmiWriter = Model.getXmiWriter(model, outStream, ApplicationVersion.getVersion() + "(" + UmlFilePersister.PERSISTENCE_VERSION + ")"); xmiWriter.write(); outStream.flush(); } catch (UmlException e) { throw new SaveException(e); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/OldZargoFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } BufferedWriter writer = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); writer = new BufferedWriter(new OutputStreamWriter(stream, "UTF-8")); // Save the .argo entry // TODO: Cyclic dependency with PersistenceManager // move PersistenceManager..getProjectBaseName() someplace else ZipEntry zipEntry = new ZipEntry(PersistenceManager.getInstance() .getProjectBaseName(project) + FileConstants.UNCOMPRESSED_FILE_EXT); stream.putNextEntry(zipEntry); Hashtable templates = TemplateReader.getInstance().read(ARGO_MINI_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project); writer.flush(); stream.closeEntry(); int counter = 0; int size = project.getMembers().size(); Collection<String> names = new ArrayList<String>(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (!(projectMember.getType().equalsIgnoreCase("xmi"))) { if (LOG.isInfoEnabled()) { LOG.info("Saving member: " + project.getMembers().get(i).getZipName()); } String name = projectMember.getZipName(); String originalName = name; while (names.contains(name)) { /* Issue 4806 explains why we need this! */ name = ++counter + originalName; } names.add(name); stream.putNextEntry(new ZipEntry(name)); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); stream.flush(); stream.closeEntry(); } } for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + project.getMembers().get(i).getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); OldModelMemberFilePersister persister = new OldModelMemberFilePersister(); persister.save(projectMember, stream); stream.flush(); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { writer.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ZipFilePersister.java
public void doSave(Project project, File file) throws SaveException { LOG.info("Receiving file '" + file.getName() + "'"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream bufferedStream = null; try { //project.setFile(file); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); String fileName = file.getName(); ZipEntry xmiEntry = new ZipEntry(fileName.substring(0, fileName.lastIndexOf("."))); stream.putNextEntry(xmiEntry); bufferedStream = new BufferedOutputStream(stream); int size = project.getMembers().size(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + (project.getMembers() .get(i)).getType()); } MemberFilePersister persister = new ModelMemberFilePersister(); persister.save(projectMember, bufferedStream); } } stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { bufferedStream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); OutputStream stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); progressMgr.nextPhase(); String path = file.getParent(); if (LOG.isInfoEnabled()) { LOG.info("Dir ==" + path); } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
void writeProject(Project project, OutputStream oStream, ProgressMgr progressMgr) throws SaveException, InterruptedException { OutputStreamWriter outputStreamWriter; try { outputStreamWriter = new OutputStreamWriter(oStream, Argo .getEncoding()); } catch (UnsupportedEncodingException e) { throw new SaveException(e); } PrintWriter writer = new PrintWriter(new BufferedWriter( outputStreamWriter)); XmlFilterOutputStream filteredStream = new XmlFilterOutputStream( oStream, Argo.getEncoding()); try { writer.println("<?xml version = \"1.0\" " + "encoding = \"" + Argo.getEncoding() + "\" ?>"); writer.println("<uml version=\"" + PERSISTENCE_VERSION + "\">"); // Write out header section try { Hashtable templates = TemplateReader.getInstance().read( ARGO_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project, " "); } catch (ExpansionException e) { throw new SaveException(e); } writer.flush(); if (progressMgr != null) { progressMgr.nextPhase(); } // Note we assume members are ordered correctly already for (ProjectMember projectMember : project.getMembers()) { if (LOG.isInfoEnabled()) { LOG.info("Saving member : " + projectMember); } MemberFilePersister persister = getMemberFilePersister(projectMember); filteredStream.startEntry(); persister.save(projectMember, filteredStream); try { filteredStream.flush(); } catch (IOException e) { throw new SaveException(e); } } writer.println("</uml>"); writer.flush(); } finally { writer.close(); try { filteredStream.reallyClose(); } catch (IOException e) { throw new SaveException(e); } } }
// in src/org/argouml/persistence/AbstractFilePersister.java
private void preSave(Project project, File file) throws SaveException { if (project == null && file == null) { throw new SaveException("No project nor file given"); } }
// in src/org/argouml/persistence/AbstractFilePersister.java
private void postSave(Project project, File file) throws SaveException { if (project == null && file == null) { throw new SaveException("No project nor file given"); } }
// in src/org/argouml/persistence/MemberFilePersister.java
protected void addXmlFileToWriter(PrintWriter writer, File file) throws SaveException { try { BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream(file), Argo.getEncoding())); // Skip the <?xml... first line String line = reader.readLine(); while (line != null && (line.startsWith("<?xml ") || line.startsWith("<!DOCTYPE "))) { line = reader.readLine(); } while (line != null) { (writer).println(line); line = reader.readLine(); } reader.close(); } catch (FileNotFoundException e) { throw new SaveException(e); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void save(ProjectMember member, OutputStream outStream) throws SaveException { ProjectMemberDiagram diagramMember = (ProjectMemberDiagram) member; OCLExpander expander; try { expander = new OCLExpander( TemplateReader.getInstance().read(PGML_TEE)); } catch (ExpansionException e) { throw new SaveException(e); } OutputStreamWriter outputWriter; try { outputWriter = new OutputStreamWriter(outStream, Argo.getEncoding()); } catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); } try { // WARNING: the OutputStream version of this doesn't work! - tfm expander.expand(outputWriter, diagramMember.getDiagram()); } catch (ExpansionException e) { throw new SaveException(e); } finally { try { outputWriter.flush(); } catch (IOException e) { throw new SaveException(e); } } }
32
              
// in src/org/argouml/persistence/XmiFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { e.printStackTrace(); throw new SaveException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (UnsupportedEncodingException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
16
              
// in src/org/argouml/persistence/XmiFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream stream = null; try { stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } progressMgr.nextPhase(); }
// in src/org/argouml/persistence/XmiFilePersister.java
void writeProject(Project project, OutputStream stream, ProgressMgr progressMgr) throws SaveException, InterruptedException { int size = project.getMembers().size(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase(getExtension())) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + (project.getMembers() .get(i)).getType()); } MemberFilePersister persister = new ModelMemberFilePersister(); persister.save(projectMember, stream); } } if (progressMgr != null) { progressMgr.nextPhase(); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public void doSave(Project project, File file) throws SaveException, InterruptedException { LOG.info("Saving"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } ZipOutputStream stream = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); stream = new ZipOutputStream(new FileOutputStream(file)); for (ProjectMember projectMember : project.getMembers()) { if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + projectMember.getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { stream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void save(ProjectMember member, OutputStream stream) throws SaveException { PrintWriter w; try { w = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); } catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); } saveProjectMember(member, w); w.flush(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private void saveProjectMember(ProjectMember member, PrintWriter w) throws SaveException { try { if (member instanceof ProfileConfiguration) { ProfileConfiguration pc = (ProfileConfiguration) member; w.println("<?xml version = \"1.0\" encoding = \"UTF-8\" ?>"); // TODO: This DTD doesn't exist, so we can't tell readers to // look for it // w.println("<!DOCTYPE profile SYSTEM \"profile.dtd\" >"); // but we need a 2nd line to make the funky UML persister work w.println(""); // remove this line if the above is uncommented w.println("<profile>"); for (Profile profile : pc.getProfiles()) { if (profile instanceof UserDefinedProfile) { UserDefinedProfile uprofile = (UserDefinedProfile) profile; w.println("\t\t<userDefined>"); w.println("\t\t\t<filename>" + uprofile.getModelFile().getName() + "</filename>"); w.println("\t\t\t<model>"); printModelXMI(w, uprofile.getProfilePackages()); w.println("\t\t\t</model>"); w.println("\t\t</userDefined>"); } else { w.println("\t\t<plugin>"); w.println("\t\t\t" + profile.getProfileIdentifier()); w.println("\t\t</plugin>"); } } w.println("</profile>"); } } catch (Exception e) { e.printStackTrace(); throw new SaveException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void save(ProjectMember member, OutputStream outStream) throws SaveException { OCLExpander expander; try { expander = new OCLExpander(TemplateReader.getInstance() .read(TO_DO_TEE)); } catch (ExpansionException e) { throw new SaveException(e); } PrintWriter pw; try { pw = new PrintWriter(new OutputStreamWriter(outStream, "UTF-8")); } catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); } try { Designer.disableCritiquing(); // WARNING: The GEF implementation of the OutputStream version of // this method doesn't work - tfm - 20070531 expander.expand(pw, member); } catch (ExpansionException e) { throw new SaveException(e); } finally { pw.flush(); // pw.close(); Designer.enableCritiquing(); } }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void save(ProjectMember member, OutputStream outStream) throws SaveException { ProjectMemberModel pmm = (ProjectMemberModel) member; Object model = pmm.getModel(); try { XmiWriter xmiWriter = Model.getXmiWriter(model, outStream, ApplicationVersion.getVersion() + "(" + UmlFilePersister.PERSISTENCE_VERSION + ")"); xmiWriter.write(); outStream.flush(); } catch (UmlException e) { throw new SaveException(e); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/OldZargoFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } BufferedWriter writer = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); writer = new BufferedWriter(new OutputStreamWriter(stream, "UTF-8")); // Save the .argo entry // TODO: Cyclic dependency with PersistenceManager // move PersistenceManager..getProjectBaseName() someplace else ZipEntry zipEntry = new ZipEntry(PersistenceManager.getInstance() .getProjectBaseName(project) + FileConstants.UNCOMPRESSED_FILE_EXT); stream.putNextEntry(zipEntry); Hashtable templates = TemplateReader.getInstance().read(ARGO_MINI_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project); writer.flush(); stream.closeEntry(); int counter = 0; int size = project.getMembers().size(); Collection<String> names = new ArrayList<String>(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (!(projectMember.getType().equalsIgnoreCase("xmi"))) { if (LOG.isInfoEnabled()) { LOG.info("Saving member: " + project.getMembers().get(i).getZipName()); } String name = projectMember.getZipName(); String originalName = name; while (names.contains(name)) { /* Issue 4806 explains why we need this! */ name = ++counter + originalName; } names.add(name); stream.putNextEntry(new ZipEntry(name)); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); stream.flush(); stream.closeEntry(); } } for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + project.getMembers().get(i).getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); OldModelMemberFilePersister persister = new OldModelMemberFilePersister(); persister.save(projectMember, stream); stream.flush(); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { writer.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ZipFilePersister.java
public void doSave(Project project, File file) throws SaveException { LOG.info("Receiving file '" + file.getName() + "'"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream bufferedStream = null; try { //project.setFile(file); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); String fileName = file.getName(); ZipEntry xmiEntry = new ZipEntry(fileName.substring(0, fileName.lastIndexOf("."))); stream.putNextEntry(xmiEntry); bufferedStream = new BufferedOutputStream(stream); int size = project.getMembers().size(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + (project.getMembers() .get(i)).getType()); } MemberFilePersister persister = new ModelMemberFilePersister(); persister.save(projectMember, bufferedStream); } } stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { bufferedStream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); OutputStream stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); progressMgr.nextPhase(); String path = file.getParent(); if (LOG.isInfoEnabled()) { LOG.info("Dir ==" + path); } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
void writeProject(Project project, OutputStream oStream, ProgressMgr progressMgr) throws SaveException, InterruptedException { OutputStreamWriter outputStreamWriter; try { outputStreamWriter = new OutputStreamWriter(oStream, Argo .getEncoding()); } catch (UnsupportedEncodingException e) { throw new SaveException(e); } PrintWriter writer = new PrintWriter(new BufferedWriter( outputStreamWriter)); XmlFilterOutputStream filteredStream = new XmlFilterOutputStream( oStream, Argo.getEncoding()); try { writer.println("<?xml version = \"1.0\" " + "encoding = \"" + Argo.getEncoding() + "\" ?>"); writer.println("<uml version=\"" + PERSISTENCE_VERSION + "\">"); // Write out header section try { Hashtable templates = TemplateReader.getInstance().read( ARGO_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project, " "); } catch (ExpansionException e) { throw new SaveException(e); } writer.flush(); if (progressMgr != null) { progressMgr.nextPhase(); } // Note we assume members are ordered correctly already for (ProjectMember projectMember : project.getMembers()) { if (LOG.isInfoEnabled()) { LOG.info("Saving member : " + projectMember); } MemberFilePersister persister = getMemberFilePersister(projectMember); filteredStream.startEntry(); persister.save(projectMember, filteredStream); try { filteredStream.flush(); } catch (IOException e) { throw new SaveException(e); } } writer.println("</uml>"); writer.flush(); } finally { writer.close(); try { filteredStream.reallyClose(); } catch (IOException e) { throw new SaveException(e); } } }
// in src/org/argouml/persistence/AbstractFilePersister.java
public final void save(Project project, File file) throws SaveException, InterruptedException { preSave(project, file); doSave(project, file); postSave(project, file); }
// in src/org/argouml/persistence/AbstractFilePersister.java
private void preSave(Project project, File file) throws SaveException { if (project == null && file == null) { throw new SaveException("No project nor file given"); } }
// in src/org/argouml/persistence/AbstractFilePersister.java
private void postSave(Project project, File file) throws SaveException { if (project == null && file == null) { throw new SaveException("No project nor file given"); } }
// in src/org/argouml/persistence/MemberFilePersister.java
protected void addXmlFileToWriter(PrintWriter writer, File file) throws SaveException { try { BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream(file), Argo.getEncoding())); // Skip the <?xml... first line String line = reader.readLine(); while (line != null && (line.startsWith("<?xml ") || line.startsWith("<!DOCTYPE "))) { line = reader.readLine(); } while (line != null) { (writer).println(line); line = reader.readLine(); } reader.close(); } catch (FileNotFoundException e) { throw new SaveException(e); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void save(ProjectMember member, OutputStream outStream) throws SaveException { ProjectMemberDiagram diagramMember = (ProjectMemberDiagram) member; OCLExpander expander; try { expander = new OCLExpander( TemplateReader.getInstance().read(PGML_TEE)); } catch (ExpansionException e) { throw new SaveException(e); } OutputStreamWriter outputWriter; try { outputWriter = new OutputStreamWriter(outStream, Argo.getEncoding()); } catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); } try { // WARNING: the OutputStream version of this doesn't work! - tfm expander.expand(outputWriter, diagramMember.getDiagram()); } catch (ExpansionException e) { throw new SaveException(e); } finally { try { outputWriter.flush(); } catch (IOException e) { throw new SaveException(e); } } }
(Lib) IllegalStateException 31
              
// in src/org/argouml/ui/targetmanager/TargetManager.java
private void navigateForward() { if (currentTarget >= history.size() - 1) { throw new IllegalStateException( "NavigateForward is not allowed " + "since the targetpointer is pointing at " + "the upper boundary " + "of the history"); } setTarget(((WeakReference) history.get(++currentTarget)).get()); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
private void navigateBackward() { if (currentTarget == 0) { throw new IllegalStateException( "NavigateBackward is not allowed " + "since the targetpointer is pointing at " + "the lower boundary " + "of the history"); } navigateBackward = true; // If nothing selected, go to last selected target if (targets.size() == 0) { setTarget(((WeakReference) history.get(currentTarget)).get()); } else { setTarget(((WeakReference) history.get(--currentTarget)).get()); } navigateBackward = false; }
// in src/org/argouml/ui/ProjectBrowser.java
Deprecated public AbstractArgoJPanel getTab(Class tabClass) { // In theory there can be multiple details pane (work in // progress). It must first be determined which details // page contains the properties tab. Bob Tarling 7 Dec 2002 for (DetailsPane detailsPane : detailsPanesByCompassPoint.values()) { AbstractArgoJPanel tab = detailsPane.getTab(tabClass); if (tab != null) { return tab; } } throw new IllegalStateException("No " + tabClass.getName() + " tab found"); }
// in src/org/argouml/ui/ProjectBrowser.java
boolean trySave( final File file, final ProgressMonitor pmw, final Project project) { LOG.info("Saving the project"); PersistenceManager pm = PersistenceManager.getInstance(); ProjectFilePersister persister = null; try { String sStatus = MessageFormat.format(Translator.localize( "statusmsg.bar.save-project-status-writing"), new Object[] {file}); updateStatus (sStatus); persister = pm.getSavePersister(); pm.setSavePersister(null); if (persister == null) { persister = pm.getPersisterFromFileName(file.getName()); } if (persister == null) { throw new IllegalStateException("Filename " + project.getName() + " is not of a known file type"); } testSimulateErrors(); // Repair any errors in the project String report = project.repair(); if (report.length() > 0) { // TODO: i18n report = "An inconsistency has been detected when saving the model." + "These have been repaired and are reported below. " + "The save will continue with the model having been " + "amended as described.\n" + report; reportError( pmw, Translator.localize("dialog.repair") + report, true); } if (pmw != null) { pmw.updateProgress(25); persister.addProgressListener(pmw); } project.preSave(); persister.save(project, file); project.postSave(); ArgoEventPump.fireEvent(new ArgoStatusEvent( ArgoEventTypes.STATUS_PROJECT_SAVED, this, file.getAbsolutePath())); LOG.debug ("setting most recent project file to " + file.getCanonicalPath()); /* * notification of menu bar */ if (saveAction != null) { // Bob says - not sure how saveAction could be null here but // NPE has been reported. See issue 6233. As Tom comments // elsewhere we should be listening for file save events. // That would allow us to have a final saveAction instance // that can never be null saveAction.setEnabled(false); } addFileSaved(file); Configuration.setString(Argo.KEY_MOST_RECENT_PROJECT_FILE, file.getCanonicalPath()); return true; } catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); } return false; }
// in src/org/argouml/ui/ProjectBrowser.java
public Project loadProject2(File file, boolean showUI, ProgressMonitor pmw) { LOG.info("Loading project."); PersistenceManager pm = PersistenceManager.getInstance(); Project oldProject = ProjectManager.getManager().getCurrentProject(); if (oldProject != null) { // Remove the old project first. It's wasteful to create a temp // empty project, but too much of ArgoUML depends on having a // current project Project p = ProjectManager.getManager().makeEmptyProject(); ProjectManager.getManager().setCurrentProject(p); ProjectManager.getManager().removeProject(oldProject); oldProject = p; } boolean success = false; // TODO: // This is actually a hack! Some diagram types // (like the statechart diagrams) access the current // diagram to get some info. This might cause // problems if there's another statechart diagram // active, so I remove the current project, before // loading the new one. Designer.disableCritiquing(); Designer.clearCritiquing(); clearDialogs(); Project project = null; if (!(file.canRead())) { reportError(pmw, "File not found " + file + ".", showUI); Designer.enableCritiquing(); success = false; } else { // Hide save action during load. Otherwise we get the // * appearing in title bar and the save enabling as models are // updated // TODO: Do we still need this now the save enablement is improved? final AbstractAction rememberedSaveAction = this.saveAction; this.saveAction = null; ProjectManager.getManager().setSaveAction(null); try { ProjectFilePersister persister = pm.getPersisterFromFileName(file.getName()); if (persister == null) { throw new IllegalStateException("Filename " + file.getName() + " is not of a known file type"); } if (pmw != null) { persister.addProgressListener(pmw); } project = persister.doLoad(file); if (pmw != null) { persister.removeProgressListener(pmw); } ThreadUtils.checkIfInterrupted(); // if (Model.getDiagramInterchangeModel() != null) { // TODO: This assumes no more than one project at a time // will be loaded. If it is ever reinstituted, this needs to // be fixed // Collection diagrams = // DiagramFactory.getInstance().getDiagram(); // Iterator diag = diagrams.iterator(); // while (diag.hasNext()) { // project.addMember(diag.next()); // } // if (!diagrams.isEmpty()) { // project.setActiveDiagram( // (ArgoDiagram) diagrams.iterator().next()); // } // } // Let's save this project in the mru list this.addFileSaved(file); // Let's save this project as the last used one // in the configuration file Configuration.setString(Argo.KEY_MOST_RECENT_PROJECT_FILE, file.getCanonicalPath()); updateStatus( Translator.localize( "statusmsg.bar.open-project-status-read", new Object[] {file.getName(), })); success = true; } catch (VersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI); } catch (OutOfMemoryError ex) { LOG.error("Out of memory while loading project", ex); reportError( pmw, Translator.localize("dialog.error.memory.limit"), showUI); } catch (java.lang.InterruptedException ex) { LOG.error("Project loading interrupted by user"); } catch (UmlVersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI, ex); } catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } } catch (IOException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); } catch (OpenException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); } catch (XmiReferenceRuntimeException ex) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix reportError(pmw, Translator.localize("dialog.error.xmi.reference.error", new Object[] {ex.getReference(), ex.getMessage()}), ex.toString(), showUI); } catch (RuntimeException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); } finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); } } }
// in src/org/argouml/uml/ui/UMLConditionExpressionModel.java
public void setExpression(Object expression) { Object target = TargetManager.getInstance().getTarget(); if (target == null) { throw new IllegalStateException("There is no target for " + getContainer()); } Model.getUseCasesHelper().setCondition(target, expression); }
// in src/org/argouml/uml/ui/UMLRecurrenceExpressionModel.java
public void setExpression(Object expression) { Object target = TargetManager.getInstance().getTarget(); if (target == null) { throw new IllegalStateException("There is no target for " + getContainer()); } Model.getCommonBehaviorHelper().setRecurrence(target, expression); }
// in src/org/argouml/uml/ui/LabelledLayout.java
private void layoutSection( final Container parent, final int sectionX, final int sectionWidth, final ArrayList components, final int sectionNo) { final ArrayList<Integer> rowHeights = new ArrayList<Integer>(); final int componentCount = components.size(); if (componentCount == 0) { return; } int labelWidth = 0; int unknownHeightCount = 0; int totalHeight = 0; // Build up an array list of the heights of each label/component pair. // Heights of zero indicate a proportional height. Component previousComp = null; for (int i = 0; i < componentCount; ++i) { final Component childComp = (Component) components.get(i); final int childHeight; if (childComp instanceof JLabel) { final JLabel jlabel = (JLabel) childComp; final Component labelledComp = jlabel.getLabelFor(); labelWidth = Math.max(labelWidth, getPreferredWidth(jlabel)); if (labelledComp != null) { ++i; childHeight = getChildHeight(labelledComp); if (childHeight == 0) { ++unknownHeightCount; } } else { childHeight = getPreferredHeight(jlabel); } totalHeight += childHeight + this.vgap; rowHeights.add(new Integer(childHeight)); } else { // to manage the case there are no label/component // pairs but just one component childHeight = getChildHeight(childComp); if (childHeight == 0) { ++unknownHeightCount; } totalHeight += childHeight + this.vgap; rowHeights.add(new Integer(childHeight)); } previousComp = childComp; } totalHeight -= this.vgap; final Insets insets = parent.getInsets(); final int parentHeight = parent.getHeight() - (insets.top + insets.bottom); // Set the child components to the heights in the array list // calculating the height of any proportional component on the // fly. FIXME - This assumes that the JLabel and the // component it labels have been added to the parent component // consecutively. int y = insets.top; int row = 0; previousComp = null; for (int i = 0; i < componentCount; ++i) { Component childComp = (Component) components.get(i); if (childComp.isVisible()) { int rowHeight; int componentWidth = sectionWidth; int componentX = sectionX; // If the component is a JLabel which has another // component assigned then position/size the label and // calculate the size of the registered component if (childComp instanceof JLabel && ((JLabel) childComp).getLabelFor() != null) { i++; // Assumes the next child is the labelled component final JLabel jlabel = (JLabel) childComp; childComp = jlabel.getLabelFor(); jlabel.setBounds(sectionX, y, labelWidth, getPreferredHeight(jlabel)); componentWidth = sectionWidth - (labelWidth); componentX = sectionX + labelWidth; } rowHeight = rowHeights.get(row).intValue(); if (rowHeight == 0) { try { rowHeight = calculateHeight( parentHeight, totalHeight, unknownHeightCount--, childComp); } catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); } totalHeight += rowHeight; } // Make sure the component width isn't any greater // than its maximum allowed width if (childComp.getMaximumSize() != null && getMaximumWidth(childComp) < componentWidth) { componentWidth = getMaximumWidth(childComp); } childComp.setBounds(componentX, y, componentWidth, rowHeight); y += rowHeight + this.vgap; ++row; previousComp = childComp; } } }
// in src/org/argouml/uml/ui/ActionNewDiagram.java
Override public void actionPerformed(ActionEvent e) { // TODO: Get Project or other necessary context from source?? // e.getSource(); // TODO: Since there may be multiple top level elements in // a project, this should be using the default Namespace (currently // undefined) or something similar Project p = ProjectManager.getManager().getCurrentProject(); Object ns = findNamespace(); if (ns != null && isValidNamespace(ns)) { super.actionPerformed(e); DiagramSettings settings = p.getProjectSettings().getDefaultDiagramSettings(); ArgoDiagram diagram = createDiagram(ns, settings); assert (diagram != null) : "No diagram was returned by the concrete class"; p.addMember(diagram); //TODO: make the explorer listen to project member property //changes... to eliminate coupling on gui. ExplorerEventAdaptor.getInstance().modelElementAdded( diagram.getNamespace()); TargetManager.getInstance().setTarget(diagram); } else { LOG.error("No valid namespace found"); throw new IllegalStateException("No valid namespace found"); } }
// in src/org/argouml/uml/ui/behavior/state_machines/UMLChangeExpressionModel.java
public void setExpression(Object expression) { Object target = TargetManager.getInstance().getTarget(); if (target == null) { throw new IllegalStateException("There is no target for " + getContainer()); } Model.getStateMachinesHelper().setChangeExpression(target, expression); }
// in src/org/argouml/uml/ui/behavior/collaborations/ActionAddMessagePredecessor.java
protected List getSelected() { if (getTarget() == null) { throw new IllegalStateException( "getSelected may not be called with null target"); } List vec = new ArrayList(); vec.addAll(Model.getFacade().getPredecessors(getTarget())); return vec; }
// in src/org/argouml/uml/ui/behavior/collaborations/ActionAddMessagePredecessor.java
protected void doIt(Collection selected) { if (getTarget() == null) { throw new IllegalStateException( "doIt may not be called with null target"); } Object message = getTarget(); Model.getCollaborationsHelper().setPredecessors(message, selected); }
// in src/org/argouml/uml/ui/ActionAddDiagram.java
Override public void actionPerformed(ActionEvent e) { // TODO: The project should be bound to the action when it is created? Project p = ProjectManager.getManager().getCurrentProject(); Object ns = findNamespace(); if (ns != null && isValidNamespace(ns)) { super.actionPerformed(e); DiagramSettings settings = p.getProjectSettings().getDefaultDiagramSettings(); // TODO: We should really be passing the default settings to // the diagram factory so they get set at creation time ArgoDiagram diagram = createDiagram(ns, settings); p.addMember(diagram); //TODO: make the explorer listen to project member property //changes... to eliminate coupling on gui. ExplorerEventAdaptor.getInstance().modelElementAdded(ns); TargetManager.getInstance().setTarget(diagram); } else { LOG.error("No valid namespace found"); throw new IllegalStateException("No valid namespace found"); } }
// in src/org/argouml/uml/ui/UMLChangeDispatch.java
private void synchronizedDispatch(Container cont) { if (target == null) { throw new IllegalStateException("Target may not be null in " + "synchronized dispatch"); } synchronized (target) { dispatch(cont); } }
// in src/org/argouml/uml/ui/UMLTimeExpressionModel.java
public void setExpression(Object expression) { Object target = TargetManager.getInstance().getTarget(); if (target == null) { throw new IllegalStateException("There is no target for " + getContainer()); } Model.getStateMachinesHelper().setWhen(target, expression); }
// in src/org/argouml/uml/diagram/ui/FigGeneralization.java
private void fixup(Object owner) { if (Model.getFacade().isAGeneralization(owner)) { Object subType = Model.getFacade().getSpecific(owner); Object superType = Model.getFacade().getGeneral(owner); if (subType == null || superType == null) { // TODO: We should warn the user we have removed something - tfm removeFromDiagram(); return; } updateDiscriminatorText(); // show it } else if (owner != null) { throw new IllegalStateException( "FigGeneralization has an illegal owner of " + owner.getClass().getName()); } }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private Fig getNoEdgePresentationFor(Object element) { if (element == null) { throw new IllegalArgumentException("Can't search for a null owner"); } List contents = PgmlUtility.getContentsNoEdges(getLayer()); int figCount = contents.size(); for (int figIndex = 0; figIndex < figCount; ++figIndex) { Fig fig = (Fig) contents.get(figIndex); if (fig.getOwner() == element) { return fig; } } throw new IllegalStateException("Can't find a FigNode representing " + Model.getFacade().getName(element)); }
// in src/org/argouml/uml/diagram/DiagramFactory.java
private ArgoDiagram createInternal(final DiagramType type, final Object namespace, final Object machine, DiagramSettings settings) { final ArgoDiagram diagram; if (settings == null) { throw new IllegalArgumentException( "DiagramSettings may not be null"); } Object factory = factories.get(type); if (factory != null) { Object owner; if (machine != null) { owner = machine; } else { owner = namespace; } if (factory instanceof DiagramFactoryInterface2) { diagram = ((DiagramFactoryInterface2) factory).createDiagram( owner, (String) null, settings); } else if (factory instanceof DiagramFactoryInterface) { diagram = ((DiagramFactoryInterface) factory).createDiagram( namespace, machine); diagram.setDiagramSettings(settings); } else { // This shouldn't be possible, but just in case throw new IllegalStateException( "Unknown factory type registered"); } } else { if ((type == DiagramType.State || type == DiagramType.Activity) && machine == null) { diagram = createDiagram(diagramClasses.get(type), null, namespace); } else { diagram = createDiagram(diagramClasses.get(type), namespace, machine); } diagram.setDiagramSettings(settings); } return diagram; }
// in src/org/argouml/uml/diagram/collaboration/ui/ActionAddClassifierRole.java
public Object makeNode() { Object node = null; Editor ce = Globals.curEditor(); GraphModel gm = ce.getGraphModel(); if (gm instanceof CollabDiagramGraphModel) { Object collaboration = ((CollabDiagramGraphModel) gm).getOwner(); node = Model.getCollaborationsFactory().buildLifeline(collaboration); } else { throw new IllegalStateException("Graphmodel is not a " + "collaboration diagram graph model"); } return node; }
// in src/org/argouml/uml/diagram/collaboration/ui/UMLCollaborationDiagram.java
public void postLoad() { super.postLoad(); if (getNamespace() == null) { throw new IllegalStateException( "The namespace of the collaboration diagram is not set"); } Collection messages; Iterator msgIterator; Collection ownedElements = Model.getFacade().getOwnedElements(getNamespace()); Iterator oeIterator = ownedElements.iterator(); Layer lay = getLayer(); while (oeIterator.hasNext()) { Object me = oeIterator.next(); if (Model.getFacade().isAAssociationRole(me)) { messages = Model.getFacade().getMessages(me); msgIterator = messages.iterator(); while (msgIterator.hasNext()) { Object message = msgIterator.next(); FigMessage figMessage = (FigMessage) lay.presentationFor(message); if (figMessage != null) { figMessage.addPathItemToFigAssociationRole(lay); } } } } }
// in src/org/argouml/uml/diagram/UmlDiagramRenderer.java
protected final void setPorts(Layer layer, FigEdge newEdge) { Object modelElement = newEdge.getOwner(); if (newEdge.getSourcePortFig() == null) { Object source; if (modelElement instanceof CommentEdge) { source = ((CommentEdge) modelElement).getSource(); } else { source = Model.getUmlHelper().getSource(modelElement); } FigNode sourceNode = getNodePresentationFor(layer, source); assert (sourceNode != null) : "No FigNode found for " + source; setSourcePort(newEdge, sourceNode); } if (newEdge.getDestPortFig() == null) { Object dest; if (modelElement instanceof CommentEdge) { dest = ((CommentEdge) modelElement).getDestination(); } else { dest = Model.getUmlHelper().getDestination(newEdge.getOwner()); } setDestPort(newEdge, getNodePresentationFor(layer, dest)); } if (newEdge.getSourcePortFig() == null || newEdge.getDestPortFig() == null) { throw new IllegalStateException("Edge of type " + newEdge.getClass().getName() + " created with no source or destination port"); } }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
Deprecated public UMLStateDiagram(Object ns, Object machine) { this(); if (!Model.getFacade().isAStateMachine(machine)) { throw new IllegalStateException( "No StateMachine given to create a Statechart diagram"); } if (ns == null) { ns = getNamespaceFromMachine(machine); } if (!Model.getFacade().isANamespace(ns)) { throw new IllegalArgumentException(); } nameDiagram(ns); setup(ns, machine); }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
private Object getNamespaceFromMachine(Object machine) { if (!Model.getFacade().isAStateMachine(machine)) { throw new IllegalStateException( "No StateMachine given to create a Statechart diagram"); } Object ns = Model.getFacade().getNamespace(machine); if (ns != null) { return ns; } Object context = Model.getFacade().getContext(machine); if (Model.getFacade().isAClassifier(context)) { ns = context; } else if (Model.getFacade().isABehavioralFeature(context)) { ns = Model.getFacade().getNamespace( // or just the owner? Model.getFacade().getOwner(context)); } if (ns == null) { ns = getProject().getRoots().iterator().next(); } if (ns == null || !Model.getFacade().isANamespace(ns)) { throw new IllegalStateException( "Can not deduce a Namespace from a StateMachine"); } return ns; }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
Override public Object getOwner() { if (!(getGraphModel() instanceof StateDiagramGraphModel)) { throw new IllegalStateException( "Incorrect graph model of " + getGraphModel().getClass().getName()); } StateDiagramGraphModel gm = (StateDiagramGraphModel) getGraphModel(); return gm.getMachine(); }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
Override public void initialize(Object o) { if (Model.getFacade().isAStateMachine(o)) { Object machine = o; Object contextNamespace = getNamespaceFromMachine(machine); setup(contextNamespace, machine); } else { throw new IllegalStateException( "Cannot find namespace " + "while initializing " + "statechart diagram"); } }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
public void initialize(Object o) { if (!(Model.getFacade().isAActivityGraph(o))) { return; } Object context = Model.getFacade().getContext(o); if (context != null) { if (Model.getFacade().isABehavioralFeature(context)) { setup(Model.getFacade().getNamespace( Model.getFacade().getOwner(context)), o); } else { setup(context, o); } } else { Object namespace4Diagram = Model.getFacade().getNamespace(o); if (namespace4Diagram != null) { setup(namespace4Diagram, o); } else { throw new IllegalStateException("Cannot find context " + "nor namespace while initializing activity diagram"); } } }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
public Object getOwner() { if (!(getGraphModel() instanceof ActivityDiagramGraphModel)) { throw new IllegalStateException( "Incorrect graph model of " + getGraphModel().getClass().getName()); } ActivityDiagramGraphModel gm = (ActivityDiagramGraphModel) getGraphModel(); return gm.getMachine(); }
// in src/org/argouml/persistence/PGMLStackParser.java
private FigNode getFigNode(String figId) throws IllegalStateException { if (figId.contains(".")) { // If the id does not look like a top-level Fig then we can assume // that this is an id of a FigEdgePort inside some FigEdge. // So extract the FigEdgePort from the FigEdge and return that as // the FigNode. figId = figId.substring(0, figId.indexOf('.')); FigEdgeModelElement edge = (FigEdgeModelElement) findFig(figId); if (edge == null) { throw new IllegalStateException("Can't find a FigNode with id " + figId); } edge.makeEdgePort(); return edge.getEdgePort(); } else { // If there is no dot then this must be a top level Fig and can be // assumed to be a FigNode. Fig f = findFig(figId); if (f instanceof FigNode) { return (FigNode) f; } else { LOG.error("FigID " + figId + " is not a node, edge ignored"); return null; } } }
1
              
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
3
              
// in src/org/argouml/ui/targetmanager/TargetManager.java
public void navigateForward() throws IllegalStateException { historyManager.navigateForward(); LOG.debug("Navigate forward"); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
public void navigateBackward() throws IllegalStateException { historyManager.navigateBackward(); LOG.debug("Navigate backward"); }
// in src/org/argouml/persistence/PGMLStackParser.java
private FigNode getFigNode(String figId) throws IllegalStateException { if (figId.contains(".")) { // If the id does not look like a top-level Fig then we can assume // that this is an id of a FigEdgePort inside some FigEdge. // So extract the FigEdgePort from the FigEdge and return that as // the FigNode. figId = figId.substring(0, figId.indexOf('.')); FigEdgeModelElement edge = (FigEdgeModelElement) findFig(figId); if (edge == null) { throw new IllegalStateException("Can't find a FigNode with id " + figId); } edge.makeEdgePort(); return edge.getEdgePort(); } else { // If there is no dot then this must be a top level Fig and can be // assumed to be a FigNode. Fig f = findFig(figId); if (f instanceof FigNode) { return (FigNode) f; } else { LOG.error("FigID " + figId + " is not a node, edge ignored"); return null; } } }
(Domain) OpenException 30
              
// in src/org/argouml/persistence/XmiFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { LOG.info("Loading with XMIFilePersister"); try { Project p = ProjectFactory.getInstance().createProject(); long length = file.length(); long phaseSpace = 100000; int phases = (int) (length / phaseSpace); if (phases < 10) { phaseSpace = length / 10; phases = 10; } LOG.info("File length is " + length + " phase space is " + phaseSpace + " phases is " + phases); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(phases); ThreadUtils.checkIfInterrupted(); InputSource source = new InputSource(new XmiInputStream(file .toURI().toURL().openStream(), this, phaseSpace, progressMgr)); source.setSystemId(file.toURI().toURL().toString()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(source); Object model = modelPersister.getCurModel(); progressMgr.nextPhase(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); // TODO Handle multiple top level packages p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); p.updateRoots(); File defaultProjectFile = new File(file.getPath() + ".zargo"); // Make sure the file doesn't exist so the user will // get prompted to choose a new name for (int i = 0; i < 99; i++) { if (!defaultProjectFile.exists()) { break; } defaultProjectFile = new File(file.getPath() + "." + i + ".zargo"); } PersistenceManager.getInstance().setProjectURI( defaultProjectFile.toURI(), p); progressMgr.nextPhase(); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/XmiFilePersister.java
public void parseXmiExtensions(Project project) throws OpenException { if (argoString != null) { LOG.info("Parsing argoString " + argoString.length()); StringReader inputStream = new StringReader(argoString); ArgoParser parser = new ArgoParser(); try { parser.readProject(project, inputStream); } catch (Exception e) { throw new OpenException("Exception caught", e); } } else { project.addMember(new ProjectMemberTodoList("", project)); } for (String pgml : pgmlStrings) { LOG.info("Parsing pgml " + pgml.length()); InputStream inputStream = new ByteArrayInputStream(pgml.getBytes()); MemberFilePersister persister = // TODO: Cyclic dependency between PersistanceManager and here PersistenceManager.getInstance() .getDiagramMemberFilePersister(); // possibly use the following instead // MemberFilePersister persister = new DiagramMemberFilePersister(); persister.load(project, inputStream); } if (todoString != null) { LOG.info("Parsing todoString " + todoString.length()); InputStream inputStream = new ByteArrayInputStream(todoString.getBytes()); MemberFilePersister persister = null; persister = new TodoListMemberFilePersister(); persister.load(project, inputStream); } else { project.addMember(new ProjectMemberTodoList("", project)); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public Project doLoad(File file) throws OpenException, InterruptedException { ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(3 + UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); int fileVersion; String releaseVersion; try { String argoEntry = getEntryNames(file, ".argo").iterator().next(); URL argoUrl = makeZipEntryUrl(toURL(file), argoEntry); fileVersion = getPersistenceVersion(argoUrl.openStream()); releaseVersion = getReleaseVersion(argoUrl.openStream()); } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } // TODO: The commented code below was commented out by Bob Tarling // in order to resolve bugs 4845 and 4857. Hopefully we can // determine the cause and reintroduce. //boolean upgradeRequired = !checkVersion(fileVersion, releaseVersion) boolean upgradeRequired = true; // Upgrade is in the way for UML2 projects, so we turn it off in that case: if (Model.getFacade().getUmlVersion().charAt(0) == '2') { upgradeRequired = false; } LOG.info("Loading zargo file of version " + fileVersion); final Project p; if (upgradeRequired) { File combinedFile = zargoToUml(file, progressMgr); p = super.doLoad(file, combinedFile, progressMgr); } else { p = loadFromZargo(file, progressMgr); } progressMgr.nextPhase(); PersistenceManager.getInstance().setProjectURI(file.toURI(), p); return p; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private Project loadFromZargo(File file, ProgressMgr progressMgr) throws OpenException { Project p = ProjectFactory.getInstance().createProject(file.toURI()); try { progressMgr.nextPhase(); // Load .argo project descriptor ArgoParser parser = new ArgoParser(); String argoEntry = getEntryNames(file, ".argo").iterator().next(); parser.readProject(p, new InputSource(makeZipEntryUrl(toURL(file), argoEntry).toExternalForm())); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); // Load .xmi file before any PGML files // FIXME: the following is loading the model before anything else. // Due to the Zargo containing the profiles, currently we have // removed this hack in UmlFilePersister and I think it should be // removed from here also. String xmiEntry = getEntryNames(file, ".xmi").iterator().next(); MemberFilePersister persister = getMemberFilePersister("xmi"); URL url = makeZipEntryUrl(toURL(file), xmiEntry); persister.load(p, new InputSource(url.toExternalForm())); // Load the rest List<String> entries = getEntryNames(file, null); for (String name : entries) { String ext = name.substring(name.lastIndexOf('.') + 1); if (!"argo".equals(ext) && !"xmi".equals(ext)) { persister = getMemberFilePersister(ext); LOG.info("Loading member with " + persister.getClass().getName()); url = makeZipEntryUrl(toURL(file), name); persister.load(p, new InputSource(url.toExternalForm())); } } progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); p.postLoad(); return p; } catch (InterruptedException e) { return null; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
private File zargoToUml(File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { File combinedFile = null; try { combinedFile = File.createTempFile("combinedzargo_", ".uml"); LOG.info( "Combining old style zargo sub files into new style uml file " + combinedFile.getAbsolutePath()); combinedFile.deleteOnExit(); String encoding = Argo.getEncoding(); FileOutputStream stream = new FileOutputStream(combinedFile); PrintWriter writer = new PrintWriter(new BufferedWriter( new OutputStreamWriter(stream, encoding))); writer.println("<?xml version = \"1.0\" " + "encoding = \"" + encoding + "\" ?>"); copyArgo(file, encoding, writer); progressMgr.nextPhase(); copyMember(file, "profile", encoding, writer); copyXmi(file, encoding, writer); copyDiagrams(file, encoding, writer); // Copy the todo items after the model and diagrams so that // any model elements or figs that the todo items refer to // will exist before creating critics. copyMember(file, "todo", encoding, writer); progressMgr.nextPhase(); writer.println("</uml>"); writer.close(); LOG.info("Completed combining files"); } catch (IOException e) { throw new OpenException(e); } return combinedFile; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyArgo(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, OpenException, UnsupportedEncodingException { int pgmlCount = getPgmlCount(file); boolean containsToDo = containsTodo(file); boolean containsProfile = containsProfile(file); // first read the .argo file from Zip ZipInputStream zis = openZipStreamAt(toURL(file), FileConstants.PROJECT_FILE_EXT); if (zis == null) { throw new OpenException( "There is no .argo file in the .zargo"); } String line; BufferedReader reader = new BufferedReader(new InputStreamReader(zis, encoding)); // Keep reading till we hit the <argo> tag String rootLine; do { rootLine = reader.readLine(); if (rootLine == null) { throw new OpenException( "Can't find an <argo> tag in the argo file"); } } while(!rootLine.startsWith("<argo")); // Get the version from the tag. String version = getVersion(rootLine); writer.println("<uml version=\"" + version + "\">"); writer.println(rootLine); LOG.info("Transfering argo contents"); int memberCount = 0; while ((line = reader.readLine()) != null) { if (line.trim().startsWith("<member")) { ++memberCount; } if (line.trim().equals("</argo>") && memberCount == 0) { LOG.info("Inserting member info"); writer.println("<member type='xmi' name='.xmi' />"); for (int i = 0; i < pgmlCount; ++i) { writer.println("<member type='pgml' name='.pgml' />"); } if (containsToDo) { writer.println("<member type='todo' name='.todo' />"); } if (containsProfile) { String type = ProfileConfiguration.EXTENSION; writer.println("<member type='" + type + "' name='." + type + "' />"); } } writer.println(line); } if (LOG.isInfoEnabled()) { LOG.info("Member count = " + memberCount); } zis.close(); reader.close(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void load(Project project, InputSource inputSource) throws OpenException { try { ProfileConfigurationParser parser = new ProfileConfigurationParser(); parser.parse(inputSource); Collection<Profile> profiles = parser.getProfiles(); Collection<String> unresolved = parser.getUnresolvedFilenames(); if (!unresolved.isEmpty()) { profiles.addAll(loadUnresolved(unresolved)); } ProfileConfiguration pc = new ProfileConfiguration(project, profiles); project.setProfileConfiguration(pc); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void load(Project project, InputStream inputStream) throws OpenException { try { load(project, new InputSource(new InputStreamReader(inputStream, Argo.getEncoding()))); } catch (UnsupportedEncodingException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void load(Project project, InputSource inputSource) throws OpenException { try { TodoParser parser = new TodoParser(); parser.readTodoList(inputSource); ProjectMemberTodoList pm = new ProjectMemberTodoList("", project); project.addMember(pm); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public synchronized void readModels(URL url, XmiExtensionParser xmiExtensionParser) throws OpenException { LOG.info("======================================="); LOG.info("== READING MODEL " + url); try { // TODO: What progressMgr is to be used here? Where does // it come from? InputSource source = new InputSource(new XmiInputStream( url.openStream(), xmiExtensionParser, 100000, null)); source.setSystemId(url.toString()); readModels(source); } catch (IOException ex) { throw new OpenException(ex); } }
// in src/org/argouml/persistence/ZipFilePersister.java
public Project doLoad(File file) throws OpenException { LOG.info("Receiving file '" + file.getName() + "'"); try { Project p = ProjectFactory.getInstance().createProject(); String fileName = file.getName(); String extension = fileName.substring( fileName.indexOf('.'), fileName.lastIndexOf('.')); InputStream stream = openZipStreamAt(file.toURI().toURL(), extension); // TODO: What progressMgr is to be used here? Where does // it come from? InputSource is = new InputSource( new XmiInputStream(stream, this, 100000, null)); is.setSystemId(file.toURI().toURL().toExternalForm()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(is); // TODO Handle multiple top level packages Object model = modelPersister.getCurModel(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected Project doLoad(File originalFile, File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { XmlInputStream inputStream = null; try { Project p = ProjectFactory.getInstance() .createProject(file.toURI()); // Run through any stylesheet upgrades int fileVersion = getPersistenceVersionFromFile(file); LOG.info("Loading uml file of version " + fileVersion); if (!checkVersion(fileVersion, getReleaseVersionFromFile(file))) { // If we're about to upgrade the file lets take an archive // of it first. String release = getReleaseVersionFromFile(file); copyFile(originalFile, new File(originalFile.getAbsolutePath() + '~' + release)); progressMgr.setNumberOfPhases(progressMgr.getNumberOfPhases() + (PERSISTENCE_VERSION - fileVersion)); while (fileVersion < PERSISTENCE_VERSION) { ++fileVersion; LOG.info("Upgrading to version " + fileVersion); long startTime = System.currentTimeMillis(); file = transform(file, fileVersion); long endTime = System.currentTimeMillis(); LOG.info("Upgrading took " + ((endTime - startTime) / 1000) + " seconds"); progressMgr.nextPhase(); } } progressMgr.nextPhase(); inputStream = new XmlInputStream(file.toURI().toURL().openStream(), "argo", file.length(), 100000); ArgoParser parser = new ArgoParser(); Reader reader = new InputStreamReader(inputStream, Argo .getEncoding()); parser.readProject(p, reader); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); for (int i = 0; i < memberList.size(); ++i) { MemberFilePersister persister = getMemberFilePersister((String) memberList .get(i)); LOG.info("Loading member with " + persister.getClass().getName()); inputStream.reopen(persister.getMainTag()); // TODO: Do we need to set the input encoding here? It was // done for ToDo parsing, but none of the other member types // InputSource inputSource = new InputSource( // new InputStreamReader(inputStream, Argo // .getEncoding())); InputSource inputSource = new InputSource(inputStream); // Don't use systemId here or it will get opened in preference // to inputStream. inputSource.setPublicId(originalFile.toURI().toURL() .toExternalForm()); try { persister.load(p, inputSource); } catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } } } // let's update the progress progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); inputStream.realClose(); p.postLoad(); return p; } catch (InterruptedException e) { throw e; } catch (OpenException e) { throw e; } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public final File transform(File file, int version) throws OpenException { try { String upgradeFilesPath = "/org/argouml/persistence/upgrades/"; String upgradeFile = "upgrade" + version + ".xsl"; String xsltFileName = upgradeFilesPath + upgradeFile; URL xsltUrl = UmlFilePersister.class.getResource(xsltFileName); LOG.info("Resource is " + xsltUrl); // Read xsltStream into a temporary file // Get url for temp file. // openStream from url and wrap in StreamSource StreamSource xsltStreamSource = new StreamSource(xsltUrl .openStream()); xsltStreamSource.setSystemId(xsltUrl.toExternalForm()); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(xsltStreamSource); File transformedFile = File.createTempFile("upgrade_" + version + "_", ".uml"); transformedFile.deleteOnExit(); FileOutputStream stream = new FileOutputStream(transformedFile); Writer writer = new BufferedWriter(new OutputStreamWriter(stream, Argo.getEncoding())); Result result = new StreamResult(writer); StreamSource inputStreamSource = new StreamSource(file); inputStreamSource.setSystemId(file); transformer.transform(inputStreamSource, result); writer.close(); return transformedFile; } catch (IOException e) { throw new OpenException(e); } catch (TransformerException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
private int getPersistenceVersionFromFile(File file) throws OpenException { InputStream stream = null; try { stream = new BufferedInputStream(file.toURI().toURL().openStream()); int version = getPersistenceVersion(stream); stream.close(); return version; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected int getPersistenceVersion(InputStream inputStream) throws OpenException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream, Argo .getEncoding())); String rootLine = reader.readLine(); while (rootLine != null && !rootLine.trim().startsWith("<argo ")) { rootLine = reader.readLine(); } if (rootLine == null) { return 1; } return Integer.parseInt(getVersion(rootLine)); } catch (IOException e) { throw new OpenException(e); } catch (NumberFormatException e) { throw new OpenException(e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } } }
// in src/org/argouml/persistence/UmlFilePersister.java
private String getReleaseVersionFromFile(File file) throws OpenException { InputStream stream = null; try { stream = new BufferedInputStream(file.toURI().toURL().openStream()); String version = getReleaseVersion(stream); stream.close(); return version; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected String getReleaseVersion(InputStream inputStream) throws OpenException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream, Argo .getEncoding())); String versionLine = reader.readLine(); while (!versionLine.trim().startsWith("<version>")) { versionLine = reader.readLine(); if (versionLine == null) { throw new OpenException( "Failed to find the release <version> tag"); } } versionLine = versionLine.trim(); int end = versionLine.lastIndexOf("</version>"); return versionLine.trim().substring(9, end); } catch (IOException e) { throw new OpenException(e); } catch (NumberFormatException e) { throw new OpenException(e); } finally { try { if (inputStream != null) { inputStream.close(); } if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, InputStream inputStream) throws OpenException { load(project, new InputSource(inputStream)); try { inputStream.close(); } catch (IOException e) { throw new OpenException("I/O error on stream close", e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, InputSource inputSource) throws OpenException { // If the model repository doesn't manage a DI model // then we must generate our Figs by inspecting PGML try { // Give the parser a map of model elements // keyed by their UUID. This is used to allocate // figs to their owner using the "href" attribute // in PGML. DiagramSettings defaultSettings = project.getProjectSettings().getDefaultDiagramSettings(); // TODO: We need the project specific diagram settings here PGMLStackParser parser = new PGMLStackParser(project.getUUIDRefs(), defaultSettings); LOG.info("Adding translations registered by modules"); for (Map.Entry<String, String> translation : CLASS_TRANSLATIONS.entrySet()) { parser.addTranslation( translation.getKey(), translation.getValue()); } ArgoDiagram d = parser.readArgoDiagram(inputSource, false); project.addMember(d); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
27
              
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { throw new OpenException("Exception caught", e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException ex) { throw new OpenException(ex); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (TransformerException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new OpenException("I/O error on stream close", e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
29
              
// in src/org/argouml/persistence/XmiFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { LOG.info("Loading with XMIFilePersister"); try { Project p = ProjectFactory.getInstance().createProject(); long length = file.length(); long phaseSpace = 100000; int phases = (int) (length / phaseSpace); if (phases < 10) { phaseSpace = length / 10; phases = 10; } LOG.info("File length is " + length + " phase space is " + phaseSpace + " phases is " + phases); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(phases); ThreadUtils.checkIfInterrupted(); InputSource source = new InputSource(new XmiInputStream(file .toURI().toURL().openStream(), this, phaseSpace, progressMgr)); source.setSystemId(file.toURI().toURL().toString()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(source); Object model = modelPersister.getCurModel(); progressMgr.nextPhase(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); // TODO Handle multiple top level packages p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); p.updateRoots(); File defaultProjectFile = new File(file.getPath() + ".zargo"); // Make sure the file doesn't exist so the user will // get prompted to choose a new name for (int i = 0; i < 99; i++) { if (!defaultProjectFile.exists()) { break; } defaultProjectFile = new File(file.getPath() + "." + i + ".zargo"); } PersistenceManager.getInstance().setProjectURI( defaultProjectFile.toURI(), p); progressMgr.nextPhase(); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/XmiFilePersister.java
public void parseXmiExtensions(Project project) throws OpenException { if (argoString != null) { LOG.info("Parsing argoString " + argoString.length()); StringReader inputStream = new StringReader(argoString); ArgoParser parser = new ArgoParser(); try { parser.readProject(project, inputStream); } catch (Exception e) { throw new OpenException("Exception caught", e); } } else { project.addMember(new ProjectMemberTodoList("", project)); } for (String pgml : pgmlStrings) { LOG.info("Parsing pgml " + pgml.length()); InputStream inputStream = new ByteArrayInputStream(pgml.getBytes()); MemberFilePersister persister = // TODO: Cyclic dependency between PersistanceManager and here PersistenceManager.getInstance() .getDiagramMemberFilePersister(); // possibly use the following instead // MemberFilePersister persister = new DiagramMemberFilePersister(); persister.load(project, inputStream); } if (todoString != null) { LOG.info("Parsing todoString " + todoString.length()); InputStream inputStream = new ByteArrayInputStream(todoString.getBytes()); MemberFilePersister persister = null; persister = new TodoListMemberFilePersister(); persister.load(project, inputStream); } else { project.addMember(new ProjectMemberTodoList("", project)); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public Project doLoad(File file) throws OpenException, InterruptedException { ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(3 + UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); int fileVersion; String releaseVersion; try { String argoEntry = getEntryNames(file, ".argo").iterator().next(); URL argoUrl = makeZipEntryUrl(toURL(file), argoEntry); fileVersion = getPersistenceVersion(argoUrl.openStream()); releaseVersion = getReleaseVersion(argoUrl.openStream()); } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } // TODO: The commented code below was commented out by Bob Tarling // in order to resolve bugs 4845 and 4857. Hopefully we can // determine the cause and reintroduce. //boolean upgradeRequired = !checkVersion(fileVersion, releaseVersion) boolean upgradeRequired = true; // Upgrade is in the way for UML2 projects, so we turn it off in that case: if (Model.getFacade().getUmlVersion().charAt(0) == '2') { upgradeRequired = false; } LOG.info("Loading zargo file of version " + fileVersion); final Project p; if (upgradeRequired) { File combinedFile = zargoToUml(file, progressMgr); p = super.doLoad(file, combinedFile, progressMgr); } else { p = loadFromZargo(file, progressMgr); } progressMgr.nextPhase(); PersistenceManager.getInstance().setProjectURI(file.toURI(), p); return p; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private Project loadFromZargo(File file, ProgressMgr progressMgr) throws OpenException { Project p = ProjectFactory.getInstance().createProject(file.toURI()); try { progressMgr.nextPhase(); // Load .argo project descriptor ArgoParser parser = new ArgoParser(); String argoEntry = getEntryNames(file, ".argo").iterator().next(); parser.readProject(p, new InputSource(makeZipEntryUrl(toURL(file), argoEntry).toExternalForm())); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); // Load .xmi file before any PGML files // FIXME: the following is loading the model before anything else. // Due to the Zargo containing the profiles, currently we have // removed this hack in UmlFilePersister and I think it should be // removed from here also. String xmiEntry = getEntryNames(file, ".xmi").iterator().next(); MemberFilePersister persister = getMemberFilePersister("xmi"); URL url = makeZipEntryUrl(toURL(file), xmiEntry); persister.load(p, new InputSource(url.toExternalForm())); // Load the rest List<String> entries = getEntryNames(file, null); for (String name : entries) { String ext = name.substring(name.lastIndexOf('.') + 1); if (!"argo".equals(ext) && !"xmi".equals(ext)) { persister = getMemberFilePersister(ext); LOG.info("Loading member with " + persister.getClass().getName()); url = makeZipEntryUrl(toURL(file), name); persister.load(p, new InputSource(url.toExternalForm())); } } progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); p.postLoad(); return p; } catch (InterruptedException e) { return null; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
private File zargoToUml(File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { File combinedFile = null; try { combinedFile = File.createTempFile("combinedzargo_", ".uml"); LOG.info( "Combining old style zargo sub files into new style uml file " + combinedFile.getAbsolutePath()); combinedFile.deleteOnExit(); String encoding = Argo.getEncoding(); FileOutputStream stream = new FileOutputStream(combinedFile); PrintWriter writer = new PrintWriter(new BufferedWriter( new OutputStreamWriter(stream, encoding))); writer.println("<?xml version = \"1.0\" " + "encoding = \"" + encoding + "\" ?>"); copyArgo(file, encoding, writer); progressMgr.nextPhase(); copyMember(file, "profile", encoding, writer); copyXmi(file, encoding, writer); copyDiagrams(file, encoding, writer); // Copy the todo items after the model and diagrams so that // any model elements or figs that the todo items refer to // will exist before creating critics. copyMember(file, "todo", encoding, writer); progressMgr.nextPhase(); writer.println("</uml>"); writer.close(); LOG.info("Completed combining files"); } catch (IOException e) { throw new OpenException(e); } return combinedFile; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyArgo(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, OpenException, UnsupportedEncodingException { int pgmlCount = getPgmlCount(file); boolean containsToDo = containsTodo(file); boolean containsProfile = containsProfile(file); // first read the .argo file from Zip ZipInputStream zis = openZipStreamAt(toURL(file), FileConstants.PROJECT_FILE_EXT); if (zis == null) { throw new OpenException( "There is no .argo file in the .zargo"); } String line; BufferedReader reader = new BufferedReader(new InputStreamReader(zis, encoding)); // Keep reading till we hit the <argo> tag String rootLine; do { rootLine = reader.readLine(); if (rootLine == null) { throw new OpenException( "Can't find an <argo> tag in the argo file"); } } while(!rootLine.startsWith("<argo")); // Get the version from the tag. String version = getVersion(rootLine); writer.println("<uml version=\"" + version + "\">"); writer.println(rootLine); LOG.info("Transfering argo contents"); int memberCount = 0; while ((line = reader.readLine()) != null) { if (line.trim().startsWith("<member")) { ++memberCount; } if (line.trim().equals("</argo>") && memberCount == 0) { LOG.info("Inserting member info"); writer.println("<member type='xmi' name='.xmi' />"); for (int i = 0; i < pgmlCount; ++i) { writer.println("<member type='pgml' name='.pgml' />"); } if (containsToDo) { writer.println("<member type='todo' name='.todo' />"); } if (containsProfile) { String type = ProfileConfiguration.EXTENSION; writer.println("<member type='" + type + "' name='." + type + "' />"); } } writer.println(line); } if (LOG.isInfoEnabled()) { LOG.info("Member count = " + memberCount); } zis.close(); reader.close(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void load(Project project, InputStream inputStream) throws OpenException { load(project, new InputSource(inputStream)); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void load(Project project, InputSource inputSource) throws OpenException { try { ProfileConfigurationParser parser = new ProfileConfigurationParser(); parser.parse(inputSource); Collection<Profile> profiles = parser.getProfiles(); Collection<String> unresolved = parser.getUnresolvedFilenames(); if (!unresolved.isEmpty()) { profiles.addAll(loadUnresolved(unresolved)); } ProfileConfiguration pc = new ProfileConfiguration(project, profiles); project.setProfileConfiguration(pc); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
Override public void load(Project project, URL url) throws OpenException { load(project, new InputSource(url.toExternalForm())); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void load(Project project, InputStream inputStream) throws OpenException { try { load(project, new InputSource(new InputStreamReader(inputStream, Argo.getEncoding()))); } catch (UnsupportedEncodingException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void load(Project project, InputSource inputSource) throws OpenException { try { TodoParser parser = new TodoParser(); parser.readTodoList(inputSource); ProjectMemberTodoList pm = new ProjectMemberTodoList("", project); project.addMember(pm); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
Override public void load(Project project, URL url) throws OpenException { load(project, new InputSource(url.toExternalForm())); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void load(Project project, URL url) throws OpenException { load(project, new InputSource(url.toExternalForm())); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void load(Project project, InputStream inputStream) throws OpenException { load(project, new InputSource(inputStream)); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void load(Project project, InputSource source) throws OpenException { Object mmodel = null; // 2002-07-18 // Jaap Branderhorst // changed the loading of the projectfiles to solve hanging // of argouml if a project is corrupted. Issue 913 // Created xmireader with method getErrors to check if parsing went well try { source.setEncoding(Argo.getEncoding()); readModels(source); mmodel = getCurModel(); } catch (OpenException e) { LOG.error("UmlException caught", e); throw e; } // This should probably be inside xmiReader.parse // but there is another place in this source // where XMIReader is used, but it appears to be // the NSUML XMIReader. When Argo XMIReader is used // consistently, it can be responsible for loading // the listener. Until then, do it here. Model.getUmlHelper().addListenersToModel(mmodel); // TODO Add all top level packages project.addMember(mmodel); project.setUUIDRefs(new HashMap<String, Object>(getUUIDRefs())); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public synchronized void readModels(URL url, XmiExtensionParser xmiExtensionParser) throws OpenException { LOG.info("======================================="); LOG.info("== READING MODEL " + url); try { // TODO: What progressMgr is to be used here? Where does // it come from? InputSource source = new InputSource(new XmiInputStream( url.openStream(), xmiExtensionParser, 100000, null)); source.setSystemId(url.toString()); readModels(source); } catch (IOException ex) { throw new OpenException(ex); } }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public synchronized void readModels(InputSource source) throws OpenException { XmiReader reader = null; try { reader = Model.getXmiReader(); if (Configuration.getBoolean(Argo.KEY_XMI_STRIP_DIAGRAMS, false)) { // TODO: Not implemented by eUML reader.setIgnoredElements(new String[] {"UML:Diagram"}); } else { reader.setIgnoredElements(null); } List<String> searchPath = reader.getSearchPath(); String pathList = System.getProperty("org.argouml.model.modules_search_path"); if (pathList != null) { String[] paths = pathList.split(","); for (String path : paths) { if (!searchPath.contains(path)) { reader.addSearchPath(path); } } } reader.addSearchPath(source.getSystemId()); curModel = null; elementsRead = reader.parse(source, false); if (elementsRead != null && !elementsRead.isEmpty()) { Facade facade = Model.getFacade(); Object current; Iterator elements = elementsRead.iterator(); while (elements.hasNext()) { current = elements.next(); if (facade.isAModel(current)) { LOG.info("Loaded model '" + facade.getName(current) + "'"); if (curModel == null) { curModel = current; } } else if (facade.isAProfile(current)) { LOG.info("Loaded profile '" + facade.getName(current) + "'"); if (curModel == null) { curModel = current; } } // TODO: add stereotype application (eCore AnyType?) } } uUIDRefs = new HashMap<String, Object>(reader.getXMIUUIDToObjectMap()); } catch (XmiException ex) { throw new XmiFormatException(ex); } catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); } LOG.info("======================================="); }
// in src/org/argouml/persistence/ZipFilePersister.java
public Project doLoad(File file) throws OpenException { LOG.info("Receiving file '" + file.getName() + "'"); try { Project p = ProjectFactory.getInstance().createProject(); String fileName = file.getName(); String extension = fileName.substring( fileName.indexOf('.'), fileName.lastIndexOf('.')); InputStream stream = openZipStreamAt(file.toURI().toURL(), extension); // TODO: What progressMgr is to be used here? Where does // it come from? InputSource is = new InputSource( new XmiInputStream(stream, this, 100000, null)); is.setSystemId(file.toURI().toURL().toExternalForm()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(is); // TODO Handle multiple top level packages Object model = modelPersister.getCurModel(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { // let's initialize the progressMgr ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); return doLoad(file, file, progressMgr); }
// in src/org/argouml/persistence/UmlFilePersister.java
protected Project doLoad(File originalFile, File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { XmlInputStream inputStream = null; try { Project p = ProjectFactory.getInstance() .createProject(file.toURI()); // Run through any stylesheet upgrades int fileVersion = getPersistenceVersionFromFile(file); LOG.info("Loading uml file of version " + fileVersion); if (!checkVersion(fileVersion, getReleaseVersionFromFile(file))) { // If we're about to upgrade the file lets take an archive // of it first. String release = getReleaseVersionFromFile(file); copyFile(originalFile, new File(originalFile.getAbsolutePath() + '~' + release)); progressMgr.setNumberOfPhases(progressMgr.getNumberOfPhases() + (PERSISTENCE_VERSION - fileVersion)); while (fileVersion < PERSISTENCE_VERSION) { ++fileVersion; LOG.info("Upgrading to version " + fileVersion); long startTime = System.currentTimeMillis(); file = transform(file, fileVersion); long endTime = System.currentTimeMillis(); LOG.info("Upgrading took " + ((endTime - startTime) / 1000) + " seconds"); progressMgr.nextPhase(); } } progressMgr.nextPhase(); inputStream = new XmlInputStream(file.toURI().toURL().openStream(), "argo", file.length(), 100000); ArgoParser parser = new ArgoParser(); Reader reader = new InputStreamReader(inputStream, Argo .getEncoding()); parser.readProject(p, reader); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); for (int i = 0; i < memberList.size(); ++i) { MemberFilePersister persister = getMemberFilePersister((String) memberList .get(i)); LOG.info("Loading member with " + persister.getClass().getName()); inputStream.reopen(persister.getMainTag()); // TODO: Do we need to set the input encoding here? It was // done for ToDo parsing, but none of the other member types // InputSource inputSource = new InputSource( // new InputStreamReader(inputStream, Argo // .getEncoding())); InputSource inputSource = new InputSource(inputStream); // Don't use systemId here or it will get opened in preference // to inputStream. inputSource.setPublicId(originalFile.toURI().toURL() .toExternalForm()); try { persister.load(p, inputSource); } catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } } } // let's update the progress progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); inputStream.realClose(); p.postLoad(); return p; } catch (InterruptedException e) { throw e; } catch (OpenException e) { throw e; } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected boolean checkVersion(int fileVersion, String releaseVersion) throws OpenException, VersionException { // If we're trying to load a file from a future version // complain and refuse. if (fileVersion > PERSISTENCE_VERSION) { throw new VersionException( "The file selected is from a more up to date version of " + "ArgoUML. It has been saved with ArgoUML version " + releaseVersion + ". Please load with that or a more up to date" + "release of ArgoUML"); } return fileVersion >= PERSISTENCE_VERSION; }
// in src/org/argouml/persistence/UmlFilePersister.java
public final File transform(File file, int version) throws OpenException { try { String upgradeFilesPath = "/org/argouml/persistence/upgrades/"; String upgradeFile = "upgrade" + version + ".xsl"; String xsltFileName = upgradeFilesPath + upgradeFile; URL xsltUrl = UmlFilePersister.class.getResource(xsltFileName); LOG.info("Resource is " + xsltUrl); // Read xsltStream into a temporary file // Get url for temp file. // openStream from url and wrap in StreamSource StreamSource xsltStreamSource = new StreamSource(xsltUrl .openStream()); xsltStreamSource.setSystemId(xsltUrl.toExternalForm()); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(xsltStreamSource); File transformedFile = File.createTempFile("upgrade_" + version + "_", ".uml"); transformedFile.deleteOnExit(); FileOutputStream stream = new FileOutputStream(transformedFile); Writer writer = new BufferedWriter(new OutputStreamWriter(stream, Argo.getEncoding())); Result result = new StreamResult(writer); StreamSource inputStreamSource = new StreamSource(file); inputStreamSource.setSystemId(file); transformer.transform(inputStreamSource, result); writer.close(); return transformedFile; } catch (IOException e) { throw new OpenException(e); } catch (TransformerException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
private int getPersistenceVersionFromFile(File file) throws OpenException { InputStream stream = null; try { stream = new BufferedInputStream(file.toURI().toURL().openStream()); int version = getPersistenceVersion(stream); stream.close(); return version; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected int getPersistenceVersion(InputStream inputStream) throws OpenException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream, Argo .getEncoding())); String rootLine = reader.readLine(); while (rootLine != null && !rootLine.trim().startsWith("<argo ")) { rootLine = reader.readLine(); } if (rootLine == null) { return 1; } return Integer.parseInt(getVersion(rootLine)); } catch (IOException e) { throw new OpenException(e); } catch (NumberFormatException e) { throw new OpenException(e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } } }
// in src/org/argouml/persistence/UmlFilePersister.java
private String getReleaseVersionFromFile(File file) throws OpenException { InputStream stream = null; try { stream = new BufferedInputStream(file.toURI().toURL().openStream()); String version = getReleaseVersion(stream); stream.close(); return version; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected String getReleaseVersion(InputStream inputStream) throws OpenException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream, Argo .getEncoding())); String versionLine = reader.readLine(); while (!versionLine.trim().startsWith("<version>")) { versionLine = reader.readLine(); if (versionLine == null) { throw new OpenException( "Failed to find the release <version> tag"); } } versionLine = versionLine.trim(); int end = versionLine.lastIndexOf("</version>"); return versionLine.trim().substring(9, end); } catch (IOException e) { throw new OpenException(e); } catch (NumberFormatException e) { throw new OpenException(e); } finally { try { if (inputStream != null) { inputStream.close(); } if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, InputStream inputStream) throws OpenException { load(project, new InputSource(inputStream)); try { inputStream.close(); } catch (IOException e) { throw new OpenException("I/O error on stream close", e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, InputSource inputSource) throws OpenException { // If the model repository doesn't manage a DI model // then we must generate our Figs by inspecting PGML try { // Give the parser a map of model elements // keyed by their UUID. This is used to allocate // figs to their owner using the "href" attribute // in PGML. DiagramSettings defaultSettings = project.getProjectSettings().getDefaultDiagramSettings(); // TODO: We need the project specific diagram settings here PGMLStackParser parser = new PGMLStackParser(project.getUUIDRefs(), defaultSettings); LOG.info("Adding translations registered by modules"); for (Map.Entry<String, String> translation : CLASS_TRANSLATIONS.entrySet()) { parser.addTranslation( translation.getKey(), translation.getValue()); } ArgoDiagram d = parser.readArgoDiagram(inputSource, false); project.addMember(d); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, URL url) throws OpenException { load(project, new InputSource(url.toExternalForm())); }
(Lib) RuntimeException 17
              
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
private void removeElementListeners(Set<Object[]> listenerSet) { for (Object[] listener : listenerSet) { Object property = listener[1]; if (property == null) { Model.getPump().removeModelEventListener(this, listener[0]); } else if (property instanceof String[]) { Model.getPump().removeModelEventListener(this, listener[0], (String[]) property); } else if (property instanceof String) { Model.getPump().removeModelEventListener(this, listener[0], (String) property); } else { throw new RuntimeException( "Internal error in removeAllElementListeners"); } } listeners.removeAll(listenerSet); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
private void addElementListeners(Set<Object[]> listenerSet) { for (Object[] listener : listenerSet) { Object property = listener[1]; if (property == null) { addElementListener(listener[0]); } else if (property instanceof String[]) { addElementListener(listener[0], (String[]) property); } else if (property instanceof String) { addElementListener(listener[0], (String) property); } else { throw new RuntimeException( "Internal error in addElementListeners"); } } }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private void removeElementListeners(Set<Object[]> listenerSet) { for (Object[] listener : listenerSet) { Object property = listener[1]; if (property == null) { Model.getPump().removeModelEventListener(this, listener[0]); } else if (property instanceof String[]) { Model.getPump().removeModelEventListener(this, listener[0], (String[]) property); } else if (property instanceof String) { Model.getPump().removeModelEventListener(this, listener[0], (String) property); } else { throw new RuntimeException( "Internal error in removeAllElementListeners"); } } listeners.removeAll(listenerSet); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private void addElementListeners(Set<Object[]> listenerSet) { for (Object[] listener : listenerSet) { Object property = listener[1]; if (property == null) { addElementListener(listener[0]); } else if (property instanceof String[]) { addElementListener(listener[0], (String[]) property); } else if (property instanceof String) { addElementListener(listener[0], (String) property); } else { throw new RuntimeException( "Internal error in addElementListeners"); } } }
// in src/org/argouml/uml/reveng/DiagramInterface.java
public boolean isDiagramInProject(String name) { if (currentProject == null) { throw new RuntimeException("current project not set yet"); } return currentProject.getDiagram(getDiagramName(name)) != null; }
// in src/org/argouml/uml/reveng/DiagramInterface.java
public void selectClassDiagram(Object p, String name) { // Check if this diagram already exists in the project if (currentProject == null) { throw new RuntimeException("current project not set yet"); } ArgoDiagram m = currentProject.getDiagram(getDiagramName(name)); if (m != null) { // The diagram already exists in this project. Select it // as the current target. setCurrentDiagram(m); } else { // Otherwise create a new classdiagram for the package. addClassDiagram(p, name); } }
// in src/org/argouml/uml/reveng/DiagramInterface.java
public void addClassDiagram(Object ns, String name) { if (currentProject == null) { throw new RuntimeException("current project not set yet"); } ArgoDiagram d = DiagramFactory.getInstance().createDiagram( DiagramFactory.DiagramType.Class, ns == null ? currentProject.getRoot() : ns, null); try { d.setName(getDiagramName(name)); } catch (PropertyVetoException pve) { LOG.error("Failed to set diagram name.", pve); } currentProject.addMember(d); setCurrentDiagram(d); }
// in src/org/argouml/uml/reveng/DiagramInterface.java
public void setCurrentDiagram(ArgoDiagram diagram) { if (diagram == null) { throw new RuntimeException("you can't select a null diagram"); } currentGM = (ClassDiagramGraphModel) diagram.getGraphModel(); currentLayer = diagram.getLayer(); currentDiagram = diagram; currentProject = diagram.getProject(); markDiagramAsModified(diagram); }
// in src/org/argouml/profile/ProfileFacade.java
private static void notInitialized(String string) { throw new RuntimeException("ProfileFacade's " + string + " isn't initialized!"); }
// in src/org/argouml/profile/internal/ocl/EvaluateExpression.java
private void errorNotType(Object node, String type, Object dft) { LOG.error("OCL does not evaluate to a " + type + " expression!! Exp: " + node + " Val: " + val); val = dft; // TODO: We need a specific exception type here. throw new RuntimeException(); }
// in src/org/argouml/profile/internal/ocl/EvaluateExpression.java
private void error(Object node) { LOG.error("Unknown error processing OCL exp!! Exp: " + node + " Val: " + val); val = null; // TODO: We need a specific exception type here. throw new RuntimeException(); }
// in src/org/argouml/notation/NotationProvider.java
protected final void removeAllElementListeners( PropertyChangeListener listener) { for (Object[] lis : listeners) { Object property = lis[1]; if (property == null) { Model.getPump().removeModelEventListener(listener, lis[0]); } else if (property instanceof String[]) { Model.getPump().removeModelEventListener(listener, lis[0], (String[]) property); } else if (property instanceof String) { Model.getPump().removeModelEventListener(listener, lis[0], (String) property); } else { throw new RuntimeException( "Internal error in removeAllElementListeners"); } } listeners.clear(); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public String getMainTag() { try { return Model.getXmiReader().getTagName(); } catch (UmlException e) { // Should never happen - something's really wrong throw new RuntimeException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void write(int b) throws IOException { if (headerProcessed) { out.write(b); } else { outBB.put((byte) b); inBB.limit(outBB.position()); // Convert from bytes back to characters CoderResult result = decoder.decode(inBB, outCB, false); if (result.isError()) { throw new RuntimeException( "Unknown character decoding error"); } // This will have problems if the smallest possible // data segment is smaller than the size of the buffer // needed for regex matching if (outCB.position() == outCB.limit()) { processHeader(); } } }
2
              
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // TODO: Why is this throwing a generic runtime exception?!?! throw new RuntimeException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { // Should never happen - something's really wrong throw new RuntimeException(e); }
0
(Domain) ProfileException 15
              
// in src/org/argouml/profile/ZipModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from ZIP '" + reference.getPath() + "'"); if (!reference.getPath().endsWith("zip")) { throw new ProfileException("Profile could not be loaded!"); } InputStream is = null; File modelFile = new File(reference.getPath()); // TODO: This is in the wrong place. It's not profile specific. // It needs to be moved to main XMI reading code. - tfm 20060326 String filename = modelFile.getName(); String extension = filename.substring(filename.indexOf('.'), filename.lastIndexOf('.')); String path = modelFile.getParent(); // Add the path of the model to the search path, so we can // read dependent models if (path != null) { System.setProperty("org.argouml.model.modules_search_path", path); } try { is = openZipStreamAt(modelFile.toURI().toURL(), extension); } catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); } catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); } if (is == null) { throw new ProfileException("Profile could not be loaded!"); } return super.loadModel(is, reference.getPublicReference()); }
// in src/org/argouml/profile/ReaderModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { if (reader == null) { LOG.error("Profile not found"); throw new ProfileException("Profile not found!"); } try { XmiReader xmiReader = Model.getXmiReader(); InputSource inputSource = new InputSource(reader); inputSource.setSystemId(reference.getPath()); inputSource.setPublicId( reference.getPublicReference().toString()); Collection elements = xmiReader.parse(inputSource, true); return elements; } catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); } }
// in src/org/argouml/profile/FileModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from file'" + reference.getPath() + "'"); try { File modelFile = new File(reference.getPath()); URL url = modelFile.toURI().toURL(); return super.loadModel(url, reference.getPublicReference()); } catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); } }
// in src/org/argouml/profile/StreamModelLoader.java
public Collection loadModel(InputStream inputStream, URL publicReference) throws ProfileException { if (inputStream == null) { LOG.error("Profile not found"); throw new ProfileException("Profile not found!"); } try { XmiReader xmiReader = Model.getXmiReader(); InputSource inputSource = new InputSource(inputStream); inputSource.setPublicId(publicReference.toString()); Collection elements = xmiReader.parse(inputSource, true); return elements; } catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); } }
// in src/org/argouml/profile/URLModelLoader.java
public Collection loadModel(URL url, URL publicId) throws ProfileException { if (url == null) { throw new ProfileException("Null profile URL"); } Collection elements = Model.getUmlFactory().getExtentElements(publicId.toExternalForm()); if (elements == null) { ZipInputStream zis = null; try { XmiReader xmiReader = Model.getXmiReader(); if (url.getPath().toLowerCase().endsWith(".zip")) { zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); // TODO: check if it's OK to just get the first zip entry // since the zip file should contain only one xmi file - thn if (entry != null) { url = makeZipEntryUrl(url, entry.getName()); } zis.close(); } InputSource inputSource = new InputSource(url.toExternalForm()); inputSource.setPublicId(publicId.toString()); elements = xmiReader.parse(inputSource, true); } catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); } catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); } } return elements; }
10
              
// in src/org/argouml/profile/ZipModelLoader.java
catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (MalformedURLException e) { throw new ProfileException( "Failed to create the ProfileReference.", e); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/ReaderModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/FileModelLoader.java
catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); }
// in src/org/argouml/profile/StreamModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); }
17
              
// in src/org/argouml/profile/ZipModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from ZIP '" + reference.getPath() + "'"); if (!reference.getPath().endsWith("zip")) { throw new ProfileException("Profile could not be loaded!"); } InputStream is = null; File modelFile = new File(reference.getPath()); // TODO: This is in the wrong place. It's not profile specific. // It needs to be moved to main XMI reading code. - tfm 20060326 String filename = modelFile.getName(); String extension = filename.substring(filename.indexOf('.'), filename.lastIndexOf('.')); String path = modelFile.getParent(); // Add the path of the model to the search path, so we can // read dependent models if (path != null) { System.setProperty("org.argouml.model.modules_search_path", path); } try { is = openZipStreamAt(modelFile.toURI().toURL(), extension); } catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); } catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); } if (is == null) { throw new ProfileException("Profile could not be loaded!"); } return super.loadModel(is, reference.getPublicReference()); }
// in src/org/argouml/profile/UserDefinedProfile.java
Deprecated public UserDefinedProfile(File file) throws ProfileException { this(file, getSomeProfileManager()); }
// in src/org/argouml/profile/UserDefinedProfile.java
Deprecated public UserDefinedProfile(URL url) throws ProfileException { this(url, getSomeProfileManager()); }
// in src/org/argouml/profile/UserDefinedProfile.java
Deprecated public UserDefinedProfile(String dn, URL url, Set<Critic> critics, Set<String> dependencies) throws ProfileException { this(dn, url, critics, dependencies, getSomeProfileManager()); }
// in src/org/argouml/profile/ResourceModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from resource'" + reference.getPath() + "'"); return super.loadModel(clazz.getResource(reference.getPath()), reference.getPublicReference()); }
// in src/org/argouml/profile/Profile.java
public Collection getProfilePackages() throws ProfileException { return Collections.emptyList(); }
// in src/org/argouml/profile/Profile.java
public Collection getLoadedPackages() throws ProfileException { return getProfilePackages(); }
// in src/org/argouml/profile/internal/ProfileMeta.java
Override public Collection getProfilePackages() throws ProfileException { return Collections.unmodifiableCollection(getModel()); }
// in src/org/argouml/profile/ReaderModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { if (reader == null) { LOG.error("Profile not found"); throw new ProfileException("Profile not found!"); } try { XmiReader xmiReader = Model.getXmiReader(); InputSource inputSource = new InputSource(reader); inputSource.setSystemId(reference.getPath()); inputSource.setPublicId( reference.getPublicReference().toString()); Collection elements = xmiReader.parse(inputSource, true); return elements; } catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); } }
// in src/org/argouml/profile/FileModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from file'" + reference.getPath() + "'"); try { File modelFile = new File(reference.getPath()); URL url = modelFile.toURI().toURL(); return super.loadModel(url, reference.getPublicReference()); } catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); } }
// in src/org/argouml/profile/StreamModelLoader.java
public Collection loadModel(InputStream inputStream, URL publicReference) throws ProfileException { if (inputStream == null) { LOG.error("Profile not found"); throw new ProfileException("Profile not found!"); } try { XmiReader xmiReader = Model.getXmiReader(); InputSource inputSource = new InputSource(inputStream); inputSource.setPublicId(publicReference.toString()); Collection elements = xmiReader.parse(inputSource, true); return elements; } catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); } }
// in src/org/argouml/profile/URLModelLoader.java
public Collection loadModel(URL url, URL publicId) throws ProfileException { if (url == null) { throw new ProfileException("Null profile URL"); } Collection elements = Model.getUmlFactory().getExtentElements(publicId.toExternalForm()); if (elements == null) { ZipInputStream zis = null; try { XmiReader xmiReader = Model.getXmiReader(); if (url.getPath().toLowerCase().endsWith(".zip")) { zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); // TODO: check if it's OK to just get the first zip entry // since the zip file should contain only one xmi file - thn if (entry != null) { url = makeZipEntryUrl(url, entry.getName()); } zis.close(); } InputSource inputSource = new InputSource(url.toExternalForm()); inputSource.setPublicId(publicId.toString()); elements = xmiReader.parse(inputSource, true); } catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); } catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); } } return elements; }
// in src/org/argouml/profile/URLModelLoader.java
public Collection loadModel(final ProfileReference reference) throws ProfileException { return loadModel(reference.getPublicReference(), reference .getPublicReference()); }
(Lib) SAXException 12
              
// in src/org/argouml/persistence/PGMLStackParser.java
Override protected final void setAttrs(Fig f, Attributes attrList) throws SAXException { if (f instanceof FigGroup) { FigGroup group = (FigGroup) f; String clsNameBounds = attrList.getValue("description"); if (clsNameBounds != null) { StringTokenizer st = new StringTokenizer(clsNameBounds, ",;[] "); // Discard class name, x y w h if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } Map<String, String> attributeMap = interpretStyle(st); setStyleAttributes(group, attributeMap); } } // TODO: Attempt to move the following code to GEF String name = attrList.getValue("name"); if (name != null && !name.equals("")) { registerFig(f, name); } setCommonAttrs(f, attrList); final String href = attrList.getValue("href"); if (href != null && !href.equals("")) { Object modelElement = findOwner(href); if (modelElement == null) { LOG.error("Can't find href of " + href); throw new SAXException("Found href of " + href + " with no matching element in model"); } // The owner should always have already been set in the constructor if (f.getOwner() != modelElement) { // Assign nodes immediately but edges later. See issue 4310. if (f instanceof FigEdge) { modelElementsByFigEdge.put((FigEdge) f, modelElement); } else { f.setOwner(modelElement); } } else { LOG.debug("Ignoring href on " + f.getClass().getName() + " as it's already set"); } } }
// in src/org/argouml/persistence/PGMLStackParser.java
Override protected Fig constructFig(final String className, final String href, final Rectangle bounds, final Attributes attributes) throws SAXException { final DiagramSettings oldSettings = ((ArgoDiagram) getDiagram()).getDiagramSettings(); Fig f = null; try { Class figClass = Class.forName(className); final Constructor[] constructors = figClass.getConstructors(); // We are looking first to match with 3 different constructor // types. We would not expect a Fig to have any mix of these. // Any constructor other than these should be deprecated so we // look for these first. // Fig(DiagramEdgeSettings, DiagramSettings) // Fig(Object, Rectangle, DiagramSettings) // Fig(Rectangle, DiagramSettings) for (Constructor constructor : constructors) { Class[] parameterTypes = constructor.getParameterTypes(); if (parameterTypes.length == 3 && parameterTypes[0].equals(Object.class) && parameterTypes[1].equals(Rectangle.class) && parameterTypes[2].equals(DiagramSettings.class)) { // FigNodeModelElements should match here final Object parameters[] = new Object[3]; final Object owner = getOwner(className, href); if (owner == null) { return null; } parameters[0] = owner; parameters[1] = bounds; parameters[2] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } else if (parameterTypes.length == 2 && parameterTypes[0].equals(DiagramEdgeSettings.class) && parameterTypes[1].equals(DiagramSettings.class)) { // FigEdgeModelElements should match here (they have no // bounds) final Object parameters[] = new Object[2]; final Object owner = getOwner(className, href); if (owner == null) { return null; } String sourceUuid = attributes.getValue("sourceConnector"); String destinationUuid = attributes .getValue("destConnector"); final Object source; final Object destination; if (sourceUuid != null && destinationUuid != null) { source = findOwner(sourceUuid); destination = findOwner(destinationUuid); } else { source = null; destination = null; } DiagramEdgeSettings newSettings = new DiagramEdgeSettings( owner, source, destination); parameters[0] = newSettings; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } else if (parameterTypes.length == 2 && parameterTypes[0].equals(Rectangle.class) && parameterTypes[1].equals(DiagramSettings.class)) { // A FigNodeModelElement with no owner should match here // TODO: This is a temporary solution due to FigPool // extending // FigNodeModelElement when in fact it should not do so. Object parameters[] = new Object[2]; parameters[0] = bounds; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } } if (f == null) { // If no Fig was created by the code above then we must go // look for the old style constructor that should have fallen // into disuse by now. // Fig(Object, Rectangle, DiagramSettings) // All of these constructors should have been deprecated // at least and replaced with the new signature. This is // here for paranoia only until all Figs have been reviewed. for (Constructor constructor : constructors) { Class[] parameterTypes = constructor.getParameterTypes(); if (parameterTypes.length == 2 && parameterTypes[0].equals(Object.class) && parameterTypes[1].equals(DiagramSettings.class)) { Object parameters[] = new Object[2]; final Object owner = getOwner(className, href); // currently FigEdgeNote can be passed null // if (owner == null) { // return null; // } parameters[0] = owner; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); LOG.warn("Fig created by old style constructor " + f.getClass().getName()); break; } } } } catch (ClassNotFoundException e) { throw new SAXException(e); } catch (IllegalAccessException e) { throw new SAXException(e); } catch (InstantiationException e) { throw new SAXException(e); } catch (InvocationTargetException e) { throw new SAXException(e); } // Fall back to GEF's handling if we couldn't find an appropriate // constructor if (f == null) { LOG.warn("No ArgoUML constructor found for " + className + " falling back to GEF's default constructors"); f = super.constructFig(className, href, bounds, attributes); } return f; }
// in src/org/argouml/persistence/SAXParserBase.java
public void parse(InputSource input) throws SAXException { long start, end; SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(false); factory.setValidating(false); try { SAXParser parser = factory.newSAXParser(); // If we weren't given a system ID, attempt to use the URL for the // JAR that we were loaded from. (Why? - tfm) if (input.getSystemId() == null) { input.setSystemId(getJarResource("org.argouml.kernel.Project")); } start = System.currentTimeMillis(); parser.parse(input, this); end = System.currentTimeMillis(); parseTime = end - start; } catch (IOException e) { throw new SAXException(e); } catch (ParserConfigurationException e) { throw new SAXException(e); } if (stats && LOG.isInfoEnabled()) { LOG.info("Elapsed time: " + (end - start) + " ms"); } }
// in src/org/argouml/persistence/SAXParserBase.java
public InputSource resolveEntity (String publicId, String systemId) throws SAXException { try { URL testIt = new URL(systemId); InputSource s = new InputSource(testIt.openStream()); return s; } catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void handleEndElement(XMLElement e) throws SAXException { try { switch (tokens.toToken(e.getName(), false)) { case ProfileConfigurationTokenTable.TOKEN_PROFILE: handleProfileEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_PLUGIN: handlePluginEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_USER_DEFINED: handleUserDefinedEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_FILENAME: handleFilenameEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_MODEL: handleModelEnd(e); break; default: LOG.warn("WARNING: unknown end tag:" + e.getName()); break; } } catch (Exception ex) { throw new SAXException(ex); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private static Profile lookupProfile(String profileIdentifier) throws SAXException { Profile profile; profile = ProfileFacade.getManager().lookForRegisteredProfile( profileIdentifier); if (profile == null) { // for compatibility with older format profile = ProfileFacade.getManager().getProfileForClass( profileIdentifier); if (profile == null) { throw new SAXException("Plugin profile \"" + profileIdentifier + "\" is not available in installation.", null); } } return profile; }
// in src/org/argouml/persistence/ArgoParser.java
protected void handleMember(XMLElement e) throws SAXException { if (e == null) { throw new SAXException("XML element is null"); } String type = e.getAttribute("type"); memberList.add(type); }
// in src/org/argouml/persistence/TodoParser.java
public void handleEndElement(XMLElement e) throws SAXException { try { switch (tokens.toToken(e.getName(), false)) { case TodoTokenTable.TOKEN_TO_DO: case TodoTokenTable.TOKEN_RESOLVEDCRITICS: case TodoTokenTable.TOKEN_TO_DO_LIST: // NOP break; case TodoTokenTable.TOKEN_TO_DO_ITEM: handleTodoItemEnd(e); break; case TodoTokenTable.TOKEN_HEADLINE: handleHeadline(e); break; case TodoTokenTable.TOKEN_DESCRIPTION: handleDescription(e); break; case TodoTokenTable.TOKEN_PRIORITY: handlePriority(e); break; case TodoTokenTable.TOKEN_MOREINFOURL: handleMoreInfoURL(e); break; case TodoTokenTable.TOKEN_ISSUE: handleIssueEnd(e); break; case TodoTokenTable.TOKEN_POSTER: handlePoster(e); break; case TodoTokenTable.TOKEN_OFFENDER: handleOffender(e); break; default: LOG.warn("WARNING: unknown end tag:" + e.getName()); break; } } catch (Exception ex) { throw new SAXException(ex); } }
9
              
// in src/org/argouml/persistence/PGMLStackParser.java
catch (ClassNotFoundException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (IllegalAccessException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InstantiationException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InvocationTargetException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (IOException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (ParserConfigurationException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception ex) { throw new SAXException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { throw new SAXException(ex); }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { throw new SAXException(ex); }
25
              
// in src/org/argouml/persistence/PrivateHandler.java
public void gotElement(String contents) throws SAXException { if (container instanceof PGMLHandler) { Object o = getPGMLStackParser().getDiagram(); if (o instanceof IItemUID) { ItemUID uid = getItemUID(contents); if (uid != null) { ((IItemUID) o).setItemUID(uid); } } // No other uses of string in PGMLHandler return; } if (container instanceof FigGroupHandler) { Object o = ((FigGroupHandler) container).getFigGroup(); if (o instanceof IItemUID) { ItemUID uid = getItemUID(contents); if (uid != null) { ((IItemUID) o).setItemUID(uid); } } } if (container instanceof FigEdgeHandler) { Object o = ((FigEdgeHandler) container).getFigEdge(); if (o instanceof IItemUID) { ItemUID uid = getItemUID(contents); if (uid != null) { ((IItemUID) o).setItemUID(uid); } } } // Handle other uses of <private> contents super.gotElement(contents); }
// in src/org/argouml/persistence/PrivateHandler.java
public void startElement(String uri, String localname, String qname, Attributes attributes) throws SAXException { if ("argouml:pathitem".equals(qname) && container instanceof FigEdgeHandler) { String classname = attributes.getValue("classname"); String figclassname = attributes.getValue("figclassname"); String ownerhref = attributes.getValue("ownerhref"); String angle = attributes.getValue("angle"); String offset = attributes.getValue("offset"); if ( classname != null && figclassname != null && ownerhref != null && angle != null && offset != null ) { // Method 2: (assign data immediately, see end of file). // TODO: if we ever want to extend PathItemPlacement, // we should modify this, so that we also recognise any // subclass of PathItemPlacement. // Is the class name a PathItemPlacment? // TODO: Use class reference to make this dependency obvious if ("org.argouml.uml.diagram.ui.PathItemPlacement".equals( classname)) { PathItemPlacementStrategy pips = getPips(figclassname, ownerhref); // Sanity check - the returned path item placement // strategy should match the one in the UML. // If it doesn't, it could be that the UML was // created with an older argo version, and the new // argo version use a different placement strategy. // If they don't match, just use the default. if (pips != null && classname.equals(pips.getClass().getName())) { // Now we're into processing each specific path // item strategy. // At the moment, we only know PathItemPlacement if (pips instanceof PathItemPlacement) { PathItemPlacement pip = (PathItemPlacement) pips; pip.setDisplacementVector( Double.parseDouble(angle), Integer.parseInt(offset)); } // Continue (future PathItemPlacementStrategy impl) //else if (...) { //} } // If the PathItemPlacement was unknown, leave the // diagram with the default settings. else { LOG.warn("PGML stored pathitem class name does " + "not match the class name on the " + "diagram. Label position will revert " + "to defaults."); } } } // If any of the values are null, ignore the element. else { LOG.warn("Could not find all attributes for <" + qname + "> tag, ignoring."); //System.out.println("Error - one of these is null:" // + "classname=" + classname // + " figclassname=" + figclassname // + " ownerhref=" + ownerhref // + " angle=" + angle // + " offset=" + offset); } } super.startElement(uri, localname, qname, attributes); }
// in src/org/argouml/persistence/FigEdgeHandler.java
public void addObject(Object o) throws SAXException { FigEdge edge = getFigEdge(); if (o instanceof FigLine || o instanceof FigPoly) { edge.setFig((Fig) o); if (o instanceof FigPoly) { ((FigPoly) o).setComplete(true); } edge.calcBounds(); if (edge instanceof FigEdgePoly) { ((FigEdgePoly) edge).setInitiallyLaidOut(true); } edge.updateAnnotationPositions(); } if (o instanceof String) { PGMLStackParser parser = getPGMLStackParser(); // Fig spf = null; // Fig dpf = null; // FigNode sfn = null; // FigNode dfn = null; String body = (String) o; StringTokenizer st2 = new StringTokenizer(body, "=\"' \t\n"); String sourcePortFig = null; String destPortFig = null; String sourceFigNode = null; String destFigNode = null; while (st2.hasMoreElements()) { String attribute = st2.nextToken(); String value = st2.nextToken(); if (attribute.equals("sourcePortFig")) { sourcePortFig = value; } if (attribute.equals("destPortFig")) { destPortFig = value; } if (attribute.equals("sourceFigNode")) { sourceFigNode = value; } if (attribute.equals("destFigNode")) { destFigNode = value; } } ((org.argouml.persistence.PGMLStackParser) parser).addFigEdge( edge, sourcePortFig, destPortFig, sourceFigNode, destFigNode); } }
// in src/org/argouml/persistence/PGMLStackParser.java
Override public DefaultHandler getHandler(HandlerStack stack, Object container, String uri, String localname, String qname, Attributes attributes) throws SAXException { String href = attributes.getValue("href"); Object owner = null; if (href != null) { owner = findOwner(href); if (owner == null) { LOG.warn("Found href of " + href + " with no matching element in model"); return null; } } // Ignore non-private elements within FigNode groups if (container instanceof FigGroupHandler) { FigGroup group = ((FigGroupHandler) container).getFigGroup(); if (group instanceof FigNode && !qname.equals("private")) { return null; } } // Handle ItemUID in container contents if (qname.equals("private") && (container instanceof Container)) { return new PrivateHandler(this, (Container) container); } DefaultHandler handler = super.getHandler(stack, container, uri, localname, qname, attributes); if (handler instanceof FigEdgeHandler) { return new org.argouml.persistence.FigEdgeHandler(this, ((FigEdgeHandler) handler).getFigEdge()); } return handler; }
// in src/org/argouml/persistence/PGMLStackParser.java
Override protected final void setAttrs(Fig f, Attributes attrList) throws SAXException { if (f instanceof FigGroup) { FigGroup group = (FigGroup) f; String clsNameBounds = attrList.getValue("description"); if (clsNameBounds != null) { StringTokenizer st = new StringTokenizer(clsNameBounds, ",;[] "); // Discard class name, x y w h if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } Map<String, String> attributeMap = interpretStyle(st); setStyleAttributes(group, attributeMap); } } // TODO: Attempt to move the following code to GEF String name = attrList.getValue("name"); if (name != null && !name.equals("")) { registerFig(f, name); } setCommonAttrs(f, attrList); final String href = attrList.getValue("href"); if (href != null && !href.equals("")) { Object modelElement = findOwner(href); if (modelElement == null) { LOG.error("Can't find href of " + href); throw new SAXException("Found href of " + href + " with no matching element in model"); } // The owner should always have already been set in the constructor if (f.getOwner() != modelElement) { // Assign nodes immediately but edges later. See issue 4310. if (f instanceof FigEdge) { modelElementsByFigEdge.put((FigEdge) f, modelElement); } else { f.setOwner(modelElement); } } else { LOG.debug("Ignoring href on " + f.getClass().getName() + " as it's already set"); } } }
// in src/org/argouml/persistence/PGMLStackParser.java
public ArgoDiagram readArgoDiagram(InputSource is, boolean closeStream) throws SAXException { InputStream stream = is.getByteStream(); if (stream == null) { try { // happens when 'is' comes from a zip file URL url = new URL(is.getSystemId()); stream = url.openStream(); closeStream = true; } catch (Exception e) { // continue with null stream, readDiagram(...) will take care of // it } } return (ArgoDiagram) readDiagram(stream, closeStream); }
// in src/org/argouml/persistence/PGMLStackParser.java
public ArgoDiagram readArgoDiagram(InputStream is, boolean closeStream) throws SAXException { return (ArgoDiagram) readDiagram(is, closeStream); }
// in src/org/argouml/persistence/PGMLStackParser.java
Override public Diagram readDiagram(InputStream is, boolean closeStream) throws SAXException { // TODO: we really want to be able replace the initial content handler // which is passed to SAX, but we can't do this without cloning a // whole bunch of code because it's private in the super class. Diagram d = super.readDiagram(is, closeStream); attachEdges(d); return d; }
// in src/org/argouml/persistence/PGMLStackParser.java
Override protected Fig constructFig(final String className, final String href, final Rectangle bounds, final Attributes attributes) throws SAXException { final DiagramSettings oldSettings = ((ArgoDiagram) getDiagram()).getDiagramSettings(); Fig f = null; try { Class figClass = Class.forName(className); final Constructor[] constructors = figClass.getConstructors(); // We are looking first to match with 3 different constructor // types. We would not expect a Fig to have any mix of these. // Any constructor other than these should be deprecated so we // look for these first. // Fig(DiagramEdgeSettings, DiagramSettings) // Fig(Object, Rectangle, DiagramSettings) // Fig(Rectangle, DiagramSettings) for (Constructor constructor : constructors) { Class[] parameterTypes = constructor.getParameterTypes(); if (parameterTypes.length == 3 && parameterTypes[0].equals(Object.class) && parameterTypes[1].equals(Rectangle.class) && parameterTypes[2].equals(DiagramSettings.class)) { // FigNodeModelElements should match here final Object parameters[] = new Object[3]; final Object owner = getOwner(className, href); if (owner == null) { return null; } parameters[0] = owner; parameters[1] = bounds; parameters[2] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } else if (parameterTypes.length == 2 && parameterTypes[0].equals(DiagramEdgeSettings.class) && parameterTypes[1].equals(DiagramSettings.class)) { // FigEdgeModelElements should match here (they have no // bounds) final Object parameters[] = new Object[2]; final Object owner = getOwner(className, href); if (owner == null) { return null; } String sourceUuid = attributes.getValue("sourceConnector"); String destinationUuid = attributes .getValue("destConnector"); final Object source; final Object destination; if (sourceUuid != null && destinationUuid != null) { source = findOwner(sourceUuid); destination = findOwner(destinationUuid); } else { source = null; destination = null; } DiagramEdgeSettings newSettings = new DiagramEdgeSettings( owner, source, destination); parameters[0] = newSettings; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } else if (parameterTypes.length == 2 && parameterTypes[0].equals(Rectangle.class) && parameterTypes[1].equals(DiagramSettings.class)) { // A FigNodeModelElement with no owner should match here // TODO: This is a temporary solution due to FigPool // extending // FigNodeModelElement when in fact it should not do so. Object parameters[] = new Object[2]; parameters[0] = bounds; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } } if (f == null) { // If no Fig was created by the code above then we must go // look for the old style constructor that should have fallen // into disuse by now. // Fig(Object, Rectangle, DiagramSettings) // All of these constructors should have been deprecated // at least and replaced with the new signature. This is // here for paranoia only until all Figs have been reviewed. for (Constructor constructor : constructors) { Class[] parameterTypes = constructor.getParameterTypes(); if (parameterTypes.length == 2 && parameterTypes[0].equals(Object.class) && parameterTypes[1].equals(DiagramSettings.class)) { Object parameters[] = new Object[2]; final Object owner = getOwner(className, href); // currently FigEdgeNote can be passed null // if (owner == null) { // return null; // } parameters[0] = owner; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); LOG.warn("Fig created by old style constructor " + f.getClass().getName()); break; } } } } catch (ClassNotFoundException e) { throw new SAXException(e); } catch (IllegalAccessException e) { throw new SAXException(e); } catch (InstantiationException e) { throw new SAXException(e); } catch (InvocationTargetException e) { throw new SAXException(e); } // Fall back to GEF's handling if we couldn't find an appropriate // constructor if (f == null) { LOG.warn("No ArgoUML constructor found for " + className + " falling back to GEF's default constructors"); f = super.constructFig(className, href, bounds, attributes); } return f; }
// in src/org/argouml/persistence/SAXParserBase.java
public void parse(Reader reader) throws SAXException { parse(new InputSource(reader)); }
// in src/org/argouml/persistence/SAXParserBase.java
public void parse(InputSource input) throws SAXException { long start, end; SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(false); factory.setValidating(false); try { SAXParser parser = factory.newSAXParser(); // If we weren't given a system ID, attempt to use the URL for the // JAR that we were loaded from. (Why? - tfm) if (input.getSystemId() == null) { input.setSystemId(getJarResource("org.argouml.kernel.Project")); } start = System.currentTimeMillis(); parser.parse(input, this); end = System.currentTimeMillis(); parseTime = end - start; } catch (IOException e) { throw new SAXException(e); } catch (ParserConfigurationException e) { throw new SAXException(e); } if (stats && LOG.isInfoEnabled()) { LOG.info("Elapsed time: " + (end - start) + " ms"); } }
// in src/org/argouml/persistence/SAXParserBase.java
public void startElement(String uri, String localname, String name, Attributes atts) throws SAXException { if (isElementOfInterest(name)) { XMLElement element = createXmlElement(name, atts); if (LOG.isDebugEnabled()) { StringBuffer buf = new StringBuffer(); buf.append("START: ").append(name).append(' ').append(element); for (int i = 0; i < atts.getLength(); i++) { buf.append(" ATT: ") .append(atts.getLocalName(i)) .append(' ') .append(atts.getValue(i)); } LOG.debug(buf.toString()); } elements[nElements++] = element; handleStartElement(element); } }
// in src/org/argouml/persistence/SAXParserBase.java
public void endElement(String uri, String localname, String name) throws SAXException { if (isElementOfInterest(name)) { XMLElement e = elements[--nElements]; if (LOG.isDebugEnabled()) { StringBuffer buf = new StringBuffer(); buf.append("END: " + e.getName() + " [" + e.getText() + "] " + e + "\n"); for (int i = 0; i < e.getNumAttributes(); i++) { buf.append(" ATT: " + e.getAttributeName(i) + " " + e.getAttributeValue(i) + "\n"); } LOG.debug(buf); } handleEndElement(e); } }
// in src/org/argouml/persistence/SAXParserBase.java
public void characters(char[] ch, int start, int length) throws SAXException { elements[nElements - 1].addText(ch, start, length); // TODO: Remove this old implementation after 0.22 if it's // demonstrated that it's not needed. - tfm // Why does the text get added to ALL the elements on the stack? - tfm // for (int i = 0; i < nElements; i++) { // XMLElement e = elements[i]; // if (e.length() > 0) { // // This seems wrong since this method can be called // // multiple times at the parser's discretion - tfm // e.addText(RETURNSTRING); // } // e.addText(ch, start, length); // } }
// in src/org/argouml/persistence/SAXParserBase.java
public InputSource resolveEntity (String publicId, String systemId) throws SAXException { try { URL testIt = new URL(systemId); InputSource s = new InputSource(testIt.openStream()); return s; } catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void handleEndElement(XMLElement e) throws SAXException { try { switch (tokens.toToken(e.getName(), false)) { case ProfileConfigurationTokenTable.TOKEN_PROFILE: handleProfileEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_PLUGIN: handlePluginEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_USER_DEFINED: handleUserDefinedEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_FILENAME: handleFilenameEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_MODEL: handleModelEnd(e); break; default: LOG.warn("WARNING: unknown end tag:" + e.getName()); break; } } catch (Exception ex) { throw new SAXException(ex); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
protected void handlePluginEnd(XMLElement e) throws SAXException { String name = e.getText().trim(); profile = lookupProfile(name); if (profile != null) { profiles.add(profile); LOG.debug("Found plugin profile " + name); } else { LOG.error("Unabled to find plugin profile - " + name); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private static Profile lookupProfile(String profileIdentifier) throws SAXException { Profile profile; profile = ProfileFacade.getManager().lookForRegisteredProfile( profileIdentifier); if (profile == null) { // for compatibility with older format profile = ProfileFacade.getManager().getProfileForClass( profileIdentifier); if (profile == null) { throw new SAXException("Plugin profile \"" + profileIdentifier + "\" is not available in installation.", null); } } return profile; }
// in src/org/argouml/persistence/ArgoParser.java
public void readProject(Project theProject, InputSource source) throws SAXException { if (source == null) { throw new IllegalArgumentException( "An InputSource must be supplied"); } preRead(theProject); try { parse(source); } catch (SAXException e) { logError(source.toString(), e); throw e; } }
// in src/org/argouml/persistence/ArgoParser.java
public void readProject(Project theProject, Reader reader) throws SAXException { if (reader == null) { throw new IllegalArgumentException( "A reader must be supplied"); } preRead(theProject); try { parse(reader); } catch (SAXException e) { logError(reader.toString(), e); throw e; } }
// in src/org/argouml/persistence/ArgoParser.java
public void handleStartElement(XMLElement e) throws SAXException { if (DBG) { LOG.debug("NOTE: ArgoParser handleStartTag:" + e.getName()); } switch (tokens.toToken(e.getName(), true)) { case ArgoTokenTable.TOKEN_ARGO: handleArgo(e); break; case ArgoTokenTable.TOKEN_DOCUMENTATION: handleDocumentation(e); break; case ArgoTokenTable.TOKEN_SETTINGS: handleSettings(e); break; default: if (DBG) { LOG.warn("WARNING: unknown tag:" + e.getName()); } break; } }
// in src/org/argouml/persistence/ArgoParser.java
protected void handleMember(XMLElement e) throws SAXException { if (e == null) { throw new SAXException("XML element is null"); } String type = e.getAttribute("type"); memberList.add(type); }
// in src/org/argouml/persistence/TodoParser.java
public synchronized void readTodoList( InputSource inputSource) throws SAXException { LOG.info("Reading ToDo list"); parse(inputSource); }
// in src/org/argouml/persistence/TodoParser.java
public synchronized void readTodoList( Reader is) throws SAXException { LOG.info("======================================="); LOG.info("== READING TO DO LIST"); parse(is); }
// in src/org/argouml/persistence/TodoParser.java
public void handleEndElement(XMLElement e) throws SAXException { try { switch (tokens.toToken(e.getName(), false)) { case TodoTokenTable.TOKEN_TO_DO: case TodoTokenTable.TOKEN_RESOLVEDCRITICS: case TodoTokenTable.TOKEN_TO_DO_LIST: // NOP break; case TodoTokenTable.TOKEN_TO_DO_ITEM: handleTodoItemEnd(e); break; case TodoTokenTable.TOKEN_HEADLINE: handleHeadline(e); break; case TodoTokenTable.TOKEN_DESCRIPTION: handleDescription(e); break; case TodoTokenTable.TOKEN_PRIORITY: handlePriority(e); break; case TodoTokenTable.TOKEN_MOREINFOURL: handleMoreInfoURL(e); break; case TodoTokenTable.TOKEN_ISSUE: handleIssueEnd(e); break; case TodoTokenTable.TOKEN_POSTER: handlePoster(e); break; case TodoTokenTable.TOKEN_OFFENDER: handleOffender(e); break; default: LOG.warn("WARNING: unknown end tag:" + e.getName()); break; } } catch (Exception ex) { throw new SAXException(ex); } }
(Lib) IndexOutOfBoundsException 8
              
// in src/org/argouml/uml/ui/TabTaggedValuesModel.java
static Object getFromCollection(Collection collection, int index) { if (collection instanceof List) { return ((List) collection).get(index); } if (index >= collection.size() || index < 0) { throw new IndexOutOfBoundsException(); } Iterator it = collection.iterator(); for (int i = 0; i < index; i++) { it.next(); } return it.next(); }
// in src/org/argouml/cognitive/ui/GoListToDecisionsToItems.java
public Object getChild(Object parent, int index) { if (parent instanceof ToDoList) { return getDecisionList().get(index); } if (parent instanceof Decision) { Decision dec = (Decision) parent; List<ToDoItem> itemList = Designer.theDesigner().getToDoList().getToDoItemList(); synchronized (itemList) { for (ToDoItem item : itemList) { if (item.getPoster().supports(dec)) { if (index == 0) { return item; } index--; } } } } throw new IndexOutOfBoundsException("getChild shouldn't get here " + "GoListToDecisionsToItems"); }
// in src/org/argouml/cognitive/ui/GoListToGoalsToItems.java
public Object getChild(Object parent, int index) { if (parent instanceof ToDoList) { return getGoalList().get(index); } if (parent instanceof Goal) { Goal g = (Goal) parent; List<ToDoItem> itemList = Designer.theDesigner().getToDoList().getToDoItemList(); synchronized (itemList) { for (ToDoItem item : itemList) { if (item.getPoster().supports(g)) { if (index == 0) { return item; } index--; } } } } throw new IndexOutOfBoundsException("getChild shouldnt get here " + "GoListToGoalsToItems"); }
// in src/org/argouml/cognitive/ui/GoListToTypeToItem.java
public Object getChild(Object parent, int index) { if (parent instanceof ToDoList) { return KnowledgeTypeNode.getTypeList().get(index); } if (parent instanceof KnowledgeTypeNode) { KnowledgeTypeNode ktn = (KnowledgeTypeNode) parent; List<ToDoItem> itemList = Designer.theDesigner().getToDoList().getToDoItemList(); synchronized (itemList) { for (ToDoItem item : itemList) { if (item.containsKnowledgeType(ktn.getName())) { if (index == 0) { return item; } index--; } } } } throw new IndexOutOfBoundsException("getChild shouldnt get here " + "GoListToTypeToItem"); }
// in src/org/argouml/cognitive/ui/GoListToPriorityToItem.java
public Object getChild(Object parent, int index) { if (parent instanceof ToDoList) { return PriorityNode.getPriorityList().get(index); } if (parent instanceof PriorityNode) { PriorityNode pn = (PriorityNode) parent; List<ToDoItem> itemList = Designer.theDesigner().getToDoList().getToDoItemList(); synchronized (itemList) { for (ToDoItem item : itemList) { if (item.getPriority() == pn.getPriority()) { if (index == 0) { return item; } index--; } } } } throw new IndexOutOfBoundsException("getChild shouldnt get here " + "GoListToPriorityToItem"); }
// in src/org/argouml/gefext/DeferredBufferedImage.java
private boolean isRasterValid(Rectangle clip) { if (clip.height > scaledBufferHeight) { throw new IndexOutOfBoundsException( "clip rectangle must fit in band buffer"); } return (clip.y >= y1 && (clip.y + clip.height - 1) < y2); }
// in src/org/argouml/gefext/DeferredBufferedImage.java
public Raster getTile(int tileX, int tileY) { LOG.debug("getTile x=" + tileX + " y = " + tileY); if (tileX < getMinTileX() || tileX >= getMinTileX() + getNumXTiles() || tileY < getMinTileY() || tileY >= getMinTileY() + getNumYTiles()) { throw new IndexOutOfBoundsException(); } // FIXME: Boundary condition at end of image for non-integral // multiples of BUFFER_HEIGHT Rectangle tileBounds = new Rectangle(0, (tileY - getMinTileY() * scaledBufferHeight), width, scaledBufferHeight); return getData(tileBounds); }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void write(byte[] b, int off, int len) throws IOException { if ((off | len | (b.length - (len + off)) | (off + len)) < 0) { throw new IndexOutOfBoundsException(); } if (headerProcessed) { out.write(b, off, len); } else { // TODO: Make this more efficient for large I/Os for (int i = 0; i < len; i++) { write(b[off + i]); } } }
0 0
(Lib) OclTypeException 8
              
// in src/org/argouml/ocl/ArgoFacade.java
public Any getClassifier(String name) { Project p = ProjectManager.getManager().getCurrentProject(); if (target != null && Model.getFacade().getName(target).equals(name)) { return new ArgoAny(target); } Object classifier = p.findTypeInModel(name, p.getModel()); if (classifier == null) { /** * Added search in defined types 2001-10-18 STEFFEN ZSCHALER. */ classifier = p.findType(name, false); if (classifier == null) { throw new OclTypeException("cannot find classifier: " + name); } } return new ArgoAny(classifier); }
// in src/org/argouml/ocl/ArgoFacade.java
public Type navigateQualified(String name, Type[] qualifiers) throws OclTypeException { if (classifier == null) { throw new OclTypeException("attempting to access features of Void"); } if (qualifiers != null) { throw new OclTypeException("qualified associations " + "not supported yet!"); } Type type = Basic.navigateAnyQualified(name, this, qualifiers); if (type != null) { return type; } Object foundAssocType = null, foundAttribType = null; // MClassifiers boolean isSet = false, isSequence = false; // cannot be Bag // first search for appropriate attributes Collection attributes = Model.getCoreHelper().getAttributesInh(classifier); Iterator iter = attributes.iterator(); while (iter.hasNext() && foundAttribType == null) { Object attr = iter.next(); if (Model.getFacade().getName(attr).equals(name)) { foundAttribType = Model.getFacade().getType(attr); } } // look for associations Collection associationEnds = Model.getCoreHelper().getAssociateEndsInh(classifier); Iterator asciter = associationEnds.iterator(); while (asciter.hasNext() && foundAssocType == null) { Object ae = asciter.next(); //MAssociationEnd if (Model.getFacade().getName(ae) != null && name.equals(Model.getFacade().getName(ae))) { foundAssocType = Model.getFacade().getType(ae); } else if (Model.getFacade().getName(ae) == null || Model.getFacade().getName(ae).equals("")) { String oppositeName = Model.getFacade().getName(Model.getFacade().getType(ae)); if (oppositeName != null) { String lowerOppositeName = oppositeName.substring(0, 1).toLowerCase(); lowerOppositeName += oppositeName.substring(1); if (lowerOppositeName.equals(name)) { foundAssocType = Model.getFacade().getType(ae); } } } if (foundAssocType != null) { Object multiplicity = Model.getFacade().getMultiplicity(ae); if (multiplicity != null && (Model.getFacade().getUpper(multiplicity) > 1 || Model.getFacade().getUpper(multiplicity) == -1)) { if (Model.getExtensionMechanismsHelper().hasStereotype(ae, "ordered")) { isSequence = true; } else { isSet = true; } } } } if (foundAssocType != null && foundAttribType != null) { throw new OclTypeException("cannot access feature " + name + " of classifier " + toString() + " because both an attribute and " + "an association end of this name " + "where found"); } Object foundType; if (foundAssocType == null) { foundType = foundAttribType; } else { foundType = foundAssocType; } if (foundType == null) { throw new OclTypeException("attribute " + name + " not found in classifier " + toString()); } Type result = getOclRepresentation(foundType); if (isSet) { result = new tudresden.ocl.check.types.Collection( tudresden.ocl.check.types.Collection.SET, result); } if (isSequence) { result = new tudresden.ocl.check.types.Collection( tudresden.ocl.check.types.Collection.SEQUENCE, result); } return result; }
// in src/org/argouml/ocl/ArgoFacade.java
private Type internalNavigateParameterized(final String name, final Type[] params, boolean fCheckIsQuery) throws OclTypeException { if (classifier == null) { throw new OclTypeException("attempting to access features of Void"); } Type type = Basic.navigateAnyParameterized(name, params); if (type != null) { return type; } Object foundOp = null; //MOperation java.util.Collection operations = Model.getFacade().getOperations(classifier); Iterator iter = operations.iterator(); while (iter.hasNext() && foundOp == null) { Object op = iter.next(); if (operationMatchesCall(op, name, params)) { foundOp = op; } } if (foundOp == null) { throw new OclTypeException("operation " + name + " not found in classifier " + toString()); } if (fCheckIsQuery) { /* Query checking added 05/21/01, sz9 */ if (!Model.getFacade().isQuery(foundOp)) { throw new OclTypeException("Non-query operations cannot " + "be used in OCL expressions. (" + name + ")"); } } Collection returnParams = Model.getCoreHelper().getReturnParameters(foundOp); Object rp; if (returnParams.size() == 0) { rp = null; } else { rp = returnParams.iterator().next(); } if (returnParams.size() > 1) { LOG.warn("OCL compiler only handles one return parameter" + " - Found " + returnParams.size() + " for " + Model.getFacade().getName(foundOp)); } if (rp == null || Model.getFacade().getType(rp) == null) { LOG.warn("WARNING: supposing return type void!"); return new ArgoAny(null); } Object returnType = Model.getFacade().getType(rp); return getOclRepresentation(returnType); }
0 5
              
// in src/org/argouml/ocl/ArgoFacade.java
public Type navigateQualified(String name, Type[] qualifiers) throws OclTypeException { if (classifier == null) { throw new OclTypeException("attempting to access features of Void"); } if (qualifiers != null) { throw new OclTypeException("qualified associations " + "not supported yet!"); } Type type = Basic.navigateAnyQualified(name, this, qualifiers); if (type != null) { return type; } Object foundAssocType = null, foundAttribType = null; // MClassifiers boolean isSet = false, isSequence = false; // cannot be Bag // first search for appropriate attributes Collection attributes = Model.getCoreHelper().getAttributesInh(classifier); Iterator iter = attributes.iterator(); while (iter.hasNext() && foundAttribType == null) { Object attr = iter.next(); if (Model.getFacade().getName(attr).equals(name)) { foundAttribType = Model.getFacade().getType(attr); } } // look for associations Collection associationEnds = Model.getCoreHelper().getAssociateEndsInh(classifier); Iterator asciter = associationEnds.iterator(); while (asciter.hasNext() && foundAssocType == null) { Object ae = asciter.next(); //MAssociationEnd if (Model.getFacade().getName(ae) != null && name.equals(Model.getFacade().getName(ae))) { foundAssocType = Model.getFacade().getType(ae); } else if (Model.getFacade().getName(ae) == null || Model.getFacade().getName(ae).equals("")) { String oppositeName = Model.getFacade().getName(Model.getFacade().getType(ae)); if (oppositeName != null) { String lowerOppositeName = oppositeName.substring(0, 1).toLowerCase(); lowerOppositeName += oppositeName.substring(1); if (lowerOppositeName.equals(name)) { foundAssocType = Model.getFacade().getType(ae); } } } if (foundAssocType != null) { Object multiplicity = Model.getFacade().getMultiplicity(ae); if (multiplicity != null && (Model.getFacade().getUpper(multiplicity) > 1 || Model.getFacade().getUpper(multiplicity) == -1)) { if (Model.getExtensionMechanismsHelper().hasStereotype(ae, "ordered")) { isSequence = true; } else { isSet = true; } } } } if (foundAssocType != null && foundAttribType != null) { throw new OclTypeException("cannot access feature " + name + " of classifier " + toString() + " because both an attribute and " + "an association end of this name " + "where found"); } Object foundType; if (foundAssocType == null) { foundType = foundAttribType; } else { foundType = foundAssocType; } if (foundType == null) { throw new OclTypeException("attribute " + name + " not found in classifier " + toString()); } Type result = getOclRepresentation(foundType); if (isSet) { result = new tudresden.ocl.check.types.Collection( tudresden.ocl.check.types.Collection.SET, result); } if (isSequence) { result = new tudresden.ocl.check.types.Collection( tudresden.ocl.check.types.Collection.SEQUENCE, result); } return result; }
// in src/org/argouml/ocl/ArgoFacade.java
public Type navigateParameterizedQuery (String name, Type[] qualifiers) throws OclTypeException { return internalNavigateParameterized(name, qualifiers, true); }
// in src/org/argouml/ocl/ArgoFacade.java
public Type navigateParameterized (String name, Type[] qualifiers) throws OclTypeException { return internalNavigateParameterized(name, qualifiers, false); }
// in src/org/argouml/ocl/ArgoFacade.java
private Type internalNavigateParameterized(final String name, final Type[] params, boolean fCheckIsQuery) throws OclTypeException { if (classifier == null) { throw new OclTypeException("attempting to access features of Void"); } Type type = Basic.navigateAnyParameterized(name, params); if (type != null) { return type; } Object foundOp = null; //MOperation java.util.Collection operations = Model.getFacade().getOperations(classifier); Iterator iter = operations.iterator(); while (iter.hasNext() && foundOp == null) { Object op = iter.next(); if (operationMatchesCall(op, name, params)) { foundOp = op; } } if (foundOp == null) { throw new OclTypeException("operation " + name + " not found in classifier " + toString()); } if (fCheckIsQuery) { /* Query checking added 05/21/01, sz9 */ if (!Model.getFacade().isQuery(foundOp)) { throw new OclTypeException("Non-query operations cannot " + "be used in OCL expressions. (" + name + ")"); } } Collection returnParams = Model.getCoreHelper().getReturnParameters(foundOp); Object rp; if (returnParams.size() == 0) { rp = null; } else { rp = returnParams.iterator().next(); } if (returnParams.size() > 1) { LOG.warn("OCL compiler only handles one return parameter" + " - Found " + returnParams.size() + " for " + Model.getFacade().getName(foundOp)); } if (rp == null || Model.getFacade().getType(rp) == null) { LOG.warn("WARNING: supposing return type void!"); return new ArgoAny(null); } Object returnType = Model.getFacade().getType(rp); return getOclRepresentation(returnType); }
// in src/org/argouml/uml/ui/TabConstraints.java
public void setData(String sData, EditingUtilities euHelper) throws OclParserException, OclTypeException { // Parse and check specified constraint. OclTree tree = null; try { Object mmeContext = OCLUtil .getInnerMostEnclosingNamespace(theMMmeiTarget); try { tree = euHelper.parseAndCheckConstraint( sData, new ArgoFacade(mmeContext)); } catch (IOException ioe) { // Ignored: Highly unlikely, and what would we // do anyway? log it LOG.error("problem parsing And Checking Constraints", ioe); return; } // Split constraint body, if user wants us to if (euHelper.getDoAutoSplit()) { List lConstraints = euHelper.splitConstraint(tree); if (lConstraints.size() > 0) { removeConstraintAt(theMNIdx); for (Iterator i = lConstraints.iterator(); i.hasNext();) { OclTree ocltCurrent = (OclTree) i.next(); Object mc = Model.getCoreFactory() .createConstraint(); Model.getCoreHelper().setName(mc, ocltCurrent .getConstraintName()); Model.getCoreHelper().setBody(mc, Model.getDataTypesFactory() .createBooleanExpression( "OCL", ocltCurrent .getExpression())); Model.getCoreHelper().addConstraint( theMMmeiTarget, mc); // the constraint _must_ be owned by a namespace if (Model.getFacade().getNamespace( theMMmeiTarget) != null) { Model.getCoreHelper().addOwnedElement( Model.getFacade().getNamespace( theMMmeiTarget), mc); } else if (Model.getFacade().getNamespace( mmeContext) != null) { Model.getCoreHelper().addOwnedElement( Model.getFacade().getNamespace( mmeContext), theMMcConstraint); } theMAlConstraints.add(mc); fireConstraintAdded(); } return; } } // Store constraint body Object mcOld = null; if (theMMcConstraint == null) { // New constraint, first time setData is called theMMcConstraint = Model.getCoreFactory().createConstraint(); Model.getCoreHelper().setName( theMMcConstraint, "newConstraint"); Model.getCoreHelper().setBody( theMMcConstraint, Model.getDataTypesFactory() .createBooleanExpression("OCL", sData)); Model.getCoreHelper().addConstraint(theMMmeiTarget, theMMcConstraint); // the constraint _must_ be owned by a namespace Object targetNamespace = Model.getFacade().getNamespace(theMMmeiTarget); Object contextNamespace = Model.getFacade().getNamespace(mmeContext); if (targetNamespace != null) { Model.getCoreHelper().addOwnedElement( targetNamespace, theMMcConstraint); } else if (contextNamespace != null) { Model.getCoreHelper().addOwnedElement( contextNamespace, theMMcConstraint); } theMAlConstraints.set(theMNIdx, theMMcConstraint); } else { mcOld = Model.getCoreFactory().createConstraint(); Model.getCoreHelper().setName( mcOld, Model.getFacade().getName(theMMcConstraint)); Model.getCoreHelper().setBody( mcOld, Model.getDataTypesFactory() .createBooleanExpression("OCL", (String) Model.getFacade() .getBody( Model.getFacade().getBody( theMMcConstraint)))); Model.getCoreHelper().setBody(theMMcConstraint, Model.getDataTypesFactory() .createBooleanExpression("OCL", sData)); } fireConstraintDataChanged(theMNIdx, mcOld, theMMcConstraint); } catch (OclTypeException pe) { LOG.warn("There was some sort of OCL Type problem", pe); throw pe; } catch (OclParserException pe1) { LOG.warn("Could not parse the constraint", pe1); throw pe1; } catch (OclException oclExc) { // a runtime exception that occurs when some // internal test fails LOG.warn("There was some unidentified problem"); throw oclExc; } }
(Domain) UnresolvableException 4
              
// in src/org/argouml/cognitive/ToDoList.java
public boolean explicitlyResolve(ToDoItem item, String reason) throws UnresolvableException { if (item.getPoster() instanceof Designer) { boolean res = resolve(item); // History.TheHistory.addItemResolution(item, reason); return res; } if (!(item.getPoster() instanceof Critic)) { throw new UnresolvableException(Translator.localize( "misc.todo-unresolvable", new Object[] {item.getPoster() .getClass()})); } ResolvedCritic rc = new ResolvedCritic((Critic) item.getPoster(), item .getOffenders()); boolean res = resolve(item); if (res) { res = addResolvedCritic(rc); } return res; }
// in src/org/argouml/cognitive/ResolvedCritic.java
protected void importOffenders(ListSet set, boolean canCreate) throws UnresolvableException { String fail = null; for (Object obj : set) { String id = ItemUID.getIDOfObject(obj, canCreate); if (id == null) { if (!canCreate) { throw new UnresolvableException("ItemUID missing or " + "unable to " + "create for class: " + obj.getClass()); } if (fail == null) { fail = obj.getClass().toString(); } else { fail = fail + ", " + obj.getClass().toString(); } LOG.warn("Offender " + obj.getClass() + " unresolvable"); // Use this for fast fail instead. // Sacrificed for complete fail. d00mst //throw new UnresolvableException( // "Unable to create ItemUID for class: " // + obj.getClass()); } else { offenders.add(id); } } if (fail != null) { throw new UnresolvableException("Unable to create ItemUID for " + "some class(es): " + fail); } }
1
              
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); }
5
              
// in src/org/argouml/cognitive/ToDoList.java
public boolean explicitlyResolve(ToDoItem item, String reason) throws UnresolvableException { if (item.getPoster() instanceof Designer) { boolean res = resolve(item); // History.TheHistory.addItemResolution(item, reason); return res; } if (!(item.getPoster() instanceof Critic)) { throw new UnresolvableException(Translator.localize( "misc.todo-unresolvable", new Object[] {item.getPoster() .getClass()})); } ResolvedCritic rc = new ResolvedCritic((Critic) item.getPoster(), item .getOffenders()); boolean res = resolve(item); if (res) { res = addResolvedCritic(rc); } return res; }
// in src/org/argouml/cognitive/ResolvedCritic.java
protected String getCriticString(Critic c) throws UnresolvableException { // TODO: Should throw if the string is not good? if (c == null) { throw (new UnresolvableException("Critic is null")); } String s = c.getClass().toString(); return s; }
// in src/org/argouml/cognitive/ResolvedCritic.java
protected void importOffenders(ListSet set, boolean canCreate) throws UnresolvableException { String fail = null; for (Object obj : set) { String id = ItemUID.getIDOfObject(obj, canCreate); if (id == null) { if (!canCreate) { throw new UnresolvableException("ItemUID missing or " + "unable to " + "create for class: " + obj.getClass()); } if (fail == null) { fail = obj.getClass().toString(); } else { fail = fail + ", " + obj.getClass().toString(); } LOG.warn("Offender " + obj.getClass() + " unresolvable"); // Use this for fast fail instead. // Sacrificed for complete fail. d00mst //throw new UnresolvableException( // "Unable to create ItemUID for class: " // + obj.getClass()); } else { offenders.add(id); } } if (fail != null) { throw new UnresolvableException("Unable to create ItemUID for " + "some class(es): " + fail); } }
(Lib) Error 3
              
// in src/org/argouml/uml/cognitive/critics/WizBreakCircularComp.java
public void doAction(int oldStep) { LOG.debug("doAction " + oldStep); int choice = -1; ToDoItem item = (ToDoItem) getToDoItem(); ListSet offs = item.getOffenders(); switch (oldStep) { case 1: if (step1 != null) { choice = step1.getSelectedIndex(); } if (choice == -1) { throw new Error("nothing selected, should not get here"); } selectedCls = offs.get(choice); break; //////////////// case 2: if (step2 != null) { choice = step2.getSelectedIndex(); } if (choice == -1) { throw new Error("nothing selected, should not get here"); } Object ae = null; Iterator iter = Model.getFacade().getAssociationEnds(selectedCls).iterator(); for (int n = 0; n <= choice; n++) { ae = iter.next(); } selectedAsc = Model.getFacade().getAssociation(ae); break; //////////////// case 3: if (selectedAsc != null) { List conns = new ArrayList( Model.getFacade().getConnections(selectedAsc)); Object ae0 = conns.get(0); Object ae1 = conns.get(1); try { Model.getCoreHelper().setAggregation1( ae0, Model.getAggregationKind().getNone()); Model.getCoreHelper().setAggregation1( ae1, Model.getAggregationKind().getNone()); } catch (Exception pve) { LOG.error("could not set aggregation", pve); } } break; } }
// in src/org/argouml/uml/cognitive/critics/WizNavigable.java
public void doAction(int oldStep) { LOG.debug("doAction " + oldStep); switch (oldStep) { case 1: int choice = -1; if (step1 != null) { choice = step1.getSelectedIndex(); } if (choice == -1) { throw new Error("nothing selected, should not get here"); } try { Object asc = getModelElement(); Object ae0 = new ArrayList(Model.getFacade().getConnections(asc)).get(0); Object ae1 = new ArrayList(Model.getFacade().getConnections(asc)).get(1); Model.getCoreHelper().setNavigable(ae0, choice == 0 || choice == 2); Model.getCoreHelper().setNavigable(ae1, choice == 1 || choice == 2); } catch (Exception pve) { LOG.error("could not set navigablity", pve); } } }
0 0
(Lib) IOException 3
              
// in src/org/argouml/persistence/XmlInputStream.java
private Map readAttributes() throws IOException { Map attributesFound = new HashMap(); int character; while ((character = realRead()) != '>') { if (!Character.isWhitespace((char) character)) { StringBuffer attributeName = new StringBuffer(); attributeName.append((char) character); while ((character = realRead()) != '=' && !Character.isWhitespace((char) character)) { attributeName.append((char) character); } // Skip any whitespace till we should be on an equals sign. while (Character.isWhitespace((char) character)) { character = realRead(); } if (character != '=') { throw new IOException( "Expected = sign after attribute " + attributeName); } // Skip any whitespace till we should be on a quote symbol. int quoteSymbol = realRead(); while (Character.isWhitespace((char) quoteSymbol)) { quoteSymbol = realRead(); } if (quoteSymbol != '"' && quoteSymbol != '\'') { throw new IOException( "Expected \" or ' around attribute value after " + "attribute " + attributeName); } StringBuffer attributeValue = new StringBuffer(); while ((character = realRead()) != quoteSymbol) { attributeValue.append((char) character); } attributesFound.put( attributeName.toString(), attributeValue.toString()); } } return attributesFound; }
// in src/org/argouml/persistence/XmlInputStream.java
private int realRead() throws IOException { int read = super.read(); if (read == -1) { throw new IOException("Tag " + tagName + " not found"); } return read; }
0 47
              
// in src/org/argouml/ui/TransferableModelElements.java
public Object getTransferData(DataFlavor dataFlavor) throws UnsupportedFlavorException, IOException { if (dataFlavor.match(UML_COLLECTION_FLAVOR)) { return theModelElements; } /* * TODO: We could also support other flavors here, * e.g. image (then you can drag modelelements directly into * your wordprocessor, to be inserted as an image). */ throw new UnsupportedFlavorException(dataFlavor); }
// in src/org/argouml/ui/ProjectBrowser.java
public void addFileSaved(File file) throws IOException { // TODO: This should listen for file save events - tfm GenericArgoMenuBar menu = (GenericArgoMenuBar) getJMenuBar(); if (menu != null) { menu.addFileSaved(file.getCanonicalPath()); } }
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
private void saveModel(File destiny, Object model) throws IOException, UmlException { OutputStream stream = new FileOutputStream(destiny); XmiWriter xmiWriter = Model.getXmiWriter(model, stream, ApplicationVersion.getVersion() + "(" + UmlFilePersister.PERSISTENCE_VERSION + ")"); xmiWriter.write(); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
private boolean doSave(File theFile, String suffix, boolean useUI) throws FileNotFoundException, IOException { SaveGraphicsManager sgm = SaveGraphicsManager.getInstance(); SaveGraphicsAction cmd = null; cmd = sgm.getSaveActionBySuffix(suffix); if (cmd == null) { return false; } if (useUI) { updateStatus(Translator.localize( "statusmsg.bar.save-graphics-status-writing", new Object[] {theFile})); } if (theFile.exists() && useUI) { int response = JOptionPane.showConfirmDialog( ArgoFrame.getFrame(), Translator.messageFormat("optionpane.confirm-overwrite", new Object[] {theFile}), Translator.localize("optionpane.confirm-overwrite-title"), JOptionPane.YES_NO_OPTION); if (response != JOptionPane.YES_OPTION) { return false; } } FileOutputStream fo = new FileOutputStream(theFile); cmd.setStream(fo); cmd.setScale(Configuration.getInteger( SaveGraphicsManager.KEY_GRAPHICS_RESOLUTION, 1)); try { cmd.actionPerformed(null); } finally { fo.close(); } if (useUI) { updateStatus(Translator.localize( "statusmsg.bar.save-graphics-status-wrote", new Object[] {theFile})); } return true; }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
private boolean saveGraphicsToFile(File theFile, SaveGraphicsAction cmd) throws IOException { if ( theFile.exists() && !overwrite ) { String message = Translator.messageFormat( "optionpane.confirm-overwrite", new Object[] {theFile}); String title = Translator.localize( "optionpane.confirm-overwrite-title"); //Custom button text: Object[] options = {Translator.localize( "optionpane.confirm-overwrite.overwrite"), // 0 Translator.localize( "optionpane.confirm-overwrite.overwrite-all"), // 1 Translator.localize( "optionpane.confirm-overwrite.skip-this-one"), // 2 Translator.localize( "optionpane.confirm-overwrite.cancel")}; // 3 int response = JOptionPane.showOptionDialog(ArgoFrame.getFrame(), message, title, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, //do not use a custom Icon options, //the titles of buttons options[0]); //default button title if (response == 1) { overwrite = true; } if (response == 2) { return true; } if (response == 3) { return false; } if (response == JOptionPane.CLOSED_OPTION) { return false; } } FileOutputStream fo = null; try { fo = new FileOutputStream( theFile ); cmd.setStream(fo); cmd.setScale(Configuration.getInteger( SaveGraphicsManager.KEY_GRAPHICS_RESOLUTION, 1)); cmd.actionPerformed(null); } finally { if (fo != null) { fo.close(); } } return true; }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
Override protected void saveGraphics(OutputStream s, Editor ce, Rectangle drawingArea) throws IOException { double editorScale = ce.getScale(); int x = (int) (drawingArea.x * editorScale); int y = (int) (drawingArea.y * editorScale); int h = (int) (drawingArea.height * editorScale); int w = (int) (drawingArea.width * editorScale); drawingArea = new Rectangle(x, y, w, h); PostscriptWriter ps = new PostscriptWriter(s, drawingArea); ps.scale(editorScale, editorScale); ce.print(ps); ps.dispose(); }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
Override protected void saveGraphics(OutputStream s, Editor ce, Rectangle drawingArea) throws IOException { Rectangle canvasArea = SaveGraphicsManager.adjustDrawingArea(drawingArea); // Create an image which will do deferred rendering of the GEF // diagram on demand as data is pulled from it RenderedImage i = new DeferredBufferedImage(canvasArea, BufferedImage.TYPE_INT_ARGB, ce, scale); LOG.debug("Created DeferredBufferedImage - drawingArea = " + canvasArea + " , scale = " + scale); ImageIO.write(i, "png", s); }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
Override protected void saveGraphics(OutputStream s, Editor ce, Rectangle drawingArea) throws IOException { Rectangle canvasArea = SaveGraphicsManager.adjustDrawingArea(drawingArea); RenderedImage i = new DeferredBufferedImage(canvasArea, BufferedImage.TYPE_INT_ARGB, ce, scale); // NOTE: GEF's GIF writer uses Jeff Poskanzer's GIF encoder, but that // saves a copy of the entire image in an internal buffer before // starting work, defeating the whole purpose of our incremental // rendering. // Java SE 6 has a native GIF writer, but it's not in Java 5. One // is available in the JAI-ImageIO library, but we don't currently // bundle that and at 6+ MB it seems like a heavyweight solution, but // I don't have time to produce a stripped down version right now - tfm // https://jai-imageio.dev.java.net/ ImageIO.write(i, "gif", s); }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
protected void saveGraphics(OutputStream outStream, Editor ce, Rectangle drawingArea) throws IOException { // LayerPerspective layer = DiagramUtils.getActiveDiagram().getLayer(); Layer layer = ce.getLayerManager().getActiveLayer(); Rectangle bounds = new Rectangle(); for (Fig fig : layer.getContents()) { bounds.x = Math.min(bounds.x, fig.getX()); bounds.y = Math.min(bounds.y, fig.getY()); // we actually are computing max x & max y, not width & height bounds.width = Math.max(bounds.width, fig.getX() + fig.getWidth()); bounds.height = Math.max(bounds.height, fig.getY() + fig.getHeight()); } // Convert max x/y to width/height bounds.width -= bounds.x; bounds.height -= bounds.y; // Get a DOMImplementation DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); // Create an instance of org.w3c.dom.Document Document document = domImpl.createDocument(null, "svg", null); // Create an instance of the SVG Generator SVGGraphics2D svgGenerator = new SVGGraphics2D(document); ce.print(svgGenerator); // for (Fig f : layer.getContents()) { // // ignore clipping // String url = null; // String clazz = null; // Object owner = f.getOwner(); // if (Model.getFacade().isAUMLElement(owner)) { // clazz = Model.getMetaTypes().getName(owner); // // TODO: toLower? // if (Model.getFacade().isAModelElement(owner)) { // String name = Model.getFacade().getName(owner); // if (name == null) { // name = ""; // } // url = "http://argoeclipse.tigris.org" + "#" + name; // } // } //// writer.beginFig(f, clazz, url); // f.paint(writer); // // writer.endFig(); // } // Finally, stream out SVG to the standard output using UTF-8 // character to byte encoding boolean useCSS = true; // we want to use CSS style attribute Writer out = new OutputStreamWriter(outStream, "UTF-8"); svgGenerator.stream(out, useCSS); }
// in src/org/argouml/uml/generator/TempFileUtils.java
private static void traverseDir(File dir, FileAction action) throws IOException { if (dir.exists()) { File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { traverseDir(files[i], action); } else { action.act(files[i]); } } action.act(dir); } }
// in src/org/argouml/uml/generator/TempFileUtils.java
public static Collection<SourceUnit> readAllFiles(File dir) { try { final List<SourceUnit> ret = new ArrayList<SourceUnit>(); final int prefix = dir.getPath().length() + 1; traverseDir(dir, new FileAction() { public void act(File f) throws IOException { // skip backup files. This is actually a workaround for the // cpp generator, which always creates backup files (it's a // bug). if (!f.isDirectory() && !f.getName().endsWith(".bak")) { // TODO: This is using the default platform character // encoding. Specifying an encoding will produce more // predictable results FileReader fr = new FileReader(f); BufferedReader bfr = new BufferedReader(fr); try { StringBuffer result = new StringBuffer((int) f.length()); String line = bfr.readLine(); do { result.append(line); line = bfr.readLine(); if (line != null) { result.append('\n'); } } while (line != null); ret.add(new SourceUnit(f.toString().substring( prefix), result.toString())); } finally { bfr.close(); fr.close(); } } } }); return ret; } catch (IOException ioe) { LOG.error("Exception reading files", ioe); } return null; }
// in src/org/argouml/uml/generator/TempFileUtils.java
public void act(File f) throws IOException { // skip backup files. This is actually a workaround for the // cpp generator, which always creates backup files (it's a // bug). if (!f.isDirectory() && !f.getName().endsWith(".bak")) { // TODO: This is using the default platform character // encoding. Specifying an encoding will produce more // predictable results FileReader fr = new FileReader(f); BufferedReader bfr = new BufferedReader(fr); try { StringBuffer result = new StringBuffer((int) f.length()); String line = bfr.readLine(); do { result.append(line); line = bfr.readLine(); if (line != null) { result.append('\n'); } } while (line != null); ret.add(new SourceUnit(f.toString().substring( prefix), result.toString())); } finally { bfr.close(); fr.close(); } } }
// in src/org/argouml/profile/ZipModelLoader.java
private ZipInputStream openZipStreamAt(URL url, String ext) throws IOException { ZipInputStream zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); while (entry != null && !entry.getName().endsWith(ext)) { entry = zis.getNextEntry(); } return zis; }
// in src/org/argouml/profile/UserDefinedProfile.java
private FigNodeDescriptor loadImage(String stereotype, File f) throws IOException { FigNodeDescriptor descriptor = new FigNodeDescriptor(); descriptor.length = (int) f.length(); descriptor.src = f.getPath(); descriptor.stereotype = stereotype; BufferedInputStream bis = new BufferedInputStream( new FileInputStream(f)); byte[] buf = new byte[descriptor.length]; try { bis.read(buf); } catch (IOException e) { e.printStackTrace(); } descriptor.img = new ImageIcon(buf).getImage(); return descriptor; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyArgo(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, OpenException, UnsupportedEncodingException { int pgmlCount = getPgmlCount(file); boolean containsToDo = containsTodo(file); boolean containsProfile = containsProfile(file); // first read the .argo file from Zip ZipInputStream zis = openZipStreamAt(toURL(file), FileConstants.PROJECT_FILE_EXT); if (zis == null) { throw new OpenException( "There is no .argo file in the .zargo"); } String line; BufferedReader reader = new BufferedReader(new InputStreamReader(zis, encoding)); // Keep reading till we hit the <argo> tag String rootLine; do { rootLine = reader.readLine(); if (rootLine == null) { throw new OpenException( "Can't find an <argo> tag in the argo file"); } } while(!rootLine.startsWith("<argo")); // Get the version from the tag. String version = getVersion(rootLine); writer.println("<uml version=\"" + version + "\">"); writer.println(rootLine); LOG.info("Transfering argo contents"); int memberCount = 0; while ((line = reader.readLine()) != null) { if (line.trim().startsWith("<member")) { ++memberCount; } if (line.trim().equals("</argo>") && memberCount == 0) { LOG.info("Inserting member info"); writer.println("<member type='xmi' name='.xmi' />"); for (int i = 0; i < pgmlCount; ++i) { writer.println("<member type='pgml' name='.pgml' />"); } if (containsToDo) { writer.println("<member type='todo' name='.todo' />"); } if (containsProfile) { String type = ProfileConfiguration.EXTENSION; writer.println("<member type='" + type + "' name='." + type + "' />"); } } writer.println(line); } if (LOG.isInfoEnabled()) { LOG.info("Member count = " + memberCount); } zis.close(); reader.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyXmi(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, UnsupportedEncodingException { ZipInputStream zis = openZipStreamAt(toURL(file), ".xmi"); BufferedReader reader = new BufferedReader( new InputStreamReader(zis, encoding)); // Skip 1 lines reader.readLine(); readerToWriter(reader, writer); zis.close(); reader.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyDiagrams(File file, String encoding, PrintWriter writer) throws IOException { // Loop round loading the diagrams ZipInputStream zis = new ZipInputStream(toURL(file).openStream()); SubInputStream sub = new SubInputStream(zis); ZipEntry currentEntry = null; while ((currentEntry = sub.getNextEntry()) != null) { if (currentEntry.getName().endsWith(".pgml")) { BufferedReader reader = new BufferedReader( new InputStreamReader(sub, encoding)); String firstLine = reader.readLine(); if (firstLine.startsWith("<?xml")) { // Skip the 2 lines //<?xml version="1.0" encoding="UTF-8" ?> //<!DOCTYPE pgml SYSTEM "pgml.dtd"> reader.readLine(); } else { writer.println(firstLine); } readerToWriter(reader, writer); sub.close(); reader.close(); } } zis.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyMember(File file, String tag, String outputEncoding, PrintWriter writer) throws IOException, MalformedURLException, UnsupportedEncodingException { ZipInputStream zis = openZipStreamAt(toURL(file), "." + tag); if (zis != null) { InputStreamReader isr = new InputStreamReader(zis, outputEncoding); BufferedReader reader = new BufferedReader(isr); String firstLine = reader.readLine(); if (firstLine.startsWith("<?xml")) { // Skip the 2 lines //<?xml version="1.0" encoding="UTF-8" ?> //<!DOCTYPE todo SYSTEM "todo.dtd" > reader.readLine(); } else { writer.println(firstLine); } readerToWriter(reader, writer); zis.close(); reader.close(); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void readerToWriter( Reader reader, Writer writer) throws IOException { int ch; while ((ch = reader.read()) != -1) { if (ch == 0xFFFF) { LOG.info("Stripping out 0xFFFF from save file"); } else if (ch == 8) { LOG.info("Stripping out 0x8 from save file"); } else { writer.write(ch); } } }
// in src/org/argouml/persistence/ZargoFilePersister.java
private ZipInputStream openZipStreamAt(URL url, String ext) throws IOException { ZipInputStream zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); while (entry != null && !entry.getName().endsWith(ext)) { entry = zis.getNextEntry(); } if (entry == null) { zis.close(); return null; } return zis; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private InputStream openZipEntry(URL url, String entryName) throws MalformedURLException, IOException { return makeZipEntryUrl(url, entryName).openStream(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public void close() throws IOException { in.closeEntry(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
public ZipEntry getNextEntry() throws IOException { return in.getNextEntry(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private int getPgmlCount(File file) throws IOException { return getEntryNames(file, ".pgml").size(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private boolean containsTodo(File file) throws IOException { return !getEntryNames(file, ".todo").isEmpty(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private boolean containsProfile(File file) throws IOException { return !getEntryNames(file, "." + ProfileConfiguration.EXTENSION) .isEmpty(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private List<String> getEntryNames(File file, String extension) throws IOException, MalformedURLException { ZipInputStream zis = new ZipInputStream(toURL(file).openStream()); List<String> result = new ArrayList<String>(); ZipEntry entry = zis.getNextEntry(); while (entry != null) { String name = entry.getName(); if (extension == null || name.endsWith(extension)) { result.add(name); } entry = zis.getNextEntry(); } zis.close(); return result; }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private void addUserDefinedProfile(String fileName, StringBuffer xmi, ProfileManager profileManager) throws IOException { File profilesDirectory = getProfilesDirectory(profileManager); File profileFile = new File(profilesDirectory, fileName); OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream(profileFile), Argo.getEncoding()); writer.write(xmi.toString()); writer.close(); LOG.info("Wrote user defined profile \"" + profileFile + "\", with size " + xmi.length() + "."); if (isSomeProfileDirectoryConfigured(profileManager)) { profileManager.refreshRegisteredProfiles(); } else { profileManager.addSearchPathDirectory( profilesDirectory.getAbsolutePath()); } }
// in src/org/argouml/persistence/XmiInputStream.java
Override public synchronized int read() throws IOException { if (endFound) { extensionFound = false; parsingExtension = false; endFound = false; readingName = false; tagName = null; endTagName = null; } int ch = super.read(); if (parsingExtension) { stringBuffer.append((char) ch); } // else { // TODO: Only progress when reading standard XMI // extension parsers will continue progression. ++readCount; if (progressMgr != null && readCount == eventSpacing) { try { readCount = 0; progressMgr.nextPhase(); } catch (InterruptedException e) { throw new InterruptedIOException(e); } } // } if (xmiExtensionParser != null) { if (readingName) { if (isNameTerminator((char) ch)) { readingName = false; if (parsingExtension && endTagName == null) { endTagName = "/" + tagName; } else if (tagName.equals("XMI.extension")) { extensionFound = true; } else if (tagName.equals(endTagName)) { endFound = true; xmiExtensionParser.parse(type, stringBuffer.toString()); stringBuffer.delete(0, stringBuffer.length()); } } else { tagName += (char) ch; } } if (extensionFound) { if (ch == '>') { extensionFound = false; callExtensionParser(); } else { attributes += (char) ch; } } if (ch == '<') { readingName = true; tagName = ""; } } return ch; }
// in src/org/argouml/persistence/XmiInputStream.java
Override public synchronized int read(byte[] b, int off, int len) throws IOException { int cnt; for (cnt = 0; cnt < len; ++cnt) { int read = read(); if (read == -1) { break; } b[cnt + off] = (byte) read; } if (cnt > 0) { return cnt; } return -1; }
// in src/org/argouml/persistence/XmiInputStream.java
Override public void close() throws IOException { }
// in src/org/argouml/persistence/XmiInputStream.java
public void realClose() throws IOException { super.close(); }
// in src/org/argouml/persistence/ZipFilePersister.java
private ZipInputStream openZipStreamAt(URL url, String ext) throws IOException { ZipInputStream zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); while (entry != null && !entry.getName().endsWith(ext)) { entry = zis.getNextEntry(); } return zis; }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void write(byte[] b, int off, int len) throws IOException { if ((off | len | (b.length - (len + off)) | (off + len)) < 0) { throw new IndexOutOfBoundsException(); } if (headerProcessed) { out.write(b, off, len); } else { // TODO: Make this more efficient for large I/Os for (int i = 0; i < len; i++) { write(b[off + i]); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void write(int b) throws IOException { if (headerProcessed) { out.write(b); } else { outBB.put((byte) b); inBB.limit(outBB.position()); // Convert from bytes back to characters CoderResult result = decoder.decode(inBB, outCB, false); if (result.isError()) { throw new RuntimeException( "Unknown character decoding error"); } // This will have problems if the smallest possible // data segment is smaller than the size of the buffer // needed for regex matching if (outCB.position() == outCB.limit()) { processHeader(); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
private void processHeader() throws IOException { headerProcessed = true; outCB.position(0); // rewind our character buffer Matcher matcher = xmlDeclarationPattern.matcher(outCB); // Remove anything that matches our pattern String headerRemainder = matcher.replaceAll(""); int index = headerRemainder.length() - 1; if (headerRemainder.charAt(index) == '\0') { // Remove null characters at the end do { index--; } while (index >= 0 && headerRemainder.charAt(index) == '\0'); headerRemainder = headerRemainder.substring(0, index + 1); } // Reencode the remaining characters as bytes again ByteBuffer bb = decoder.charset().encode(headerRemainder); // and write them to our output stream byte[] outBytes = new byte[bb.limit()]; bb.get(outBytes); out.write(outBytes, 0, outBytes.length); // Write any left over bytes in the input buffer // (perhaps from a partially decoded character) if (inBB.remaining() > 0) { out.write(inBB.array(), inBB.position(), inBB.remaining()); inBB.position(0); inBB.limit(0); } }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void close() throws IOException { flush(); }
// in src/org/argouml/persistence/UmlFilePersister.java
public void reallyClose() throws IOException { out.close(); }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void flush() throws IOException { if (!headerProcessed) { processHeader(); } out.flush(); }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected File createTempFile(File file) throws FileNotFoundException, IOException { File tempFile = new File(file.getAbsolutePath() + "#"); if (tempFile.exists()) { tempFile.delete(); } if (file.exists()) { copyFile(file, tempFile); } return tempFile; }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected File copyFile(File src, File dest) throws FileNotFoundException, IOException { FileInputStream fis = new FileInputStream(src); FileOutputStream fos = new FileOutputStream(dest); byte[] buf = new byte[1024]; int i = 0; while ((i = fis.read(buf)) != -1) { fos.write(buf, 0, i); } fis.close(); fos.close(); dest.setLastModified(src.lastModified()); return dest; }
// in src/org/argouml/persistence/XmlInputStream.java
public synchronized int read() throws IOException { if (!xmlStarted) { skipToTag(); xmlStarted = true; } if (endStream) { return -1; } int ch = super.read(); endStream = isLastTag(ch); return ch; }
// in src/org/argouml/persistence/XmlInputStream.java
public synchronized int read(byte[] b, int off, int len) throws IOException { if (!xmlStarted) { skipToTag(); xmlStarted = true; } if (endStream) { return -1; } int cnt; for (cnt = 0; cnt < len; ++cnt) { int read = read(); if (read == -1) { break; } b[cnt + off] = (byte) read; } if (cnt > 0) { return cnt; } return -1; }
// in src/org/argouml/persistence/XmlInputStream.java
private void skipToTag() throws IOException { char[] searchChars = tagName.toCharArray(); int i; boolean found; while (true) { if (!childOnly) { mark(1000); } // Keep reading till we get the left bracket of an opening tag while (realRead() != '<') { if (!childOnly) { mark(1000); } } found = true; // Compare each following character to see // that it matches the tag we want for (i = 0; i < tagName.length(); ++i) { int c = realRead(); if (c != searchChars[i]) { found = false; break; } } int terminator = realRead(); // We also want to match with the right bracket of the tag or // some other terminator if (found && !isNameTerminator((char) terminator)) { found = false; } if (found) { // We've found the matching tag but do we have // the correct instance with matching attributes? if (attributes != null) { Map attributesFound = new HashMap(); if (terminator != '>') { attributesFound = readAttributes(); } // Search all attributes found to those expected. // If any don't match then turn off the found flag // so that we search for the next matching tag. Iterator it = attributes.entrySet().iterator(); while (found && it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); if (!pair.getValue().equals( attributesFound.get(pair.getKey()))) { found = false; } } } } if (found) { if (instanceCount < 0) { found = false; ++instanceCount; } } if (found) { if (childOnly) { // Read the name of the child tag // and then reset read position // back to that child tag. mark(1000); while (realRead() != '<') { /* do nothing */ } tagName = ""; char ch = (char) realRead(); while (!isNameTerminator(ch)) { tagName += ch; ch = (char) realRead(); } endTagName = "/" + tagName; LOG.info("Start tag = " + tagName); LOG.info("End tag = " + endTagName); } reset(); return; } } }
// in src/org/argouml/persistence/XmlInputStream.java
private Map readAttributes() throws IOException { Map attributesFound = new HashMap(); int character; while ((character = realRead()) != '>') { if (!Character.isWhitespace((char) character)) { StringBuffer attributeName = new StringBuffer(); attributeName.append((char) character); while ((character = realRead()) != '=' && !Character.isWhitespace((char) character)) { attributeName.append((char) character); } // Skip any whitespace till we should be on an equals sign. while (Character.isWhitespace((char) character)) { character = realRead(); } if (character != '=') { throw new IOException( "Expected = sign after attribute " + attributeName); } // Skip any whitespace till we should be on a quote symbol. int quoteSymbol = realRead(); while (Character.isWhitespace((char) quoteSymbol)) { quoteSymbol = realRead(); } if (quoteSymbol != '"' && quoteSymbol != '\'') { throw new IOException( "Expected \" or ' around attribute value after " + "attribute " + attributeName); } StringBuffer attributeValue = new StringBuffer(); while ((character = realRead()) != quoteSymbol) { attributeValue.append((char) character); } attributesFound.put( attributeName.toString(), attributeValue.toString()); } } return attributesFound; }
// in src/org/argouml/persistence/XmlInputStream.java
public void close() throws IOException { }
// in src/org/argouml/persistence/XmlInputStream.java
public void realClose() throws IOException { super.close(); }
// in src/org/argouml/persistence/XmlInputStream.java
private int realRead() throws IOException { int read = super.read(); if (read == -1) { throw new IOException("Tag " + tagName + " not found"); } return read; }
(Domain) InvalidOclException 2
              
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
public Object evaluate(Map<String, Object> vt, ModelInterpreter mi, String ocl) throws InvalidOclException { // XXX this seems to be a bug of the parser, // it always requires a context //LOG.debug("OCL: " + ocl); if (ocl.contains("ore")) { // TODO: Convert this to some sensible logging System.out.println("VOILA!"); } Lexer lexer = new Lexer(new PushbackReader(new StringReader( "context X inv: " + ocl), 2)); OclParser parser = new OclParser(lexer); Start tree = null; try { tree = parser.parse(); } catch (Exception e) { throw new InvalidOclException(ocl); } EvaluateExpression ee = new EvaluateExpression(vt, mi); tree.apply(ee); return ee.getValue(); }
2
              
// in src/org/argouml/profile/internal/ocl/OclInterpreter.java
catch (Exception e) { e.printStackTrace(); throw new InvalidOclException(ocl); }
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
catch (Exception e) { throw new InvalidOclException(ocl); }
3
              
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
public Object evaluate(Map<String, Object> vt, ModelInterpreter mi, String ocl) throws InvalidOclException { // XXX this seems to be a bug of the parser, // it always requires a context //LOG.debug("OCL: " + ocl); if (ocl.contains("ore")) { // TODO: Convert this to some sensible logging System.out.println("VOILA!"); } Lexer lexer = new Lexer(new PushbackReader(new StringReader( "context X inv: " + ocl), 2)); OclParser parser = new OclParser(lexer); Start tree = null; try { tree = parser.parse(); } catch (Exception e) { throw new InvalidOclException(ocl); } EvaluateExpression ee = new EvaluateExpression(vt, mi); tree.apply(ee); return ee.getValue(); }
(Lib) NoSuchElementException 2
              
// in src/org/argouml/util/SingleElementIterator.java
public T next() { if (!done) { done = true; return target; } throw new NoSuchElementException(); }
// in src/org/argouml/util/MyTokenizer.java
public String nextToken() { CustomSeparator csep; TokenSep sep; String s = null; int i, j; if (putToken != null) { s = putToken; putToken = null; return s; } if (savedToken != null) { s = savedToken; tokIdx = savedIdx; savedToken = null; return s; } if (sIdx >= eIdx) { throw new NoSuchElementException("No more tokens available"); } for (sep = delims; sep != null; sep = sep.getNext()) { sep.reset(); } if (customSeps != null) { for (i = 0; i < customSeps.size(); i++) { ((CustomSeparator) customSeps.get(i)).reset(); } } for (i = sIdx; i < eIdx; i++) { char c = source.charAt(i); for (j = 0; customSeps != null && j < customSeps.size(); j++) { csep = (CustomSeparator) customSeps.get(j); if (csep.addChar(c)) { break; } } if (customSeps != null && j < customSeps.size()) { csep = (CustomSeparator) customSeps.get(j); while (csep.hasFreePart() && i + 1 < eIdx) { if (csep.endChar(source.charAt(++i))) { break; } } i -= Math.min(csep.getPeekCount(), i); int clen = Math.min(i + 1, source.length()); if (i - sIdx + 1 > csep.tokenLength()) { s = source.substring(sIdx, i - csep.tokenLength() + 1); savedIdx = i - csep.tokenLength() + 1; savedToken = source.substring( savedIdx, clen); } else { s = source.substring(sIdx, clen); } tokIdx = sIdx; sIdx = i + 1; break; } for (sep = delims; sep != null; sep = sep.getNext()) { if (sep.addChar(c)) { break; } } if (sep != null) { if (i - sIdx + 1 > sep.length()) { s = source.substring(sIdx, i - sep.length() + 1); savedIdx = i - sep.length() + 1; savedToken = sep.getString(); } else { s = sep.getString(); } tokIdx = sIdx; sIdx = i + 1; break; } } if (s == null) { s = source.substring(sIdx); tokIdx = sIdx; sIdx = eIdx; } return s; }
0 0
(Lib) NullPointerException 2
              
// in src/org/argouml/util/MyTokenizer.java
public void putToken(String s) { if (s == null) { throw new NullPointerException("Cannot put a null token"); } putToken = s; }
0 0
(Lib) NumberFormatException 2
              
// in src/org/argouml/ui/ZoomSliderButton.java
private void handleTextEntry() { String value = currentValue.getText(); if (value.endsWith("%")) { value = value.substring(0, value.length() - 1); } try { int newZoom = Integer.parseInt(value); if (newZoom < MINIMUM_ZOOM || newZoom > MAXIMUM_ZOOM) { throw new NumberFormatException(); } slider.setValue(newZoom); } catch (NumberFormatException ex) { updateCurrentValueLabel(); } }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
private static int parseMsgOrder(String s) { int i, t; int v = 0; t = s.length(); for (i = 0; i < t; i++) { char c = s.charAt(i); if (c < 'a' || c > 'z') { throw new NumberFormatException(); } v *= 26; v += c - 'a'; } return v; }
0 0
(Lib) UnsupportedFlavorException 2
              
// in src/org/argouml/ui/TransferableModelElements.java
public Object getTransferData(DataFlavor dataFlavor) throws UnsupportedFlavorException, IOException { if (dataFlavor.match(UML_COLLECTION_FLAVOR)) { return theModelElements; } /* * TODO: We could also support other flavors here, * e.g. image (then you can drag modelelements directly into * your wordprocessor, to be inserted as an image). */ throw new UnsupportedFlavorException(dataFlavor); }
// in src/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java
public synchronized Object getTransferData(DataFlavor parFlavor) throws UnsupportedFlavorException { if (isDataFlavorSupported(parFlavor)) { return (diagramImage); } throw new UnsupportedFlavorException(DataFlavor.imageFlavor); }
0 2
              
// in src/org/argouml/ui/TransferableModelElements.java
public Object getTransferData(DataFlavor dataFlavor) throws UnsupportedFlavorException, IOException { if (dataFlavor.match(UML_COLLECTION_FLAVOR)) { return theModelElements; } /* * TODO: We could also support other flavors here, * e.g. image (then you can drag modelelements directly into * your wordprocessor, to be inserted as an image). */ throw new UnsupportedFlavorException(dataFlavor); }
// in src/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java
public synchronized Object getTransferData(DataFlavor parFlavor) throws UnsupportedFlavorException { if (isDataFlavorSupported(parFlavor)) { return (diagramImage); } throw new UnsupportedFlavorException(DataFlavor.imageFlavor); }
(Domain) XmiFormatException 2
              
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public synchronized void readModels(InputSource source) throws OpenException { XmiReader reader = null; try { reader = Model.getXmiReader(); if (Configuration.getBoolean(Argo.KEY_XMI_STRIP_DIAGRAMS, false)) { // TODO: Not implemented by eUML reader.setIgnoredElements(new String[] {"UML:Diagram"}); } else { reader.setIgnoredElements(null); } List<String> searchPath = reader.getSearchPath(); String pathList = System.getProperty("org.argouml.model.modules_search_path"); if (pathList != null) { String[] paths = pathList.split(","); for (String path : paths) { if (!searchPath.contains(path)) { reader.addSearchPath(path); } } } reader.addSearchPath(source.getSystemId()); curModel = null; elementsRead = reader.parse(source, false); if (elementsRead != null && !elementsRead.isEmpty()) { Facade facade = Model.getFacade(); Object current; Iterator elements = elementsRead.iterator(); while (elements.hasNext()) { current = elements.next(); if (facade.isAModel(current)) { LOG.info("Loaded model '" + facade.getName(current) + "'"); if (curModel == null) { curModel = current; } } else if (facade.isAProfile(current)) { LOG.info("Loaded profile '" + facade.getName(current) + "'"); if (curModel == null) { curModel = current; } } // TODO: add stereotype application (eCore AnyType?) } } uUIDRefs = new HashMap<String, Object>(reader.getXMIUUIDToObjectMap()); } catch (XmiException ex) { throw new XmiFormatException(ex); } catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); } LOG.info("======================================="); }
2
              
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (XmiException ex) { throw new XmiFormatException(ex); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); }
0
(Lib) ArrayIndexOutOfBoundsException 1
              
// in src/org/argouml/uml/util/SortedListModel.java
public Object getElementAt(int index) { Object result = null; // TODO: If this turns out to be a performance bottleneck, we can // probably optimize the common case by caching our iterator and current // position, assuming that the next request will be for a greater index Iterator it = delegate.iterator(); while (index >= 0) { if (it.hasNext()) { result = it.next(); } else { throw new ArrayIndexOutOfBoundsException(); } index--; } return result; }
0 0
(Lib) ClassCastException 1
              
// in src/org/argouml/uml/util/PathComparator.java
public int compare(Object o1, Object o2) { if (o1 == null) { if (o2 == null) { return 0; } return -1; } if (o2 == null) { return 1; } if (o1.equals(o2)) { return 0; } if (o1 instanceof String) { if (o2 instanceof String) { return collator.compare((String) o1, (String) o2); } else if (Model.getFacade().isAUMLElement(o2)) { // All strings collate before all UML elements return -1; } } if (o2 instanceof String && Model.getFacade().isAUMLElement(o1)) { // All strings collate before all UML elements return 1; } // Elements are collated first by name hoping for a quick solution String name1, name2; try { name1 = Model.getFacade().getName(o1); name2 = Model.getFacade().getName(o2); } catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); } if (name1 != null && name2 != null) { int comparison = collator.compare(name1, name2); if (comparison != 0) { return comparison; } } // and then by their enclosing path to fully distinguish them return comparePaths(o1, o2); }
1
              
// in src/org/argouml/uml/util/PathComparator.java
catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); }
0
(Lib) EOFException 1
              
// in src/org/argouml/uml/generator/AbstractSection.java
public void write(String filename, String indent, boolean outputLostSections) { try { FileReader f = new FileReader(filename); BufferedReader fr = new BufferedReader(f); // TODO: This is using the default platform character encoding // specifying an encoding will produce more predictable results FileWriter fw = new FileWriter(filename + ".out"); String line = ""; line = fr.readLine(); while (line != null) { String sectionId = getSectId(line); if (sectionId != null) { String content = mAry.get(sectionId); if (content != null) { fw.write(line + LINE_SEPARATOR); fw.write(content); // read until the end section is found, discard // generated content String endSectionId = null; do { line = fr.readLine(); if (line == null) { throw new EOFException( "Reached end of file while looking " + "for the end of section with ID = \"" + sectionId + "\"!"); } endSectionId = getSectId(line); } while (endSectionId == null); if (!endSectionId.equals(sectionId)) { LOG.error("Mismatch between sectionId (\"" + sectionId + "\") and endSectionId (\"" + endSectionId + "\")!"); } } mAry.remove(sectionId); } fw.write(line); line = fr.readLine(); if (line != null) { fw.write(LINE_SEPARATOR); } } if ((!mAry.isEmpty()) && (outputLostSections)) { fw.write("/* lost code following: " + LINE_SEPARATOR); Set mapEntries = mAry.entrySet(); Iterator itr = mapEntries.iterator(); while (itr.hasNext()) { Map.Entry entry = (Map.Entry) itr.next(); fw.write(indent + "// section " + entry.getKey() + " begin" + LINE_SEPARATOR); fw.write((String) entry.getValue()); fw.write(indent + "// section " + entry.getKey() + " end" + LINE_SEPARATOR); } fw.write("*/"); } fr.close(); fw.close(); } catch (IOException e) { LOG.error("Error: " + e.toString()); } }
0 0
(Lib) InterruptedException 1
              
// in src/org/argouml/util/ThreadUtils.java
public static void checkIfInterrupted() throws InterruptedException { // make this thread interruptible, if called from SwingWorker if (Thread.interrupted()) { throw new InterruptedException(); } }
0 19
              
// in src/org/argouml/ui/SplashScreen.java
public void progress(ProgressEvent event) throws InterruptedException { statusBar.progress(event); }
// in src/org/argouml/ui/StatusBar.java
public void progress(ProgressEvent event) throws InterruptedException { // TODO: Auto-generated method stub }
// in src/org/argouml/uml/reveng/ui/ImportStatusScreen.java
public void progress(ProgressEvent event) throws InterruptedException { // ignored }
// in src/org/argouml/util/ThreadUtils.java
public static void checkIfInterrupted() throws InterruptedException { // make this thread interruptible, if called from SwingWorker if (Thread.interrupted()) { throw new InterruptedException(); } }
// in src/org/argouml/persistence/XmiFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream stream = null; try { stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } progressMgr.nextPhase(); }
// in src/org/argouml/persistence/XmiFilePersister.java
void writeProject(Project project, OutputStream stream, ProgressMgr progressMgr) throws SaveException, InterruptedException { int size = project.getMembers().size(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase(getExtension())) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + (project.getMembers() .get(i)).getType()); } MemberFilePersister persister = new ModelMemberFilePersister(); persister.save(projectMember, stream); } } if (progressMgr != null) { progressMgr.nextPhase(); } }
// in src/org/argouml/persistence/XmiFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { LOG.info("Loading with XMIFilePersister"); try { Project p = ProjectFactory.getInstance().createProject(); long length = file.length(); long phaseSpace = 100000; int phases = (int) (length / phaseSpace); if (phases < 10) { phaseSpace = length / 10; phases = 10; } LOG.info("File length is " + length + " phase space is " + phaseSpace + " phases is " + phases); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(phases); ThreadUtils.checkIfInterrupted(); InputSource source = new InputSource(new XmiInputStream(file .toURI().toURL().openStream(), this, phaseSpace, progressMgr)); source.setSystemId(file.toURI().toURL().toString()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(source); Object model = modelPersister.getCurModel(); progressMgr.nextPhase(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); // TODO Handle multiple top level packages p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); p.updateRoots(); File defaultProjectFile = new File(file.getPath() + ".zargo"); // Make sure the file doesn't exist so the user will // get prompted to choose a new name for (int i = 0; i < 99; i++) { if (!defaultProjectFile.exists()) { break; } defaultProjectFile = new File(file.getPath() + "." + i + ".zargo"); } PersistenceManager.getInstance().setProjectURI( defaultProjectFile.toURI(), p); progressMgr.nextPhase(); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public void doSave(Project project, File file) throws SaveException, InterruptedException { LOG.info("Saving"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } ZipOutputStream stream = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); stream = new ZipOutputStream(new FileOutputStream(file)); for (ProjectMember projectMember : project.getMembers()) { if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + projectMember.getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { stream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public Project doLoad(File file) throws OpenException, InterruptedException { ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(3 + UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); int fileVersion; String releaseVersion; try { String argoEntry = getEntryNames(file, ".argo").iterator().next(); URL argoUrl = makeZipEntryUrl(toURL(file), argoEntry); fileVersion = getPersistenceVersion(argoUrl.openStream()); releaseVersion = getReleaseVersion(argoUrl.openStream()); } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } // TODO: The commented code below was commented out by Bob Tarling // in order to resolve bugs 4845 and 4857. Hopefully we can // determine the cause and reintroduce. //boolean upgradeRequired = !checkVersion(fileVersion, releaseVersion) boolean upgradeRequired = true; // Upgrade is in the way for UML2 projects, so we turn it off in that case: if (Model.getFacade().getUmlVersion().charAt(0) == '2') { upgradeRequired = false; } LOG.info("Loading zargo file of version " + fileVersion); final Project p; if (upgradeRequired) { File combinedFile = zargoToUml(file, progressMgr); p = super.doLoad(file, combinedFile, progressMgr); } else { p = loadFromZargo(file, progressMgr); } progressMgr.nextPhase(); PersistenceManager.getInstance().setProjectURI(file.toURI(), p); return p; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private File zargoToUml(File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { File combinedFile = null; try { combinedFile = File.createTempFile("combinedzargo_", ".uml"); LOG.info( "Combining old style zargo sub files into new style uml file " + combinedFile.getAbsolutePath()); combinedFile.deleteOnExit(); String encoding = Argo.getEncoding(); FileOutputStream stream = new FileOutputStream(combinedFile); PrintWriter writer = new PrintWriter(new BufferedWriter( new OutputStreamWriter(stream, encoding))); writer.println("<?xml version = \"1.0\" " + "encoding = \"" + encoding + "\" ?>"); copyArgo(file, encoding, writer); progressMgr.nextPhase(); copyMember(file, "profile", encoding, writer); copyXmi(file, encoding, writer); copyDiagrams(file, encoding, writer); // Copy the todo items after the model and diagrams so that // any model elements or figs that the todo items refer to // will exist before creating critics. copyMember(file, "todo", encoding, writer); progressMgr.nextPhase(); writer.println("</uml>"); writer.close(); LOG.info("Completed combining files"); } catch (IOException e) { throw new OpenException(e); } return combinedFile; }
// in src/org/argouml/persistence/OldZargoFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } BufferedWriter writer = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); writer = new BufferedWriter(new OutputStreamWriter(stream, "UTF-8")); // Save the .argo entry // TODO: Cyclic dependency with PersistenceManager // move PersistenceManager..getProjectBaseName() someplace else ZipEntry zipEntry = new ZipEntry(PersistenceManager.getInstance() .getProjectBaseName(project) + FileConstants.UNCOMPRESSED_FILE_EXT); stream.putNextEntry(zipEntry); Hashtable templates = TemplateReader.getInstance().read(ARGO_MINI_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project); writer.flush(); stream.closeEntry(); int counter = 0; int size = project.getMembers().size(); Collection<String> names = new ArrayList<String>(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (!(projectMember.getType().equalsIgnoreCase("xmi"))) { if (LOG.isInfoEnabled()) { LOG.info("Saving member: " + project.getMembers().get(i).getZipName()); } String name = projectMember.getZipName(); String originalName = name; while (names.contains(name)) { /* Issue 4806 explains why we need this! */ name = ++counter + originalName; } names.add(name); stream.putNextEntry(new ZipEntry(name)); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); stream.flush(); stream.closeEntry(); } } for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + project.getMembers().get(i).getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); OldModelMemberFilePersister persister = new OldModelMemberFilePersister(); persister.save(projectMember, stream); stream.flush(); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { writer.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); OutputStream stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); progressMgr.nextPhase(); String path = file.getParent(); if (LOG.isInfoEnabled()) { LOG.info("Dir ==" + path); } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
void writeProject(Project project, OutputStream oStream, ProgressMgr progressMgr) throws SaveException, InterruptedException { OutputStreamWriter outputStreamWriter; try { outputStreamWriter = new OutputStreamWriter(oStream, Argo .getEncoding()); } catch (UnsupportedEncodingException e) { throw new SaveException(e); } PrintWriter writer = new PrintWriter(new BufferedWriter( outputStreamWriter)); XmlFilterOutputStream filteredStream = new XmlFilterOutputStream( oStream, Argo.getEncoding()); try { writer.println("<?xml version = \"1.0\" " + "encoding = \"" + Argo.getEncoding() + "\" ?>"); writer.println("<uml version=\"" + PERSISTENCE_VERSION + "\">"); // Write out header section try { Hashtable templates = TemplateReader.getInstance().read( ARGO_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project, " "); } catch (ExpansionException e) { throw new SaveException(e); } writer.flush(); if (progressMgr != null) { progressMgr.nextPhase(); } // Note we assume members are ordered correctly already for (ProjectMember projectMember : project.getMembers()) { if (LOG.isInfoEnabled()) { LOG.info("Saving member : " + projectMember); } MemberFilePersister persister = getMemberFilePersister(projectMember); filteredStream.startEntry(); persister.save(projectMember, filteredStream); try { filteredStream.flush(); } catch (IOException e) { throw new SaveException(e); } } writer.println("</uml>"); writer.flush(); } finally { writer.close(); try { filteredStream.reallyClose(); } catch (IOException e) { throw new SaveException(e); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { // let's initialize the progressMgr ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); return doLoad(file, file, progressMgr); }
// in src/org/argouml/persistence/UmlFilePersister.java
protected Project doLoad(File originalFile, File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { XmlInputStream inputStream = null; try { Project p = ProjectFactory.getInstance() .createProject(file.toURI()); // Run through any stylesheet upgrades int fileVersion = getPersistenceVersionFromFile(file); LOG.info("Loading uml file of version " + fileVersion); if (!checkVersion(fileVersion, getReleaseVersionFromFile(file))) { // If we're about to upgrade the file lets take an archive // of it first. String release = getReleaseVersionFromFile(file); copyFile(originalFile, new File(originalFile.getAbsolutePath() + '~' + release)); progressMgr.setNumberOfPhases(progressMgr.getNumberOfPhases() + (PERSISTENCE_VERSION - fileVersion)); while (fileVersion < PERSISTENCE_VERSION) { ++fileVersion; LOG.info("Upgrading to version " + fileVersion); long startTime = System.currentTimeMillis(); file = transform(file, fileVersion); long endTime = System.currentTimeMillis(); LOG.info("Upgrading took " + ((endTime - startTime) / 1000) + " seconds"); progressMgr.nextPhase(); } } progressMgr.nextPhase(); inputStream = new XmlInputStream(file.toURI().toURL().openStream(), "argo", file.length(), 100000); ArgoParser parser = new ArgoParser(); Reader reader = new InputStreamReader(inputStream, Argo .getEncoding()); parser.readProject(p, reader); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); for (int i = 0; i < memberList.size(); ++i) { MemberFilePersister persister = getMemberFilePersister((String) memberList .get(i)); LOG.info("Loading member with " + persister.getClass().getName()); inputStream.reopen(persister.getMainTag()); // TODO: Do we need to set the input encoding here? It was // done for ToDo parsing, but none of the other member types // InputSource inputSource = new InputSource( // new InputStreamReader(inputStream, Argo // .getEncoding())); InputSource inputSource = new InputSource(inputStream); // Don't use systemId here or it will get opened in preference // to inputStream. inputSource.setPublicId(originalFile.toURI().toURL() .toExternalForm()); try { persister.load(p, inputSource); } catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } } } // let's update the progress progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); inputStream.realClose(); p.postLoad(); return p; } catch (InterruptedException e) { throw e; } catch (OpenException e) { throw e; } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/AbstractFilePersister.java
public final void save(Project project, File file) throws SaveException, InterruptedException { preSave(project, file); doSave(project, file); postSave(project, file); }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected void nextPhase() throws InterruptedException { ThreadUtils.checkIfInterrupted(); ++phasesCompleted; percentPhasesComplete = (phasesCompleted * 100) / numberOfPhases; fireProgressEvent(percentPhasesComplete); }
// in src/org/argouml/persistence/AbstractFilePersister.java
public void progress(ProgressEvent event) throws InterruptedException { ThreadUtils.checkIfInterrupted(); int percentPhasesLeft = 100 - percentPhasesComplete; long position = event.getPosition(); long length = event.getLength(); long proportion = (position * percentPhasesLeft) / length; fireProgressEvent(percentPhasesComplete + proportion); }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected void fireProgressEvent(long percent) throws InterruptedException { ProgressEvent event = null; // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ProgressListener.class) { // Lazily create the event: if (event == null) { event = new ProgressEvent(this, percent, 100); } ((ProgressListener) listeners[i + 1]).progress(event); } } }
(Domain) InterruptedIOException 1
              
// in src/org/argouml/persistence/XmiInputStream.java
Override public synchronized int read() throws IOException { if (endFound) { extensionFound = false; parsingExtension = false; endFound = false; readingName = false; tagName = null; endTagName = null; } int ch = super.read(); if (parsingExtension) { stringBuffer.append((char) ch); } // else { // TODO: Only progress when reading standard XMI // extension parsers will continue progression. ++readCount; if (progressMgr != null && readCount == eventSpacing) { try { readCount = 0; progressMgr.nextPhase(); } catch (InterruptedException e) { throw new InterruptedIOException(e); } } // } if (xmiExtensionParser != null) { if (readingName) { if (isNameTerminator((char) ch)) { readingName = false; if (parsingExtension && endTagName == null) { endTagName = "/" + tagName; } else if (tagName.equals("XMI.extension")) { extensionFound = true; } else if (tagName.equals(endTagName)) { endFound = true; xmiExtensionParser.parse(type, stringBuffer.toString()); stringBuffer.delete(0, stringBuffer.length()); } } else { tagName += (char) ch; } } if (extensionFound) { if (ch == '>') { extensionFound = false; callExtensionParser(); } else { attributes += (char) ch; } } if (ch == '<') { readingName = true; tagName = ""; } } return ch; }
1
              
// in src/org/argouml/persistence/XmiInputStream.java
catch (InterruptedException e) { throw new InterruptedIOException(e); }
0
(Lib) PropertyVetoException 1
              
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { if ("name".equals(evt.getPropertyName())) { if (project != null) { if (!project.isValidDiagramName((String) evt.getNewValue())) { throw new PropertyVetoException("Invalid name", evt); } } } }
0 7
              
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
protected void textEdited(FigText ft) throws PropertyVetoException { if (ft == nameFig) { // TODO: Can we delegate this to a specialist FigName class? if (getOwner() == null) { return; } notationProviderName.parse(getOwner(), ft.getText()); ft.setText(notationProviderName.toString(getOwner(), getNotationSettings())); } if (ft instanceof CompartmentFigText) { final CompartmentFigText figText = (CompartmentFigText) ft; figText.getNotationProvider().parse(ft.getOwner(), ft.getText()); ft.setText(figText.getNotationProvider().toString( ft.getOwner(), getNotationSettings())); } }
// in src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
private void createClassDiagram( Object namespace, String defaultName, Project project) throws PropertyVetoException { String namespaceDescr; if (namespace != null && Model.getFacade().getName(namespace) != null) { namespaceDescr = Model.getFacade().getName(namespace); } else { namespaceDescr = Translator.localize("misc.name.anon"); } String dialogText = "Add new class diagram to " + namespaceDescr + "?"; int option = JOptionPane.showConfirmDialog( null, dialogText, "Add new class diagram?", JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { ArgoDiagram classDiagram = DiagramFactory.getInstance(). createDiagram(DiagramType.Class, namespace, null); String diagramName = defaultName + "_" + classDiagram.getName(); project.addMember(classDiagram); TargetManager.getInstance().setTarget(classDiagram); /* change prefix */ classDiagram.setName(diagramName); ExplorerEventAdaptor.getInstance().structureChanged(); } }
// in src/org/argouml/uml/diagram/state/ui/FigState.java
Override public void textEdited(FigText ft) throws PropertyVetoException { super.textEdited(ft); if (ft == getInternal()) { Object st = getOwner(); if (st == null) { return; } notationProviderBody.parse(getOwner(), ft.getText()); ft.setText(notationProviderBody.toString(getOwner(), getNotationSettings())); } }
// in src/org/argouml/uml/diagram/state/ui/FigVertex.java
Override public void textEdited(FigText ft) throws PropertyVetoException { super.textEdited(ft); if (ft == getBodyText()) { notationProviderBody.parse(getOwner(), ft.getText()); ft.setText(notationProviderBody.toString(getOwner(), getNotationSettings())); } }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
public void setName(String n) throws PropertyVetoException { super.setName(n); MutableGraphSupport.enableSaveAction(); }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { if ("name".equals(evt.getPropertyName())) { if (project != null) { if (!project.isValidDiagramName((String) evt.getNewValue())) { throw new PropertyVetoException("Invalid name", evt); } } } }
// in src/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java
Override protected void textEdited(FigText ft) throws PropertyVetoException { super.textEdited(ft); if (ft == state) { notationProviderState.parse(getOwner(), ft.getText()); ft.setText(notationProviderState.toString(getOwner(), getNotationSettings())); } }
(Lib) UnexpectedException 1
              
// in src/org/argouml/persistence/PersistenceManager.java
public URI fixUriExtension(URI in) { URI newUri; String n = in.toString(); n = fixExtension(n); try { newUri = new URI(n); } catch (java.net.URISyntaxException e) { throw new UnexpectedException(e); } return newUri; }
1
              
// in src/org/argouml/persistence/PersistenceManager.java
catch (java.net.URISyntaxException e) { throw new UnexpectedException(e); }
0
(Domain) VersionException 1
              
// in src/org/argouml/persistence/UmlFilePersister.java
protected boolean checkVersion(int fileVersion, String releaseVersion) throws OpenException, VersionException { // If we're trying to load a file from a future version // complain and refuse. if (fileVersion > PERSISTENCE_VERSION) { throw new VersionException( "The file selected is from a more up to date version of " + "ArgoUML. It has been saved with ArgoUML version " + releaseVersion + ". Please load with that or a more up to date" + "release of ArgoUML"); } return fileVersion >= PERSISTENCE_VERSION; }
0 1
              
// in src/org/argouml/persistence/UmlFilePersister.java
protected boolean checkVersion(int fileVersion, String releaseVersion) throws OpenException, VersionException { // If we're trying to load a file from a future version // complain and refuse. if (fileVersion > PERSISTENCE_VERSION) { throw new VersionException( "The file selected is from a more up to date version of " + "ArgoUML. It has been saved with ArgoUML version " + releaseVersion + ". Please load with that or a more up to date" + "release of ArgoUML"); } return fileVersion >= PERSISTENCE_VERSION; }
Explicit thrown (throw new...): 434/464
Explicit thrown ratio: 93.5%
Builder thrown ratio: 0.2%
Variable thrown ratio: 6.3%
Checked Runtime Total
Domain 89 0 89
Lib 3 219 222
Total 92 219

Caught Exceptions Summary

A (Domain) exception is defined in the application. A (Lib) exception is defined in the JDK or in a library. An exception can be caught, and it happens that the catch block contains a throw (e.g. for wrapping a low-level exception). Hovering over a number triggers showing code snippets from the application code.

Type Exception Caught
(directly)
Caught
with Thrown
(Lib) IOException 71
            
// in src/org/argouml/ui/LoadSwingWorker.java
catch (IOException exc) { LOG.error("Failed to save file: " + file + " in most recently used list"); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IOException ioExc) { return true; }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IOException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (IOException e) { LOG.debug(e); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (IOException io) { LOG.debug("drop IOException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
catch (IOException e) { LOG.error("Exception", e); }
// in src/org/argouml/ui/HelpBox.java
catch ( IOException e) { LOG.warn("Attempted to read a bad URL: " + paneURL); }
// in src/org/argouml/ui/HelpBox.java
catch (IOException ioe) { LOG.warn( "Could not fetch requested URL"); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IOException ioe) { LOG.error("Cannot open Jar file " + file, ioe); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IOException e) { LOG.error("Unable to open " + file, e); return; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IOException e) { LOG.error("Unable to read manifest of " + file, e); return; }
// in src/org/argouml/uml/ui/ActionCopy.java
catch (IOException ignorable) { }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (IOException e) { LOG.error("IO error when writing.", e); }
// in src/org/argouml/uml/ui/ActionPaste.java
catch (IOException ignorable) { }
// in src/org/argouml/uml/ui/ActionCut.java
catch (IOException ignorable) { }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
catch ( IOException ignore ) { LOG.error("got an IOException", ignore); }
// in src/org/argouml/uml/ui/TabConstraints.java
catch (IOException ioe) { // Ignored: Highly unlikely, and what would we // do anyway? log it LOG.error("problem parsing And Checking Constraints", ioe); return; }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
catch (java.io.IOException e) { LOG.error("Error while exporting Graphics:", e); }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (IOException e) { LOG.error("Exception caught", e); }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Error while creating a temporary directory", ioe); return null; }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Exception reading files", ioe); }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Exception deleting directory", ioe); }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Exception reading file names", ioe); }
// in src/org/argouml/uml/generator/AbstractSection.java
catch (IOException e) { LOG.error("Error: " + e.toString()); }
// in src/org/argouml/uml/generator/AbstractSection.java
catch (IOException e) { LOG.error("Error: " + e.toString()); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (IOException e) { LOG.error("Error loading FigNode", e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (IOException e) { e.printStackTrace(); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (IOException ioe) { LOG.debug("Cannot open Jar file " + file, ioe); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (IOException e) { LOG.error("Exception", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); }
// in src/org/argouml/application/Main.java
catch (IOException io) { io.printStackTrace(); System.exit(-1); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final IOException e) { LOG.error("IO error copying file", e); return false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (IOException e) { LOG.error("Could not create the properties file at: " + file.getAbsolutePath(), e); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final IOException e) { if (canComplain) { LOG.warn("Unable to load configuration " + file); } canComplain = false; }
// in src/org/argouml/util/osdep/StartBrowser.java
catch (IOException ioe) { // Didn't work. LOG.error(ioe); }
// in src/org/argouml/util/Tools.java
catch (IOException ioe) { }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException ex) { }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException ex) { }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (IOException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException ex) { LOG.error("Failed to close save output writer", ex); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException ex) { throw new OpenException(ex); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException ex) { LOG.error("Failed to close save output writer", ex); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException ex) { // If we get a 2nd error, just ignore it }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException ex) { LOG.error("Failed to close save output writer", ex); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { // ignore }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { // No more we can do here on failure }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { // ignore }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { // No more we can do here on failure }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new OpenException("I/O error on stream close", e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
26
            
// in src/org/argouml/profile/ZipModelLoader.java
catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (IOException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException ex) { throw new OpenException(ex); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new OpenException("I/O error on stream close", e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
(Lib) Exception 70
            
// in src/org/argouml/ui/SwingWorker.java
catch (Exception exc) { // TODO: This error needs to be reported! LOG.error("Error while loading project: ", exc); }
// in src/org/argouml/ui/cmd/ShortcutMgr.java
catch (Exception exc) { LOG.error("Exception: " + exc); }
// in src/org/argouml/ui/cmd/GenericArgoMenuBar.java
catch (Exception e) { LOG.error("Error while loading the OSXAdapter:", e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); }
// in src/org/argouml/ui/explorer/ExplorerPopup.java
catch (Exception e) { // just no item added in this case }
// in src/org/argouml/ui/explorer/PerspectiveConfigurator.java
catch (Exception e) { LOG.error("problem adding rule", e); }
// in src/org/argouml/language/ui/LanguageComboBox.java
catch (Exception e) { LOG.error("Unexpected exception", e); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (Exception e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), e); ed.setModal(true); ed.setVisible(true); LOG.error("Got some exception", e); }
// in src/org/argouml/uml/ui/ActionDeleteModelElements.java
catch (Exception e) { // TODO: This catch block needs to be narrower and do something // with the caught exception - tfm 20071120 // Ignore }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (Exception e) { LOG.error("Exception", e); }
// in src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java
catch (Exception ex) { LOG.error("Exception caught", ex); }
// in src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
catch (Exception ex) { LOG.error(ex); }
// in src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
catch (Exception e) { LOG.error("could not set package due to:" + e + "' at " + encloser, e); }
// in src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
catch (Exception e) { LOG.error("could not set package due to:" + e + "' at " + encloser, e); }
// in src/org/argouml/uml/diagram/state/ui/FigStubState.java
catch (Exception e) { LOG.error("Exception caught and ignored!!", e); }
// in src/org/argouml/uml/diagram/state/StateDiagramGraphModel.java
catch (Exception ex) { LOG.error("buildConnection() failed", ex); }
// in src/org/argouml/uml/generator/ui/ClassGenerationDialog.java
catch (Exception userPressedCancel) { // TODO: How does the pressed cancel become a java.lang.Exception? LOG.info("user pressed cancel"); }
// in src/org/argouml/uml/reveng/ImportCommon.java
catch (Exception e) { problems.append(printToBuffer(e)); }
// in src/org/argouml/uml/reveng/Import.java
catch (Exception e) { // this is because of the (senseless?) "All files" FileFilter theImport.setSelectedSuffixFilter(null); }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (Exception e) { LOG.warn("could not set path ", e); }
// in src/org/argouml/uml/cognitive/critics/WizBreakCircularComp.java
catch (Exception pve) { LOG.error("could not set aggregation", pve); }
// in src/org/argouml/uml/cognitive/critics/WizMEName.java
catch (Exception pve) { LOG.error("could not set name", pve); }
// in src/org/argouml/uml/cognitive/critics/WizAssocComposite.java
catch (Exception pve) { // Someone took our association away. LOG.error("WizAssocComposite: could not set " + "aggregation.", pve); }
// in src/org/argouml/uml/cognitive/critics/WizOperName.java
catch (Exception pve) { LOG.error("could not set stereotype", pve); }
// in src/org/argouml/uml/cognitive/critics/WizNavigable.java
catch (Exception pve) { LOG.error("could not set navigablity", pve); }
// in src/org/argouml/uml/cognitive/critics/WizManyNames.java
catch (Exception pve) { LOG.error("could not set name", pve); }
// in src/org/argouml/profile/internal/ocl/OclInterpreter.java
catch (Exception e) { e.printStackTrace(); throw new InvalidOclException(ocl); }
// in src/org/argouml/profile/internal/ocl/ComputeDesignMaterials.java
catch (Exception e) { LOG.error("Metaclass not found: " + str, e); }
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
catch (Exception e) { throw new InvalidOclException(ocl); }
// in src/org/argouml/application/api/AbstractArgoJPanel.java
catch (Exception ex) { LOG.error("exception in clone()", ex); }
// in src/org/argouml/application/Main.java
catch (Exception ex) { LOG.error("post load no sleep", ex); }
// in src/org/argouml/application/Main.java
catch (Exception ex) { LOG.error("post load no sleep2", ex); }
// in src/org/argouml/cognitive/ToDoList.java
catch (Exception ex) { valid = false; StringBuffer buf = new StringBuffer( "Exception raised in ToDo list cleaning"); buf.append("\n"); buf.append(item.toString()); LOG.error(buf.toString(), ex); }
// in src/org/argouml/cognitive/Designer.java
catch (Exception e) { LOG.error("Critic thread killed by exception", e); }
// in src/org/argouml/cognitive/Agency.java
catch (Exception ex) { LOG.error("Disabling critique due to exception\n" + c + "\n" + dm, ex); c.setEnabled(false); }
// in src/org/argouml/notation/ui/NotationComboBox.java
catch (Exception e) { LOG.error("Unexpected exception", e); }
// in src/org/argouml/notation/NotationNameImpl.java
catch (Exception e) { // TODO: Document why we catch this. LOG.error("Unexpected exception", e); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception ioe) { // TODO: What should we do here? LOG.warn("Configuration not loaded from " + propertyLocation, ioe); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception e) { if (canComplain) { LOG.warn("Unable to save configuration " + file + "\n"); } canComplain = false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception e) { if (canComplain) { LOG.warn("Unable to load configuration " + url + "\n"); } canComplain = false; return false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception e) { result = defaultValue; }
// in src/org/argouml/configuration/ConfigurationFactory.java
catch (Exception e) { Logger.getLogger(ConfigurationFactory.class). warn("Can't create configuration factory " + name + ", using default factory"); }
// in src/org/argouml/util/osdep/StartBrowser.java
catch (Exception cnfe) { LOG.error(cnfe); LOG.info("Trying a default browser (netscape)"); String[] commline = { "netscape", url, }; Runtime.getRuntime().exec(commline); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter could not access the About Menu", ex); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter could not access the About Menu"); ex.printStackTrace(); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods LOG.error("Mac OS X Adapter could not talk to EAWT:"); ex.printStackTrace(); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter was unable to handle an ApplicationEvent: " + event, ex); }
// in src/org/argouml/util/Tools.java
catch (Exception ex) { sb.append(Translator.localize("label.error-sax-factory")); }
// in src/org/argouml/util/Tools.java
catch (Exception e) { return e.toString(); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { throw new OpenException("Exception caught", e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (Exception e) { // continue with null stream, readDiagram(...) will take care of // it }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception ex) { throw new SAXException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception ex) { // Do nothing. }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { e.printStackTrace(); throw new SaveException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { LOG.error("Exception in startelement", ex); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { throw new SAXException(ex); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/PersistenceManager.java
catch (Exception e) { // If anything goes wrong return the stack // trace as a string so that we get some // useful feedback. e.printStackTrace(new PrintStream(stream)); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception ex) { // Do nothing. }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { LOG.error("Exception in startelement", ex); }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { throw new SAXException(ex); }
19
            
// in src/org/argouml/profile/internal/ocl/OclInterpreter.java
catch (Exception e) { e.printStackTrace(); throw new InvalidOclException(ocl); }
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
catch (Exception e) { throw new InvalidOclException(ocl); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { throw new OpenException("Exception caught", e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception ex) { throw new SAXException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { e.printStackTrace(); throw new SaveException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { throw new SAXException(ex); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { throw new SAXException(ex); }
(Lib) InvalidElementException 37
            
// in src/org/argouml/ui/DisplayTextTree.java
catch (InvalidElementException e) { name = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/ui/DisplayTextTree.java
catch (InvalidElementException e) { return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/ui/DisplayTextTree.java
catch (InvalidElementException e) { return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
catch (InvalidElementException e) { LOG.debug("InvalidElementException in ExplorerTree : " + e.getStackTrace()); }
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
catch (InvalidElementException e) { LOG.debug("InvalidElementException in ExplorerTree : " + e.getStackTrace()); }
// in src/org/argouml/ui/explorer/ExplorerEventAdaptor.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element", e); } }
// in src/org/argouml/ui/explorer/NameOrder.java
catch (InvalidElementException e) { name = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/ui/UMLListCellRenderer2.java
catch (InvalidElementException e) { name = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/ui/TabTaggedValuesModel.java
catch (InvalidElementException e) { // Target has been deleted return 0; }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { return ""; }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { LOG.warn("buildModelList attempted to operate on " + "deleted element"); }
// in src/org/argouml/uml/ui/UMLStereotypeListModel.java
catch (InvalidElementException iee) { return; }
// in src/org/argouml/uml/ui/UMLStereotypeListModel.java
catch (InvalidElementException exception) { /* * This can throw an exception if the target has been * deleted. We don't want to try locking the repository * because this is called from the event delivery thread and * could cause a deadlock. Instead catch the exception and * leave the model empty. */ LOG.debug("buildModelList threw exception for target " + getTarget() + ": " + exception); }
// in src/org/argouml/uml/ui/ActionDeleteModelElements.java
catch (InvalidElementException e) { LOG.debug("Model element deleted twice - ignoring 2nd delete"); }
// in src/org/argouml/uml/ui/UMLModelElementListModel2.java
catch (InvalidElementException iee) { return; }
// in src/org/argouml/uml/ui/UMLModelElementListModel2.java
catch (InvalidElementException exception) { /* * This can throw an exception if the target has been * deleted. We don't want to try locking the repository * because this is called from the event delivery thread and * could cause a deadlock. Instead catch the exception and * leave the model empty. */ LOG.debug("buildModelList threw exception for target " + getTarget() + ": " + exception); }
// in src/org/argouml/uml/ui/TabTaggedValues.java
catch (InvalidElementException e) { // Most likely cause of this is that someone deleted our // target with the event pump turned off so we didn't // get notification. Nothing we can do about it now and // we are changing targets anyway, so just log it. LOG.warn("failed to cancel editing - " + "model element deleted while edit in progress"); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("modelChanged method accessed deleted element" + formatEvent(event), e); } }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element " + formatEvent(event), e); } }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { return true; }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { LOG.debug("stereotypeChanged method accessed deleted element ", e); }
// in src/org/argouml/uml/diagram/ui/FigCompartment.java
catch (InvalidElementException e) { // TODO: It would be better here to continue the loop and try to // build the rest of the compartment. Hence try/catch should be // internal to the loop. LOG.debug("Attempted to populate a FigEditableCompartment" + " using a deleted model element - aborting", e); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { // We moused over an object just as it was deleted // transient condition - doesn't require I18N LOG.warn("A deleted element still exists on the diagram"); return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { LOG.error("updateLayout method accessed " + "deleted element", e); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigSingleLineText.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("method accessed " + "deleted element", e); } }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
catch (InvalidElementException e) { LOG.error("Tried to refresh deleted element ", e); }
// in src/org/argouml/uml/cognitive/checklist/UMLCheckItem.java
catch (InvalidElementException e) { /* The modelelement must have been * deleted - ignore this - it will pass. */ evalStr = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/profile/ProfileFacade.java
catch (InvalidElementException e) { LOG.debug("Attempted to delete extent twice in removeAllProfiles "); }
// in src/org/argouml/application/helpers/ResourceLoaderWrapper.java
catch (InvalidElementException e) { LOG.debug("Attempted to get icon for deleted element"); return null; }
// in src/org/argouml/cognitive/ToDoList.java
catch (InvalidElementException ex) { // If element has been deleted, it's no longer valid valid = false; }
// in src/org/argouml/cognitive/Designer.java
catch (InvalidElementException e) { // Don't let a transient error kill the thread LOG.warn("Element " + dm + "caused an InvalidElementException. " + "Ignoring for this pass."); }
// in src/org/argouml/kernel/ProjectImpl.java
catch (InvalidElementException e) { LOG.warn("Extent deleted a second time"); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (InvalidElementException e) { // The model element was deleted while we were working on it return ""; }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (InvalidElementException e) { // The element was deleted while we were processing it return ""; }
0
(Lib) ParseException 26
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-end-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.transition"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-role"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.multiplicity"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.statebody"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.enumeration-literal"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException ex) { if (pex == null) { pex = ex; } }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.operation"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException ex) { if (pex == null) { pex = ex; } }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.message"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.classifierrole"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.callstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.attribute"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException ex) { if (pex == null) { pex = ex; } }
// in src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.node-modelelement"; final Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pre) { throw pre; }
6
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pre) { throw pre; }
(Domain) InvalidOclException 21
            
// in src/org/argouml/ocl/OCLEvaluator.java
catch (InvalidOclException e) { return "<ocl>invalid expression</ocl>"; }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (InvalidOclException e) { LOG.error("Invalid OCL in XMI!", e); return null; }
// in src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java
catch (InvalidOclException e) { LOG.error("Exception", e); return null; }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
0
(Lib) IllegalAccessException 17
            
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (IllegalAccessException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (IllegalAccessException e) { LOG.error(e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IllegalAccessException e) { LOG.error("Exception", e); }
// in src/org/argouml/ui/explorer/PerspectiveManager.java
catch (IllegalAccessException e) { LOG.error( "could not create rule " + ruleName + " you can try to " + "refresh the perspectives to the " + "default settings.", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IllegalAccessException e) { LOG.error("The constructor for class " + classname + " is not accessible.", e); return false; }
// in src/org/argouml/uml/ui/TabStyle.java
catch (IllegalAccessException ignore) { LOG.error(ignore); return null; }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (IllegalAccessException e) { LOG.error("Exception", e); }
// in src/org/argouml/application/Main.java
catch (IllegalAccessException e) { System.out.println(commandName + " could not be instantiated - skipping" + " (IllegalAccessException)"); continue; }
// in src/org/argouml/cognitive/Critic.java
catch (IllegalAccessException illEx) { LOG.error("Could not access wizard: ", illEx); }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.IllegalAccessException e) { LOG.error("Error instancating cr " + crClassName, e); return; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (IllegalAccessException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalAccessException iace) { // Apparently it had a setItemUID, // but we're not allowed to call it return null; }
// in src/org/argouml/util/KeyEventUtils.java
catch (IllegalAccessException e) { }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (IllegalAccessException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/AbstractFilePersister.java
catch (IllegalAccessException e) { LOG.error("Exception instantiating file persister " + clazz, e); return null; }
1
            
// in src/org/argouml/persistence/PGMLStackParser.java
catch (IllegalAccessException e) { throw new SAXException(e); }
(Domain) ProfileException 17
            
// in src/org/argouml/ui/SettingsTabProfile.java
catch (ProfileException e) { JOptionPane.showMessageDialog(this, Translator .localize("tab.profiles.userdefined.errorloading") + ": " + file.getAbsolutePath()); }
// in src/org/argouml/ui/ProjectSettingsTabProfile.java
catch (ProfileException e) { JOptionPane.showMessageDialog(this, Translator .localize("tab.profiles.userdefined.errorloading")); }
// in src/org/argouml/ui/explorer/rules/GoProfileToModel.java
catch (ProfileException e) { return Collections.EMPTY_SET; }
// in src/org/argouml/ui/explorer/ActionDeployProfile.java
catch (ProfileException e) { LOG.warn("failed to load profile from file " + f.getPath(), e); }
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
catch (ProfileException e) { // TODO: We should be giving the user more direct feedback LOG.error("Exception", e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (ProfileException e1) { LOG.error("Exception loading profile " + reference.getPath(), e1); profilePackages = Collections.emptySet(); return; }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // TODO: Why is this throwing a generic runtime exception?!?! throw new RuntimeException(e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // if an exception is raised file is unusable LOG.info("Failed to load user defined profile " + file.getAbsolutePath() + ".", e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { LOG.error("Error loading profile: " + file, e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // Nothing to delete if we couldn't get the packages }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (ProfileException e) { LOG.error("Exception loading metaprofile " + PROFILE_FILE, e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (ProfileException e) { LOG.error("Error loading UML profile", e); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (ProfileException e) { LOG.error("Exception", e); }
// in src/org/argouml/kernel/ProfileConfiguration.java
catch (ProfileException e) { LOG.warn("Error retrieving profile's " + p + " packages.", e); }
// in src/org/argouml/kernel/ProfileConfiguration.java
catch (ProfileException e) { LOG.error("Exception", e); }
// in src/org/argouml/kernel/ProjectImpl.java
catch (org.argouml.profile.ProfileException e) { LOG.error("Exception when fetching models from profile " + profile.getDisplayName(), e); }
// in src/org/argouml/kernel/ProjectManager.java
catch (ProfileException pe) { LOG.warn("Failed to get profile packages from profile " + p.getDisplayName()); }
1
            
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // TODO: Why is this throwing a generic runtime exception?!?! throw new RuntimeException(e); }
(Lib) PropertyVetoException 17
            
// in src/org/argouml/uml/ui/foundation/core/UMLDiagramNameDocument.java
catch (PropertyVetoException e) { // TODO: what shall we do with the exception? }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (PropertyVetoException ex) { LOG.error("could not parse the text entered. " + "PropertyVetoException", ex); }
// in src/org/argouml/uml/diagram/ui/UMLDiagram.java
catch (PropertyVetoException pve) { LOG.fatal("Name not allowed in construction of diagram"); }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (PropertyVetoException pe) { // Provide feedback to the user that their name was // not accepted try { highlightTag = field.getHighlighter().addHighlight(0, field.getText().length(), DefaultHighlighter.DefaultPainter); } catch (BadLocationException e1) { LOG.debug("Nested exception", e1); } }
// in src/org/argouml/uml/diagram/deployment/ui/UMLDeploymentDiagram.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java
catch (PropertyVetoException pve) { LOG.warn("Generated diagram name '" + name + "' was vetoed by setName"); }
// in src/org/argouml/uml/diagram/collaboration/ui/UMLCollaborationDiagram.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
catch (PropertyVetoException pve) { // nothing we can do about veto, so just ignore it }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
catch (PropertyVetoException pve) { // nothing we can do about veto, so just ignore it }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
catch (PropertyVetoException pve) { // no action required in case of veto on setName }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
catch (PropertyVetoException pve) { // no action required }
// in src/org/argouml/uml/diagram/use_case/ui/UMLUseCaseDiagram.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/use_case/ui/UMLUseCaseDiagram.java
catch (PropertyVetoException v) { }
// in src/org/argouml/uml/reveng/DiagramInterface.java
catch (PropertyVetoException pve) { LOG.error("Failed to set diagram name.", pve); }
// in src/org/argouml/kernel/ProjectImpl.java
catch (PropertyVetoException e) { serial++; }
0
(Lib) IllegalArgumentException 15
            
// in src/org/argouml/ui/StylePanelFig.java
catch (IllegalArgumentException iae) { bboxField.setBackground(Color.RED); return null; }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IllegalArgumentException e) { LOG.error("Exception", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IllegalArgumentException e) { LOG.error("The constructor for class " + classname + " is called with incorrect argument.", e); return false; }
// in src/org/argouml/uml/diagram/ui/AbstractActionCheckBoxMenuItem.java
catch (IllegalArgumentException e) { result = false; //not supported for this target }
// in src/org/argouml/uml/diagram/ui/AbstractActionRadioMenuItem.java
catch (IllegalArgumentException e) { result = false; //not supported for this target }
// in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
catch (IllegalArgumentException e) { LOG.error("Illegal Argument to setCollaboration", e); throw e; }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
catch (IllegalArgumentException iae) { // idem, e.g. for a generalization with leaf/root object // TODO: but showing the message in the statusbar would help // TODO: IllegalArgumentException should not be used for // events we expect to happen. We need a different way of // catching well-formedness rules. LOG.warn("IllegalArgumentException caught", iae); }
// in src/org/argouml/uml/util/PathComparator.java
catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (IllegalArgumentException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("getItemUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("setItemUID for " + obj.getClass() + " takes strange parameter", iare); return null; }
5
            
// in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
catch (IllegalArgumentException e) { LOG.error("Illegal Argument to setCollaboration", e); throw e; }
// in src/org/argouml/uml/util/PathComparator.java
catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); }
(Lib) NumberFormatException 15
            
// in src/org/argouml/ui/StylePanelFig.java
catch (NumberFormatException ex) { bboxField.setBackground(Color.RED); return null; }
// in src/org/argouml/ui/ZoomSliderButton.java
catch (NumberFormatException ex) { updateCurrentValueLabel(); }
// in src/org/argouml/uml/ui/behavior/state_machines/UMLSynchStateBoundDocument.java
catch (NumberFormatException e) { // ignored - we just skipped inserting it in our document }
// in src/org/argouml/uml/cognitive/critics/WizTooMany.java
catch (NumberFormatException ex) { // intentional: if there is nonsense in the field, // we return false }
// in src/org/argouml/uml/cognitive/critics/WizTooMany.java
catch (NumberFormatException ex) { // intentional: if there is nonsense in the field, // we do not set the value }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NumberFormatException nfe) { }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NumberFormatException nfe) { }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NumberFormatException nfe) { }
// in src/org/argouml/configuration/ConfigurationHandler.java
catch (NumberFormatException nfe) { return defaultValue; }
// in src/org/argouml/configuration/ConfigurationHandler.java
catch (NumberFormatException nfe) { return defaultValue; }
// in src/org/argouml/persistence/ArgoParser.java
catch (NumberFormatException e1) { LOG.error("NumberFormatException while parsing Font Size", e1); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/TodoParser.java
catch (NumberFormatException nfe) { np = ToDoItem.HIGH_PRIORITY; if (TodoTokenTable.STRING_PRIO_HIGH.equalsIgnoreCase(prio)) { np = ToDoItem.HIGH_PRIORITY; } else if (TodoTokenTable.STRING_PRIO_MED.equalsIgnoreCase(prio)) { np = ToDoItem.MED_PRIORITY; } else if (TodoTokenTable.STRING_PRIO_LOW.equalsIgnoreCase(prio)) { np = ToDoItem.LOW_PRIORITY; } }
// in src/org/argouml/persistence/TodoParser.java
catch (NumberFormatException nfe) { // TODO: handle parse error }
2
            
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
(Lib) ClassNotFoundException 14
            
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (ClassNotFoundException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (ClassNotFoundException e) { LOG.error(e); }
// in src/org/argouml/ui/explorer/PerspectiveManager.java
catch (ClassNotFoundException e) { LOG.error( "could not create rule " + ruleName + " you can try to " + "refresh the perspectives to the " + "default settings.", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (ClassNotFoundException e) { LOG.error("Could not load module from class " + className); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (ClassNotFoundException e) { LOG.error("The class is not found.", e); return; }
// in src/org/argouml/uml/ui/TabStyle.java
catch (ClassNotFoundException ignore) { LOG.debug("ClassNotFoundException. Could not find class:" + name); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (ClassNotFoundException e) { LOG.error("Error loading class: " + entry, e); }
// in src/org/argouml/application/Main.java
catch (ClassNotFoundException e) { System.out.println("Cannot find the command: " + commandName); continue; }
// in src/org/argouml/application/Main.java
catch (ClassNotFoundException e) { /* We don't care if optional modules aren't found. */ LOG.debug("Module " + module + " not found"); }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.ClassNotFoundException e) { LOG.error("Error loading dm " + dmClassName, e); return; }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.ClassNotFoundException e) { LOG.error("Error loading cr " + crClassName, e); return; }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (ClassNotFoundException cnfe) { LOG.error("This version of Mac OS X does not support the Apple EAWT. ApplicationEvent handling has been disabled (" + cnfe + ")"); }
// in src/org/argouml/util/Tools.java
catch (ClassNotFoundException e) { // ignore }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (ClassNotFoundException e) { throw new SAXException(e); }
1
            
// in src/org/argouml/persistence/PGMLStackParser.java
catch (ClassNotFoundException e) { throw new SAXException(e); }
(Lib) MalformedURLException 14
            
// in src/org/argouml/ui/HelpBox.java
catch ( MalformedURLException e) { LOG.warn( pages[i][0] + " URL malformed: " + pages[i][1]); }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
catch ( MalformedURLException ex ) { LOG.error("exception in opening JFileChooser", ex); }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (MalformedURLException e) { LOG.warn("could not remove file ", e); return; }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (MalformedURLException e) { LOG.warn("could not set path ", e); }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (MalformedURLException e) { LOG.error(e); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (MalformedURLException e) { throw new ProfileException( "Failed to create the ProfileReference.", e); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/FileModelLoader.java
catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
9
            
// in src/org/argouml/profile/ZipModelLoader.java
catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (MalformedURLException e) { throw new ProfileException( "Failed to create the ProfileReference.", e); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/FileModelLoader.java
catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
(Lib) InterruptedException 13
            
// in src/org/argouml/ui/SwingWorker.java
catch (InterruptedException e) { Thread.currentThread().interrupt(); // propagate return null; }
// in src/org/argouml/ui/ProjectBrowser.java
catch (java.lang.InterruptedException ex) { LOG.error("Project loading interrupted by user"); }
// in src/org/argouml/ui/StatusBar.java
catch (InterruptedException ex) { }
// in src/org/argouml/ui/StatusBar.java
catch (InterruptedException ex) { }
// in src/org/argouml/application/Main.java
catch (InterruptedException e) { }
// in src/org/argouml/cognitive/ToDoList.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/ToDoList.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/Designer.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/Designer.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (InterruptedException e) { return null; }
// in src/org/argouml/persistence/XmiInputStream.java
catch (InterruptedException e) { throw new InterruptedIOException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (InterruptedException e) { throw e; }
3
            
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/XmiInputStream.java
catch (InterruptedException e) { throw new InterruptedIOException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (InterruptedException e) { throw e; }
(Lib) InstantiationException 12
            
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (InstantiationException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (InstantiationException e) { LOG.error(e); }
// in src/org/argouml/ui/explorer/PerspectiveManager.java
catch (InstantiationException e) { LOG.error( "could not create rule " + ruleName + " you can try to " + "refresh the perspectives to the " + "default settings.", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (InstantiationException e) { LOG.error("The constructor for class " + classname + " threw an exception.", e); return false; }
// in src/org/argouml/uml/ui/TabStyle.java
catch (InstantiationException ignore) { LOG.error(ignore); return null; }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (InstantiationException e) { LOG.error("Error instantianting class: " + entry, e); }
// in src/org/argouml/application/Main.java
catch (InstantiationException e) { System.out.println(commandName + " could not be instantiated - skipping" + " (InstantiationException)"); continue; }
// in src/org/argouml/cognitive/Critic.java
catch (InstantiationException instEx) { LOG.error("Could not instantiate wizard: ", instEx); }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.InstantiationException e) { LOG.error("Error instancating cr " + crClassName, e); return; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (InstantiationException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InstantiationException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/AbstractFilePersister.java
catch (InstantiationException e) { LOG.error("Exception instantiating file persister " + clazz, e); return null; }
1
            
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InstantiationException e) { throw new SAXException(e); }
(Lib) Throwable 10
            
// in src/org/argouml/ui/ProjectSettingsDialog.java
catch (Throwable t) { }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Exception or error while trying to " + "enable module " + module.getName(), e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Exception or error while trying to " + "disable module " + module.getName(), e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { if (e instanceof ClassNotFoundException) { throw (ClassNotFoundException) e; } LOG.error("Unexpected error while loading " + classname, e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Unexpected error while loading " + classname, e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Unexpected error while instantiating " + classname, e); return false; }
// in src/org/argouml/uml/ui/TabConstraints.java
catch (Throwable t) { // OK, so that didn't work out... Just ignore // any problems and don't set the name in the // constraint body better had log it. LOG.error("some unidentified problem", t); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (Throwable e2) { LOG.error("Error loading profile: " + fileName, e2); }
// in src/org/argouml/application/Main.java
catch (Throwable t) { try { LOG.fatal("Fatal error on startup. ArgoUML failed to start", t); } finally { System.out.println("Fatal error on startup. " + "ArgoUML failed to start."); t.printStackTrace(); System.exit(1); } }
// in src/org/argouml/util/logging/AwtExceptionHandler.java
catch (Throwable t2) { // Ignore any nested exceptions. We don't want infinite loop. }
1
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { if (e instanceof ClassNotFoundException) { throw (ClassNotFoundException) e; } LOG.error("Unexpected error while loading " + classname, e); return false; }
(Lib) UmlException 10
            
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
catch (UmlException e) { LOG.error("Exception", e); }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
catch (UmlException ex) { // fail silently as we expect users to accidentally drop // on to wrong component }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (UmlException e) { LOG.error("Couldn't retrive XMI Reader from Model.", e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (UmlException e) { LOG.error("Couldn't retrive XMI Reader from Model.", e); }
// in src/org/argouml/profile/ReaderModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/StreamModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { // Should never happen - something's really wrong throw new RuntimeException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); }
6
            
// in src/org/argouml/profile/ReaderModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/StreamModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { // Should never happen - something's really wrong throw new RuntimeException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); }
(Lib) FileNotFoundException 9
            
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (FileNotFoundException e) { LOG.error("File not found error when writing.", e); }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
catch ( FileNotFoundException ignore ) { LOG.error("got a FileNotFoundException", ignore); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final FileNotFoundException e) { LOG.error("File not found while copying", e); return false; }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(e); }
6
            
// in src/org/argouml/persistence/XmiFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(e); }
(Lib) NoSuchElementException 8
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (NoSuchElementException nsee) { parseError("operation.unexpected-end-operation", s.length()); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
7
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
(Lib) ExpansionException 7
            
// in src/org/argouml/uml/cognitive/checklist/UMLCheckItem.java
catch (ExpansionException e) { // Really ought to have a CriticException to throw here. LOG.error("Failed to evaluate critic expression", e); }
// in src/org/argouml/uml/cognitive/critics/CrUML.java
catch (ExpansionException e) { // Really ought to have a CriticException to throw here. LOG.error("Failed to evaluate critic expression", e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
5
            
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
(Lib) InvocationTargetException 7
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (InvocationTargetException e) { LOG.error("Exception", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (InvocationTargetException e) { LOG.error("The constructor for class " + classname + " cannot be called.", e); return false; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (InvocationTargetException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("getItemUID for " + obj.getClass() + " threw: ", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("setItemUID for " + obj.getClass() + " threw", tie); return null; }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InvocationTargetException e) { throw new SAXException(e); }
1
            
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InvocationTargetException e) { throw new SAXException(e); }
(Lib) RuntimeException 7
            
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.error("While calling targetSet for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); e.printStackTrace(); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.error("While calling targetAdded for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); e.printStackTrace(); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.warn("While calling targetRemoved for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (RuntimeException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
catch (RuntimeException e) { if (Model.getFacade().getUmlVersion().startsWith("2")) { // TODO: Ignore and report exception until getTop // implemented. LOG.error("Explorer caught exception ", e); } else { throw e; } }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (RuntimeException e) { /* TODO: The copy function is not yet * completely implemented - so we will * have some exceptions here and there.*/ LOG.error("Exception", e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (RuntimeException e) { // TODO: Better if we wrap in a ProfileException and throw that LOG.error("Error registering profile " + p.getDisplayName()); throw e; }
2
            
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
catch (RuntimeException e) { if (Model.getFacade().getUmlVersion().startsWith("2")) { // TODO: Ignore and report exception until getTop // implemented. LOG.error("Explorer caught exception ", e); } else { throw e; } }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (RuntimeException e) { // TODO: Better if we wrap in a ProfileException and throw that LOG.error("Error registering profile " + p.getDisplayName()); throw e; }
(Lib) UnsupportedEncodingException 7
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (UnsupportedEncodingException e) { LOG.warn("Encoding " + Argo.getEncoding() + " is unknown."); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/PersistenceManager.java
catch (UnsupportedEncodingException e) { return e.toString(); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (UnsupportedEncodingException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); }
5
            
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (UnsupportedEncodingException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); }
(Lib) NoSuchMethodException 6
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (NoSuchMethodException e) { LOG.error("Exception", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoSuchMethodException e) { LOG.error("The default constructor for class " + classname + " is not found.", e); return false; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (NoSuchMethodException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no setItemUID return null; }
0
(Lib) SecurityException 6
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (SecurityException e) { LOG.error("The default constructor for class " + classname + " is not accessable.", e); return false; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (SecurityException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final SecurityException e) { LOG.error("You are not allowed to copy these files", e); return false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final SecurityException e) { LOG.error("A security exception occurred trying to load" + " the configuration, check your security settings", e); }
// in src/org/argouml/util/ItemUID.java
catch (SecurityException se) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; }
// in src/org/argouml/util/ItemUID.java
catch (SecurityException se) { // Apparently it had a setItemUID, // but we're not allowed to call it return null; }
0
(Lib) UnsupportedFlavorException 6
            
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (UnsupportedFlavorException e) { LOG.debug(e); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (UnsupportedFlavorException ufe) { LOG.debug("drop UnsupportedFlavorException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/uml/ui/ActionCopy.java
catch (UnsupportedFlavorException ignorable) { }
// in src/org/argouml/uml/ui/ActionPaste.java
catch (UnsupportedFlavorException ignorable) { }
// in src/org/argouml/uml/ui/ActionCut.java
catch (UnsupportedFlavorException ignorable) { }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (UnsupportedFlavorException e) { LOG.error("Exception caught", e); }
0
(Lib) IllegalModelElementConnectionException 5
            
// in src/org/argouml/ui/ActionCreateEdgeModelElement.java
catch (IllegalModelElementConnectionException e1) { LOG.error("Exception", e1); }
// in src/org/argouml/ui/explorer/ExplorerPopup.java
catch (IllegalModelElementConnectionException e1) { LOG.error("Exception", e1); }
// in src/org/argouml/ui/explorer/ExplorerPopup.java
catch (IllegalModelElementConnectionException e1) { LOG.error("Exception", e1); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (IllegalModelElementConnectionException e) { LOG.error("Exception", e); }
// in src/org/argouml/uml/diagram/ui/ModeCreateAssociationEnd.java
catch (IllegalModelElementConnectionException e) { // We have already confirmed the connection is valid return null; }
0
(Domain) OpenException 4
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (OpenException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (OpenException e) { LOG.error("UmlException caught", e); throw e; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { throw e; }
3
            
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (OpenException e) { LOG.error("UmlException caught", e); throw e; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { throw e; }
(Lib) SAXException 4
            
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(source.toString(), e); throw e; }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(reader.toString(), e); throw e; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
4
            
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(source.toString(), e); throw e; }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(reader.toString(), e); throw e; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
(Domain) UnresolvableException 4
            
// in src/org/argouml/cognitive/ui/DismissToDoItemDialog.java
catch (UnresolvableException ure) { LOG.error("Resolve failed (ure): ", ure); JOptionPane.showMessageDialog( this, ure.getMessage(), Translator.localize("optionpane.dismiss-failed"), JOptionPane.ERROR_MESSAGE); }
// in src/org/argouml/cognitive/ToDoList.java
catch (UnresolvableException ure) { }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); }
2
            
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); }
(Lib) BadLocationException 3
            
// in src/org/argouml/uml/ui/UMLPlainTextDocument.java
catch (BadLocationException b) { LOG.error( "A BadLocationException happened\n" + "The string to set was: " + getProperty(), b); }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (PropertyVetoException pe) { // Provide feedback to the user that their name was // not accepted try { highlightTag = field.getHighlighter().addHighlight(0, field.getText().length(), DefaultHighlighter.DefaultPainter); } catch (BadLocationException e1) { LOG.debug("Nested exception", e1); } }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (BadLocationException e1) { LOG.debug("Nested exception", e1); }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (BadLocationException ble) { LOG.debug(ble); }
0
(Lib) MissingResourceException 3
            
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e1) { LOG.debug("Resource " + resource + " not found in the default class loader."); Iterator iter = classLoaders.iterator(); while (iter.hasNext()) { ClassLoader cl = (ClassLoader) iter.next(); try { LOG.debug("Loading " + resource + " from " + cl); bundle = ResourceBundle.getBundle(resource, Locale.getDefault(), cl); break; } catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); } } }
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); }
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e) { LOG.debug("Resource " + key + " not found."); return key; }
0
(Lib) NoClassDefFoundError 3
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while loading " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while loading " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while instantiating " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; }
0
(Lib) NullPointerException 3
            
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (NullPointerException e) { dropTargetDragEvent.rejectDrag(); return; }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (NullPointerException e) { // System.err.println("NullPointerException ignored."); }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (NullPointerException e) { // System.err.println("NullPointerException ignored."); }
0
(Lib) ExceptionInInitializerError 2
            
// in src/org/argouml/util/ItemUID.java
catch (ExceptionInInitializerError eiie) { LOG.error("getItemUID for " + obj.getClass() + " exception: ", eiie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (ExceptionInInitializerError eiie) { LOG.error("setItemUID for " + obj.getClass() + " threw", eiie); return null; }
0
(Lib) IllegalStateException 2
            
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (java.lang.IllegalStateException ils) { LOG.debug("drop IllegalStateException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/uml/cognitive/critics/CrCircularInheritance.java
catch (IllegalStateException ex) { problem = PROBLEM_FOUND; LOG.info("problem found for: " + this); }
0
(Lib) OutOfMemoryError 2
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (OutOfMemoryError ex) { LOG.error("Out of memory while loading project", ex); reportError( pmw, Translator.localize("dialog.error.memory.limit"), showUI); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (OutOfMemoryError e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), "You have run out of memory. " + "Close down ArgoUML and restart with a larger heap size.", e); ed.setModal(true); ed.setVisible(true); }
0
(Lib) URISyntaxException 2
            
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (URISyntaxException e1) { LOG.error("Invalid path for Profile: " + fileName, e1); }
// in src/org/argouml/persistence/PersistenceManager.java
catch (java.net.URISyntaxException e) { throw new UnexpectedException(e); }
1
            
// in src/org/argouml/persistence/PersistenceManager.java
catch (java.net.URISyntaxException e) { throw new UnexpectedException(e); }
(Lib) UnsupportedLookAndFeelException 2
            
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (UnsupportedLookAndFeelException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (UnsupportedLookAndFeelException e) { LOG.error(e); }
0
(Lib) ArithmeticException 1
            
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
1
            
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
(Lib) ClassCastException 1
            
// in src/org/argouml/persistence/ResolvedCriticXMLHelper.java
catch (ClassCastException cce) { // TODO: Shouldn't we do something here? }
0
(Lib) CloneNotSupportedException 1
            
// in src/org/argouml/uml/util/namespace/StringNamespace.java
catch (CloneNotSupportedException e) { LOG.debug(e); return null; }
0
(Lib) ListenerNotFoundException 1
            
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (ListenerNotFoundException e) { LOG.error("Notification Listener for " + "CommentEdge not found", e); }
0
(Lib) OclException 1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclException oclExc) { // a runtime exception that occurs when some // internal test fails LOG.warn("There was some unidentified problem"); throw oclExc; }
1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclException oclExc) { // a runtime exception that occurs when some // internal test fails LOG.warn("There was some unidentified problem"); throw oclExc; }
(Lib) OclParserException 1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclParserException pe1) { LOG.warn("Could not parse the constraint", pe1); throw pe1; }
1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclParserException pe1) { LOG.warn("Could not parse the constraint", pe1); throw pe1; }
(Lib) OclTypeException 1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclTypeException pe) { LOG.warn("There was some sort of OCL Type problem", pe); throw pe; }
1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclTypeException pe) { LOG.warn("There was some sort of OCL Type problem", pe); throw pe; }
(Lib) ParserConfigurationException 1
            
// in src/org/argouml/persistence/SAXParserBase.java
catch (ParserConfigurationException e) { throw new SAXException(e); }
1
            
// in src/org/argouml/persistence/SAXParserBase.java
catch (ParserConfigurationException e) { throw new SAXException(e); }
(Lib) TransformerException 1
            
// in src/org/argouml/persistence/UmlFilePersister.java
catch (TransformerException e) { throw new OpenException(e); }
1
            
// in src/org/argouml/persistence/UmlFilePersister.java
catch (TransformerException e) { throw new OpenException(e); }
(Domain) UmlVersionException 1
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (UmlVersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI, ex); }
0
(Lib) UnknownHostException 1
            
// in src/org/argouml/application/Main.java
catch (UnknownHostException e) { System.err.println("ERROR: unable to get localhost information."); e.printStackTrace(System.err); System.err.println("On Unix systems this usually indicates that" + "your /etc/hosts file is incorrectly setup."); System.err.println("Stopping execution of ArgoUML."); System.exit(0); }
0
(Lib) UnsupportedClassVersionError 1
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (UnsupportedClassVersionError e) { LOG.error("Unsupported Java class version for " + classname); return false; }
0
(Domain) VersionException 1
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (VersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI); }
0
(Lib) XmiException 1
            
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (XmiException ex) { throw new XmiFormatException(ex); }
1
            
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (XmiException ex) { throw new XmiFormatException(ex); }
(Domain) XmiFormatException 1
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } }
0
(Lib) XmiReferenceRuntimeException 1
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiReferenceRuntimeException ex) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix reportError(pmw, Translator.localize("dialog.error.xmi.reference.error", new Object[] {ex.getReference(), ex.getMessage()}), ex.toString(), showUI); }
0

Exception Recast Summary

There is a common practice of throwing exceptions from within a catch block (e.g. for wrapping a low-level exception). The following table summarizes the usage of this practice in the application. The last column gives the number of times it happens for a pair of exceptions. The graph below the table graphically renders the same information. For a given node, its color represents its origin (blue means library exception, orange means domain exception); the left-most number is the number of times it is thrown, the right-most is the number of times it is caught.

Catch Throw
(Lib) Throwable
Unknown
1
                    
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { if (e instanceof ClassNotFoundException) { throw (ClassNotFoundException) e; } LOG.error("Unexpected error while loading " + classname, e); return false; }
(Lib) IOException
(Domain) ProfileException
(Domain) SaveException
(Domain) OpenException
(Lib) SAXException
2
                    
// in src/org/argouml/profile/ZipModelLoader.java
catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); }
10
                    
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
13
                    
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException ex) { throw new OpenException(ex); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new OpenException("I/O error on stream close", e); }
1
                    
// in src/org/argouml/persistence/SAXParserBase.java
catch (IOException e) { throw new SAXException(e); }
(Lib) RuntimeException
Unknown
2
                    
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
catch (RuntimeException e) { if (Model.getFacade().getUmlVersion().startsWith("2")) { // TODO: Ignore and report exception until getTop // implemented. LOG.error("Explorer caught exception ", e); } else { throw e; } }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (RuntimeException e) { // TODO: Better if we wrap in a ProfileException and throw that LOG.error("Error registering profile " + p.getDisplayName()); throw e; }
(Lib) ClassNotFoundException
(Lib) SAXException
1
                    
// in src/org/argouml/persistence/PGMLStackParser.java
catch (ClassNotFoundException e) { throw new SAXException(e); }
(Lib) InstantiationException
(Lib) SAXException
1
                    
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InstantiationException e) { throw new SAXException(e); }
(Lib) IllegalAccessException
(Lib) SAXException
1
                    
// in src/org/argouml/persistence/PGMLStackParser.java
catch (IllegalAccessException e) { throw new SAXException(e); }
(Lib) IllegalArgumentException
(Lib) ClassCastException
(Lib) ParseException
Unknown
1
                    
// in src/org/argouml/uml/util/PathComparator.java
catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); }
3
                    
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); }
1
                    
// in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
catch (IllegalArgumentException e) { LOG.error("Illegal Argument to setCollaboration", e); throw e; }
(Domain) ProfileException
(Lib) RuntimeException
1
                    
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // TODO: Why is this throwing a generic runtime exception?!?! throw new RuntimeException(e); }
(Lib) Exception
(Domain) InvalidOclException
(Domain) SaveException
(Domain) OpenException
(Lib) SAXException
Unknown
2
                    
// in src/org/argouml/profile/internal/ocl/OclInterpreter.java
catch (Exception e) { e.printStackTrace(); throw new InvalidOclException(ocl); }
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
catch (Exception e) { throw new InvalidOclException(ocl); }
6
                    
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { e.printStackTrace(); throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
4
                    
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { throw new OpenException("Exception caught", e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
3
                    
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception ex) { throw new SAXException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { throw new SAXException(ex); }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { throw new SAXException(ex); }
4
                    
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
(Domain) UnresolvableException
(Domain) UnresolvableException
Unknown
1
                    
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); }
1
                    
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
(Domain) OpenException
Unknown
3
                    
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (OpenException e) { LOG.error("UmlException caught", e); throw e; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { throw e; }
(Lib) InterruptedException
(Domain) InterruptedIOException
Unknown
1
                    
// in src/org/argouml/persistence/XmiInputStream.java
catch (InterruptedException e) { throw new InterruptedIOException(e); }
2
                    
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (InterruptedException e) { throw e; }
(Lib) NumberFormatException
(Domain) OpenException
2
                    
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
(Lib) InvocationTargetException
(Lib) SAXException
1
                    
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InvocationTargetException e) { throw new SAXException(e); }
(Lib) UmlException
(Domain) ProfileException
(Lib) RuntimeException
(Domain) SaveException
(Domain) XmiFormatException
3
                    
// in src/org/argouml/profile/ReaderModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/StreamModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); }
1
                    
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { // Should never happen - something's really wrong throw new RuntimeException(e); }
1
                    
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { throw new SaveException(e); }
1
                    
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); }
(Lib) MalformedURLException
(Domain) ProfileException
(Domain) OpenException
5
                    
// in src/org/argouml/profile/ZipModelLoader.java
catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (MalformedURLException e) { throw new ProfileException( "Failed to create the ProfileReference.", e); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/FileModelLoader.java
catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); }
4
                    
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
(Lib) UnsupportedEncodingException
(Domain) SaveException
(Domain) OpenException
4
                    
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (UnsupportedEncodingException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); }
1
                    
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e) { throw new OpenException(e); }
(Lib) OclTypeException
Unknown
1
                    
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclTypeException pe) { LOG.warn("There was some sort of OCL Type problem", pe); throw pe; }
(Lib) FileNotFoundException
(Domain) SaveException
6
                    
// in src/org/argouml/persistence/XmiFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(e); }
(Lib) ArithmeticException
(Lib) IllegalStateException
1
                    
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
(Lib) OclParserException
Unknown
1
                    
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclParserException pe1) { LOG.warn("Could not parse the constraint", pe1); throw pe1; }
(Lib) OclException
Unknown
1
                    
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclException oclExc) { // a runtime exception that occurs when some // internal test fails LOG.warn("There was some unidentified problem"); throw oclExc; }
(Lib) ExpansionException
(Domain) SaveException
5
                    
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
(Lib) URISyntaxException
(Lib) UnexpectedException
1
                    
// in src/org/argouml/persistence/PersistenceManager.java
catch (java.net.URISyntaxException e) { throw new UnexpectedException(e); }
(Lib) ParseException
Unknown
6
                    
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pre) { throw pre; }
(Lib) NoSuchElementException
(Lib) ParseException
7
                    
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
(Lib) SAXException
(Domain) OpenException
Unknown
2
                    
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
2
                    
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(source.toString(), e); throw e; }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(reader.toString(), e); throw e; }
(Lib) ParserConfigurationException
(Lib) SAXException
1
                    
// in src/org/argouml/persistence/SAXParserBase.java
catch (ParserConfigurationException e) { throw new SAXException(e); }
(Lib) XmiException
(Domain) XmiFormatException
1
                    
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (XmiException ex) { throw new XmiFormatException(ex); }
(Lib) TransformerException
(Domain) OpenException
1
                    
// in src/org/argouml/persistence/UmlFilePersister.java
catch (TransformerException e) { throw new OpenException(e); }

Caught / Thrown Exception

Not all exceptions are thrown AND caught in the same project. The following table gives the exceptions types with respect to this. The lower left hand side sell lists all exceptions thrown but not caught (prevalent for libraries), the upper right-hand side lists all exceptions caught but not thrown (usually coming from external dependencies).

Thrown Not Thrown
Caught
Type Name
(Lib) IOException
(Lib) UnsupportedFlavorException
(Lib) IllegalStateException
(Lib) RuntimeException
(Lib) IllegalArgumentException
(Domain) ProfileException
(Domain) InvalidOclException
(Domain) UnresolvableException
(Domain) XmiFormatException
(Domain) OpenException
(Domain) VersionException
(Lib) InterruptedException
(Lib) NumberFormatException
(Lib) NullPointerException
(Lib) OclTypeException
(Lib) PropertyVetoException
(Lib) ClassCastException
(Lib) ParseException
(Lib) NoSuchElementException
(Lib) SAXException
Type Name
(Lib) Throwable
(Lib) ListenerNotFoundException
(Lib) UnsupportedLookAndFeelException
(Lib) ClassNotFoundException
(Lib) InstantiationException
(Lib) IllegalAccessException
(Lib) IllegalModelElementConnectionException
(Lib) InvalidElementException
(Lib) Exception
(Domain) UmlVersionException
(Lib) InvocationTargetException
(Lib) NoSuchMethodException
(Lib) OutOfMemoryError
(Lib) XmiReferenceRuntimeException
(Lib) UmlException
(Lib) MalformedURLException
(Lib) UnsupportedEncodingException
(Lib) UnsupportedClassVersionError
(Lib) NoClassDefFoundError
(Lib) SecurityException
(Lib) FileNotFoundException
(Lib) BadLocationException
(Lib) ArithmeticException
(Lib) OclParserException
(Lib) OclException
(Lib) ExpansionException
(Lib) CloneNotSupportedException
(Lib) URISyntaxException
(Lib) UnknownHostException
(Lib) MissingResourceException
(Lib) ExceptionInInitializerError
(Lib) ParserConfigurationException
(Lib) XmiException
(Lib) TransformerException
Not caught
Type Name
(Lib) IndexOutOfBoundsException
(Lib) UnsupportedOperationException
(Lib) EOFException
(Lib) Error
(Lib) ArrayIndexOutOfBoundsException
(Domain) SaveException
(Lib) UnexpectedException
(Domain) InterruptedIOException

Methods called in Catch and Finally Blocks

The following shows the methods that are called inside catch blocks (first column) and finally blocks (second column). For each method, we give the number of times it is called in a catch block (second sub-column), and the total number of calls (third sub-column). If the method name is red, it means that it is only called from catch/finally blocks. Hovering over a number triggers showing code snippets from the application code.

Catch Finally
Method Nbr Nbr total
error 181
                  
// in src/org/argouml/ui/LoadSwingWorker.java
catch (IOException exc) { LOG.error("Failed to save file: " + file + " in most recently used list"); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.error("While calling targetSet for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); e.printStackTrace(); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.error("While calling targetAdded for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); e.printStackTrace(); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (ListenerNotFoundException e) { LOG.error("Notification Listener for " + "CommentEdge not found", e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (UnsupportedLookAndFeelException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (ClassNotFoundException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (InstantiationException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (IllegalAccessException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (UnsupportedLookAndFeelException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (ClassNotFoundException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (InstantiationException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (IllegalAccessException e) { LOG.error(e); }
// in src/org/argouml/ui/ActionCreateEdgeModelElement.java
catch (IllegalModelElementConnectionException e1) { LOG.error("Exception", e1); }
// in src/org/argouml/ui/SwingWorker.java
catch (Exception exc) { // TODO: This error needs to be reported! LOG.error("Error while loading project: ", exc); }
// in src/org/argouml/ui/cmd/ShortcutMgr.java
catch (Exception exc) { LOG.error("Exception: " + exc); }
// in src/org/argouml/ui/cmd/GenericArgoMenuBar.java
catch (Exception e) { LOG.error("Error while loading the OSXAdapter:", e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (InvocationTargetException e) { LOG.error("Exception", e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (NoSuchMethodException e) { LOG.error("Exception", e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IllegalArgumentException e) { LOG.error("Exception", e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IllegalAccessException e) { LOG.error("Exception", e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (OutOfMemoryError ex) { LOG.error("Out of memory while loading project", ex); reportError( pmw, Translator.localize("dialog.error.memory.limit"), showUI); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (java.lang.InterruptedException ex) { LOG.error("Project loading interrupted by user"); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IOException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (OpenException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (RuntimeException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
catch (RuntimeException e) { if (Model.getFacade().getUmlVersion().startsWith("2")) { // TODO: Ignore and report exception until getTop // implemented. LOG.error("Explorer caught exception ", e); } else { throw e; } }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (RuntimeException e) { /* TODO: The copy function is not yet * completely implemented - so we will * have some exceptions here and there.*/ LOG.error("Exception", e); }
// in src/org/argouml/ui/explorer/ExplorerPopup.java
catch (IllegalModelElementConnectionException e1) { LOG.error("Exception", e1); }
// in src/org/argouml/ui/explorer/ExplorerPopup.java
catch (IllegalModelElementConnectionException e1) { LOG.error("Exception", e1); }
// in src/org/argouml/ui/explorer/PerspectiveConfigurator.java
catch (Exception e) { LOG.error("problem adding rule", e); }
// in src/org/argouml/ui/explorer/PerspectiveManager.java
catch (ClassNotFoundException e) { LOG.error( "could not create rule " + ruleName + " you can try to " + "refresh the perspectives to the " + "default settings.", e); }
// in src/org/argouml/ui/explorer/PerspectiveManager.java
catch (InstantiationException e) { LOG.error( "could not create rule " + ruleName + " you can try to " + "refresh the perspectives to the " + "default settings.", e); }
// in src/org/argouml/ui/explorer/PerspectiveManager.java
catch (IllegalAccessException e) { LOG.error( "could not create rule " + ruleName + " you can try to " + "refresh the perspectives to the " + "default settings.", e); }
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
catch (ProfileException e) { // TODO: We should be giving the user more direct feedback LOG.error("Exception", e); }
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
catch (IOException e) { LOG.error("Exception", e); }
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
catch (UmlException e) { LOG.error("Exception", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Exception or error while trying to " + "enable module " + module.getName(), e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Exception or error while trying to " + "disable module " + module.getName(), e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (ClassNotFoundException e) { LOG.error("Could not load module from class " + className); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (ClassNotFoundException e) { LOG.error("The class is not found.", e); return; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IOException ioe) { LOG.error("Cannot open Jar file " + file, ioe); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IOException e) { LOG.error("Unable to open " + file, e); return; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IOException e) { LOG.error("Unable to read manifest of " + file, e); return; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (UnsupportedClassVersionError e) { LOG.error("Unsupported Java class version for " + classname); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while loading " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { if (e instanceof ClassNotFoundException) { throw (ClassNotFoundException) e; } LOG.error("Unexpected error while loading " + classname, e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (SecurityException e) { LOG.error("The default constructor for class " + classname + " is not accessable.", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoSuchMethodException e) { LOG.error("The default constructor for class " + classname + " is not found.", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while loading " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Unexpected error while loading " + classname, e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IllegalArgumentException e) { LOG.error("The constructor for class " + classname + " is called with incorrect argument.", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (InstantiationException e) { LOG.error("The constructor for class " + classname + " threw an exception.", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IllegalAccessException e) { LOG.error("The constructor for class " + classname + " is not accessible.", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (InvocationTargetException e) { LOG.error("The constructor for class " + classname + " cannot be called.", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while instantiating " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Unexpected error while instantiating " + classname, e); return false; }
// in src/org/argouml/language/ui/LanguageComboBox.java
catch (Exception e) { LOG.error("Unexpected exception", e); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (Exception e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), e); ed.setModal(true); ed.setVisible(true); LOG.error("Got some exception", e); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (FileNotFoundException e) { LOG.error("File not found error when writing.", e); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (IOException e) { LOG.error("IO error when writing.", e); }
// in src/org/argouml/uml/ui/UMLPlainTextDocument.java
catch (BadLocationException b) { LOG.error( "A BadLocationException happened\n" + "The string to set was: " + getProperty(), b); }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
catch ( FileNotFoundException ignore ) { LOG.error("got a FileNotFoundException", ignore); }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
catch ( IOException ignore ) { LOG.error("got an IOException", ignore); }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
catch ( MalformedURLException ex ) { LOG.error("exception in opening JFileChooser", ex); }
// in src/org/argouml/uml/ui/TabStyle.java
catch (IllegalAccessException ignore) { LOG.error(ignore); return null; }
// in src/org/argouml/uml/ui/TabStyle.java
catch (InstantiationException ignore) { LOG.error(ignore); return null; }
// in src/org/argouml/uml/ui/TabConstraints.java
catch (IOException ioe) { // Ignored: Highly unlikely, and what would we // do anyway? log it LOG.error("problem parsing And Checking Constraints", ioe); return; }
// in src/org/argouml/uml/ui/TabConstraints.java
catch (Throwable t) { // OK, so that didn't work out... Just ignore // any problems and don't set the name in the // constraint body better had log it. LOG.error("some unidentified problem", t); }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
catch (java.io.IOException e) { LOG.error("Error while exporting Graphics:", e); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (IllegalModelElementConnectionException e) { LOG.error("Exception", e); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (PropertyVetoException ex) { LOG.error("could not parse the text entered. " + "PropertyVetoException", ex); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (Exception e) { LOG.error("Exception", e); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { LOG.error("updateLayout method accessed " + "deleted element", e); }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (UnsupportedFlavorException e) { LOG.error("Exception caught", e); }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (IOException e) { LOG.error("Exception caught", e); }
// in src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java
catch (Exception ex) { LOG.error("Exception caught", ex); }
// in src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
catch (Exception ex) { LOG.error(ex); }
// in src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
catch (Exception e) { LOG.error("could not set package due to:" + e + "' at " + encloser, e); }
// in src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
catch (Exception e) { LOG.error("could not set package due to:" + e + "' at " + encloser, e); }
// in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
catch (IllegalArgumentException e) { LOG.error("Illegal Argument to setCollaboration", e); throw e; }
// in src/org/argouml/uml/diagram/state/ui/FigStubState.java
catch (Exception e) { LOG.error("Exception caught and ignored!!", e); }
// in src/org/argouml/uml/diagram/state/StateDiagramGraphModel.java
catch (Exception ex) { LOG.error("buildConnection() failed", ex); }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
catch (InvalidElementException e) { LOG.error("Tried to refresh deleted element ", e); }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Error while creating a temporary directory", ioe); return null; }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Exception reading files", ioe); }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Exception deleting directory", ioe); }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Exception reading file names", ioe); }
// in src/org/argouml/uml/generator/AbstractSection.java
catch (IOException e) { LOG.error("Error: " + e.toString()); }
// in src/org/argouml/uml/generator/AbstractSection.java
catch (IOException e) { LOG.error("Error: " + e.toString()); }
// in src/org/argouml/uml/reveng/DiagramInterface.java
catch (PropertyVetoException pve) { LOG.error("Failed to set diagram name.", pve); }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (MalformedURLException e) { LOG.error(e); }
// in src/org/argouml/uml/cognitive/checklist/UMLCheckItem.java
catch (ExpansionException e) { // Really ought to have a CriticException to throw here. LOG.error("Failed to evaluate critic expression", e); }
// in src/org/argouml/uml/cognitive/critics/WizBreakCircularComp.java
catch (Exception pve) { LOG.error("could not set aggregation", pve); }
// in src/org/argouml/uml/cognitive/critics/WizMEName.java
catch (Exception pve) { LOG.error("could not set name", pve); }
// in src/org/argouml/uml/cognitive/critics/WizAssocComposite.java
catch (Exception pve) { // Someone took our association away. LOG.error("WizAssocComposite: could not set " + "aggregation.", pve); }
// in src/org/argouml/uml/cognitive/critics/WizOperName.java
catch (Exception pve) { LOG.error("could not set stereotype", pve); }
// in src/org/argouml/uml/cognitive/critics/CrUML.java
catch (ExpansionException e) { // Really ought to have a CriticException to throw here. LOG.error("Failed to evaluate critic expression", e); }
// in src/org/argouml/uml/cognitive/critics/WizNavigable.java
catch (Exception pve) { LOG.error("could not set navigablity", pve); }
// in src/org/argouml/uml/cognitive/critics/WizManyNames.java
catch (Exception pve) { LOG.error("could not set name", pve); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (ProfileException e1) { LOG.error("Exception loading profile " + reference.getPath(), e1); profilePackages = Collections.emptySet(); return; }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (IOException e) { LOG.error("Error loading FigNode", e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (InvalidOclException e) { LOG.error("Invalid OCL in XMI!", e); return null; }
// in src/org/argouml/profile/internal/ocl/ComputeDesignMaterials.java
catch (Exception e) { LOG.error("Metaclass not found: " + str, e); }
// in src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java
catch (InvalidOclException e) { LOG.error("Exception", e); return null; }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { LOG.error("Error loading profile: " + file, e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (URISyntaxException e1) { LOG.error("Invalid path for Profile: " + fileName, e1); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (Throwable e2) { LOG.error("Error loading profile: " + fileName, e2); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (RuntimeException e) { // TODO: Better if we wrap in a ProfileException and throw that LOG.error("Error registering profile " + p.getDisplayName()); throw e; }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (UmlException e) { LOG.error("Couldn't retrive XMI Reader from Model.", e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (UmlException e) { LOG.error("Couldn't retrive XMI Reader from Model.", e); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (ProfileException e) { LOG.error("Exception loading metaprofile " + PROFILE_FILE, e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (ProfileException e) { LOG.error("Error loading UML profile", e); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (ProfileException e) { LOG.error("Exception", e); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (IOException e) { LOG.error("Exception", e); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (ClassNotFoundException e) { LOG.error("Error loading class: " + entry, e); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (InstantiationException e) { LOG.error("Error instantianting class: " + entry, e); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (IllegalAccessException e) { LOG.error("Exception", e); }
// in src/org/argouml/application/api/AbstractArgoJPanel.java
catch (Exception ex) { LOG.error("exception in clone()", ex); }
// in src/org/argouml/application/Main.java
catch (Exception ex) { LOG.error("post load no sleep", ex); }
// in src/org/argouml/application/Main.java
catch (Exception ex) { LOG.error("post load no sleep2", ex); }
// in src/org/argouml/cognitive/ui/DismissToDoItemDialog.java
catch (UnresolvableException ure) { LOG.error("Resolve failed (ure): ", ure); JOptionPane.showMessageDialog( this, ure.getMessage(), Translator.localize("optionpane.dismiss-failed"), JOptionPane.ERROR_MESSAGE); }
// in src/org/argouml/cognitive/Critic.java
catch (IllegalAccessException illEx) { LOG.error("Could not access wizard: ", illEx); }
// in src/org/argouml/cognitive/Critic.java
catch (InstantiationException instEx) { LOG.error("Could not instantiate wizard: ", instEx); }
// in src/org/argouml/cognitive/ToDoList.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/ToDoList.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/ToDoList.java
catch (Exception ex) { valid = false; StringBuffer buf = new StringBuffer( "Exception raised in ToDo list cleaning"); buf.append("\n"); buf.append(item.toString()); LOG.error(buf.toString(), ex); }
// in src/org/argouml/cognitive/Designer.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/Designer.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/Designer.java
catch (Exception e) { LOG.error("Critic thread killed by exception", e); }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.ClassNotFoundException e) { LOG.error("Error loading dm " + dmClassName, e); return; }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.ClassNotFoundException e) { LOG.error("Error loading cr " + crClassName, e); return; }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.IllegalAccessException e) { LOG.error("Error instancating cr " + crClassName, e); return; }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.InstantiationException e) { LOG.error("Error instancating cr " + crClassName, e); return; }
// in src/org/argouml/cognitive/Agency.java
catch (Exception ex) { LOG.error("Disabling critique due to exception\n" + c + "\n" + dm, ex); c.setEnabled(false); }
// in src/org/argouml/kernel/ProfileConfiguration.java
catch (ProfileException e) { LOG.error("Exception", e); }
// in src/org/argouml/kernel/ProjectImpl.java
catch (org.argouml.profile.ProfileException e) { LOG.error("Exception when fetching models from profile " + profile.getDisplayName(), e); }
// in src/org/argouml/notation/ui/NotationComboBox.java
catch (Exception e) { LOG.error("Unexpected exception", e); }
// in src/org/argouml/notation/NotationNameImpl.java
catch (Exception e) { // TODO: Document why we catch this. LOG.error("Unexpected exception", e); }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (SecurityException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (NoSuchMethodException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (IllegalArgumentException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (InstantiationException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (IllegalAccessException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (InvocationTargetException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final FileNotFoundException e) { LOG.error("File not found while copying", e); return false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final IOException e) { LOG.error("IO error copying file", e); return false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final SecurityException e) { LOG.error("You are not allowed to copy these files", e); return false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (IOException e) { LOG.error("Could not create the properties file at: " + file.getAbsolutePath(), e); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final SecurityException e) { LOG.error("A security exception occurred trying to load" + " the configuration, check your security settings", e); }
// in src/org/argouml/util/osdep/StartBrowser.java
catch (Exception cnfe) { LOG.error(cnfe); LOG.info("Trying a default browser (netscape)"); String[] commline = { "netscape", url, }; Runtime.getRuntime().exec(commline); }
// in src/org/argouml/util/osdep/StartBrowser.java
catch (IOException ioe) { // Didn't work. LOG.error(ioe); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter could not access the About Menu", ex); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter could not access the About Menu"); ex.printStackTrace(); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (ClassNotFoundException cnfe) { LOG.error("This version of Mac OS X does not support the Apple EAWT. ApplicationEvent handling has been disabled (" + cnfe + ")"); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods LOG.error("Mac OS X Adapter could not talk to EAWT:"); ex.printStackTrace(); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter was unable to handle an ApplicationEvent: " + event, ex); }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("getItemUID for " + obj.getClass() + " threw: ", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("getItemUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (ExceptionInInitializerError eiie) { LOG.error("getItemUID for " + obj.getClass() + " exception: ", eiie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("setItemUID for " + obj.getClass() + " threw", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("setItemUID for " + obj.getClass() + " takes strange parameter", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (ExceptionInInitializerError eiie) { LOG.error("setItemUID for " + obj.getClass() + " threw", eiie); return null; }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException ex) { LOG.error("Failed to close save output writer", ex); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { LOG.error("Exception in startelement", ex); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (OpenException e) { LOG.error("UmlException caught", e); throw e; }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException ex) { LOG.error("Failed to close save output writer", ex); }
// in src/org/argouml/persistence/ArgoParser.java
catch (NumberFormatException e1) { LOG.error("NumberFormatException while parsing Font Size", e1); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException ex) { LOG.error("Failed to close save output writer", ex); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
// in src/org/argouml/persistence/AbstractFilePersister.java
catch (InstantiationException e) { LOG.error("Exception instantiating file persister " + clazz, e); return null; }
// in src/org/argouml/persistence/AbstractFilePersister.java
catch (IllegalAccessException e) { LOG.error("Exception instantiating file persister " + clazz, e); return null; }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { LOG.error("Exception in startelement", ex); }
283
localize 41
                  
// in src/org/argouml/ui/SettingsTabProfile.java
catch (ProfileException e) { JOptionPane.showMessageDialog(this, Translator .localize("tab.profiles.userdefined.errorloading") + ": " + file.getAbsolutePath()); }
// in src/org/argouml/ui/ProjectSettingsTabProfile.java
catch (ProfileException e) { JOptionPane.showMessageDialog(this, Translator .localize("tab.profiles.userdefined.errorloading")); }
// in src/org/argouml/ui/DisplayTextTree.java
catch (InvalidElementException e) { name = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/ui/DisplayTextTree.java
catch (InvalidElementException e) { return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/ui/DisplayTextTree.java
catch (InvalidElementException e) { return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (VersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (OutOfMemoryError ex) { LOG.error("Out of memory while loading project", ex); reportError( pmw, Translator.localize("dialog.error.memory.limit"), showUI); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (UmlVersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IOException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (OpenException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiReferenceRuntimeException ex) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix reportError(pmw, Translator.localize("dialog.error.xmi.reference.error", new Object[] {ex.getReference(), ex.getMessage()}), ex.toString(), showUI); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (RuntimeException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/explorer/NameOrder.java
catch (InvalidElementException e) { name = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/ui/UMLListCellRenderer2.java
catch (InvalidElementException e) { name = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { // We moused over an object just as it was deleted // transient condition - doesn't require I18N LOG.warn("A deleted element still exists on the diagram"); return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/cognitive/checklist/UMLCheckItem.java
catch (InvalidElementException e) { /* The modelelement must have been * deleted - ignore this - it will pass. */ evalStr = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/cognitive/ui/DismissToDoItemDialog.java
catch (UnresolvableException ure) { LOG.error("Resolve failed (ure): ", ure); JOptionPane.showMessageDialog( this, ure.getMessage(), Translator.localize("optionpane.dismiss-failed"), JOptionPane.ERROR_MESSAGE); }
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/util/Tools.java
catch (Exception ex) { sb.append(Translator.localize("label.error-sax-factory")); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
1170
debug 39
                  
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
catch (InvalidElementException e) { LOG.debug("InvalidElementException in ExplorerTree : " + e.getStackTrace()); }
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
catch (InvalidElementException e) { LOG.debug("InvalidElementException in ExplorerTree : " + e.getStackTrace()); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (UnsupportedFlavorException e) { LOG.debug(e); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (IOException e) { LOG.debug(e); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (java.lang.IllegalStateException ils) { LOG.debug("drop IllegalStateException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (IOException io) { LOG.debug("drop IOException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (UnsupportedFlavorException ufe) { LOG.debug("drop UnsupportedFlavorException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/ui/explorer/ExplorerEventAdaptor.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element", e); } }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/ui/UMLStereotypeListModel.java
catch (InvalidElementException exception) { /* * This can throw an exception if the target has been * deleted. We don't want to try locking the repository * because this is called from the event delivery thread and * could cause a deadlock. Instead catch the exception and * leave the model empty. */ LOG.debug("buildModelList threw exception for target " + getTarget() + ": " + exception); }
// in src/org/argouml/uml/ui/ActionDeleteModelElements.java
catch (InvalidElementException e) { LOG.debug("Model element deleted twice - ignoring 2nd delete"); }
// in src/org/argouml/uml/ui/UMLModelElementListModel2.java
catch (InvalidElementException exception) { /* * This can throw an exception if the target has been * deleted. We don't want to try locking the repository * because this is called from the event delivery thread and * could cause a deadlock. Instead catch the exception and * leave the model empty. */ LOG.debug("buildModelList threw exception for target " + getTarget() + ": " + exception); }
// in src/org/argouml/uml/ui/TabStyle.java
catch (ClassNotFoundException ignore) { LOG.debug("ClassNotFoundException. Could not find class:" + name); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("modelChanged method accessed deleted element" + formatEvent(event), e); } }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element " + formatEvent(event), e); } }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { LOG.debug("stereotypeChanged method accessed deleted element ", e); }
// in src/org/argouml/uml/diagram/ui/FigCompartment.java
catch (InvalidElementException e) { // TODO: It would be better here to continue the loop and try to // build the rest of the compartment. Hence try/catch should be // internal to the loop. LOG.debug("Attempted to populate a FigEditableCompartment" + " using a deleted model element - aborting", e); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigSingleLineText.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("method accessed " + "deleted element", e); } }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (PropertyVetoException pe) { // Provide feedback to the user that their name was // not accepted try { highlightTag = field.getHighlighter().addHighlight(0, field.getText().length(), DefaultHighlighter.DefaultPainter); } catch (BadLocationException e1) { LOG.debug("Nested exception", e1); } }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (BadLocationException e1) { LOG.debug("Nested exception", e1); }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (BadLocationException ble) { LOG.debug(ble); }
// in src/org/argouml/uml/util/namespace/StringNamespace.java
catch (CloneNotSupportedException e) { LOG.debug(e); return null; }
// in src/org/argouml/profile/ProfileFacade.java
catch (InvalidElementException e) { LOG.debug("Attempted to delete extent twice in removeAllProfiles "); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (IOException ioe) { LOG.debug("Cannot open Jar file " + file, ioe); }
// in src/org/argouml/application/helpers/ResourceLoaderWrapper.java
catch (InvalidElementException e) { LOG.debug("Attempted to get icon for deleted element"); return null; }
// in src/org/argouml/application/Main.java
catch (ClassNotFoundException e) { /* We don't care if optional modules aren't found. */ LOG.debug("Module " + module + " not found"); }
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e1) { LOG.debug("Resource " + resource + " not found in the default class loader."); Iterator iter = classLoaders.iterator(); while (iter.hasNext()) { ClassLoader cl = (ClassLoader) iter.next(); try { LOG.debug("Loading " + resource + " from " + cl); bundle = ResourceBundle.getBundle(resource, Locale.getDefault(), cl); break; } catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); } } }
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); }
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e) { LOG.debug("Resource " + key + " not found."); return key; }
317
printStackTrace 29
                  
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.error("While calling targetSet for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); e.printStackTrace(); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.error("While calling targetAdded for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); e.printStackTrace(); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (IOException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ocl/OclInterpreter.java
catch (Exception e) { e.printStackTrace(); throw new InvalidOclException(ocl); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/application/Main.java
catch (Throwable t) { try { LOG.fatal("Fatal error on startup. ArgoUML failed to start", t); } finally { System.out.println("Fatal error on startup. " + "ArgoUML failed to start."); t.printStackTrace(); System.exit(1); } }
// in src/org/argouml/application/Main.java
catch (UnknownHostException e) { System.err.println("ERROR: unable to get localhost information."); e.printStackTrace(System.err); System.err.println("On Unix systems this usually indicates that" + "your /etc/hosts file is incorrectly setup."); System.err.println("Stopping execution of ArgoUML."); System.exit(0); }
// in src/org/argouml/application/Main.java
catch (IOException io) { io.printStackTrace(); System.exit(-1); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter could not access the About Menu"); ex.printStackTrace(); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods LOG.error("Mac OS X Adapter could not talk to EAWT:"); ex.printStackTrace(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { e.printStackTrace(); throw new SaveException(e); }
// in src/org/argouml/persistence/PersistenceManager.java
catch (Exception e) { // If anything goes wrong return the stack // trace as a string so that we get some // useful feedback. e.printStackTrace(new PrintStream(stream)); }
39
warn 26
                  
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.warn("While calling targetRemoved for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); }
// in src/org/argouml/ui/explorer/ActionDeployProfile.java
catch (ProfileException e) { LOG.warn("failed to load profile from file " + f.getPath(), e); }
// in src/org/argouml/ui/HelpBox.java
catch ( MalformedURLException e) { LOG.warn( pages[i][0] + " URL malformed: " + pages[i][1]); }
// in src/org/argouml/ui/HelpBox.java
catch ( IOException e) { LOG.warn("Attempted to read a bad URL: " + paneURL); }
// in src/org/argouml/ui/HelpBox.java
catch (IOException ioe) { LOG.warn( "Could not fetch requested URL"); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (UnsupportedEncodingException e) { LOG.warn("Encoding " + Argo.getEncoding() + " is unknown."); }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { LOG.warn("buildModelList attempted to operate on " + "deleted element"); }
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclTypeException pe) { LOG.warn("There was some sort of OCL Type problem", pe); throw pe; }
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclParserException pe1) { LOG.warn("Could not parse the constraint", pe1); throw pe1; }
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclException oclExc) { // a runtime exception that occurs when some // internal test fails LOG.warn("There was some unidentified problem"); throw oclExc; }
// in src/org/argouml/uml/ui/TabTaggedValues.java
catch (InvalidElementException e) { // Most likely cause of this is that someone deleted our // target with the event pump turned off so we didn't // get notification. Nothing we can do about it now and // we are changing targets anyway, so just log it. LOG.warn("failed to cancel editing - " + "model element deleted while edit in progress"); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { // We moused over an object just as it was deleted // transient condition - doesn't require I18N LOG.warn("A deleted element still exists on the diagram"); return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java
catch (PropertyVetoException pve) { LOG.warn("Generated diagram name '" + name + "' was vetoed by setName"); }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
catch (IllegalArgumentException iae) { // idem, e.g. for a generalization with leaf/root object // TODO: but showing the message in the statusbar would help // TODO: IllegalArgumentException should not be used for // events we expect to happen. We need a different way of // catching well-formedness rules. LOG.warn("IllegalArgumentException caught", iae); }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (MalformedURLException e) { LOG.warn("could not remove file ", e); return; }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (MalformedURLException e) { LOG.warn("could not set path ", e); }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (Exception e) { LOG.warn("could not set path ", e); }
// in src/org/argouml/cognitive/Designer.java
catch (InvalidElementException e) { // Don't let a transient error kill the thread LOG.warn("Element " + dm + "caused an InvalidElementException. " + "Ignoring for this pass."); }
// in src/org/argouml/kernel/ProfileConfiguration.java
catch (ProfileException e) { LOG.warn("Error retrieving profile's " + p + " packages.", e); }
// in src/org/argouml/kernel/ProjectImpl.java
catch (InvalidElementException e) { LOG.warn("Extent deleted a second time"); }
// in src/org/argouml/kernel/ProjectManager.java
catch (ProfileException pe) { LOG.warn("Failed to get profile packages from profile " + p.getDisplayName()); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception ioe) { // TODO: What should we do here? LOG.warn("Configuration not loaded from " + propertyLocation, ioe); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final IOException e) { if (canComplain) { LOG.warn("Unable to load configuration " + file); } canComplain = false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception e) { if (canComplain) { LOG.warn("Unable to save configuration " + file + "\n"); } canComplain = false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception e) { if (canComplain) { LOG.warn("Unable to load configuration " + url + "\n"); } canComplain = false; return false; }
// in src/org/argouml/configuration/ConfigurationFactory.java
catch (Exception e) { Logger.getLogger(ConfigurationFactory.class). warn("Can't create configuration factory " + name + ", using default factory"); }
90
getLocalizedMessage
19
                  
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-end-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.transition"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-role"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.multiplicity"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.statebody"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.enumeration-literal"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.operation"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.message"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.classifierrole"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.callstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.attribute"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.node-modelelement"; final Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
19
ArgoHelpEvent 17
                  
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-end-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.transition"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-role"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.multiplicity"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.statebody"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.enumeration-literal"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.operation"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.message"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.classifierrole"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.callstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.attribute"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.node-modelelement"; final Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
24
fireEvent 17
                  
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-end-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.transition"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-role"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.multiplicity"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.statebody"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.enumeration-literal"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.operation"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.message"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.classifierrole"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.callstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.attribute"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.node-modelelement"; final Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
40
getErrorOffset
17
                  
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-end-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.transition"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-role"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.multiplicity"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.statebody"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.enumeration-literal"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.operation"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.message"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.classifierrole"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.callstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.attribute"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.node-modelelement"; final Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
17
messageFormat 17
                  
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-end-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.transition"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-role"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.multiplicity"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.statebody"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.enumeration-literal"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.operation"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.message"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.classifierrole"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.callstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.attribute"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.node-modelelement"; final Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
49
valueOf 17
                  
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-end-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.transition"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-role"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.multiplicity"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.statebody"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.enumeration-literal"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.operation"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.message"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.classifierrole"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.callstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.attribute"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.node-modelelement"; final Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
170
getClass 14
                  
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
// in src/org/argouml/uml/diagram/ui/FigSingleLineText.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("getItemUID for " + obj.getClass() + " threw: ", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("getItemUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (ExceptionInInitializerError eiie) { LOG.error("getItemUID for " + obj.getClass() + " exception: ", eiie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("setItemUID for " + obj.getClass() + " threw", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("setItemUID for " + obj.getClass() + " takes strange parameter", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (ExceptionInInitializerError eiie) { LOG.error("setItemUID for " + obj.getClass() + " threw", eiie); return null; }
137
toString 12
                  
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } }
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiReferenceRuntimeException ex) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix reportError(pmw, Translator.localize("dialog.error.xmi.reference.error", new Object[] {ex.getReference(), ex.getMessage()}), ex.toString(), showUI); }
// in src/org/argouml/uml/generator/AbstractSection.java
catch (IOException e) { LOG.error("Error: " + e.toString()); }
// in src/org/argouml/uml/generator/AbstractSection.java
catch (IOException e) { LOG.error("Error: " + e.toString()); }
// in src/org/argouml/uml/util/PathComparator.java
catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); }
// in src/org/argouml/cognitive/ToDoList.java
catch (Exception ex) { valid = false; StringBuffer buf = new StringBuffer( "Exception raised in ToDo list cleaning"); buf.append("\n"); buf.append(item.toString()); LOG.error(buf.toString(), ex); }
// in src/org/argouml/util/Tools.java
catch (Exception e) { return e.toString(); }
// in src/org/argouml/persistence/PersistenceManager.java
catch (UnsupportedEncodingException e) { return e.toString(); }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(source.toString(), e); throw e; }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(reader.toString(), e); throw e; }
375
getName 11
                  
// in src/org/argouml/ui/ProjectBrowser.java
catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IOException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (OpenException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (RuntimeException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Exception or error while trying to " + "enable module " + module.getName(), e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Exception or error while trying to " + "disable module " + module.getName(), e); }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
// in src/org/argouml/uml/diagram/ui/FigSingleLineText.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
539
reportError 10
                  
// in src/org/argouml/ui/ProjectBrowser.java
catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (VersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (OutOfMemoryError ex) { LOG.error("Out of memory while loading project", ex); reportError( pmw, Translator.localize("dialog.error.memory.limit"), showUI); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (UmlVersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IOException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (OpenException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiReferenceRuntimeException ex) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix reportError(pmw, Translator.localize("dialog.error.xmi.reference.error", new Object[] {ex.getReference(), ex.getMessage()}), ex.toString(), showUI); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (RuntimeException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
14
getMessage 9
                  
// in src/org/argouml/ui/ProjectBrowser.java
catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (VersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (UmlVersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI, ex); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } }
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiReferenceRuntimeException ex) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix reportError(pmw, Translator.localize("dialog.error.xmi.reference.error", new Object[] {ex.getReference(), ex.getMessage()}), ex.toString(), showUI); }
// in src/org/argouml/cognitive/ui/DismissToDoItemDialog.java
catch (UnresolvableException ure) { LOG.error("Resolve failed (ure): ", ure); JOptionPane.showMessageDialog( this, ure.getMessage(), Translator.localize("optionpane.dismiss-failed"), JOptionPane.ERROR_MESSAGE); }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); }
10
length 9
                  
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (PropertyVetoException pe) { // Provide feedback to the user that their name was // not accepted try { highlightTag = field.getHighlighter().addHighlight(0, field.getText().length(), DefaultHighlighter.DefaultPainter); } catch (BadLocationException e1) { LOG.debug("Nested exception", e1); } }
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (NoSuchElementException nsee) { parseError("operation.unexpected-end-operation", s.length()); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
334
isDebugEnabled 7
                  
// in src/org/argouml/ui/explorer/ExplorerEventAdaptor.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element", e); } }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("modelChanged method accessed deleted element" + formatEvent(event), e); } }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element " + formatEvent(event), e); } }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigSingleLineText.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("method accessed " + "deleted element", e); } }
39
println 7
                  
// in src/org/argouml/application/Main.java
catch (Throwable t) { try { LOG.fatal("Fatal error on startup. ArgoUML failed to start", t); } finally { System.out.println("Fatal error on startup. " + "ArgoUML failed to start."); t.printStackTrace(); System.exit(1); } }
// in src/org/argouml/application/Main.java
catch (UnknownHostException e) { System.err.println("ERROR: unable to get localhost information."); e.printStackTrace(System.err); System.err.println("On Unix systems this usually indicates that" + "your /etc/hosts file is incorrectly setup."); System.err.println("Stopping execution of ArgoUML."); System.exit(0); }
// in src/org/argouml/application/Main.java
catch (ClassNotFoundException e) { System.out.println("Cannot find the command: " + commandName); continue; }
// in src/org/argouml/application/Main.java
catch (InstantiationException e) { System.out.println(commandName + " could not be instantiated - skipping" + " (InstantiationException)"); continue; }
// in src/org/argouml/application/Main.java
catch (IllegalAccessException e) { System.out.println(commandName + " could not be instantiated - skipping" + " (IllegalAccessException)"); continue; }
61
close 5
                  
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
55
delete 5
                  
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
48
getCause 5
                  
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
16
info 5
                  
// in src/org/argouml/uml/generator/ui/ClassGenerationDialog.java
catch (Exception userPressedCancel) { // TODO: How does the pressed cancel become a java.lang.Exception? LOG.info("user pressed cancel"); }
// in src/org/argouml/uml/cognitive/critics/CrCircularInheritance.java
catch (IllegalStateException ex) { problem = PROBLEM_FOUND; LOG.info("problem found for: " + this); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // if an exception is raised file is unusable LOG.info("Failed to load user defined profile " + file.getAbsolutePath() + ".", e); }
// in src/org/argouml/util/osdep/StartBrowser.java
catch (Exception cnfe) { LOG.error(cnfe); LOG.info("Trying a default browser (netscape)"); String[] commline = { "netscape", url, }; Runtime.getRuntime().exec(commline); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
160
renameTo 5
                  
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
10
append 4
                  
// in src/org/argouml/uml/reveng/ImportCommon.java
catch (Exception e) { problems.append(printToBuffer(e)); }
// in src/org/argouml/cognitive/ToDoList.java
catch (Exception ex) { valid = false; StringBuffer buf = new StringBuffer( "Exception raised in ToDo list cleaning"); buf.append("\n"); buf.append(item.toString()); LOG.error(buf.toString(), ex); }
// in src/org/argouml/util/Tools.java
catch (Exception ex) { sb.append(Translator.localize("label.error-sax-factory")); }
604
getPath 4
                  
// in src/org/argouml/ui/explorer/ActionDeployProfile.java
catch (ProfileException e) { LOG.warn("failed to load profile from file " + f.getPath(), e); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (ProfileException e1) { LOG.error("Exception loading profile " + reference.getPath(), e1); profilePackages = Collections.emptySet(); return; }
47
showMessageDialog 4
                  
// in src/org/argouml/ui/SettingsTabProfile.java
catch (ProfileException e) { JOptionPane.showMessageDialog(this, Translator .localize("tab.profiles.userdefined.errorloading") + ": " + file.getAbsolutePath()); }
// in src/org/argouml/ui/ProjectSettingsTabProfile.java
catch (ProfileException e) { JOptionPane.showMessageDialog(this, Translator .localize("tab.profiles.userdefined.errorloading")); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); }
// in src/org/argouml/cognitive/ui/DismissToDoItemDialog.java
catch (UnresolvableException ure) { LOG.error("Resolve failed (ure): ", ure); JOptionPane.showMessageDialog( this, ure.getMessage(), Translator.localize("optionpane.dismiss-failed"), JOptionPane.ERROR_MESSAGE); }
11
equalsIgnoreCase 3
                  
// in src/org/argouml/persistence/TodoParser.java
catch (NumberFormatException nfe) { np = ToDoItem.HIGH_PRIORITY; if (TodoTokenTable.STRING_PRIO_HIGH.equalsIgnoreCase(prio)) { np = ToDoItem.HIGH_PRIORITY; } else if (TodoTokenTable.STRING_PRIO_MED.equalsIgnoreCase(prio)) { np = ToDoItem.MED_PRIORITY; } else if (TodoTokenTable.STRING_PRIO_LOW.equalsIgnoreCase(prio)) { np = ToDoItem.LOW_PRIORITY; } }
66
exit 3
                  
// in src/org/argouml/application/Main.java
catch (Throwable t) { try { LOG.fatal("Fatal error on startup. ArgoUML failed to start", t); } finally { System.out.println("Fatal error on startup. " + "ArgoUML failed to start."); t.printStackTrace(); System.exit(1); } }
// in src/org/argouml/application/Main.java
catch (UnknownHostException e) { System.err.println("ERROR: unable to get localhost information."); e.printStackTrace(System.err); System.err.println("On Unix systems this usually indicates that" + "your /etc/hosts file is incorrectly setup."); System.err.println("Stopping execution of ArgoUML."); System.exit(0); }
// in src/org/argouml/application/Main.java
catch (IOException io) { io.printStackTrace(); System.exit(-1); }
11
getAbsolutePath 3
                  
// in src/org/argouml/ui/SettingsTabProfile.java
catch (ProfileException e) { JOptionPane.showMessageDialog(this, Translator .localize("tab.profiles.userdefined.errorloading") + ": " + file.getAbsolutePath()); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // if an exception is raised file is unusable LOG.info("Failed to load user defined profile " + file.getAbsolutePath() + ".", e); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (IOException e) { LOG.error("Could not create the properties file at: " + file.getAbsolutePath(), e); }
19
getDisplayName 3
                  
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (RuntimeException e) { // TODO: Better if we wrap in a ProfileException and throw that LOG.error("Error registering profile " + p.getDisplayName()); throw e; }
// in src/org/argouml/kernel/ProjectImpl.java
catch (org.argouml.profile.ProfileException e) { LOG.error("Exception when fetching models from profile " + profile.getDisplayName(), e); }
// in src/org/argouml/kernel/ProjectManager.java
catch (ProfileException pe) { LOG.warn("Failed to get profile packages from profile " + p.getDisplayName()); }
7
rejectDrop 3
                  
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (java.lang.IllegalStateException ils) { LOG.debug("drop IllegalStateException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (IOException io) { LOG.debug("drop IOException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (UnsupportedFlavorException ufe) { LOG.debug("drop UnsupportedFlavorException"); dropTargetDropEvent.rejectDrop(); }
9
ExceptionDialog 2
                  
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (OutOfMemoryError e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), "You have run out of memory. " + "Close down ArgoUML and restart with a larger heap size.", e); ed.setModal(true); ed.setVisible(true); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (Exception e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), e); ed.setModal(true); ed.setVisible(true); LOG.error("Got some exception", e); }
9
fatal 2
                  
// in src/org/argouml/uml/diagram/ui/UMLDiagram.java
catch (PropertyVetoException pve) { LOG.fatal("Name not allowed in construction of diagram"); }
// in src/org/argouml/application/Main.java
catch (Throwable t) { try { LOG.fatal("Fatal error on startup. ArgoUML failed to start", t); } finally { System.out.println("Fatal error on startup. " + "ArgoUML failed to start."); t.printStackTrace(); System.exit(1); } }
3
formatEvent
2
                  
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("modelChanged method accessed deleted element" + formatEvent(event), e); } }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element " + formatEvent(event), e); } }
2
getFrame 2
                  
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (OutOfMemoryError e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), "You have run out of memory. " + "Close down ArgoUML and restart with a larger heap size.", e); ed.setModal(true); ed.setVisible(true); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (Exception e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), e); ed.setModal(true); ed.setVisible(true); LOG.error("Got some exception", e); }
39
getOldValue 2
                  
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigSingleLineText.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
55
getPropertyName 2
                  
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigSingleLineText.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
106
getReference
2
                  
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } }
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiReferenceRuntimeException ex) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix reportError(pmw, Translator.localize("dialog.error.xmi.reference.error", new Object[] {ex.getReference(), ex.getMessage()}), ex.toString(), showUI); }
2
getSource 2
                  
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigSingleLineText.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
230
getStackTrace
2
                  
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
catch (InvalidElementException e) { LOG.debug("InvalidElementException in ExplorerTree : " + e.getStackTrace()); }
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
catch (InvalidElementException e) { LOG.debug("InvalidElementException in ExplorerTree : " + e.getStackTrace()); }
2
getTarget 2
                  
// in src/org/argouml/uml/ui/UMLStereotypeListModel.java
catch (InvalidElementException exception) { /* * This can throw an exception if the target has been * deleted. We don't want to try locking the repository * because this is called from the event delivery thread and * could cause a deadlock. Instead catch the exception and * leave the model empty. */ LOG.debug("buildModelList threw exception for target " + getTarget() + ": " + exception); }
// in src/org/argouml/uml/ui/UMLModelElementListModel2.java
catch (InvalidElementException exception) { /* * This can throw an exception if the target has been * deleted. We don't want to try locking the repository * because this is called from the event delivery thread and * could cause a deadlock. Instead catch the exception and * leave the model empty. */ LOG.debug("buildModelList threw exception for target " + getTarget() + ": " + exception); }
242
logError
2
                  
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(source.toString(), e); throw e; }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(reader.toString(), e); throw e; }
2
setBackground 2
                  
// in src/org/argouml/ui/StylePanelFig.java
catch (NumberFormatException ex) { bboxField.setBackground(Color.RED); return null; }
// in src/org/argouml/ui/StylePanelFig.java
catch (IllegalArgumentException iae) { bboxField.setBackground(Color.RED); return null; }
21
setModal 2
                  
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (OutOfMemoryError e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), "You have run out of memory. " + "Close down ArgoUML and restart with a larger heap size.", e); ed.setModal(true); ed.setVisible(true); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (Exception e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), e); ed.setModal(true); ed.setVisible(true); LOG.error("Got some exception", e); }
5
setVisible 2
                  
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (OutOfMemoryError e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), "You have run out of memory. " + "Close down ArgoUML and restart with a larger heap size.", e); ed.setModal(true); ed.setVisible(true); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (Exception e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), e); ed.setModal(true); ed.setVisible(true); LOG.error("Got some exception", e); }
100
substring 2
                  
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
152
FileInputStream 1
                  
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
6
InputSource 1
                  
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
21
PrintStream
1
                  
// in src/org/argouml/persistence/PersistenceManager.java
catch (Exception e) { // If anything goes wrong return the stack // trace as a string so that we get some // useful feedback. e.printStackTrace(new PrintStream(stream)); }
1
StringBuffer 1
                  
// in src/org/argouml/cognitive/ToDoList.java
catch (Exception ex) { valid = false; StringBuffer buf = new StringBuffer( "Exception raised in ToDo list cleaning"); buf.append("\n"); buf.append(item.toString()); LOG.error(buf.toString(), ex); }
72
addHighlight
1
                  
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (PropertyVetoException pe) { // Provide feedback to the user that their name was // not accepted try { highlightTag = field.getHighlighter().addHighlight(0, field.getText().length(), DefaultHighlighter.DefaultPainter); } catch (BadLocationException e1) { LOG.debug("Nested exception", e1); } }
1
currentThread 1
                  
// in src/org/argouml/ui/SwingWorker.java
catch (InterruptedException e) { Thread.currentThread().interrupt(); // propagate return null; }
9
emptySet 1
                  
// in src/org/argouml/profile/UserDefinedProfile.java
catch (ProfileException e1) { LOG.error("Exception loading profile " + reference.getPath(), e1); profilePackages = Collections.emptySet(); return; }
12
equals 1
                  
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
981
exec 1
                  
// in src/org/argouml/util/osdep/StartBrowser.java
catch (Exception cnfe) { LOG.error(cnfe); LOG.info("Trying a default browser (netscape)"); String[] commline = { "netscape", url, }; Runtime.getRuntime().exec(commline); }
3
format 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); }
26
getBundle 1
                  
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e1) { LOG.debug("Resource " + resource + " not found in the default class loader."); Iterator iter = classLoaders.iterator(); while (iter.hasNext()) { ClassLoader cl = (ClassLoader) iter.next(); try { LOG.debug("Loading " + resource + " from " + cl); bundle = ResourceBundle.getBundle(resource, Locale.getDefault(), cl); break; } catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); } } }
2
getCriticString 1
                  
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
2
getDefault 1
                  
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e1) { LOG.debug("Resource " + resource + " not found in the default class loader."); Iterator iter = classLoaders.iterator(); while (iter.hasNext()) { ClassLoader cl = (ClassLoader) iter.next(); try { LOG.debug("Loading " + resource + " from " + cl); bundle = ResourceBundle.getBundle(resource, Locale.getDefault(), cl); break; } catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); } } }
9
getEncoding 1
                  
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (UnsupportedEncodingException e) { LOG.warn("Encoding " + Argo.getEncoding() + " is unknown."); }
16
getFacade 1
                  
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
catch (RuntimeException e) { if (Model.getFacade().getUmlVersion().startsWith("2")) { // TODO: Ignore and report exception until getTop // implemented. LOG.error("Explorer caught exception ", e); } else { throw e; } }
3159
getHighlighter 1
                  
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (PropertyVetoException pe) { // Provide feedback to the user that their name was // not accepted try { highlightTag = field.getHighlighter().addHighlight(0, field.getText().length(), DefaultHighlighter.DefaultPainter); } catch (BadLocationException e1) { LOG.debug("Nested exception", e1); } }
2
getLogger 1
                  
// in src/org/argouml/configuration/ConfigurationFactory.java
catch (Exception e) { Logger.getLogger(ConfigurationFactory.class). warn("Can't create configuration factory " + name + ", using default factory"); }
219
getLookAndFeel 1
                  
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
2
getMainTag 1
                  
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
2
getMethod 1
                  
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
9
getProperty 1
                  
// in src/org/argouml/uml/ui/UMLPlainTextDocument.java
catch (BadLocationException b) { LOG.error( "A BadLocationException happened\n" + "The string to set was: " + getProperty(), b); }
57
getResourceAsStream 1
                  
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
3
getRuntime 1
                  
// in src/org/argouml/util/osdep/StartBrowser.java
catch (Exception cnfe) { LOG.error(cnfe); LOG.info("Trying a default browser (netscape)"); String[] commline = { "netscape", url, }; Runtime.getRuntime().exec(commline); }
10
getText 1
                  
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (PropertyVetoException pe) { // Provide feedback to the user that their name was // not accepted try { highlightTag = field.getHighlighter().addHighlight(0, field.getText().length(), DefaultHighlighter.DefaultPainter); } catch (BadLocationException e1) { LOG.debug("Nested exception", e1); } }
124
getUmlVersion 1
                  
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
catch (RuntimeException e) { if (Model.getFacade().getUmlVersion().startsWith("2")) { // TODO: Ignore and report exception until getTop // implemented. LOG.error("Explorer caught exception ", e); } else { throw e; } }
49
hasNext 1
                  
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e1) { LOG.debug("Resource " + resource + " not found in the default class loader."); Iterator iter = classLoaders.iterator(); while (iter.hasNext()) { ClassLoader cl = (ClassLoader) iter.next(); try { LOG.debug("Loading " + resource + " from " + cl); bundle = ResourceBundle.getBundle(resource, Locale.getDefault(), cl); break; } catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); } } }
335
interrupt 1
                  
// in src/org/argouml/ui/SwingWorker.java
catch (InterruptedException e) { Thread.currentThread().interrupt(); // propagate return null; }
4
invoke 1
                  
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
14
iterator 1
                  
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e1) { LOG.debug("Resource " + resource + " not found in the default class loader."); Iterator iter = classLoaders.iterator(); while (iter.hasNext()) { ClassLoader cl = (ClassLoader) iter.next(); try { LOG.debug("Loading " + resource + " from " + cl); bundle = ResourceBundle.getBundle(resource, Locale.getDefault(), cl); break; } catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); } } }
404
lastIndexOf 1
                  
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
22
load 1
                  
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
22
next 1
                  
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e1) { LOG.debug("Resource " + resource + " not found in the default class loader."); Iterator iter = classLoaders.iterator(); while (iter.hasNext()) { ClassLoader cl = (ClassLoader) iter.next(); try { LOG.debug("Loading " + resource + " from " + cl); bundle = ResourceBundle.getBundle(resource, Locale.getDefault(), cl); break; } catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); } } }
469
parseError 1
                  
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (NoSuchElementException nsee) { parseError("operation.unexpected-end-operation", s.length()); }
11
printToBuffer
1
                  
// in src/org/argouml/uml/reveng/ImportCommon.java
catch (Exception e) { problems.append(printToBuffer(e)); }
1
rejectDrag 1
                  
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (NullPointerException e) { dropTargetDragEvent.rejectDrag(); return; }
11
reopen 1
                  
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
2
setEnabled 1
                  
// in src/org/argouml/cognitive/Agency.java
catch (Exception ex) { LOG.error("Disabling critique due to exception\n" + c + "\n" + dm, ex); c.setEnabled(false); }
160
setProjectType
1
                  
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
1
setSelectedSuffixFilter 1
                  
// in src/org/argouml/uml/reveng/Import.java
catch (Exception e) { // this is because of the (senseless?) "All files" FileFilter theImport.setSelectedSuffixFilter(null); }
2
startsWith 1
                  
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
catch (RuntimeException e) { if (Model.getFacade().getUmlVersion().startsWith("2")) { // TODO: Ignore and report exception until getTop // implemented. LOG.error("Explorer caught exception ", e); } else { throw e; } }
69
updateCurrentValueLabel 1
                  
// in src/org/argouml/ui/ZoomSliderButton.java
catch (NumberFormatException ex) { updateCurrentValueLabel(); }
3
Method Nbr Nbr total
close 11
                  
// in src/org/argouml/ui/SwingWorker.java
finally { pmw.close(); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
finally { fo.close(); }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
finally { if (fo != null) { fo.close(); } }
// in src/org/argouml/uml/generator/TempFileUtils.java
finally { bfr.close(); fr.close(); }
// in src/org/argouml/persistence/UmlFilePersister.java
finally { writer.close(); try { filteredStream.reallyClose(); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } }
// in src/org/argouml/persistence/UmlFilePersister.java
finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } }
// in src/org/argouml/persistence/UmlFilePersister.java
finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } }
// in src/org/argouml/persistence/UmlFilePersister.java
finally { try { if (inputStream != null) { inputStream.close(); } if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } }
55
getManager 4
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
// in src/org/argouml/ui/ProjectBrowser.java
finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } });
196
SaveException 2
                  
// in src/org/argouml/persistence/UmlFilePersister.java
finally { writer.close(); try { filteredStream.reallyClose(); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
finally { try { outputWriter.flush(); } catch (IOException e) { throw new SaveException(e); } }
34
enableCritiquing 2
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
finally { pw.flush(); // pw.close(); Designer.enableCritiquing(); }
6
flush 2
                  
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
finally { pw.flush(); // pw.close(); Designer.enableCritiquing(); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
finally { try { outputWriter.flush(); } catch (IOException e) { throw new SaveException(e); } }
13
addCommand 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
6
clear 1
                  
// in src/org/argouml/ui/SwingWorker.java
finally { threadVar.clear(); }
62
exit 1
                  
// in src/org/argouml/application/Main.java
finally { System.out.println("Fatal error on startup. " + "ArgoUML failed to start."); t.printStackTrace(); System.exit(1); }
11
getDiagramList 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
26
getInstance 1
                  
// in src/org/argouml/uml/reveng/ImportCommon.java
finally { if (criticThreadWasOn) { Designer.theDesigner().setAutoCritique(true); } // TODO: Send an event instead of calling Explorer directly ExplorerEventAdaptor.getInstance().structureChanged(); Model.getPump().startPumpingEvents(); }
527
getProjectSettings 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
31
getPump 1
                  
// in src/org/argouml/uml/reveng/ImportCommon.java
finally { if (criticThreadWasOn) { Designer.theDesigner().setAutoCritique(true); } // TODO: Send an event instead of calling Explorer directly ExplorerEventAdaptor.getInstance().structureChanged(); Model.getPump().startPumpingEvents(); }
101
getUndoManager 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
11
info 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
160
init 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
16
invokeLater 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
// in src/org/argouml/ui/ProjectBrowser.java
finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } });
41
makeEmptyProject 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
5
printStackTrace 1
                  
// in src/org/argouml/application/Main.java
finally { System.out.println("Fatal error on startup. " + "ArgoUML failed to start."); t.printStackTrace(); System.exit(1); }
39
println 1
                  
// in src/org/argouml/application/Main.java
finally { System.out.println("Fatal error on startup. " + "ArgoUML failed to start."); t.printStackTrace(); System.exit(1); }
61
reallyClose
1
                  
// in src/org/argouml/persistence/UmlFilePersister.java
finally { writer.close(); try { filteredStream.reallyClose(); } catch (IOException e) { throw new SaveException(e); } }
1
removeProject 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
2
setAutoCritique 1
                  
// in src/org/argouml/uml/reveng/ImportCommon.java
finally { if (criticThreadWasOn) { Designer.theDesigner().setAutoCritique(true); } // TODO: Send an event instead of calling Explorer directly ExplorerEventAdaptor.getInstance().structureChanged(); Model.getPump().startPumpingEvents(); }
3
setCurrentProject 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
5
setEnabled 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
// in src/org/argouml/ui/ProjectBrowser.java
finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } });
160
setFiring 1
                  
// in src/org/argouml/uml/ui/UMLPlainTextDocument.java
finally { setFiring(true); }
4
setSaveAction 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
// in src/org/argouml/ui/ProjectBrowser.java
finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } });
4
size 1
                  
// in src/org/argouml/ui/ProjectBrowser.java
finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); }
449
startPumpingEvents 1
                  
// in src/org/argouml/uml/reveng/ImportCommon.java
finally { if (criticThreadWasOn) { Designer.theDesigner().setAutoCritique(true); } // TODO: Send an event instead of calling Explorer directly ExplorerEventAdaptor.getInstance().structureChanged(); Model.getPump().startPumpingEvents(); }
5
structureChanged 1
                  
// in src/org/argouml/uml/reveng/ImportCommon.java
finally { if (criticThreadWasOn) { Designer.theDesigner().setAutoCritique(true); } // TODO: Send an event instead of calling Explorer directly ExplorerEventAdaptor.getInstance().structureChanged(); Model.getPump().startPumpingEvents(); }
8
theDesigner 1
                  
// in src/org/argouml/uml/reveng/ImportCommon.java
finally { if (criticThreadWasOn) { Designer.theDesigner().setAutoCritique(true); } // TODO: Send an event instead of calling Explorer directly ExplorerEventAdaptor.getInstance().structureChanged(); Model.getPump().startPumpingEvents(); }
94

Reference Table

This table concatenates the results of the previous tables.

Checked/Runtime Type Exception Thrown Thrown from Catch Declared Caught directly Caught
with Thrown
Caught
with Thrown Runtime
unknown (Lib) ArithmeticException 0 0 0 1
            
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
1
            
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
1
unknown (Lib) ArrayIndexOutOfBoundsException 1
            
// in src/org/argouml/uml/util/SortedListModel.java
public Object getElementAt(int index) { Object result = null; // TODO: If this turns out to be a performance bottleneck, we can // probably optimize the common case by caching our iterator and current // position, assuming that the next request will be for a greater index Iterator it = delegate.iterator(); while (index >= 0) { if (it.hasNext()) { result = it.next(); } else { throw new ArrayIndexOutOfBoundsException(); } index--; } return result; }
0 0 0 0 0
unknown (Lib) BadLocationException 0 0 8
            
// in src/org/argouml/uml/ui/UMLPlainTextDocument.java
public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { // Mutators hold write lock & will deadlock if use is not thread safe super.insertString(offset, str, a); setPropertyInternal(getText(0, getLength())); }
// in src/org/argouml/uml/ui/UMLPlainTextDocument.java
public void remove(int offs, int len) throws BadLocationException { // Mutators hold write lock & will deadlock if use is not thread safe super.remove(offs, len); setPropertyInternal(getText(0, getLength())); }
// in src/org/argouml/uml/ui/UMLModelElementTaggedValueProxy.java
public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { document.insertString(offset, str, a); }
// in src/org/argouml/uml/ui/UMLModelElementTaggedValueProxy.java
public void remove(int offs, int len) throws BadLocationException { document.remove(offs, len); }
// in src/org/argouml/uml/ui/UMLModelElementTaggedValueProxy.java
public String getText(int offset, int length) throws BadLocationException { return document.getText(offset, length); }
// in src/org/argouml/uml/ui/UMLModelElementTaggedValueProxy.java
public Position createPosition(int offs) throws BadLocationException { return document.createPosition(offs); }
// in src/org/argouml/uml/ui/UMLModelElementTaggedValueProxy.java
public void getText(int offset, int length, Segment txt) throws BadLocationException { document.getText(offset, length, txt); }
// in src/org/argouml/uml/ui/behavior/state_machines/UMLSynchStateBoundDocument.java
Override public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { try { // Make sure it's parseable as an number Integer.parseInt(str); super.insertString(offset, str, a); } catch (NumberFormatException e) { // ignored - we just skipped inserting it in our document } }
3
            
// in src/org/argouml/uml/ui/UMLPlainTextDocument.java
catch (BadLocationException b) { LOG.error( "A BadLocationException happened\n" + "The string to set was: " + getProperty(), b); }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (PropertyVetoException pe) { // Provide feedback to the user that their name was // not accepted try { highlightTag = field.getHighlighter().addHighlight(0, field.getText().length(), DefaultHighlighter.DefaultPainter); } catch (BadLocationException e1) { LOG.debug("Nested exception", e1); } }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (BadLocationException e1) { LOG.debug("Nested exception", e1); }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (BadLocationException ble) { LOG.debug(ble); }
0 0
unknown (Lib) ClassCastException 1
            
// in src/org/argouml/uml/util/PathComparator.java
public int compare(Object o1, Object o2) { if (o1 == null) { if (o2 == null) { return 0; } return -1; } if (o2 == null) { return 1; } if (o1.equals(o2)) { return 0; } if (o1 instanceof String) { if (o2 instanceof String) { return collator.compare((String) o1, (String) o2); } else if (Model.getFacade().isAUMLElement(o2)) { // All strings collate before all UML elements return -1; } } if (o2 instanceof String && Model.getFacade().isAUMLElement(o1)) { // All strings collate before all UML elements return 1; } // Elements are collated first by name hoping for a quick solution String name1, name2; try { name1 = Model.getFacade().getName(o1); name2 = Model.getFacade().getName(o2); } catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); } if (name1 != null && name2 != null) { int comparison = collator.compare(name1, name2); if (comparison != 0) { return comparison; } } // and then by their enclosing path to fully distinguish them return comparePaths(o1, o2); }
1
            
// in src/org/argouml/uml/util/PathComparator.java
catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); }
0 1
            
// in src/org/argouml/persistence/ResolvedCriticXMLHelper.java
catch (ClassCastException cce) { // TODO: Shouldn't we do something here? }
0 0
unknown (Lib) ClassNotFoundException 0 0 4
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
private void processJarFile(ClassLoader classloader, File file) throws ClassNotFoundException { LOG.info("Opening jar file " + file); JarFile jarfile; try { jarfile = new JarFile(file); } catch (IOException e) { LOG.error("Unable to open " + file, e); return; } Manifest manifest; try { manifest = jarfile.getManifest(); if (manifest == null) { // We expect all extensions to have a manifest even though we // can operate without one if necessary. LOG.warn(file + " does not have a manifest"); } } catch (IOException e) { LOG.error("Unable to read manifest of " + file, e); return; } // TODO: It is a performance drain to load all classes at startup time. // They should be lazy loaded when needed. Instead of scanning all // classes for ones which implement our loadable module interface, we // should use a manifest entry or a special name/name pattern that we // look for to find the single main module class to load here. - tfm boolean loadedClass = false; if (manifest == null) { Enumeration<JarEntry> jarEntries = jarfile.entries(); while (jarEntries.hasMoreElements()) { JarEntry entry = jarEntries.nextElement(); loadedClass = loadedClass | processEntry(classloader, entry.getName()); } } else { Map<String, Attributes> entries = manifest.getEntries(); for (String key : entries.keySet()) { // Look for our specification loadedClass = loadedClass | processEntry(classloader, key); } } // Add this to search list for I18N properties // (Done for both modules & localized property file sets) Translator.addClassLoader(classloader); // If it didn't have a loadable module class and it doesn't look like // a localized property set, warn the user that something funny is in // their extension directory if (!loadedClass && !file.getName().contains("argouml-i18n-")) { LOG.error("Failed to find any loadable ArgoUML modules in jar " + file); } }
// in src/org/argouml/moduleloader/ModuleLoader2.java
private boolean processEntry(ClassLoader classloader, String cname) throws ClassNotFoundException { if (cname.endsWith(CLASS_SUFFIX)) { int classNamelen = cname.length() - CLASS_SUFFIX.length(); String className = cname.substring(0, classNamelen); className = className.replace('/', '.'); return addClass(classloader, className); } return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
public static void addClass(String classname) throws ClassNotFoundException { getInstance().addClass(ModuleLoader2.class.getClassLoader(), classname); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
private boolean addClass(ClassLoader classLoader, String classname) throws ClassNotFoundException { LOG.info("Loading module " + classname); Class moduleClass; try { moduleClass = classLoader.loadClass(classname); } catch (UnsupportedClassVersionError e) { LOG.error("Unsupported Java class version for " + classname); return false; } catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while loading " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; } catch (Throwable e) { if (e instanceof ClassNotFoundException) { throw (ClassNotFoundException) e; } LOG.error("Unexpected error while loading " + classname, e); return false; } if (!ModuleInterface.class.isAssignableFrom(moduleClass)) { LOG.debug("The class " + classname + " is not a module."); return false; } Constructor defaultConstructor; try { defaultConstructor = moduleClass.getDeclaredConstructor(new Class[] {}); } catch (SecurityException e) { LOG.error("The default constructor for class " + classname + " is not accessable.", e); return false; } catch (NoSuchMethodException e) { LOG.error("The default constructor for class " + classname + " is not found.", e); return false; } catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while loading " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; } catch (Throwable e) { LOG.error("Unexpected error while loading " + classname, e); return false; } if (!Modifier.isPublic(defaultConstructor.getModifiers())) { LOG.error("The default constructor for class " + classname + " is not public. Not loaded."); return false; } Object moduleInstance; try { moduleInstance = defaultConstructor.newInstance(new Object[]{}); } catch (IllegalArgumentException e) { LOG.error("The constructor for class " + classname + " is called with incorrect argument.", e); return false; } catch (InstantiationException e) { LOG.error("The constructor for class " + classname + " threw an exception.", e); return false; } catch (IllegalAccessException e) { LOG.error("The constructor for class " + classname + " is not accessible.", e); return false; } catch (InvocationTargetException e) { LOG.error("The constructor for class " + classname + " cannot be called.", e); return false; } catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while instantiating " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; } catch (Throwable e) { LOG.error("Unexpected error while instantiating " + classname, e); return false; } // The following check should have been satisfied before we // instantiated the module, but double check again if (!(moduleInstance instanceof ModuleInterface)) { LOG.error("The class " + classname + " is not a module."); return false; } ModuleInterface mf = (ModuleInterface) moduleInstance; addModule(mf); LOG.info("Succesfully loaded module " + classname); return true; }
14
            
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (ClassNotFoundException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (ClassNotFoundException e) { LOG.error(e); }
// in src/org/argouml/ui/explorer/PerspectiveManager.java
catch (ClassNotFoundException e) { LOG.error( "could not create rule " + ruleName + " you can try to " + "refresh the perspectives to the " + "default settings.", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (ClassNotFoundException e) { LOG.error("Could not load module from class " + className); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (ClassNotFoundException e) { LOG.error("The class is not found.", e); return; }
// in src/org/argouml/uml/ui/TabStyle.java
catch (ClassNotFoundException ignore) { LOG.debug("ClassNotFoundException. Could not find class:" + name); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (ClassNotFoundException e) { LOG.error("Error loading class: " + entry, e); }
// in src/org/argouml/application/Main.java
catch (ClassNotFoundException e) { System.out.println("Cannot find the command: " + commandName); continue; }
// in src/org/argouml/application/Main.java
catch (ClassNotFoundException e) { /* We don't care if optional modules aren't found. */ LOG.debug("Module " + module + " not found"); }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.ClassNotFoundException e) { LOG.error("Error loading dm " + dmClassName, e); return; }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.ClassNotFoundException e) { LOG.error("Error loading cr " + crClassName, e); return; }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (ClassNotFoundException cnfe) { LOG.error("This version of Mac OS X does not support the Apple EAWT. ApplicationEvent handling has been disabled (" + cnfe + ")"); }
// in src/org/argouml/util/Tools.java
catch (ClassNotFoundException e) { // ignore }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (ClassNotFoundException e) { throw new SAXException(e); }
1
            
// in src/org/argouml/persistence/PGMLStackParser.java
catch (ClassNotFoundException e) { throw new SAXException(e); }
0
unknown (Lib) CloneNotSupportedException 0 0 0 1
            
// in src/org/argouml/uml/util/namespace/StringNamespace.java
catch (CloneNotSupportedException e) { LOG.debug(e); return null; }
0 0
unknown (Lib) EOFException 1
            
// in src/org/argouml/uml/generator/AbstractSection.java
public void write(String filename, String indent, boolean outputLostSections) { try { FileReader f = new FileReader(filename); BufferedReader fr = new BufferedReader(f); // TODO: This is using the default platform character encoding // specifying an encoding will produce more predictable results FileWriter fw = new FileWriter(filename + ".out"); String line = ""; line = fr.readLine(); while (line != null) { String sectionId = getSectId(line); if (sectionId != null) { String content = mAry.get(sectionId); if (content != null) { fw.write(line + LINE_SEPARATOR); fw.write(content); // read until the end section is found, discard // generated content String endSectionId = null; do { line = fr.readLine(); if (line == null) { throw new EOFException( "Reached end of file while looking " + "for the end of section with ID = \"" + sectionId + "\"!"); } endSectionId = getSectId(line); } while (endSectionId == null); if (!endSectionId.equals(sectionId)) { LOG.error("Mismatch between sectionId (\"" + sectionId + "\") and endSectionId (\"" + endSectionId + "\")!"); } } mAry.remove(sectionId); } fw.write(line); line = fr.readLine(); if (line != null) { fw.write(LINE_SEPARATOR); } } if ((!mAry.isEmpty()) && (outputLostSections)) { fw.write("/* lost code following: " + LINE_SEPARATOR); Set mapEntries = mAry.entrySet(); Iterator itr = mapEntries.iterator(); while (itr.hasNext()) { Map.Entry entry = (Map.Entry) itr.next(); fw.write(indent + "// section " + entry.getKey() + " begin" + LINE_SEPARATOR); fw.write((String) entry.getValue()); fw.write(indent + "// section " + entry.getKey() + " end" + LINE_SEPARATOR); } fw.write("*/"); } fr.close(); fw.close(); } catch (IOException e) { LOG.error("Error: " + e.toString()); } }
0 0 0 0 0
runtime (Lib) Error 3
            
// in src/org/argouml/uml/cognitive/critics/WizBreakCircularComp.java
public void doAction(int oldStep) { LOG.debug("doAction " + oldStep); int choice = -1; ToDoItem item = (ToDoItem) getToDoItem(); ListSet offs = item.getOffenders(); switch (oldStep) { case 1: if (step1 != null) { choice = step1.getSelectedIndex(); } if (choice == -1) { throw new Error("nothing selected, should not get here"); } selectedCls = offs.get(choice); break; //////////////// case 2: if (step2 != null) { choice = step2.getSelectedIndex(); } if (choice == -1) { throw new Error("nothing selected, should not get here"); } Object ae = null; Iterator iter = Model.getFacade().getAssociationEnds(selectedCls).iterator(); for (int n = 0; n <= choice; n++) { ae = iter.next(); } selectedAsc = Model.getFacade().getAssociation(ae); break; //////////////// case 3: if (selectedAsc != null) { List conns = new ArrayList( Model.getFacade().getConnections(selectedAsc)); Object ae0 = conns.get(0); Object ae1 = conns.get(1); try { Model.getCoreHelper().setAggregation1( ae0, Model.getAggregationKind().getNone()); Model.getCoreHelper().setAggregation1( ae1, Model.getAggregationKind().getNone()); } catch (Exception pve) { LOG.error("could not set aggregation", pve); } } break; } }
// in src/org/argouml/uml/cognitive/critics/WizNavigable.java
public void doAction(int oldStep) { LOG.debug("doAction " + oldStep); switch (oldStep) { case 1: int choice = -1; if (step1 != null) { choice = step1.getSelectedIndex(); } if (choice == -1) { throw new Error("nothing selected, should not get here"); } try { Object asc = getModelElement(); Object ae0 = new ArrayList(Model.getFacade().getConnections(asc)).get(0); Object ae1 = new ArrayList(Model.getFacade().getConnections(asc)).get(1); Model.getCoreHelper().setNavigable(ae0, choice == 0 || choice == 2); Model.getCoreHelper().setNavigable(ae1, choice == 1 || choice == 2); } catch (Exception pve) { LOG.error("could not set navigablity", pve); } } }
0 0 0 0 0
checked (Lib) Exception 0 0 0 70
            
// in src/org/argouml/ui/SwingWorker.java
catch (Exception exc) { // TODO: This error needs to be reported! LOG.error("Error while loading project: ", exc); }
// in src/org/argouml/ui/cmd/ShortcutMgr.java
catch (Exception exc) { LOG.error("Exception: " + exc); }
// in src/org/argouml/ui/cmd/GenericArgoMenuBar.java
catch (Exception e) { LOG.error("Error while loading the OSXAdapter:", e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); }
// in src/org/argouml/ui/explorer/ExplorerPopup.java
catch (Exception e) { // just no item added in this case }
// in src/org/argouml/ui/explorer/PerspectiveConfigurator.java
catch (Exception e) { LOG.error("problem adding rule", e); }
// in src/org/argouml/language/ui/LanguageComboBox.java
catch (Exception e) { LOG.error("Unexpected exception", e); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (Exception e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), e); ed.setModal(true); ed.setVisible(true); LOG.error("Got some exception", e); }
// in src/org/argouml/uml/ui/ActionDeleteModelElements.java
catch (Exception e) { // TODO: This catch block needs to be narrower and do something // with the caught exception - tfm 20071120 // Ignore }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (Exception e) { LOG.error("Exception", e); }
// in src/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java
catch (Exception ex) { LOG.error("Exception caught", ex); }
// in src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
catch (Exception ex) { LOG.error(ex); }
// in src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
catch (Exception e) { LOG.error("could not set package due to:" + e + "' at " + encloser, e); }
// in src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
catch (Exception e) { LOG.error("could not set package due to:" + e + "' at " + encloser, e); }
// in src/org/argouml/uml/diagram/state/ui/FigStubState.java
catch (Exception e) { LOG.error("Exception caught and ignored!!", e); }
// in src/org/argouml/uml/diagram/state/StateDiagramGraphModel.java
catch (Exception ex) { LOG.error("buildConnection() failed", ex); }
// in src/org/argouml/uml/generator/ui/ClassGenerationDialog.java
catch (Exception userPressedCancel) { // TODO: How does the pressed cancel become a java.lang.Exception? LOG.info("user pressed cancel"); }
// in src/org/argouml/uml/reveng/ImportCommon.java
catch (Exception e) { problems.append(printToBuffer(e)); }
// in src/org/argouml/uml/reveng/Import.java
catch (Exception e) { // this is because of the (senseless?) "All files" FileFilter theImport.setSelectedSuffixFilter(null); }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (Exception e) { LOG.warn("could not set path ", e); }
// in src/org/argouml/uml/cognitive/critics/WizBreakCircularComp.java
catch (Exception pve) { LOG.error("could not set aggregation", pve); }
// in src/org/argouml/uml/cognitive/critics/WizMEName.java
catch (Exception pve) { LOG.error("could not set name", pve); }
// in src/org/argouml/uml/cognitive/critics/WizAssocComposite.java
catch (Exception pve) { // Someone took our association away. LOG.error("WizAssocComposite: could not set " + "aggregation.", pve); }
// in src/org/argouml/uml/cognitive/critics/WizOperName.java
catch (Exception pve) { LOG.error("could not set stereotype", pve); }
// in src/org/argouml/uml/cognitive/critics/WizNavigable.java
catch (Exception pve) { LOG.error("could not set navigablity", pve); }
// in src/org/argouml/uml/cognitive/critics/WizManyNames.java
catch (Exception pve) { LOG.error("could not set name", pve); }
// in src/org/argouml/profile/internal/ocl/OclInterpreter.java
catch (Exception e) { e.printStackTrace(); throw new InvalidOclException(ocl); }
// in src/org/argouml/profile/internal/ocl/ComputeDesignMaterials.java
catch (Exception e) { LOG.error("Metaclass not found: " + str, e); }
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
catch (Exception e) { throw new InvalidOclException(ocl); }
// in src/org/argouml/application/api/AbstractArgoJPanel.java
catch (Exception ex) { LOG.error("exception in clone()", ex); }
// in src/org/argouml/application/Main.java
catch (Exception ex) { LOG.error("post load no sleep", ex); }
// in src/org/argouml/application/Main.java
catch (Exception ex) { LOG.error("post load no sleep2", ex); }
// in src/org/argouml/cognitive/ToDoList.java
catch (Exception ex) { valid = false; StringBuffer buf = new StringBuffer( "Exception raised in ToDo list cleaning"); buf.append("\n"); buf.append(item.toString()); LOG.error(buf.toString(), ex); }
// in src/org/argouml/cognitive/Designer.java
catch (Exception e) { LOG.error("Critic thread killed by exception", e); }
// in src/org/argouml/cognitive/Agency.java
catch (Exception ex) { LOG.error("Disabling critique due to exception\n" + c + "\n" + dm, ex); c.setEnabled(false); }
// in src/org/argouml/notation/ui/NotationComboBox.java
catch (Exception e) { LOG.error("Unexpected exception", e); }
// in src/org/argouml/notation/NotationNameImpl.java
catch (Exception e) { // TODO: Document why we catch this. LOG.error("Unexpected exception", e); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception ioe) { // TODO: What should we do here? LOG.warn("Configuration not loaded from " + propertyLocation, ioe); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception e) { if (canComplain) { LOG.warn("Unable to save configuration " + file + "\n"); } canComplain = false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception e) { if (canComplain) { LOG.warn("Unable to load configuration " + url + "\n"); } canComplain = false; return false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (Exception e) { result = defaultValue; }
// in src/org/argouml/configuration/ConfigurationFactory.java
catch (Exception e) { Logger.getLogger(ConfigurationFactory.class). warn("Can't create configuration factory " + name + ", using default factory"); }
// in src/org/argouml/util/osdep/StartBrowser.java
catch (Exception cnfe) { LOG.error(cnfe); LOG.info("Trying a default browser (netscape)"); String[] commline = { "netscape", url, }; Runtime.getRuntime().exec(commline); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter could not access the About Menu", ex); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter could not access the About Menu"); ex.printStackTrace(); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods LOG.error("Mac OS X Adapter could not talk to EAWT:"); ex.printStackTrace(); }
// in src/org/argouml/util/osdep/OSXAdapter.java
catch (Exception ex) { LOG.error("OSXAdapter was unable to handle an ApplicationEvent: " + event, ex); }
// in src/org/argouml/util/Tools.java
catch (Exception ex) { sb.append(Translator.localize("label.error-sax-factory")); }
// in src/org/argouml/util/Tools.java
catch (Exception e) { return e.toString(); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { throw new OpenException("Exception caught", e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (Exception e) { // continue with null stream, readDiagram(...) will take care of // it }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception ex) { throw new SAXException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception ex) { // Do nothing. }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { e.printStackTrace(); throw new SaveException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { LOG.error("Exception in startelement", ex); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { throw new SAXException(ex); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/PersistenceManager.java
catch (Exception e) { // If anything goes wrong return the stack // trace as a string so that we get some // useful feedback. e.printStackTrace(new PrintStream(stream)); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception ex) { // Do nothing. }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { LOG.error("Exception in startelement", ex); }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { throw new SAXException(ex); }
19
            
// in src/org/argouml/profile/internal/ocl/OclInterpreter.java
catch (Exception e) { e.printStackTrace(); throw new InvalidOclException(ocl); }
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
catch (Exception e) { throw new InvalidOclException(ocl); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { throw new OpenException("Exception caught", e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception ex) { throw new SAXException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { e.printStackTrace(); throw new SaveException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { throw new SAXException(ex); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { throw new SAXException(ex); }
0
unknown (Lib) ExceptionInInitializerError 0 0 0 2
            
// in src/org/argouml/util/ItemUID.java
catch (ExceptionInInitializerError eiie) { LOG.error("getItemUID for " + obj.getClass() + " exception: ", eiie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (ExceptionInInitializerError eiie) { LOG.error("setItemUID for " + obj.getClass() + " threw", eiie); return null; }
0 0
unknown (Lib) ExpansionException 0 0 4
            
// in src/org/argouml/ocl/OCLEvaluator.java
protected synchronized String evalToString(Object self, String expr) throws ExpansionException { if ("self".equals(expr)) { expr = "self.name"; } vt.clear(); vt.put("self", self); try { return value2String(evaluator.evaluate(vt, modelInterpreter, expr)); } catch (InvalidOclException e) { return "<ocl>invalid expression</ocl>"; } }
// in src/org/argouml/ocl/OCLEvaluator.java
protected synchronized String evalToString( Object self, String expr, String sep) throws ExpansionException { _scratchBindings.put("self", self); java.util.List values = eval(_scratchBindings, expr); _strBuf.setLength(0); Iterator iter = values.iterator(); while (iter.hasNext()) { Object v = value2String(iter.next()); if (!"".equals(v)) { _strBuf.append(v); if (iter.hasNext()) { _strBuf.append(sep); } } } return _strBuf.toString(); }
// in src/org/argouml/ocl/CriticOclEvaluator.java
public synchronized String evalToString(Object self, String expr) throws ExpansionException { return EVALUATOR.evalToString(self, expr); }
// in src/org/argouml/ocl/CriticOclEvaluator.java
public synchronized String evalToString( Object self, String expr, String sep) throws ExpansionException { return EVALUATOR.evalToString(self, expr, sep); }
7
            
// in src/org/argouml/uml/cognitive/checklist/UMLCheckItem.java
catch (ExpansionException e) { // Really ought to have a CriticException to throw here. LOG.error("Failed to evaluate critic expression", e); }
// in src/org/argouml/uml/cognitive/critics/CrUML.java
catch (ExpansionException e) { // Really ought to have a CriticException to throw here. LOG.error("Failed to evaluate critic expression", e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
5
            
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
0
unknown (Lib) FileNotFoundException 0 0 3
            
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
private boolean doSave(File theFile, String suffix, boolean useUI) throws FileNotFoundException, IOException { SaveGraphicsManager sgm = SaveGraphicsManager.getInstance(); SaveGraphicsAction cmd = null; cmd = sgm.getSaveActionBySuffix(suffix); if (cmd == null) { return false; } if (useUI) { updateStatus(Translator.localize( "statusmsg.bar.save-graphics-status-writing", new Object[] {theFile})); } if (theFile.exists() && useUI) { int response = JOptionPane.showConfirmDialog( ArgoFrame.getFrame(), Translator.messageFormat("optionpane.confirm-overwrite", new Object[] {theFile}), Translator.localize("optionpane.confirm-overwrite-title"), JOptionPane.YES_NO_OPTION); if (response != JOptionPane.YES_OPTION) { return false; } } FileOutputStream fo = new FileOutputStream(theFile); cmd.setStream(fo); cmd.setScale(Configuration.getInteger( SaveGraphicsManager.KEY_GRAPHICS_RESOLUTION, 1)); try { cmd.actionPerformed(null); } finally { fo.close(); } if (useUI) { updateStatus(Translator.localize( "statusmsg.bar.save-graphics-status-wrote", new Object[] {theFile})); } return true; }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected File createTempFile(File file) throws FileNotFoundException, IOException { File tempFile = new File(file.getAbsolutePath() + "#"); if (tempFile.exists()) { tempFile.delete(); } if (file.exists()) { copyFile(file, tempFile); } return tempFile; }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected File copyFile(File src, File dest) throws FileNotFoundException, IOException { FileInputStream fis = new FileInputStream(src); FileOutputStream fos = new FileOutputStream(dest); byte[] buf = new byte[1024]; int i = 0; while ((i = fis.read(buf)) != -1) { fos.write(buf, 0, i); } fis.close(); fos.close(); dest.setLastModified(src.lastModified()); return dest; }
9
            
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (FileNotFoundException e) { LOG.error("File not found error when writing.", e); }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
catch ( FileNotFoundException ignore ) { LOG.error("got a FileNotFoundException", ignore); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final FileNotFoundException e) { LOG.error("File not found while copying", e); return false; }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(e); }
6
            
// in src/org/argouml/persistence/XmiFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(e); }
0
checked (Lib) IOException 3
            
// in src/org/argouml/persistence/XmlInputStream.java
private Map readAttributes() throws IOException { Map attributesFound = new HashMap(); int character; while ((character = realRead()) != '>') { if (!Character.isWhitespace((char) character)) { StringBuffer attributeName = new StringBuffer(); attributeName.append((char) character); while ((character = realRead()) != '=' && !Character.isWhitespace((char) character)) { attributeName.append((char) character); } // Skip any whitespace till we should be on an equals sign. while (Character.isWhitespace((char) character)) { character = realRead(); } if (character != '=') { throw new IOException( "Expected = sign after attribute " + attributeName); } // Skip any whitespace till we should be on a quote symbol. int quoteSymbol = realRead(); while (Character.isWhitespace((char) quoteSymbol)) { quoteSymbol = realRead(); } if (quoteSymbol != '"' && quoteSymbol != '\'') { throw new IOException( "Expected \" or ' around attribute value after " + "attribute " + attributeName); } StringBuffer attributeValue = new StringBuffer(); while ((character = realRead()) != quoteSymbol) { attributeValue.append((char) character); } attributesFound.put( attributeName.toString(), attributeValue.toString()); } } return attributesFound; }
// in src/org/argouml/persistence/XmlInputStream.java
private int realRead() throws IOException { int read = super.read(); if (read == -1) { throw new IOException("Tag " + tagName + " not found"); } return read; }
0 47
            
// in src/org/argouml/ui/TransferableModelElements.java
public Object getTransferData(DataFlavor dataFlavor) throws UnsupportedFlavorException, IOException { if (dataFlavor.match(UML_COLLECTION_FLAVOR)) { return theModelElements; } /* * TODO: We could also support other flavors here, * e.g. image (then you can drag modelelements directly into * your wordprocessor, to be inserted as an image). */ throw new UnsupportedFlavorException(dataFlavor); }
// in src/org/argouml/ui/ProjectBrowser.java
public void addFileSaved(File file) throws IOException { // TODO: This should listen for file save events - tfm GenericArgoMenuBar menu = (GenericArgoMenuBar) getJMenuBar(); if (menu != null) { menu.addFileSaved(file.getCanonicalPath()); } }
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
private void saveModel(File destiny, Object model) throws IOException, UmlException { OutputStream stream = new FileOutputStream(destiny); XmiWriter xmiWriter = Model.getXmiWriter(model, stream, ApplicationVersion.getVersion() + "(" + UmlFilePersister.PERSISTENCE_VERSION + ")"); xmiWriter.write(); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
private boolean doSave(File theFile, String suffix, boolean useUI) throws FileNotFoundException, IOException { SaveGraphicsManager sgm = SaveGraphicsManager.getInstance(); SaveGraphicsAction cmd = null; cmd = sgm.getSaveActionBySuffix(suffix); if (cmd == null) { return false; } if (useUI) { updateStatus(Translator.localize( "statusmsg.bar.save-graphics-status-writing", new Object[] {theFile})); } if (theFile.exists() && useUI) { int response = JOptionPane.showConfirmDialog( ArgoFrame.getFrame(), Translator.messageFormat("optionpane.confirm-overwrite", new Object[] {theFile}), Translator.localize("optionpane.confirm-overwrite-title"), JOptionPane.YES_NO_OPTION); if (response != JOptionPane.YES_OPTION) { return false; } } FileOutputStream fo = new FileOutputStream(theFile); cmd.setStream(fo); cmd.setScale(Configuration.getInteger( SaveGraphicsManager.KEY_GRAPHICS_RESOLUTION, 1)); try { cmd.actionPerformed(null); } finally { fo.close(); } if (useUI) { updateStatus(Translator.localize( "statusmsg.bar.save-graphics-status-wrote", new Object[] {theFile})); } return true; }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
private boolean saveGraphicsToFile(File theFile, SaveGraphicsAction cmd) throws IOException { if ( theFile.exists() && !overwrite ) { String message = Translator.messageFormat( "optionpane.confirm-overwrite", new Object[] {theFile}); String title = Translator.localize( "optionpane.confirm-overwrite-title"); //Custom button text: Object[] options = {Translator.localize( "optionpane.confirm-overwrite.overwrite"), // 0 Translator.localize( "optionpane.confirm-overwrite.overwrite-all"), // 1 Translator.localize( "optionpane.confirm-overwrite.skip-this-one"), // 2 Translator.localize( "optionpane.confirm-overwrite.cancel")}; // 3 int response = JOptionPane.showOptionDialog(ArgoFrame.getFrame(), message, title, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, //do not use a custom Icon options, //the titles of buttons options[0]); //default button title if (response == 1) { overwrite = true; } if (response == 2) { return true; } if (response == 3) { return false; } if (response == JOptionPane.CLOSED_OPTION) { return false; } } FileOutputStream fo = null; try { fo = new FileOutputStream( theFile ); cmd.setStream(fo); cmd.setScale(Configuration.getInteger( SaveGraphicsManager.KEY_GRAPHICS_RESOLUTION, 1)); cmd.actionPerformed(null); } finally { if (fo != null) { fo.close(); } } return true; }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
Override protected void saveGraphics(OutputStream s, Editor ce, Rectangle drawingArea) throws IOException { double editorScale = ce.getScale(); int x = (int) (drawingArea.x * editorScale); int y = (int) (drawingArea.y * editorScale); int h = (int) (drawingArea.height * editorScale); int w = (int) (drawingArea.width * editorScale); drawingArea = new Rectangle(x, y, w, h); PostscriptWriter ps = new PostscriptWriter(s, drawingArea); ps.scale(editorScale, editorScale); ce.print(ps); ps.dispose(); }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
Override protected void saveGraphics(OutputStream s, Editor ce, Rectangle drawingArea) throws IOException { Rectangle canvasArea = SaveGraphicsManager.adjustDrawingArea(drawingArea); // Create an image which will do deferred rendering of the GEF // diagram on demand as data is pulled from it RenderedImage i = new DeferredBufferedImage(canvasArea, BufferedImage.TYPE_INT_ARGB, ce, scale); LOG.debug("Created DeferredBufferedImage - drawingArea = " + canvasArea + " , scale = " + scale); ImageIO.write(i, "png", s); }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
Override protected void saveGraphics(OutputStream s, Editor ce, Rectangle drawingArea) throws IOException { Rectangle canvasArea = SaveGraphicsManager.adjustDrawingArea(drawingArea); RenderedImage i = new DeferredBufferedImage(canvasArea, BufferedImage.TYPE_INT_ARGB, ce, scale); // NOTE: GEF's GIF writer uses Jeff Poskanzer's GIF encoder, but that // saves a copy of the entire image in an internal buffer before // starting work, defeating the whole purpose of our incremental // rendering. // Java SE 6 has a native GIF writer, but it's not in Java 5. One // is available in the JAI-ImageIO library, but we don't currently // bundle that and at 6+ MB it seems like a heavyweight solution, but // I don't have time to produce a stripped down version right now - tfm // https://jai-imageio.dev.java.net/ ImageIO.write(i, "gif", s); }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
protected void saveGraphics(OutputStream outStream, Editor ce, Rectangle drawingArea) throws IOException { // LayerPerspective layer = DiagramUtils.getActiveDiagram().getLayer(); Layer layer = ce.getLayerManager().getActiveLayer(); Rectangle bounds = new Rectangle(); for (Fig fig : layer.getContents()) { bounds.x = Math.min(bounds.x, fig.getX()); bounds.y = Math.min(bounds.y, fig.getY()); // we actually are computing max x & max y, not width & height bounds.width = Math.max(bounds.width, fig.getX() + fig.getWidth()); bounds.height = Math.max(bounds.height, fig.getY() + fig.getHeight()); } // Convert max x/y to width/height bounds.width -= bounds.x; bounds.height -= bounds.y; // Get a DOMImplementation DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); // Create an instance of org.w3c.dom.Document Document document = domImpl.createDocument(null, "svg", null); // Create an instance of the SVG Generator SVGGraphics2D svgGenerator = new SVGGraphics2D(document); ce.print(svgGenerator); // for (Fig f : layer.getContents()) { // // ignore clipping // String url = null; // String clazz = null; // Object owner = f.getOwner(); // if (Model.getFacade().isAUMLElement(owner)) { // clazz = Model.getMetaTypes().getName(owner); // // TODO: toLower? // if (Model.getFacade().isAModelElement(owner)) { // String name = Model.getFacade().getName(owner); // if (name == null) { // name = ""; // } // url = "http://argoeclipse.tigris.org" + "#" + name; // } // } //// writer.beginFig(f, clazz, url); // f.paint(writer); // // writer.endFig(); // } // Finally, stream out SVG to the standard output using UTF-8 // character to byte encoding boolean useCSS = true; // we want to use CSS style attribute Writer out = new OutputStreamWriter(outStream, "UTF-8"); svgGenerator.stream(out, useCSS); }
// in src/org/argouml/uml/generator/TempFileUtils.java
private static void traverseDir(File dir, FileAction action) throws IOException { if (dir.exists()) { File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { traverseDir(files[i], action); } else { action.act(files[i]); } } action.act(dir); } }
// in src/org/argouml/uml/generator/TempFileUtils.java
public static Collection<SourceUnit> readAllFiles(File dir) { try { final List<SourceUnit> ret = new ArrayList<SourceUnit>(); final int prefix = dir.getPath().length() + 1; traverseDir(dir, new FileAction() { public void act(File f) throws IOException { // skip backup files. This is actually a workaround for the // cpp generator, which always creates backup files (it's a // bug). if (!f.isDirectory() && !f.getName().endsWith(".bak")) { // TODO: This is using the default platform character // encoding. Specifying an encoding will produce more // predictable results FileReader fr = new FileReader(f); BufferedReader bfr = new BufferedReader(fr); try { StringBuffer result = new StringBuffer((int) f.length()); String line = bfr.readLine(); do { result.append(line); line = bfr.readLine(); if (line != null) { result.append('\n'); } } while (line != null); ret.add(new SourceUnit(f.toString().substring( prefix), result.toString())); } finally { bfr.close(); fr.close(); } } } }); return ret; } catch (IOException ioe) { LOG.error("Exception reading files", ioe); } return null; }
// in src/org/argouml/uml/generator/TempFileUtils.java
public void act(File f) throws IOException { // skip backup files. This is actually a workaround for the // cpp generator, which always creates backup files (it's a // bug). if (!f.isDirectory() && !f.getName().endsWith(".bak")) { // TODO: This is using the default platform character // encoding. Specifying an encoding will produce more // predictable results FileReader fr = new FileReader(f); BufferedReader bfr = new BufferedReader(fr); try { StringBuffer result = new StringBuffer((int) f.length()); String line = bfr.readLine(); do { result.append(line); line = bfr.readLine(); if (line != null) { result.append('\n'); } } while (line != null); ret.add(new SourceUnit(f.toString().substring( prefix), result.toString())); } finally { bfr.close(); fr.close(); } } }
// in src/org/argouml/profile/ZipModelLoader.java
private ZipInputStream openZipStreamAt(URL url, String ext) throws IOException { ZipInputStream zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); while (entry != null && !entry.getName().endsWith(ext)) { entry = zis.getNextEntry(); } return zis; }
// in src/org/argouml/profile/UserDefinedProfile.java
private FigNodeDescriptor loadImage(String stereotype, File f) throws IOException { FigNodeDescriptor descriptor = new FigNodeDescriptor(); descriptor.length = (int) f.length(); descriptor.src = f.getPath(); descriptor.stereotype = stereotype; BufferedInputStream bis = new BufferedInputStream( new FileInputStream(f)); byte[] buf = new byte[descriptor.length]; try { bis.read(buf); } catch (IOException e) { e.printStackTrace(); } descriptor.img = new ImageIcon(buf).getImage(); return descriptor; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyArgo(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, OpenException, UnsupportedEncodingException { int pgmlCount = getPgmlCount(file); boolean containsToDo = containsTodo(file); boolean containsProfile = containsProfile(file); // first read the .argo file from Zip ZipInputStream zis = openZipStreamAt(toURL(file), FileConstants.PROJECT_FILE_EXT); if (zis == null) { throw new OpenException( "There is no .argo file in the .zargo"); } String line; BufferedReader reader = new BufferedReader(new InputStreamReader(zis, encoding)); // Keep reading till we hit the <argo> tag String rootLine; do { rootLine = reader.readLine(); if (rootLine == null) { throw new OpenException( "Can't find an <argo> tag in the argo file"); } } while(!rootLine.startsWith("<argo")); // Get the version from the tag. String version = getVersion(rootLine); writer.println("<uml version=\"" + version + "\">"); writer.println(rootLine); LOG.info("Transfering argo contents"); int memberCount = 0; while ((line = reader.readLine()) != null) { if (line.trim().startsWith("<member")) { ++memberCount; } if (line.trim().equals("</argo>") && memberCount == 0) { LOG.info("Inserting member info"); writer.println("<member type='xmi' name='.xmi' />"); for (int i = 0; i < pgmlCount; ++i) { writer.println("<member type='pgml' name='.pgml' />"); } if (containsToDo) { writer.println("<member type='todo' name='.todo' />"); } if (containsProfile) { String type = ProfileConfiguration.EXTENSION; writer.println("<member type='" + type + "' name='." + type + "' />"); } } writer.println(line); } if (LOG.isInfoEnabled()) { LOG.info("Member count = " + memberCount); } zis.close(); reader.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyXmi(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, UnsupportedEncodingException { ZipInputStream zis = openZipStreamAt(toURL(file), ".xmi"); BufferedReader reader = new BufferedReader( new InputStreamReader(zis, encoding)); // Skip 1 lines reader.readLine(); readerToWriter(reader, writer); zis.close(); reader.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyDiagrams(File file, String encoding, PrintWriter writer) throws IOException { // Loop round loading the diagrams ZipInputStream zis = new ZipInputStream(toURL(file).openStream()); SubInputStream sub = new SubInputStream(zis); ZipEntry currentEntry = null; while ((currentEntry = sub.getNextEntry()) != null) { if (currentEntry.getName().endsWith(".pgml")) { BufferedReader reader = new BufferedReader( new InputStreamReader(sub, encoding)); String firstLine = reader.readLine(); if (firstLine.startsWith("<?xml")) { // Skip the 2 lines //<?xml version="1.0" encoding="UTF-8" ?> //<!DOCTYPE pgml SYSTEM "pgml.dtd"> reader.readLine(); } else { writer.println(firstLine); } readerToWriter(reader, writer); sub.close(); reader.close(); } } zis.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyMember(File file, String tag, String outputEncoding, PrintWriter writer) throws IOException, MalformedURLException, UnsupportedEncodingException { ZipInputStream zis = openZipStreamAt(toURL(file), "." + tag); if (zis != null) { InputStreamReader isr = new InputStreamReader(zis, outputEncoding); BufferedReader reader = new BufferedReader(isr); String firstLine = reader.readLine(); if (firstLine.startsWith("<?xml")) { // Skip the 2 lines //<?xml version="1.0" encoding="UTF-8" ?> //<!DOCTYPE todo SYSTEM "todo.dtd" > reader.readLine(); } else { writer.println(firstLine); } readerToWriter(reader, writer); zis.close(); reader.close(); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void readerToWriter( Reader reader, Writer writer) throws IOException { int ch; while ((ch = reader.read()) != -1) { if (ch == 0xFFFF) { LOG.info("Stripping out 0xFFFF from save file"); } else if (ch == 8) { LOG.info("Stripping out 0x8 from save file"); } else { writer.write(ch); } } }
// in src/org/argouml/persistence/ZargoFilePersister.java
private ZipInputStream openZipStreamAt(URL url, String ext) throws IOException { ZipInputStream zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); while (entry != null && !entry.getName().endsWith(ext)) { entry = zis.getNextEntry(); } if (entry == null) { zis.close(); return null; } return zis; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private InputStream openZipEntry(URL url, String entryName) throws MalformedURLException, IOException { return makeZipEntryUrl(url, entryName).openStream(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public void close() throws IOException { in.closeEntry(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
public ZipEntry getNextEntry() throws IOException { return in.getNextEntry(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private int getPgmlCount(File file) throws IOException { return getEntryNames(file, ".pgml").size(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private boolean containsTodo(File file) throws IOException { return !getEntryNames(file, ".todo").isEmpty(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private boolean containsProfile(File file) throws IOException { return !getEntryNames(file, "." + ProfileConfiguration.EXTENSION) .isEmpty(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private List<String> getEntryNames(File file, String extension) throws IOException, MalformedURLException { ZipInputStream zis = new ZipInputStream(toURL(file).openStream()); List<String> result = new ArrayList<String>(); ZipEntry entry = zis.getNextEntry(); while (entry != null) { String name = entry.getName(); if (extension == null || name.endsWith(extension)) { result.add(name); } entry = zis.getNextEntry(); } zis.close(); return result; }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private void addUserDefinedProfile(String fileName, StringBuffer xmi, ProfileManager profileManager) throws IOException { File profilesDirectory = getProfilesDirectory(profileManager); File profileFile = new File(profilesDirectory, fileName); OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream(profileFile), Argo.getEncoding()); writer.write(xmi.toString()); writer.close(); LOG.info("Wrote user defined profile \"" + profileFile + "\", with size " + xmi.length() + "."); if (isSomeProfileDirectoryConfigured(profileManager)) { profileManager.refreshRegisteredProfiles(); } else { profileManager.addSearchPathDirectory( profilesDirectory.getAbsolutePath()); } }
// in src/org/argouml/persistence/XmiInputStream.java
Override public synchronized int read() throws IOException { if (endFound) { extensionFound = false; parsingExtension = false; endFound = false; readingName = false; tagName = null; endTagName = null; } int ch = super.read(); if (parsingExtension) { stringBuffer.append((char) ch); } // else { // TODO: Only progress when reading standard XMI // extension parsers will continue progression. ++readCount; if (progressMgr != null && readCount == eventSpacing) { try { readCount = 0; progressMgr.nextPhase(); } catch (InterruptedException e) { throw new InterruptedIOException(e); } } // } if (xmiExtensionParser != null) { if (readingName) { if (isNameTerminator((char) ch)) { readingName = false; if (parsingExtension && endTagName == null) { endTagName = "/" + tagName; } else if (tagName.equals("XMI.extension")) { extensionFound = true; } else if (tagName.equals(endTagName)) { endFound = true; xmiExtensionParser.parse(type, stringBuffer.toString()); stringBuffer.delete(0, stringBuffer.length()); } } else { tagName += (char) ch; } } if (extensionFound) { if (ch == '>') { extensionFound = false; callExtensionParser(); } else { attributes += (char) ch; } } if (ch == '<') { readingName = true; tagName = ""; } } return ch; }
// in src/org/argouml/persistence/XmiInputStream.java
Override public synchronized int read(byte[] b, int off, int len) throws IOException { int cnt; for (cnt = 0; cnt < len; ++cnt) { int read = read(); if (read == -1) { break; } b[cnt + off] = (byte) read; } if (cnt > 0) { return cnt; } return -1; }
// in src/org/argouml/persistence/XmiInputStream.java
Override public void close() throws IOException { }
// in src/org/argouml/persistence/XmiInputStream.java
public void realClose() throws IOException { super.close(); }
// in src/org/argouml/persistence/ZipFilePersister.java
private ZipInputStream openZipStreamAt(URL url, String ext) throws IOException { ZipInputStream zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); while (entry != null && !entry.getName().endsWith(ext)) { entry = zis.getNextEntry(); } return zis; }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void write(byte[] b, int off, int len) throws IOException { if ((off | len | (b.length - (len + off)) | (off + len)) < 0) { throw new IndexOutOfBoundsException(); } if (headerProcessed) { out.write(b, off, len); } else { // TODO: Make this more efficient for large I/Os for (int i = 0; i < len; i++) { write(b[off + i]); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void write(int b) throws IOException { if (headerProcessed) { out.write(b); } else { outBB.put((byte) b); inBB.limit(outBB.position()); // Convert from bytes back to characters CoderResult result = decoder.decode(inBB, outCB, false); if (result.isError()) { throw new RuntimeException( "Unknown character decoding error"); } // This will have problems if the smallest possible // data segment is smaller than the size of the buffer // needed for regex matching if (outCB.position() == outCB.limit()) { processHeader(); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
private void processHeader() throws IOException { headerProcessed = true; outCB.position(0); // rewind our character buffer Matcher matcher = xmlDeclarationPattern.matcher(outCB); // Remove anything that matches our pattern String headerRemainder = matcher.replaceAll(""); int index = headerRemainder.length() - 1; if (headerRemainder.charAt(index) == '\0') { // Remove null characters at the end do { index--; } while (index >= 0 && headerRemainder.charAt(index) == '\0'); headerRemainder = headerRemainder.substring(0, index + 1); } // Reencode the remaining characters as bytes again ByteBuffer bb = decoder.charset().encode(headerRemainder); // and write them to our output stream byte[] outBytes = new byte[bb.limit()]; bb.get(outBytes); out.write(outBytes, 0, outBytes.length); // Write any left over bytes in the input buffer // (perhaps from a partially decoded character) if (inBB.remaining() > 0) { out.write(inBB.array(), inBB.position(), inBB.remaining()); inBB.position(0); inBB.limit(0); } }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void close() throws IOException { flush(); }
// in src/org/argouml/persistence/UmlFilePersister.java
public void reallyClose() throws IOException { out.close(); }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void flush() throws IOException { if (!headerProcessed) { processHeader(); } out.flush(); }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected File createTempFile(File file) throws FileNotFoundException, IOException { File tempFile = new File(file.getAbsolutePath() + "#"); if (tempFile.exists()) { tempFile.delete(); } if (file.exists()) { copyFile(file, tempFile); } return tempFile; }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected File copyFile(File src, File dest) throws FileNotFoundException, IOException { FileInputStream fis = new FileInputStream(src); FileOutputStream fos = new FileOutputStream(dest); byte[] buf = new byte[1024]; int i = 0; while ((i = fis.read(buf)) != -1) { fos.write(buf, 0, i); } fis.close(); fos.close(); dest.setLastModified(src.lastModified()); return dest; }
// in src/org/argouml/persistence/XmlInputStream.java
public synchronized int read() throws IOException { if (!xmlStarted) { skipToTag(); xmlStarted = true; } if (endStream) { return -1; } int ch = super.read(); endStream = isLastTag(ch); return ch; }
// in src/org/argouml/persistence/XmlInputStream.java
public synchronized int read(byte[] b, int off, int len) throws IOException { if (!xmlStarted) { skipToTag(); xmlStarted = true; } if (endStream) { return -1; } int cnt; for (cnt = 0; cnt < len; ++cnt) { int read = read(); if (read == -1) { break; } b[cnt + off] = (byte) read; } if (cnt > 0) { return cnt; } return -1; }
// in src/org/argouml/persistence/XmlInputStream.java
private void skipToTag() throws IOException { char[] searchChars = tagName.toCharArray(); int i; boolean found; while (true) { if (!childOnly) { mark(1000); } // Keep reading till we get the left bracket of an opening tag while (realRead() != '<') { if (!childOnly) { mark(1000); } } found = true; // Compare each following character to see // that it matches the tag we want for (i = 0; i < tagName.length(); ++i) { int c = realRead(); if (c != searchChars[i]) { found = false; break; } } int terminator = realRead(); // We also want to match with the right bracket of the tag or // some other terminator if (found && !isNameTerminator((char) terminator)) { found = false; } if (found) { // We've found the matching tag but do we have // the correct instance with matching attributes? if (attributes != null) { Map attributesFound = new HashMap(); if (terminator != '>') { attributesFound = readAttributes(); } // Search all attributes found to those expected. // If any don't match then turn off the found flag // so that we search for the next matching tag. Iterator it = attributes.entrySet().iterator(); while (found && it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); if (!pair.getValue().equals( attributesFound.get(pair.getKey()))) { found = false; } } } } if (found) { if (instanceCount < 0) { found = false; ++instanceCount; } } if (found) { if (childOnly) { // Read the name of the child tag // and then reset read position // back to that child tag. mark(1000); while (realRead() != '<') { /* do nothing */ } tagName = ""; char ch = (char) realRead(); while (!isNameTerminator(ch)) { tagName += ch; ch = (char) realRead(); } endTagName = "/" + tagName; LOG.info("Start tag = " + tagName); LOG.info("End tag = " + endTagName); } reset(); return; } } }
// in src/org/argouml/persistence/XmlInputStream.java
private Map readAttributes() throws IOException { Map attributesFound = new HashMap(); int character; while ((character = realRead()) != '>') { if (!Character.isWhitespace((char) character)) { StringBuffer attributeName = new StringBuffer(); attributeName.append((char) character); while ((character = realRead()) != '=' && !Character.isWhitespace((char) character)) { attributeName.append((char) character); } // Skip any whitespace till we should be on an equals sign. while (Character.isWhitespace((char) character)) { character = realRead(); } if (character != '=') { throw new IOException( "Expected = sign after attribute " + attributeName); } // Skip any whitespace till we should be on a quote symbol. int quoteSymbol = realRead(); while (Character.isWhitespace((char) quoteSymbol)) { quoteSymbol = realRead(); } if (quoteSymbol != '"' && quoteSymbol != '\'') { throw new IOException( "Expected \" or ' around attribute value after " + "attribute " + attributeName); } StringBuffer attributeValue = new StringBuffer(); while ((character = realRead()) != quoteSymbol) { attributeValue.append((char) character); } attributesFound.put( attributeName.toString(), attributeValue.toString()); } } return attributesFound; }
// in src/org/argouml/persistence/XmlInputStream.java
public void close() throws IOException { }
// in src/org/argouml/persistence/XmlInputStream.java
public void realClose() throws IOException { super.close(); }
// in src/org/argouml/persistence/XmlInputStream.java
private int realRead() throws IOException { int read = super.read(); if (read == -1) { throw new IOException("Tag " + tagName + " not found"); } return read; }
71
            
// in src/org/argouml/ui/LoadSwingWorker.java
catch (IOException exc) { LOG.error("Failed to save file: " + file + " in most recently used list"); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IOException ioExc) { return true; }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IOException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (IOException e) { LOG.debug(e); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (IOException io) { LOG.debug("drop IOException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
catch (IOException e) { LOG.error("Exception", e); }
// in src/org/argouml/ui/HelpBox.java
catch ( IOException e) { LOG.warn("Attempted to read a bad URL: " + paneURL); }
// in src/org/argouml/ui/HelpBox.java
catch (IOException ioe) { LOG.warn( "Could not fetch requested URL"); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IOException ioe) { LOG.error("Cannot open Jar file " + file, ioe); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IOException e) { LOG.error("Unable to open " + file, e); return; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IOException e) { LOG.error("Unable to read manifest of " + file, e); return; }
// in src/org/argouml/uml/ui/ActionCopy.java
catch (IOException ignorable) { }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (IOException e) { LOG.error("IO error when writing.", e); }
// in src/org/argouml/uml/ui/ActionPaste.java
catch (IOException ignorable) { }
// in src/org/argouml/uml/ui/ActionCut.java
catch (IOException ignorable) { }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
catch ( IOException ignore ) { LOG.error("got an IOException", ignore); }
// in src/org/argouml/uml/ui/TabConstraints.java
catch (IOException ioe) { // Ignored: Highly unlikely, and what would we // do anyway? log it LOG.error("problem parsing And Checking Constraints", ioe); return; }
// in src/org/argouml/uml/ui/SaveGraphicsManager.java
catch (java.io.IOException e) { LOG.error("Error while exporting Graphics:", e); }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (IOException e) { LOG.error("Exception caught", e); }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Error while creating a temporary directory", ioe); return null; }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Exception reading files", ioe); }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Exception deleting directory", ioe); }
// in src/org/argouml/uml/generator/TempFileUtils.java
catch (IOException ioe) { LOG.error("Exception reading file names", ioe); }
// in src/org/argouml/uml/generator/AbstractSection.java
catch (IOException e) { LOG.error("Error: " + e.toString()); }
// in src/org/argouml/uml/generator/AbstractSection.java
catch (IOException e) { LOG.error("Error: " + e.toString()); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (IOException e) { LOG.error("Error loading FigNode", e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (IOException e) { e.printStackTrace(); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (IOException ioe) { LOG.debug("Cannot open Jar file " + file, ioe); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (IOException e) { LOG.error("Exception", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); }
// in src/org/argouml/application/Main.java
catch (IOException io) { io.printStackTrace(); System.exit(-1); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final IOException e) { LOG.error("IO error copying file", e); return false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (IOException e) { LOG.error("Could not create the properties file at: " + file.getAbsolutePath(), e); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final IOException e) { if (canComplain) { LOG.warn("Unable to load configuration " + file); } canComplain = false; }
// in src/org/argouml/util/osdep/StartBrowser.java
catch (IOException ioe) { // Didn't work. LOG.error(ioe); }
// in src/org/argouml/util/Tools.java
catch (IOException ioe) { }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException ex) { }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException ex) { }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (IOException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException ex) { LOG.error("Failed to close save output writer", ex); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException ex) { throw new OpenException(ex); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException ex) { LOG.error("Failed to close save output writer", ex); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException ex) { // If we get a 2nd error, just ignore it }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException ex) { LOG.error("Failed to close save output writer", ex); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { // ignore }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { // No more we can do here on failure }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { // ignore }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { // No more we can do here on failure }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new OpenException("I/O error on stream close", e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
26
            
// in src/org/argouml/profile/ZipModelLoader.java
catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (IOException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException ex) { throw new OpenException(ex); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new OpenException("I/O error on stream close", e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
0
unknown (Lib) IllegalAccessException 0 0 1
            
// in src/org/argouml/util/osdep/OSXAdapter.java
public boolean callTarget(Object appleEvent) throws InvocationTargetException, IllegalAccessException { Object result = targetMethod.invoke(targetObject, (Object[])null); if (result == null) { return true; } return Boolean.valueOf(result.toString()).booleanValue(); }
17
            
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (IllegalAccessException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (IllegalAccessException e) { LOG.error(e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IllegalAccessException e) { LOG.error("Exception", e); }
// in src/org/argouml/ui/explorer/PerspectiveManager.java
catch (IllegalAccessException e) { LOG.error( "could not create rule " + ruleName + " you can try to " + "refresh the perspectives to the " + "default settings.", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IllegalAccessException e) { LOG.error("The constructor for class " + classname + " is not accessible.", e); return false; }
// in src/org/argouml/uml/ui/TabStyle.java
catch (IllegalAccessException ignore) { LOG.error(ignore); return null; }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (IllegalAccessException e) { LOG.error("Exception", e); }
// in src/org/argouml/application/Main.java
catch (IllegalAccessException e) { System.out.println(commandName + " could not be instantiated - skipping" + " (IllegalAccessException)"); continue; }
// in src/org/argouml/cognitive/Critic.java
catch (IllegalAccessException illEx) { LOG.error("Could not access wizard: ", illEx); }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.IllegalAccessException e) { LOG.error("Error instancating cr " + crClassName, e); return; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (IllegalAccessException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalAccessException iace) { // Apparently it had a setItemUID, // but we're not allowed to call it return null; }
// in src/org/argouml/util/KeyEventUtils.java
catch (IllegalAccessException e) { }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (IllegalAccessException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/AbstractFilePersister.java
catch (IllegalAccessException e) { LOG.error("Exception instantiating file persister " + clazz, e); return null; }
1
            
// in src/org/argouml/persistence/PGMLStackParser.java
catch (IllegalAccessException e) { throw new SAXException(e); }
0
runtime (Lib) IllegalArgumentException 129
            
// in src/org/argouml/ui/CheckboxTableModel.java
public Object getValueAt(int row, int col) { if (row < elements.length && col < 3) { return elements[row][col]; } else { throw new IllegalArgumentException("Index out of bounds"); } }
// in src/org/argouml/ui/StylePanelFig.java
protected Rectangle parseBBox() { Fig target = getPanelTarget(); // Get the text in the field, and don't do anything if the // field is // empty. String bboxStr = bboxField.getText().trim(); if (bboxStr.length() == 0) { return null; } // Parse the string as if // possible Rectangle res = new Rectangle(); java.util.StringTokenizer st = new java.util.StringTokenizer(bboxStr, ", "); try { boolean changed = false; if (!st.hasMoreTokens()) { return target.getBounds(); } res.x = Integer.parseInt(st.nextToken()); if (!st.hasMoreTokens()) { res.y = target.getBounds().y; res.width = target.getBounds().width; res.height = target.getBounds().height; return res; } res.y = Integer.parseInt(st.nextToken()); if (!st.hasMoreTokens()) { res.width = target.getBounds().width; res.height = target.getBounds().height; return res; } res.width = Integer.parseInt(st.nextToken()); // TODO: What does the magic number 6000 represent here? // Put it in an explanatory literal! - tfm - 20071205 if ((res.width + res.x) > 6000) { res.width = 6000 - res.x; changed = true; } if (!st.hasMoreTokens()) { res.width = target.getBounds().width; return res; } res.height = Integer.parseInt(st.nextToken()); // TODO: What does the magic number 6000 represent here? // Put it in an explanatory literal! - tfm - 20071205 if ((res.height + res.y) > 6000) { res.height = 6000 - res.y; changed = true; } if (res.x < 0 || res.y < 0) { // TODO: This exception will be thrown during autoscrolling // when the edge of the canvas is reached causing either // the width or height to be "adjusted" to a negative value LOG.warn("Part of bounding box is off screen " + res); } if (res.width < 0 || res.height < 0) { // TODO: This exception will be thrown during autoscrolling // when the edge of the canvas is reached causing either // the width or height to be "adjusted" to a negative value throw new IllegalArgumentException( "Bounding box has negative size " + res); } if (changed) { StringBuffer sb = new StringBuffer(); sb.append(Integer.toString(res.x)); sb.append(","); sb.append(Integer.toString(res.y)); sb.append(","); sb.append(Integer.toString(res.width)); sb.append(","); sb.append(Integer.toString(res.height)); bboxField.setText(sb.toString()); } } catch (NumberFormatException ex) { bboxField.setBackground(Color.RED); return null; } catch (IllegalArgumentException iae) { bboxField.setBackground(Color.RED); return null; } bboxField.setBackground(null); return res; }
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
private List<Object> reorderChildren(ExplorerTreeNode node) { List<Object> childUserObjects = new ArrayList<Object>(); List<ExplorerTreeNode> reordered = new ArrayList<ExplorerTreeNode>(); // Enumerate the current children of node to find out which now sorts // in different order, since these must be moved Enumeration enChld = node.children(); Object lastObj = null; while (enChld.hasMoreElements()) { Object child = enChld.nextElement(); if (child instanceof ExplorerTreeNode) { Object obj = ((ExplorerTreeNode) child).getUserObject(); if (lastObj != null && order.compare(lastObj, obj) > 0) { /* * If a node to be moved is currently selected, * move its predecessors instead so don't lose selection. * This fixes issue 3249. * NOTE: this does not deal with the case where * multiple nodes are selected and they are out * of order with respect to each other, but I * don't think more than one node is ever reordered * at a time - tfm */ if (!tree.isPathSelected(new TreePath( getPathToRoot((ExplorerTreeNode) child)))) { reordered.add((ExplorerTreeNode) child); } else { ExplorerTreeNode prev = (ExplorerTreeNode) ((ExplorerTreeNode) child) .getPreviousSibling(); while (prev != null && (order.compare(prev.getUserObject(), obj) >= 0)) { reordered.add(prev); childUserObjects.remove(childUserObjects.size() - 1); prev = (ExplorerTreeNode) prev.getPreviousSibling(); } childUserObjects.add(obj); lastObj = obj; } } else { childUserObjects.add(obj); lastObj = obj; } } else { throw new IllegalArgumentException( "Incomprehencible child node " + child.toString()); } } for (ExplorerTreeNode child : reordered) { // Avoid our deinitialization here // The node will be added back to the tree again super.removeNodeFromParent(child); } // For each reordered node, find it's new position among the current // children and move it there for (ExplorerTreeNode child : reordered) { Object obj = child.getUserObject(); int ip = Collections.binarySearch(childUserObjects, obj, order); if (ip < 0) { ip = -(ip + 1); } // Avoid our initialization here super.insertNodeInto(child, node, ip); childUserObjects.add(ip, obj); } return childUserObjects; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
private String getDescriptionInternal(String name) { Map.Entry<ModuleInterface, ModuleStatus> entry = findModule(name); if (entry == null) { throw new IllegalArgumentException("Module does not exist."); } ModuleInterface module = entry.getKey(); StringBuffer sb = new StringBuffer(); String desc = module.getInfo(ModuleInterface.DESCRIPTION); if (desc != null) { sb.append(desc); sb.append("\n\n"); } String author = module.getInfo(ModuleInterface.AUTHOR); if (author != null) { sb.append("Author: ").append(author); sb.append("\n"); } String version = module.getInfo(ModuleInterface.VERSION); if (version != null) { sb.append("Version: ").append(version); sb.append("\n"); } return sb.toString(); }
// in src/org/argouml/ocl/OCLUtil.java
public static Object getInnerMostEnclosingNamespace (Object me) { if (Model.getFacade().isAFeature(me)) { me = Model.getFacade().getOwner(me); } if (!Model.getFacade().isANamespace(me)) { throw new IllegalArgumentException(); } return me; }
// in src/org/argouml/uml/ui/TabTaggedValuesModel.java
public void setTarget(Object t) { if (LOG.isDebugEnabled()) { LOG.debug("Set target to " + t); } if (t != null && !Model.getFacade().isAModelElement(t)) { throw new IllegalArgumentException(); } if (target != t) { if (target != null) { Model.getPump().removeModelEventListener(this, target); } target = t; if (t != null) { Model.getPump().addModelEventListener(this, t, new String[] {"taggedValue", "referenceTag"}); } } // always fire changes in the case something has changed in the // composition of the taggedValues collection. fireTableDataChanged(); }
// in src/org/argouml/uml/ui/TabTaggedValuesModel.java
public Object getValueAt(int row, int col) { Collection tvs = Model.getFacade().getTaggedValuesCollection(target); if (row > tvs.size() || col > 1) { throw new IllegalArgumentException(); } // If the row is past the end of our current collection, // return an empty string so they can add a new value if (row == tvs.size()) { return ""; } Object[] tva = tvs.toArray(); Object tv = tva[row]; if (col == 0) { Object n = Model.getFacade().getTagDefinition(tv); if (n == null) { return ""; } return n; } if (col == 1) { if (Model.getFacade().getUmlVersion().charAt(0) == '1') { String be = Model.getFacade().getValueOfTag(tv); if (be == null) { return ""; } return be; } else { Object value = Model.getFacade().getValueOfTag(target, tv); if (value instanceof Collection) { // handle multivalued tagged value int n = -1; for (int i = 0; i <= row; i++) { if (tva[i] == tv) { n++; } } if (n != -1) { value = ((Collection) value).toArray()[n]; } else { value = ""; } } return value.toString(); } } return "TV-" + row * 2 + col; // for debugging }
// in src/org/argouml/uml/ui/PropPanel.java
public JLabel addFieldAfter(String label, Component component, Component afterComponent) { int nComponent = getComponentCount(); for (int i = 0; i < nComponent; ++i) { if (getComponent(i) == afterComponent) { JLabel jlabel = createLabelFor(label, component); component.setFont(stdFont); add(jlabel, ++i); add(component, ++i); return jlabel; } } throw new IllegalArgumentException("Component not found"); }
// in src/org/argouml/uml/ui/PropPanel.java
public JLabel addFieldBefore(String label, Component component, Component beforeComponent) { int nComponent = getComponentCount(); for (int i = 0; i < nComponent; ++i) { if (getComponent(i) == beforeComponent) { JLabel jlabel = createLabelFor(label, component); component.setFont(stdFont); add(jlabel, i - 1); add(component, i++); return jlabel; } } throw new IllegalArgumentException("Component not found"); }
// in src/org/argouml/uml/ui/ActionClassDiagram.java
Override public ArgoDiagram createDiagram(Object ns, DiagramSettings settings) { if (isValidNamespace(ns)) { return DiagramFactory.getInstance().create( DiagramFactory.DiagramType.Class, ns, settings); } LOG.error("No namespace as argument"); LOG.error(ns); throw new IllegalArgumentException( "The argument " + ns + "is not a namespace."); }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
protected void setElements(Collection elements) { if (elements != null) { ArrayList toBeRemoved = new ArrayList(); for (Object o : objects) { if (!elements.contains(o) && !(isClearable // Check against "" is needed for backward // compatibility. Don't remove without // checking subclasses and warning downstream // developers - tfm - 20081211 && ("".equals(o) || CLEARED.equals(o)))) { toBeRemoved.add(o); } } removeAll(toBeRemoved); addAll(elements); if (isClearable && !elements.contains(CLEARED)) { addElement(CLEARED); } if (!objects.contains(selectedObject)) { selectedObject = null; } } else { throw new IllegalArgumentException("In setElements: may not set " + "elements to null collection"); } }
// in src/org/argouml/uml/ui/ActionDeploymentDiagram.java
public ArgoDiagram createDiagram(Object namespace) { // a deployment diagram shows something about the whole model // according to the UML spec, but we rely on the caller to enforce // that if desired. if (!Model.getFacade().isANamespace(namespace)) { LOG.error("No namespace as argument"); LOG.error(namespace); throw new IllegalArgumentException( "The argument " + namespace + "is not a namespace."); } return DiagramFactory.getInstance().createDiagram( DiagramFactory.DiagramType.Deployment, namespace, null); }
// in src/org/argouml/uml/ui/ActionDeploymentDiagram.java
public boolean isValidNamespace(Object namespace) { // a deployment diagram shows something about the whole model // according to the uml spec if (!Model.getFacade().isANamespace(namespace)) { LOG.error("No namespace as argument"); LOG.error(namespace); throw new IllegalArgumentException( "The argument " + namespace + "is not a namespace."); } // may only occur as child of the model or in a package if (Model.getFacade().isAPackage(namespace)) { return true; } return false; }
// in src/org/argouml/uml/ui/behavior/common_behavior/ActionNewReception.java
public void actionPerformed(ActionEvent e) { super.actionPerformed(e); Object classifier = TargetManager.getInstance().getModelTarget(); if (!Model.getFacade().isAClassifier(classifier)) { throw new IllegalArgumentException( "Argument classifier is null or not a classifier. Got: " + classifier); } Object reception = Model.getCommonBehaviorFactory().buildReception(classifier); TargetManager.getInstance().setTarget(reception); }
// in src/org/argouml/uml/ui/TabConstraints.java
public void setName( final String sName, final EditingUtilities euHelper) { if (theMMcConstraint != null) { // Check name for consistency with spec if (!euHelper.isValidConstraintName(sName)) { throw new IllegalArgumentException( "Please specify a valid name."); } // Set name Object mcOld = Model.getCoreFactory().createConstraint(); Model.getCoreHelper().setName(mcOld, Model.getFacade().getName(theMMcConstraint)); Object constraintBody = Model.getFacade().getBody(theMMcConstraint); Model.getCoreHelper().setBody(mcOld, Model.getDataTypesFactory() .createBooleanExpression( "OCL", (String) Model.getFacade().getBody( constraintBody))); Model.getCoreHelper().setName(theMMcConstraint, sName); fireConstraintNameChanged(theMNIdx, mcOld, theMMcConstraint); // Also set name in constraint body -- Added 03/14/2001 try { OclTree tree = null; Object mmeContext = OCLUtil .getInnerMostEnclosingNamespace(theMMmeiTarget); constraintBody = Model.getFacade().getBody(theMMcConstraint); tree = euHelper.parseAndCheckConstraint( (String) Model.getFacade().getBody( constraintBody), new ArgoFacade(mmeContext)); if (tree != null) { tree.apply(new DepthFirstAdapter() { private int nameID = 0; public void caseAConstraintBody( AConstraintBody node) { // replace name if (nameID == 0) { node.setName(new TName(sName)); } else { node.setName(new TName( sName + "_" + nameID)); } nameID++; } }); setData(tree.getExpression(), euHelper); } } catch (Throwable t) { // OK, so that didn't work out... Just ignore // any problems and don't set the name in the // constraint body better had log it. LOG.error("some unidentified problem", t); } }
// in src/org/argouml/uml/ui/ActionUseCaseDiagram.java
Override public ArgoDiagram createDiagram(Object namespace, DiagramSettings settings) { if (!Model.getFacade().isANamespace(namespace)) { LOG.error("No namespace as argument"); LOG.error(namespace); throw new IllegalArgumentException( "The argument " + namespace + "is not a namespace."); } return DiagramFactory.getInstance().create( DiagramFactory.DiagramType.UseCase, namespace, settings); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
public void setVisible(boolean visible) { if (!visible && !invisibleAllowed) { throw new IllegalArgumentException( "Visibility of a FigNode should never be false"); } }
// in src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java
private void constructFigs(FigClassAssociationClass classBoxFig, Fig ownerFig) { LOG.info("FigEdgeAssociationClass constructor"); if (classBoxFig == null) { throw new IllegalArgumentException("No class box found while " + "creating FigEdgeAssociationClass"); } if (ownerFig == null) { throw new IllegalArgumentException("No association edge found " + "while creating FigEdgeAssociationClass"); } setDestFigNode(classBoxFig); setDestPortFig(classBoxFig); final FigNode port; if (ownerFig instanceof FigEdgeModelElement) { ((FigEdgeModelElement) ownerFig).makeEdgePort(); port = ((FigEdgeModelElement) ownerFig).getEdgePort(); } else { port = (FigNode) ownerFig; } setSourcePortFig(port); setSourceFigNode(port); computeRoute(); }
// in src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java
Override public void setDestFigNode(FigNode fn) { if (!(fn instanceof FigClassAssociationClass)) { throw new IllegalArgumentException( "The dest of an association class dashed link can " + "only be a FigClassAssociationClass"); } super.setDestFigNode(fn); }
// in src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java
Override public void setSourceFigNode(FigNode fn) { if (!(fn instanceof FigEdgePort || fn instanceof FigNodeAssociation)) { throw new IllegalArgumentException( "The source of an association class dashed link can " + "only be a FigEdgePort"); } super.setSourceFigNode(fn); }
// in src/org/argouml/uml/diagram/ui/FigCompartment.java
Override public void addFig(Fig fig) { if (fig != getBigPort() && !(fig instanceof CompartmentFigText) && !(fig instanceof FigSeparator)) { LOG.error("Illegal Fig added to a FigEditableCompartment"); throw new IllegalArgumentException( "A FigEditableCompartment can only " + "contain CompartmentFigTexts, " + "received a " + fig.getClass().getName()); } super.addFig(fig); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private void initOwner(Object element) { if (element != null) { if (!Model.getFacade().isAUMLElement(element)) { throw new IllegalArgumentException( "The owner must be a model element - got a " + element.getClass().getName()); } super.setOwner(element); if (edgePort != null) { edgePort.setOwner(getOwner()); } if (Model.getFacade().isANamedElement(element)) { NotationName nn = Notation.findNotation( settings.getNotationSettings().getNotationLanguage()); notationProviderName = NotationProviderFactory2.getInstance().getNotationProvider( getNotationProviderType(), element, this, nn); } addElementListener(element, "remove"); } }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private Fig getNoEdgePresentationFor(Object element) { if (element == null) { throw new IllegalArgumentException("Can't search for a null owner"); } List contents = PgmlUtility.getContentsNoEdges(getLayer()); int figCount = contents.size(); for (int figIndex = 0; figIndex < figCount; ++figIndex) { Fig fig = (Fig) contents.get(figIndex); if (fig.getOwner() == element) { return fig; } } throw new IllegalStateException("Can't find a FigNode representing " + Model.getFacade().getName(element)); }
// in src/org/argouml/uml/diagram/DiagramSettings.java
public void setDefaultStereotypeView(final int newView) { StereotypeStyle sv = StereotypeStyle.getEnum(newView); if (sv == null) { throw new IllegalArgumentException("Bad argument " + newView); } setDefaultStereotypeView(sv); }
// in src/org/argouml/uml/diagram/DiagramFactory.java
private ArgoDiagram createInternal(final DiagramType type, final Object namespace, final Object machine, DiagramSettings settings) { final ArgoDiagram diagram; if (settings == null) { throw new IllegalArgumentException( "DiagramSettings may not be null"); } Object factory = factories.get(type); if (factory != null) { Object owner; if (machine != null) { owner = machine; } else { owner = namespace; } if (factory instanceof DiagramFactoryInterface2) { diagram = ((DiagramFactoryInterface2) factory).createDiagram( owner, (String) null, settings); } else if (factory instanceof DiagramFactoryInterface) { diagram = ((DiagramFactoryInterface) factory).createDiagram( namespace, machine); diagram.setDiagramSettings(settings); } else { // This shouldn't be possible, but just in case throw new IllegalStateException( "Unknown factory type registered"); } } else { if ((type == DiagramType.State || type == DiagramType.Activity) && machine == null) { diagram = createDiagram(diagramClasses.get(type), null, namespace); } else { diagram = createDiagram(diagramClasses.get(type), namespace, machine); } diagram.setDiagramSettings(settings); } return diagram; }
// in src/org/argouml/uml/diagram/DiagramFactory.java
Deprecated private ArgoDiagram createDiagram(Class type, Object namespace, Object machine) { ArgoDiagram diagram = null; Class diType = null; // TODO: Convert all to use standard factory registration if (type == UMLClassDiagram.class) { diagram = new UMLClassDiagram(namespace); diType = ClassDiagram.class; } else if (type == UMLUseCaseDiagram.class) { diagram = new UMLUseCaseDiagram(namespace); diType = UseCaseDiagram.class; } else if (type == UMLStateDiagram.class) { diagram = new UMLStateDiagram(namespace, machine); diType = StateDiagram.class; } else if (type == UMLDeploymentDiagram.class) { diagram = new UMLDeploymentDiagram(namespace); diType = DeploymentDiagram.class; } else if (type == UMLCollaborationDiagram.class) { diagram = new UMLCollaborationDiagram(namespace); diType = CollaborationDiagram.class; } else if (type == UMLActivityDiagram.class) { diagram = new UMLActivityDiagram(namespace, machine); diType = ActivityDiagram.class; } if (diagram == null) { throw new IllegalArgumentException ("Unknown diagram type"); } if (Model.getDiagramInterchangeModel() != null) { // TODO: This is never executed as Ludos DI work was never // finished. diagram.getGraphModel().addGraphEventListener( GraphChangeAdapter.getInstance()); /* * The diagram are always owned by the model * in this first implementation. */ DiDiagram dd = GraphChangeAdapter.getInstance() .createDiagram(diType, namespace); ((UMLMutableGraphSupport) diagram.getGraphModel()).setDiDiagram(dd); } return diagram; }
// in src/org/argouml/uml/diagram/deployment/ui/UMLDeploymentDiagram.java
public void setNamespace(Object handle) { if (!Model.getFacade().isANamespace(handle)) { LOG.error( "Illegal argument. Object " + handle + " is not a namespace"); throw new IllegalArgumentException( "Illegal argument. Object " + handle + " is not a namespace"); } Object m = handle; boolean init = (null == getNamespace()); super.setNamespace(m); DeploymentDiagramGraphModel gm = createGraphModel(); gm.setHomeModel(m); if (init) { LayerPerspective lay = new LayerPerspectiveMutable(Model.getFacade().getName(m), gm); DeploymentDiagramRenderer rend = new DeploymentDiagramRenderer(); lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); } }
// in src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java
public void setNamespace(Object ns) { if (!Model.getFacade().isANamespace(ns)) { LOG.error("Illegal argument. " + "Object " + ns + " is not a namespace"); throw new IllegalArgumentException("Illegal argument. " + "Object " + ns + " is not a namespace"); } boolean init = (null == getNamespace()); super.setNamespace(ns); ClassDiagramGraphModel gm = (ClassDiagramGraphModel) getGraphModel(); gm.setHomeModel(ns); if (init) { LayerPerspective lay = new LayerPerspectiveMutable(Model.getFacade().getName(ns), gm); ClassDiagramRenderer rend = new ClassDiagramRenderer(); // singleton lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); } }
// in src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java
public FigNode getFigNodeFor(GraphModel gm, Layer lay, Object node, Map styleAttributes) { FigNodeModelElement figNode = null; if (node == null) { throw new IllegalArgumentException("A node must be supplied"); } // Although not generally true for GEF, for Argo we know that the layer // is a LayerPerspective which knows the associated diagram Diagram diag = ((LayerPerspective) lay).getDiagram(); if (diag instanceof UMLDiagram && ((UMLDiagram) diag).doesAccept(node)) { figNode = (FigNodeModelElement) ((UMLDiagram) diag) .drop(node, null); } else { LOG.error("TODO: ClassDiagramRenderer getFigNodeFor " + node); throw new IllegalArgumentException( "Node is not a recognised type. Received " + node.getClass().getName()); } lay.add(figNode); figNode.setDiElement( GraphChangeAdapter.getInstance().createElement(gm, node)); return figNode; }
// in src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java
public FigEdge getFigEdgeFor(GraphModel gm, Layer lay, Object edge, Map styleAttribute) { if (LOG.isDebugEnabled()) { LOG.debug("making figedge for " + edge); } if (edge == null) { throw new IllegalArgumentException("A model edge must be supplied"); } assert lay instanceof LayerPerspective; final FigEdge newEdge; // Although not generally true for GEF, for Argo we know that the layer // is a LayerPerspective which knows the associated diagram Diagram diag = ((LayerPerspective) lay).getDiagram(); if (diag instanceof UMLDiagram && ((UMLDiagram) diag).doesAccept(edge)) { newEdge = (FigEdge) ((UMLDiagram) diag) .drop(edge, null); } else { LOG.error("TODO: ClassDiagramRenderer getFigEdgeFor " + edge); throw new IllegalArgumentException( "Edge is not a recognised type. Received " + edge.getClass().getName()); } addEdge(lay, newEdge, edge); return newEdge; }
// in src/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java
Override public void addEdge(Object edge) { if (edge == null) { throw new IllegalArgumentException("Cannot add a null edge"); } if (getDestPort(edge) == null || getSourcePort(edge) == null) { throw new IllegalArgumentException( "The source and dest port should be provided on an edge"); } if (LOG.isInfoEnabled()) { LOG.info("Adding an edge of type " + edge.getClass().getName() + " to class diagram."); } if (!canAddEdge(edge)) { LOG.info("Attempt to add edge rejected"); return; } getEdges().add(edge); // TODO: assumes public // TODO: This is probably an undesirable side effect unless the user // confirms it. Placing an element on a second diagram is going to // potentially change its namespace. - tfm 20061208 if (Model.getFacade().isAModelElement(edge) && Model.getFacade().getNamespace(edge) == null && !Model.getFacade().isAAssociationEnd(edge)) { Model.getCoreHelper().addOwnedElement(getHomeModel(), edge); } fireEdgeAdded(edge); }
// in src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java
public FigNode getFigNodeFor(GraphModel gm, Layer lay, Object node, Map styleAttributes) { FigNode figNode = null; assert node != null; // Although not generally true for GEF, for Argo we know that the layer // is a LayerPerspective which knows the associated diagram Diagram diag = ((LayerPerspective) lay).getDiagram(); if (diag instanceof UMLDiagram && ((UMLDiagram) diag).doesAccept(node)) { figNode = (FigNode) ((UMLDiagram) diag).drop(node, null); } else { LOG.error("TODO: CollabDiagramRenderer getFigNodeFor"); throw new IllegalArgumentException( "Node is not a recognised type. Received " + node.getClass().getName()); } lay.add(figNode); return figNode; }
// in src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java
public FigEdge getFigEdgeFor(GraphModel gm, Layer lay, Object edge, Map styleAttributes) { if (LOG.isDebugEnabled()) { LOG.debug("making figedge for " + edge); } if (edge == null) { throw new IllegalArgumentException("A model edge must be supplied"); } assert lay instanceof LayerPerspective; ArgoDiagram diag = (ArgoDiagram) ((LayerPerspective) lay).getDiagram(); DiagramSettings settings = diag.getDiagramSettings(); FigEdge newEdge = null; if (Model.getFacade().isAAssociationRole(edge) || Model.getFacade().isAConnector(edge)) { Object[] associationEnds = Model.getFacade().getConnections(edge).toArray(); newEdge = new FigAssociationRole( new DiagramEdgeSettings( edge, associationEnds[0], associationEnds[1]), settings); FigNode sourceFig = getFigNodeForAssociationEnd(diag, associationEnds[0]); FigNode destFig = getFigNodeForAssociationEnd(diag, associationEnds[1]); newEdge.setSourceFigNode(sourceFig); newEdge.setSourcePortFig(sourceFig); newEdge.setDestFigNode(destFig); newEdge.setDestPortFig(destFig); } else if (Model.getFacade().isAGeneralization(edge)) { newEdge = new FigGeneralization(edge, settings); } else if (Model.getFacade().isADependency(edge)) { newEdge = new FigDependency(edge , settings); } else if (edge instanceof CommentEdge) { newEdge = new FigEdgeNote(edge, settings); // TODO -> settings } addEdge(lay, newEdge, edge); return newEdge; }
// in src/org/argouml/uml/diagram/collaboration/ui/UMLCollaborationDiagram.java
public void setNamespace(Object handle) { if (!Model.getFacade().isANamespace(handle)) { LOG.error( "Illegal argument. Object " + handle + " is not a namespace"); throw new IllegalArgumentException( "Illegal argument. Object " + handle + " is not a namespace"); } super.setNamespace(handle); CollabDiagramGraphModel gm = createGraphModel(); gm.setCollaboration(handle); LayerPerspective lay = new LayerPerspectiveMutable(Model.getFacade().getName(handle), gm); CollabDiagramRenderer rend = new CollabDiagramRenderer(); // singleton lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); }
// in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
public void setCollaboration(Object collaboration) { try { if (collaboration == null) { throw new IllegalArgumentException( "A null collaboration was supplied"); } if (!(Model.getFacade().isACollaboration(collaboration))) { throw new IllegalArgumentException( "Expected a collaboration. The type received was " + collaboration.getClass().getName()); } } catch (IllegalArgumentException e) { LOG.error("Illegal Argument to setCollaboration", e); throw e; } setHomeModel(collaboration); }
// in src/org/argouml/uml/diagram/UmlDiagramRenderer.java
protected void addEdge(Layer lay, FigEdge newEdge, Object edge) { if (newEdge == null) { throw new IllegalArgumentException( "Don't know how to create FigEdge for model type " + edge.getClass().getName()); } setPorts(lay, newEdge); assert newEdge != null : "There has been no FigEdge created"; // newEdge.setDiElement( // GraphChangeAdapter.getInstance().createElement(gm, edge)); assert newEdge != null : "There has been no FigEdge created"; assert (newEdge.getDestFigNode() != null) : "The FigEdge has no dest node"; assert (newEdge.getDestPortFig() != null) : "The FigEdge has no dest port"; assert (newEdge.getSourceFigNode() != null) : "The FigEdge has no source node"; assert (newEdge.getSourcePortFig() != null) : "The FigEdge has no source port"; lay.add(newEdge); }
// in src/org/argouml/uml/diagram/state/ui/StateDiagramRenderer.java
public FigNode getFigNodeFor(GraphModel gm, Layer lay, Object node, Map styleAttributes) { assert node != null; FigNode figNode = null; // Although not generally true for GEF, for Argo we know that the layer // is a LayerPerspective which knows the associated diagram Diagram diag = ((LayerPerspective) lay).getDiagram(); if (diag instanceof UMLDiagram && ((UMLDiagram) diag).doesAccept(node)) { figNode = (FigNode) ((UMLDiagram) diag).drop(node, null); } else { LOG.debug("TODO: StateDiagramRenderer getFigNodeFor"); throw new IllegalArgumentException( "Node is not a recognised type. Received " + node.getClass().getName()); } lay.add(figNode); return figNode; }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
Deprecated public UMLStateDiagram(Object ns, Object machine) { this(); if (!Model.getFacade().isAStateMachine(machine)) { throw new IllegalStateException( "No StateMachine given to create a Statechart diagram"); } if (ns == null) { ns = getNamespaceFromMachine(machine); } if (!Model.getFacade().isANamespace(ns)) { throw new IllegalArgumentException(); } nameDiagram(ns); setup(ns, machine); }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
public void setStateMachine(Object sm) { if (!Model.getFacade().isAStateMachine(sm)) { throw new IllegalArgumentException("This is not a StateMachine"); } ((StateDiagramGraphModel) getGraphModel()).setMachine(sm); }
// in src/org/argouml/uml/diagram/state/StateDiagramGraphModel.java
public void setMachine(Object sm) { if (!Model.getFacade().isAStateMachine(sm)) { throw new IllegalArgumentException(); } if (sm != null) { machine = sm; } }
// in src/org/argouml/uml/diagram/state/StateDiagramGraphModel.java
public void addEdge(Object edge) { LOG.debug("adding statechart/activity diagram edge!!!!!!"); if (edge == null) { throw new IllegalArgumentException("Cannot add a null edge"); } if (getDestPort(edge) == null || getSourcePort(edge) == null) { throw new IllegalArgumentException( "The source and dest port should be provided on an edge"); } if (LOG.isInfoEnabled()) { LOG.info("Adding an edge of type " + edge.getClass().getName() + " to class diagram."); } if (!canAddEdge(edge)) { LOG.info("Attempt to add edge rejected"); return; } getEdges().add(edge); fireEdgeAdded(edge); }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
public void setNamespace(Object ns) { if (!Model.getFacade().isANamespace(ns)) { LOG.error("Not a namespace"); LOG.error(ns); throw new IllegalArgumentException("Given object not a namespace"); } if ((namespace != null) && (namespace != ns)) { Model.getPump().removeModelEventListener(this, namespace); } Object oldNs = namespace; namespace = ns; firePropertyChange(NAMESPACE_KEY, oldNs, ns); // Add the diagram as a listener to the namespace so // that when the namespace is removed the diagram is deleted also. /* Listening only to "remove" events does not work... * TODO: Check if this works now with new event pump - tfm */ Model.getPump().addModelEventListener(this, namespace, "remove"); }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
public void setHomeModel(Object ns) { if (!Model.getFacade().isANamespace(ns)) { throw new IllegalArgumentException(); } homeModel = ns; }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
public CommentEdge buildCommentConnection(Object from, Object to) { if (from == null || to == null) { throw new IllegalArgumentException("Either fromNode == null " + "or toNode == null"); } Object comment = null; Object annotatedElement = null; if (Model.getFacade().isAComment(from)) { comment = from; annotatedElement = to; } else { if (Model.getFacade().isAComment(to)) { comment = to; annotatedElement = from; } else { return null; } } CommentEdge connection = new CommentEdge(from, to); Model.getCoreHelper().addAnnotatedElement(comment, annotatedElement); return connection; }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
Deprecated public UMLActivityDiagram(Object namespace, Object agraph) { this(); if (namespace == null) { namespace = Model.getFacade().getNamespace(agraph); } if (!Model.getFacade().isANamespace(namespace) || !Model.getFacade().isAActivityGraph(agraph)) { throw new IllegalArgumentException(); } if (Model.getFacade().getName(namespace) != null) { if (!Model.getFacade().getName(namespace).trim().equals("")) { String name = Model.getFacade().getName(namespace) + " activity " + (Model.getFacade().getBehaviors(namespace).size()); try { setName(name); } catch (PropertyVetoException pve) { // no action required } } } setup(namespace, agraph); }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
public void setup(Object namespace, Object agraph) { if (!Model.getFacade().isANamespace(namespace) || !Model.getFacade().isAActivityGraph(agraph)) { throw new IllegalArgumentException(); } setNamespace(namespace); theActivityGraph = agraph; ActivityDiagramGraphModel gm = createGraphModel(); gm.setHomeModel(namespace); if (theActivityGraph != null) { gm.setMachine(theActivityGraph); } ActivityDiagramRenderer rend = new ActivityDiagramRenderer(); LayerPerspective lay = new LayerPerspectiveMutable( Model.getFacade().getName(namespace), gm); lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); /* Listen to activitygraph deletion, * delete this diagram. */ Model.getPump().addModelEventListener(this, theActivityGraph, new String[] {"remove", "namespace"}); }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
public void setStateMachine(Object sm) { if (!Model.getFacade().isAStateMachine(sm)) { throw new IllegalArgumentException(); } ((ActivityDiagramGraphModel) getGraphModel()).setMachine(sm); }
// in src/org/argouml/uml/diagram/use_case/ui/UMLUseCaseDiagram.java
Override public void setNamespace(Object handle) { if (!Model.getFacade().isANamespace(handle)) { LOG.error( "Illegal argument. Object " + handle + " is not a namespace"); throw new IllegalArgumentException( "Illegal argument. Object " + handle + " is not a namespace"); } Object m = handle; super.setNamespace(m); UseCaseDiagramGraphModel gm = (UseCaseDiagramGraphModel) getGraphModel(); gm.setHomeModel(m); LayerPerspective lay = new LayerPerspectiveMutable(Model.getFacade().getName(m), gm); UseCaseDiagramRenderer rend = new UseCaseDiagramRenderer(); lay.setGraphNodeRenderer(rend); lay.setGraphEdgeRenderer(rend); setLayer(lay); // The renderer should be a singleton }
// in src/org/argouml/uml/diagram/use_case/ui/UseCaseDiagramRenderer.java
public FigEdge getFigEdgeFor(GraphModel gm, Layer lay, Object edge, Map styleAttributes) { if (LOG.isDebugEnabled()) { LOG.debug("making figedge for " + edge); } if (edge == null) { throw new IllegalArgumentException("A model edge must be supplied"); } assert lay instanceof LayerPerspective; ArgoDiagram diag = (ArgoDiagram) ((LayerPerspective) lay).getDiagram(); DiagramSettings settings = diag.getDiagramSettings(); FigEdge newEdge = null; if (Model.getFacade().isAAssociation(edge)) { final Object[] associationEnds = Model.getFacade().getConnections(edge).toArray(); newEdge = new FigAssociation( new DiagramEdgeSettings( edge, associationEnds[0], associationEnds[1]), settings); final FigNode sourceFig = getFigNodeForAssociationEnd(diag, associationEnds[0]); final FigNode destFig = getFigNodeForAssociationEnd(diag, associationEnds[1]); newEdge.setSourceFigNode(sourceFig); newEdge.setSourcePortFig(sourceFig); newEdge.setDestFigNode(destFig); newEdge.setDestPortFig(destFig); } else if (Model.getFacade().isAGeneralization(edge)) { newEdge = new FigGeneralization(edge, settings); } else if (Model.getFacade().isAExtend(edge)) { newEdge = new FigExtend(edge, settings); // The nodes at the two ends Object base = Model.getFacade().getBase(edge); Object extension = Model.getFacade().getExtension(edge); // The figs for the two end nodes FigNode baseFN = (FigNode) lay.presentationFor(base); FigNode extensionFN = (FigNode) lay.presentationFor(extension); // Link the new extend relationship in to the ends. Remember we // draw from the extension use case to the base use case. newEdge.setSourcePortFig(extensionFN); newEdge.setSourceFigNode(extensionFN); newEdge.setDestPortFig(baseFN); newEdge.setDestFigNode(baseFN); } else if (Model.getFacade().isAInclude(edge)) { newEdge = new FigInclude(edge, settings); Object base = Model.getFacade().getBase(edge); Object addition = Model.getFacade().getAddition(edge); // The figs for the two end nodes FigNode baseFN = (FigNode) lay.presentationFor(base); FigNode additionFN = (FigNode) lay.presentationFor(addition); // Link the new include relationship in to the ends newEdge.setSourcePortFig(baseFN); newEdge.setSourceFigNode(baseFN); newEdge.setDestPortFig(additionFN); newEdge.setDestFigNode(additionFN); } else if (Model.getFacade().isADependency(edge)) { newEdge = new FigDependency(edge, settings); // Where there is more than one supplier or client, take the first // element in each case. There really ought to be a check that // there are some here for safety. Object supplier = ((Model.getFacade().getSuppliers(edge).toArray())[0]); Object client = ((Model.getFacade().getClients(edge).toArray())[0]); // The figs for the two end nodes FigNode supplierFN = (FigNode) lay.presentationFor(supplier); FigNode clientFN = (FigNode) lay.presentationFor(client); // Link the new dependency in to the ends newEdge.setSourcePortFig(clientFN); newEdge.setSourceFigNode(clientFN); newEdge.setDestPortFig(supplierFN); newEdge.setDestFigNode(supplierFN); } else if (edge instanceof CommentEdge) { newEdge = new FigEdgeNote(edge, settings); } addEdge(lay, newEdge, edge); return newEdge; }
// in src/org/argouml/uml/diagram/use_case/UseCaseDiagramGraphModel.java
Override public void addEdge(Object edge) { if (edge == null) { throw new IllegalArgumentException("Cannot add a null edge"); } if (getDestPort(edge) == null || getSourcePort(edge) == null) { throw new IllegalArgumentException( "The source and dest port should be provided on an edge"); } if (LOG.isInfoEnabled()) { LOG.info("Adding an edge of type " + edge.getClass().getName() + " to use case diagram."); } if (!canAddEdge(edge)) { LOG.info("Attempt to add edge rejected"); return; } // Add the element and place it in the namespace of the model getEdges().add(edge); // TODO: assumes public if (Model.getFacade().isAUMLElement(edge) && Model.getFacade().getNamespace(edge) == null) { Model.getCoreHelper().addOwnedElement(getHomeModel(), edge); } // Tell GEF fireEdgeAdded(edge); }
// in src/org/argouml/uml/CommentEdge.java
public void setDestination(Object destination) { if (destination == null) { throw new IllegalArgumentException( "The destination of a comment edge cannot be null"); } if (!(Model.getFacade().isAModelElement(destination))) { throw new IllegalArgumentException( "The destination of the CommentEdge cannot be a " + destination.getClass().getName()); } dest = destination; }
// in src/org/argouml/uml/CommentEdge.java
public void setSource(Object theSource) { if (theSource == null) { throw new IllegalArgumentException( "The source of a comment edge cannot be null"); } if (!(Model.getFacade().isAModelElement(theSource))) { throw new IllegalArgumentException( "The source of the CommentEdge cannot be a " + theSource.getClass().getName()); } this.source = theSource; }
// in src/org/argouml/uml/CommentEdge.java
public void setAnnotatedElement(Object theAnnotatedElement) { if (theAnnotatedElement == null) { throw new IllegalArgumentException( "An annotated element must be supplied"); } if (Model.getFacade().isAComment(theAnnotatedElement)) { throw new IllegalArgumentException( "An annotated element cannot be a comment"); } this.annotatedElement = theAnnotatedElement; }
// in src/org/argouml/uml/CommentEdge.java
public void setComment(Object theComment) { if (theComment == null) { throw new IllegalArgumentException("A comment must be supplied"); } if (!Model.getFacade().isAComment(theComment)) { throw new IllegalArgumentException("A comment cannot be a " + theComment.getClass().getName()); } this.comment = theComment; }
// in src/org/argouml/uml/ChildGenRelated.java
public Enumeration gen(Object o) { // This is carried over from previous implementation // not sure why we don't want contents of package - tfm - 20060214 if (Model.getFacade().isAPackage(o)) { return null; } if (o instanceof Diagram) { List res = new ArrayList(); Diagram d = (Diagram) o; res.add(d.getGraphModel().getNodes()); res.add(d.getGraphModel().getEdges()); return Collections.enumeration(res); } // For all other model elements, return any elements // associated in any way if (Model.getFacade().isAUMLElement(o)) { return Collections.enumeration(Model.getFacade() .getModelElementAssociated(o)); } throw new IllegalArgumentException("Unknown element type " + o); }
// in src/org/argouml/uml/cognitive/critics/WizOperName.java
Override public void doAction(int oldStep) { if (!possibleConstructor) { super.doAction(oldStep); return; } switch (oldStep) { case 1: int choice = -1; if (step1 != null) { choice = step1.getSelectedIndex(); } switch (choice) { case -1: throw new IllegalArgumentException( "nothing selected, should not get here"); case 0: stereotypePathChosen = true; Object oper = getModelElement(); // We need to find the stereotype with the name // "create" and the base class BehavioralFeature in // the model. If there is none then we create one and // put it there. Object m = Model.getFacade().getRoot(oper); Object theStereotype = null; for (Iterator iter = Model.getFacade().getOwnedElements(m).iterator(); iter.hasNext();) { Object candidate = iter.next(); if (!(Model.getFacade().isAStereotype(candidate))) { continue; } if (!("create".equals( Model.getFacade().getName(candidate)))) { continue; } Collection baseClasses = Model.getFacade().getBaseClasses(candidate); Iterator iter2 = baseClasses != null ? baseClasses.iterator() : null; if (iter2 == null || !("BehavioralFeature".equals( iter2.next()))) { continue; } theStereotype = candidate; break; } if (theStereotype == null) { theStereotype = Model.getExtensionMechanismsFactory() .buildStereotype("create", m); Model.getCoreHelper().setName(theStereotype, "create"); // theStereotype.setStereotype(???); Model.getExtensionMechanismsHelper() .addBaseClass(theStereotype, "BehavioralFeature"); Object targetNS = findNamespace(Model.getFacade().getNamespace(oper), Model.getFacade().getRoot(oper)); Model.getCoreHelper() .addOwnedElement(targetNS, theStereotype); } try { createStereotype = theStereotype; Model.getCoreHelper().addStereotype(oper, theStereotype); ProjectManager.getManager().updateRoots(); addedCreateStereotype = true; } catch (Exception pve) { LOG.error("could not set stereotype", pve); } return; case 1: // Nothing to do. stereotypePathChosen = false; return; default: } return; case 2: if (!stereotypePathChosen) { super.doAction(1); } return; default: } }
// in src/org/argouml/uml/cognitive/critics/WizManyNames.java
public void setModelElements(List elements) { int mSize = elements.size(); for (int i = 0; i < 3 && i < mSize; ++i) { if (!Model.getFacade().isAModelElement(elements.get(i))) { throw new IllegalArgumentException( "The list should contain model elements in " + "the first 3 positions"); } } mes = elements; }
// in src/org/argouml/uml/cognitive/UMLToDoItem.java
Override protected void checkArgument(Object dm) { if (!Model.getFacade().isAUMLElement(dm) && !(dm instanceof Fig) && !(dm instanceof Diagram)) { throw new IllegalArgumentException( "The offender must be a model element, " + "a Fig or a Diagram"); } }
// in src/org/argouml/profile/internal/ModelUtils.java
public static Object findTypeInModel(String s, Object model) { if (!Model.getFacade().isANamespace(model)) { throw new IllegalArgumentException( "Looking for the classifier " + s + " in a non-namespace object of " + model + ". A namespace was expected."); } Collection allClassifiers = Model.getModelManagementHelper() .getAllModelElementsOfKind(model, Model.getMetaTypes().getClassifier()); for (Object classifier : allClassifiers) { if (Model.getFacade().getName(classifier) != null && Model.getFacade().getName(classifier).equals(s)) { return classifier; } } return null; }
// in src/org/argouml/application/helpers/ResourceLoaderWrapper.java
public Icon lookupIcon(Object value) { if (value == null) { throw new IllegalArgumentException( "Attempted to get an icon given a null key"); } if (value instanceof String) { return null; } Icon icon = iconCache.get(value.getClass()); try { if (Model.getFacade().isAPseudostate(value)) { Object kind = Model.getFacade().getKind(value); DataTypesHelper helper = Model.getDataTypesHelper(); if (helper.equalsINITIALKind(kind)) { icon = initialStateIcon; } if (helper.equalsDeepHistoryKind(kind)) { icon = deepIcon; } if (helper.equalsShallowHistoryKind(kind)) { icon = shallowIcon; } if (helper.equalsFORKKind(kind)) { icon = forkIcon; } if (helper.equalsJOINKind(kind)) { icon = joinIcon; } if (helper.equalsCHOICEKind(kind)) { icon = branchIcon; } if (helper.equalsJUNCTIONKind(kind)) { icon = junctionIcon; } // if (MPseudostateKind.FINAL.equals(kind)) // icon = _FinalStateIcon; } if (Model.getFacade().isAAbstraction(value)) { icon = realizeIcon; } if (Model.getFacade().isAException(value)) { icon = exceptionIcon; } else { // needs more work: sending and receiving icons if (Model.getFacade().isASignal(value)) { icon = signalIcon; } } if (Model.getFacade().isAComment(value)) { icon = commentIcon; } if (icon == null) { String cName = Model.getMetaTypes().getName(value); icon = lookupIconResource(cName); if (icon == null) { LOG.debug("Can't find icon for " + cName); } else { synchronized (iconCache) { iconCache.put(value.getClass(), icon); } } } } catch (InvalidElementException e) { LOG.debug("Attempted to get icon for deleted element"); return null; } return icon; }
// in src/org/argouml/cognitive/critics/ui/TableModelCritics.java
public String getColumnName(int c) { if (c == 0) { return Translator.localize("dialog.browse.column-name.active"); } if (c == 1) { return Translator.localize("dialog.browse.column-name.headline"); } if (c == 2) { return Translator.localize("dialog.browse.column-name.snoozed"); } if (c == 3) { return Translator.localize("dialog.browse.column-name.priority"); } if (c == 4) { return Translator.localize( "dialog.browse.column-name.supported-decision"); } if (c == 5) { return Translator.localize( "dialog.browse.column-name.knowledge-type"); } throw new IllegalArgumentException(); }
// in src/org/argouml/cognitive/critics/ui/TableModelCritics.java
public Class< ? > getColumnClass(int c) { if (c == 0) { return Boolean.class; } if (c == 1) { return String.class; } if (c == 2) { return String.class; } if (c == 3) { return Integer.class; } if (c == 4) { return String.class; } if (c == 5) { return String.class; } throw new IllegalArgumentException(); }
// in src/org/argouml/cognitive/critics/ui/TableModelCritics.java
public Object getValueAt(int row, int col) { Critic cr = critics.get(row); if (col == 0) { return cr.isEnabled() ? Boolean.TRUE : Boolean.FALSE; } if (col == 1) { return cr.getHeadline(); } if (col == 2) { return cr.isActive() ? "no" : "yes"; } if (col == 3) { return cr.getPriority(); } if (col == 4) { return listToString(cr.getSupportedDecisions()); } if (col == 5) { return listToString(cr.getKnowledgeTypes()); } throw new IllegalArgumentException(); }
// in src/org/argouml/cognitive/ToDoItem.java
private void checkOffs(ListSet offs) { if (offs == null) { throw new IllegalArgumentException( "A ListSet of offenders must be supplied."); } Object offender = CollectionUtil.getFirstItemOrNull(offs); if (offender != null) { checkArgument(offender); } if (offs.size() >= 2) { offender = offs.get(1); checkArgument(offender); } }
// in src/org/argouml/kernel/ProfileConfiguration.java
public static Object findTypeInModel(String s, Object model) { if (!Model.getFacade().isANamespace(model)) { throw new IllegalArgumentException( "Looking for the classifier " + s + " in a non-namespace object of " + model + ". A namespace was expected."); } Collection allClassifiers = Model.getModelManagementHelper() .getAllModelElementsOfKind(model, Model.getMetaTypes().getClassifier()); Object[] classifiers = allClassifiers.toArray(); Object classifier = null; for (int i = 0; i < classifiers.length; i++) { classifier = classifiers[i]; if (Model.getFacade().getName(classifier) != null && Model.getFacade().getName(classifier).equals(s)) { return classifier; } } return null; }
// in src/org/argouml/kernel/ProjectImpl.java
public void addMember(Object m) { if (m == null) { throw new IllegalArgumentException( "A model member must be supplied"); } else if (m instanceof ArgoDiagram) { LOG.info("Adding diagram member"); addDiagramMember((ArgoDiagram) m); } else if (m instanceof ProjectMemberTodoList) { LOG.info("Adding todo member"); addTodoMember((ProjectMemberTodoList) m); } else if (Model.getFacade().isAModel(m)) { LOG.info("Adding model member"); addModelMember(m); } else if (Model.getFacade().isAProfile(m)) { LOG.info("Adding profile model member"); addModelMember(m); } else { throw new IllegalArgumentException( "The member must be a UML model todo member or diagram." + "It is " + m.getClass().getName()); } LOG.info("There are now " + members.size() + " members"); }
// in src/org/argouml/kernel/ProjectImpl.java
private void addModelMember(final Object m) { boolean memberFound = false; Object currentMember = members.get(0); if (currentMember instanceof ProjectMemberModel) { Object currentModel = ((ProjectMemberModel) currentMember).getModel(); if (currentModel == m) { memberFound = true; } } if (!memberFound) { if (!models.contains(m)) { addModel(m); } // got past the veto, add the member ProjectMember pm = new ProjectMemberModel(m, this); LOG.info("Adding model member to start of member list"); members.add(pm); } else { LOG.info("Attempted to load 2 models"); throw new IllegalArgumentException( "Attempted to load 2 models"); } }
// in src/org/argouml/kernel/ProjectImpl.java
public void addModel(final Object model) { if (!Model.getFacade().isAModel(model) && !Model.getFacade().isAProfile(model)) { throw new IllegalArgumentException(); } if (!models.contains(model)) { setRoot(model); } }
// in src/org/argouml/kernel/ProjectImpl.java
public Object findTypeInModel(String typeName, Object namespace) { if (typeName == null) { throw new IllegalArgumentException("typeName must be non-null"); } if (!Model.getFacade().isANamespace(namespace)) { throw new IllegalArgumentException( "Looking for the classifier " + typeName + " in a non-namespace object of " + namespace + ". A namespace was expected."); } Collection allClassifiers = Model.getModelManagementHelper() .getAllModelElementsOfKind(namespace, Model.getMetaTypes().getClassifier()); for (Object classifier : allClassifiers) { if (typeName.equals(Model.getFacade().getName(classifier))) { return classifier; } } return null; }
// in src/org/argouml/kernel/ProjectImpl.java
public int getPresentationCountFor(Object me) { if (!Model.getFacade().isAUMLElement(me)) { throw new IllegalArgumentException(); } int presentations = 0; for (ArgoDiagram d : diagrams) { presentations += d.getLayer().presentationCountFor(me); } return presentations; }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
public static String generateMultiplicity(Object element, boolean showSingularMultiplicity) { Object multiplicity; if (Model.getFacade().isAMultiplicity(element)) { multiplicity = element; } else if (Model.getFacade().isAUMLElement(element)) { multiplicity = Model.getFacade().getMultiplicity(element); } else { throw new IllegalArgumentException(); } // it can still be null if the UML element // did not have a multiplicity defined. if (multiplicity != null) { int upper = Model.getFacade().getUpper(multiplicity); int lower = Model.getFacade().getLower(multiplicity); if (lower != 1 || upper != 1 || showSingularMultiplicity) { // TODO: I18N return Model.getFacade().toString(multiplicity); } } return ""; }
// in src/org/argouml/i18n/Translator.java
public static String localize(String key) { /* This is needed for the JUnit tests. * Otherwise a "assert initialized" would suffice. */ if (!initialized) { init("en"); } if (key == null) { throw new IllegalArgumentException("null"); } String name = getName(key); if (name == null) { return Localizer.localize("UMLMenu", key); } loadBundle(name); ResourceBundle bundle = bundles.get(name); if (bundle == null) { LOG.debug("Bundle (" + name + ") for resource " + key + " not found."); return key; } try { return bundle.getString(key); } catch (MissingResourceException e) { LOG.debug("Resource " + key + " not found."); return key; } }
// in src/org/argouml/persistence/PgmlUtility.java
public static String getId(Fig f) { if (f == null) { throw new IllegalArgumentException("A fig must be supplied"); } if (f.getGroup() != null) { String groupId = f.getGroup().getId(); if (f.getGroup() instanceof FigGroup) { FigGroup group = (FigGroup) f.getGroup(); return groupId + "." + (group.getFigs()).indexOf(f); } else if (f.getGroup() instanceof FigEdge) { FigEdge edge = (FigEdge) f.getGroup(); return groupId + "." + (((List) edge.getPathItemFigs()).indexOf(f) + 1); } else { return groupId + ".0"; } } Layer layer = f.getLayer(); if (layer == null) { return "LAYER_NULL"; } List c = layer.getContents(); int index = c.indexOf(f); return "Fig" + index; }
// in src/org/argouml/persistence/ArgoParser.java
public void readProject(Project theProject, InputSource source) throws SAXException { if (source == null) { throw new IllegalArgumentException( "An InputSource must be supplied"); } preRead(theProject); try { parse(source); } catch (SAXException e) { logError(source.toString(), e); throw e; } }
// in src/org/argouml/persistence/ArgoParser.java
public void readProject(Project theProject, Reader reader) throws SAXException { if (reader == null) { throw new IllegalArgumentException( "A reader must be supplied"); } preRead(theProject); try { parse(reader); } catch (SAXException e) { logError(reader.toString(), e); throw e; } }
0 9
            
// in src/org/argouml/uml/diagram/ui/ArgoFigText.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/profile/Profile.java
protected final void addProfileDependency(Profile p) throws IllegalArgumentException { addProfileDependency(p.getProfileIdentifier()); }
// in src/org/argouml/gefext/ArgoFigRRect.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigSpline.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigLine.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigCircle.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigPoly.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigRect.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigInk.java
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException { notifier.addNotificationListener(listener, filter, handback); }
15
            
// in src/org/argouml/ui/StylePanelFig.java
catch (IllegalArgumentException iae) { bboxField.setBackground(Color.RED); return null; }
// in src/org/argouml/ui/ProjectBrowser.java
catch (IllegalArgumentException e) { LOG.error("Exception", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (IllegalArgumentException e) { LOG.error("The constructor for class " + classname + " is called with incorrect argument.", e); return false; }
// in src/org/argouml/uml/diagram/ui/AbstractActionCheckBoxMenuItem.java
catch (IllegalArgumentException e) { result = false; //not supported for this target }
// in src/org/argouml/uml/diagram/ui/AbstractActionRadioMenuItem.java
catch (IllegalArgumentException e) { result = false; //not supported for this target }
// in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
catch (IllegalArgumentException e) { LOG.error("Illegal Argument to setCollaboration", e); throw e; }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
catch (IllegalArgumentException iae) { // idem, e.g. for a generalization with leaf/root object // TODO: but showing the message in the statusbar would help // TODO: IllegalArgumentException should not be used for // events we expect to happen. We need a different way of // catching well-formedness rules. LOG.warn("IllegalArgumentException caught", iae); }
// in src/org/argouml/uml/util/PathComparator.java
catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (IllegalArgumentException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("getItemUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; }
// in src/org/argouml/util/ItemUID.java
catch (IllegalArgumentException iare) { LOG.error("setItemUID for " + obj.getClass() + " takes strange parameter", iare); return null; }
5
            
// in src/org/argouml/uml/diagram/collaboration/CollabDiagramGraphModel.java
catch (IllegalArgumentException e) { LOG.error("Illegal Argument to setCollaboration", e); throw e; }
// in src/org/argouml/uml/util/PathComparator.java
catch (IllegalArgumentException e) { throw new ClassCastException( "Model element or String required" + "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString()) + "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString())); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); }
0
unknown (Lib) IllegalModelElementConnectionException 0 0 0 5
            
// in src/org/argouml/ui/ActionCreateEdgeModelElement.java
catch (IllegalModelElementConnectionException e1) { LOG.error("Exception", e1); }
// in src/org/argouml/ui/explorer/ExplorerPopup.java
catch (IllegalModelElementConnectionException e1) { LOG.error("Exception", e1); }
// in src/org/argouml/ui/explorer/ExplorerPopup.java
catch (IllegalModelElementConnectionException e1) { LOG.error("Exception", e1); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (IllegalModelElementConnectionException e) { LOG.error("Exception", e); }
// in src/org/argouml/uml/diagram/ui/ModeCreateAssociationEnd.java
catch (IllegalModelElementConnectionException e) { // We have already confirmed the connection is valid return null; }
0 0
runtime (Lib) IllegalStateException 31
            
// in src/org/argouml/ui/targetmanager/TargetManager.java
private void navigateForward() { if (currentTarget >= history.size() - 1) { throw new IllegalStateException( "NavigateForward is not allowed " + "since the targetpointer is pointing at " + "the upper boundary " + "of the history"); } setTarget(((WeakReference) history.get(++currentTarget)).get()); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
private void navigateBackward() { if (currentTarget == 0) { throw new IllegalStateException( "NavigateBackward is not allowed " + "since the targetpointer is pointing at " + "the lower boundary " + "of the history"); } navigateBackward = true; // If nothing selected, go to last selected target if (targets.size() == 0) { setTarget(((WeakReference) history.get(currentTarget)).get()); } else { setTarget(((WeakReference) history.get(--currentTarget)).get()); } navigateBackward = false; }
// in src/org/argouml/ui/ProjectBrowser.java
Deprecated public AbstractArgoJPanel getTab(Class tabClass) { // In theory there can be multiple details pane (work in // progress). It must first be determined which details // page contains the properties tab. Bob Tarling 7 Dec 2002 for (DetailsPane detailsPane : detailsPanesByCompassPoint.values()) { AbstractArgoJPanel tab = detailsPane.getTab(tabClass); if (tab != null) { return tab; } } throw new IllegalStateException("No " + tabClass.getName() + " tab found"); }
// in src/org/argouml/ui/ProjectBrowser.java
boolean trySave( final File file, final ProgressMonitor pmw, final Project project) { LOG.info("Saving the project"); PersistenceManager pm = PersistenceManager.getInstance(); ProjectFilePersister persister = null; try { String sStatus = MessageFormat.format(Translator.localize( "statusmsg.bar.save-project-status-writing"), new Object[] {file}); updateStatus (sStatus); persister = pm.getSavePersister(); pm.setSavePersister(null); if (persister == null) { persister = pm.getPersisterFromFileName(file.getName()); } if (persister == null) { throw new IllegalStateException("Filename " + project.getName() + " is not of a known file type"); } testSimulateErrors(); // Repair any errors in the project String report = project.repair(); if (report.length() > 0) { // TODO: i18n report = "An inconsistency has been detected when saving the model." + "These have been repaired and are reported below. " + "The save will continue with the model having been " + "amended as described.\n" + report; reportError( pmw, Translator.localize("dialog.repair") + report, true); } if (pmw != null) { pmw.updateProgress(25); persister.addProgressListener(pmw); } project.preSave(); persister.save(project, file); project.postSave(); ArgoEventPump.fireEvent(new ArgoStatusEvent( ArgoEventTypes.STATUS_PROJECT_SAVED, this, file.getAbsolutePath())); LOG.debug ("setting most recent project file to " + file.getCanonicalPath()); /* * notification of menu bar */ if (saveAction != null) { // Bob says - not sure how saveAction could be null here but // NPE has been reported. See issue 6233. As Tom comments // elsewhere we should be listening for file save events. // That would allow us to have a final saveAction instance // that can never be null saveAction.setEnabled(false); } addFileSaved(file); Configuration.setString(Argo.KEY_MOST_RECENT_PROJECT_FILE, file.getCanonicalPath()); return true; } catch (Exception ex) { String sMessage = MessageFormat.format(Translator.localize( "optionpane.save-project-general-exception"), new Object[] {ex.getMessage()}); JOptionPane.showMessageDialog(this, sMessage, Translator.localize( "optionpane.save-project-general-exception-title"), JOptionPane.ERROR_MESSAGE); reportError( pmw, Translator.localize( "dialog.error.save.error", new Object[] {file.getName()}), true, ex); LOG.error(sMessage, ex); } return false; }
// in src/org/argouml/ui/ProjectBrowser.java
public Project loadProject2(File file, boolean showUI, ProgressMonitor pmw) { LOG.info("Loading project."); PersistenceManager pm = PersistenceManager.getInstance(); Project oldProject = ProjectManager.getManager().getCurrentProject(); if (oldProject != null) { // Remove the old project first. It's wasteful to create a temp // empty project, but too much of ArgoUML depends on having a // current project Project p = ProjectManager.getManager().makeEmptyProject(); ProjectManager.getManager().setCurrentProject(p); ProjectManager.getManager().removeProject(oldProject); oldProject = p; } boolean success = false; // TODO: // This is actually a hack! Some diagram types // (like the statechart diagrams) access the current // diagram to get some info. This might cause // problems if there's another statechart diagram // active, so I remove the current project, before // loading the new one. Designer.disableCritiquing(); Designer.clearCritiquing(); clearDialogs(); Project project = null; if (!(file.canRead())) { reportError(pmw, "File not found " + file + ".", showUI); Designer.enableCritiquing(); success = false; } else { // Hide save action during load. Otherwise we get the // * appearing in title bar and the save enabling as models are // updated // TODO: Do we still need this now the save enablement is improved? final AbstractAction rememberedSaveAction = this.saveAction; this.saveAction = null; ProjectManager.getManager().setSaveAction(null); try { ProjectFilePersister persister = pm.getPersisterFromFileName(file.getName()); if (persister == null) { throw new IllegalStateException("Filename " + file.getName() + " is not of a known file type"); } if (pmw != null) { persister.addProgressListener(pmw); } project = persister.doLoad(file); if (pmw != null) { persister.removeProgressListener(pmw); } ThreadUtils.checkIfInterrupted(); // if (Model.getDiagramInterchangeModel() != null) { // TODO: This assumes no more than one project at a time // will be loaded. If it is ever reinstituted, this needs to // be fixed // Collection diagrams = // DiagramFactory.getInstance().getDiagram(); // Iterator diag = diagrams.iterator(); // while (diag.hasNext()) { // project.addMember(diag.next()); // } // if (!diagrams.isEmpty()) { // project.setActiveDiagram( // (ArgoDiagram) diagrams.iterator().next()); // } // } // Let's save this project in the mru list this.addFileSaved(file); // Let's save this project as the last used one // in the configuration file Configuration.setString(Argo.KEY_MOST_RECENT_PROJECT_FILE, file.getCanonicalPath()); updateStatus( Translator.localize( "statusmsg.bar.open-project-status-read", new Object[] {file.getName(), })); success = true; } catch (VersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI); } catch (OutOfMemoryError ex) { LOG.error("Out of memory while loading project", ex); reportError( pmw, Translator.localize("dialog.error.memory.limit"), showUI); } catch (java.lang.InterruptedException ex) { LOG.error("Project loading interrupted by user"); } catch (UmlVersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI, ex); } catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } } catch (IOException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); } catch (OpenException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); } catch (XmiReferenceRuntimeException ex) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix reportError(pmw, Translator.localize("dialog.error.xmi.reference.error", new Object[] {ex.getReference(), ex.getMessage()}), ex.toString(), showUI); } catch (RuntimeException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); } finally { try { if (!success) { project = ProjectManager.getManager().makeEmptyProject(); } ProjectManager.getManager().setCurrentProject(project); if (oldProject != null) { ProjectManager.getManager().removeProject(oldProject); } project.getProjectSettings().init(); Command cmd = new NonUndoableCommand() { public Object execute() { // This is temporary. Load project // should create a new project // with its own UndoManager and so // there should be no Command return null; } }; project.getUndoManager().addCommand(cmd); LOG.info("There are " + project.getDiagramList().size() + " diagrams in the current project"); Designer.enableCritiquing(); } finally { // Make sure save action is always reinstated this.saveAction = rememberedSaveAction; // We clear the save-required flag on the Swing event thread // in the hopes that it gets done after any other background // work (listener updates) that is being done there SwingUtilities.invokeLater(new Runnable() { public void run() { ProjectManager.getManager().setSaveAction( rememberedSaveAction); rememberedSaveAction.setEnabled(false); } }); } } }
// in src/org/argouml/uml/ui/UMLConditionExpressionModel.java
public void setExpression(Object expression) { Object target = TargetManager.getInstance().getTarget(); if (target == null) { throw new IllegalStateException("There is no target for " + getContainer()); } Model.getUseCasesHelper().setCondition(target, expression); }
// in src/org/argouml/uml/ui/UMLRecurrenceExpressionModel.java
public void setExpression(Object expression) { Object target = TargetManager.getInstance().getTarget(); if (target == null) { throw new IllegalStateException("There is no target for " + getContainer()); } Model.getCommonBehaviorHelper().setRecurrence(target, expression); }
// in src/org/argouml/uml/ui/LabelledLayout.java
private void layoutSection( final Container parent, final int sectionX, final int sectionWidth, final ArrayList components, final int sectionNo) { final ArrayList<Integer> rowHeights = new ArrayList<Integer>(); final int componentCount = components.size(); if (componentCount == 0) { return; } int labelWidth = 0; int unknownHeightCount = 0; int totalHeight = 0; // Build up an array list of the heights of each label/component pair. // Heights of zero indicate a proportional height. Component previousComp = null; for (int i = 0; i < componentCount; ++i) { final Component childComp = (Component) components.get(i); final int childHeight; if (childComp instanceof JLabel) { final JLabel jlabel = (JLabel) childComp; final Component labelledComp = jlabel.getLabelFor(); labelWidth = Math.max(labelWidth, getPreferredWidth(jlabel)); if (labelledComp != null) { ++i; childHeight = getChildHeight(labelledComp); if (childHeight == 0) { ++unknownHeightCount; } } else { childHeight = getPreferredHeight(jlabel); } totalHeight += childHeight + this.vgap; rowHeights.add(new Integer(childHeight)); } else { // to manage the case there are no label/component // pairs but just one component childHeight = getChildHeight(childComp); if (childHeight == 0) { ++unknownHeightCount; } totalHeight += childHeight + this.vgap; rowHeights.add(new Integer(childHeight)); } previousComp = childComp; } totalHeight -= this.vgap; final Insets insets = parent.getInsets(); final int parentHeight = parent.getHeight() - (insets.top + insets.bottom); // Set the child components to the heights in the array list // calculating the height of any proportional component on the // fly. FIXME - This assumes that the JLabel and the // component it labels have been added to the parent component // consecutively. int y = insets.top; int row = 0; previousComp = null; for (int i = 0; i < componentCount; ++i) { Component childComp = (Component) components.get(i); if (childComp.isVisible()) { int rowHeight; int componentWidth = sectionWidth; int componentX = sectionX; // If the component is a JLabel which has another // component assigned then position/size the label and // calculate the size of the registered component if (childComp instanceof JLabel && ((JLabel) childComp).getLabelFor() != null) { i++; // Assumes the next child is the labelled component final JLabel jlabel = (JLabel) childComp; childComp = jlabel.getLabelFor(); jlabel.setBounds(sectionX, y, labelWidth, getPreferredHeight(jlabel)); componentWidth = sectionWidth - (labelWidth); componentX = sectionX + labelWidth; } rowHeight = rowHeights.get(row).intValue(); if (rowHeight == 0) { try { rowHeight = calculateHeight( parentHeight, totalHeight, unknownHeightCount--, childComp); } catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); } totalHeight += rowHeight; } // Make sure the component width isn't any greater // than its maximum allowed width if (childComp.getMaximumSize() != null && getMaximumWidth(childComp) < componentWidth) { componentWidth = getMaximumWidth(childComp); } childComp.setBounds(componentX, y, componentWidth, rowHeight); y += rowHeight + this.vgap; ++row; previousComp = childComp; } } }
// in src/org/argouml/uml/ui/ActionNewDiagram.java
Override public void actionPerformed(ActionEvent e) { // TODO: Get Project or other necessary context from source?? // e.getSource(); // TODO: Since there may be multiple top level elements in // a project, this should be using the default Namespace (currently // undefined) or something similar Project p = ProjectManager.getManager().getCurrentProject(); Object ns = findNamespace(); if (ns != null && isValidNamespace(ns)) { super.actionPerformed(e); DiagramSettings settings = p.getProjectSettings().getDefaultDiagramSettings(); ArgoDiagram diagram = createDiagram(ns, settings); assert (diagram != null) : "No diagram was returned by the concrete class"; p.addMember(diagram); //TODO: make the explorer listen to project member property //changes... to eliminate coupling on gui. ExplorerEventAdaptor.getInstance().modelElementAdded( diagram.getNamespace()); TargetManager.getInstance().setTarget(diagram); } else { LOG.error("No valid namespace found"); throw new IllegalStateException("No valid namespace found"); } }
// in src/org/argouml/uml/ui/behavior/state_machines/UMLChangeExpressionModel.java
public void setExpression(Object expression) { Object target = TargetManager.getInstance().getTarget(); if (target == null) { throw new IllegalStateException("There is no target for " + getContainer()); } Model.getStateMachinesHelper().setChangeExpression(target, expression); }
// in src/org/argouml/uml/ui/behavior/collaborations/ActionAddMessagePredecessor.java
protected List getSelected() { if (getTarget() == null) { throw new IllegalStateException( "getSelected may not be called with null target"); } List vec = new ArrayList(); vec.addAll(Model.getFacade().getPredecessors(getTarget())); return vec; }
// in src/org/argouml/uml/ui/behavior/collaborations/ActionAddMessagePredecessor.java
protected void doIt(Collection selected) { if (getTarget() == null) { throw new IllegalStateException( "doIt may not be called with null target"); } Object message = getTarget(); Model.getCollaborationsHelper().setPredecessors(message, selected); }
// in src/org/argouml/uml/ui/ActionAddDiagram.java
Override public void actionPerformed(ActionEvent e) { // TODO: The project should be bound to the action when it is created? Project p = ProjectManager.getManager().getCurrentProject(); Object ns = findNamespace(); if (ns != null && isValidNamespace(ns)) { super.actionPerformed(e); DiagramSettings settings = p.getProjectSettings().getDefaultDiagramSettings(); // TODO: We should really be passing the default settings to // the diagram factory so they get set at creation time ArgoDiagram diagram = createDiagram(ns, settings); p.addMember(diagram); //TODO: make the explorer listen to project member property //changes... to eliminate coupling on gui. ExplorerEventAdaptor.getInstance().modelElementAdded(ns); TargetManager.getInstance().setTarget(diagram); } else { LOG.error("No valid namespace found"); throw new IllegalStateException("No valid namespace found"); } }
// in src/org/argouml/uml/ui/UMLChangeDispatch.java
private void synchronizedDispatch(Container cont) { if (target == null) { throw new IllegalStateException("Target may not be null in " + "synchronized dispatch"); } synchronized (target) { dispatch(cont); } }
// in src/org/argouml/uml/ui/UMLTimeExpressionModel.java
public void setExpression(Object expression) { Object target = TargetManager.getInstance().getTarget(); if (target == null) { throw new IllegalStateException("There is no target for " + getContainer()); } Model.getStateMachinesHelper().setWhen(target, expression); }
// in src/org/argouml/uml/diagram/ui/FigGeneralization.java
private void fixup(Object owner) { if (Model.getFacade().isAGeneralization(owner)) { Object subType = Model.getFacade().getSpecific(owner); Object superType = Model.getFacade().getGeneral(owner); if (subType == null || superType == null) { // TODO: We should warn the user we have removed something - tfm removeFromDiagram(); return; } updateDiscriminatorText(); // show it } else if (owner != null) { throw new IllegalStateException( "FigGeneralization has an illegal owner of " + owner.getClass().getName()); } }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private Fig getNoEdgePresentationFor(Object element) { if (element == null) { throw new IllegalArgumentException("Can't search for a null owner"); } List contents = PgmlUtility.getContentsNoEdges(getLayer()); int figCount = contents.size(); for (int figIndex = 0; figIndex < figCount; ++figIndex) { Fig fig = (Fig) contents.get(figIndex); if (fig.getOwner() == element) { return fig; } } throw new IllegalStateException("Can't find a FigNode representing " + Model.getFacade().getName(element)); }
// in src/org/argouml/uml/diagram/DiagramFactory.java
private ArgoDiagram createInternal(final DiagramType type, final Object namespace, final Object machine, DiagramSettings settings) { final ArgoDiagram diagram; if (settings == null) { throw new IllegalArgumentException( "DiagramSettings may not be null"); } Object factory = factories.get(type); if (factory != null) { Object owner; if (machine != null) { owner = machine; } else { owner = namespace; } if (factory instanceof DiagramFactoryInterface2) { diagram = ((DiagramFactoryInterface2) factory).createDiagram( owner, (String) null, settings); } else if (factory instanceof DiagramFactoryInterface) { diagram = ((DiagramFactoryInterface) factory).createDiagram( namespace, machine); diagram.setDiagramSettings(settings); } else { // This shouldn't be possible, but just in case throw new IllegalStateException( "Unknown factory type registered"); } } else { if ((type == DiagramType.State || type == DiagramType.Activity) && machine == null) { diagram = createDiagram(diagramClasses.get(type), null, namespace); } else { diagram = createDiagram(diagramClasses.get(type), namespace, machine); } diagram.setDiagramSettings(settings); } return diagram; }
// in src/org/argouml/uml/diagram/collaboration/ui/ActionAddClassifierRole.java
public Object makeNode() { Object node = null; Editor ce = Globals.curEditor(); GraphModel gm = ce.getGraphModel(); if (gm instanceof CollabDiagramGraphModel) { Object collaboration = ((CollabDiagramGraphModel) gm).getOwner(); node = Model.getCollaborationsFactory().buildLifeline(collaboration); } else { throw new IllegalStateException("Graphmodel is not a " + "collaboration diagram graph model"); } return node; }
// in src/org/argouml/uml/diagram/collaboration/ui/UMLCollaborationDiagram.java
public void postLoad() { super.postLoad(); if (getNamespace() == null) { throw new IllegalStateException( "The namespace of the collaboration diagram is not set"); } Collection messages; Iterator msgIterator; Collection ownedElements = Model.getFacade().getOwnedElements(getNamespace()); Iterator oeIterator = ownedElements.iterator(); Layer lay = getLayer(); while (oeIterator.hasNext()) { Object me = oeIterator.next(); if (Model.getFacade().isAAssociationRole(me)) { messages = Model.getFacade().getMessages(me); msgIterator = messages.iterator(); while (msgIterator.hasNext()) { Object message = msgIterator.next(); FigMessage figMessage = (FigMessage) lay.presentationFor(message); if (figMessage != null) { figMessage.addPathItemToFigAssociationRole(lay); } } } } }
// in src/org/argouml/uml/diagram/UmlDiagramRenderer.java
protected final void setPorts(Layer layer, FigEdge newEdge) { Object modelElement = newEdge.getOwner(); if (newEdge.getSourcePortFig() == null) { Object source; if (modelElement instanceof CommentEdge) { source = ((CommentEdge) modelElement).getSource(); } else { source = Model.getUmlHelper().getSource(modelElement); } FigNode sourceNode = getNodePresentationFor(layer, source); assert (sourceNode != null) : "No FigNode found for " + source; setSourcePort(newEdge, sourceNode); } if (newEdge.getDestPortFig() == null) { Object dest; if (modelElement instanceof CommentEdge) { dest = ((CommentEdge) modelElement).getDestination(); } else { dest = Model.getUmlHelper().getDestination(newEdge.getOwner()); } setDestPort(newEdge, getNodePresentationFor(layer, dest)); } if (newEdge.getSourcePortFig() == null || newEdge.getDestPortFig() == null) { throw new IllegalStateException("Edge of type " + newEdge.getClass().getName() + " created with no source or destination port"); } }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
Deprecated public UMLStateDiagram(Object ns, Object machine) { this(); if (!Model.getFacade().isAStateMachine(machine)) { throw new IllegalStateException( "No StateMachine given to create a Statechart diagram"); } if (ns == null) { ns = getNamespaceFromMachine(machine); } if (!Model.getFacade().isANamespace(ns)) { throw new IllegalArgumentException(); } nameDiagram(ns); setup(ns, machine); }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
private Object getNamespaceFromMachine(Object machine) { if (!Model.getFacade().isAStateMachine(machine)) { throw new IllegalStateException( "No StateMachine given to create a Statechart diagram"); } Object ns = Model.getFacade().getNamespace(machine); if (ns != null) { return ns; } Object context = Model.getFacade().getContext(machine); if (Model.getFacade().isAClassifier(context)) { ns = context; } else if (Model.getFacade().isABehavioralFeature(context)) { ns = Model.getFacade().getNamespace( // or just the owner? Model.getFacade().getOwner(context)); } if (ns == null) { ns = getProject().getRoots().iterator().next(); } if (ns == null || !Model.getFacade().isANamespace(ns)) { throw new IllegalStateException( "Can not deduce a Namespace from a StateMachine"); } return ns; }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
Override public Object getOwner() { if (!(getGraphModel() instanceof StateDiagramGraphModel)) { throw new IllegalStateException( "Incorrect graph model of " + getGraphModel().getClass().getName()); } StateDiagramGraphModel gm = (StateDiagramGraphModel) getGraphModel(); return gm.getMachine(); }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
Override public void initialize(Object o) { if (Model.getFacade().isAStateMachine(o)) { Object machine = o; Object contextNamespace = getNamespaceFromMachine(machine); setup(contextNamespace, machine); } else { throw new IllegalStateException( "Cannot find namespace " + "while initializing " + "statechart diagram"); } }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
public void initialize(Object o) { if (!(Model.getFacade().isAActivityGraph(o))) { return; } Object context = Model.getFacade().getContext(o); if (context != null) { if (Model.getFacade().isABehavioralFeature(context)) { setup(Model.getFacade().getNamespace( Model.getFacade().getOwner(context)), o); } else { setup(context, o); } } else { Object namespace4Diagram = Model.getFacade().getNamespace(o); if (namespace4Diagram != null) { setup(namespace4Diagram, o); } else { throw new IllegalStateException("Cannot find context " + "nor namespace while initializing activity diagram"); } } }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
public Object getOwner() { if (!(getGraphModel() instanceof ActivityDiagramGraphModel)) { throw new IllegalStateException( "Incorrect graph model of " + getGraphModel().getClass().getName()); } ActivityDiagramGraphModel gm = (ActivityDiagramGraphModel) getGraphModel(); return gm.getMachine(); }
// in src/org/argouml/persistence/PGMLStackParser.java
private FigNode getFigNode(String figId) throws IllegalStateException { if (figId.contains(".")) { // If the id does not look like a top-level Fig then we can assume // that this is an id of a FigEdgePort inside some FigEdge. // So extract the FigEdgePort from the FigEdge and return that as // the FigNode. figId = figId.substring(0, figId.indexOf('.')); FigEdgeModelElement edge = (FigEdgeModelElement) findFig(figId); if (edge == null) { throw new IllegalStateException("Can't find a FigNode with id " + figId); } edge.makeEdgePort(); return edge.getEdgePort(); } else { // If there is no dot then this must be a top level Fig and can be // assumed to be a FigNode. Fig f = findFig(figId); if (f instanceof FigNode) { return (FigNode) f; } else { LOG.error("FigID " + figId + " is not a node, edge ignored"); return null; } } }
1
            
// in src/org/argouml/uml/ui/LabelledLayout.java
catch (ArithmeticException e) { String lookAndFeel = UIManager.getLookAndFeel().getClass().getName(); throw new IllegalStateException( "Division by zero laying out " + childComp.getClass().getName() + " on " + parent.getClass().getName() + " in section " + sectionNo + " using " + lookAndFeel, e); }
3
            
// in src/org/argouml/ui/targetmanager/TargetManager.java
public void navigateForward() throws IllegalStateException { historyManager.navigateForward(); LOG.debug("Navigate forward"); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
public void navigateBackward() throws IllegalStateException { historyManager.navigateBackward(); LOG.debug("Navigate backward"); }
// in src/org/argouml/persistence/PGMLStackParser.java
private FigNode getFigNode(String figId) throws IllegalStateException { if (figId.contains(".")) { // If the id does not look like a top-level Fig then we can assume // that this is an id of a FigEdgePort inside some FigEdge. // So extract the FigEdgePort from the FigEdge and return that as // the FigNode. figId = figId.substring(0, figId.indexOf('.')); FigEdgeModelElement edge = (FigEdgeModelElement) findFig(figId); if (edge == null) { throw new IllegalStateException("Can't find a FigNode with id " + figId); } edge.makeEdgePort(); return edge.getEdgePort(); } else { // If there is no dot then this must be a top level Fig and can be // assumed to be a FigNode. Fig f = findFig(figId); if (f instanceof FigNode) { return (FigNode) f; } else { LOG.error("FigID " + figId + " is not a node, edge ignored"); return null; } } }
2
            
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (java.lang.IllegalStateException ils) { LOG.debug("drop IllegalStateException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/uml/cognitive/critics/CrCircularInheritance.java
catch (IllegalStateException ex) { problem = PROBLEM_FOUND; LOG.info("problem found for: " + this); }
0 0
checked (Domain) ImportException
public class ImportException extends Exception {

        /**
         * Construct an ImportException with a wrapped Throwable.
         * 
         * @param message message indicating error that occurred
         * @param cause the wrapped Exception
         */
        public ImportException(String message, Throwable cause) {
            super("Import Exception : " + message, cause);
        }
        
        public ImportException(String message) {
            super(message);
        }

        public ImportException(Throwable cause) {
            super("Import Exception", cause);
        }
        
    }
0 0 0 0 0 0
unknown (Lib) IndexOutOfBoundsException 8
            
// in src/org/argouml/uml/ui/TabTaggedValuesModel.java
static Object getFromCollection(Collection collection, int index) { if (collection instanceof List) { return ((List) collection).get(index); } if (index >= collection.size() || index < 0) { throw new IndexOutOfBoundsException(); } Iterator it = collection.iterator(); for (int i = 0; i < index; i++) { it.next(); } return it.next(); }
// in src/org/argouml/cognitive/ui/GoListToDecisionsToItems.java
public Object getChild(Object parent, int index) { if (parent instanceof ToDoList) { return getDecisionList().get(index); } if (parent instanceof Decision) { Decision dec = (Decision) parent; List<ToDoItem> itemList = Designer.theDesigner().getToDoList().getToDoItemList(); synchronized (itemList) { for (ToDoItem item : itemList) { if (item.getPoster().supports(dec)) { if (index == 0) { return item; } index--; } } } } throw new IndexOutOfBoundsException("getChild shouldn't get here " + "GoListToDecisionsToItems"); }
// in src/org/argouml/cognitive/ui/GoListToGoalsToItems.java
public Object getChild(Object parent, int index) { if (parent instanceof ToDoList) { return getGoalList().get(index); } if (parent instanceof Goal) { Goal g = (Goal) parent; List<ToDoItem> itemList = Designer.theDesigner().getToDoList().getToDoItemList(); synchronized (itemList) { for (ToDoItem item : itemList) { if (item.getPoster().supports(g)) { if (index == 0) { return item; } index--; } } } } throw new IndexOutOfBoundsException("getChild shouldnt get here " + "GoListToGoalsToItems"); }
// in src/org/argouml/cognitive/ui/GoListToTypeToItem.java
public Object getChild(Object parent, int index) { if (parent instanceof ToDoList) { return KnowledgeTypeNode.getTypeList().get(index); } if (parent instanceof KnowledgeTypeNode) { KnowledgeTypeNode ktn = (KnowledgeTypeNode) parent; List<ToDoItem> itemList = Designer.theDesigner().getToDoList().getToDoItemList(); synchronized (itemList) { for (ToDoItem item : itemList) { if (item.containsKnowledgeType(ktn.getName())) { if (index == 0) { return item; } index--; } } } } throw new IndexOutOfBoundsException("getChild shouldnt get here " + "GoListToTypeToItem"); }
// in src/org/argouml/cognitive/ui/GoListToPriorityToItem.java
public Object getChild(Object parent, int index) { if (parent instanceof ToDoList) { return PriorityNode.getPriorityList().get(index); } if (parent instanceof PriorityNode) { PriorityNode pn = (PriorityNode) parent; List<ToDoItem> itemList = Designer.theDesigner().getToDoList().getToDoItemList(); synchronized (itemList) { for (ToDoItem item : itemList) { if (item.getPriority() == pn.getPriority()) { if (index == 0) { return item; } index--; } } } } throw new IndexOutOfBoundsException("getChild shouldnt get here " + "GoListToPriorityToItem"); }
// in src/org/argouml/gefext/DeferredBufferedImage.java
private boolean isRasterValid(Rectangle clip) { if (clip.height > scaledBufferHeight) { throw new IndexOutOfBoundsException( "clip rectangle must fit in band buffer"); } return (clip.y >= y1 && (clip.y + clip.height - 1) < y2); }
// in src/org/argouml/gefext/DeferredBufferedImage.java
public Raster getTile(int tileX, int tileY) { LOG.debug("getTile x=" + tileX + " y = " + tileY); if (tileX < getMinTileX() || tileX >= getMinTileX() + getNumXTiles() || tileY < getMinTileY() || tileY >= getMinTileY() + getNumYTiles()) { throw new IndexOutOfBoundsException(); } // FIXME: Boundary condition at end of image for non-integral // multiples of BUFFER_HEIGHT Rectangle tileBounds = new Rectangle(0, (tileY - getMinTileY() * scaledBufferHeight), width, scaledBufferHeight); return getData(tileBounds); }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void write(byte[] b, int off, int len) throws IOException { if ((off | len | (b.length - (len + off)) | (off + len)) < 0) { throw new IndexOutOfBoundsException(); } if (headerProcessed) { out.write(b, off, len); } else { // TODO: Make this more efficient for large I/Os for (int i = 0; i < len; i++) { write(b[off + i]); } } }
0 0 0 0 0
unknown (Lib) InstantiationException 0 0 0 12
            
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (InstantiationException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (InstantiationException e) { LOG.error(e); }
// in src/org/argouml/ui/explorer/PerspectiveManager.java
catch (InstantiationException e) { LOG.error( "could not create rule " + ruleName + " you can try to " + "refresh the perspectives to the " + "default settings.", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (InstantiationException e) { LOG.error("The constructor for class " + classname + " threw an exception.", e); return false; }
// in src/org/argouml/uml/ui/TabStyle.java
catch (InstantiationException ignore) { LOG.error(ignore); return null; }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (InstantiationException e) { LOG.error("Error instantianting class: " + entry, e); }
// in src/org/argouml/application/Main.java
catch (InstantiationException e) { System.out.println(commandName + " could not be instantiated - skipping" + " (InstantiationException)"); continue; }
// in src/org/argouml/cognitive/Critic.java
catch (InstantiationException instEx) { LOG.error("Could not instantiate wizard: ", instEx); }
// in src/org/argouml/cognitive/Agency.java
catch (java.lang.InstantiationException e) { LOG.error("Error instancating cr " + crClassName, e); return; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (InstantiationException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InstantiationException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/AbstractFilePersister.java
catch (InstantiationException e) { LOG.error("Exception instantiating file persister " + clazz, e); return null; }
1
            
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InstantiationException e) { throw new SAXException(e); }
0
unknown (Lib) InterruptedException 1
            
// in src/org/argouml/util/ThreadUtils.java
public static void checkIfInterrupted() throws InterruptedException { // make this thread interruptible, if called from SwingWorker if (Thread.interrupted()) { throw new InterruptedException(); } }
0 19
            
// in src/org/argouml/ui/SplashScreen.java
public void progress(ProgressEvent event) throws InterruptedException { statusBar.progress(event); }
// in src/org/argouml/ui/StatusBar.java
public void progress(ProgressEvent event) throws InterruptedException { // TODO: Auto-generated method stub }
// in src/org/argouml/uml/reveng/ui/ImportStatusScreen.java
public void progress(ProgressEvent event) throws InterruptedException { // ignored }
// in src/org/argouml/util/ThreadUtils.java
public static void checkIfInterrupted() throws InterruptedException { // make this thread interruptible, if called from SwingWorker if (Thread.interrupted()) { throw new InterruptedException(); } }
// in src/org/argouml/persistence/XmiFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream stream = null; try { stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } progressMgr.nextPhase(); }
// in src/org/argouml/persistence/XmiFilePersister.java
void writeProject(Project project, OutputStream stream, ProgressMgr progressMgr) throws SaveException, InterruptedException { int size = project.getMembers().size(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase(getExtension())) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + (project.getMembers() .get(i)).getType()); } MemberFilePersister persister = new ModelMemberFilePersister(); persister.save(projectMember, stream); } } if (progressMgr != null) { progressMgr.nextPhase(); } }
// in src/org/argouml/persistence/XmiFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { LOG.info("Loading with XMIFilePersister"); try { Project p = ProjectFactory.getInstance().createProject(); long length = file.length(); long phaseSpace = 100000; int phases = (int) (length / phaseSpace); if (phases < 10) { phaseSpace = length / 10; phases = 10; } LOG.info("File length is " + length + " phase space is " + phaseSpace + " phases is " + phases); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(phases); ThreadUtils.checkIfInterrupted(); InputSource source = new InputSource(new XmiInputStream(file .toURI().toURL().openStream(), this, phaseSpace, progressMgr)); source.setSystemId(file.toURI().toURL().toString()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(source); Object model = modelPersister.getCurModel(); progressMgr.nextPhase(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); // TODO Handle multiple top level packages p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); p.updateRoots(); File defaultProjectFile = new File(file.getPath() + ".zargo"); // Make sure the file doesn't exist so the user will // get prompted to choose a new name for (int i = 0; i < 99; i++) { if (!defaultProjectFile.exists()) { break; } defaultProjectFile = new File(file.getPath() + "." + i + ".zargo"); } PersistenceManager.getInstance().setProjectURI( defaultProjectFile.toURI(), p); progressMgr.nextPhase(); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public void doSave(Project project, File file) throws SaveException, InterruptedException { LOG.info("Saving"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } ZipOutputStream stream = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); stream = new ZipOutputStream(new FileOutputStream(file)); for (ProjectMember projectMember : project.getMembers()) { if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + projectMember.getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { stream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public Project doLoad(File file) throws OpenException, InterruptedException { ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(3 + UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); int fileVersion; String releaseVersion; try { String argoEntry = getEntryNames(file, ".argo").iterator().next(); URL argoUrl = makeZipEntryUrl(toURL(file), argoEntry); fileVersion = getPersistenceVersion(argoUrl.openStream()); releaseVersion = getReleaseVersion(argoUrl.openStream()); } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } // TODO: The commented code below was commented out by Bob Tarling // in order to resolve bugs 4845 and 4857. Hopefully we can // determine the cause and reintroduce. //boolean upgradeRequired = !checkVersion(fileVersion, releaseVersion) boolean upgradeRequired = true; // Upgrade is in the way for UML2 projects, so we turn it off in that case: if (Model.getFacade().getUmlVersion().charAt(0) == '2') { upgradeRequired = false; } LOG.info("Loading zargo file of version " + fileVersion); final Project p; if (upgradeRequired) { File combinedFile = zargoToUml(file, progressMgr); p = super.doLoad(file, combinedFile, progressMgr); } else { p = loadFromZargo(file, progressMgr); } progressMgr.nextPhase(); PersistenceManager.getInstance().setProjectURI(file.toURI(), p); return p; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private File zargoToUml(File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { File combinedFile = null; try { combinedFile = File.createTempFile("combinedzargo_", ".uml"); LOG.info( "Combining old style zargo sub files into new style uml file " + combinedFile.getAbsolutePath()); combinedFile.deleteOnExit(); String encoding = Argo.getEncoding(); FileOutputStream stream = new FileOutputStream(combinedFile); PrintWriter writer = new PrintWriter(new BufferedWriter( new OutputStreamWriter(stream, encoding))); writer.println("<?xml version = \"1.0\" " + "encoding = \"" + encoding + "\" ?>"); copyArgo(file, encoding, writer); progressMgr.nextPhase(); copyMember(file, "profile", encoding, writer); copyXmi(file, encoding, writer); copyDiagrams(file, encoding, writer); // Copy the todo items after the model and diagrams so that // any model elements or figs that the todo items refer to // will exist before creating critics. copyMember(file, "todo", encoding, writer); progressMgr.nextPhase(); writer.println("</uml>"); writer.close(); LOG.info("Completed combining files"); } catch (IOException e) { throw new OpenException(e); } return combinedFile; }
// in src/org/argouml/persistence/OldZargoFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } BufferedWriter writer = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); writer = new BufferedWriter(new OutputStreamWriter(stream, "UTF-8")); // Save the .argo entry // TODO: Cyclic dependency with PersistenceManager // move PersistenceManager..getProjectBaseName() someplace else ZipEntry zipEntry = new ZipEntry(PersistenceManager.getInstance() .getProjectBaseName(project) + FileConstants.UNCOMPRESSED_FILE_EXT); stream.putNextEntry(zipEntry); Hashtable templates = TemplateReader.getInstance().read(ARGO_MINI_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project); writer.flush(); stream.closeEntry(); int counter = 0; int size = project.getMembers().size(); Collection<String> names = new ArrayList<String>(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (!(projectMember.getType().equalsIgnoreCase("xmi"))) { if (LOG.isInfoEnabled()) { LOG.info("Saving member: " + project.getMembers().get(i).getZipName()); } String name = projectMember.getZipName(); String originalName = name; while (names.contains(name)) { /* Issue 4806 explains why we need this! */ name = ++counter + originalName; } names.add(name); stream.putNextEntry(new ZipEntry(name)); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); stream.flush(); stream.closeEntry(); } } for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + project.getMembers().get(i).getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); OldModelMemberFilePersister persister = new OldModelMemberFilePersister(); persister.save(projectMember, stream); stream.flush(); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { writer.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); OutputStream stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); progressMgr.nextPhase(); String path = file.getParent(); if (LOG.isInfoEnabled()) { LOG.info("Dir ==" + path); } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
void writeProject(Project project, OutputStream oStream, ProgressMgr progressMgr) throws SaveException, InterruptedException { OutputStreamWriter outputStreamWriter; try { outputStreamWriter = new OutputStreamWriter(oStream, Argo .getEncoding()); } catch (UnsupportedEncodingException e) { throw new SaveException(e); } PrintWriter writer = new PrintWriter(new BufferedWriter( outputStreamWriter)); XmlFilterOutputStream filteredStream = new XmlFilterOutputStream( oStream, Argo.getEncoding()); try { writer.println("<?xml version = \"1.0\" " + "encoding = \"" + Argo.getEncoding() + "\" ?>"); writer.println("<uml version=\"" + PERSISTENCE_VERSION + "\">"); // Write out header section try { Hashtable templates = TemplateReader.getInstance().read( ARGO_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project, " "); } catch (ExpansionException e) { throw new SaveException(e); } writer.flush(); if (progressMgr != null) { progressMgr.nextPhase(); } // Note we assume members are ordered correctly already for (ProjectMember projectMember : project.getMembers()) { if (LOG.isInfoEnabled()) { LOG.info("Saving member : " + projectMember); } MemberFilePersister persister = getMemberFilePersister(projectMember); filteredStream.startEntry(); persister.save(projectMember, filteredStream); try { filteredStream.flush(); } catch (IOException e) { throw new SaveException(e); } } writer.println("</uml>"); writer.flush(); } finally { writer.close(); try { filteredStream.reallyClose(); } catch (IOException e) { throw new SaveException(e); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { // let's initialize the progressMgr ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); return doLoad(file, file, progressMgr); }
// in src/org/argouml/persistence/UmlFilePersister.java
protected Project doLoad(File originalFile, File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { XmlInputStream inputStream = null; try { Project p = ProjectFactory.getInstance() .createProject(file.toURI()); // Run through any stylesheet upgrades int fileVersion = getPersistenceVersionFromFile(file); LOG.info("Loading uml file of version " + fileVersion); if (!checkVersion(fileVersion, getReleaseVersionFromFile(file))) { // If we're about to upgrade the file lets take an archive // of it first. String release = getReleaseVersionFromFile(file); copyFile(originalFile, new File(originalFile.getAbsolutePath() + '~' + release)); progressMgr.setNumberOfPhases(progressMgr.getNumberOfPhases() + (PERSISTENCE_VERSION - fileVersion)); while (fileVersion < PERSISTENCE_VERSION) { ++fileVersion; LOG.info("Upgrading to version " + fileVersion); long startTime = System.currentTimeMillis(); file = transform(file, fileVersion); long endTime = System.currentTimeMillis(); LOG.info("Upgrading took " + ((endTime - startTime) / 1000) + " seconds"); progressMgr.nextPhase(); } } progressMgr.nextPhase(); inputStream = new XmlInputStream(file.toURI().toURL().openStream(), "argo", file.length(), 100000); ArgoParser parser = new ArgoParser(); Reader reader = new InputStreamReader(inputStream, Argo .getEncoding()); parser.readProject(p, reader); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); for (int i = 0; i < memberList.size(); ++i) { MemberFilePersister persister = getMemberFilePersister((String) memberList .get(i)); LOG.info("Loading member with " + persister.getClass().getName()); inputStream.reopen(persister.getMainTag()); // TODO: Do we need to set the input encoding here? It was // done for ToDo parsing, but none of the other member types // InputSource inputSource = new InputSource( // new InputStreamReader(inputStream, Argo // .getEncoding())); InputSource inputSource = new InputSource(inputStream); // Don't use systemId here or it will get opened in preference // to inputStream. inputSource.setPublicId(originalFile.toURI().toURL() .toExternalForm()); try { persister.load(p, inputSource); } catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } } } // let's update the progress progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); inputStream.realClose(); p.postLoad(); return p; } catch (InterruptedException e) { throw e; } catch (OpenException e) { throw e; } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/AbstractFilePersister.java
public final void save(Project project, File file) throws SaveException, InterruptedException { preSave(project, file); doSave(project, file); postSave(project, file); }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected void nextPhase() throws InterruptedException { ThreadUtils.checkIfInterrupted(); ++phasesCompleted; percentPhasesComplete = (phasesCompleted * 100) / numberOfPhases; fireProgressEvent(percentPhasesComplete); }
// in src/org/argouml/persistence/AbstractFilePersister.java
public void progress(ProgressEvent event) throws InterruptedException { ThreadUtils.checkIfInterrupted(); int percentPhasesLeft = 100 - percentPhasesComplete; long position = event.getPosition(); long length = event.getLength(); long proportion = (position * percentPhasesLeft) / length; fireProgressEvent(percentPhasesComplete + proportion); }
// in src/org/argouml/persistence/AbstractFilePersister.java
protected void fireProgressEvent(long percent) throws InterruptedException { ProgressEvent event = null; // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ProgressListener.class) { // Lazily create the event: if (event == null) { event = new ProgressEvent(this, percent, 100); } ((ProgressListener) listeners[i + 1]).progress(event); } } }
13
            
// in src/org/argouml/ui/SwingWorker.java
catch (InterruptedException e) { Thread.currentThread().interrupt(); // propagate return null; }
// in src/org/argouml/ui/ProjectBrowser.java
catch (java.lang.InterruptedException ex) { LOG.error("Project loading interrupted by user"); }
// in src/org/argouml/ui/StatusBar.java
catch (InterruptedException ex) { }
// in src/org/argouml/ui/StatusBar.java
catch (InterruptedException ex) { }
// in src/org/argouml/application/Main.java
catch (InterruptedException e) { }
// in src/org/argouml/cognitive/ToDoList.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/ToDoList.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/Designer.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/cognitive/Designer.java
catch (InterruptedException ignore) { LOG.error("InterruptedException!!!", ignore); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (InterruptedException e) { return null; }
// in src/org/argouml/persistence/XmiInputStream.java
catch (InterruptedException e) { throw new InterruptedIOException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (InterruptedException e) { throw e; }
3
            
// in src/org/argouml/persistence/XmiFilePersister.java
catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; }
// in src/org/argouml/persistence/XmiInputStream.java
catch (InterruptedException e) { throw new InterruptedIOException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (InterruptedException e) { throw e; }
0
checked (Domain) InterruptedIOException
class InterruptedIOException extends IOException {
    
    private static final long serialVersionUID = 5654808047803205851L;
    
    private InterruptedException cause;
    
    public InterruptedIOException(InterruptedException theCause) {
        cause = theCause;
    }
    
    public InterruptedException getInterruptedException() {
        return cause;
    }
}
1
            
// in src/org/argouml/persistence/XmiInputStream.java
Override public synchronized int read() throws IOException { if (endFound) { extensionFound = false; parsingExtension = false; endFound = false; readingName = false; tagName = null; endTagName = null; } int ch = super.read(); if (parsingExtension) { stringBuffer.append((char) ch); } // else { // TODO: Only progress when reading standard XMI // extension parsers will continue progression. ++readCount; if (progressMgr != null && readCount == eventSpacing) { try { readCount = 0; progressMgr.nextPhase(); } catch (InterruptedException e) { throw new InterruptedIOException(e); } } // } if (xmiExtensionParser != null) { if (readingName) { if (isNameTerminator((char) ch)) { readingName = false; if (parsingExtension && endTagName == null) { endTagName = "/" + tagName; } else if (tagName.equals("XMI.extension")) { extensionFound = true; } else if (tagName.equals(endTagName)) { endFound = true; xmiExtensionParser.parse(type, stringBuffer.toString()); stringBuffer.delete(0, stringBuffer.length()); } } else { tagName += (char) ch; } } if (extensionFound) { if (ch == '>') { extensionFound = false; callExtensionParser(); } else { attributes += (char) ch; } } if (ch == '<') { readingName = true; tagName = ""; } } return ch; }
1
            
// in src/org/argouml/persistence/XmiInputStream.java
catch (InterruptedException e) { throw new InterruptedIOException(e); }
0 0 0 0
unknown (Lib) InvalidElementException 0 0 0 37
            
// in src/org/argouml/ui/DisplayTextTree.java
catch (InvalidElementException e) { name = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/ui/DisplayTextTree.java
catch (InvalidElementException e) { return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/ui/DisplayTextTree.java
catch (InvalidElementException e) { return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
catch (InvalidElementException e) { LOG.debug("InvalidElementException in ExplorerTree : " + e.getStackTrace()); }
// in src/org/argouml/ui/explorer/ExplorerTreeModel.java
catch (InvalidElementException e) { LOG.debug("InvalidElementException in ExplorerTree : " + e.getStackTrace()); }
// in src/org/argouml/ui/explorer/ExplorerEventAdaptor.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element", e); } }
// in src/org/argouml/ui/explorer/NameOrder.java
catch (InvalidElementException e) { name = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/ui/UMLListCellRenderer2.java
catch (InvalidElementException e) { name = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/ui/TabTaggedValuesModel.java
catch (InvalidElementException e) { // Target has been deleted return 0; }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { return ""; }
// in src/org/argouml/uml/ui/UMLComboBoxModel2.java
catch (InvalidElementException e) { LOG.warn("buildModelList attempted to operate on " + "deleted element"); }
// in src/org/argouml/uml/ui/UMLStereotypeListModel.java
catch (InvalidElementException iee) { return; }
// in src/org/argouml/uml/ui/UMLStereotypeListModel.java
catch (InvalidElementException exception) { /* * This can throw an exception if the target has been * deleted. We don't want to try locking the repository * because this is called from the event delivery thread and * could cause a deadlock. Instead catch the exception and * leave the model empty. */ LOG.debug("buildModelList threw exception for target " + getTarget() + ": " + exception); }
// in src/org/argouml/uml/ui/ActionDeleteModelElements.java
catch (InvalidElementException e) { LOG.debug("Model element deleted twice - ignoring 2nd delete"); }
// in src/org/argouml/uml/ui/UMLModelElementListModel2.java
catch (InvalidElementException iee) { return; }
// in src/org/argouml/uml/ui/UMLModelElementListModel2.java
catch (InvalidElementException exception) { /* * This can throw an exception if the target has been * deleted. We don't want to try locking the repository * because this is called from the event delivery thread and * could cause a deadlock. Instead catch the exception and * leave the model empty. */ LOG.debug("buildModelList threw exception for target " + getTarget() + ": " + exception); }
// in src/org/argouml/uml/ui/TabTaggedValues.java
catch (InvalidElementException e) { // Most likely cause of this is that someone deleted our // target with the event pump turned off so we didn't // get notification. Nothing we can do about it now and // we are changing targets anyway, so just log it. LOG.warn("failed to cancel editing - " + "model element deleted while edit in progress"); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("modelChanged method accessed deleted element" + formatEvent(event), e); } }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element " + formatEvent(event), e); } }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { return true; }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (InvalidElementException e) { LOG.debug("stereotypeChanged method accessed deleted element ", e); }
// in src/org/argouml/uml/diagram/ui/FigCompartment.java
catch (InvalidElementException e) { // TODO: It would be better here to continue the loop and try to // build the rest of the compartment. Hence try/catch should be // internal to the loop. LOG.debug("Attempted to populate a FigEditableCompartment" + " using a deleted model element - aborting", e); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { // We moused over an object just as it was deleted // transient condition - doesn't require I18N LOG.warn("A deleted element still exists on the diagram"); return Translator.localize("misc.name.deleted"); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { LOG.error("updateLayout method accessed " + "deleted element", e); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigSingleLineText.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("event = " + event.getClass().getName()); LOG.debug("source = " + event.getSource()); LOG.debug("old = " + event.getOldValue()); LOG.debug("name = " + event.getPropertyName()); LOG.debug("updateLayout method accessed " + "deleted element ", e); } }
// in src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
catch (InvalidElementException e) { if (LOG.isDebugEnabled()) { LOG.debug("method accessed " + "deleted element", e); } }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
catch (InvalidElementException e) { LOG.error("Tried to refresh deleted element ", e); }
// in src/org/argouml/uml/cognitive/checklist/UMLCheckItem.java
catch (InvalidElementException e) { /* The modelelement must have been * deleted - ignore this - it will pass. */ evalStr = Translator.localize("misc.name.deleted"); }
// in src/org/argouml/profile/ProfileFacade.java
catch (InvalidElementException e) { LOG.debug("Attempted to delete extent twice in removeAllProfiles "); }
// in src/org/argouml/application/helpers/ResourceLoaderWrapper.java
catch (InvalidElementException e) { LOG.debug("Attempted to get icon for deleted element"); return null; }
// in src/org/argouml/cognitive/ToDoList.java
catch (InvalidElementException ex) { // If element has been deleted, it's no longer valid valid = false; }
// in src/org/argouml/cognitive/Designer.java
catch (InvalidElementException e) { // Don't let a transient error kill the thread LOG.warn("Element " + dm + "caused an InvalidElementException. " + "Ignoring for this pass."); }
// in src/org/argouml/kernel/ProjectImpl.java
catch (InvalidElementException e) { LOG.warn("Extent deleted a second time"); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (InvalidElementException e) { // The model element was deleted while we were working on it return ""; }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (InvalidElementException e) { // The element was deleted while we were processing it return ""; }
0 0
checked (Domain) InvalidOclException
public class InvalidOclException extends Exception {

    /**
     * Default Constructor
     * 
     * @param ocl the invalid ocl expression
     */
    public InvalidOclException(String ocl) {
        super(ocl);
    }
}
2
            
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
public Object evaluate(Map<String, Object> vt, ModelInterpreter mi, String ocl) throws InvalidOclException { // XXX this seems to be a bug of the parser, // it always requires a context //LOG.debug("OCL: " + ocl); if (ocl.contains("ore")) { // TODO: Convert this to some sensible logging System.out.println("VOILA!"); } Lexer lexer = new Lexer(new PushbackReader(new StringReader( "context X inv: " + ocl), 2)); OclParser parser = new OclParser(lexer); Start tree = null; try { tree = parser.parse(); } catch (Exception e) { throw new InvalidOclException(ocl); } EvaluateExpression ee = new EvaluateExpression(vt, mi); tree.apply(ee); return ee.getValue(); }
2
            
// in src/org/argouml/profile/internal/ocl/OclInterpreter.java
catch (Exception e) { e.printStackTrace(); throw new InvalidOclException(ocl); }
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
catch (Exception e) { throw new InvalidOclException(ocl); }
3
            
// in src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
public Object evaluate(Map<String, Object> vt, ModelInterpreter mi, String ocl) throws InvalidOclException { // XXX this seems to be a bug of the parser, // it always requires a context //LOG.debug("OCL: " + ocl); if (ocl.contains("ore")) { // TODO: Convert this to some sensible logging System.out.println("VOILA!"); } Lexer lexer = new Lexer(new PushbackReader(new StringReader( "context X inv: " + ocl), 2)); OclParser parser = new OclParser(lexer); Start tree = null; try { tree = parser.parse(); } catch (Exception e) { throw new InvalidOclException(ocl); } EvaluateExpression ee = new EvaluateExpression(vt, mi); tree.apply(ee); return ee.getValue(); }
21
            
// in src/org/argouml/ocl/OCLEvaluator.java
catch (InvalidOclException e) { return "<ocl>invalid expression</ocl>"; }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (InvalidOclException e) { LOG.error("Invalid OCL in XMI!", e); return null; }
// in src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java
catch (InvalidOclException e) { LOG.error("Exception", e); return null; }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (InvalidOclException e) { e.printStackTrace(); }
0 0
unknown (Lib) InvocationTargetException 0 0 1
            
// in src/org/argouml/util/osdep/OSXAdapter.java
public boolean callTarget(Object appleEvent) throws InvocationTargetException, IllegalAccessException { Object result = targetMethod.invoke(targetObject, (Object[])null); if (result == null) { return true; } return Boolean.valueOf(result.toString()).booleanValue(); }
7
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (InvocationTargetException e) { LOG.error("Exception", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (InvocationTargetException e) { LOG.error("The constructor for class " + classname + " cannot be called.", e); return false; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (InvocationTargetException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("getItemUID for " + obj.getClass() + " threw: ", tie); return null; }
// in src/org/argouml/util/ItemUID.java
catch (InvocationTargetException tie) { LOG.error("setItemUID for " + obj.getClass() + " threw", tie); return null; }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InvocationTargetException e) { throw new SAXException(e); }
1
            
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InvocationTargetException e) { throw new SAXException(e); }
0
unknown (Lib) ListenerNotFoundException 0 0 16
            
// in src/org/argouml/uml/diagram/ui/ArgoFigText.java
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { notifier.removeNotificationListener(listener, filter, handback); }
// in src/org/argouml/uml/diagram/ui/ArgoFigText.java
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { notifier.removeNotificationListener(listener); }
// in src/org/argouml/gefext/ArgoFigRRect.java
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { notifier.removeNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigRRect.java
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { notifier.removeNotificationListener(listener); }
// in src/org/argouml/gefext/ArgoFigSpline.java
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { notifier.removeNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigSpline.java
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { notifier.removeNotificationListener(listener); }
// in src/org/argouml/gefext/ArgoFigLine.java
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { notifier.removeNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigLine.java
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { notifier.removeNotificationListener(listener); }
// in src/org/argouml/gefext/ArgoFigCircle.java
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { notifier.removeNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigCircle.java
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { notifier.removeNotificationListener(listener); }
// in src/org/argouml/gefext/ArgoFigPoly.java
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { notifier.removeNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigPoly.java
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { notifier.removeNotificationListener(listener); }
// in src/org/argouml/gefext/ArgoFigRect.java
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { notifier.removeNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigRect.java
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { notifier.removeNotificationListener(listener); }
// in src/org/argouml/gefext/ArgoFigInk.java
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { notifier.removeNotificationListener(listener, filter, handback); }
// in src/org/argouml/gefext/ArgoFigInk.java
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { notifier.removeNotificationListener(listener); }
1
            
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (ListenerNotFoundException e) { LOG.error("Notification Listener for " + "CommentEdge not found", e); }
0 0
unknown (Lib) MalformedURLException 0 0 13
            
// in src/org/argouml/uml/reveng/ImportClassLoader.java
public static ImportClassLoader getInstance() throws MalformedURLException { if (instance == null) { String path = Configuration.getString(Argo.KEY_USER_IMPORT_CLASSPATH, System.getProperty("user.dir")); return getInstance(getURLs(path)); } else { return instance; } }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
public static ImportClassLoader getInstance(URL[] urls) throws MalformedURLException { instance = new ImportClassLoader(urls); return instance; }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
public void addFile(File f) throws MalformedURLException { addURL(f.toURI().toURL()); }
// in src/org/argouml/profile/URLModelLoader.java
private URL makeZipEntryUrl(URL url, String entryName) throws MalformedURLException { String entryURL = "jar:" + url + "!/" + entryName; return new URL(entryURL); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private URL toURL(File file) throws MalformedURLException { return file.toURI().toURL(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyArgo(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, OpenException, UnsupportedEncodingException { int pgmlCount = getPgmlCount(file); boolean containsToDo = containsTodo(file); boolean containsProfile = containsProfile(file); // first read the .argo file from Zip ZipInputStream zis = openZipStreamAt(toURL(file), FileConstants.PROJECT_FILE_EXT); if (zis == null) { throw new OpenException( "There is no .argo file in the .zargo"); } String line; BufferedReader reader = new BufferedReader(new InputStreamReader(zis, encoding)); // Keep reading till we hit the <argo> tag String rootLine; do { rootLine = reader.readLine(); if (rootLine == null) { throw new OpenException( "Can't find an <argo> tag in the argo file"); } } while(!rootLine.startsWith("<argo")); // Get the version from the tag. String version = getVersion(rootLine); writer.println("<uml version=\"" + version + "\">"); writer.println(rootLine); LOG.info("Transfering argo contents"); int memberCount = 0; while ((line = reader.readLine()) != null) { if (line.trim().startsWith("<member")) { ++memberCount; } if (line.trim().equals("</argo>") && memberCount == 0) { LOG.info("Inserting member info"); writer.println("<member type='xmi' name='.xmi' />"); for (int i = 0; i < pgmlCount; ++i) { writer.println("<member type='pgml' name='.pgml' />"); } if (containsToDo) { writer.println("<member type='todo' name='.todo' />"); } if (containsProfile) { String type = ProfileConfiguration.EXTENSION; writer.println("<member type='" + type + "' name='." + type + "' />"); } } writer.println(line); } if (LOG.isInfoEnabled()) { LOG.info("Member count = " + memberCount); } zis.close(); reader.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyXmi(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, UnsupportedEncodingException { ZipInputStream zis = openZipStreamAt(toURL(file), ".xmi"); BufferedReader reader = new BufferedReader( new InputStreamReader(zis, encoding)); // Skip 1 lines reader.readLine(); readerToWriter(reader, writer); zis.close(); reader.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyMember(File file, String tag, String outputEncoding, PrintWriter writer) throws IOException, MalformedURLException, UnsupportedEncodingException { ZipInputStream zis = openZipStreamAt(toURL(file), "." + tag); if (zis != null) { InputStreamReader isr = new InputStreamReader(zis, outputEncoding); BufferedReader reader = new BufferedReader(isr); String firstLine = reader.readLine(); if (firstLine.startsWith("<?xml")) { // Skip the 2 lines //<?xml version="1.0" encoding="UTF-8" ?> //<!DOCTYPE todo SYSTEM "todo.dtd" > reader.readLine(); } else { writer.println(firstLine); } readerToWriter(reader, writer); zis.close(); reader.close(); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
private InputStream openZipEntry(URL url, String entryName) throws MalformedURLException, IOException { return makeZipEntryUrl(url, entryName).openStream(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private URL makeZipEntryUrl(URL url, String entryName) throws MalformedURLException { String entryURL = "jar:" + url + "!/" + entryName; return new URL(entryURL); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private List<String> getEntryNames(File file, String extension) throws IOException, MalformedURLException { ZipInputStream zis = new ZipInputStream(toURL(file).openStream()); List<String> result = new ArrayList<String>(); ZipEntry entry = zis.getNextEntry(); while (entry != null) { String name = entry.getName(); if (extension == null || name.endsWith(extension)) { result.add(name); } entry = zis.getNextEntry(); } zis.close(); return result; }
14
            
// in src/org/argouml/ui/HelpBox.java
catch ( MalformedURLException e) { LOG.warn( pages[i][0] + " URL malformed: " + pages[i][1]); }
// in src/org/argouml/uml/ui/ActionSaveAllGraphics.java
catch ( MalformedURLException ex ) { LOG.error("exception in opening JFileChooser", ex); }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (MalformedURLException e) { LOG.warn("could not remove file ", e); return; }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (MalformedURLException e) { LOG.warn("could not set path ", e); }
// in src/org/argouml/uml/reveng/ImportClassLoader.java
catch (MalformedURLException e) { LOG.error(e); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (MalformedURLException e) { throw new ProfileException( "Failed to create the ProfileReference.", e); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/FileModelLoader.java
catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
9
            
// in src/org/argouml/profile/ZipModelLoader.java
catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (MalformedURLException e) { throw new ProfileException( "Failed to create the ProfileReference.", e); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/FileModelLoader.java
catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
0
unknown (Lib) MissingResourceException 0 0 0 3
            
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e1) { LOG.debug("Resource " + resource + " not found in the default class loader."); Iterator iter = classLoaders.iterator(); while (iter.hasNext()) { ClassLoader cl = (ClassLoader) iter.next(); try { LOG.debug("Loading " + resource + " from " + cl); bundle = ResourceBundle.getBundle(resource, Locale.getDefault(), cl); break; } catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); } } }
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e2) { LOG.debug("Resource " + resource + " not found in " + cl); }
// in src/org/argouml/i18n/Translator.java
catch (MissingResourceException e) { LOG.debug("Resource " + key + " not found."); return key; }
0 0
unknown (Lib) NoClassDefFoundError 0 0 0 3
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while loading " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while loading " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoClassDefFoundError e) { LOG.error("Unable to find required class while instantiating " + classname + " - may indicate an obsolete" + " extension module or an unresolved dependency", e); return false; }
0 0
unknown (Lib) NoSuchElementException 2
            
// in src/org/argouml/util/SingleElementIterator.java
public T next() { if (!done) { done = true; return target; } throw new NoSuchElementException(); }
// in src/org/argouml/util/MyTokenizer.java
public String nextToken() { CustomSeparator csep; TokenSep sep; String s = null; int i, j; if (putToken != null) { s = putToken; putToken = null; return s; } if (savedToken != null) { s = savedToken; tokIdx = savedIdx; savedToken = null; return s; } if (sIdx >= eIdx) { throw new NoSuchElementException("No more tokens available"); } for (sep = delims; sep != null; sep = sep.getNext()) { sep.reset(); } if (customSeps != null) { for (i = 0; i < customSeps.size(); i++) { ((CustomSeparator) customSeps.get(i)).reset(); } } for (i = sIdx; i < eIdx; i++) { char c = source.charAt(i); for (j = 0; customSeps != null && j < customSeps.size(); j++) { csep = (CustomSeparator) customSeps.get(j); if (csep.addChar(c)) { break; } } if (customSeps != null && j < customSeps.size()) { csep = (CustomSeparator) customSeps.get(j); while (csep.hasFreePart() && i + 1 < eIdx) { if (csep.endChar(source.charAt(++i))) { break; } } i -= Math.min(csep.getPeekCount(), i); int clen = Math.min(i + 1, source.length()); if (i - sIdx + 1 > csep.tokenLength()) { s = source.substring(sIdx, i - csep.tokenLength() + 1); savedIdx = i - csep.tokenLength() + 1; savedToken = source.substring( savedIdx, clen); } else { s = source.substring(sIdx, clen); } tokIdx = sIdx; sIdx = i + 1; break; } for (sep = delims; sep != null; sep = sep.getNext()) { if (sep.addChar(c)) { break; } } if (sep != null) { if (i - sIdx + 1 > sep.length()) { s = source.substring(sIdx, i - sep.length() + 1); savedIdx = i - sep.length() + 1; savedToken = sep.getString(); } else { s = sep.getString(); } tokIdx = sIdx; sIdx = i + 1; break; } } if (s == null) { s = source.substring(sIdx); tokIdx = sIdx; sIdx = eIdx; } return s; }
0 0 8
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (NoSuchElementException nsee) { parseError("operation.unexpected-end-operation", s.length()); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
7
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
0
unknown (Lib) NoSuchMethodException 0 0 0 6
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (NoSuchMethodException e) { LOG.error("Exception", e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (NoSuchMethodException e) { LOG.error("The default constructor for class " + classname + " is not found.", e); return false; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (NoSuchMethodException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no getItemUID try { // This is needed for a CommentEdge ... // TODO: Why doesn't CommentEdge implement IItemUID and be // handled with the mechanism above. Method m = obj.getClass().getMethod("getUUID", (Class[]) null); rv = m.invoke(obj, (Object[]) null); return (String) rv; } catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; } catch (IllegalArgumentException iare) { LOG.error("getUUID for " + obj.getClass() + " takes strange parameter: ", iare); return null; } catch (IllegalAccessException iace) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; } catch (InvocationTargetException tie) { LOG.error("getUUID for " + obj.getClass() + " threw: ", tie); return null; } }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme2) { // Apparently this object had no getUUID return null; }
// in src/org/argouml/util/ItemUID.java
catch (NoSuchMethodException nsme) { // Apparently this object had no setItemUID return null; }
0 0
runtime (Lib) NullPointerException 2
            
// in src/org/argouml/util/MyTokenizer.java
public void putToken(String s) { if (s == null) { throw new NullPointerException("Cannot put a null token"); } putToken = s; }
0 0 3
            
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (NullPointerException e) { dropTargetDragEvent.rejectDrag(); return; }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (NullPointerException e) { // System.err.println("NullPointerException ignored."); }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (NullPointerException e) { // System.err.println("NullPointerException ignored."); }
0 0
unknown (Lib) NumberFormatException 2
            
// in src/org/argouml/ui/ZoomSliderButton.java
private void handleTextEntry() { String value = currentValue.getText(); if (value.endsWith("%")) { value = value.substring(0, value.length() - 1); } try { int newZoom = Integer.parseInt(value); if (newZoom < MINIMUM_ZOOM || newZoom > MAXIMUM_ZOOM) { throw new NumberFormatException(); } slider.setValue(newZoom); } catch (NumberFormatException ex) { updateCurrentValueLabel(); } }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
private static int parseMsgOrder(String s) { int i, t; int v = 0; t = s.length(); for (i = 0; i < t; i++) { char c = s.charAt(i); if (c < 'a' || c > 'z') { throw new NumberFormatException(); } v *= 26; v += c - 'a'; } return v; }
0 0 15
            
// in src/org/argouml/ui/StylePanelFig.java
catch (NumberFormatException ex) { bboxField.setBackground(Color.RED); return null; }
// in src/org/argouml/ui/ZoomSliderButton.java
catch (NumberFormatException ex) { updateCurrentValueLabel(); }
// in src/org/argouml/uml/ui/behavior/state_machines/UMLSynchStateBoundDocument.java
catch (NumberFormatException e) { // ignored - we just skipped inserting it in our document }
// in src/org/argouml/uml/cognitive/critics/WizTooMany.java
catch (NumberFormatException ex) { // intentional: if there is nonsense in the field, // we return false }
// in src/org/argouml/uml/cognitive/critics/WizTooMany.java
catch (NumberFormatException ex) { // intentional: if there is nonsense in the field, // we do not set the value }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NumberFormatException nfe) { }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NumberFormatException nfe) { }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NumberFormatException nfe) { }
// in src/org/argouml/configuration/ConfigurationHandler.java
catch (NumberFormatException nfe) { return defaultValue; }
// in src/org/argouml/configuration/ConfigurationHandler.java
catch (NumberFormatException nfe) { return defaultValue; }
// in src/org/argouml/persistence/ArgoParser.java
catch (NumberFormatException e1) { LOG.error("NumberFormatException while parsing Font Size", e1); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/TodoParser.java
catch (NumberFormatException nfe) { np = ToDoItem.HIGH_PRIORITY; if (TodoTokenTable.STRING_PRIO_HIGH.equalsIgnoreCase(prio)) { np = ToDoItem.HIGH_PRIORITY; } else if (TodoTokenTable.STRING_PRIO_MED.equalsIgnoreCase(prio)) { np = ToDoItem.MED_PRIORITY; } else if (TodoTokenTable.STRING_PRIO_LOW.equalsIgnoreCase(prio)) { np = ToDoItem.LOW_PRIORITY; } }
// in src/org/argouml/persistence/TodoParser.java
catch (NumberFormatException nfe) { // TODO: handle parse error }
2
            
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
0
unknown (Lib) OclException 0 0 0 1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclException oclExc) { // a runtime exception that occurs when some // internal test fails LOG.warn("There was some unidentified problem"); throw oclExc; }
1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclException oclExc) { // a runtime exception that occurs when some // internal test fails LOG.warn("There was some unidentified problem"); throw oclExc; }
0
unknown (Lib) OclParserException 0 0 1
            
// in src/org/argouml/uml/ui/TabConstraints.java
public void setData(String sData, EditingUtilities euHelper) throws OclParserException, OclTypeException { // Parse and check specified constraint. OclTree tree = null; try { Object mmeContext = OCLUtil .getInnerMostEnclosingNamespace(theMMmeiTarget); try { tree = euHelper.parseAndCheckConstraint( sData, new ArgoFacade(mmeContext)); } catch (IOException ioe) { // Ignored: Highly unlikely, and what would we // do anyway? log it LOG.error("problem parsing And Checking Constraints", ioe); return; } // Split constraint body, if user wants us to if (euHelper.getDoAutoSplit()) { List lConstraints = euHelper.splitConstraint(tree); if (lConstraints.size() > 0) { removeConstraintAt(theMNIdx); for (Iterator i = lConstraints.iterator(); i.hasNext();) { OclTree ocltCurrent = (OclTree) i.next(); Object mc = Model.getCoreFactory() .createConstraint(); Model.getCoreHelper().setName(mc, ocltCurrent .getConstraintName()); Model.getCoreHelper().setBody(mc, Model.getDataTypesFactory() .createBooleanExpression( "OCL", ocltCurrent .getExpression())); Model.getCoreHelper().addConstraint( theMMmeiTarget, mc); // the constraint _must_ be owned by a namespace if (Model.getFacade().getNamespace( theMMmeiTarget) != null) { Model.getCoreHelper().addOwnedElement( Model.getFacade().getNamespace( theMMmeiTarget), mc); } else if (Model.getFacade().getNamespace( mmeContext) != null) { Model.getCoreHelper().addOwnedElement( Model.getFacade().getNamespace( mmeContext), theMMcConstraint); } theMAlConstraints.add(mc); fireConstraintAdded(); } return; } } // Store constraint body Object mcOld = null; if (theMMcConstraint == null) { // New constraint, first time setData is called theMMcConstraint = Model.getCoreFactory().createConstraint(); Model.getCoreHelper().setName( theMMcConstraint, "newConstraint"); Model.getCoreHelper().setBody( theMMcConstraint, Model.getDataTypesFactory() .createBooleanExpression("OCL", sData)); Model.getCoreHelper().addConstraint(theMMmeiTarget, theMMcConstraint); // the constraint _must_ be owned by a namespace Object targetNamespace = Model.getFacade().getNamespace(theMMmeiTarget); Object contextNamespace = Model.getFacade().getNamespace(mmeContext); if (targetNamespace != null) { Model.getCoreHelper().addOwnedElement( targetNamespace, theMMcConstraint); } else if (contextNamespace != null) { Model.getCoreHelper().addOwnedElement( contextNamespace, theMMcConstraint); } theMAlConstraints.set(theMNIdx, theMMcConstraint); } else { mcOld = Model.getCoreFactory().createConstraint(); Model.getCoreHelper().setName( mcOld, Model.getFacade().getName(theMMcConstraint)); Model.getCoreHelper().setBody( mcOld, Model.getDataTypesFactory() .createBooleanExpression("OCL", (String) Model.getFacade() .getBody( Model.getFacade().getBody( theMMcConstraint)))); Model.getCoreHelper().setBody(theMMcConstraint, Model.getDataTypesFactory() .createBooleanExpression("OCL", sData)); } fireConstraintDataChanged(theMNIdx, mcOld, theMMcConstraint); } catch (OclTypeException pe) { LOG.warn("There was some sort of OCL Type problem", pe); throw pe; } catch (OclParserException pe1) { LOG.warn("Could not parse the constraint", pe1); throw pe1; } catch (OclException oclExc) { // a runtime exception that occurs when some // internal test fails LOG.warn("There was some unidentified problem"); throw oclExc; } }
1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclParserException pe1) { LOG.warn("Could not parse the constraint", pe1); throw pe1; }
1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclParserException pe1) { LOG.warn("Could not parse the constraint", pe1); throw pe1; }
0
unknown (Lib) OclTypeException 8
            
// in src/org/argouml/ocl/ArgoFacade.java
public Any getClassifier(String name) { Project p = ProjectManager.getManager().getCurrentProject(); if (target != null && Model.getFacade().getName(target).equals(name)) { return new ArgoAny(target); } Object classifier = p.findTypeInModel(name, p.getModel()); if (classifier == null) { /** * Added search in defined types 2001-10-18 STEFFEN ZSCHALER. */ classifier = p.findType(name, false); if (classifier == null) { throw new OclTypeException("cannot find classifier: " + name); } } return new ArgoAny(classifier); }
// in src/org/argouml/ocl/ArgoFacade.java
public Type navigateQualified(String name, Type[] qualifiers) throws OclTypeException { if (classifier == null) { throw new OclTypeException("attempting to access features of Void"); } if (qualifiers != null) { throw new OclTypeException("qualified associations " + "not supported yet!"); } Type type = Basic.navigateAnyQualified(name, this, qualifiers); if (type != null) { return type; } Object foundAssocType = null, foundAttribType = null; // MClassifiers boolean isSet = false, isSequence = false; // cannot be Bag // first search for appropriate attributes Collection attributes = Model.getCoreHelper().getAttributesInh(classifier); Iterator iter = attributes.iterator(); while (iter.hasNext() && foundAttribType == null) { Object attr = iter.next(); if (Model.getFacade().getName(attr).equals(name)) { foundAttribType = Model.getFacade().getType(attr); } } // look for associations Collection associationEnds = Model.getCoreHelper().getAssociateEndsInh(classifier); Iterator asciter = associationEnds.iterator(); while (asciter.hasNext() && foundAssocType == null) { Object ae = asciter.next(); //MAssociationEnd if (Model.getFacade().getName(ae) != null && name.equals(Model.getFacade().getName(ae))) { foundAssocType = Model.getFacade().getType(ae); } else if (Model.getFacade().getName(ae) == null || Model.getFacade().getName(ae).equals("")) { String oppositeName = Model.getFacade().getName(Model.getFacade().getType(ae)); if (oppositeName != null) { String lowerOppositeName = oppositeName.substring(0, 1).toLowerCase(); lowerOppositeName += oppositeName.substring(1); if (lowerOppositeName.equals(name)) { foundAssocType = Model.getFacade().getType(ae); } } } if (foundAssocType != null) { Object multiplicity = Model.getFacade().getMultiplicity(ae); if (multiplicity != null && (Model.getFacade().getUpper(multiplicity) > 1 || Model.getFacade().getUpper(multiplicity) == -1)) { if (Model.getExtensionMechanismsHelper().hasStereotype(ae, "ordered")) { isSequence = true; } else { isSet = true; } } } } if (foundAssocType != null && foundAttribType != null) { throw new OclTypeException("cannot access feature " + name + " of classifier " + toString() + " because both an attribute and " + "an association end of this name " + "where found"); } Object foundType; if (foundAssocType == null) { foundType = foundAttribType; } else { foundType = foundAssocType; } if (foundType == null) { throw new OclTypeException("attribute " + name + " not found in classifier " + toString()); } Type result = getOclRepresentation(foundType); if (isSet) { result = new tudresden.ocl.check.types.Collection( tudresden.ocl.check.types.Collection.SET, result); } if (isSequence) { result = new tudresden.ocl.check.types.Collection( tudresden.ocl.check.types.Collection.SEQUENCE, result); } return result; }
// in src/org/argouml/ocl/ArgoFacade.java
private Type internalNavigateParameterized(final String name, final Type[] params, boolean fCheckIsQuery) throws OclTypeException { if (classifier == null) { throw new OclTypeException("attempting to access features of Void"); } Type type = Basic.navigateAnyParameterized(name, params); if (type != null) { return type; } Object foundOp = null; //MOperation java.util.Collection operations = Model.getFacade().getOperations(classifier); Iterator iter = operations.iterator(); while (iter.hasNext() && foundOp == null) { Object op = iter.next(); if (operationMatchesCall(op, name, params)) { foundOp = op; } } if (foundOp == null) { throw new OclTypeException("operation " + name + " not found in classifier " + toString()); } if (fCheckIsQuery) { /* Query checking added 05/21/01, sz9 */ if (!Model.getFacade().isQuery(foundOp)) { throw new OclTypeException("Non-query operations cannot " + "be used in OCL expressions. (" + name + ")"); } } Collection returnParams = Model.getCoreHelper().getReturnParameters(foundOp); Object rp; if (returnParams.size() == 0) { rp = null; } else { rp = returnParams.iterator().next(); } if (returnParams.size() > 1) { LOG.warn("OCL compiler only handles one return parameter" + " - Found " + returnParams.size() + " for " + Model.getFacade().getName(foundOp)); } if (rp == null || Model.getFacade().getType(rp) == null) { LOG.warn("WARNING: supposing return type void!"); return new ArgoAny(null); } Object returnType = Model.getFacade().getType(rp); return getOclRepresentation(returnType); }
0 5
            
// in src/org/argouml/ocl/ArgoFacade.java
public Type navigateQualified(String name, Type[] qualifiers) throws OclTypeException { if (classifier == null) { throw new OclTypeException("attempting to access features of Void"); } if (qualifiers != null) { throw new OclTypeException("qualified associations " + "not supported yet!"); } Type type = Basic.navigateAnyQualified(name, this, qualifiers); if (type != null) { return type; } Object foundAssocType = null, foundAttribType = null; // MClassifiers boolean isSet = false, isSequence = false; // cannot be Bag // first search for appropriate attributes Collection attributes = Model.getCoreHelper().getAttributesInh(classifier); Iterator iter = attributes.iterator(); while (iter.hasNext() && foundAttribType == null) { Object attr = iter.next(); if (Model.getFacade().getName(attr).equals(name)) { foundAttribType = Model.getFacade().getType(attr); } } // look for associations Collection associationEnds = Model.getCoreHelper().getAssociateEndsInh(classifier); Iterator asciter = associationEnds.iterator(); while (asciter.hasNext() && foundAssocType == null) { Object ae = asciter.next(); //MAssociationEnd if (Model.getFacade().getName(ae) != null && name.equals(Model.getFacade().getName(ae))) { foundAssocType = Model.getFacade().getType(ae); } else if (Model.getFacade().getName(ae) == null || Model.getFacade().getName(ae).equals("")) { String oppositeName = Model.getFacade().getName(Model.getFacade().getType(ae)); if (oppositeName != null) { String lowerOppositeName = oppositeName.substring(0, 1).toLowerCase(); lowerOppositeName += oppositeName.substring(1); if (lowerOppositeName.equals(name)) { foundAssocType = Model.getFacade().getType(ae); } } } if (foundAssocType != null) { Object multiplicity = Model.getFacade().getMultiplicity(ae); if (multiplicity != null && (Model.getFacade().getUpper(multiplicity) > 1 || Model.getFacade().getUpper(multiplicity) == -1)) { if (Model.getExtensionMechanismsHelper().hasStereotype(ae, "ordered")) { isSequence = true; } else { isSet = true; } } } } if (foundAssocType != null && foundAttribType != null) { throw new OclTypeException("cannot access feature " + name + " of classifier " + toString() + " because both an attribute and " + "an association end of this name " + "where found"); } Object foundType; if (foundAssocType == null) { foundType = foundAttribType; } else { foundType = foundAssocType; } if (foundType == null) { throw new OclTypeException("attribute " + name + " not found in classifier " + toString()); } Type result = getOclRepresentation(foundType); if (isSet) { result = new tudresden.ocl.check.types.Collection( tudresden.ocl.check.types.Collection.SET, result); } if (isSequence) { result = new tudresden.ocl.check.types.Collection( tudresden.ocl.check.types.Collection.SEQUENCE, result); } return result; }
// in src/org/argouml/ocl/ArgoFacade.java
public Type navigateParameterizedQuery (String name, Type[] qualifiers) throws OclTypeException { return internalNavigateParameterized(name, qualifiers, true); }
// in src/org/argouml/ocl/ArgoFacade.java
public Type navigateParameterized (String name, Type[] qualifiers) throws OclTypeException { return internalNavigateParameterized(name, qualifiers, false); }
// in src/org/argouml/ocl/ArgoFacade.java
private Type internalNavigateParameterized(final String name, final Type[] params, boolean fCheckIsQuery) throws OclTypeException { if (classifier == null) { throw new OclTypeException("attempting to access features of Void"); } Type type = Basic.navigateAnyParameterized(name, params); if (type != null) { return type; } Object foundOp = null; //MOperation java.util.Collection operations = Model.getFacade().getOperations(classifier); Iterator iter = operations.iterator(); while (iter.hasNext() && foundOp == null) { Object op = iter.next(); if (operationMatchesCall(op, name, params)) { foundOp = op; } } if (foundOp == null) { throw new OclTypeException("operation " + name + " not found in classifier " + toString()); } if (fCheckIsQuery) { /* Query checking added 05/21/01, sz9 */ if (!Model.getFacade().isQuery(foundOp)) { throw new OclTypeException("Non-query operations cannot " + "be used in OCL expressions. (" + name + ")"); } } Collection returnParams = Model.getCoreHelper().getReturnParameters(foundOp); Object rp; if (returnParams.size() == 0) { rp = null; } else { rp = returnParams.iterator().next(); } if (returnParams.size() > 1) { LOG.warn("OCL compiler only handles one return parameter" + " - Found " + returnParams.size() + " for " + Model.getFacade().getName(foundOp)); } if (rp == null || Model.getFacade().getType(rp) == null) { LOG.warn("WARNING: supposing return type void!"); return new ArgoAny(null); } Object returnType = Model.getFacade().getType(rp); return getOclRepresentation(returnType); }
// in src/org/argouml/uml/ui/TabConstraints.java
public void setData(String sData, EditingUtilities euHelper) throws OclParserException, OclTypeException { // Parse and check specified constraint. OclTree tree = null; try { Object mmeContext = OCLUtil .getInnerMostEnclosingNamespace(theMMmeiTarget); try { tree = euHelper.parseAndCheckConstraint( sData, new ArgoFacade(mmeContext)); } catch (IOException ioe) { // Ignored: Highly unlikely, and what would we // do anyway? log it LOG.error("problem parsing And Checking Constraints", ioe); return; } // Split constraint body, if user wants us to if (euHelper.getDoAutoSplit()) { List lConstraints = euHelper.splitConstraint(tree); if (lConstraints.size() > 0) { removeConstraintAt(theMNIdx); for (Iterator i = lConstraints.iterator(); i.hasNext();) { OclTree ocltCurrent = (OclTree) i.next(); Object mc = Model.getCoreFactory() .createConstraint(); Model.getCoreHelper().setName(mc, ocltCurrent .getConstraintName()); Model.getCoreHelper().setBody(mc, Model.getDataTypesFactory() .createBooleanExpression( "OCL", ocltCurrent .getExpression())); Model.getCoreHelper().addConstraint( theMMmeiTarget, mc); // the constraint _must_ be owned by a namespace if (Model.getFacade().getNamespace( theMMmeiTarget) != null) { Model.getCoreHelper().addOwnedElement( Model.getFacade().getNamespace( theMMmeiTarget), mc); } else if (Model.getFacade().getNamespace( mmeContext) != null) { Model.getCoreHelper().addOwnedElement( Model.getFacade().getNamespace( mmeContext), theMMcConstraint); } theMAlConstraints.add(mc); fireConstraintAdded(); } return; } } // Store constraint body Object mcOld = null; if (theMMcConstraint == null) { // New constraint, first time setData is called theMMcConstraint = Model.getCoreFactory().createConstraint(); Model.getCoreHelper().setName( theMMcConstraint, "newConstraint"); Model.getCoreHelper().setBody( theMMcConstraint, Model.getDataTypesFactory() .createBooleanExpression("OCL", sData)); Model.getCoreHelper().addConstraint(theMMmeiTarget, theMMcConstraint); // the constraint _must_ be owned by a namespace Object targetNamespace = Model.getFacade().getNamespace(theMMmeiTarget); Object contextNamespace = Model.getFacade().getNamespace(mmeContext); if (targetNamespace != null) { Model.getCoreHelper().addOwnedElement( targetNamespace, theMMcConstraint); } else if (contextNamespace != null) { Model.getCoreHelper().addOwnedElement( contextNamespace, theMMcConstraint); } theMAlConstraints.set(theMNIdx, theMMcConstraint); } else { mcOld = Model.getCoreFactory().createConstraint(); Model.getCoreHelper().setName( mcOld, Model.getFacade().getName(theMMcConstraint)); Model.getCoreHelper().setBody( mcOld, Model.getDataTypesFactory() .createBooleanExpression("OCL", (String) Model.getFacade() .getBody( Model.getFacade().getBody( theMMcConstraint)))); Model.getCoreHelper().setBody(theMMcConstraint, Model.getDataTypesFactory() .createBooleanExpression("OCL", sData)); } fireConstraintDataChanged(theMNIdx, mcOld, theMMcConstraint); } catch (OclTypeException pe) { LOG.warn("There was some sort of OCL Type problem", pe); throw pe; } catch (OclParserException pe1) { LOG.warn("Could not parse the constraint", pe1); throw pe1; } catch (OclException oclExc) { // a runtime exception that occurs when some // internal test fails LOG.warn("There was some unidentified problem"); throw oclExc; } }
1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclTypeException pe) { LOG.warn("There was some sort of OCL Type problem", pe); throw pe; }
1
            
// in src/org/argouml/uml/ui/TabConstraints.java
catch (OclTypeException pe) { LOG.warn("There was some sort of OCL Type problem", pe); throw pe; }
0
checked (Domain) OpenException
public class OpenException extends PersistenceException {

    /**
     * The constructor.
     *
     * @param message the message to show
     */
    public OpenException(String message) {
        super(message);
    }

    /**
     * The constructor.
     *
     * @param message the message to show
     * @param cause the cause for the exception
     */
    public OpenException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * The constructor.
     *
     * @param cause the cause for the exception
     */
    public OpenException(Throwable cause) {
        super(cause);
    }


    /*
     * @see java.lang.Throwable#printStackTrace()
     */
    public void printStackTrace() {
        super.printStackTrace();
        if (getCause() instanceof SAXException
                && ((SAXException) getCause()).getException() != null) {
            ((SAXException) getCause()).getException().printStackTrace();
        }
    }

    /*
     * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
     */
    public void printStackTrace(PrintStream ps) {
        super.printStackTrace(ps);
        if (getCause() instanceof SAXException
                && ((SAXException) getCause()).getException() != null) {
            ((SAXException) getCause()).getException().printStackTrace(ps);
        }
    }

    /*
     * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
     */
    public void printStackTrace(PrintWriter pw) {
        super.printStackTrace(pw);
        if (getCause() instanceof SAXException
                && ((SAXException) getCause()).getException() != null) {
            ((SAXException) getCause()).getException().printStackTrace(pw);
        }
    }

    /**
     * The UID.
     */
    private static final long serialVersionUID = -4787911270548948677L;
}
30
            
// in src/org/argouml/persistence/XmiFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { LOG.info("Loading with XMIFilePersister"); try { Project p = ProjectFactory.getInstance().createProject(); long length = file.length(); long phaseSpace = 100000; int phases = (int) (length / phaseSpace); if (phases < 10) { phaseSpace = length / 10; phases = 10; } LOG.info("File length is " + length + " phase space is " + phaseSpace + " phases is " + phases); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(phases); ThreadUtils.checkIfInterrupted(); InputSource source = new InputSource(new XmiInputStream(file .toURI().toURL().openStream(), this, phaseSpace, progressMgr)); source.setSystemId(file.toURI().toURL().toString()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(source); Object model = modelPersister.getCurModel(); progressMgr.nextPhase(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); // TODO Handle multiple top level packages p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); p.updateRoots(); File defaultProjectFile = new File(file.getPath() + ".zargo"); // Make sure the file doesn't exist so the user will // get prompted to choose a new name for (int i = 0; i < 99; i++) { if (!defaultProjectFile.exists()) { break; } defaultProjectFile = new File(file.getPath() + "." + i + ".zargo"); } PersistenceManager.getInstance().setProjectURI( defaultProjectFile.toURI(), p); progressMgr.nextPhase(); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/XmiFilePersister.java
public void parseXmiExtensions(Project project) throws OpenException { if (argoString != null) { LOG.info("Parsing argoString " + argoString.length()); StringReader inputStream = new StringReader(argoString); ArgoParser parser = new ArgoParser(); try { parser.readProject(project, inputStream); } catch (Exception e) { throw new OpenException("Exception caught", e); } } else { project.addMember(new ProjectMemberTodoList("", project)); } for (String pgml : pgmlStrings) { LOG.info("Parsing pgml " + pgml.length()); InputStream inputStream = new ByteArrayInputStream(pgml.getBytes()); MemberFilePersister persister = // TODO: Cyclic dependency between PersistanceManager and here PersistenceManager.getInstance() .getDiagramMemberFilePersister(); // possibly use the following instead // MemberFilePersister persister = new DiagramMemberFilePersister(); persister.load(project, inputStream); } if (todoString != null) { LOG.info("Parsing todoString " + todoString.length()); InputStream inputStream = new ByteArrayInputStream(todoString.getBytes()); MemberFilePersister persister = null; persister = new TodoListMemberFilePersister(); persister.load(project, inputStream); } else { project.addMember(new ProjectMemberTodoList("", project)); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public Project doLoad(File file) throws OpenException, InterruptedException { ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(3 + UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); int fileVersion; String releaseVersion; try { String argoEntry = getEntryNames(file, ".argo").iterator().next(); URL argoUrl = makeZipEntryUrl(toURL(file), argoEntry); fileVersion = getPersistenceVersion(argoUrl.openStream()); releaseVersion = getReleaseVersion(argoUrl.openStream()); } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } // TODO: The commented code below was commented out by Bob Tarling // in order to resolve bugs 4845 and 4857. Hopefully we can // determine the cause and reintroduce. //boolean upgradeRequired = !checkVersion(fileVersion, releaseVersion) boolean upgradeRequired = true; // Upgrade is in the way for UML2 projects, so we turn it off in that case: if (Model.getFacade().getUmlVersion().charAt(0) == '2') { upgradeRequired = false; } LOG.info("Loading zargo file of version " + fileVersion); final Project p; if (upgradeRequired) { File combinedFile = zargoToUml(file, progressMgr); p = super.doLoad(file, combinedFile, progressMgr); } else { p = loadFromZargo(file, progressMgr); } progressMgr.nextPhase(); PersistenceManager.getInstance().setProjectURI(file.toURI(), p); return p; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private Project loadFromZargo(File file, ProgressMgr progressMgr) throws OpenException { Project p = ProjectFactory.getInstance().createProject(file.toURI()); try { progressMgr.nextPhase(); // Load .argo project descriptor ArgoParser parser = new ArgoParser(); String argoEntry = getEntryNames(file, ".argo").iterator().next(); parser.readProject(p, new InputSource(makeZipEntryUrl(toURL(file), argoEntry).toExternalForm())); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); // Load .xmi file before any PGML files // FIXME: the following is loading the model before anything else. // Due to the Zargo containing the profiles, currently we have // removed this hack in UmlFilePersister and I think it should be // removed from here also. String xmiEntry = getEntryNames(file, ".xmi").iterator().next(); MemberFilePersister persister = getMemberFilePersister("xmi"); URL url = makeZipEntryUrl(toURL(file), xmiEntry); persister.load(p, new InputSource(url.toExternalForm())); // Load the rest List<String> entries = getEntryNames(file, null); for (String name : entries) { String ext = name.substring(name.lastIndexOf('.') + 1); if (!"argo".equals(ext) && !"xmi".equals(ext)) { persister = getMemberFilePersister(ext); LOG.info("Loading member with " + persister.getClass().getName()); url = makeZipEntryUrl(toURL(file), name); persister.load(p, new InputSource(url.toExternalForm())); } } progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); p.postLoad(); return p; } catch (InterruptedException e) { return null; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
private File zargoToUml(File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { File combinedFile = null; try { combinedFile = File.createTempFile("combinedzargo_", ".uml"); LOG.info( "Combining old style zargo sub files into new style uml file " + combinedFile.getAbsolutePath()); combinedFile.deleteOnExit(); String encoding = Argo.getEncoding(); FileOutputStream stream = new FileOutputStream(combinedFile); PrintWriter writer = new PrintWriter(new BufferedWriter( new OutputStreamWriter(stream, encoding))); writer.println("<?xml version = \"1.0\" " + "encoding = \"" + encoding + "\" ?>"); copyArgo(file, encoding, writer); progressMgr.nextPhase(); copyMember(file, "profile", encoding, writer); copyXmi(file, encoding, writer); copyDiagrams(file, encoding, writer); // Copy the todo items after the model and diagrams so that // any model elements or figs that the todo items refer to // will exist before creating critics. copyMember(file, "todo", encoding, writer); progressMgr.nextPhase(); writer.println("</uml>"); writer.close(); LOG.info("Completed combining files"); } catch (IOException e) { throw new OpenException(e); } return combinedFile; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyArgo(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, OpenException, UnsupportedEncodingException { int pgmlCount = getPgmlCount(file); boolean containsToDo = containsTodo(file); boolean containsProfile = containsProfile(file); // first read the .argo file from Zip ZipInputStream zis = openZipStreamAt(toURL(file), FileConstants.PROJECT_FILE_EXT); if (zis == null) { throw new OpenException( "There is no .argo file in the .zargo"); } String line; BufferedReader reader = new BufferedReader(new InputStreamReader(zis, encoding)); // Keep reading till we hit the <argo> tag String rootLine; do { rootLine = reader.readLine(); if (rootLine == null) { throw new OpenException( "Can't find an <argo> tag in the argo file"); } } while(!rootLine.startsWith("<argo")); // Get the version from the tag. String version = getVersion(rootLine); writer.println("<uml version=\"" + version + "\">"); writer.println(rootLine); LOG.info("Transfering argo contents"); int memberCount = 0; while ((line = reader.readLine()) != null) { if (line.trim().startsWith("<member")) { ++memberCount; } if (line.trim().equals("</argo>") && memberCount == 0) { LOG.info("Inserting member info"); writer.println("<member type='xmi' name='.xmi' />"); for (int i = 0; i < pgmlCount; ++i) { writer.println("<member type='pgml' name='.pgml' />"); } if (containsToDo) { writer.println("<member type='todo' name='.todo' />"); } if (containsProfile) { String type = ProfileConfiguration.EXTENSION; writer.println("<member type='" + type + "' name='." + type + "' />"); } } writer.println(line); } if (LOG.isInfoEnabled()) { LOG.info("Member count = " + memberCount); } zis.close(); reader.close(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void load(Project project, InputSource inputSource) throws OpenException { try { ProfileConfigurationParser parser = new ProfileConfigurationParser(); parser.parse(inputSource); Collection<Profile> profiles = parser.getProfiles(); Collection<String> unresolved = parser.getUnresolvedFilenames(); if (!unresolved.isEmpty()) { profiles.addAll(loadUnresolved(unresolved)); } ProfileConfiguration pc = new ProfileConfiguration(project, profiles); project.setProfileConfiguration(pc); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void load(Project project, InputStream inputStream) throws OpenException { try { load(project, new InputSource(new InputStreamReader(inputStream, Argo.getEncoding()))); } catch (UnsupportedEncodingException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void load(Project project, InputSource inputSource) throws OpenException { try { TodoParser parser = new TodoParser(); parser.readTodoList(inputSource); ProjectMemberTodoList pm = new ProjectMemberTodoList("", project); project.addMember(pm); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public synchronized void readModels(URL url, XmiExtensionParser xmiExtensionParser) throws OpenException { LOG.info("======================================="); LOG.info("== READING MODEL " + url); try { // TODO: What progressMgr is to be used here? Where does // it come from? InputSource source = new InputSource(new XmiInputStream( url.openStream(), xmiExtensionParser, 100000, null)); source.setSystemId(url.toString()); readModels(source); } catch (IOException ex) { throw new OpenException(ex); } }
// in src/org/argouml/persistence/ZipFilePersister.java
public Project doLoad(File file) throws OpenException { LOG.info("Receiving file '" + file.getName() + "'"); try { Project p = ProjectFactory.getInstance().createProject(); String fileName = file.getName(); String extension = fileName.substring( fileName.indexOf('.'), fileName.lastIndexOf('.')); InputStream stream = openZipStreamAt(file.toURI().toURL(), extension); // TODO: What progressMgr is to be used here? Where does // it come from? InputSource is = new InputSource( new XmiInputStream(stream, this, 100000, null)); is.setSystemId(file.toURI().toURL().toExternalForm()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(is); // TODO Handle multiple top level packages Object model = modelPersister.getCurModel(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected Project doLoad(File originalFile, File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { XmlInputStream inputStream = null; try { Project p = ProjectFactory.getInstance() .createProject(file.toURI()); // Run through any stylesheet upgrades int fileVersion = getPersistenceVersionFromFile(file); LOG.info("Loading uml file of version " + fileVersion); if (!checkVersion(fileVersion, getReleaseVersionFromFile(file))) { // If we're about to upgrade the file lets take an archive // of it first. String release = getReleaseVersionFromFile(file); copyFile(originalFile, new File(originalFile.getAbsolutePath() + '~' + release)); progressMgr.setNumberOfPhases(progressMgr.getNumberOfPhases() + (PERSISTENCE_VERSION - fileVersion)); while (fileVersion < PERSISTENCE_VERSION) { ++fileVersion; LOG.info("Upgrading to version " + fileVersion); long startTime = System.currentTimeMillis(); file = transform(file, fileVersion); long endTime = System.currentTimeMillis(); LOG.info("Upgrading took " + ((endTime - startTime) / 1000) + " seconds"); progressMgr.nextPhase(); } } progressMgr.nextPhase(); inputStream = new XmlInputStream(file.toURI().toURL().openStream(), "argo", file.length(), 100000); ArgoParser parser = new ArgoParser(); Reader reader = new InputStreamReader(inputStream, Argo .getEncoding()); parser.readProject(p, reader); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); for (int i = 0; i < memberList.size(); ++i) { MemberFilePersister persister = getMemberFilePersister((String) memberList .get(i)); LOG.info("Loading member with " + persister.getClass().getName()); inputStream.reopen(persister.getMainTag()); // TODO: Do we need to set the input encoding here? It was // done for ToDo parsing, but none of the other member types // InputSource inputSource = new InputSource( // new InputStreamReader(inputStream, Argo // .getEncoding())); InputSource inputSource = new InputSource(inputStream); // Don't use systemId here or it will get opened in preference // to inputStream. inputSource.setPublicId(originalFile.toURI().toURL() .toExternalForm()); try { persister.load(p, inputSource); } catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } } } // let's update the progress progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); inputStream.realClose(); p.postLoad(); return p; } catch (InterruptedException e) { throw e; } catch (OpenException e) { throw e; } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public final File transform(File file, int version) throws OpenException { try { String upgradeFilesPath = "/org/argouml/persistence/upgrades/"; String upgradeFile = "upgrade" + version + ".xsl"; String xsltFileName = upgradeFilesPath + upgradeFile; URL xsltUrl = UmlFilePersister.class.getResource(xsltFileName); LOG.info("Resource is " + xsltUrl); // Read xsltStream into a temporary file // Get url for temp file. // openStream from url and wrap in StreamSource StreamSource xsltStreamSource = new StreamSource(xsltUrl .openStream()); xsltStreamSource.setSystemId(xsltUrl.toExternalForm()); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(xsltStreamSource); File transformedFile = File.createTempFile("upgrade_" + version + "_", ".uml"); transformedFile.deleteOnExit(); FileOutputStream stream = new FileOutputStream(transformedFile); Writer writer = new BufferedWriter(new OutputStreamWriter(stream, Argo.getEncoding())); Result result = new StreamResult(writer); StreamSource inputStreamSource = new StreamSource(file); inputStreamSource.setSystemId(file); transformer.transform(inputStreamSource, result); writer.close(); return transformedFile; } catch (IOException e) { throw new OpenException(e); } catch (TransformerException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
private int getPersistenceVersionFromFile(File file) throws OpenException { InputStream stream = null; try { stream = new BufferedInputStream(file.toURI().toURL().openStream()); int version = getPersistenceVersion(stream); stream.close(); return version; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected int getPersistenceVersion(InputStream inputStream) throws OpenException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream, Argo .getEncoding())); String rootLine = reader.readLine(); while (rootLine != null && !rootLine.trim().startsWith("<argo ")) { rootLine = reader.readLine(); } if (rootLine == null) { return 1; } return Integer.parseInt(getVersion(rootLine)); } catch (IOException e) { throw new OpenException(e); } catch (NumberFormatException e) { throw new OpenException(e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } } }
// in src/org/argouml/persistence/UmlFilePersister.java
private String getReleaseVersionFromFile(File file) throws OpenException { InputStream stream = null; try { stream = new BufferedInputStream(file.toURI().toURL().openStream()); String version = getReleaseVersion(stream); stream.close(); return version; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected String getReleaseVersion(InputStream inputStream) throws OpenException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream, Argo .getEncoding())); String versionLine = reader.readLine(); while (!versionLine.trim().startsWith("<version>")) { versionLine = reader.readLine(); if (versionLine == null) { throw new OpenException( "Failed to find the release <version> tag"); } } versionLine = versionLine.trim(); int end = versionLine.lastIndexOf("</version>"); return versionLine.trim().substring(9, end); } catch (IOException e) { throw new OpenException(e); } catch (NumberFormatException e) { throw new OpenException(e); } finally { try { if (inputStream != null) { inputStream.close(); } if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, InputStream inputStream) throws OpenException { load(project, new InputSource(inputStream)); try { inputStream.close(); } catch (IOException e) { throw new OpenException("I/O error on stream close", e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, InputSource inputSource) throws OpenException { // If the model repository doesn't manage a DI model // then we must generate our Figs by inspecting PGML try { // Give the parser a map of model elements // keyed by their UUID. This is used to allocate // figs to their owner using the "href" attribute // in PGML. DiagramSettings defaultSettings = project.getProjectSettings().getDefaultDiagramSettings(); // TODO: We need the project specific diagram settings here PGMLStackParser parser = new PGMLStackParser(project.getUUIDRefs(), defaultSettings); LOG.info("Adding translations registered by modules"); for (Map.Entry<String, String> translation : CLASS_TRANSLATIONS.entrySet()) { parser.addTranslation( translation.getKey(), translation.getValue()); } ArgoDiagram d = parser.readArgoDiagram(inputSource, false); project.addMember(d); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
27
            
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { throw new OpenException("Exception caught", e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException ex) { throw new OpenException(ex); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (TransformerException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (MalformedURLException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (NumberFormatException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new OpenException("I/O error on stream close", e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); }
29
            
// in src/org/argouml/persistence/XmiFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { LOG.info("Loading with XMIFilePersister"); try { Project p = ProjectFactory.getInstance().createProject(); long length = file.length(); long phaseSpace = 100000; int phases = (int) (length / phaseSpace); if (phases < 10) { phaseSpace = length / 10; phases = 10; } LOG.info("File length is " + length + " phase space is " + phaseSpace + " phases is " + phases); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(phases); ThreadUtils.checkIfInterrupted(); InputSource source = new InputSource(new XmiInputStream(file .toURI().toURL().openStream(), this, phaseSpace, progressMgr)); source.setSystemId(file.toURI().toURL().toString()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(source); Object model = modelPersister.getCurModel(); progressMgr.nextPhase(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); // TODO Handle multiple top level packages p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); p.updateRoots(); File defaultProjectFile = new File(file.getPath() + ".zargo"); // Make sure the file doesn't exist so the user will // get prompted to choose a new name for (int i = 0; i < 99; i++) { if (!defaultProjectFile.exists()) { break; } defaultProjectFile = new File(file.getPath() + "." + i + ".zargo"); } PersistenceManager.getInstance().setProjectURI( defaultProjectFile.toURI(), p); progressMgr.nextPhase(); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/XmiFilePersister.java
public void parseXmiExtensions(Project project) throws OpenException { if (argoString != null) { LOG.info("Parsing argoString " + argoString.length()); StringReader inputStream = new StringReader(argoString); ArgoParser parser = new ArgoParser(); try { parser.readProject(project, inputStream); } catch (Exception e) { throw new OpenException("Exception caught", e); } } else { project.addMember(new ProjectMemberTodoList("", project)); } for (String pgml : pgmlStrings) { LOG.info("Parsing pgml " + pgml.length()); InputStream inputStream = new ByteArrayInputStream(pgml.getBytes()); MemberFilePersister persister = // TODO: Cyclic dependency between PersistanceManager and here PersistenceManager.getInstance() .getDiagramMemberFilePersister(); // possibly use the following instead // MemberFilePersister persister = new DiagramMemberFilePersister(); persister.load(project, inputStream); } if (todoString != null) { LOG.info("Parsing todoString " + todoString.length()); InputStream inputStream = new ByteArrayInputStream(todoString.getBytes()); MemberFilePersister persister = null; persister = new TodoListMemberFilePersister(); persister.load(project, inputStream); } else { project.addMember(new ProjectMemberTodoList("", project)); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public Project doLoad(File file) throws OpenException, InterruptedException { ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(3 + UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); int fileVersion; String releaseVersion; try { String argoEntry = getEntryNames(file, ".argo").iterator().next(); URL argoUrl = makeZipEntryUrl(toURL(file), argoEntry); fileVersion = getPersistenceVersion(argoUrl.openStream()); releaseVersion = getReleaseVersion(argoUrl.openStream()); } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } // TODO: The commented code below was commented out by Bob Tarling // in order to resolve bugs 4845 and 4857. Hopefully we can // determine the cause and reintroduce. //boolean upgradeRequired = !checkVersion(fileVersion, releaseVersion) boolean upgradeRequired = true; // Upgrade is in the way for UML2 projects, so we turn it off in that case: if (Model.getFacade().getUmlVersion().charAt(0) == '2') { upgradeRequired = false; } LOG.info("Loading zargo file of version " + fileVersion); final Project p; if (upgradeRequired) { File combinedFile = zargoToUml(file, progressMgr); p = super.doLoad(file, combinedFile, progressMgr); } else { p = loadFromZargo(file, progressMgr); } progressMgr.nextPhase(); PersistenceManager.getInstance().setProjectURI(file.toURI(), p); return p; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private Project loadFromZargo(File file, ProgressMgr progressMgr) throws OpenException { Project p = ProjectFactory.getInstance().createProject(file.toURI()); try { progressMgr.nextPhase(); // Load .argo project descriptor ArgoParser parser = new ArgoParser(); String argoEntry = getEntryNames(file, ".argo").iterator().next(); parser.readProject(p, new InputSource(makeZipEntryUrl(toURL(file), argoEntry).toExternalForm())); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); // Load .xmi file before any PGML files // FIXME: the following is loading the model before anything else. // Due to the Zargo containing the profiles, currently we have // removed this hack in UmlFilePersister and I think it should be // removed from here also. String xmiEntry = getEntryNames(file, ".xmi").iterator().next(); MemberFilePersister persister = getMemberFilePersister("xmi"); URL url = makeZipEntryUrl(toURL(file), xmiEntry); persister.load(p, new InputSource(url.toExternalForm())); // Load the rest List<String> entries = getEntryNames(file, null); for (String name : entries) { String ext = name.substring(name.lastIndexOf('.') + 1); if (!"argo".equals(ext) && !"xmi".equals(ext)) { persister = getMemberFilePersister(ext); LOG.info("Loading member with " + persister.getClass().getName()); url = makeZipEntryUrl(toURL(file), name); persister.load(p, new InputSource(url.toExternalForm())); } } progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); p.postLoad(); return p; } catch (InterruptedException e) { return null; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
private File zargoToUml(File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { File combinedFile = null; try { combinedFile = File.createTempFile("combinedzargo_", ".uml"); LOG.info( "Combining old style zargo sub files into new style uml file " + combinedFile.getAbsolutePath()); combinedFile.deleteOnExit(); String encoding = Argo.getEncoding(); FileOutputStream stream = new FileOutputStream(combinedFile); PrintWriter writer = new PrintWriter(new BufferedWriter( new OutputStreamWriter(stream, encoding))); writer.println("<?xml version = \"1.0\" " + "encoding = \"" + encoding + "\" ?>"); copyArgo(file, encoding, writer); progressMgr.nextPhase(); copyMember(file, "profile", encoding, writer); copyXmi(file, encoding, writer); copyDiagrams(file, encoding, writer); // Copy the todo items after the model and diagrams so that // any model elements or figs that the todo items refer to // will exist before creating critics. copyMember(file, "todo", encoding, writer); progressMgr.nextPhase(); writer.println("</uml>"); writer.close(); LOG.info("Completed combining files"); } catch (IOException e) { throw new OpenException(e); } return combinedFile; }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyArgo(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, OpenException, UnsupportedEncodingException { int pgmlCount = getPgmlCount(file); boolean containsToDo = containsTodo(file); boolean containsProfile = containsProfile(file); // first read the .argo file from Zip ZipInputStream zis = openZipStreamAt(toURL(file), FileConstants.PROJECT_FILE_EXT); if (zis == null) { throw new OpenException( "There is no .argo file in the .zargo"); } String line; BufferedReader reader = new BufferedReader(new InputStreamReader(zis, encoding)); // Keep reading till we hit the <argo> tag String rootLine; do { rootLine = reader.readLine(); if (rootLine == null) { throw new OpenException( "Can't find an <argo> tag in the argo file"); } } while(!rootLine.startsWith("<argo")); // Get the version from the tag. String version = getVersion(rootLine); writer.println("<uml version=\"" + version + "\">"); writer.println(rootLine); LOG.info("Transfering argo contents"); int memberCount = 0; while ((line = reader.readLine()) != null) { if (line.trim().startsWith("<member")) { ++memberCount; } if (line.trim().equals("</argo>") && memberCount == 0) { LOG.info("Inserting member info"); writer.println("<member type='xmi' name='.xmi' />"); for (int i = 0; i < pgmlCount; ++i) { writer.println("<member type='pgml' name='.pgml' />"); } if (containsToDo) { writer.println("<member type='todo' name='.todo' />"); } if (containsProfile) { String type = ProfileConfiguration.EXTENSION; writer.println("<member type='" + type + "' name='." + type + "' />"); } } writer.println(line); } if (LOG.isInfoEnabled()) { LOG.info("Member count = " + memberCount); } zis.close(); reader.close(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void load(Project project, InputStream inputStream) throws OpenException { load(project, new InputSource(inputStream)); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void load(Project project, InputSource inputSource) throws OpenException { try { ProfileConfigurationParser parser = new ProfileConfigurationParser(); parser.parse(inputSource); Collection<Profile> profiles = parser.getProfiles(); Collection<String> unresolved = parser.getUnresolvedFilenames(); if (!unresolved.isEmpty()) { profiles.addAll(loadUnresolved(unresolved)); } ProfileConfiguration pc = new ProfileConfiguration(project, profiles); project.setProfileConfiguration(pc); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
Override public void load(Project project, URL url) throws OpenException { load(project, new InputSource(url.toExternalForm())); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void load(Project project, InputStream inputStream) throws OpenException { try { load(project, new InputSource(new InputStreamReader(inputStream, Argo.getEncoding()))); } catch (UnsupportedEncodingException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void load(Project project, InputSource inputSource) throws OpenException { try { TodoParser parser = new TodoParser(); parser.readTodoList(inputSource); ProjectMemberTodoList pm = new ProjectMemberTodoList("", project); project.addMember(pm); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
Override public void load(Project project, URL url) throws OpenException { load(project, new InputSource(url.toExternalForm())); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void load(Project project, URL url) throws OpenException { load(project, new InputSource(url.toExternalForm())); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void load(Project project, InputStream inputStream) throws OpenException { load(project, new InputSource(inputStream)); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void load(Project project, InputSource source) throws OpenException { Object mmodel = null; // 2002-07-18 // Jaap Branderhorst // changed the loading of the projectfiles to solve hanging // of argouml if a project is corrupted. Issue 913 // Created xmireader with method getErrors to check if parsing went well try { source.setEncoding(Argo.getEncoding()); readModels(source); mmodel = getCurModel(); } catch (OpenException e) { LOG.error("UmlException caught", e); throw e; } // This should probably be inside xmiReader.parse // but there is another place in this source // where XMIReader is used, but it appears to be // the NSUML XMIReader. When Argo XMIReader is used // consistently, it can be responsible for loading // the listener. Until then, do it here. Model.getUmlHelper().addListenersToModel(mmodel); // TODO Add all top level packages project.addMember(mmodel); project.setUUIDRefs(new HashMap<String, Object>(getUUIDRefs())); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public synchronized void readModels(URL url, XmiExtensionParser xmiExtensionParser) throws OpenException { LOG.info("======================================="); LOG.info("== READING MODEL " + url); try { // TODO: What progressMgr is to be used here? Where does // it come from? InputSource source = new InputSource(new XmiInputStream( url.openStream(), xmiExtensionParser, 100000, null)); source.setSystemId(url.toString()); readModels(source); } catch (IOException ex) { throw new OpenException(ex); } }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public synchronized void readModels(InputSource source) throws OpenException { XmiReader reader = null; try { reader = Model.getXmiReader(); if (Configuration.getBoolean(Argo.KEY_XMI_STRIP_DIAGRAMS, false)) { // TODO: Not implemented by eUML reader.setIgnoredElements(new String[] {"UML:Diagram"}); } else { reader.setIgnoredElements(null); } List<String> searchPath = reader.getSearchPath(); String pathList = System.getProperty("org.argouml.model.modules_search_path"); if (pathList != null) { String[] paths = pathList.split(","); for (String path : paths) { if (!searchPath.contains(path)) { reader.addSearchPath(path); } } } reader.addSearchPath(source.getSystemId()); curModel = null; elementsRead = reader.parse(source, false); if (elementsRead != null && !elementsRead.isEmpty()) { Facade facade = Model.getFacade(); Object current; Iterator elements = elementsRead.iterator(); while (elements.hasNext()) { current = elements.next(); if (facade.isAModel(current)) { LOG.info("Loaded model '" + facade.getName(current) + "'"); if (curModel == null) { curModel = current; } } else if (facade.isAProfile(current)) { LOG.info("Loaded profile '" + facade.getName(current) + "'"); if (curModel == null) { curModel = current; } } // TODO: add stereotype application (eCore AnyType?) } } uUIDRefs = new HashMap<String, Object>(reader.getXMIUUIDToObjectMap()); } catch (XmiException ex) { throw new XmiFormatException(ex); } catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); } LOG.info("======================================="); }
// in src/org/argouml/persistence/ZipFilePersister.java
public Project doLoad(File file) throws OpenException { LOG.info("Receiving file '" + file.getName() + "'"); try { Project p = ProjectFactory.getInstance().createProject(); String fileName = file.getName(); String extension = fileName.substring( fileName.indexOf('.'), fileName.lastIndexOf('.')); InputStream stream = openZipStreamAt(file.toURI().toURL(), extension); // TODO: What progressMgr is to be used here? Where does // it come from? InputSource is = new InputSource( new XmiInputStream(stream, this, 100000, null)); is.setSystemId(file.toURI().toURL().toExternalForm()); ModelMemberFilePersister modelPersister = new ModelMemberFilePersister(); modelPersister.readModels(is); // TODO Handle multiple top level packages Object model = modelPersister.getCurModel(); Model.getUmlHelper().addListenersToModel(model); p.setUUIDRefs(modelPersister.getUUIDRefs()); p.addMember(model); parseXmiExtensions(p); modelPersister.registerDiagrams(p); p.setRoot(model); p.setRoots(modelPersister.getElementsRead()); ProjectManager.getManager().setSaveEnabled(false); return p; } catch (IOException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public Project doLoad(File file) throws OpenException, InterruptedException { // let's initialize the progressMgr ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(UML_PHASES_LOAD); ThreadUtils.checkIfInterrupted(); return doLoad(file, file, progressMgr); }
// in src/org/argouml/persistence/UmlFilePersister.java
protected Project doLoad(File originalFile, File file, ProgressMgr progressMgr) throws OpenException, InterruptedException { XmlInputStream inputStream = null; try { Project p = ProjectFactory.getInstance() .createProject(file.toURI()); // Run through any stylesheet upgrades int fileVersion = getPersistenceVersionFromFile(file); LOG.info("Loading uml file of version " + fileVersion); if (!checkVersion(fileVersion, getReleaseVersionFromFile(file))) { // If we're about to upgrade the file lets take an archive // of it first. String release = getReleaseVersionFromFile(file); copyFile(originalFile, new File(originalFile.getAbsolutePath() + '~' + release)); progressMgr.setNumberOfPhases(progressMgr.getNumberOfPhases() + (PERSISTENCE_VERSION - fileVersion)); while (fileVersion < PERSISTENCE_VERSION) { ++fileVersion; LOG.info("Upgrading to version " + fileVersion); long startTime = System.currentTimeMillis(); file = transform(file, fileVersion); long endTime = System.currentTimeMillis(); LOG.info("Upgrading took " + ((endTime - startTime) / 1000) + " seconds"); progressMgr.nextPhase(); } } progressMgr.nextPhase(); inputStream = new XmlInputStream(file.toURI().toURL().openStream(), "argo", file.length(), 100000); ArgoParser parser = new ArgoParser(); Reader reader = new InputStreamReader(inputStream, Argo .getEncoding()); parser.readProject(p, reader); List memberList = parser.getMemberList(); LOG.info(memberList.size() + " members"); for (int i = 0; i < memberList.size(); ++i) { MemberFilePersister persister = getMemberFilePersister((String) memberList .get(i)); LOG.info("Loading member with " + persister.getClass().getName()); inputStream.reopen(persister.getMainTag()); // TODO: Do we need to set the input encoding here? It was // done for ToDo parsing, but none of the other member types // InputSource inputSource = new InputSource( // new InputStreamReader(inputStream, Argo // .getEncoding())); InputSource inputSource = new InputSource(inputStream); // Don't use systemId here or it will get opened in preference // to inputStream. inputSource.setPublicId(originalFile.toURI().toURL() .toExternalForm()); try { persister.load(p, inputSource); } catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } } } // let's update the progress progressMgr.nextPhase(); ThreadUtils.checkIfInterrupted(); inputStream.realClose(); p.postLoad(); return p; } catch (InterruptedException e) { throw e; } catch (OpenException e) { throw e; } catch (IOException e) { throw new OpenException(e); } catch (SAXException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected boolean checkVersion(int fileVersion, String releaseVersion) throws OpenException, VersionException { // If we're trying to load a file from a future version // complain and refuse. if (fileVersion > PERSISTENCE_VERSION) { throw new VersionException( "The file selected is from a more up to date version of " + "ArgoUML. It has been saved with ArgoUML version " + releaseVersion + ". Please load with that or a more up to date" + "release of ArgoUML"); } return fileVersion >= PERSISTENCE_VERSION; }
// in src/org/argouml/persistence/UmlFilePersister.java
public final File transform(File file, int version) throws OpenException { try { String upgradeFilesPath = "/org/argouml/persistence/upgrades/"; String upgradeFile = "upgrade" + version + ".xsl"; String xsltFileName = upgradeFilesPath + upgradeFile; URL xsltUrl = UmlFilePersister.class.getResource(xsltFileName); LOG.info("Resource is " + xsltUrl); // Read xsltStream into a temporary file // Get url for temp file. // openStream from url and wrap in StreamSource StreamSource xsltStreamSource = new StreamSource(xsltUrl .openStream()); xsltStreamSource.setSystemId(xsltUrl.toExternalForm()); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(xsltStreamSource); File transformedFile = File.createTempFile("upgrade_" + version + "_", ".uml"); transformedFile.deleteOnExit(); FileOutputStream stream = new FileOutputStream(transformedFile); Writer writer = new BufferedWriter(new OutputStreamWriter(stream, Argo.getEncoding())); Result result = new StreamResult(writer); StreamSource inputStreamSource = new StreamSource(file); inputStreamSource.setSystemId(file); transformer.transform(inputStreamSource, result); writer.close(); return transformedFile; } catch (IOException e) { throw new OpenException(e); } catch (TransformerException e) { throw new OpenException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
private int getPersistenceVersionFromFile(File file) throws OpenException { InputStream stream = null; try { stream = new BufferedInputStream(file.toURI().toURL().openStream()); int version = getPersistenceVersion(stream); stream.close(); return version; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected int getPersistenceVersion(InputStream inputStream) throws OpenException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream, Argo .getEncoding())); String rootLine = reader.readLine(); while (rootLine != null && !rootLine.trim().startsWith("<argo ")) { rootLine = reader.readLine(); } if (rootLine == null) { return 1; } return Integer.parseInt(getVersion(rootLine)); } catch (IOException e) { throw new OpenException(e); } catch (NumberFormatException e) { throw new OpenException(e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } } }
// in src/org/argouml/persistence/UmlFilePersister.java
private String getReleaseVersionFromFile(File file) throws OpenException { InputStream stream = null; try { stream = new BufferedInputStream(file.toURI().toURL().openStream()); String version = getReleaseVersion(stream); stream.close(); return version; } catch (MalformedURLException e) { throw new OpenException(e); } catch (IOException e) { throw new OpenException(e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { // ignore } } } }
// in src/org/argouml/persistence/UmlFilePersister.java
protected String getReleaseVersion(InputStream inputStream) throws OpenException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream, Argo .getEncoding())); String versionLine = reader.readLine(); while (!versionLine.trim().startsWith("<version>")) { versionLine = reader.readLine(); if (versionLine == null) { throw new OpenException( "Failed to find the release <version> tag"); } } versionLine = versionLine.trim(); int end = versionLine.lastIndexOf("</version>"); return versionLine.trim().substring(9, end); } catch (IOException e) { throw new OpenException(e); } catch (NumberFormatException e) { throw new OpenException(e); } finally { try { if (inputStream != null) { inputStream.close(); } if (reader != null) { reader.close(); } } catch (IOException e) { // No more we can do here on failure } } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, InputStream inputStream) throws OpenException { load(project, new InputSource(inputStream)); try { inputStream.close(); } catch (IOException e) { throw new OpenException("I/O error on stream close", e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, InputSource inputSource) throws OpenException { // If the model repository doesn't manage a DI model // then we must generate our Figs by inspecting PGML try { // Give the parser a map of model elements // keyed by their UUID. This is used to allocate // figs to their owner using the "href" attribute // in PGML. DiagramSettings defaultSettings = project.getProjectSettings().getDefaultDiagramSettings(); // TODO: We need the project specific diagram settings here PGMLStackParser parser = new PGMLStackParser(project.getUUIDRefs(), defaultSettings); LOG.info("Adding translations registered by modules"); for (Map.Entry<String, String> translation : CLASS_TRANSLATIONS.entrySet()) { parser.addTranslation( translation.getKey(), translation.getValue()); } ArgoDiagram d = parser.readArgoDiagram(inputSource, false); project.addMember(d); } catch (Exception e) { if (e instanceof OpenException) { throw (OpenException) e; } throw new OpenException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void load(Project project, URL url) throws OpenException { load(project, new InputSource(url.toExternalForm())); }
4
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (OpenException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (OpenException e) { LOG.error("UmlException caught", e); throw e; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { throw e; }
3
            
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (OpenException e) { LOG.error("UmlException caught", e); throw e; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { // UML 2.x files could also contain a profile model. // Try again with uml:Profile as main tag. if ("uml:Model".equals(persister.getMainTag()) && e.getCause() instanceof UmlException && e.getCause().getCause() instanceof IOException) { inputStream.reopen("uml:Profile"); persister.load(p, inputSource); p.setProjectType(Project.PROFILE_PROJECT); } else { throw e; } }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (OpenException e) { throw e; }
0
unknown (Lib) OutOfMemoryError 0 0 0 2
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (OutOfMemoryError ex) { LOG.error("Out of memory while loading project", ex); reportError( pmw, Translator.localize("dialog.error.memory.limit"), showUI); }
// in src/org/argouml/uml/ui/ActionSaveGraphics.java
catch (OutOfMemoryError e) { ExceptionDialog ed = new ExceptionDialog(ArgoFrame.getFrame(), "You have run out of memory. " + "Close down ArgoUML and restart with a larger heap size.", e); ed.setModal(true); ed.setVisible(true); }
0 0
unknown (Lib) ParseException 83
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
protected void parseAssociationEnd(Object role, String text) throws ParseException { MyTokenizer st; String name = null; StringBuilder stereotype = null; String token; boolean derived = false; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.association-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else { if (name != null) { String msg = "parsing.error.association-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); } catch (ParseException pre) { throw pre; } dealWithDerived(role, derived); if (name != null) { name = name.trim(); } if (name != null && name.startsWith("+")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPublic()); } if (name != null && name.startsWith("-")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPrivate()); } if (name != null && name.startsWith("#")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getProtected()); } if (name != null && name.startsWith("~")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPackage()); } if (name != null) { Model.getCoreHelper().setName(role, name); } StereotypeUtility.dealWithStereotypes(role, stereotype, true); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
protected Object parseObjectFlowState1(Object objectFlowState, String s) throws ParseException { Object c = Model.getActivityGraphsHelper() .findClassifierByName(objectFlowState, s); if (c != null) { /* Great! The class already existed - just use it. */ Model.getCoreHelper().setType(objectFlowState, c); return objectFlowState; } /* Let's create a class with the given name, otherwise * the user will not understand why we refuse his input! */ if (s != null && s.length() > 0) { Object topState = Model.getFacade().getContainer(objectFlowState); if (topState != null) { Object machine = Model.getFacade().getStateMachine(topState); if (machine != null) { Object ns = Model.getFacade().getNamespace(machine); if (ns != null) { Object clazz = Model.getCoreFactory().buildClass(s, ns); Model.getCoreHelper().setType(objectFlowState, clazz); return objectFlowState; } } } } String msg = "parsing.error.object-flow-type.classifier-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
protected Object parseTransition(Object trans, String s) throws ParseException { s = s.trim(); int a = s.indexOf("["); int b = s.indexOf("]"); int c = s.indexOf("/"); if (((a < 0) && (b >= 0)) || ((b < 0) && (a >= 0)) || (b < a)) { String msg = "parsing.error.transition.no-matching-square-brackets"; throw new ParseException(Translator.localize(msg), 0); } if ((c >= 0) && (c < b) && (c > a) && (a > 0)) { String msg = "parsing.error.transition.found-bracket-instead-slash"; throw new ParseException(Translator.localize(msg), 0); } String[] s1 = s.trim().split("/", 2); String eg = s1[0].trim(); String[] s2 = eg.split("\\[", 2); if (s2[0].trim().length() > 0) { parseTrigger(trans, s2[0].trim()); } if (s2.length > 1) { if (s2[1].trim().endsWith("]")) { String g = s2[1].trim(); g = g.substring(0, g.length() - 1).trim(); if (g.length() > 0) { parseGuard(trans, g); } } } if (s1.length > 1) { if (s1[1].trim().length() > 0) { parseEffect(trans, s1[1].trim()); } } return trans; }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
private void parseTrigger(Object trans, String trigger) throws ParseException { // let's look for a TimeEvent, ChangeEvent, CallEvent or SignalEvent String s = ""; boolean timeEvent = false; boolean changeEvent = false; boolean callEvent = false; boolean signalEvent = false; trigger = trigger.trim(); StringTokenizer tokenizer = new StringTokenizer(trigger, "()"); String name = tokenizer.nextToken().trim(); if (name.equalsIgnoreCase("after")) { timeEvent = true; } else if (name.equalsIgnoreCase("when")) { changeEvent = true; } else { // the part after the || is for when there's nothing between the () if (tokenizer.hasMoreTokens() || (trigger.indexOf("(") > 0) || (trigger.indexOf(")") > 1)) { callEvent = true; if (!trigger.endsWith(")") || !(trigger.indexOf("(") > 0)) { String msg = "parsing.error.transition.no-matching-brackets"; throw new ParseException( Translator.localize(msg), 0); } } else { signalEvent = true; } } if (timeEvent || changeEvent || callEvent) { if (tokenizer.hasMoreTokens()) { s = tokenizer.nextToken().trim(); } // else the empty s will do } /* * We can distinguish between 4 cases: * 1. A trigger is given. None exists yet. * 2. The trigger was present, and it is the same type, * or a different type, and its text is changed, or the same. * 3. A trigger is not given. None exists yet. * 4. The name of the trigger was present, but is removed. * The reaction in these cases should be: * 1. Find the referred trigger (issue 5988) or create a new one, and hook it to the transition. * 2. Rename the trigger. * 3. Nop. * 4. Unhook and erase the existing trigger. */ Object evt = Model.getFacade().getTrigger(trans); /* It is safe to give a null to the next function, * since a statemachine is always composed by a model anyhow. */ Object ns = Model.getStateMachinesHelper() .findNamespaceForEvent(trans, null); StateMachinesFactory sMFactory = Model.getStateMachinesFactory(); boolean weHaveAnEvent = false; if (trigger.length() > 0) { // case 1 and 2 if (evt == null) { // case 1 if (timeEvent) { // after(...) evt = findOrBuildTimeEvent(s, ns); /* Do not set the name. */ } if (changeEvent) { // when(...) evt = findOrBuildChangeEvent(s, ns); /* Do not set the name. */ } if (callEvent) { // operation(paramlist) String triggerName = trigger.indexOf("(") > 0 ? trigger.substring(0, trigger.indexOf("(")).trim() : trigger; /* This case is a bit different, because of the parameters. * If the event already exists, the parameters are ignored. */ evt = findCallEvent(triggerName, ns); if (evt == null) { evt = sMFactory.buildCallEvent(trans, triggerName, ns); // and parse the parameter list NotationUtilityUml.parseParamList(evt, s, 0); } } if (signalEvent) { // signalname evt = findOrBuildSignalEvent(trigger, ns); } weHaveAnEvent = true; } else { // case 2 if (timeEvent) { if (Model.getFacade().isATimeEvent(evt)) { /* Just change the time expression */ Object timeExpr = Model.getFacade().getWhen(evt); if (timeExpr == null) { // we have an event without expression timeExpr = Model.getDataTypesFactory().createTimeExpression("", s); Model.getStateMachinesHelper().setWhen(evt, timeExpr); } else { Model.getDataTypesHelper().setBody(timeExpr, s); } } else { /* It's a time-event now, * but was of another type before! */ delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildTimeEvent(s, ns); weHaveAnEvent = true; } } if (changeEvent) { if (Model.getFacade().isAChangeEvent(evt)) { /* Just change the ChangeExpression */ Object changeExpr = Model.getFacade().getChangeExpression(evt); if (changeExpr == null) { /* Create a new expression: */ changeExpr = Model.getDataTypesFactory() .createBooleanExpression("", s); Model.getStateMachinesHelper().setExpression(evt, changeExpr); } else { Model.getDataTypesHelper().setBody(changeExpr, s); } } else { /* The parsed text describes a change-event, * but the model contains another type! */ delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildChangeEvent(s, ns); weHaveAnEvent = true; } } if (callEvent) { if (Model.getFacade().isACallEvent(evt)) { /* Just change the Name and linked operation */ String triggerName = trigger.indexOf("(") > 0 ? trigger.substring(0, trigger.indexOf("(")).trim() : trigger; if (!Model.getFacade().getName(evt) .equals(triggerName)) { Model.getCoreHelper().setName(evt, triggerName); } /* TODO: Change the linked operation. */ } else { delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildCallEvent(trans, trigger, ns); // and parse the parameter list NotationUtilityUml.parseParamList(evt, s, 0); weHaveAnEvent = true; } } if (signalEvent) { if (Model.getFacade().isASignalEvent(evt)) { /* Just change the Name and linked signal */ if (!Model.getFacade().getName(evt).equals(trigger)) { Model.getCoreHelper().setName(evt, trigger); } /* TODO: link to the Signal. */ } else { delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildSignalEvent(trigger, ns); weHaveAnEvent = true; } } } if (weHaveAnEvent && (evt != null)) { Model.getStateMachinesHelper().setEventAsTrigger(trans, evt); } } else { // case 3 and 4 if (evt == null) { /* case 3 */ } else { // case 4 delete(evt); // erase it } } }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
protected void parseRole(Object role, String text) throws ParseException { String token; boolean hasColon = false; boolean hasSlash = false; String rolestr = null; String basestr = null; MyTokenizer st = new MyTokenizer(text, " ,\t,/,:"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { /* Do nothing. */ } else if ("/".equals(token)) { hasSlash = true; hasColon = false; } else if (":".equals(token)) { hasColon = true; hasSlash = false; } else if (hasColon) { if (basestr != null) { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } basestr = token; } else if (hasSlash) { if (rolestr != null) { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } rolestr = token; } else { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } } if (basestr == null) { /* If no base was typed, then only set the name: */ if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } /* If the base was not changed, then only set the name: */ Object currentBase = Model.getFacade().getBase(role); if (currentBase != null) { String currentBaseStr = Model.getFacade().getName(currentBase); if (currentBaseStr == null) { /* TODO: Is this needed? */ currentBaseStr = ""; } if (currentBaseStr.equals(basestr)) { if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } } Collection c = Model.getCollaborationsHelper().getAllPossibleBases(role); Iterator i = c.iterator(); while (i.hasNext()) { Object candidate = i.next(); if (basestr.equals(Model.getFacade().getName(candidate))) { if (Model.getFacade().getBase(role) != candidate) { /* If the base is already set to this assoc, * then do not set it again. * This check is needed, otherwise the setbase() * below gives an exception.*/ Model.getCollaborationsHelper().setBase(role, candidate); } /* Only set the name if the base was found: */ if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } } String msg = "parsing.error.association-role.base-not-found"; throw new ParseException(Translator.localize(msg), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
Deprecated protected Object parseMultiplicity(final Object multiplicityOwner, final String s1) throws ParseException { String s = s1.trim(); Object multi = null; try { multi = Model.getDataTypesFactory().createMultiplicity(s); } catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); } setMultiplicity(multiplicityOwner, s1); return multi; }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
protected void setMultiplicity(final Object multiplicityOwner, final String arg) throws ParseException { try { Model.getCoreHelper().setMultiplicity(multiplicityOwner, arg); } catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); } }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
protected static void parseModelElement(Object me, String text) throws ParseException { MyTokenizer st; List<String> path = null; String name = null; StringBuilder stereotype = null; String token; try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>,::"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.model-element-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else if ("::".equals(token)) { if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.anon-qualifiers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (path == null) { path = new ArrayList<String>(); } if (name != null) { path.add(name); } name = null; } else { if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.must-end-with-name"; throw new ParseException(Translator.localize(msg), 0); } if (name != null && name.startsWith("+")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPublic()); } if (name != null && name.startsWith("-")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPrivate()); } if (name != null && name.startsWith("#")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getProtected()); } if (name != null && name.startsWith("~")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPackage()); } if (name != null) { Model.getCoreHelper().setName(me, name); } StereotypeUtility.dealWithStereotypes(me, stereotype, false); if (path != null) { Object nspe = Model.getModelManagementHelper().getElement( path, Model.getFacade().getRoot(me)); if (nspe == null || !(Model.getFacade().isANamespace(nspe))) { String msg = "parsing.error.model-element-name.namespace-unresolved"; throw new ParseException(Translator.localize(msg), 0); } if (!Model.getCoreHelper().isValidNamespace(me, nspe)) { String msg = "parsing.error.model-element-name.namespace-invalid"; throw new ParseException(Translator.localize(msg), 0); } Model.getCoreHelper().addOwnedElement(nspe, me); } }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
static void parseParamList(Object op, String param, int paramOffset) throws ParseException { MyTokenizer st = new MyTokenizer(param, " ,\t,:,=,\\,", parameterCustomSep); // Copy returned parameters because it will be a live collection for MDR Collection origParam = new ArrayList(Model.getFacade().getParameters(op)); Object ns = Model.getFacade().getRoot(op); if (Model.getFacade().isAOperation(op)) { Object ow = Model.getFacade().getOwner(op); if (ow != null && Model.getFacade().getNamespace(ow) != null) { ns = Model.getFacade().getNamespace(ow); } } Iterator it = origParam.iterator(); while (st.hasMoreTokens()) { String kind = null; String name = null; String tok; String type = null; StringBuilder value = null; Object p = null; boolean hasColon = false; boolean hasEq = false; while (it.hasNext() && p == null) { p = it.next(); if (Model.getFacade().isReturn(p)) { p = null; } } while (st.hasMoreTokens()) { tok = st.nextToken(); if (",".equals(tok)) { break; } else if (" ".equals(tok) || "\t".equals(tok)) { if (hasEq) { value.append(tok); } } else if (":".equals(tok)) { hasColon = true; hasEq = false; } else if ("=".equals(tok)) { if (value != null) { String msg = "parsing.error.notation-utility.two-default-values"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } hasEq = true; hasColon = false; value = new StringBuilder(); } else if (hasColon) { if (type != null) { String msg = "parsing.error.notation-utility.two-types"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') { String msg = "parsing.error.notation-utility.type-quoted"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '(') { String msg = "parsing.error.notation-utility.type-expr"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } type = tok; } else if (hasEq) { value.append(tok); } else { if (name != null && kind != null) { String msg = "parsing.error.notation-utility.extra-text"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') { String msg = "parsing.error.notation-utility.name-kind-quoted"; throw new ParseException( Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '(') { String msg = "parsing.error.notation-utility.name-kind-expr"; throw new ParseException( Translator.localize(msg), paramOffset + st.getTokenIndex()); } kind = name; name = tok; } } if (p == null) { /* Leave the type undefined (see issue 6145): */ p = Model.getCoreFactory().buildParameter(op, null); } if (name != null) { Model.getCoreHelper().setName(p, name.trim()); } if (kind != null) { setParamKind(p, kind.trim()); } if (type != null) { Model.getCoreHelper().setType(p, getType(type.trim(), ns)); } if (value != null) { // TODO: Find a better default language // TODO: We should know the notation language, since it is us Project project = ProjectManager.getManager().getCurrentProject(); ProjectSettings ps = project.getProjectSettings(); String notationLanguage = ps.getNotationLanguage(); Object initExpr = Model.getDataTypesFactory() .createExpression( notationLanguage, value.toString().trim()); Model.getCoreHelper().setDefaultValue(p, initExpr); } } while (it.hasNext()) { Object p = it.next(); if (!Model.getFacade().isReturn(p)) { Model.getCoreHelper().removeParameter(op, p); Model.getUmlFactory().delete(p); } } }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
protected void parseEnumerationLiteral(String text, Object literal) throws ParseException { text = text.trim(); if (text.length() == 0) { return; } // strip any trailing semi-colons if (text.charAt(text.length() - 1) == ';') { text = text.substring(0, text.length() - 2); } MyTokenizer st; String name = null; StringBuilder stereotype = null; String token; try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.model-element-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else { if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (name != null) { Model.getCoreHelper().setName(literal, name); } StereotypeUtility.dealWithStereotypes(literal, stereotype, false); return; }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
private void parseError(String message, int offset) throws ParseException { throw new ParseException( Translator.localize("parsing.error." + message), offset); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
private List<String> tokenOpenBrace(MyTokenizer st, List<String> properties) throws ParseException { String token; StringBuilder propname = new StringBuilder(); String propvalue = null; if (properties == null) { properties = new ArrayList<String>(); } while (true) { token = st.nextToken(); if (",".equals(token) || "}".equals(token)) { if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } propname = new StringBuilder(); propvalue = null; if ("}".equals(token)) { break; } } else if ("=".equals(token)) { if (propvalue != null) { String msg = "parsing.error.operation.prop-stereotypes"; Object[] args = {propname}; throw new ParseException( Translator.localize(msg, args), st.getTokenIndex()); } propvalue = ""; } else if (propvalue == null) { propname.append(token); } else { propvalue += token; } } if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } return properties; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void parseMessage(Object umlMessage, String s) throws ParseException { String fname = null; // the condition or iteration expression (recurrence): StringBuilder guard = null; String paramExpr = null; String token; StringBuilder varname = null; List<List> predecessors = new ArrayList<List>(); List<Integer> seqno = null; List<Integer> currentseq = new ArrayList<Integer>(); // List<String> args = null; boolean mustBePre = false; boolean mustBeSeq = false; boolean parallell = false; boolean iterative = false; boolean mayDeleteExpr = false; boolean refindOperation = false; boolean hasPredecessors = false; currentseq.add(null); currentseq.add(null); try { MyTokenizer st = new MyTokenizer(s, " ,\t,*,[,],.,:,=,/,\\,", MyTokenizer.PAREN_EXPR_STRING_SEPARATOR); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { if (currentseq == null) { if (varname != null && fname == null) { varname.append(token); } } } else if ("[".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-unqualified"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (guard != null) { String msg = "parsing.error.message.several-specs"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } guard = new StringBuilder(); while (true) { token = st.nextToken(); if ("]".equals(token)) { break; } guard.append(token); } } else if ("*".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-unqualified"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (currentseq != null) { iterative = true; } } else if (".".equals(token)) { if (currentseq == null) { String msg = "parsing.error.message.unexpected-dot"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { currentseq.add(null); currentseq.add(null); } } else if (":".equals(token)) { if (st.hasMoreTokens()) { String t = st.nextToken(); if ("=".equals(t)) { st.putToken(":="); continue; } st.putToken(t); } if (mustBePre) { String msg = "parsing.error.message.pred-colon"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (currentseq != null) { if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } seqno = currentseq; currentseq = null; mayDeleteExpr = true; } } else if ("/".equals(token)) { if (st.hasMoreTokens()) { String t = st.nextToken(); if ("/".equals(t)) { st.putToken("//"); continue; } st.putToken(t); } if (mustBeSeq) { String msg = "parsing.error.message.sequence-slash"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBePre = false; mustBeSeq = true; if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { predecessors.add(currentseq); currentseq = new ArrayList<Integer>(); currentseq.add(null); currentseq.add(null); } hasPredecessors = true; } else if ("//".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-parallelized"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (currentseq != null) { parallell = true; } } else if (",".equals(token)) { if (currentseq != null) { if (mustBeSeq) { String msg = "parsing.error.message.many-numbers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBePre = true; if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { predecessors.add(currentseq); currentseq = new ArrayList<Integer>(); currentseq.add(null); currentseq.add(null); } hasPredecessors = true; } else { if (varname == null && fname != null) { varname = new StringBuilder(fname + token); fname = null; } else if (varname != null && fname == null) { varname.append(token); } else { String msg = "parsing.error.message.found-comma"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } } } else if ("=".equals(token) || ":=".equals(token)) { if (currentseq == null) { if (varname == null) { varname = new StringBuilder(fname); fname = ""; } else { fname = ""; } } } else if (currentseq == null) { if (paramExpr == null && token.charAt(0) == '(') { if (token.charAt(token.length() - 1) != ')') { String msg = "parsing.error.message.malformed-parameters"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (fname == null || "".equals(fname)) { String msg = "parsing.error.message.function-not-found"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (varname == null) { varname = new StringBuilder(); } paramExpr = token.substring(1, token.length() - 1); } else if (varname != null && fname == null) { varname.append(token); } else if (fname == null || fname.length() == 0) { fname = token; } else { String msg = "parsing.error.message.unexpected-token"; Object[] parseExcArgs = {token}; throw new ParseException( Translator.localize(msg, parseExcArgs), st.getTokenIndex()); } } else { boolean hasVal = currentseq.get(currentseq.size() - 2) != null; boolean hasOrd = currentseq.get(currentseq.size() - 1) != null; boolean assigned = false; int bp = findMsgOrderBreak(token); if (!hasVal && !assigned && bp == token.length()) { try { currentseq.set( currentseq.size() - 2, Integer.valueOf( token)); assigned = true; } catch (NumberFormatException nfe) { } } if (!hasOrd && !assigned && bp == 0) { try { currentseq.set( currentseq.size() - 1, Integer.valueOf( parseMsgOrder(token))); assigned = true; } catch (NumberFormatException nfe) { } } if (!hasVal && !hasOrd && !assigned && bp > 0 && bp < token.length()) { Integer nbr, ord; try { nbr = Integer.valueOf(token.substring(0, bp)); ord = Integer.valueOf( parseMsgOrder(token.substring(bp))); currentseq.set(currentseq.size() - 2, nbr); currentseq.set(currentseq.size() - 1, ord); assigned = true; } catch (NumberFormatException nfe) { } } if (!assigned) { String msg = "parsing.error.message.unexpected-token"; Object[] parseExcArgs = {token}; throw new ParseException( Translator.localize(msg, parseExcArgs), st.getTokenIndex()); } } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); } catch (ParseException pre) { throw pre; } List<String> args = parseArguments(paramExpr, mayDeleteExpr); printDebugInfo(s, fname, guard, paramExpr, varname, predecessors, seqno, parallell, iterative); /* Now apply the changes to the model: */ buildAction(umlMessage); handleGuard(umlMessage, guard, parallell, iterative); fname = fillBlankFunctionName(umlMessage, fname, mayDeleteExpr); varname = fillBlankVariableName(umlMessage, varname, mayDeleteExpr); refindOperation = handleFunctionName(umlMessage, fname, varname, refindOperation); refindOperation = handleArguments(umlMessage, args, refindOperation); refindOperation = handleSequenceNumber(umlMessage, seqno, refindOperation); handleOperation(umlMessage, fname, refindOperation); handlePredecessors(umlMessage, predecessors, hasPredecessors); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void handlePredecessors(Object umlMessage, List<List> predecessors, boolean hasPredecessors) throws ParseException { // Predecessors used to be not implemented, because it // caused some problems that I've not found an easy way to handle yet, // d00mst. The specific problem is that the notation currently is // ambiguous on second message after a thread split. // Why not implement it anyway? d00mst // TODO: Document this ambiguity and the choice made. if (hasPredecessors) { Collection roots = findCandidateRoots( Model.getFacade().getMessages( Model.getFacade().getInteraction(umlMessage)), null, null); List<Object> pre = new ArrayList<Object>(); predfor: for (int i = 0; i < predecessors.size(); i++) { for (Object root : roots) { Object msg = walkTree(root, predecessors.get(i)); if (msg != null && msg != umlMessage) { if (isBadPreMsg(umlMessage, msg)) { String parseMsg = "parsing.error.message.one-pred"; throw new ParseException( Translator.localize(parseMsg), 0); } pre.add(msg); continue predfor; } } String parseMsg = "parsing.error.message.pred-not-found"; throw new ParseException(Translator.localize(parseMsg), 0); } MsgPtr ptr = new MsgPtr(); recCountPredecessors(umlMessage, ptr); if (ptr.message != null && !pre.contains(ptr.message)) { pre.add(ptr.message); } Model.getCollaborationsHelper().setPredecessors(umlMessage, pre); } }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected boolean handleSequenceNumber(Object umlMessage, List<Integer> seqno, boolean refindOperation) throws ParseException { int i; if (seqno != null) { Object/* MMessage */root; // Find the preceding message, if any, on either end of the // association. StringBuilder pname = new StringBuilder(); StringBuilder mname = new StringBuilder(); String gname = generateMessageNumber(umlMessage); boolean swapRoles = false; int majval = 0; if (seqno.get(seqno.size() - 2) != null) { majval = Math.max((seqno.get(seqno.size() - 2)).intValue() - 1, 0); } int minval = 0; if (seqno.get(seqno.size() - 1) != null) { minval = Math.max((seqno.get(seqno.size() - 1)).intValue(), 0); } for (i = 0; i + 1 < seqno.size(); i += 2) { int bv = 1; if (seqno.get(i) != null) { bv = Math.max((seqno.get(i)).intValue(), 1); } int sv = 0; if (seqno.get(i + 1) != null) { sv = Math.max((seqno.get(i + 1)).intValue(), 0); } if (i > 0) { mname.append("."); } mname.append(Integer.toString(bv) + (char) ('a' + sv)); if (i + 3 < seqno.size()) { if (i > 0) { pname.append("."); } pname.append(Integer.toString(bv) + (char) ('a' + sv)); } } root = null; if (pname.length() > 0) { root = findMsg(Model.getFacade().getSender(umlMessage), pname.toString()); if (root == null) { root = findMsg(Model.getFacade().getReceiver(umlMessage), pname.toString()); if (root != null) { swapRoles = true; } } } else if (!hasMsgWithActivator(Model.getFacade().getSender(umlMessage), null) && hasMsgWithActivator(Model.getFacade().getReceiver(umlMessage), null)) { swapRoles = true; } if (compareMsgNumbers(mname.toString(), gname.toString())) { // Do nothing } else if (isMsgNumberStartOf(gname.toString(), mname.toString())) { String msg = "parsing.error.message.subtree-rooted-self"; throw new ParseException(Translator.localize(msg), 0); } else if (Model.getFacade().getPredecessors(umlMessage).size() > 1 && Model.getFacade().getSuccessors(umlMessage).size() > 1) { String msg = "parsing.error.message.start-end-many-threads"; throw new ParseException(Translator.localize(msg), 0); } else if (root == null && pname.length() > 0) { String msg = "parsing.error.message.activator-not-found"; throw new ParseException(Translator.localize(msg), 0); } else if (swapRoles && Model.getFacade().getActivatedMessages(umlMessage).size() > 0 && (Model.getFacade().getSender(umlMessage) != Model.getFacade().getReceiver(umlMessage))) { String msg = "parsing.error.message.reverse-direction-message"; throw new ParseException(Translator.localize(msg), 0); } else { /* Disconnect the message from the call graph * Make copies of returned live collections * since we're modifying */ Collection c = new ArrayList( Model.getFacade().getPredecessors(umlMessage)); Collection c2 = new ArrayList( Model.getFacade().getSuccessors(umlMessage)); Iterator it; it = c2.iterator(); while (it.hasNext()) { Model.getCollaborationsHelper().removeSuccessor(umlMessage, it.next()); } it = c.iterator(); while (it.hasNext()) { Iterator it2 = c2.iterator(); Object pre = /* (MMessage) */it.next(); Model.getCollaborationsHelper().removePredecessor(umlMessage, pre); while (it2.hasNext()) { Model.getCollaborationsHelper().addPredecessor( it2.next(), pre); } } // Connect the message at a new spot Model.getCollaborationsHelper().setActivator(umlMessage, root); if (swapRoles) { Object/* MClassifierRole */r = Model.getFacade().getSender(umlMessage); Model.getCollaborationsHelper().setSender(umlMessage, Model.getFacade().getReceiver(umlMessage)); Model.getCommonBehaviorHelper().setReceiver(umlMessage, r); } if (root == null) { c = filterWithActivator( Model.getFacade().getSentMessages( Model.getFacade().getSender(umlMessage)), null); } else { c = Model.getFacade().getActivatedMessages(root); } c2 = findCandidateRoots(c, root, umlMessage); it = c2.iterator(); // If c2 is empty, then we're done (or there is a // cycle in the message graph, which would be bad) If // c2 has more than one element, then the model is // crappy, but we'll just use one of them anyway if (majval <= 0) { while (it.hasNext()) { Model.getCollaborationsHelper().addSuccessor(umlMessage, /* (MMessage) */it.next()); } } else if (it.hasNext()) { Object/* MMessage */pre = walk(/* (MMessage) */it.next(), majval - 1, false); Object/* MMessage */post = successor(pre, minval); if (post != null) { Model.getCollaborationsHelper() .removePredecessor(post, pre); Model.getCollaborationsHelper() .addPredecessor(post, umlMessage); } insertSuccessor(pre, umlMessage, minval); } refindOperation = true; } } return refindOperation; }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
protected Object parseObjectFlowState2(Object objectFlowState, String s) throws ParseException { s = s.trim(); /* Let's not be picky about the brackets - just remove them: */ if (s.startsWith("[")) { s = s.substring(1); } if (s.endsWith("]")) { s = s.substring(0, s.length() - 1); } s = s.trim(); Object c = Model.getFacade().getType(objectFlowState); // get the // classifier if (c != null) { if (Model.getFacade().isAClassifierInState(c)) { Object classifier = Model.getFacade().getType(c); if ((s == null) || "".equals(s)) { // the State of a ClassifierInState is removed, // so let's reduce it to a Classifier. Model.getCoreHelper().setType(objectFlowState, classifier); delete(c); Model.getCoreHelper().setType(objectFlowState, classifier); return objectFlowState; // the model is changed - job done } Collection states = new ArrayList(Model.getFacade() .getInStates(c)); Collection statesToBeRemoved = new ArrayList(states); Collection namesToBeAdded = new ArrayList(); // Strings StringTokenizer tokenizer = new StringTokenizer(s, ","); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); boolean found = false; Iterator i = states.iterator(); while (i.hasNext()) { Object state = i.next(); if (Model.getFacade().getName(state) == nextToken) { found = true; statesToBeRemoved.remove(state); } } if (!found) { namesToBeAdded.add(nextToken); } } /* Remove the states that did not match. */ states.removeAll(statesToBeRemoved); Iterator i = namesToBeAdded.iterator(); while (i.hasNext()) { String name = (String) i.next(); /* * Now we have to see if any state in any statemachine of * classifier is named [name]. If so, then we only have to * link the state to c. */ Object state = Model.getActivityGraphsHelper() .findStateByName(classifier, name); if (state != null) { states.add(state); // the model is changed - our job is done } else { // no state named s is found, so we have to // reject the user's input String msg = "parsing.error.object-flow-state.state-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); } } /* Finally, do the adaptations: */ Model.getActivityGraphsHelper().setInStates(c, states); } else { // then c is a "normal" Classifier Collection statesToBeAdded = new ArrayList(); // UML states StringTokenizer tokenizer = new StringTokenizer(s, ","); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); Object state = Model.getActivityGraphsHelper() .findStateByName(c, nextToken); if (state != null) { statesToBeAdded.add(state); } else { // no state with the given name is found, so we have to // reject the complete user's input String msg = "parsing.error.object-flow-state.state-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); } } // let's create a new ClassifierInState with the correct links Object cis = Model.getActivityGraphsFactory() .buildClassifierInState(c, statesToBeAdded); Model.getCoreHelper().setType(objectFlowState, cis); // the model is changed - our job is done } } else { // if no classifier has been set, then entering a state is // not useful, so the user's input has to be rejected. String msg = "parsing.error.object-flow-state.classifier-not-found"; throw new ParseException(Translator.localize(msg), 0); } return objectFlowState; }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
protected Object parseClassifierRole(Object cls, String s) throws ParseException { String name = null; String token; String role = null; String base = null; List<String> bases = null; boolean hasColon = false; boolean hasSlash = false; try { MyTokenizer st = new MyTokenizer(s, " ,\t,/,:,\\,"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { /* Do nothing. */ } else if ("/".equals(token)) { hasSlash = true; hasColon = false; if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } base = null; } else if (":".equals(token)) { hasColon = true; hasSlash = false; if (bases == null) { bases = new ArrayList<String>(); } if (base != null) { bases.add(base); } base = null; } else if (",".equals(token)) { if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } base = null; } else if (hasColon) { if (base != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } base = token; } else if (hasSlash) { if (role != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } role = token; } else { if (name != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); } if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } // TODO: What to do about object name??? // if (name != null) // ; if (role != null) { Model.getCoreHelper().setName(cls, role.trim()); } if (bases != null) { // Remove bases that aren't there anymore // copy - can't iterate modify live collection while iterating it Collection b = new ArrayList(Model.getFacade().getBases(cls)); Iterator it = b.iterator(); Object c; Object ns = Model.getFacade().getNamespace(cls); if (ns != null && Model.getFacade().getNamespace(ns) != null) { ns = Model.getFacade().getNamespace(ns); } else { ns = Model.getFacade().getRoot(cls); } while (it.hasNext()) { c = it.next(); if (!bases.contains(Model.getFacade().getName(c))) { Model.getCollaborationsHelper().removeBase(cls, c); } } it = bases.iterator(); addBases: while (it.hasNext()) { String d = ((String) it.next()).trim(); Iterator it2 = b.iterator(); while (it2.hasNext()) { c = it2.next(); if (d.equals(Model.getFacade().getName(c))) { continue addBases; } } c = NotationUtilityUml.getType(d, ns); if (Model.getFacade().isACollaboration( Model.getFacade().getNamespace(c))) { Model.getCoreHelper().setNamespace(c, ns); } Model.getCollaborationsHelper().addBase(cls, c); } } return cls; }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
protected Object parseCallState(Object callState, String s1) throws ParseException { String s = s1.trim(); int a = s.indexOf("("); int b = s.indexOf(")"); if (((a < 0) && (b >= 0)) || ((b < 0) && (a >= 0)) || (b < a)) { throw new ParseException("No matching brackets () found.", 0); } /* First we decode the string: */ String newClassName = null; String newOperationName = null; StringTokenizer tokenizer = new StringTokenizer(s, "("); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); if (nextToken.endsWith(")")) { newClassName = nextToken.substring(0, nextToken.length() - 1); } else { newOperationName = nextToken.trim(); } } /* Secondly we check the previous model structure: */ String oldOperationName = null; String oldClassName = null; Object entry = Model.getFacade().getEntry(callState); Object operation = null; Object clazz = null; if (Model.getFacade().isACallAction(entry)) { operation = Model.getFacade().getOperation(entry); if (Model.getFacade().isAOperation(operation)) { oldOperationName = Model.getFacade().getName(operation); clazz = Model.getFacade().getOwner(operation); oldClassName = Model.getFacade().getName(clazz); } } /* And 3rd, we adapt the model: */ boolean found = false; if ((newClassName != null) && newClassName.equals(oldClassName) && (newOperationName != null) && !newOperationName.equals(oldOperationName)) { // Same class, other operation for ( Object op : Model.getFacade().getOperations(clazz)) { if (newOperationName.equals( Model.getFacade().getName(op))) { Model.getCommonBehaviorHelper().setOperation(entry, op); found = true; break; } } if (!found) { throw new ParseException( "Operation " + newOperationName + " not found in " + newClassName + ".", 0); } } else if ((newClassName != null) && !newClassName.equals(oldClassName) && (newOperationName != null)) { // Other class Object model = ProjectManager.getManager().getCurrentProject().getRoot(); Collection c = Model.getModelManagementHelper(). getAllModelElementsOfKind(model, Model.getMetaTypes().getClassifier()); Iterator i = c.iterator(); Object classifier = null; while (i.hasNext()) { Object cl = i.next(); String cn = Model.getFacade().getName(cl); if (cn.equals(newClassName)) { classifier = cl; break; } } if (classifier == null) { throw new ParseException( "Classifier " + newClassName + " not found.", 0); } // We found the classifier, now go find the operation: if (classifier != null) { Collection ops = Model.getFacade().getOperations(classifier); Iterator io = ops.iterator(); while (io.hasNext()) { Object op = io.next(); if (newOperationName.equals( Model.getFacade().getName(op))) { /* Here we located the new classifier * with its operation. */ found = true; if (!Model.getFacade().isACallAction(entry)) { entry = Model.getCommonBehaviorFactory() .buildCallAction(op, "ca"); Model.getStateMachinesHelper().setEntry( callState, entry); } else { Model.getCommonBehaviorHelper().setOperation( entry, op); } break; } } if (!found) { throw new ParseException( "Operation " + newOperationName + " not found in " + newClassName + ".", 0); } } } if (!found) { throw new ParseException( "Incompatible input found.", 0); } return callState; }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
protected void parseAttribute( String text, Object attribute) throws ParseException { StringBuilder multiplicity = null; String name = null; List<String> properties = null; StringBuilder stereotype = null; // This is null as until // the first stereotype declaration is seen. // After that it is non-null. String token; String type = null; StringBuilder value = null; String visibility = null; boolean derived = false; boolean hasColon = false; boolean hasEq = false; int multindex = -1; MyTokenizer st; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } /* Handle Visibility: */ if (text.length() > 0 && NotationUtilityUml.VISIBILITYCHARS.indexOf(text.charAt(0)) >= 0) { visibility = text.substring(0, 1); text = text.substring(1); } try { st = new MyTokenizer(text, " ,\t,<<,\u00AB,\u00BB,>>,[,],:,=,{,},\\,", NotationUtilityUml.attributeCustomSep); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token) || ",".equals(token)) { if (hasEq) { value.append(token); } } else if ("<<".equals(token) || "\u00AB".equals(token)) { if (hasEq) { value.append(token); } else { if (stereotype != null) { String msg = "parsing.error.attribute.two-sets-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } } else if ("[".equals(token)) { if (hasEq) { value.append(token); } else { if (multiplicity != null) { String msg = "parsing.error.attribute.two-multiplicities"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } multiplicity = new StringBuilder(); multindex = st.getTokenIndex() + 1; while (true) { token = st.nextToken(); if ("]".equals(token)) { break; } multiplicity.append(token); } } } else if ("{".equals(token)) { StringBuilder propname = new StringBuilder(); String propvalue = null; if (properties == null) { properties = new ArrayList<String>(); } while (true) { token = st.nextToken(); if (",".equals(token) || "}".equals(token)) { if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } propname = new StringBuilder(); propvalue = null; if ("}".equals(token)) { break; } } else if ("=".equals(token)) { if (propvalue != null) { String msg = "parsing.error.attribute.prop-two-values"; Object[] args = {propvalue}; throw new ParseException(Translator.localize( msg, args), st.getTokenIndex()); } propvalue = ""; } else if (propvalue == null) { propname.append(token); } else { propvalue += token; } } if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } } else if (":".equals(token)) { hasColon = true; hasEq = false; } else if ("=".equals(token)) { if (value != null) { String msg = "parsing.error.attribute.two-default-values"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } value = new StringBuilder(); hasColon = false; hasEq = true; } else { if (hasColon) { if (type != null) { String msg = "parsing.error.attribute.two-types"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { String msg = "parsing.error.attribute.quoted"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { String msg = "parsing.error.attribute.is-expr"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } type = token; } else if (hasEq) { value.append(token); } else { if (name != null && visibility != null) { String msg = "parsing.error.attribute.extra-text"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { String msg = "parsing.error.attribute.name-quoted"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { String msg = "parsing.error.attribute.name-expr"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (name == null && visibility == null && token.length() > 1 && NotationUtilityUml.VISIBILITYCHARS .indexOf(token.charAt(0)) >= 0) { visibility = token.substring(0, 1); token = token.substring(1); } if (name != null) { visibility = name; name = token; } else { name = token; } } } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); } // catch & rethrow is not necessary if we don't do nothing (penyaskito) // catch (ParseException pre) { // throw pre; // } if (LOG.isDebugEnabled()) { LOG.debug("ParseAttribute [name: " + name + " visibility: " + visibility + " type: " + type + " value: " + value + " stereo: " + stereotype + " mult: " + multiplicity); if (properties != null) { for (int i = 0; i + 1 < properties.size(); i += 2) { LOG.debug("\tProperty [name: " + properties.get(i) + " = " + properties.get(i + 1) + "]"); } } } dealWithDerived(attribute, derived); dealWithVisibility(attribute, visibility); dealWithName(attribute, name); dealWithType(attribute, type); dealWithValue(attribute, value); dealWithMultiplicity(attribute, multiplicity, multindex); dealWithProperties(attribute, properties); StereotypeUtility.dealWithStereotypes(attribute, stereotype, true); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
private void dealWithMultiplicity(Object attribute, StringBuilder multiplicity, int multindex) throws ParseException { if (multiplicity != null) { try { Model.getCoreHelper().setMultiplicity(attribute, multiplicity.toString()); } catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); } } }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
static void parseModelElement(Object modelElement, String text) throws ParseException { MyTokenizer st; boolean abstrac = false; boolean fina = false; boolean publi = false; boolean privat = false; boolean protect = false; String token; List<String> path = null; String name = null; try { st = new MyTokenizer(text, " ,.,abstract,final,public,private,protected"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token)) { /* skip spaces */ } else if ("abstract".equals(token)) { abstrac = true; } else if ("final".equals(token)) { fina = true; } else if ("public".equals(token)) { publi = true; } else if ("private".equals(token)) { privat = true; } else if ("protected".equals(token)) { protect = true; } else if (".".equals(token)) { if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.anon-qualifiers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (path == null) { path = new ArrayList<String>(); } if (name != null) { path.add(name); } name = null; } else { // the name itself if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.must-end-with-name"; throw new ParseException(Translator.localize(msg), 0); } /* Check the name for validity: */ if (!isValidJavaClassName(name)) { throw new ParseException( "Invalid class name for Java: " + name, 0); } if (path != null) { Object nspe = Model.getModelManagementHelper().getElement( path, Model.getFacade().getRoot(modelElement)); if (nspe == null || !(Model.getFacade().isANamespace(nspe))) { String msg = "parsing.error.model-element-name.namespace-unresolved"; throw new ParseException(Translator.localize(msg), 0); } if (!Model.getCoreHelper().isValidNamespace( modelElement, nspe)) { String msg = "parsing.error.model-element-name.namespace-invalid"; throw new ParseException(Translator.localize(msg), 0); } Model.getCoreHelper().addOwnedElement(nspe, modelElement); } Model.getCoreHelper().setName(modelElement, name); if (abstrac) { Model.getCoreHelper().setAbstract(modelElement, abstrac); } if (fina) { Model.getCoreHelper().setLeaf(modelElement, fina); } if (publi) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getPublic()); } if (privat) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getPrivate()); } if (protect) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getProtected()); } }
10
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); }
29
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
protected void parseAssociationEnd(Object role, String text) throws ParseException { MyTokenizer st; String name = null; StringBuilder stereotype = null; String token; boolean derived = false; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.association-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else { if (name != null) { String msg = "parsing.error.association-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String ms = "parsing.error.association-name.unexpected-end-element"; throw new ParseException(Translator.localize(ms), text.length()); } catch (ParseException pre) { throw pre; } dealWithDerived(role, derived); if (name != null) { name = name.trim(); } if (name != null && name.startsWith("+")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPublic()); } if (name != null && name.startsWith("-")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPrivate()); } if (name != null && name.startsWith("#")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getProtected()); } if (name != null && name.startsWith("~")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(role, Model.getVisibilityKind().getPackage()); } if (name != null) { Model.getCoreHelper().setName(role, name); } StereotypeUtility.dealWithStereotypes(role, stereotype, true); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
protected Object parseObjectFlowState1(Object objectFlowState, String s) throws ParseException { Object c = Model.getActivityGraphsHelper() .findClassifierByName(objectFlowState, s); if (c != null) { /* Great! The class already existed - just use it. */ Model.getCoreHelper().setType(objectFlowState, c); return objectFlowState; } /* Let's create a class with the given name, otherwise * the user will not understand why we refuse his input! */ if (s != null && s.length() > 0) { Object topState = Model.getFacade().getContainer(objectFlowState); if (topState != null) { Object machine = Model.getFacade().getStateMachine(topState); if (machine != null) { Object ns = Model.getFacade().getNamespace(machine); if (ns != null) { Object clazz = Model.getCoreFactory().buildClass(s, ns); Model.getCoreHelper().setType(objectFlowState, clazz); return objectFlowState; } } } } String msg = "parsing.error.object-flow-type.classifier-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
protected Object parseTransition(Object trans, String s) throws ParseException { s = s.trim(); int a = s.indexOf("["); int b = s.indexOf("]"); int c = s.indexOf("/"); if (((a < 0) && (b >= 0)) || ((b < 0) && (a >= 0)) || (b < a)) { String msg = "parsing.error.transition.no-matching-square-brackets"; throw new ParseException(Translator.localize(msg), 0); } if ((c >= 0) && (c < b) && (c > a) && (a > 0)) { String msg = "parsing.error.transition.found-bracket-instead-slash"; throw new ParseException(Translator.localize(msg), 0); } String[] s1 = s.trim().split("/", 2); String eg = s1[0].trim(); String[] s2 = eg.split("\\[", 2); if (s2[0].trim().length() > 0) { parseTrigger(trans, s2[0].trim()); } if (s2.length > 1) { if (s2[1].trim().endsWith("]")) { String g = s2[1].trim(); g = g.substring(0, g.length() - 1).trim(); if (g.length() > 0) { parseGuard(trans, g); } } } if (s1.length > 1) { if (s1[1].trim().length() > 0) { parseEffect(trans, s1[1].trim()); } } return trans; }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
private void parseTrigger(Object trans, String trigger) throws ParseException { // let's look for a TimeEvent, ChangeEvent, CallEvent or SignalEvent String s = ""; boolean timeEvent = false; boolean changeEvent = false; boolean callEvent = false; boolean signalEvent = false; trigger = trigger.trim(); StringTokenizer tokenizer = new StringTokenizer(trigger, "()"); String name = tokenizer.nextToken().trim(); if (name.equalsIgnoreCase("after")) { timeEvent = true; } else if (name.equalsIgnoreCase("when")) { changeEvent = true; } else { // the part after the || is for when there's nothing between the () if (tokenizer.hasMoreTokens() || (trigger.indexOf("(") > 0) || (trigger.indexOf(")") > 1)) { callEvent = true; if (!trigger.endsWith(")") || !(trigger.indexOf("(") > 0)) { String msg = "parsing.error.transition.no-matching-brackets"; throw new ParseException( Translator.localize(msg), 0); } } else { signalEvent = true; } } if (timeEvent || changeEvent || callEvent) { if (tokenizer.hasMoreTokens()) { s = tokenizer.nextToken().trim(); } // else the empty s will do } /* * We can distinguish between 4 cases: * 1. A trigger is given. None exists yet. * 2. The trigger was present, and it is the same type, * or a different type, and its text is changed, or the same. * 3. A trigger is not given. None exists yet. * 4. The name of the trigger was present, but is removed. * The reaction in these cases should be: * 1. Find the referred trigger (issue 5988) or create a new one, and hook it to the transition. * 2. Rename the trigger. * 3. Nop. * 4. Unhook and erase the existing trigger. */ Object evt = Model.getFacade().getTrigger(trans); /* It is safe to give a null to the next function, * since a statemachine is always composed by a model anyhow. */ Object ns = Model.getStateMachinesHelper() .findNamespaceForEvent(trans, null); StateMachinesFactory sMFactory = Model.getStateMachinesFactory(); boolean weHaveAnEvent = false; if (trigger.length() > 0) { // case 1 and 2 if (evt == null) { // case 1 if (timeEvent) { // after(...) evt = findOrBuildTimeEvent(s, ns); /* Do not set the name. */ } if (changeEvent) { // when(...) evt = findOrBuildChangeEvent(s, ns); /* Do not set the name. */ } if (callEvent) { // operation(paramlist) String triggerName = trigger.indexOf("(") > 0 ? trigger.substring(0, trigger.indexOf("(")).trim() : trigger; /* This case is a bit different, because of the parameters. * If the event already exists, the parameters are ignored. */ evt = findCallEvent(triggerName, ns); if (evt == null) { evt = sMFactory.buildCallEvent(trans, triggerName, ns); // and parse the parameter list NotationUtilityUml.parseParamList(evt, s, 0); } } if (signalEvent) { // signalname evt = findOrBuildSignalEvent(trigger, ns); } weHaveAnEvent = true; } else { // case 2 if (timeEvent) { if (Model.getFacade().isATimeEvent(evt)) { /* Just change the time expression */ Object timeExpr = Model.getFacade().getWhen(evt); if (timeExpr == null) { // we have an event without expression timeExpr = Model.getDataTypesFactory().createTimeExpression("", s); Model.getStateMachinesHelper().setWhen(evt, timeExpr); } else { Model.getDataTypesHelper().setBody(timeExpr, s); } } else { /* It's a time-event now, * but was of another type before! */ delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildTimeEvent(s, ns); weHaveAnEvent = true; } } if (changeEvent) { if (Model.getFacade().isAChangeEvent(evt)) { /* Just change the ChangeExpression */ Object changeExpr = Model.getFacade().getChangeExpression(evt); if (changeExpr == null) { /* Create a new expression: */ changeExpr = Model.getDataTypesFactory() .createBooleanExpression("", s); Model.getStateMachinesHelper().setExpression(evt, changeExpr); } else { Model.getDataTypesHelper().setBody(changeExpr, s); } } else { /* The parsed text describes a change-event, * but the model contains another type! */ delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildChangeEvent(s, ns); weHaveAnEvent = true; } } if (callEvent) { if (Model.getFacade().isACallEvent(evt)) { /* Just change the Name and linked operation */ String triggerName = trigger.indexOf("(") > 0 ? trigger.substring(0, trigger.indexOf("(")).trim() : trigger; if (!Model.getFacade().getName(evt) .equals(triggerName)) { Model.getCoreHelper().setName(evt, triggerName); } /* TODO: Change the linked operation. */ } else { delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildCallEvent(trans, trigger, ns); // and parse the parameter list NotationUtilityUml.parseParamList(evt, s, 0); weHaveAnEvent = true; } } if (signalEvent) { if (Model.getFacade().isASignalEvent(evt)) { /* Just change the Name and linked signal */ if (!Model.getFacade().getName(evt).equals(trigger)) { Model.getCoreHelper().setName(evt, trigger); } /* TODO: link to the Signal. */ } else { delete(evt); /* TODO: What if used elsewhere? */ evt = sMFactory.buildSignalEvent(trigger, ns); weHaveAnEvent = true; } } } if (weHaveAnEvent && (evt != null)) { Model.getStateMachinesHelper().setEventAsTrigger(trans, evt); } } else { // case 3 and 4 if (evt == null) { /* case 3 */ } else { // case 4 delete(evt); // erase it } } }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
protected void parseRole(Object role, String text) throws ParseException { String token; boolean hasColon = false; boolean hasSlash = false; String rolestr = null; String basestr = null; MyTokenizer st = new MyTokenizer(text, " ,\t,/,:"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { /* Do nothing. */ } else if ("/".equals(token)) { hasSlash = true; hasColon = false; } else if (":".equals(token)) { hasColon = true; hasSlash = false; } else if (hasColon) { if (basestr != null) { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } basestr = token; } else if (hasSlash) { if (rolestr != null) { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } rolestr = token; } else { String msg = "parsing.error.association-role.association-extra-text"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } } if (basestr == null) { /* If no base was typed, then only set the name: */ if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } /* If the base was not changed, then only set the name: */ Object currentBase = Model.getFacade().getBase(role); if (currentBase != null) { String currentBaseStr = Model.getFacade().getName(currentBase); if (currentBaseStr == null) { /* TODO: Is this needed? */ currentBaseStr = ""; } if (currentBaseStr.equals(basestr)) { if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } } Collection c = Model.getCollaborationsHelper().getAllPossibleBases(role); Iterator i = c.iterator(); while (i.hasNext()) { Object candidate = i.next(); if (basestr.equals(Model.getFacade().getName(candidate))) { if (Model.getFacade().getBase(role) != candidate) { /* If the base is already set to this assoc, * then do not set it again. * This check is needed, otherwise the setbase() * below gives an exception.*/ Model.getCollaborationsHelper().setBase(role, candidate); } /* Only set the name if the base was found: */ if (rolestr != null) { Model.getCoreHelper().setName(role, rolestr.trim()); } return; } } String msg = "parsing.error.association-role.base-not-found"; throw new ParseException(Translator.localize(msg), 0); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
Deprecated protected Object parseMultiplicity(final Object multiplicityOwner, final String s1) throws ParseException { String s = s1.trim(); Object multi = null; try { multi = Model.getDataTypesFactory().createMultiplicity(s); } catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); } setMultiplicity(multiplicityOwner, s1); return multi; }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
protected void setMultiplicity(final Object multiplicityOwner, final String arg) throws ParseException { try { Model.getCoreHelper().setMultiplicity(multiplicityOwner, arg); } catch (IllegalArgumentException iae) { throw new ParseException(iae.getLocalizedMessage(), 0); } }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
protected void parseAssociationName(Object modelElement, String text) throws ParseException { boolean derived = false; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } NotationUtilityUml.setDerived(modelElement, derived); NotationUtilityUml.parseModelElement(modelElement, text); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
protected static void parseModelElement(Object me, String text) throws ParseException { MyTokenizer st; List<String> path = null; String name = null; StringBuilder stereotype = null; String token; try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>,::"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.model-element-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else if ("::".equals(token)) { if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.anon-qualifiers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (path == null) { path = new ArrayList<String>(); } if (name != null) { path.add(name); } name = null; } else { if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.must-end-with-name"; throw new ParseException(Translator.localize(msg), 0); } if (name != null && name.startsWith("+")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPublic()); } if (name != null && name.startsWith("-")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPrivate()); } if (name != null && name.startsWith("#")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getProtected()); } if (name != null && name.startsWith("~")) { name = name.substring(1).trim(); Model.getCoreHelper().setVisibility(me, Model.getVisibilityKind().getPackage()); } if (name != null) { Model.getCoreHelper().setName(me, name); } StereotypeUtility.dealWithStereotypes(me, stereotype, false); if (path != null) { Object nspe = Model.getModelManagementHelper().getElement( path, Model.getFacade().getRoot(me)); if (nspe == null || !(Model.getFacade().isANamespace(nspe))) { String msg = "parsing.error.model-element-name.namespace-unresolved"; throw new ParseException(Translator.localize(msg), 0); } if (!Model.getCoreHelper().isValidNamespace(me, nspe)) { String msg = "parsing.error.model-element-name.namespace-invalid"; throw new ParseException(Translator.localize(msg), 0); } Model.getCoreHelper().addOwnedElement(nspe, me); } }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
static void parseParamList(Object op, String param, int paramOffset) throws ParseException { MyTokenizer st = new MyTokenizer(param, " ,\t,:,=,\\,", parameterCustomSep); // Copy returned parameters because it will be a live collection for MDR Collection origParam = new ArrayList(Model.getFacade().getParameters(op)); Object ns = Model.getFacade().getRoot(op); if (Model.getFacade().isAOperation(op)) { Object ow = Model.getFacade().getOwner(op); if (ow != null && Model.getFacade().getNamespace(ow) != null) { ns = Model.getFacade().getNamespace(ow); } } Iterator it = origParam.iterator(); while (st.hasMoreTokens()) { String kind = null; String name = null; String tok; String type = null; StringBuilder value = null; Object p = null; boolean hasColon = false; boolean hasEq = false; while (it.hasNext() && p == null) { p = it.next(); if (Model.getFacade().isReturn(p)) { p = null; } } while (st.hasMoreTokens()) { tok = st.nextToken(); if (",".equals(tok)) { break; } else if (" ".equals(tok) || "\t".equals(tok)) { if (hasEq) { value.append(tok); } } else if (":".equals(tok)) { hasColon = true; hasEq = false; } else if ("=".equals(tok)) { if (value != null) { String msg = "parsing.error.notation-utility.two-default-values"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } hasEq = true; hasColon = false; value = new StringBuilder(); } else if (hasColon) { if (type != null) { String msg = "parsing.error.notation-utility.two-types"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') { String msg = "parsing.error.notation-utility.type-quoted"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '(') { String msg = "parsing.error.notation-utility.type-expr"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } type = tok; } else if (hasEq) { value.append(tok); } else { if (name != null && kind != null) { String msg = "parsing.error.notation-utility.extra-text"; throw new ParseException(Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '\'' || tok.charAt(0) == '\"') { String msg = "parsing.error.notation-utility.name-kind-quoted"; throw new ParseException( Translator.localize(msg), paramOffset + st.getTokenIndex()); } if (tok.charAt(0) == '(') { String msg = "parsing.error.notation-utility.name-kind-expr"; throw new ParseException( Translator.localize(msg), paramOffset + st.getTokenIndex()); } kind = name; name = tok; } } if (p == null) { /* Leave the type undefined (see issue 6145): */ p = Model.getCoreFactory().buildParameter(op, null); } if (name != null) { Model.getCoreHelper().setName(p, name.trim()); } if (kind != null) { setParamKind(p, kind.trim()); } if (type != null) { Model.getCoreHelper().setType(p, getType(type.trim(), ns)); } if (value != null) { // TODO: Find a better default language // TODO: We should know the notation language, since it is us Project project = ProjectManager.getManager().getCurrentProject(); ProjectSettings ps = project.getProjectSettings(); String notationLanguage = ps.getNotationLanguage(); Object initExpr = Model.getDataTypesFactory() .createExpression( notationLanguage, value.toString().trim()); Model.getCoreHelper().setDefaultValue(p, initExpr); } } while (it.hasNext()) { Object p = it.next(); if (!Model.getFacade().isReturn(p)) { Model.getCoreHelper().removeParameter(op, p); Model.getUmlFactory().delete(p); } } }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
protected void parseStateBody(Object st, String s) throws ParseException { boolean foundEntry = false; boolean foundExit = false; boolean foundDo = false; /* Generate all the existing internal transitions, * so that we can compare them as text with the newly entered ones. */ ModelElementInfoList internalsInfo = new ModelElementInfoList( Model.getFacade().getInternalTransitions(st)); StringTokenizer lines = new StringTokenizer(s, "\n\r"); while (lines.hasMoreTokens()) { String line = lines.nextToken().trim(); /* Now let's check if the new line is already present in * the old list of internal transitions; if it is, then * mark the old one to be retained (i.e. do not create a new one), * if it isn't, continue with parsing: */ if (!internalsInfo.checkRetain(line)) { if (line.toLowerCase().startsWith("entry") && line.substring(5).trim().startsWith("/")) { parseStateEntryAction(st, line); foundEntry = true; } else if (line.toLowerCase().startsWith("exit") && line.substring(4).trim().startsWith("/")) { parseStateExitAction(st, line); foundExit = true; } else if (line.toLowerCase().startsWith("do") && line.substring(2).trim().startsWith("/")) { parseStateDoAction(st, line); foundDo = true; } else { Object t = Model.getStateMachinesFactory() .buildInternalTransition(st); if (t == null) { continue; } /* TODO: If the next line trows an exception, then what * do we do with the remainder of the * parsed/to be parsed lines? */ /* TODO: Is this a good way of handling nested notation? * The following fails the tests: * new TransitionNotationUml(t).parse(line); */ new TransitionNotationUml(t).parseTransition(t, line); /* Add this new one, and mark it to be retained: */ internalsInfo.add(t, true); } } } if (!foundEntry) { delete(Model.getFacade().getEntry(st)); } if (!foundExit) { delete(Model.getFacade().getExit(st)); } if (!foundDo) { delete(Model.getFacade().getDoActivity(st)); } /* Process the final list of internal transitions, * and hook it to the state: */ Model.getStateMachinesHelper().setInternalTransitions(st, internalsInfo.finalisedList()); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
protected void parseEnumerationLiteralFig( Object enumeration, Object literal, String text) throws ParseException { if (enumeration == null || literal == null) { return; } Project project = ProjectManager.getManager().getCurrentProject(); ParseException pex = null; int start = 0; int end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); if (end == -1) { /* No text. We may remove the literal. */ project.moveToTrash(literal); return; } String s = text.substring(start, end).trim(); if (s.length() == 0) { /* No non-white chars in text? remove literal! */ project.moveToTrash(literal); return; } parseEnumerationLiteral(s, literal); int i = Model.getFacade().getEnumerationLiterals(enumeration) .indexOf(literal); // check for more literals (';' separated): start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); while (end > start && end <= text.length()) { s = text.substring(start, end).trim(); if (s.length() > 0) { // yes, there are more: Object newLiteral = Model.getCoreFactory().createEnumerationLiteral(); if (newLiteral != null) { try { if (i != -1) { Model.getCoreHelper().addLiteral( enumeration, ++i, newLiteral); } else { Model.getCoreHelper().addLiteral( enumeration, 0, newLiteral); } parseEnumerationLiteral(s, newLiteral); } catch (ParseException ex) { if (pex == null) { pex = ex; } } } } start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); } if (pex != null) { throw pex; } }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
protected void parseEnumerationLiteral(String text, Object literal) throws ParseException { text = text.trim(); if (text.length() == 0) { return; } // strip any trailing semi-colons if (text.charAt(text.length() - 1) == ';') { text = text.substring(0, text.length() - 2); } MyTokenizer st; String name = null; StringBuilder stereotype = null; String token; try { st = new MyTokenizer(text, "<<,\u00AB,\u00BB,>>"); while (st.hasMoreTokens()) { token = st.nextToken(); if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { String msg = "parsing.error.model-element-name.twin-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else { if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (name != null) { Model.getCoreHelper().setName(literal, name); } StereotypeUtility.dealWithStereotypes(literal, stereotype, false); return; }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
public void parseOperationFig( Object classifier, Object operation, String text) throws ParseException { if (classifier == null || operation == null) { return; } ParseException pex = null; int start = 0; int end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); Project currentProject = ProjectManager.getManager().getCurrentProject(); if (end == -1) { //no text? remove op! currentProject.moveToTrash(operation); return; } String s = text.substring(start, end).trim(); if (s.length() == 0) { //no non-whitechars in text? remove op! currentProject.moveToTrash(operation); return; } parseOperation(s, operation); int i = Model.getFacade().getFeatures(classifier).indexOf(operation); // check for more operations (';' separated): start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); while (end > start && end <= text.length()) { s = text.substring(start, end).trim(); if (s.length() > 0) { // yes, there are more: Object returnType = currentProject.getDefaultReturnType(); Object newOp = Model.getCoreFactory() .buildOperation(classifier, returnType); if (newOp != null) { try { parseOperation(s, newOp); //newOp.setOwnerScope(op.getOwnerScope()); // //not needed in case of operation if (i != -1) { Model.getCoreHelper().addFeature( classifier, ++i, newOp); } else { Model.getCoreHelper().addFeature( classifier, newOp); } } catch (ParseException ex) { if (pex == null) { pex = ex; } } } } start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); } if (pex != null) { throw pex; } }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
public void parseOperation(String s, Object op) throws ParseException { MyTokenizer st; boolean hasColon = false; String name = null; String parameterlist = null; StringBuilder stereotype = null; String token; String type = null; String visibility = null; List<String> properties = null; int paramOffset = 0; s = s.trim(); if (s.length() > 0 && NotationUtilityUml.VISIBILITYCHARS.indexOf(s.charAt(0)) >= 0) { visibility = s.substring(0, 1); s = s.substring(1); } try { st = new MyTokenizer(s, " ,\t,<<,\u00AB,\u00BB,>>,:,=,{,},\\,", NotationUtilityUml.operationCustomSep); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token) || ",".equals(token)) { continue; // Do nothing } else if ("<<".equals(token) || "\u00AB".equals(token)) { if (stereotype != null) { parseError("operation.stereotypes", st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } else if ("{".equals(token)) { properties = tokenOpenBrace(st, properties); } else if (":".equals(token)) { hasColon = true; } else if ("=".equals(token)) { parseError("operation.default-values", st.getTokenIndex()); } else if (token.charAt(0) == '(' && !hasColon) { if (parameterlist != null) { parseError("operation.two-parameter-lists", st.getTokenIndex()); } parameterlist = token; } else { if (hasColon) { if (type != null) { parseError("operation.two-types", st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { parseError("operation.type-quoted", st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { parseError("operation.type-expr", st.getTokenIndex()); } type = token; } else { if (name != null && visibility != null) { parseError("operation.extra-text", st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { parseError("operation.name-quoted", st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { parseError("operation.name-expr", st.getTokenIndex()); } if (name == null && visibility == null && token.length() > 1 && NotationUtilityUml.VISIBILITYCHARS.indexOf( token.charAt(0)) >= 0) { visibility = token.substring(0, 1); token = token.substring(1); } if (name != null) { visibility = name; name = token; } else { name = token; } } } } // end while loop } catch (NoSuchElementException nsee) { parseError("operation.unexpected-end-operation", s.length()); } catch (ParseException pre) { throw pre; } if (parameterlist != null) { // parameterlist is guaranteed to contain at least "(" if (parameterlist.charAt(parameterlist.length() - 1) != ')') { parseError("operation.parameter-list-incomplete", paramOffset + parameterlist.length() - 1); } paramOffset++; parameterlist = parameterlist.substring(1, parameterlist.length() - 1); NotationUtilityUml.parseParamList(op, parameterlist, paramOffset); } if (visibility != null) { Model.getCoreHelper().setVisibility(op, NotationUtilityUml.getVisibility(visibility.trim())); } if (name != null) { Model.getCoreHelper().setName(op, name.trim()); } else if (Model.getFacade().getName(op) == null || "".equals(Model.getFacade().getName(op))) { Model.getCoreHelper().setName(op, "anonymous"); } if (type != null) { Object ow = Model.getFacade().getOwner(op); Object ns = null; if (ow != null && Model.getFacade().getNamespace(ow) != null) { ns = Model.getFacade().getNamespace(ow); } else { ns = Model.getFacade().getRoot(op); } Object mtype = NotationUtilityUml.getType(type.trim(), ns); setReturnParameter(op, mtype); } if (properties != null) { NotationUtilityUml.setProperties(op, properties, NotationUtilityUml.operationSpecialStrings); } // Don't create a stereotype for <<signal>> on a Reception // but create any other parsed stereotypes as needed if (!Model.getFacade().isAReception(op) || !RECEPTION_KEYWORD.equals(stereotype.toString())) { StereotypeUtility.dealWithStereotypes(op, stereotype, true); } }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
private void parseError(String message, int offset) throws ParseException { throw new ParseException( Translator.localize("parsing.error." + message), offset); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
private List<String> tokenOpenBrace(MyTokenizer st, List<String> properties) throws ParseException { String token; StringBuilder propname = new StringBuilder(); String propvalue = null; if (properties == null) { properties = new ArrayList<String>(); } while (true) { token = st.nextToken(); if (",".equals(token) || "}".equals(token)) { if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } propname = new StringBuilder(); propvalue = null; if ("}".equals(token)) { break; } } else if ("=".equals(token)) { if (propvalue != null) { String msg = "parsing.error.operation.prop-stereotypes"; Object[] args = {propname}; throw new ParseException( Translator.localize(msg, args), st.getTokenIndex()); } propvalue = ""; } else if (propvalue == null) { propname.append(token); } else { propvalue += token; } } if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } return properties; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void parseMessage(Object umlMessage, String s) throws ParseException { String fname = null; // the condition or iteration expression (recurrence): StringBuilder guard = null; String paramExpr = null; String token; StringBuilder varname = null; List<List> predecessors = new ArrayList<List>(); List<Integer> seqno = null; List<Integer> currentseq = new ArrayList<Integer>(); // List<String> args = null; boolean mustBePre = false; boolean mustBeSeq = false; boolean parallell = false; boolean iterative = false; boolean mayDeleteExpr = false; boolean refindOperation = false; boolean hasPredecessors = false; currentseq.add(null); currentseq.add(null); try { MyTokenizer st = new MyTokenizer(s, " ,\t,*,[,],.,:,=,/,\\,", MyTokenizer.PAREN_EXPR_STRING_SEPARATOR); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { if (currentseq == null) { if (varname != null && fname == null) { varname.append(token); } } } else if ("[".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-unqualified"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (guard != null) { String msg = "parsing.error.message.several-specs"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } guard = new StringBuilder(); while (true) { token = st.nextToken(); if ("]".equals(token)) { break; } guard.append(token); } } else if ("*".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-unqualified"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (currentseq != null) { iterative = true; } } else if (".".equals(token)) { if (currentseq == null) { String msg = "parsing.error.message.unexpected-dot"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { currentseq.add(null); currentseq.add(null); } } else if (":".equals(token)) { if (st.hasMoreTokens()) { String t = st.nextToken(); if ("=".equals(t)) { st.putToken(":="); continue; } st.putToken(t); } if (mustBePre) { String msg = "parsing.error.message.pred-colon"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (currentseq != null) { if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } seqno = currentseq; currentseq = null; mayDeleteExpr = true; } } else if ("/".equals(token)) { if (st.hasMoreTokens()) { String t = st.nextToken(); if ("/".equals(t)) { st.putToken("//"); continue; } st.putToken(t); } if (mustBeSeq) { String msg = "parsing.error.message.sequence-slash"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBePre = false; mustBeSeq = true; if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { predecessors.add(currentseq); currentseq = new ArrayList<Integer>(); currentseq.add(null); currentseq.add(null); } hasPredecessors = true; } else if ("//".equals(token)) { if (mustBePre) { String msg = "parsing.error.message.pred-parallelized"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBeSeq = true; if (currentseq != null) { parallell = true; } } else if (",".equals(token)) { if (currentseq != null) { if (mustBeSeq) { String msg = "parsing.error.message.many-numbers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } mustBePre = true; if (currentseq.size() > 2 && currentseq.get(currentseq.size() - 2) == null && currentseq.get(currentseq.size() - 1) == null) { currentseq.remove(currentseq.size() - 1); currentseq.remove(currentseq.size() - 1); } if (currentseq.get(currentseq.size() - 2) != null || currentseq.get(currentseq.size() - 1) != null) { predecessors.add(currentseq); currentseq = new ArrayList<Integer>(); currentseq.add(null); currentseq.add(null); } hasPredecessors = true; } else { if (varname == null && fname != null) { varname = new StringBuilder(fname + token); fname = null; } else if (varname != null && fname == null) { varname.append(token); } else { String msg = "parsing.error.message.found-comma"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } } } else if ("=".equals(token) || ":=".equals(token)) { if (currentseq == null) { if (varname == null) { varname = new StringBuilder(fname); fname = ""; } else { fname = ""; } } } else if (currentseq == null) { if (paramExpr == null && token.charAt(0) == '(') { if (token.charAt(token.length() - 1) != ')') { String msg = "parsing.error.message.malformed-parameters"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (fname == null || "".equals(fname)) { String msg = "parsing.error.message.function-not-found"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (varname == null) { varname = new StringBuilder(); } paramExpr = token.substring(1, token.length() - 1); } else if (varname != null && fname == null) { varname.append(token); } else if (fname == null || fname.length() == 0) { fname = token; } else { String msg = "parsing.error.message.unexpected-token"; Object[] parseExcArgs = {token}; throw new ParseException( Translator.localize(msg, parseExcArgs), st.getTokenIndex()); } } else { boolean hasVal = currentseq.get(currentseq.size() - 2) != null; boolean hasOrd = currentseq.get(currentseq.size() - 1) != null; boolean assigned = false; int bp = findMsgOrderBreak(token); if (!hasVal && !assigned && bp == token.length()) { try { currentseq.set( currentseq.size() - 2, Integer.valueOf( token)); assigned = true; } catch (NumberFormatException nfe) { } } if (!hasOrd && !assigned && bp == 0) { try { currentseq.set( currentseq.size() - 1, Integer.valueOf( parseMsgOrder(token))); assigned = true; } catch (NumberFormatException nfe) { } } if (!hasVal && !hasOrd && !assigned && bp > 0 && bp < token.length()) { Integer nbr, ord; try { nbr = Integer.valueOf(token.substring(0, bp)); ord = Integer.valueOf( parseMsgOrder(token.substring(bp))); currentseq.set(currentseq.size() - 2, nbr); currentseq.set(currentseq.size() - 1, ord); assigned = true; } catch (NumberFormatException nfe) { } } if (!assigned) { String msg = "parsing.error.message.unexpected-token"; Object[] parseExcArgs = {token}; throw new ParseException( Translator.localize(msg, parseExcArgs), st.getTokenIndex()); } } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.message.unexpected-end-message"; throw new ParseException(Translator.localize(msg), s.length()); } catch (ParseException pre) { throw pre; } List<String> args = parseArguments(paramExpr, mayDeleteExpr); printDebugInfo(s, fname, guard, paramExpr, varname, predecessors, seqno, parallell, iterative); /* Now apply the changes to the model: */ buildAction(umlMessage); handleGuard(umlMessage, guard, parallell, iterative); fname = fillBlankFunctionName(umlMessage, fname, mayDeleteExpr); varname = fillBlankVariableName(umlMessage, varname, mayDeleteExpr); refindOperation = handleFunctionName(umlMessage, fname, varname, refindOperation); refindOperation = handleArguments(umlMessage, args, refindOperation); refindOperation = handleSequenceNumber(umlMessage, seqno, refindOperation); handleOperation(umlMessage, fname, refindOperation); handlePredecessors(umlMessage, predecessors, hasPredecessors); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void handlePredecessors(Object umlMessage, List<List> predecessors, boolean hasPredecessors) throws ParseException { // Predecessors used to be not implemented, because it // caused some problems that I've not found an easy way to handle yet, // d00mst. The specific problem is that the notation currently is // ambiguous on second message after a thread split. // Why not implement it anyway? d00mst // TODO: Document this ambiguity and the choice made. if (hasPredecessors) { Collection roots = findCandidateRoots( Model.getFacade().getMessages( Model.getFacade().getInteraction(umlMessage)), null, null); List<Object> pre = new ArrayList<Object>(); predfor: for (int i = 0; i < predecessors.size(); i++) { for (Object root : roots) { Object msg = walkTree(root, predecessors.get(i)); if (msg != null && msg != umlMessage) { if (isBadPreMsg(umlMessage, msg)) { String parseMsg = "parsing.error.message.one-pred"; throw new ParseException( Translator.localize(parseMsg), 0); } pre.add(msg); continue predfor; } } String parseMsg = "parsing.error.message.pred-not-found"; throw new ParseException(Translator.localize(parseMsg), 0); } MsgPtr ptr = new MsgPtr(); recCountPredecessors(umlMessage, ptr); if (ptr.message != null && !pre.contains(ptr.message)) { pre.add(ptr.message); } Model.getCollaborationsHelper().setPredecessors(umlMessage, pre); } }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected void handleOperation(Object umlMessage, String fname, boolean refindOperation) throws ParseException { if (fname != null && refindOperation) { Object role = Model.getFacade().getReceiver(umlMessage); List ops = getOperation( Model.getFacade().getBases(role), fname.trim(), Model.getFacade().getActualArguments( Model.getFacade().getAction(umlMessage)).size()); Object callAction = Model.getFacade().getAction(umlMessage); if (Model.getFacade().isACallAction(callAction)) { if (ops.size() > 0) { // If there are more than one suitable operation, // then we pick the first one. Model.getCommonBehaviorHelper().setOperation(callAction, ops.get(0)); } else { Model.getCommonBehaviorHelper().setOperation( callAction, null); } } } }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
protected boolean handleSequenceNumber(Object umlMessage, List<Integer> seqno, boolean refindOperation) throws ParseException { int i; if (seqno != null) { Object/* MMessage */root; // Find the preceding message, if any, on either end of the // association. StringBuilder pname = new StringBuilder(); StringBuilder mname = new StringBuilder(); String gname = generateMessageNumber(umlMessage); boolean swapRoles = false; int majval = 0; if (seqno.get(seqno.size() - 2) != null) { majval = Math.max((seqno.get(seqno.size() - 2)).intValue() - 1, 0); } int minval = 0; if (seqno.get(seqno.size() - 1) != null) { minval = Math.max((seqno.get(seqno.size() - 1)).intValue(), 0); } for (i = 0; i + 1 < seqno.size(); i += 2) { int bv = 1; if (seqno.get(i) != null) { bv = Math.max((seqno.get(i)).intValue(), 1); } int sv = 0; if (seqno.get(i + 1) != null) { sv = Math.max((seqno.get(i + 1)).intValue(), 0); } if (i > 0) { mname.append("."); } mname.append(Integer.toString(bv) + (char) ('a' + sv)); if (i + 3 < seqno.size()) { if (i > 0) { pname.append("."); } pname.append(Integer.toString(bv) + (char) ('a' + sv)); } } root = null; if (pname.length() > 0) { root = findMsg(Model.getFacade().getSender(umlMessage), pname.toString()); if (root == null) { root = findMsg(Model.getFacade().getReceiver(umlMessage), pname.toString()); if (root != null) { swapRoles = true; } } } else if (!hasMsgWithActivator(Model.getFacade().getSender(umlMessage), null) && hasMsgWithActivator(Model.getFacade().getReceiver(umlMessage), null)) { swapRoles = true; } if (compareMsgNumbers(mname.toString(), gname.toString())) { // Do nothing } else if (isMsgNumberStartOf(gname.toString(), mname.toString())) { String msg = "parsing.error.message.subtree-rooted-self"; throw new ParseException(Translator.localize(msg), 0); } else if (Model.getFacade().getPredecessors(umlMessage).size() > 1 && Model.getFacade().getSuccessors(umlMessage).size() > 1) { String msg = "parsing.error.message.start-end-many-threads"; throw new ParseException(Translator.localize(msg), 0); } else if (root == null && pname.length() > 0) { String msg = "parsing.error.message.activator-not-found"; throw new ParseException(Translator.localize(msg), 0); } else if (swapRoles && Model.getFacade().getActivatedMessages(umlMessage).size() > 0 && (Model.getFacade().getSender(umlMessage) != Model.getFacade().getReceiver(umlMessage))) { String msg = "parsing.error.message.reverse-direction-message"; throw new ParseException(Translator.localize(msg), 0); } else { /* Disconnect the message from the call graph * Make copies of returned live collections * since we're modifying */ Collection c = new ArrayList( Model.getFacade().getPredecessors(umlMessage)); Collection c2 = new ArrayList( Model.getFacade().getSuccessors(umlMessage)); Iterator it; it = c2.iterator(); while (it.hasNext()) { Model.getCollaborationsHelper().removeSuccessor(umlMessage, it.next()); } it = c.iterator(); while (it.hasNext()) { Iterator it2 = c2.iterator(); Object pre = /* (MMessage) */it.next(); Model.getCollaborationsHelper().removePredecessor(umlMessage, pre); while (it2.hasNext()) { Model.getCollaborationsHelper().addPredecessor( it2.next(), pre); } } // Connect the message at a new spot Model.getCollaborationsHelper().setActivator(umlMessage, root); if (swapRoles) { Object/* MClassifierRole */r = Model.getFacade().getSender(umlMessage); Model.getCollaborationsHelper().setSender(umlMessage, Model.getFacade().getReceiver(umlMessage)); Model.getCommonBehaviorHelper().setReceiver(umlMessage, r); } if (root == null) { c = filterWithActivator( Model.getFacade().getSentMessages( Model.getFacade().getSender(umlMessage)), null); } else { c = Model.getFacade().getActivatedMessages(root); } c2 = findCandidateRoots(c, root, umlMessage); it = c2.iterator(); // If c2 is empty, then we're done (or there is a // cycle in the message graph, which would be bad) If // c2 has more than one element, then the model is // crappy, but we'll just use one of them anyway if (majval <= 0) { while (it.hasNext()) { Model.getCollaborationsHelper().addSuccessor(umlMessage, /* (MMessage) */it.next()); } } else if (it.hasNext()) { Object/* MMessage */pre = walk(/* (MMessage) */it.next(), majval - 1, false); Object/* MMessage */post = successor(pre, minval); if (post != null) { Model.getCollaborationsHelper() .removePredecessor(post, pre); Model.getCollaborationsHelper() .addPredecessor(post, umlMessage); } insertSuccessor(pre, umlMessage, minval); } refindOperation = true; } } return refindOperation; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
private List getOperation(Collection classifiers, String name, int params) throws ParseException { List<Object> operations = new ArrayList<Object>(); if (name == null || name.length() == 0) { return operations; } for (Object clf : classifiers) { Collection oe = Model.getFacade().getFeatures(clf); for (Object operation : oe) { if (!(Model.getFacade().isAOperation(operation))) { continue; } if (!name.equals(Model.getFacade().getName(operation))) { continue; } if (params != countParameters(operation)) { continue; } operations.add(operation); } } if (operations.size() > 0) { return operations; } Iterator it = classifiers.iterator(); if (it.hasNext()) { StringBuilder expr = new StringBuilder(name + "("); int i; for (i = 0; i < params; i++) { if (i > 0) { expr.append(", "); } expr.append("param" + (i + 1)); } expr.append(")"); // Jaap Branderhorst 2002-23-09 added next lines to link // parameters and operations to the figs that represent // them Object cls = it.next(); Object returnType = ProjectManager.getManager() .getCurrentProject().getDefaultReturnType(); Object op = Model.getCoreFactory().buildOperation(cls, returnType); new OperationNotationUml(op).parseOperation( expr.toString(), op); operations.add(op); } return operations; }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
protected Object parseObjectFlowState2(Object objectFlowState, String s) throws ParseException { s = s.trim(); /* Let's not be picky about the brackets - just remove them: */ if (s.startsWith("[")) { s = s.substring(1); } if (s.endsWith("]")) { s = s.substring(0, s.length() - 1); } s = s.trim(); Object c = Model.getFacade().getType(objectFlowState); // get the // classifier if (c != null) { if (Model.getFacade().isAClassifierInState(c)) { Object classifier = Model.getFacade().getType(c); if ((s == null) || "".equals(s)) { // the State of a ClassifierInState is removed, // so let's reduce it to a Classifier. Model.getCoreHelper().setType(objectFlowState, classifier); delete(c); Model.getCoreHelper().setType(objectFlowState, classifier); return objectFlowState; // the model is changed - job done } Collection states = new ArrayList(Model.getFacade() .getInStates(c)); Collection statesToBeRemoved = new ArrayList(states); Collection namesToBeAdded = new ArrayList(); // Strings StringTokenizer tokenizer = new StringTokenizer(s, ","); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); boolean found = false; Iterator i = states.iterator(); while (i.hasNext()) { Object state = i.next(); if (Model.getFacade().getName(state) == nextToken) { found = true; statesToBeRemoved.remove(state); } } if (!found) { namesToBeAdded.add(nextToken); } } /* Remove the states that did not match. */ states.removeAll(statesToBeRemoved); Iterator i = namesToBeAdded.iterator(); while (i.hasNext()) { String name = (String) i.next(); /* * Now we have to see if any state in any statemachine of * classifier is named [name]. If so, then we only have to * link the state to c. */ Object state = Model.getActivityGraphsHelper() .findStateByName(classifier, name); if (state != null) { states.add(state); // the model is changed - our job is done } else { // no state named s is found, so we have to // reject the user's input String msg = "parsing.error.object-flow-state.state-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); } } /* Finally, do the adaptations: */ Model.getActivityGraphsHelper().setInStates(c, states); } else { // then c is a "normal" Classifier Collection statesToBeAdded = new ArrayList(); // UML states StringTokenizer tokenizer = new StringTokenizer(s, ","); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); Object state = Model.getActivityGraphsHelper() .findStateByName(c, nextToken); if (state != null) { statesToBeAdded.add(state); } else { // no state with the given name is found, so we have to // reject the complete user's input String msg = "parsing.error.object-flow-state.state-not-found"; Object[] args = {s}; throw new ParseException(Translator.localize(msg, args), 0); } } // let's create a new ClassifierInState with the correct links Object cis = Model.getActivityGraphsFactory() .buildClassifierInState(c, statesToBeAdded); Model.getCoreHelper().setType(objectFlowState, cis); // the model is changed - our job is done } } else { // if no classifier has been set, then entering a state is // not useful, so the user's input has to be rejected. String msg = "parsing.error.object-flow-state.classifier-not-found"; throw new ParseException(Translator.localize(msg), 0); } return objectFlowState; }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
protected Object parseClassifierRole(Object cls, String s) throws ParseException { String name = null; String token; String role = null; String base = null; List<String> bases = null; boolean hasColon = false; boolean hasSlash = false; try { MyTokenizer st = new MyTokenizer(s, " ,\t,/,:,\\,"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token)) { /* Do nothing. */ } else if ("/".equals(token)) { hasSlash = true; hasColon = false; if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } base = null; } else if (":".equals(token)) { hasColon = true; hasSlash = false; if (bases == null) { bases = new ArrayList<String>(); } if (base != null) { bases.add(base); } base = null; } else if (",".equals(token)) { if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } base = null; } else if (hasColon) { if (base != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } base = token; } else if (hasSlash) { if (role != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } role = token; } else { if (name != null) { String msg = "parsing.error.classifier.extra-test"; throw new ParseException( Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.classifier.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), s.length()); } if (base != null) { if (bases == null) { bases = new ArrayList<String>(); } bases.add(base); } // TODO: What to do about object name??? // if (name != null) // ; if (role != null) { Model.getCoreHelper().setName(cls, role.trim()); } if (bases != null) { // Remove bases that aren't there anymore // copy - can't iterate modify live collection while iterating it Collection b = new ArrayList(Model.getFacade().getBases(cls)); Iterator it = b.iterator(); Object c; Object ns = Model.getFacade().getNamespace(cls); if (ns != null && Model.getFacade().getNamespace(ns) != null) { ns = Model.getFacade().getNamespace(ns); } else { ns = Model.getFacade().getRoot(cls); } while (it.hasNext()) { c = it.next(); if (!bases.contains(Model.getFacade().getName(c))) { Model.getCollaborationsHelper().removeBase(cls, c); } } it = bases.iterator(); addBases: while (it.hasNext()) { String d = ((String) it.next()).trim(); Iterator it2 = b.iterator(); while (it2.hasNext()) { c = it2.next(); if (d.equals(Model.getFacade().getName(c))) { continue addBases; } } c = NotationUtilityUml.getType(d, ns); if (Model.getFacade().isACollaboration( Model.getFacade().getNamespace(c))) { Model.getCoreHelper().setNamespace(c, ns); } Model.getCollaborationsHelper().addBase(cls, c); } } return cls; }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
protected Object parseCallState(Object callState, String s1) throws ParseException { String s = s1.trim(); int a = s.indexOf("("); int b = s.indexOf(")"); if (((a < 0) && (b >= 0)) || ((b < 0) && (a >= 0)) || (b < a)) { throw new ParseException("No matching brackets () found.", 0); } /* First we decode the string: */ String newClassName = null; String newOperationName = null; StringTokenizer tokenizer = new StringTokenizer(s, "("); while (tokenizer.hasMoreTokens()) { String nextToken = tokenizer.nextToken().trim(); if (nextToken.endsWith(")")) { newClassName = nextToken.substring(0, nextToken.length() - 1); } else { newOperationName = nextToken.trim(); } } /* Secondly we check the previous model structure: */ String oldOperationName = null; String oldClassName = null; Object entry = Model.getFacade().getEntry(callState); Object operation = null; Object clazz = null; if (Model.getFacade().isACallAction(entry)) { operation = Model.getFacade().getOperation(entry); if (Model.getFacade().isAOperation(operation)) { oldOperationName = Model.getFacade().getName(operation); clazz = Model.getFacade().getOwner(operation); oldClassName = Model.getFacade().getName(clazz); } } /* And 3rd, we adapt the model: */ boolean found = false; if ((newClassName != null) && newClassName.equals(oldClassName) && (newOperationName != null) && !newOperationName.equals(oldOperationName)) { // Same class, other operation for ( Object op : Model.getFacade().getOperations(clazz)) { if (newOperationName.equals( Model.getFacade().getName(op))) { Model.getCommonBehaviorHelper().setOperation(entry, op); found = true; break; } } if (!found) { throw new ParseException( "Operation " + newOperationName + " not found in " + newClassName + ".", 0); } } else if ((newClassName != null) && !newClassName.equals(oldClassName) && (newOperationName != null)) { // Other class Object model = ProjectManager.getManager().getCurrentProject().getRoot(); Collection c = Model.getModelManagementHelper(). getAllModelElementsOfKind(model, Model.getMetaTypes().getClassifier()); Iterator i = c.iterator(); Object classifier = null; while (i.hasNext()) { Object cl = i.next(); String cn = Model.getFacade().getName(cl); if (cn.equals(newClassName)) { classifier = cl; break; } } if (classifier == null) { throw new ParseException( "Classifier " + newClassName + " not found.", 0); } // We found the classifier, now go find the operation: if (classifier != null) { Collection ops = Model.getFacade().getOperations(classifier); Iterator io = ops.iterator(); while (io.hasNext()) { Object op = io.next(); if (newOperationName.equals( Model.getFacade().getName(op))) { /* Here we located the new classifier * with its operation. */ found = true; if (!Model.getFacade().isACallAction(entry)) { entry = Model.getCommonBehaviorFactory() .buildCallAction(op, "ca"); Model.getStateMachinesHelper().setEntry( callState, entry); } else { Model.getCommonBehaviorHelper().setOperation( entry, op); } break; } } if (!found) { throw new ParseException( "Operation " + newOperationName + " not found in " + newClassName + ".", 0); } } } if (!found) { throw new ParseException( "Incompatible input found.", 0); } return callState; }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
public void parseAttributeFig( Object classifier, Object attribute, String text) throws ParseException { if (classifier == null || attribute == null) { return; } /* TODO: We should have all the information that is required in the * NotationSettings object */ Project project = ProjectManager.getManager().getCurrentProject(); ParseException pex = null; int start = 0; int end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); if (end == -1) { //no text? remove attr! project.moveToTrash(attribute); return; } String s = text.substring(start, end).trim(); if (s.length() == 0) { //no non-whitechars in text? remove attr! project.moveToTrash(attribute); return; } parseAttribute(s, attribute); int i = Model.getFacade().getFeatures(classifier).indexOf(attribute); // check for more attributes (';' separated): start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); while (end > start && end <= text.length()) { s = text.substring(start, end).trim(); if (s.length() > 0) { // yes, there are more: Object attrType = project.getDefaultAttributeType(); Object newAttribute = Model.getUmlFactory().buildNode( Model.getMetaTypes().getAttribute()); Model.getCoreHelper().setType(newAttribute, attrType); if (newAttribute != null) { /* We need to set the namespace/owner * of the new attribute before parsing: */ if (i != -1) { Model.getCoreHelper().addFeature( classifier, ++i, newAttribute); } else { Model.getCoreHelper().addFeature( classifier, newAttribute); } try { parseAttribute(s, newAttribute); /* If the 1st attribute is static, * then the new ones, too. */ Model.getCoreHelper().setStatic( newAttribute, Model.getFacade().isStatic(attribute)); } catch (ParseException ex) { if (pex == null) { pex = ex; } } } } start = end + 1; end = NotationUtilityUml.indexOfNextCheckedSemicolon(text, start); } if (pex != null) { throw pex; } }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
protected void parseAttribute( String text, Object attribute) throws ParseException { StringBuilder multiplicity = null; String name = null; List<String> properties = null; StringBuilder stereotype = null; // This is null as until // the first stereotype declaration is seen. // After that it is non-null. String token; String type = null; StringBuilder value = null; String visibility = null; boolean derived = false; boolean hasColon = false; boolean hasEq = false; int multindex = -1; MyTokenizer st; text = text.trim(); /* Handle Derived: */ if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { derived = true; text = text.substring(1); text = text.trim(); } /* Handle Visibility: */ if (text.length() > 0 && NotationUtilityUml.VISIBILITYCHARS.indexOf(text.charAt(0)) >= 0) { visibility = text.substring(0, 1); text = text.substring(1); } try { st = new MyTokenizer(text, " ,\t,<<,\u00AB,\u00BB,>>,[,],:,=,{,},\\,", NotationUtilityUml.attributeCustomSep); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token) || "\t".equals(token) || ",".equals(token)) { if (hasEq) { value.append(token); } } else if ("<<".equals(token) || "\u00AB".equals(token)) { if (hasEq) { value.append(token); } else { if (stereotype != null) { String msg = "parsing.error.attribute.two-sets-stereotypes"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } stereotype = new StringBuilder(); while (true) { token = st.nextToken(); if (">>".equals(token) || "\u00BB".equals(token)) { break; } stereotype.append(token); } } } else if ("[".equals(token)) { if (hasEq) { value.append(token); } else { if (multiplicity != null) { String msg = "parsing.error.attribute.two-multiplicities"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } multiplicity = new StringBuilder(); multindex = st.getTokenIndex() + 1; while (true) { token = st.nextToken(); if ("]".equals(token)) { break; } multiplicity.append(token); } } } else if ("{".equals(token)) { StringBuilder propname = new StringBuilder(); String propvalue = null; if (properties == null) { properties = new ArrayList<String>(); } while (true) { token = st.nextToken(); if (",".equals(token) || "}".equals(token)) { if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } propname = new StringBuilder(); propvalue = null; if ("}".equals(token)) { break; } } else if ("=".equals(token)) { if (propvalue != null) { String msg = "parsing.error.attribute.prop-two-values"; Object[] args = {propvalue}; throw new ParseException(Translator.localize( msg, args), st.getTokenIndex()); } propvalue = ""; } else if (propvalue == null) { propname.append(token); } else { propvalue += token; } } if (propname.length() > 0) { properties.add(propname.toString()); properties.add(propvalue); } } else if (":".equals(token)) { hasColon = true; hasEq = false; } else if ("=".equals(token)) { if (value != null) { String msg = "parsing.error.attribute.two-default-values"; throw new ParseException(Translator.localize(msg), st .getTokenIndex()); } value = new StringBuilder(); hasColon = false; hasEq = true; } else { if (hasColon) { if (type != null) { String msg = "parsing.error.attribute.two-types"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { String msg = "parsing.error.attribute.quoted"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { String msg = "parsing.error.attribute.is-expr"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } type = token; } else if (hasEq) { value.append(token); } else { if (name != null && visibility != null) { String msg = "parsing.error.attribute.extra-text"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && (token.charAt(0) == '\"' || token.charAt(0) == '\'')) { String msg = "parsing.error.attribute.name-quoted"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (token.length() > 0 && token.charAt(0) == '(') { String msg = "parsing.error.attribute.name-expr"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (name == null && visibility == null && token.length() > 1 && NotationUtilityUml.VISIBILITYCHARS .indexOf(token.charAt(0)) >= 0) { visibility = token.substring(0, 1); token = token.substring(1); } if (name != null) { visibility = name; name = token; } else { name = token; } } } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.attribute.unexpected-end-attribute"; throw new ParseException(Translator.localize(msg), text.length()); } // catch & rethrow is not necessary if we don't do nothing (penyaskito) // catch (ParseException pre) { // throw pre; // } if (LOG.isDebugEnabled()) { LOG.debug("ParseAttribute [name: " + name + " visibility: " + visibility + " type: " + type + " value: " + value + " stereo: " + stereotype + " mult: " + multiplicity); if (properties != null) { for (int i = 0; i + 1 < properties.size(); i += 2) { LOG.debug("\tProperty [name: " + properties.get(i) + " = " + properties.get(i + 1) + "]"); } } } dealWithDerived(attribute, derived); dealWithVisibility(attribute, visibility); dealWithName(attribute, name); dealWithType(attribute, type); dealWithValue(attribute, value); dealWithMultiplicity(attribute, multiplicity, multindex); dealWithProperties(attribute, properties); StereotypeUtility.dealWithStereotypes(attribute, stereotype, true); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
private void dealWithMultiplicity(Object attribute, StringBuilder multiplicity, int multindex) throws ParseException { if (multiplicity != null) { try { Model.getCoreHelper().setMultiplicity(attribute, multiplicity.toString()); } catch (IllegalArgumentException iae) { String msg = "parsing.error.attribute.bad-multiplicity"; Object[] args = {iae}; throw new ParseException(Translator.localize(msg, args), multindex); } } }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
static void parseModelElement(Object modelElement, String text) throws ParseException { MyTokenizer st; boolean abstrac = false; boolean fina = false; boolean publi = false; boolean privat = false; boolean protect = false; String token; List<String> path = null; String name = null; try { st = new MyTokenizer(text, " ,.,abstract,final,public,private,protected"); while (st.hasMoreTokens()) { token = st.nextToken(); if (" ".equals(token)) { /* skip spaces */ } else if ("abstract".equals(token)) { abstrac = true; } else if ("final".equals(token)) { fina = true; } else if ("public".equals(token)) { publi = true; } else if ("private".equals(token)) { privat = true; } else if ("protected".equals(token)) { protect = true; } else if (".".equals(token)) { if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.anon-qualifiers"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } if (path == null) { path = new ArrayList<String>(); } if (name != null) { path.add(name); } name = null; } else { // the name itself if (name != null) { String msg = "parsing.error.model-element-name.twin-names"; throw new ParseException(Translator.localize(msg), st.getTokenIndex()); } name = token; } } } catch (NoSuchElementException nsee) { String msg = "parsing.error.model-element-name.unexpected-name-element"; throw new ParseException(Translator.localize(msg), text.length()); } catch (ParseException pre) { throw pre; } if (name != null) { name = name.trim(); } if (path != null && (name == null || "".equals(name))) { String msg = "parsing.error.model-element-name.must-end-with-name"; throw new ParseException(Translator.localize(msg), 0); } /* Check the name for validity: */ if (!isValidJavaClassName(name)) { throw new ParseException( "Invalid class name for Java: " + name, 0); } if (path != null) { Object nspe = Model.getModelManagementHelper().getElement( path, Model.getFacade().getRoot(modelElement)); if (nspe == null || !(Model.getFacade().isANamespace(nspe))) { String msg = "parsing.error.model-element-name.namespace-unresolved"; throw new ParseException(Translator.localize(msg), 0); } if (!Model.getCoreHelper().isValidNamespace( modelElement, nspe)) { String msg = "parsing.error.model-element-name.namespace-invalid"; throw new ParseException(Translator.localize(msg), 0); } Model.getCoreHelper().addOwnedElement(nspe, modelElement); } Model.getCoreHelper().setName(modelElement, name); if (abstrac) { Model.getCoreHelper().setAbstract(modelElement, abstrac); } if (fina) { Model.getCoreHelper().setLeaf(modelElement, fina); } if (publi) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getPublic()); } if (privat) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getPrivate()); } if (protect) { Model.getCoreHelper().setVisibility(modelElement, Model.getVisibilityKind().getProtected()); } }
26
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-end-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateTypeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/TransitionNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.transition"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-role"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/MultiplicityNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.multiplicity"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AssociationNameNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.association-name"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.statebody"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.enumeration-literal"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException ex) { if (pex == null) { pex = ex; } }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.operation"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException ex) { if (pex == null) { pex = ex; } }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.message"; final Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.objectflowstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.classifierrole"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/CallStateNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.callstate"; Object[] args = {pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.attribute"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/uml/AttributeNotationUml.java
catch (ParseException ex) { if (pex == null) { pex = ex; } }
// in src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
catch (ParseException pe) { final String msg = "statusmsg.bar.error.parsing.node-modelelement"; final Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pe) { String msg = "statusmsg.bar.error.parsing.node-modelelement"; Object[] args = { pe.getLocalizedMessage(), Integer.valueOf(pe.getErrorOffset()), }; ArgoEventPump.fireEvent(new ArgoHelpEvent( ArgoEventTypes.HELP_CHANGED, this, Translator.messageFormat(msg, args))); }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pre) { throw pre; }
6
            
// in src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/NotationUtilityUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/EnumerationLiteralNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/OperationNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
catch (ParseException pre) { throw pre; }
// in src/org/argouml/notation/providers/java/ModelElementNameNotationJava.java
catch (ParseException pre) { throw pre; }
0
unknown (Lib) ParserConfigurationException 0 0 0 1
            
// in src/org/argouml/persistence/SAXParserBase.java
catch (ParserConfigurationException e) { throw new SAXException(e); }
1
            
// in src/org/argouml/persistence/SAXParserBase.java
catch (ParserConfigurationException e) { throw new SAXException(e); }
0
checked (Domain) PersistenceException
class PersistenceException extends Exception {
    /**
     * Constructor.
     */
    public PersistenceException() {
        super();
    }

    /**
     * Constructor.
     *
     * @param message the message
     */
    public PersistenceException(String message) {
        super(message);
    }

    /**
     * @param message the message
     * @param c the cause of the exception
     */
    public PersistenceException(String message, Throwable c) {
        super(message, c);
    }

    /**
     * @param c the cause of the exception
     */
    public PersistenceException(Throwable c) {
        super(c);
    }


    /**
     * The UID.
     */
    private static final long serialVersionUID = 4626477344515962964L;
}
0 0 0 0 0 0
checked (Domain) ProfileException
public class ProfileException extends Exception {

    /**
     * The constructor.
     *
     * @param message the message to show
     */
    public ProfileException(String message) {
        super(message);
    }

    /**
     * The constructor.
     *
     * @param message the message to show
     * @param theCause the cause for the exception
     */
    public ProfileException(String message, Throwable theCause) {
        super(message, theCause);
    }

    /**
     * The constructor.
     *
     * @param theCause the cause for the exception
     */
    public ProfileException(Throwable theCause) {
        super(theCause);
    }
}
15
            
// in src/org/argouml/profile/ZipModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from ZIP '" + reference.getPath() + "'"); if (!reference.getPath().endsWith("zip")) { throw new ProfileException("Profile could not be loaded!"); } InputStream is = null; File modelFile = new File(reference.getPath()); // TODO: This is in the wrong place. It's not profile specific. // It needs to be moved to main XMI reading code. - tfm 20060326 String filename = modelFile.getName(); String extension = filename.substring(filename.indexOf('.'), filename.lastIndexOf('.')); String path = modelFile.getParent(); // Add the path of the model to the search path, so we can // read dependent models if (path != null) { System.setProperty("org.argouml.model.modules_search_path", path); } try { is = openZipStreamAt(modelFile.toURI().toURL(), extension); } catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); } catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); } if (is == null) { throw new ProfileException("Profile could not be loaded!"); } return super.loadModel(is, reference.getPublicReference()); }
// in src/org/argouml/profile/ReaderModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { if (reader == null) { LOG.error("Profile not found"); throw new ProfileException("Profile not found!"); } try { XmiReader xmiReader = Model.getXmiReader(); InputSource inputSource = new InputSource(reader); inputSource.setSystemId(reference.getPath()); inputSource.setPublicId( reference.getPublicReference().toString()); Collection elements = xmiReader.parse(inputSource, true); return elements; } catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); } }
// in src/org/argouml/profile/FileModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from file'" + reference.getPath() + "'"); try { File modelFile = new File(reference.getPath()); URL url = modelFile.toURI().toURL(); return super.loadModel(url, reference.getPublicReference()); } catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); } }
// in src/org/argouml/profile/StreamModelLoader.java
public Collection loadModel(InputStream inputStream, URL publicReference) throws ProfileException { if (inputStream == null) { LOG.error("Profile not found"); throw new ProfileException("Profile not found!"); } try { XmiReader xmiReader = Model.getXmiReader(); InputSource inputSource = new InputSource(inputStream); inputSource.setPublicId(publicReference.toString()); Collection elements = xmiReader.parse(inputSource, true); return elements; } catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); } }
// in src/org/argouml/profile/URLModelLoader.java
public Collection loadModel(URL url, URL publicId) throws ProfileException { if (url == null) { throw new ProfileException("Null profile URL"); } Collection elements = Model.getUmlFactory().getExtentElements(publicId.toExternalForm()); if (elements == null) { ZipInputStream zis = null; try { XmiReader xmiReader = Model.getXmiReader(); if (url.getPath().toLowerCase().endsWith(".zip")) { zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); // TODO: check if it's OK to just get the first zip entry // since the zip file should contain only one xmi file - thn if (entry != null) { url = makeZipEntryUrl(url, entry.getName()); } zis.close(); } InputSource inputSource = new InputSource(url.toExternalForm()); inputSource.setPublicId(publicId.toString()); elements = xmiReader.parse(inputSource, true); } catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); } catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); } } return elements; }
10
            
// in src/org/argouml/profile/ZipModelLoader.java
catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/ZipModelLoader.java
catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (MalformedURLException e) { throw new ProfileException( "Failed to create the ProfileReference.", e); }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (MalformedURLException e) { throw new ProfileException( "Exception while creating profile reference.", e); }
// in src/org/argouml/profile/ReaderModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/FileModelLoader.java
catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); }
// in src/org/argouml/profile/StreamModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); }
17
            
// in src/org/argouml/profile/ZipModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from ZIP '" + reference.getPath() + "'"); if (!reference.getPath().endsWith("zip")) { throw new ProfileException("Profile could not be loaded!"); } InputStream is = null; File modelFile = new File(reference.getPath()); // TODO: This is in the wrong place. It's not profile specific. // It needs to be moved to main XMI reading code. - tfm 20060326 String filename = modelFile.getName(); String extension = filename.substring(filename.indexOf('.'), filename.lastIndexOf('.')); String path = modelFile.getParent(); // Add the path of the model to the search path, so we can // read dependent models if (path != null) { System.setProperty("org.argouml.model.modules_search_path", path); } try { is = openZipStreamAt(modelFile.toURI().toURL(), extension); } catch (MalformedURLException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); } catch (IOException e) { LOG.error("Exception while loading profile '" + reference.getPath() + "'", e); throw new ProfileException(e); } if (is == null) { throw new ProfileException("Profile could not be loaded!"); } return super.loadModel(is, reference.getPublicReference()); }
// in src/org/argouml/profile/UserDefinedProfile.java
Deprecated public UserDefinedProfile(File file) throws ProfileException { this(file, getSomeProfileManager()); }
// in src/org/argouml/profile/UserDefinedProfile.java
Deprecated public UserDefinedProfile(URL url) throws ProfileException { this(url, getSomeProfileManager()); }
// in src/org/argouml/profile/UserDefinedProfile.java
Deprecated public UserDefinedProfile(String dn, URL url, Set<Critic> critics, Set<String> dependencies) throws ProfileException { this(dn, url, critics, dependencies, getSomeProfileManager()); }
// in src/org/argouml/profile/ResourceModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from resource'" + reference.getPath() + "'"); return super.loadModel(clazz.getResource(reference.getPath()), reference.getPublicReference()); }
// in src/org/argouml/profile/Profile.java
public Collection getProfilePackages() throws ProfileException { return Collections.emptyList(); }
// in src/org/argouml/profile/Profile.java
public Collection getLoadedPackages() throws ProfileException { return getProfilePackages(); }
// in src/org/argouml/profile/internal/ProfileMeta.java
Override public Collection getProfilePackages() throws ProfileException { return Collections.unmodifiableCollection(getModel()); }
// in src/org/argouml/profile/ReaderModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { if (reader == null) { LOG.error("Profile not found"); throw new ProfileException("Profile not found!"); } try { XmiReader xmiReader = Model.getXmiReader(); InputSource inputSource = new InputSource(reader); inputSource.setSystemId(reference.getPath()); inputSource.setPublicId( reference.getPublicReference().toString()); Collection elements = xmiReader.parse(inputSource, true); return elements; } catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); } }
// in src/org/argouml/profile/FileModelLoader.java
public Collection loadModel(ProfileReference reference) throws ProfileException { LOG.info("Loading profile from file'" + reference.getPath() + "'"); try { File modelFile = new File(reference.getPath()); URL url = modelFile.toURI().toURL(); return super.loadModel(url, reference.getPublicReference()); } catch (MalformedURLException e) { throw new ProfileException("Model file not found!", e); } }
// in src/org/argouml/profile/StreamModelLoader.java
public Collection loadModel(InputStream inputStream, URL publicReference) throws ProfileException { if (inputStream == null) { LOG.error("Profile not found"); throw new ProfileException("Profile not found!"); } try { XmiReader xmiReader = Model.getXmiReader(); InputSource inputSource = new InputSource(inputStream); inputSource.setPublicId(publicReference.toString()); Collection elements = xmiReader.parse(inputSource, true); return elements; } catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); } }
// in src/org/argouml/profile/URLModelLoader.java
public Collection loadModel(URL url, URL publicId) throws ProfileException { if (url == null) { throw new ProfileException("Null profile URL"); } Collection elements = Model.getUmlFactory().getExtentElements(publicId.toExternalForm()); if (elements == null) { ZipInputStream zis = null; try { XmiReader xmiReader = Model.getXmiReader(); if (url.getPath().toLowerCase().endsWith(".zip")) { zis = new ZipInputStream(url.openStream()); ZipEntry entry = zis.getNextEntry(); // TODO: check if it's OK to just get the first zip entry // since the zip file should contain only one xmi file - thn if (entry != null) { url = makeZipEntryUrl(url, entry.getName()); } zis.close(); } InputSource inputSource = new InputSource(url.toExternalForm()); inputSource.setPublicId(publicId.toString()); elements = xmiReader.parse(inputSource, true); } catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); } catch (IOException e) { throw new ProfileException("I/O error loading profile XMI ", e); } } return elements; }
// in src/org/argouml/profile/URLModelLoader.java
public Collection loadModel(final ProfileReference reference) throws ProfileException { return loadModel(reference.getPublicReference(), reference .getPublicReference()); }
17
            
// in src/org/argouml/ui/SettingsTabProfile.java
catch (ProfileException e) { JOptionPane.showMessageDialog(this, Translator .localize("tab.profiles.userdefined.errorloading") + ": " + file.getAbsolutePath()); }
// in src/org/argouml/ui/ProjectSettingsTabProfile.java
catch (ProfileException e) { JOptionPane.showMessageDialog(this, Translator .localize("tab.profiles.userdefined.errorloading")); }
// in src/org/argouml/ui/explorer/rules/GoProfileToModel.java
catch (ProfileException e) { return Collections.EMPTY_SET; }
// in src/org/argouml/ui/explorer/ActionDeployProfile.java
catch (ProfileException e) { LOG.warn("failed to load profile from file " + f.getPath(), e); }
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
catch (ProfileException e) { // TODO: We should be giving the user more direct feedback LOG.error("Exception", e); }
// in src/org/argouml/profile/UserDefinedProfile.java
catch (ProfileException e1) { LOG.error("Exception loading profile " + reference.getPath(), e1); profilePackages = Collections.emptySet(); return; }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // TODO: Why is this throwing a generic runtime exception?!?! throw new RuntimeException(e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // if an exception is raised file is unusable LOG.info("Failed to load user defined profile " + file.getAbsolutePath() + ".", e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { LOG.error("Error loading profile: " + file, e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // Nothing to delete if we couldn't get the packages }
// in src/org/argouml/profile/internal/ProfileMeta.java
catch (ProfileException e) { LOG.error("Exception loading metaprofile " + PROFILE_FILE, e); }
// in src/org/argouml/profile/internal/ProfileUML.java
catch (ProfileException e) { LOG.error("Error loading UML profile", e); }
// in src/org/argouml/profile/init/ProfileLoader.java
catch (ProfileException e) { LOG.error("Exception", e); }
// in src/org/argouml/kernel/ProfileConfiguration.java
catch (ProfileException e) { LOG.warn("Error retrieving profile's " + p + " packages.", e); }
// in src/org/argouml/kernel/ProfileConfiguration.java
catch (ProfileException e) { LOG.error("Exception", e); }
// in src/org/argouml/kernel/ProjectImpl.java
catch (org.argouml.profile.ProfileException e) { LOG.error("Exception when fetching models from profile " + profile.getDisplayName(), e); }
// in src/org/argouml/kernel/ProjectManager.java
catch (ProfileException pe) { LOG.warn("Failed to get profile packages from profile " + p.getDisplayName()); }
1
            
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // TODO: Why is this throwing a generic runtime exception?!?! throw new RuntimeException(e); }
1
unknown (Lib) PropertyVetoException 1
            
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { if ("name".equals(evt.getPropertyName())) { if (project != null) { if (!project.isValidDiagramName((String) evt.getNewValue())) { throw new PropertyVetoException("Invalid name", evt); } } } }
0 7
            
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
protected void textEdited(FigText ft) throws PropertyVetoException { if (ft == nameFig) { // TODO: Can we delegate this to a specialist FigName class? if (getOwner() == null) { return; } notationProviderName.parse(getOwner(), ft.getText()); ft.setText(notationProviderName.toString(getOwner(), getNotationSettings())); } if (ft instanceof CompartmentFigText) { final CompartmentFigText figText = (CompartmentFigText) ft; figText.getNotationProvider().parse(ft.getOwner(), ft.getText()); ft.setText(figText.getNotationProvider().toString( ft.getOwner(), getNotationSettings())); } }
// in src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
private void createClassDiagram( Object namespace, String defaultName, Project project) throws PropertyVetoException { String namespaceDescr; if (namespace != null && Model.getFacade().getName(namespace) != null) { namespaceDescr = Model.getFacade().getName(namespace); } else { namespaceDescr = Translator.localize("misc.name.anon"); } String dialogText = "Add new class diagram to " + namespaceDescr + "?"; int option = JOptionPane.showConfirmDialog( null, dialogText, "Add new class diagram?", JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { ArgoDiagram classDiagram = DiagramFactory.getInstance(). createDiagram(DiagramType.Class, namespace, null); String diagramName = defaultName + "_" + classDiagram.getName(); project.addMember(classDiagram); TargetManager.getInstance().setTarget(classDiagram); /* change prefix */ classDiagram.setName(diagramName); ExplorerEventAdaptor.getInstance().structureChanged(); } }
// in src/org/argouml/uml/diagram/state/ui/FigState.java
Override public void textEdited(FigText ft) throws PropertyVetoException { super.textEdited(ft); if (ft == getInternal()) { Object st = getOwner(); if (st == null) { return; } notationProviderBody.parse(getOwner(), ft.getText()); ft.setText(notationProviderBody.toString(getOwner(), getNotationSettings())); } }
// in src/org/argouml/uml/diagram/state/ui/FigVertex.java
Override public void textEdited(FigText ft) throws PropertyVetoException { super.textEdited(ft); if (ft == getBodyText()) { notationProviderBody.parse(getOwner(), ft.getText()); ft.setText(notationProviderBody.toString(getOwner(), getNotationSettings())); } }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
public void setName(String n) throws PropertyVetoException { super.setName(n); MutableGraphSupport.enableSaveAction(); }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { if ("name".equals(evt.getPropertyName())) { if (project != null) { if (!project.isValidDiagramName((String) evt.getNewValue())) { throw new PropertyVetoException("Invalid name", evt); } } } }
// in src/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java
Override protected void textEdited(FigText ft) throws PropertyVetoException { super.textEdited(ft); if (ft == state) { notationProviderState.parse(getOwner(), ft.getText()); ft.setText(notationProviderState.toString(getOwner(), getNotationSettings())); } }
17
            
// in src/org/argouml/uml/ui/foundation/core/UMLDiagramNameDocument.java
catch (PropertyVetoException e) { // TODO: what shall we do with the exception? }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
catch (PropertyVetoException ex) { LOG.error("could not parse the text entered. " + "PropertyVetoException", ex); }
// in src/org/argouml/uml/diagram/ui/UMLDiagram.java
catch (PropertyVetoException pve) { LOG.fatal("Name not allowed in construction of diagram"); }
// in src/org/argouml/uml/diagram/ui/DiagramNameDocument.java
catch (PropertyVetoException pe) { // Provide feedback to the user that their name was // not accepted try { highlightTag = field.getHighlighter().addHighlight(0, field.getText().length(), DefaultHighlighter.DefaultPainter); } catch (BadLocationException e1) { LOG.debug("Nested exception", e1); } }
// in src/org/argouml/uml/diagram/deployment/ui/UMLDeploymentDiagram.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java
catch (PropertyVetoException pve) { LOG.warn("Generated diagram name '" + name + "' was vetoed by setName"); }
// in src/org/argouml/uml/diagram/collaboration/ui/UMLCollaborationDiagram.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
catch (PropertyVetoException pve) { // nothing we can do about veto, so just ignore it }
// in src/org/argouml/uml/diagram/state/ui/UMLStateDiagram.java
catch (PropertyVetoException pve) { // nothing we can do about veto, so just ignore it }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/ArgoDiagramImpl.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
catch (PropertyVetoException pve) { // no action required in case of veto on setName }
// in src/org/argouml/uml/diagram/activity/ui/UMLActivityDiagram.java
catch (PropertyVetoException pve) { // no action required }
// in src/org/argouml/uml/diagram/use_case/ui/UMLUseCaseDiagram.java
catch (PropertyVetoException pve) { }
// in src/org/argouml/uml/diagram/use_case/ui/UMLUseCaseDiagram.java
catch (PropertyVetoException v) { }
// in src/org/argouml/uml/reveng/DiagramInterface.java
catch (PropertyVetoException pve) { LOG.error("Failed to set diagram name.", pve); }
// in src/org/argouml/kernel/ProjectImpl.java
catch (PropertyVetoException e) { serial++; }
0 0
runtime (Lib) RuntimeException 17
            
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
private void removeElementListeners(Set<Object[]> listenerSet) { for (Object[] listener : listenerSet) { Object property = listener[1]; if (property == null) { Model.getPump().removeModelEventListener(this, listener[0]); } else if (property instanceof String[]) { Model.getPump().removeModelEventListener(this, listener[0], (String[]) property); } else if (property instanceof String) { Model.getPump().removeModelEventListener(this, listener[0], (String) property); } else { throw new RuntimeException( "Internal error in removeAllElementListeners"); } } listeners.removeAll(listenerSet); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
private void addElementListeners(Set<Object[]> listenerSet) { for (Object[] listener : listenerSet) { Object property = listener[1]; if (property == null) { addElementListener(listener[0]); } else if (property instanceof String[]) { addElementListener(listener[0], (String[]) property); } else if (property instanceof String) { addElementListener(listener[0], (String) property); } else { throw new RuntimeException( "Internal error in addElementListeners"); } } }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private void removeElementListeners(Set<Object[]> listenerSet) { for (Object[] listener : listenerSet) { Object property = listener[1]; if (property == null) { Model.getPump().removeModelEventListener(this, listener[0]); } else if (property instanceof String[]) { Model.getPump().removeModelEventListener(this, listener[0], (String[]) property); } else if (property instanceof String) { Model.getPump().removeModelEventListener(this, listener[0], (String) property); } else { throw new RuntimeException( "Internal error in removeAllElementListeners"); } } listeners.removeAll(listenerSet); }
// in src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
private void addElementListeners(Set<Object[]> listenerSet) { for (Object[] listener : listenerSet) { Object property = listener[1]; if (property == null) { addElementListener(listener[0]); } else if (property instanceof String[]) { addElementListener(listener[0], (String[]) property); } else if (property instanceof String) { addElementListener(listener[0], (String) property); } else { throw new RuntimeException( "Internal error in addElementListeners"); } } }
// in src/org/argouml/uml/reveng/DiagramInterface.java
public boolean isDiagramInProject(String name) { if (currentProject == null) { throw new RuntimeException("current project not set yet"); } return currentProject.getDiagram(getDiagramName(name)) != null; }
// in src/org/argouml/uml/reveng/DiagramInterface.java
public void selectClassDiagram(Object p, String name) { // Check if this diagram already exists in the project if (currentProject == null) { throw new RuntimeException("current project not set yet"); } ArgoDiagram m = currentProject.getDiagram(getDiagramName(name)); if (m != null) { // The diagram already exists in this project. Select it // as the current target. setCurrentDiagram(m); } else { // Otherwise create a new classdiagram for the package. addClassDiagram(p, name); } }
// in src/org/argouml/uml/reveng/DiagramInterface.java
public void addClassDiagram(Object ns, String name) { if (currentProject == null) { throw new RuntimeException("current project not set yet"); } ArgoDiagram d = DiagramFactory.getInstance().createDiagram( DiagramFactory.DiagramType.Class, ns == null ? currentProject.getRoot() : ns, null); try { d.setName(getDiagramName(name)); } catch (PropertyVetoException pve) { LOG.error("Failed to set diagram name.", pve); } currentProject.addMember(d); setCurrentDiagram(d); }
// in src/org/argouml/uml/reveng/DiagramInterface.java
public void setCurrentDiagram(ArgoDiagram diagram) { if (diagram == null) { throw new RuntimeException("you can't select a null diagram"); } currentGM = (ClassDiagramGraphModel) diagram.getGraphModel(); currentLayer = diagram.getLayer(); currentDiagram = diagram; currentProject = diagram.getProject(); markDiagramAsModified(diagram); }
// in src/org/argouml/profile/ProfileFacade.java
private static void notInitialized(String string) { throw new RuntimeException("ProfileFacade's " + string + " isn't initialized!"); }
// in src/org/argouml/profile/internal/ocl/EvaluateExpression.java
private void errorNotType(Object node, String type, Object dft) { LOG.error("OCL does not evaluate to a " + type + " expression!! Exp: " + node + " Val: " + val); val = dft; // TODO: We need a specific exception type here. throw new RuntimeException(); }
// in src/org/argouml/profile/internal/ocl/EvaluateExpression.java
private void error(Object node) { LOG.error("Unknown error processing OCL exp!! Exp: " + node + " Val: " + val); val = null; // TODO: We need a specific exception type here. throw new RuntimeException(); }
// in src/org/argouml/notation/NotationProvider.java
protected final void removeAllElementListeners( PropertyChangeListener listener) { for (Object[] lis : listeners) { Object property = lis[1]; if (property == null) { Model.getPump().removeModelEventListener(listener, lis[0]); } else if (property instanceof String[]) { Model.getPump().removeModelEventListener(listener, lis[0], (String[]) property); } else if (property instanceof String) { Model.getPump().removeModelEventListener(listener, lis[0], (String) property); } else { throw new RuntimeException( "Internal error in removeAllElementListeners"); } } listeners.clear(); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public String getMainTag() { try { return Model.getXmiReader().getTagName(); } catch (UmlException e) { // Should never happen - something's really wrong throw new RuntimeException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
Override public void write(int b) throws IOException { if (headerProcessed) { out.write(b); } else { outBB.put((byte) b); inBB.limit(outBB.position()); // Convert from bytes back to characters CoderResult result = decoder.decode(inBB, outCB, false); if (result.isError()) { throw new RuntimeException( "Unknown character decoding error"); } // This will have problems if the smallest possible // data segment is smaller than the size of the buffer // needed for regex matching if (outCB.position() == outCB.limit()) { processHeader(); } } }
2
            
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (ProfileException e) { // TODO: Why is this throwing a generic runtime exception?!?! throw new RuntimeException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { // Should never happen - something's really wrong throw new RuntimeException(e); }
0 7
            
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.error("While calling targetSet for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); e.printStackTrace(); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.error("While calling targetAdded for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); e.printStackTrace(); }
// in src/org/argouml/ui/targetmanager/TargetManager.java
catch (RuntimeException e) { LOG.warn("While calling targetRemoved for " + targetEvent + " in " + listeners[i + 1] + " an error is thrown.", e); }
// in src/org/argouml/ui/ProjectBrowser.java
catch (RuntimeException ex) { LOG.error("Exception while loading project", ex); reportError( pmw, Translator.localize( "dialog.error.open.error", new Object[] {file.getName()}), showUI, ex); }
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
catch (RuntimeException e) { if (Model.getFacade().getUmlVersion().startsWith("2")) { // TODO: Ignore and report exception until getTop // implemented. LOG.error("Explorer caught exception ", e); } else { throw e; } }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (RuntimeException e) { /* TODO: The copy function is not yet * completely implemented - so we will * have some exceptions here and there.*/ LOG.error("Exception", e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (RuntimeException e) { // TODO: Better if we wrap in a ProfileException and throw that LOG.error("Error registering profile " + p.getDisplayName()); throw e; }
2
            
// in src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
catch (RuntimeException e) { if (Model.getFacade().getUmlVersion().startsWith("2")) { // TODO: Ignore and report exception until getTop // implemented. LOG.error("Explorer caught exception ", e); } else { throw e; } }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (RuntimeException e) { // TODO: Better if we wrap in a ProfileException and throw that LOG.error("Error registering profile " + p.getDisplayName()); throw e; }
0
unknown (Lib) SAXException 12
            
// in src/org/argouml/persistence/PGMLStackParser.java
Override protected final void setAttrs(Fig f, Attributes attrList) throws SAXException { if (f instanceof FigGroup) { FigGroup group = (FigGroup) f; String clsNameBounds = attrList.getValue("description"); if (clsNameBounds != null) { StringTokenizer st = new StringTokenizer(clsNameBounds, ",;[] "); // Discard class name, x y w h if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } Map<String, String> attributeMap = interpretStyle(st); setStyleAttributes(group, attributeMap); } } // TODO: Attempt to move the following code to GEF String name = attrList.getValue("name"); if (name != null && !name.equals("")) { registerFig(f, name); } setCommonAttrs(f, attrList); final String href = attrList.getValue("href"); if (href != null && !href.equals("")) { Object modelElement = findOwner(href); if (modelElement == null) { LOG.error("Can't find href of " + href); throw new SAXException("Found href of " + href + " with no matching element in model"); } // The owner should always have already been set in the constructor if (f.getOwner() != modelElement) { // Assign nodes immediately but edges later. See issue 4310. if (f instanceof FigEdge) { modelElementsByFigEdge.put((FigEdge) f, modelElement); } else { f.setOwner(modelElement); } } else { LOG.debug("Ignoring href on " + f.getClass().getName() + " as it's already set"); } } }
// in src/org/argouml/persistence/PGMLStackParser.java
Override protected Fig constructFig(final String className, final String href, final Rectangle bounds, final Attributes attributes) throws SAXException { final DiagramSettings oldSettings = ((ArgoDiagram) getDiagram()).getDiagramSettings(); Fig f = null; try { Class figClass = Class.forName(className); final Constructor[] constructors = figClass.getConstructors(); // We are looking first to match with 3 different constructor // types. We would not expect a Fig to have any mix of these. // Any constructor other than these should be deprecated so we // look for these first. // Fig(DiagramEdgeSettings, DiagramSettings) // Fig(Object, Rectangle, DiagramSettings) // Fig(Rectangle, DiagramSettings) for (Constructor constructor : constructors) { Class[] parameterTypes = constructor.getParameterTypes(); if (parameterTypes.length == 3 && parameterTypes[0].equals(Object.class) && parameterTypes[1].equals(Rectangle.class) && parameterTypes[2].equals(DiagramSettings.class)) { // FigNodeModelElements should match here final Object parameters[] = new Object[3]; final Object owner = getOwner(className, href); if (owner == null) { return null; } parameters[0] = owner; parameters[1] = bounds; parameters[2] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } else if (parameterTypes.length == 2 && parameterTypes[0].equals(DiagramEdgeSettings.class) && parameterTypes[1].equals(DiagramSettings.class)) { // FigEdgeModelElements should match here (they have no // bounds) final Object parameters[] = new Object[2]; final Object owner = getOwner(className, href); if (owner == null) { return null; } String sourceUuid = attributes.getValue("sourceConnector"); String destinationUuid = attributes .getValue("destConnector"); final Object source; final Object destination; if (sourceUuid != null && destinationUuid != null) { source = findOwner(sourceUuid); destination = findOwner(destinationUuid); } else { source = null; destination = null; } DiagramEdgeSettings newSettings = new DiagramEdgeSettings( owner, source, destination); parameters[0] = newSettings; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } else if (parameterTypes.length == 2 && parameterTypes[0].equals(Rectangle.class) && parameterTypes[1].equals(DiagramSettings.class)) { // A FigNodeModelElement with no owner should match here // TODO: This is a temporary solution due to FigPool // extending // FigNodeModelElement when in fact it should not do so. Object parameters[] = new Object[2]; parameters[0] = bounds; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } } if (f == null) { // If no Fig was created by the code above then we must go // look for the old style constructor that should have fallen // into disuse by now. // Fig(Object, Rectangle, DiagramSettings) // All of these constructors should have been deprecated // at least and replaced with the new signature. This is // here for paranoia only until all Figs have been reviewed. for (Constructor constructor : constructors) { Class[] parameterTypes = constructor.getParameterTypes(); if (parameterTypes.length == 2 && parameterTypes[0].equals(Object.class) && parameterTypes[1].equals(DiagramSettings.class)) { Object parameters[] = new Object[2]; final Object owner = getOwner(className, href); // currently FigEdgeNote can be passed null // if (owner == null) { // return null; // } parameters[0] = owner; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); LOG.warn("Fig created by old style constructor " + f.getClass().getName()); break; } } } } catch (ClassNotFoundException e) { throw new SAXException(e); } catch (IllegalAccessException e) { throw new SAXException(e); } catch (InstantiationException e) { throw new SAXException(e); } catch (InvocationTargetException e) { throw new SAXException(e); } // Fall back to GEF's handling if we couldn't find an appropriate // constructor if (f == null) { LOG.warn("No ArgoUML constructor found for " + className + " falling back to GEF's default constructors"); f = super.constructFig(className, href, bounds, attributes); } return f; }
// in src/org/argouml/persistence/SAXParserBase.java
public void parse(InputSource input) throws SAXException { long start, end; SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(false); factory.setValidating(false); try { SAXParser parser = factory.newSAXParser(); // If we weren't given a system ID, attempt to use the URL for the // JAR that we were loaded from. (Why? - tfm) if (input.getSystemId() == null) { input.setSystemId(getJarResource("org.argouml.kernel.Project")); } start = System.currentTimeMillis(); parser.parse(input, this); end = System.currentTimeMillis(); parseTime = end - start; } catch (IOException e) { throw new SAXException(e); } catch (ParserConfigurationException e) { throw new SAXException(e); } if (stats && LOG.isInfoEnabled()) { LOG.info("Elapsed time: " + (end - start) + " ms"); } }
// in src/org/argouml/persistence/SAXParserBase.java
public InputSource resolveEntity (String publicId, String systemId) throws SAXException { try { URL testIt = new URL(systemId); InputSource s = new InputSource(testIt.openStream()); return s; } catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void handleEndElement(XMLElement e) throws SAXException { try { switch (tokens.toToken(e.getName(), false)) { case ProfileConfigurationTokenTable.TOKEN_PROFILE: handleProfileEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_PLUGIN: handlePluginEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_USER_DEFINED: handleUserDefinedEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_FILENAME: handleFilenameEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_MODEL: handleModelEnd(e); break; default: LOG.warn("WARNING: unknown end tag:" + e.getName()); break; } } catch (Exception ex) { throw new SAXException(ex); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private static Profile lookupProfile(String profileIdentifier) throws SAXException { Profile profile; profile = ProfileFacade.getManager().lookForRegisteredProfile( profileIdentifier); if (profile == null) { // for compatibility with older format profile = ProfileFacade.getManager().getProfileForClass( profileIdentifier); if (profile == null) { throw new SAXException("Plugin profile \"" + profileIdentifier + "\" is not available in installation.", null); } } return profile; }
// in src/org/argouml/persistence/ArgoParser.java
protected void handleMember(XMLElement e) throws SAXException { if (e == null) { throw new SAXException("XML element is null"); } String type = e.getAttribute("type"); memberList.add(type); }
// in src/org/argouml/persistence/TodoParser.java
public void handleEndElement(XMLElement e) throws SAXException { try { switch (tokens.toToken(e.getName(), false)) { case TodoTokenTable.TOKEN_TO_DO: case TodoTokenTable.TOKEN_RESOLVEDCRITICS: case TodoTokenTable.TOKEN_TO_DO_LIST: // NOP break; case TodoTokenTable.TOKEN_TO_DO_ITEM: handleTodoItemEnd(e); break; case TodoTokenTable.TOKEN_HEADLINE: handleHeadline(e); break; case TodoTokenTable.TOKEN_DESCRIPTION: handleDescription(e); break; case TodoTokenTable.TOKEN_PRIORITY: handlePriority(e); break; case TodoTokenTable.TOKEN_MOREINFOURL: handleMoreInfoURL(e); break; case TodoTokenTable.TOKEN_ISSUE: handleIssueEnd(e); break; case TodoTokenTable.TOKEN_POSTER: handlePoster(e); break; case TodoTokenTable.TOKEN_OFFENDER: handleOffender(e); break; default: LOG.warn("WARNING: unknown end tag:" + e.getName()); break; } } catch (Exception ex) { throw new SAXException(ex); } }
9
            
// in src/org/argouml/persistence/PGMLStackParser.java
catch (ClassNotFoundException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (IllegalAccessException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InstantiationException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/PGMLStackParser.java
catch (InvocationTargetException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (IOException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (ParserConfigurationException e) { throw new SAXException(e); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); }
// in src/org/argouml/persistence/SAXParserBase.java
catch (Exception ex) { throw new SAXException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception ex) { throw new SAXException(ex); }
// in src/org/argouml/persistence/TodoParser.java
catch (Exception ex) { throw new SAXException(ex); }
25
            
// in src/org/argouml/persistence/PrivateHandler.java
public void gotElement(String contents) throws SAXException { if (container instanceof PGMLHandler) { Object o = getPGMLStackParser().getDiagram(); if (o instanceof IItemUID) { ItemUID uid = getItemUID(contents); if (uid != null) { ((IItemUID) o).setItemUID(uid); } } // No other uses of string in PGMLHandler return; } if (container instanceof FigGroupHandler) { Object o = ((FigGroupHandler) container).getFigGroup(); if (o instanceof IItemUID) { ItemUID uid = getItemUID(contents); if (uid != null) { ((IItemUID) o).setItemUID(uid); } } } if (container instanceof FigEdgeHandler) { Object o = ((FigEdgeHandler) container).getFigEdge(); if (o instanceof IItemUID) { ItemUID uid = getItemUID(contents); if (uid != null) { ((IItemUID) o).setItemUID(uid); } } } // Handle other uses of <private> contents super.gotElement(contents); }
// in src/org/argouml/persistence/PrivateHandler.java
public void startElement(String uri, String localname, String qname, Attributes attributes) throws SAXException { if ("argouml:pathitem".equals(qname) && container instanceof FigEdgeHandler) { String classname = attributes.getValue("classname"); String figclassname = attributes.getValue("figclassname"); String ownerhref = attributes.getValue("ownerhref"); String angle = attributes.getValue("angle"); String offset = attributes.getValue("offset"); if ( classname != null && figclassname != null && ownerhref != null && angle != null && offset != null ) { // Method 2: (assign data immediately, see end of file). // TODO: if we ever want to extend PathItemPlacement, // we should modify this, so that we also recognise any // subclass of PathItemPlacement. // Is the class name a PathItemPlacment? // TODO: Use class reference to make this dependency obvious if ("org.argouml.uml.diagram.ui.PathItemPlacement".equals( classname)) { PathItemPlacementStrategy pips = getPips(figclassname, ownerhref); // Sanity check - the returned path item placement // strategy should match the one in the UML. // If it doesn't, it could be that the UML was // created with an older argo version, and the new // argo version use a different placement strategy. // If they don't match, just use the default. if (pips != null && classname.equals(pips.getClass().getName())) { // Now we're into processing each specific path // item strategy. // At the moment, we only know PathItemPlacement if (pips instanceof PathItemPlacement) { PathItemPlacement pip = (PathItemPlacement) pips; pip.setDisplacementVector( Double.parseDouble(angle), Integer.parseInt(offset)); } // Continue (future PathItemPlacementStrategy impl) //else if (...) { //} } // If the PathItemPlacement was unknown, leave the // diagram with the default settings. else { LOG.warn("PGML stored pathitem class name does " + "not match the class name on the " + "diagram. Label position will revert " + "to defaults."); } } } // If any of the values are null, ignore the element. else { LOG.warn("Could not find all attributes for <" + qname + "> tag, ignoring."); //System.out.println("Error - one of these is null:" // + "classname=" + classname // + " figclassname=" + figclassname // + " ownerhref=" + ownerhref // + " angle=" + angle // + " offset=" + offset); } } super.startElement(uri, localname, qname, attributes); }
// in src/org/argouml/persistence/FigEdgeHandler.java
public void addObject(Object o) throws SAXException { FigEdge edge = getFigEdge(); if (o instanceof FigLine || o instanceof FigPoly) { edge.setFig((Fig) o); if (o instanceof FigPoly) { ((FigPoly) o).setComplete(true); } edge.calcBounds(); if (edge instanceof FigEdgePoly) { ((FigEdgePoly) edge).setInitiallyLaidOut(true); } edge.updateAnnotationPositions(); } if (o instanceof String) { PGMLStackParser parser = getPGMLStackParser(); // Fig spf = null; // Fig dpf = null; // FigNode sfn = null; // FigNode dfn = null; String body = (String) o; StringTokenizer st2 = new StringTokenizer(body, "=\"' \t\n"); String sourcePortFig = null; String destPortFig = null; String sourceFigNode = null; String destFigNode = null; while (st2.hasMoreElements()) { String attribute = st2.nextToken(); String value = st2.nextToken(); if (attribute.equals("sourcePortFig")) { sourcePortFig = value; } if (attribute.equals("destPortFig")) { destPortFig = value; } if (attribute.equals("sourceFigNode")) { sourceFigNode = value; } if (attribute.equals("destFigNode")) { destFigNode = value; } } ((org.argouml.persistence.PGMLStackParser) parser).addFigEdge( edge, sourcePortFig, destPortFig, sourceFigNode, destFigNode); } }
// in src/org/argouml/persistence/PGMLStackParser.java
Override public DefaultHandler getHandler(HandlerStack stack, Object container, String uri, String localname, String qname, Attributes attributes) throws SAXException { String href = attributes.getValue("href"); Object owner = null; if (href != null) { owner = findOwner(href); if (owner == null) { LOG.warn("Found href of " + href + " with no matching element in model"); return null; } } // Ignore non-private elements within FigNode groups if (container instanceof FigGroupHandler) { FigGroup group = ((FigGroupHandler) container).getFigGroup(); if (group instanceof FigNode && !qname.equals("private")) { return null; } } // Handle ItemUID in container contents if (qname.equals("private") && (container instanceof Container)) { return new PrivateHandler(this, (Container) container); } DefaultHandler handler = super.getHandler(stack, container, uri, localname, qname, attributes); if (handler instanceof FigEdgeHandler) { return new org.argouml.persistence.FigEdgeHandler(this, ((FigEdgeHandler) handler).getFigEdge()); } return handler; }
// in src/org/argouml/persistence/PGMLStackParser.java
Override protected final void setAttrs(Fig f, Attributes attrList) throws SAXException { if (f instanceof FigGroup) { FigGroup group = (FigGroup) f; String clsNameBounds = attrList.getValue("description"); if (clsNameBounds != null) { StringTokenizer st = new StringTokenizer(clsNameBounds, ",;[] "); // Discard class name, x y w h if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } if (st.hasMoreElements()) { st.nextToken(); } Map<String, String> attributeMap = interpretStyle(st); setStyleAttributes(group, attributeMap); } } // TODO: Attempt to move the following code to GEF String name = attrList.getValue("name"); if (name != null && !name.equals("")) { registerFig(f, name); } setCommonAttrs(f, attrList); final String href = attrList.getValue("href"); if (href != null && !href.equals("")) { Object modelElement = findOwner(href); if (modelElement == null) { LOG.error("Can't find href of " + href); throw new SAXException("Found href of " + href + " with no matching element in model"); } // The owner should always have already been set in the constructor if (f.getOwner() != modelElement) { // Assign nodes immediately but edges later. See issue 4310. if (f instanceof FigEdge) { modelElementsByFigEdge.put((FigEdge) f, modelElement); } else { f.setOwner(modelElement); } } else { LOG.debug("Ignoring href on " + f.getClass().getName() + " as it's already set"); } } }
// in src/org/argouml/persistence/PGMLStackParser.java
public ArgoDiagram readArgoDiagram(InputSource is, boolean closeStream) throws SAXException { InputStream stream = is.getByteStream(); if (stream == null) { try { // happens when 'is' comes from a zip file URL url = new URL(is.getSystemId()); stream = url.openStream(); closeStream = true; } catch (Exception e) { // continue with null stream, readDiagram(...) will take care of // it } } return (ArgoDiagram) readDiagram(stream, closeStream); }
// in src/org/argouml/persistence/PGMLStackParser.java
public ArgoDiagram readArgoDiagram(InputStream is, boolean closeStream) throws SAXException { return (ArgoDiagram) readDiagram(is, closeStream); }
// in src/org/argouml/persistence/PGMLStackParser.java
Override public Diagram readDiagram(InputStream is, boolean closeStream) throws SAXException { // TODO: we really want to be able replace the initial content handler // which is passed to SAX, but we can't do this without cloning a // whole bunch of code because it's private in the super class. Diagram d = super.readDiagram(is, closeStream); attachEdges(d); return d; }
// in src/org/argouml/persistence/PGMLStackParser.java
Override protected Fig constructFig(final String className, final String href, final Rectangle bounds, final Attributes attributes) throws SAXException { final DiagramSettings oldSettings = ((ArgoDiagram) getDiagram()).getDiagramSettings(); Fig f = null; try { Class figClass = Class.forName(className); final Constructor[] constructors = figClass.getConstructors(); // We are looking first to match with 3 different constructor // types. We would not expect a Fig to have any mix of these. // Any constructor other than these should be deprecated so we // look for these first. // Fig(DiagramEdgeSettings, DiagramSettings) // Fig(Object, Rectangle, DiagramSettings) // Fig(Rectangle, DiagramSettings) for (Constructor constructor : constructors) { Class[] parameterTypes = constructor.getParameterTypes(); if (parameterTypes.length == 3 && parameterTypes[0].equals(Object.class) && parameterTypes[1].equals(Rectangle.class) && parameterTypes[2].equals(DiagramSettings.class)) { // FigNodeModelElements should match here final Object parameters[] = new Object[3]; final Object owner = getOwner(className, href); if (owner == null) { return null; } parameters[0] = owner; parameters[1] = bounds; parameters[2] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } else if (parameterTypes.length == 2 && parameterTypes[0].equals(DiagramEdgeSettings.class) && parameterTypes[1].equals(DiagramSettings.class)) { // FigEdgeModelElements should match here (they have no // bounds) final Object parameters[] = new Object[2]; final Object owner = getOwner(className, href); if (owner == null) { return null; } String sourceUuid = attributes.getValue("sourceConnector"); String destinationUuid = attributes .getValue("destConnector"); final Object source; final Object destination; if (sourceUuid != null && destinationUuid != null) { source = findOwner(sourceUuid); destination = findOwner(destinationUuid); } else { source = null; destination = null; } DiagramEdgeSettings newSettings = new DiagramEdgeSettings( owner, source, destination); parameters[0] = newSettings; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } else if (parameterTypes.length == 2 && parameterTypes[0].equals(Rectangle.class) && parameterTypes[1].equals(DiagramSettings.class)) { // A FigNodeModelElement with no owner should match here // TODO: This is a temporary solution due to FigPool // extending // FigNodeModelElement when in fact it should not do so. Object parameters[] = new Object[2]; parameters[0] = bounds; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); } } if (f == null) { // If no Fig was created by the code above then we must go // look for the old style constructor that should have fallen // into disuse by now. // Fig(Object, Rectangle, DiagramSettings) // All of these constructors should have been deprecated // at least and replaced with the new signature. This is // here for paranoia only until all Figs have been reviewed. for (Constructor constructor : constructors) { Class[] parameterTypes = constructor.getParameterTypes(); if (parameterTypes.length == 2 && parameterTypes[0].equals(Object.class) && parameterTypes[1].equals(DiagramSettings.class)) { Object parameters[] = new Object[2]; final Object owner = getOwner(className, href); // currently FigEdgeNote can be passed null // if (owner == null) { // return null; // } parameters[0] = owner; parameters[1] = oldSettings; constructor.setAccessible(true); f = (Fig) constructor.newInstance(parameters); LOG.warn("Fig created by old style constructor " + f.getClass().getName()); break; } } } } catch (ClassNotFoundException e) { throw new SAXException(e); } catch (IllegalAccessException e) { throw new SAXException(e); } catch (InstantiationException e) { throw new SAXException(e); } catch (InvocationTargetException e) { throw new SAXException(e); } // Fall back to GEF's handling if we couldn't find an appropriate // constructor if (f == null) { LOG.warn("No ArgoUML constructor found for " + className + " falling back to GEF's default constructors"); f = super.constructFig(className, href, bounds, attributes); } return f; }
// in src/org/argouml/persistence/SAXParserBase.java
public void parse(Reader reader) throws SAXException { parse(new InputSource(reader)); }
// in src/org/argouml/persistence/SAXParserBase.java
public void parse(InputSource input) throws SAXException { long start, end; SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(false); factory.setValidating(false); try { SAXParser parser = factory.newSAXParser(); // If we weren't given a system ID, attempt to use the URL for the // JAR that we were loaded from. (Why? - tfm) if (input.getSystemId() == null) { input.setSystemId(getJarResource("org.argouml.kernel.Project")); } start = System.currentTimeMillis(); parser.parse(input, this); end = System.currentTimeMillis(); parseTime = end - start; } catch (IOException e) { throw new SAXException(e); } catch (ParserConfigurationException e) { throw new SAXException(e); } if (stats && LOG.isInfoEnabled()) { LOG.info("Elapsed time: " + (end - start) + " ms"); } }
// in src/org/argouml/persistence/SAXParserBase.java
public void startElement(String uri, String localname, String name, Attributes atts) throws SAXException { if (isElementOfInterest(name)) { XMLElement element = createXmlElement(name, atts); if (LOG.isDebugEnabled()) { StringBuffer buf = new StringBuffer(); buf.append("START: ").append(name).append(' ').append(element); for (int i = 0; i < atts.getLength(); i++) { buf.append(" ATT: ") .append(atts.getLocalName(i)) .append(' ') .append(atts.getValue(i)); } LOG.debug(buf.toString()); } elements[nElements++] = element; handleStartElement(element); } }
// in src/org/argouml/persistence/SAXParserBase.java
public void endElement(String uri, String localname, String name) throws SAXException { if (isElementOfInterest(name)) { XMLElement e = elements[--nElements]; if (LOG.isDebugEnabled()) { StringBuffer buf = new StringBuffer(); buf.append("END: " + e.getName() + " [" + e.getText() + "] " + e + "\n"); for (int i = 0; i < e.getNumAttributes(); i++) { buf.append(" ATT: " + e.getAttributeName(i) + " " + e.getAttributeValue(i) + "\n"); } LOG.debug(buf); } handleEndElement(e); } }
// in src/org/argouml/persistence/SAXParserBase.java
public void characters(char[] ch, int start, int length) throws SAXException { elements[nElements - 1].addText(ch, start, length); // TODO: Remove this old implementation after 0.22 if it's // demonstrated that it's not needed. - tfm // Why does the text get added to ALL the elements on the stack? - tfm // for (int i = 0; i < nElements; i++) { // XMLElement e = elements[i]; // if (e.length() > 0) { // // This seems wrong since this method can be called // // multiple times at the parser's discretion - tfm // e.addText(RETURNSTRING); // } // e.addText(ch, start, length); // } }
// in src/org/argouml/persistence/SAXParserBase.java
public InputSource resolveEntity (String publicId, String systemId) throws SAXException { try { URL testIt = new URL(systemId); InputSource s = new InputSource(testIt.openStream()); return s; } catch (Exception e) { LOG.info("NOTE: Could not open DTD " + systemId + " due to exception"); String dtdName = systemId.substring(systemId.lastIndexOf('/') + 1); String dtdPath = "/org/argouml/persistence/" + dtdName; InputStream is = SAXParserBase.class.getResourceAsStream(dtdPath); if (is == null) { try { is = new FileInputStream(dtdPath.substring(1)); } catch (Exception ex) { throw new SAXException(e); } } return new InputSource(is); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void handleEndElement(XMLElement e) throws SAXException { try { switch (tokens.toToken(e.getName(), false)) { case ProfileConfigurationTokenTable.TOKEN_PROFILE: handleProfileEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_PLUGIN: handlePluginEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_USER_DEFINED: handleUserDefinedEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_FILENAME: handleFilenameEnd(e); break; case ProfileConfigurationTokenTable.TOKEN_MODEL: handleModelEnd(e); break; default: LOG.warn("WARNING: unknown end tag:" + e.getName()); break; } } catch (Exception ex) { throw new SAXException(ex); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
protected void handlePluginEnd(XMLElement e) throws SAXException { String name = e.getText().trim(); profile = lookupProfile(name); if (profile != null) { profiles.add(profile); LOG.debug("Found plugin profile " + name); } else { LOG.error("Unabled to find plugin profile - " + name); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private static Profile lookupProfile(String profileIdentifier) throws SAXException { Profile profile; profile = ProfileFacade.getManager().lookForRegisteredProfile( profileIdentifier); if (profile == null) { // for compatibility with older format profile = ProfileFacade.getManager().getProfileForClass( profileIdentifier); if (profile == null) { throw new SAXException("Plugin profile \"" + profileIdentifier + "\" is not available in installation.", null); } } return profile; }
// in src/org/argouml/persistence/ArgoParser.java
public void readProject(Project theProject, InputSource source) throws SAXException { if (source == null) { throw new IllegalArgumentException( "An InputSource must be supplied"); } preRead(theProject); try { parse(source); } catch (SAXException e) { logError(source.toString(), e); throw e; } }
// in src/org/argouml/persistence/ArgoParser.java
public void readProject(Project theProject, Reader reader) throws SAXException { if (reader == null) { throw new IllegalArgumentException( "A reader must be supplied"); } preRead(theProject); try { parse(reader); } catch (SAXException e) { logError(reader.toString(), e); throw e; } }
// in src/org/argouml/persistence/ArgoParser.java
public void handleStartElement(XMLElement e) throws SAXException { if (DBG) { LOG.debug("NOTE: ArgoParser handleStartTag:" + e.getName()); } switch (tokens.toToken(e.getName(), true)) { case ArgoTokenTable.TOKEN_ARGO: handleArgo(e); break; case ArgoTokenTable.TOKEN_DOCUMENTATION: handleDocumentation(e); break; case ArgoTokenTable.TOKEN_SETTINGS: handleSettings(e); break; default: if (DBG) { LOG.warn("WARNING: unknown tag:" + e.getName()); } break; } }
// in src/org/argouml/persistence/ArgoParser.java
protected void handleMember(XMLElement e) throws SAXException { if (e == null) { throw new SAXException("XML element is null"); } String type = e.getAttribute("type"); memberList.add(type); }
// in src/org/argouml/persistence/TodoParser.java
public synchronized void readTodoList( InputSource inputSource) throws SAXException { LOG.info("Reading ToDo list"); parse(inputSource); }
// in src/org/argouml/persistence/TodoParser.java
public synchronized void readTodoList( Reader is) throws SAXException { LOG.info("======================================="); LOG.info("== READING TO DO LIST"); parse(is); }
// in src/org/argouml/persistence/TodoParser.java
public void handleEndElement(XMLElement e) throws SAXException { try { switch (tokens.toToken(e.getName(), false)) { case TodoTokenTable.TOKEN_TO_DO: case TodoTokenTable.TOKEN_RESOLVEDCRITICS: case TodoTokenTable.TOKEN_TO_DO_LIST: // NOP break; case TodoTokenTable.TOKEN_TO_DO_ITEM: handleTodoItemEnd(e); break; case TodoTokenTable.TOKEN_HEADLINE: handleHeadline(e); break; case TodoTokenTable.TOKEN_DESCRIPTION: handleDescription(e); break; case TodoTokenTable.TOKEN_PRIORITY: handlePriority(e); break; case TodoTokenTable.TOKEN_MOREINFOURL: handleMoreInfoURL(e); break; case TodoTokenTable.TOKEN_ISSUE: handleIssueEnd(e); break; case TodoTokenTable.TOKEN_POSTER: handlePoster(e); break; case TodoTokenTable.TOKEN_OFFENDER: handleOffender(e); break; default: LOG.warn("WARNING: unknown end tag:" + e.getName()); break; } } catch (Exception ex) { throw new SAXException(ex); } }
4
            
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(source.toString(), e); throw e; }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(reader.toString(), e); throw e; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
4
            
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(source.toString(), e); throw e; }
// in src/org/argouml/persistence/ArgoParser.java
catch (SAXException e) { logError(reader.toString(), e); throw e; }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (SAXException e) { throw new OpenException(e); }
0
checked (Domain) SaveException
public class SaveException extends PersistenceException {
    /**
     * The constructor.
     *
     * @param message the message to be shown
     * @param cause the cause of the exception
     */
    public SaveException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * @param message the message to be shown
     */
    public SaveException(String message) {
        super(message);
    }

    /**
     * @param cause the cause of the exception
     */
    public SaveException(Throwable cause) {
        super(cause);
    }
}
34
            
// in src/org/argouml/persistence/XmiFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream stream = null; try { stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } progressMgr.nextPhase(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public void doSave(Project project, File file) throws SaveException, InterruptedException { LOG.info("Saving"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } ZipOutputStream stream = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); stream = new ZipOutputStream(new FileOutputStream(file)); for (ProjectMember projectMember : project.getMembers()) { if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + projectMember.getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { stream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void save(ProjectMember member, OutputStream stream) throws SaveException { PrintWriter w; try { w = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); } catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); } saveProjectMember(member, w); w.flush(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private void saveProjectMember(ProjectMember member, PrintWriter w) throws SaveException { try { if (member instanceof ProfileConfiguration) { ProfileConfiguration pc = (ProfileConfiguration) member; w.println("<?xml version = \"1.0\" encoding = \"UTF-8\" ?>"); // TODO: This DTD doesn't exist, so we can't tell readers to // look for it // w.println("<!DOCTYPE profile SYSTEM \"profile.dtd\" >"); // but we need a 2nd line to make the funky UML persister work w.println(""); // remove this line if the above is uncommented w.println("<profile>"); for (Profile profile : pc.getProfiles()) { if (profile instanceof UserDefinedProfile) { UserDefinedProfile uprofile = (UserDefinedProfile) profile; w.println("\t\t<userDefined>"); w.println("\t\t\t<filename>" + uprofile.getModelFile().getName() + "</filename>"); w.println("\t\t\t<model>"); printModelXMI(w, uprofile.getProfilePackages()); w.println("\t\t\t</model>"); w.println("\t\t</userDefined>"); } else { w.println("\t\t<plugin>"); w.println("\t\t\t" + profile.getProfileIdentifier()); w.println("\t\t</plugin>"); } } w.println("</profile>"); } } catch (Exception e) { e.printStackTrace(); throw new SaveException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void save(ProjectMember member, OutputStream outStream) throws SaveException { OCLExpander expander; try { expander = new OCLExpander(TemplateReader.getInstance() .read(TO_DO_TEE)); } catch (ExpansionException e) { throw new SaveException(e); } PrintWriter pw; try { pw = new PrintWriter(new OutputStreamWriter(outStream, "UTF-8")); } catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); } try { Designer.disableCritiquing(); // WARNING: The GEF implementation of the OutputStream version of // this method doesn't work - tfm - 20070531 expander.expand(pw, member); } catch (ExpansionException e) { throw new SaveException(e); } finally { pw.flush(); // pw.close(); Designer.enableCritiquing(); } }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void save(ProjectMember member, OutputStream outStream) throws SaveException { ProjectMemberModel pmm = (ProjectMemberModel) member; Object model = pmm.getModel(); try { XmiWriter xmiWriter = Model.getXmiWriter(model, outStream, ApplicationVersion.getVersion() + "(" + UmlFilePersister.PERSISTENCE_VERSION + ")"); xmiWriter.write(); outStream.flush(); } catch (UmlException e) { throw new SaveException(e); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/OldZargoFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } BufferedWriter writer = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); writer = new BufferedWriter(new OutputStreamWriter(stream, "UTF-8")); // Save the .argo entry // TODO: Cyclic dependency with PersistenceManager // move PersistenceManager..getProjectBaseName() someplace else ZipEntry zipEntry = new ZipEntry(PersistenceManager.getInstance() .getProjectBaseName(project) + FileConstants.UNCOMPRESSED_FILE_EXT); stream.putNextEntry(zipEntry); Hashtable templates = TemplateReader.getInstance().read(ARGO_MINI_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project); writer.flush(); stream.closeEntry(); int counter = 0; int size = project.getMembers().size(); Collection<String> names = new ArrayList<String>(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (!(projectMember.getType().equalsIgnoreCase("xmi"))) { if (LOG.isInfoEnabled()) { LOG.info("Saving member: " + project.getMembers().get(i).getZipName()); } String name = projectMember.getZipName(); String originalName = name; while (names.contains(name)) { /* Issue 4806 explains why we need this! */ name = ++counter + originalName; } names.add(name); stream.putNextEntry(new ZipEntry(name)); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); stream.flush(); stream.closeEntry(); } } for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + project.getMembers().get(i).getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); OldModelMemberFilePersister persister = new OldModelMemberFilePersister(); persister.save(projectMember, stream); stream.flush(); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { writer.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ZipFilePersister.java
public void doSave(Project project, File file) throws SaveException { LOG.info("Receiving file '" + file.getName() + "'"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream bufferedStream = null; try { //project.setFile(file); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); String fileName = file.getName(); ZipEntry xmiEntry = new ZipEntry(fileName.substring(0, fileName.lastIndexOf("."))); stream.putNextEntry(xmiEntry); bufferedStream = new BufferedOutputStream(stream); int size = project.getMembers().size(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + (project.getMembers() .get(i)).getType()); } MemberFilePersister persister = new ModelMemberFilePersister(); persister.save(projectMember, bufferedStream); } } stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { bufferedStream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); OutputStream stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); progressMgr.nextPhase(); String path = file.getParent(); if (LOG.isInfoEnabled()) { LOG.info("Dir ==" + path); } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
void writeProject(Project project, OutputStream oStream, ProgressMgr progressMgr) throws SaveException, InterruptedException { OutputStreamWriter outputStreamWriter; try { outputStreamWriter = new OutputStreamWriter(oStream, Argo .getEncoding()); } catch (UnsupportedEncodingException e) { throw new SaveException(e); } PrintWriter writer = new PrintWriter(new BufferedWriter( outputStreamWriter)); XmlFilterOutputStream filteredStream = new XmlFilterOutputStream( oStream, Argo.getEncoding()); try { writer.println("<?xml version = \"1.0\" " + "encoding = \"" + Argo.getEncoding() + "\" ?>"); writer.println("<uml version=\"" + PERSISTENCE_VERSION + "\">"); // Write out header section try { Hashtable templates = TemplateReader.getInstance().read( ARGO_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project, " "); } catch (ExpansionException e) { throw new SaveException(e); } writer.flush(); if (progressMgr != null) { progressMgr.nextPhase(); } // Note we assume members are ordered correctly already for (ProjectMember projectMember : project.getMembers()) { if (LOG.isInfoEnabled()) { LOG.info("Saving member : " + projectMember); } MemberFilePersister persister = getMemberFilePersister(projectMember); filteredStream.startEntry(); persister.save(projectMember, filteredStream); try { filteredStream.flush(); } catch (IOException e) { throw new SaveException(e); } } writer.println("</uml>"); writer.flush(); } finally { writer.close(); try { filteredStream.reallyClose(); } catch (IOException e) { throw new SaveException(e); } } }
// in src/org/argouml/persistence/AbstractFilePersister.java
private void preSave(Project project, File file) throws SaveException { if (project == null && file == null) { throw new SaveException("No project nor file given"); } }
// in src/org/argouml/persistence/AbstractFilePersister.java
private void postSave(Project project, File file) throws SaveException { if (project == null && file == null) { throw new SaveException("No project nor file given"); } }
// in src/org/argouml/persistence/MemberFilePersister.java
protected void addXmlFileToWriter(PrintWriter writer, File file) throws SaveException { try { BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream(file), Argo.getEncoding())); // Skip the <?xml... first line String line = reader.readLine(); while (line != null && (line.startsWith("<?xml ") || line.startsWith("<!DOCTYPE "))) { line = reader.readLine(); } while (line != null) { (writer).println(line); line = reader.readLine(); } reader.close(); } catch (FileNotFoundException e) { throw new SaveException(e); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void save(ProjectMember member, OutputStream outStream) throws SaveException { ProjectMemberDiagram diagramMember = (ProjectMemberDiagram) member; OCLExpander expander; try { expander = new OCLExpander( TemplateReader.getInstance().read(PGML_TEE)); } catch (ExpansionException e) { throw new SaveException(e); } OutputStreamWriter outputWriter; try { outputWriter = new OutputStreamWriter(outStream, Argo.getEncoding()); } catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); } try { // WARNING: the OutputStream version of this doesn't work! - tfm expander.expand(outputWriter, diagramMember.getDiagram()); } catch (ExpansionException e) { throw new SaveException(e); } finally { try { outputWriter.flush(); } catch (IOException e) { throw new SaveException(e); } } }
32
            
// in src/org/argouml/persistence/XmiFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/XmiFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (Exception e) { e.printStackTrace(); throw new SaveException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/OldZargoFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/ZipFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (UnsupportedEncodingException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (FileNotFoundException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/MemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (ExpansionException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (IOException e) { throw new SaveException(e); }
16
            
// in src/org/argouml/persistence/XmiFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream stream = null; try { stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (InterruptedException exc) { try { stream.close(); } catch (IOException ex) { } throw exc; } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { stream.close(); } catch (IOException ex) { } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } progressMgr.nextPhase(); }
// in src/org/argouml/persistence/XmiFilePersister.java
void writeProject(Project project, OutputStream stream, ProgressMgr progressMgr) throws SaveException, InterruptedException { int size = project.getMembers().size(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase(getExtension())) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + (project.getMembers() .get(i)).getType()); } MemberFilePersister persister = new ModelMemberFilePersister(); persister.save(projectMember, stream); } } if (progressMgr != null) { progressMgr.nextPhase(); } }
// in src/org/argouml/persistence/ZargoFilePersister.java
Override public void doSave(Project project, File file) throws SaveException, InterruptedException { LOG.info("Saving"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } ZipOutputStream stream = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); stream = new ZipOutputStream(new FileOutputStream(file)); for (ProjectMember projectMember : project.getMembers()) { if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + projectMember.getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { if (stream != null) { stream.close(); } } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { stream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
public void save(ProjectMember member, OutputStream stream) throws SaveException { PrintWriter w; try { w = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); } catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); } saveProjectMember(member, w); w.flush(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private void saveProjectMember(ProjectMember member, PrintWriter w) throws SaveException { try { if (member instanceof ProfileConfiguration) { ProfileConfiguration pc = (ProfileConfiguration) member; w.println("<?xml version = \"1.0\" encoding = \"UTF-8\" ?>"); // TODO: This DTD doesn't exist, so we can't tell readers to // look for it // w.println("<!DOCTYPE profile SYSTEM \"profile.dtd\" >"); // but we need a 2nd line to make the funky UML persister work w.println(""); // remove this line if the above is uncommented w.println("<profile>"); for (Profile profile : pc.getProfiles()) { if (profile instanceof UserDefinedProfile) { UserDefinedProfile uprofile = (UserDefinedProfile) profile; w.println("\t\t<userDefined>"); w.println("\t\t\t<filename>" + uprofile.getModelFile().getName() + "</filename>"); w.println("\t\t\t<model>"); printModelXMI(w, uprofile.getProfilePackages()); w.println("\t\t\t</model>"); w.println("\t\t</userDefined>"); } else { w.println("\t\t<plugin>"); w.println("\t\t\t" + profile.getProfileIdentifier()); w.println("\t\t</plugin>"); } } w.println("</profile>"); } } catch (Exception e) { e.printStackTrace(); throw new SaveException(e); } }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
public void save(ProjectMember member, OutputStream outStream) throws SaveException { OCLExpander expander; try { expander = new OCLExpander(TemplateReader.getInstance() .read(TO_DO_TEE)); } catch (ExpansionException e) { throw new SaveException(e); } PrintWriter pw; try { pw = new PrintWriter(new OutputStreamWriter(outStream, "UTF-8")); } catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); } try { Designer.disableCritiquing(); // WARNING: The GEF implementation of the OutputStream version of // this method doesn't work - tfm - 20070531 expander.expand(pw, member); } catch (ExpansionException e) { throw new SaveException(e); } finally { pw.flush(); // pw.close(); Designer.enableCritiquing(); } }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public void save(ProjectMember member, OutputStream outStream) throws SaveException { ProjectMemberModel pmm = (ProjectMemberModel) member; Object model = pmm.getModel(); try { XmiWriter xmiWriter = Model.getXmiWriter(model, outStream, ApplicationVersion.getVersion() + "(" + UmlFilePersister.PERSISTENCE_VERSION + ")"); xmiWriter.write(); outStream.flush(); } catch (UmlException e) { throw new SaveException(e); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/OldZargoFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } BufferedWriter writer = null; try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); writer = new BufferedWriter(new OutputStreamWriter(stream, "UTF-8")); // Save the .argo entry // TODO: Cyclic dependency with PersistenceManager // move PersistenceManager..getProjectBaseName() someplace else ZipEntry zipEntry = new ZipEntry(PersistenceManager.getInstance() .getProjectBaseName(project) + FileConstants.UNCOMPRESSED_FILE_EXT); stream.putNextEntry(zipEntry); Hashtable templates = TemplateReader.getInstance().read(ARGO_MINI_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project); writer.flush(); stream.closeEntry(); int counter = 0; int size = project.getMembers().size(); Collection<String> names = new ArrayList<String>(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (!(projectMember.getType().equalsIgnoreCase("xmi"))) { if (LOG.isInfoEnabled()) { LOG.info("Saving member: " + project.getMembers().get(i).getZipName()); } String name = projectMember.getZipName(); String originalName = name; while (names.contains(name)) { /* Issue 4806 explains why we need this! */ name = ++counter + originalName; } names.add(name); stream.putNextEntry(new ZipEntry(name)); MemberFilePersister persister = getMemberFilePersister(projectMember); persister.save(projectMember, stream); stream.flush(); stream.closeEntry(); } } for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + project.getMembers().get(i).getType()); } stream.putNextEntry( new ZipEntry(projectMember.getZipName())); OldModelMemberFilePersister persister = new OldModelMemberFilePersister(); persister.save(projectMember, stream); stream.flush(); } } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { writer.close(); } catch (Exception ex) { // Do nothing. } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { writer.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/ZipFilePersister.java
public void doSave(Project project, File file) throws SaveException { LOG.info("Receiving file '" + file.getName() + "'"); /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } OutputStream bufferedStream = null; try { //project.setFile(file); ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(file)); String fileName = file.getName(); ZipEntry xmiEntry = new ZipEntry(fileName.substring(0, fileName.lastIndexOf("."))); stream.putNextEntry(xmiEntry); bufferedStream = new BufferedOutputStream(stream); int size = project.getMembers().size(); for (int i = 0; i < size; i++) { ProjectMember projectMember = project.getMembers().get(i); if (projectMember.getType().equalsIgnoreCase("xmi")) { if (LOG.isInfoEnabled()) { LOG.info("Saving member of type: " + (project.getMembers() .get(i)).getType()); } MemberFilePersister persister = new ModelMemberFilePersister(); persister.save(projectMember, bufferedStream); } } stream.close(); if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } } catch (Exception e) { LOG.error("Exception occured during save attempt", e); try { bufferedStream.close(); } catch (IOException ex) { // If we get a 2nd error, just ignore it } if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } // we have to give a message to user and set the system to unsaved! throw new SaveException(e); } try { bufferedStream.close(); } catch (IOException ex) { LOG.error("Failed to close save output writer", ex); } }
// in src/org/argouml/persistence/UmlFilePersister.java
public void doSave(Project project, File file) throws SaveException, InterruptedException { /* Retain the previous project file even when the save operation * crashes in the middle. Also create a backup file after saving. */ boolean doSafeSaves = useSafeSaves(); ProgressMgr progressMgr = new ProgressMgr(); progressMgr.setNumberOfPhases(4); progressMgr.nextPhase(); File lastArchiveFile = new File(file.getAbsolutePath() + "~"); File tempFile = null; if (doSafeSaves) { try { tempFile = createTempFile(file); } catch (FileNotFoundException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause1"), e); } catch (IOException e) { throw new SaveException(Translator.localize( "optionpane.save-project-exception-cause2"), e); } } try { project.setFile(file); project.setVersion(ApplicationVersion.getVersion()); project.setPersistenceVersion(PERSISTENCE_VERSION); OutputStream stream = new FileOutputStream(file); writeProject(project, stream, progressMgr); stream.close(); progressMgr.nextPhase(); String path = file.getParent(); if (LOG.isInfoEnabled()) { LOG.info("Dir ==" + path); } if (doSafeSaves) { // if save did not raise an exception // and name+"#" exists move name+"#" to name+"~" // this is the correct backup file if (lastArchiveFile.exists()) { lastArchiveFile.delete(); } if (tempFile.exists() && !lastArchiveFile.exists()) { tempFile.renameTo(lastArchiveFile); } if (tempFile.exists()) { tempFile.delete(); } } progressMgr.nextPhase(); } catch (Exception e) { LOG.error("Exception occured during save attempt", e); if (doSafeSaves) { // frank: in case of exception // delete name and mv name+"#" back to name if name+"#" exists // this is the "rollback" to old file file.delete(); tempFile.renameTo(file); } if (e instanceof InterruptedException) { throw (InterruptedException) e; } else { // we have to give a message to user and set the system // to unsaved! throw new SaveException(e); } } }
// in src/org/argouml/persistence/UmlFilePersister.java
void writeProject(Project project, OutputStream oStream, ProgressMgr progressMgr) throws SaveException, InterruptedException { OutputStreamWriter outputStreamWriter; try { outputStreamWriter = new OutputStreamWriter(oStream, Argo .getEncoding()); } catch (UnsupportedEncodingException e) { throw new SaveException(e); } PrintWriter writer = new PrintWriter(new BufferedWriter( outputStreamWriter)); XmlFilterOutputStream filteredStream = new XmlFilterOutputStream( oStream, Argo.getEncoding()); try { writer.println("<?xml version = \"1.0\" " + "encoding = \"" + Argo.getEncoding() + "\" ?>"); writer.println("<uml version=\"" + PERSISTENCE_VERSION + "\">"); // Write out header section try { Hashtable templates = TemplateReader.getInstance().read( ARGO_TEE); OCLExpander expander = new OCLExpander(templates); expander.expand(writer, project, " "); } catch (ExpansionException e) { throw new SaveException(e); } writer.flush(); if (progressMgr != null) { progressMgr.nextPhase(); } // Note we assume members are ordered correctly already for (ProjectMember projectMember : project.getMembers()) { if (LOG.isInfoEnabled()) { LOG.info("Saving member : " + projectMember); } MemberFilePersister persister = getMemberFilePersister(projectMember); filteredStream.startEntry(); persister.save(projectMember, filteredStream); try { filteredStream.flush(); } catch (IOException e) { throw new SaveException(e); } } writer.println("</uml>"); writer.flush(); } finally { writer.close(); try { filteredStream.reallyClose(); } catch (IOException e) { throw new SaveException(e); } } }
// in src/org/argouml/persistence/AbstractFilePersister.java
public final void save(Project project, File file) throws SaveException, InterruptedException { preSave(project, file); doSave(project, file); postSave(project, file); }
// in src/org/argouml/persistence/AbstractFilePersister.java
private void preSave(Project project, File file) throws SaveException { if (project == null && file == null) { throw new SaveException("No project nor file given"); } }
// in src/org/argouml/persistence/AbstractFilePersister.java
private void postSave(Project project, File file) throws SaveException { if (project == null && file == null) { throw new SaveException("No project nor file given"); } }
// in src/org/argouml/persistence/MemberFilePersister.java
protected void addXmlFileToWriter(PrintWriter writer, File file) throws SaveException { try { BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream(file), Argo.getEncoding())); // Skip the <?xml... first line String line = reader.readLine(); while (line != null && (line.startsWith("<?xml ") || line.startsWith("<!DOCTYPE "))) { line = reader.readLine(); } while (line != null) { (writer).println(line); line = reader.readLine(); } reader.close(); } catch (FileNotFoundException e) { throw new SaveException(e); } catch (IOException e) { throw new SaveException(e); } }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
Override public void save(ProjectMember member, OutputStream outStream) throws SaveException { ProjectMemberDiagram diagramMember = (ProjectMemberDiagram) member; OCLExpander expander; try { expander = new OCLExpander( TemplateReader.getInstance().read(PGML_TEE)); } catch (ExpansionException e) { throw new SaveException(e); } OutputStreamWriter outputWriter; try { outputWriter = new OutputStreamWriter(outStream, Argo.getEncoding()); } catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); } try { // WARNING: the OutputStream version of this doesn't work! - tfm expander.expand(outputWriter, diagramMember.getDiagram()); } catch (ExpansionException e) { throw new SaveException(e); } finally { try { outputWriter.flush(); } catch (IOException e) { throw new SaveException(e); } } }
0 0 0
unknown (Lib) SecurityException 0 0 0 6
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (SecurityException e) { LOG.error("The default constructor for class " + classname + " is not accessable.", e); return false; }
// in src/org/argouml/notation/NotationProviderFactory2.java
catch (SecurityException e) { // TODO: Why aren't we throwing an exception here? // Returning null results in NPE and no explanation why. LOG.error("Exception caught", e); }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final SecurityException e) { LOG.error("You are not allowed to copy these files", e); return false; }
// in src/org/argouml/configuration/ConfigurationProperties.java
catch (final SecurityException e) { LOG.error("A security exception occurred trying to load" + " the configuration, check your security settings", e); }
// in src/org/argouml/util/ItemUID.java
catch (SecurityException se) { // Apparently it had a getItemUID, // but we're not allowed to call it return null; }
// in src/org/argouml/util/ItemUID.java
catch (SecurityException se) { // Apparently it had a setItemUID, // but we're not allowed to call it return null; }
0 0
checked (Lib) Throwable 0 0 2
            
// in src/org/argouml/application/security/ArgoAwtExceptionHandler.java
public void handle(Throwable t) throws Throwable { throw t; }
// in src/org/argouml/util/osdep/OSXAdapter.java
public Object invoke (Object proxy, Method method, Object[] args) throws Throwable { if (isCorrectMethod(method, args)) { boolean handled = callTarget(args[0]); setApplicationEventHandled(args[0], handled); } // All of the ApplicationListener methods are void; return null regardless of what happens return null; }
10
            
// in src/org/argouml/ui/ProjectSettingsDialog.java
catch (Throwable t) { }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Exception or error while trying to " + "enable module " + module.getName(), e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Exception or error while trying to " + "disable module " + module.getName(), e); }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { if (e instanceof ClassNotFoundException) { throw (ClassNotFoundException) e; } LOG.error("Unexpected error while loading " + classname, e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Unexpected error while loading " + classname, e); return false; }
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { LOG.error("Unexpected error while instantiating " + classname, e); return false; }
// in src/org/argouml/uml/ui/TabConstraints.java
catch (Throwable t) { // OK, so that didn't work out... Just ignore // any problems and don't set the name in the // constraint body better had log it. LOG.error("some unidentified problem", t); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (Throwable e2) { LOG.error("Error loading profile: " + fileName, e2); }
// in src/org/argouml/application/Main.java
catch (Throwable t) { try { LOG.fatal("Fatal error on startup. ArgoUML failed to start", t); } finally { System.out.println("Fatal error on startup. " + "ArgoUML failed to start."); t.printStackTrace(); System.exit(1); } }
// in src/org/argouml/util/logging/AwtExceptionHandler.java
catch (Throwable t2) { // Ignore any nested exceptions. We don't want infinite loop. }
1
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (Throwable e) { if (e instanceof ClassNotFoundException) { throw (ClassNotFoundException) e; } LOG.error("Unexpected error while loading " + classname, e); return false; }
0
unknown (Lib) TransformerException 0 0 0 1
            
// in src/org/argouml/persistence/UmlFilePersister.java
catch (TransformerException e) { throw new OpenException(e); }
1
            
// in src/org/argouml/persistence/UmlFilePersister.java
catch (TransformerException e) { throw new OpenException(e); }
0
unknown (Lib) URISyntaxException 0 0 1
            
// in src/org/argouml/persistence/PersistenceManager.java
public void setProjectName(final String n, Project p) throws URISyntaxException { String s = ""; if (p.getURI() != null) { s = p.getURI().toString(); } s = s.substring(0, s.lastIndexOf("/") + 1) + n; setProjectURI(new URI(s), p); }
2
            
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (URISyntaxException e1) { LOG.error("Invalid path for Profile: " + fileName, e1); }
// in src/org/argouml/persistence/PersistenceManager.java
catch (java.net.URISyntaxException e) { throw new UnexpectedException(e); }
1
            
// in src/org/argouml/persistence/PersistenceManager.java
catch (java.net.URISyntaxException e) { throw new UnexpectedException(e); }
0
unknown (Lib) UmlException 0 0 2
            
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
private void saveModel(File destiny, Object model) throws IOException, UmlException { OutputStream stream = new FileOutputStream(destiny); XmiWriter xmiWriter = Model.getXmiWriter(model, stream, ApplicationVersion.getVersion() + "(" + UmlFilePersister.PERSISTENCE_VERSION + ")"); xmiWriter.write(); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
private void printModelXMI(PrintWriter w, Collection profileModels) throws UmlException { // TODO: Why is this not executed? Remove if not needed - tfm if (true) { return; } StringWriter myWriter = new StringWriter(); for (Object model : profileModels) { XmiWriter xmiWriter = Model.getXmiWriter(model, (OutputStream) null, //myWriter, ApplicationVersion.getVersion() + "(" + UmlFilePersister.PERSISTENCE_VERSION + ")"); xmiWriter.write(); } myWriter.flush(); w.println("" + myWriter.toString()); }
10
            
// in src/org/argouml/ui/explorer/ActionExportProfileXMI.java
catch (UmlException e) { LOG.error("Exception", e); }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
catch (UmlException ex) { // fail silently as we expect users to accidentally drop // on to wrong component }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (UmlException e) { LOG.error("Couldn't retrive XMI Reader from Model.", e); }
// in src/org/argouml/profile/internal/ProfileManagerImpl.java
catch (UmlException e) { LOG.error("Couldn't retrive XMI Reader from Model.", e); }
// in src/org/argouml/profile/ReaderModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/StreamModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { // Should never happen - something's really wrong throw new RuntimeException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); }
6
            
// in src/org/argouml/profile/ReaderModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/StreamModelLoader.java
catch (UmlException e) { throw new ProfileException("Invalid XMI data!", e); }
// in src/org/argouml/profile/URLModelLoader.java
catch (UmlException e) { throw new ProfileException("Error loading profile XMI file ", e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { // Should never happen - something's really wrong throw new RuntimeException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); }
1
checked (Domain) UmlVersionException
public class UmlVersionException extends XmiFormatException {

    /**
     * Construct an UmlVersionException with the version string
     * and a nested cause.
     * 
     * @param message the message for the exception
     * @param cause what caused the exception
     */
    public UmlVersionException(String message, Throwable cause) {
        super(message, cause);
    }

}
0 0 0 1
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (UmlVersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI, ex); }
0 0
unknown (Lib) UnexpectedException 1
            
// in src/org/argouml/persistence/PersistenceManager.java
public URI fixUriExtension(URI in) { URI newUri; String n = in.toString(); n = fixExtension(n); try { newUri = new URI(n); } catch (java.net.URISyntaxException e) { throw new UnexpectedException(e); } return newUri; }
1
            
// in src/org/argouml/persistence/PersistenceManager.java
catch (java.net.URISyntaxException e) { throw new UnexpectedException(e); }
0 0 0 0
unknown (Lib) UnknownHostException 0 0 0 1
            
// in src/org/argouml/application/Main.java
catch (UnknownHostException e) { System.err.println("ERROR: unable to get localhost information."); e.printStackTrace(System.err); System.err.println("On Unix systems this usually indicates that" + "your /etc/hosts file is incorrectly setup."); System.err.println("Stopping execution of ArgoUML."); System.exit(0); }
0 0
checked (Domain) UnresolvableException
public class UnresolvableException extends Exception
{
    /**
     * Creates a new UnresolvableException with message msg.
     *
     * @param	msg	A message describing what caused the exception.
     */
    public UnresolvableException(String msg)
    {
	super(msg);
    }
}
4
            
// in src/org/argouml/cognitive/ToDoList.java
public boolean explicitlyResolve(ToDoItem item, String reason) throws UnresolvableException { if (item.getPoster() instanceof Designer) { boolean res = resolve(item); // History.TheHistory.addItemResolution(item, reason); return res; } if (!(item.getPoster() instanceof Critic)) { throw new UnresolvableException(Translator.localize( "misc.todo-unresolvable", new Object[] {item.getPoster() .getClass()})); } ResolvedCritic rc = new ResolvedCritic((Critic) item.getPoster(), item .getOffenders()); boolean res = resolve(item); if (res) { res = addResolvedCritic(rc); } return res; }
// in src/org/argouml/cognitive/ResolvedCritic.java
protected void importOffenders(ListSet set, boolean canCreate) throws UnresolvableException { String fail = null; for (Object obj : set) { String id = ItemUID.getIDOfObject(obj, canCreate); if (id == null) { if (!canCreate) { throw new UnresolvableException("ItemUID missing or " + "unable to " + "create for class: " + obj.getClass()); } if (fail == null) { fail = obj.getClass().toString(); } else { fail = fail + ", " + obj.getClass().toString(); } LOG.warn("Offender " + obj.getClass() + " unresolvable"); // Use this for fast fail instead. // Sacrificed for complete fail. d00mst //throw new UnresolvableException( // "Unable to create ItemUID for class: " // + obj.getClass()); } else { offenders.add(id); } } if (fail != null) { throw new UnresolvableException("Unable to create ItemUID for " + "some class(es): " + fail); } }
1
            
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); }
5
            
// in src/org/argouml/cognitive/ToDoList.java
public boolean explicitlyResolve(ToDoItem item, String reason) throws UnresolvableException { if (item.getPoster() instanceof Designer) { boolean res = resolve(item); // History.TheHistory.addItemResolution(item, reason); return res; } if (!(item.getPoster() instanceof Critic)) { throw new UnresolvableException(Translator.localize( "misc.todo-unresolvable", new Object[] {item.getPoster() .getClass()})); } ResolvedCritic rc = new ResolvedCritic((Critic) item.getPoster(), item .getOffenders()); boolean res = resolve(item); if (res) { res = addResolvedCritic(rc); } return res; }
// in src/org/argouml/cognitive/ResolvedCritic.java
protected String getCriticString(Critic c) throws UnresolvableException { // TODO: Should throw if the string is not good? if (c == null) { throw (new UnresolvableException("Critic is null")); } String s = c.getClass().toString(); return s; }
// in src/org/argouml/cognitive/ResolvedCritic.java
protected void importOffenders(ListSet set, boolean canCreate) throws UnresolvableException { String fail = null; for (Object obj : set) { String id = ItemUID.getIDOfObject(obj, canCreate); if (id == null) { if (!canCreate) { throw new UnresolvableException("ItemUID missing or " + "unable to " + "create for class: " + obj.getClass()); } if (fail == null) { fail = obj.getClass().toString(); } else { fail = fail + ", " + obj.getClass().toString(); } LOG.warn("Offender " + obj.getClass() + " unresolvable"); // Use this for fast fail instead. // Sacrificed for complete fail. d00mst //throw new UnresolvableException( // "Unable to create ItemUID for class: " // + obj.getClass()); } else { offenders.add(id); } } if (fail != null) { throw new UnresolvableException("Unable to create ItemUID for " + "some class(es): " + fail); } }
4
            
// in src/org/argouml/cognitive/ui/DismissToDoItemDialog.java
catch (UnresolvableException ure) { LOG.error("Resolve failed (ure): ", ure); JOptionPane.showMessageDialog( this, ure.getMessage(), Translator.localize("optionpane.dismiss-failed"), JOptionPane.ERROR_MESSAGE); }
// in src/org/argouml/cognitive/ToDoList.java
catch (UnresolvableException ure) { }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); }
2
            
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure) { try { getCriticString(c); } catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); } throw ure; }
// in src/org/argouml/cognitive/ResolvedCritic.java
catch (UnresolvableException ure2) { throw new UnresolvableException(ure2.getMessage() + "\n" + ure.getMessage()); }
0
unknown (Lib) UnsupportedClassVersionError 0 0 0 1
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (UnsupportedClassVersionError e) { LOG.error("Unsupported Java class version for " + classname); return false; }
0 0
unknown (Lib) UnsupportedEncodingException 0 0 3
            
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyArgo(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, OpenException, UnsupportedEncodingException { int pgmlCount = getPgmlCount(file); boolean containsToDo = containsTodo(file); boolean containsProfile = containsProfile(file); // first read the .argo file from Zip ZipInputStream zis = openZipStreamAt(toURL(file), FileConstants.PROJECT_FILE_EXT); if (zis == null) { throw new OpenException( "There is no .argo file in the .zargo"); } String line; BufferedReader reader = new BufferedReader(new InputStreamReader(zis, encoding)); // Keep reading till we hit the <argo> tag String rootLine; do { rootLine = reader.readLine(); if (rootLine == null) { throw new OpenException( "Can't find an <argo> tag in the argo file"); } } while(!rootLine.startsWith("<argo")); // Get the version from the tag. String version = getVersion(rootLine); writer.println("<uml version=\"" + version + "\">"); writer.println(rootLine); LOG.info("Transfering argo contents"); int memberCount = 0; while ((line = reader.readLine()) != null) { if (line.trim().startsWith("<member")) { ++memberCount; } if (line.trim().equals("</argo>") && memberCount == 0) { LOG.info("Inserting member info"); writer.println("<member type='xmi' name='.xmi' />"); for (int i = 0; i < pgmlCount; ++i) { writer.println("<member type='pgml' name='.pgml' />"); } if (containsToDo) { writer.println("<member type='todo' name='.todo' />"); } if (containsProfile) { String type = ProfileConfiguration.EXTENSION; writer.println("<member type='" + type + "' name='." + type + "' />"); } } writer.println(line); } if (LOG.isInfoEnabled()) { LOG.info("Member count = " + memberCount); } zis.close(); reader.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyXmi(File file, String encoding, PrintWriter writer) throws IOException, MalformedURLException, UnsupportedEncodingException { ZipInputStream zis = openZipStreamAt(toURL(file), ".xmi"); BufferedReader reader = new BufferedReader( new InputStreamReader(zis, encoding)); // Skip 1 lines reader.readLine(); readerToWriter(reader, writer); zis.close(); reader.close(); }
// in src/org/argouml/persistence/ZargoFilePersister.java
private void copyMember(File file, String tag, String outputEncoding, PrintWriter writer) throws IOException, MalformedURLException, UnsupportedEncodingException { ZipInputStream zis = openZipStreamAt(toURL(file), "." + tag); if (zis != null) { InputStreamReader isr = new InputStreamReader(zis, outputEncoding); BufferedReader reader = new BufferedReader(isr); String firstLine = reader.readLine(); if (firstLine.startsWith("<?xml")) { // Skip the 2 lines //<?xml version="1.0" encoding="UTF-8" ?> //<!DOCTYPE todo SYSTEM "todo.dtd" > reader.readLine(); } else { writer.println(firstLine); } readerToWriter(reader, writer); zis.close(); reader.close(); } }
7
            
// in src/org/argouml/moduleloader/ModuleLoader2.java
catch (UnsupportedEncodingException e) { LOG.warn("Encoding " + Argo.getEncoding() + " is unknown."); }
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/PersistenceManager.java
catch (UnsupportedEncodingException e) { return e.toString(); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (UnsupportedEncodingException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); }
5
            
// in src/org/argouml/persistence/ProfileConfigurationFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e) { throw new OpenException(e); }
// in src/org/argouml/persistence/TodoListMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("UTF-8 encoding not supported on platform", e1); }
// in src/org/argouml/persistence/UmlFilePersister.java
catch (UnsupportedEncodingException e) { throw new SaveException(e); }
// in src/org/argouml/persistence/DiagramMemberFilePersister.java
catch (UnsupportedEncodingException e1) { throw new SaveException("Bad encoding", e1); }
0
unknown (Lib) UnsupportedFlavorException 2
            
// in src/org/argouml/ui/TransferableModelElements.java
public Object getTransferData(DataFlavor dataFlavor) throws UnsupportedFlavorException, IOException { if (dataFlavor.match(UML_COLLECTION_FLAVOR)) { return theModelElements; } /* * TODO: We could also support other flavors here, * e.g. image (then you can drag modelelements directly into * your wordprocessor, to be inserted as an image). */ throw new UnsupportedFlavorException(dataFlavor); }
// in src/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java
public synchronized Object getTransferData(DataFlavor parFlavor) throws UnsupportedFlavorException { if (isDataFlavorSupported(parFlavor)) { return (diagramImage); } throw new UnsupportedFlavorException(DataFlavor.imageFlavor); }
0 2
            
// in src/org/argouml/ui/TransferableModelElements.java
public Object getTransferData(DataFlavor dataFlavor) throws UnsupportedFlavorException, IOException { if (dataFlavor.match(UML_COLLECTION_FLAVOR)) { return theModelElements; } /* * TODO: We could also support other flavors here, * e.g. image (then you can drag modelelements directly into * your wordprocessor, to be inserted as an image). */ throw new UnsupportedFlavorException(dataFlavor); }
// in src/org/argouml/uml/diagram/ui/ActionSaveDiagramToClipboard.java
public synchronized Object getTransferData(DataFlavor parFlavor) throws UnsupportedFlavorException { if (isDataFlavorSupported(parFlavor)) { return (diagramImage); } throw new UnsupportedFlavorException(DataFlavor.imageFlavor); }
6
            
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (UnsupportedFlavorException e) { LOG.debug(e); }
// in src/org/argouml/ui/explorer/DnDExplorerTree.java
catch (UnsupportedFlavorException ufe) { LOG.debug("drop UnsupportedFlavorException"); dropTargetDropEvent.rejectDrop(); }
// in src/org/argouml/uml/ui/ActionCopy.java
catch (UnsupportedFlavorException ignorable) { }
// in src/org/argouml/uml/ui/ActionPaste.java
catch (UnsupportedFlavorException ignorable) { }
// in src/org/argouml/uml/ui/ActionCut.java
catch (UnsupportedFlavorException ignorable) { }
// in src/org/argouml/uml/diagram/ui/DnDJGraph.java
catch (UnsupportedFlavorException e) { LOG.error("Exception caught", e); }
0 0
unknown (Lib) UnsupportedLookAndFeelException 0 0 0 2
            
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (UnsupportedLookAndFeelException e) { LOG.error(e); }
// in src/org/argouml/ui/LookAndFeelMgr.java
catch (UnsupportedLookAndFeelException e) { LOG.error(e); }
0 0
runtime (Lib) UnsupportedOperationException 37
            
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Deprecated public void setProject(Project project) { throw new UnsupportedOperationException(); }
// in src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Deprecated public void setOwner(Object owner) { if (owner != getOwner()) { throw new UnsupportedOperationException( "Owner must be set in constructor and left unchanged"); } }
// in src/org/argouml/uml/diagram/ui/PathItemPlacement.java
public void setClosestPoint(Point newPoint) { throw new UnsupportedOperationException(); }
// in src/org/argouml/uml/diagram/UMLMutableGraphSupport.java
public Object connect(Object fromPort, Object toPort) { throw new UnsupportedOperationException( "The connect method is not supported"); }
// in src/org/argouml/profile/internal/ocl/uml14/HashBag.java
public boolean retainAll(Collection c) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/ui/AbstractGoList2.java
public Object getRoot() { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/ListSet.java
public T set(int arg0, T o) { throw new UnsupportedOperationException("set() method not supported"); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public List<Decision> getSupportedDecisions() { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public void addSupportedDecision(Decision d) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public List<Goal> getSupportedGoals() { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public void addSupportedGoal(Goal g) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public void addKnowledgeType(String type) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public String expand(String desc, ListSet offs) { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public Icon getClarifier() { throw new UnsupportedOperationException(); }
// in src/org/argouml/cognitive/CompoundCritic.java
Override public ToDoItem toDoItem(Object dm, Designer dsgr) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public <T> T[] toArray(T[] a) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean containsAll(Collection< ? > arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean addAll(Collection< ? extends ProjectMember> arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean addAll(int arg0, Collection< ? extends ProjectMember> arg1) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean removeAll(Collection< ? > arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public boolean retainAll(Collection< ? > arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public ProjectMember set(int arg0, ProjectMember arg1) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public void add(int arg0, ProjectMember arg1) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public ProjectMember remove(int arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public int indexOf(Object arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public int lastIndexOf(Object arg0) { throw new UnsupportedOperationException(); }
// in src/org/argouml/kernel/MemberList.java
public List<ProjectMember> subList(int arg0, int arg1) { throw new UnsupportedOperationException(); }
// in src/org/argouml/gefext/DeferredBufferedImage.java
public WritableRaster copyData(WritableRaster outRaster) { throw new UnsupportedOperationException(); // This needs to iterate to fill entire output raster if implemented // return image.copyData(outRaster); }
// in src/org/argouml/util/EnumerationIterator.java
public void remove() { throw new UnsupportedOperationException(); }
// in src/org/argouml/util/SingleElementIterator.java
public void remove() { throw new UnsupportedOperationException(); }
0 0 0 0 0
checked (Domain) VersionException
public class VersionException extends OpenException {

    /**
     * Construct the exception the version information found.
     * @param message the message
     */
    public VersionException(String message) {
        super(message);
    }
}
1
            
// in src/org/argouml/persistence/UmlFilePersister.java
protected boolean checkVersion(int fileVersion, String releaseVersion) throws OpenException, VersionException { // If we're trying to load a file from a future version // complain and refuse. if (fileVersion > PERSISTENCE_VERSION) { throw new VersionException( "The file selected is from a more up to date version of " + "ArgoUML. It has been saved with ArgoUML version " + releaseVersion + ". Please load with that or a more up to date" + "release of ArgoUML"); } return fileVersion >= PERSISTENCE_VERSION; }
0 1
            
// in src/org/argouml/persistence/UmlFilePersister.java
protected boolean checkVersion(int fileVersion, String releaseVersion) throws OpenException, VersionException { // If we're trying to load a file from a future version // complain and refuse. if (fileVersion > PERSISTENCE_VERSION) { throw new VersionException( "The file selected is from a more up to date version of " + "ArgoUML. It has been saved with ArgoUML version " + releaseVersion + ". Please load with that or a more up to date" + "release of ArgoUML"); } return fileVersion >= PERSISTENCE_VERSION; }
1
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (VersionException ex) { reportError( pmw, Translator.localize( "dialog.error.file.version.error", new Object[] {ex.getMessage()}), showUI); }
0 0
unknown (Lib) XmiException 0 0 0 1
            
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (XmiException ex) { throw new XmiFormatException(ex); }
1
            
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (XmiException ex) { throw new XmiFormatException(ex); }
0
checked (Domain) XmiFormatException
public class XmiFormatException extends OpenException {

    /**
     * Construct an XmiFormatException with a nested cause.
     * 
     * @param message the message
     * @param cause the underlying error cause
     */
    public XmiFormatException(String message, Throwable cause) {
        super(message, cause);
    }
    
    /**
     * Construct an XmiFormatException with a nested cause.
     * 
     * @param cause the underlying error cause
     */
    public XmiFormatException(Throwable cause) {
        super(cause);
    }


}
2
            
// in src/org/argouml/persistence/ModelMemberFilePersister.java
public synchronized void readModels(InputSource source) throws OpenException { XmiReader reader = null; try { reader = Model.getXmiReader(); if (Configuration.getBoolean(Argo.KEY_XMI_STRIP_DIAGRAMS, false)) { // TODO: Not implemented by eUML reader.setIgnoredElements(new String[] {"UML:Diagram"}); } else { reader.setIgnoredElements(null); } List<String> searchPath = reader.getSearchPath(); String pathList = System.getProperty("org.argouml.model.modules_search_path"); if (pathList != null) { String[] paths = pathList.split(","); for (String path : paths) { if (!searchPath.contains(path)) { reader.addSearchPath(path); } } } reader.addSearchPath(source.getSystemId()); curModel = null; elementsRead = reader.parse(source, false); if (elementsRead != null && !elementsRead.isEmpty()) { Facade facade = Model.getFacade(); Object current; Iterator elements = elementsRead.iterator(); while (elements.hasNext()) { current = elements.next(); if (facade.isAModel(current)) { LOG.info("Loaded model '" + facade.getName(current) + "'"); if (curModel == null) { curModel = current; } } else if (facade.isAProfile(current)) { LOG.info("Loaded profile '" + facade.getName(current) + "'"); if (curModel == null) { curModel = current; } } // TODO: add stereotype application (eCore AnyType?) } } uUIDRefs = new HashMap<String, Object>(reader.getXMIUUIDToObjectMap()); } catch (XmiException ex) { throw new XmiFormatException(ex); } catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); } LOG.info("======================================="); }
2
            
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (XmiException ex) { throw new XmiFormatException(ex); }
// in src/org/argouml/persistence/ModelMemberFilePersister.java
catch (UmlException ex) { // Could this be some other type of internal error that we want // to handle differently? Don't think so. - tfm throw new XmiFormatException(ex); }
0 1
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiFormatException ex) { if (ex.getCause() instanceof XmiReferenceException) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix String reference = ((XmiReferenceException) ex.getCause()).getReference(); reportError( pmw, Translator.localize( "dialog.error.xmi.reference.error", new Object[] {reference, ex.getMessage()}), ex.toString(), showUI); } else { reportError( pmw, Translator.localize( "dialog.error.xmi.format.error", new Object[] {ex.getMessage()}), showUI, ex); } }
0 0
unknown (Lib) XmiReferenceRuntimeException 0 0 0 1
            
// in src/org/argouml/ui/ProjectBrowser.java
catch (XmiReferenceRuntimeException ex) { // an error that can be corrected by the user, so no stack // trace, but instead an explanation and a hint how to fix reportError(pmw, Translator.localize("dialog.error.xmi.reference.error", new Object[] {ex.getReference(), ex.getMessage()}), ex.toString(), showUI); }
0 0

Miscellanous Metrics

nF = Number of Finally 22
nF = Number of Try-Finally (without catch) 10
Number of Methods with Finally (nMF) 24 / 8795 (0.3%)
Number of Finally with a Continue 0
Number of Finally with a Return 1
Number of Finally with a Throw 2
Number of Finally with a Break 0
Number of different exception types thrown 28
Number of Domain exception types thrown 8
Number of different exception types caught 54
Number of Domain exception types caught 7
Number of exception declarations in signatures 296
Number of different exceptions types declared in method signatures 29
Number of library exceptions types declared in method signatures 22
Number of Domain exceptions types declared in method signatures 7
Number of Catch with a continue 3
Number of Catch with a return 77
Number of Catch with a Break 1
nbIf = Number of If 8184
nbFor = Number of For 987
Number of Method with an if 3220 / 8795
Number of Methods with a for 788 / 8795
Number of Method starting with a try 64 / 8795 (0.7%)
Number of Expressions 88124
Number of Expressions in try 6187 (7%)