StateValue diagnosisStateValue = currentDefense.getAffectedAssetState().findStateValue(diagnosis);
AssetState diagnosisStateValue = currentDefense.getAffectedAssetState().findAssetState(diagnosis);
    private void handle_Function(Attributes attrs){             if (ERROR) { return; }        if (currentMonitoringLevel == null) {            ERROR = true;            logger.warn("*** Cannot process -- Defense XML:Function element - Missing Monitoring element.");                        return;        }        String diagnosis = attrs.getValue("diagnosis");        String state = attrs.getValue("assetStateDescriptor");                String value = attrs.getValue("assetStateValue");                String prob = attrs.getValue("probability");                String type = attrs.getValue("assetType");                AssetType assetType = null;        if ( type == null) { //use type specified in Defense element            assetType = currentDefense.getAssetType();        } else {            assetType = AssetType.findAssetType(type);            if (assetType == null) {                ERROR = true;                 logger.warn("*** Cannot process this defense entry -- Defense XML -  unknown asset type = : "+type);                            return;            }        }                        AssetStateDescriptor assetState = assetType.findState(state);        if ( assetState == null) {             ERROR = true;             logger.warn("*** Cannot process this defense entry -- Defense XML -  unknown asset state = : "+state + " for this asset type: "+assetType.getName());                        return;        }        StateValue stateValue = assetState.findStateValue(value);        if ( stateValue == null) {             ERROR = true;             logger.warn("*** Cannot process this defense entry -- Defense XML -  unknown state value = : "+value + " for this asset state = : "+state + " & this asset type: "+assetType.getName());                        return;        }        StateValue diagnosisStateValue = currentDefense.getAffectedAssetState().findStateValue(diagnosis);        if ( diagnosisStateValue == null) {             ERROR = true;             logger.warn("*** Cannot process this defense entry -- Defense XML -  unknown diagnosis state value= : "+diagnosis + "for this asset state = : "+state + " & this asset type: "+assetType.getName());                        return;        }        try {            double probability = Double.parseDouble(prob);            DiagnosisAccuracyFunction daf = new DiagnosisAccuracyFunction(assetState, stateValue, diagnosisStateValue, probability);            currentMonitoringLevel.addDiagnosis(daf);        } catch (Exception e) {            ERROR = true;            logger.warn("*** Cannot process -- Defense XML - Function element - probability conversion to double error: p="+prob, e);                    }                    }