You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ra...@apache.org on 2008/04/26 03:09:37 UTC
svn commit: r651765 -
/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/SimpleErrorReporter.java
Author: rahul
Date: Fri Apr 25 18:09:26 2008
New Revision: 651765
URL: http://svn.apache.org/viewvc?rev=651765&view=rev
Log:
Eliminate raw type warnings and type safety improvements.
Suppress warnings since error contexts come in flavors that haven't been abstracted over (and there is no intent to).
Modified:
commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/SimpleErrorReporter.java
Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/SimpleErrorReporter.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/SimpleErrorReporter.java?rev=651765&r1=651764&r2=651765&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/SimpleErrorReporter.java (original)
+++ commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/SimpleErrorReporter.java Fri Apr 25 18:09:26 2008
@@ -49,6 +49,7 @@
/**
* @see ErrorReporter#onError(String, String, Object)
*/
+ @SuppressWarnings("unchecked")
public void onError(final String errorCode, final String errDetail,
final Object errCtx) {
//Note: the if-then-else below is based on the actual usage
@@ -71,24 +72,26 @@
msg.append("Action: " + errCtx.getClass().getName());
} else if (errCode == ErrorConstants.ILLEGAL_CONFIG) {
//isLegalConfig
- if (errCtx instanceof Map.Entry) {
- TransitionTarget tt = (TransitionTarget)
- (((Map.Entry) errCtx).getKey());
- Set vals = (Set) (((Map.Entry) errCtx).getValue());
+ if (errCtx instanceof Map.Entry) { //unchecked cast below
+ Map.Entry<TransitionTarget, Set<TransitionTarget>> badConfigMap =
+ (Map.Entry<TransitionTarget, Set<TransitionTarget>>) errCtx;
+ TransitionTarget tt = badConfigMap.getKey();
+ Set<TransitionTarget> vals = badConfigMap.getValue();
msg.append(LogUtils.getTTPath(tt) + " : [");
- for (Iterator i = vals.iterator(); i.hasNext();) {
- TransitionTarget tx = (TransitionTarget) i.next();
+ for (Iterator<TransitionTarget> i = vals.iterator();
+ i.hasNext();) {
+ TransitionTarget tx = i.next();
msg.append(LogUtils.getTTPath(tx));
- if (i.hasNext()) {
+ if (i.hasNext()) { // reason for iterator usage
msg.append(", ");
}
}
msg.append(']');
- } else if (errCtx instanceof Set) {
- Set vals = (Set) errCtx;
+ } else if (errCtx instanceof Set) { //unchecked cast below
+ Set<TransitionTarget> vals = (Set<TransitionTarget>) errCtx;
msg.append("<SCXML> : [");
- for (Iterator i = vals.iterator(); i.hasNext();) {
- TransitionTarget tx = (TransitionTarget) i.next();
+ for (Iterator<TransitionTarget> i = vals.iterator(); i.hasNext();) {
+ TransitionTarget tx = i.next();
msg.append(LogUtils.getTTPath(tx));
if (i.hasNext()) {
msg.append(", ");