You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2004/03/01 11:36:23 UTC
cvs commit: cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl WorkflowBuilder.java ConditionFactory.java WorkflowImpl.java AbstractCondition.java BooleanVariableAssignmentImpl.java StateImpl.java TransitionImpl.java EventImpl.java Version.java BooleanVariableImpl.java History.java ActionImpl.java WorkflowInstanceImpl.java
andreas 2004/03/01 02:36:22
Modified: src/blocks/workflow/java/org/apache/lenya/workflow/impl
WorkflowBuilder.java ConditionFactory.java
WorkflowImpl.java AbstractCondition.java
BooleanVariableAssignmentImpl.java StateImpl.java
TransitionImpl.java EventImpl.java Version.java
BooleanVariableImpl.java History.java
ActionImpl.java WorkflowInstanceImpl.java
Log:
removed assertions
Revision Changes Path
1.2 +1 -21 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/WorkflowBuilder.java
Index: WorkflowBuilder.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/WorkflowBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WorkflowBuilder.java 29 Feb 2004 17:34:47 -0000 1.1
+++ WorkflowBuilder.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -143,8 +143,6 @@
}
}
- assert initialState != null;
-
WorkflowImpl workflow = new WorkflowImpl(initialState);
// load variables
@@ -187,8 +185,6 @@
* @return A boolean value.
*/
protected static boolean isInitialStateElement(Element element) {
- assert element.getLocalName().equals(STATE_ELEMENT);
-
String initialAttribute = element.getAttribute(INITIAL_ATTRIBUTE);
return (initialAttribute != null)
@@ -218,8 +214,6 @@
* @return A state.
*/
protected static StateImpl buildState(Element element) {
- assert element.getLocalName().equals(STATE_ELEMENT);
-
String id = element.getAttribute(ID_ATTRIBUTE);
StateImpl state = new StateImpl(id);
@@ -246,31 +240,19 @@
log.debug("Building transition");
}
- assert element.getLocalName().equals(TRANSITION_ELEMENT);
-
String sourceId = element.getAttribute(SOURCE_ATTRIBUTE);
String destinationId = element.getAttribute(DESTINATION_ATTRIBUTE);
- assert sourceId != null;
- assert destinationId != null;
-
StateImpl source = (StateImpl) states.get(sourceId);
StateImpl destination = (StateImpl) states.get(destinationId);
- assert source != null;
- assert destination != null;
-
TransitionImpl transition = new TransitionImpl(source, destination);
// set event
Element eventElement =
(Element) element.getElementsByTagNameNS(Workflow.NAMESPACE, EVENT_ELEMENT).item(0);
String id = eventElement.getAttribute(ID_ATTRIBUTE);
- assert id != null;
-
Event event = (Event) events.get(id);
- assert event != null;
-
transition.setEvent(event);
if (log.isDebugEnabled()) {
@@ -321,8 +303,6 @@
*/
protected static EventImpl buildEvent(Element element) {
String id = element.getAttribute(ID_ATTRIBUTE);
- assert id != null;
-
EventImpl event = new EventImpl(id);
return event;
1.2 +1 -3 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/ConditionFactory.java
Index: ConditionFactory.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/ConditionFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConditionFactory.java 29 Feb 2004 17:34:47 -0000 1.1
+++ ConditionFactory.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -80,8 +80,6 @@
*/
protected static Condition createCondition(String className, String expression)
throws WorkflowException {
- assert className != null;
- assert expression != null;
Condition condition;
1.2 +1 -6 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/WorkflowImpl.java
Index: WorkflowImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/WorkflowImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WorkflowImpl.java 29 Feb 2004 17:34:47 -0000 1.1
+++ WorkflowImpl.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -107,7 +107,6 @@
* @param transition The transition.
*/
protected void addTransition(TransitionImpl transition) {
- assert transition != null;
transitions.add(transition);
addState(transition.getSource());
addState(transition.getDestination());
@@ -127,8 +126,6 @@
*
*/
protected State getDestination(Transition transition) {
- assert transition instanceof TransitionImpl;
-
return ((TransitionImpl) transition).getDestination();
}
@@ -188,7 +185,6 @@
* @param event An event.
*/
protected void addEvent(EventImpl event) {
- assert event != null;
events.put(event.getName(), event);
}
@@ -216,7 +212,6 @@
* @param variable A variable.
*/
protected void addVariable(BooleanVariableImpl variable) {
- assert variable != null;
variables.put(variable.getName(), variable);
}
1.2 +1 -2 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/AbstractCondition.java
Index: AbstractCondition.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/AbstractCondition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractCondition.java 29 Feb 2004 17:34:47 -0000 1.1
+++ AbstractCondition.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -72,7 +72,6 @@
* @see org.apache.lenya.workflow.impl.AbstractCondition#setExpression(java.lang.String)
*/
public void setExpression(String expression) throws WorkflowException {
- assert expression != null;
this.expression = expression.trim();
}
1.2 +1 -2 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/BooleanVariableAssignmentImpl.java
Index: BooleanVariableAssignmentImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/BooleanVariableAssignmentImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BooleanVariableAssignmentImpl.java 29 Feb 2004 17:34:47 -0000 1.1
+++ BooleanVariableAssignmentImpl.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -74,7 +74,6 @@
* @param value The value.
*/
protected BooleanVariableAssignmentImpl(BooleanVariableImpl variable, boolean value) {
- assert variable != null;
this.variable = variable;
this.value = value;
1.2 +1 -2 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/StateImpl.java
Index: StateImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/StateImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StateImpl.java 29 Feb 2004 17:34:47 -0000 1.1
+++ StateImpl.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -69,7 +69,6 @@
* @param stateId The state ID.
*/
protected StateImpl(String stateId) {
- assert stateId != null;
id = stateId;
}
1.2 +1 -7 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/TransitionImpl.java
Index: TransitionImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/TransitionImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TransitionImpl.java 29 Feb 2004 17:34:47 -0000 1.1
+++ TransitionImpl.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -82,9 +82,6 @@
* @param destinationState The destination state.
*/
protected TransitionImpl(StateImpl sourceState, StateImpl destinationState) {
- assert sourceState != null;
- assert destinationState != null;
-
source = sourceState;
destination = destinationState;
}
@@ -107,7 +104,6 @@
* @param action DOCUMENT ME!
*/
public void addAction(Action action) {
- assert action != null;
actions.add(action);
}
@@ -128,7 +124,6 @@
* @param condition DOCUMENT ME!
*/
public void addCondition(Condition condition) {
- assert condition != null;
conditions.add(condition);
}
@@ -149,7 +144,6 @@
* @param anEvent DOCUMENT ME!
*/
public void setEvent(Event anEvent) {
- assert anEvent != null;
event = anEvent;
}
1.2 +1 -2 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/EventImpl.java
Index: EventImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/EventImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EventImpl.java 29 Feb 2004 17:34:47 -0000 1.1
+++ EventImpl.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -69,7 +69,6 @@
* @param eventName The event name.
*/
protected EventImpl(String eventName) {
- assert eventName != null;
name = eventName;
}
1.2 +1 -4 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/Version.java
Index: Version.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/Version.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Version.java 29 Feb 2004 17:34:47 -0000 1.1
+++ Version.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -91,10 +91,7 @@
* @param state The destination state.
*/
public Version(Event event, State state) {
- assert event != null;
this.event = event;
-
- assert state != null;
this.state = state;
}
1.2 +1 -2 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/BooleanVariableImpl.java
Index: BooleanVariableImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/BooleanVariableImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BooleanVariableImpl.java 29 Feb 2004 17:34:47 -0000 1.1
+++ BooleanVariableImpl.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -70,7 +70,6 @@
* @param initialValue The initial value of the corresponding variable instances.
*/
protected BooleanVariableImpl(String variableName, boolean initialValue) {
- assert variableName != null;
name = variableName;
this.initialValue = initialValue;
1.2 +4 -2 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/History.java
Index: History.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/History.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- History.java 29 Feb 2004 17:34:47 -0000 1.1
+++ History.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -447,7 +447,9 @@
* @throws WorkflowException when something went wrong.
*/
protected Version restoreVersion(NamespaceHelper helper, Element element) throws WorkflowException {
- assert element.getLocalName().equals(VERSION_ELEMENT);
+ if (!element.getLocalName().equals(VERSION_ELEMENT)) {
+ throw new WorkflowException("Invalid history XML!");
+ }
Event event = null;
String eventId = element.getAttribute(EVENT_ATTRIBUTE);
1.2 +1 -2 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/ActionImpl.java
Index: ActionImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/ActionImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ActionImpl.java 29 Feb 2004 17:34:47 -0000 1.1
+++ ActionImpl.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -71,7 +71,6 @@
* @param actionId The action ID.
*/
protected ActionImpl(String actionId) {
- assert actionId != null;
id = actionId;
}
1.2 +1 -4 cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/WorkflowInstanceImpl.java
Index: WorkflowInstanceImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/workflow/java/org/apache/lenya/workflow/impl/WorkflowInstanceImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WorkflowInstanceImpl.java 29 Feb 2004 17:34:47 -0000 1.1
+++ WorkflowInstanceImpl.java 1 Mar 2004 10:36:22 -0000 1.2
@@ -215,7 +215,6 @@
* @param state The state to set.
*/
protected void setCurrentState(State state) {
- assert (state != null) && ((WorkflowImpl) getWorkflow()).containsState(state);
this.currentState = state;
}
@@ -231,7 +230,6 @@
* @param workflow A workflow object.
*/
protected void setWorkflow(WorkflowImpl workflow) {
- assert workflow != null;
this.workflow = workflow;
setCurrentState(getWorkflow().getInitialState());
initVariableInstances();
@@ -243,7 +241,6 @@
* @throws WorkflowException if something goes wrong.
*/
protected void setWorkflow(String workflowName) throws WorkflowException {
- assert (workflowName != null) && !"".equals(workflowName);
setWorkflow(getWorkflow(workflowName));
}