diff --git a/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java b/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java index 5f0719034508d821d82b86c2b8f014dbdaa0890a..8dae12c85ee22916d3d009017296096bf2b49d54 100644 --- a/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java +++ b/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java @@ -1212,11 +1212,6 @@ public class TML2Avatar { } else { String attributeName = setNewAttributeName(getName(ch.getName()) + "_chData", block); channelData = new AvatarAttribute(attributeName, AvatarType.INTEGER, block, null); - if (!channelsSecAttributes.containsKey(ae)) { - Set<String> tmp = new HashSet<String>(); - channelsSecAttributes.put(ae, tmp); - } - channelsSecAttributes.get(ae).add(channelData.getName()); block.addAttribute(channelData); } if (channelData != null) { @@ -1267,6 +1262,14 @@ public class TML2Avatar { } } if (!foundDecrytionOp) { + if (!channelsSecAttributes.containsKey(ae)) { + Set<String> tmp = new HashSet<String>(); + channelsSecAttributes.put(ae, tmp); + } + channelsSecAttributes.get(ae).add(channelData.getName()); + if (ae.getSecurityPattern() != null) { + channelsSecAttributes.get(ae).add(ae.getSecurityPattern().getName()); + } /*if (block.getAvatarAttributeWithName(getName(ch.getName()) + "_chData") == null) { AvatarAttribute channelData = new AvatarAttribute(getName(ch.getName()) + "_chData", AvatarType.INTEGER, block, null); block.addAttribute(channelData); @@ -2083,8 +2086,8 @@ public class TML2Avatar { for (TMLActivityElement actElem : task.getActivityDiagram().getElements()) { if (actElem instanceof TMLReadChannel) { TMLReadChannel rd = (TMLReadChannel) actElem; - if (rd.hasChannel(ch) && actElem.getSecurityPattern() == null - && channelsSecAttributes.get(actElem).contains(attributeStateOrigin.getAttribute().getName())) { + if (rd.hasChannel(ch) && channelsSecAttributes.containsKey(actElem) && + channelsSecAttributes.get(actElem).contains(attributeStateDest.getAttribute().getName())) { if (!authPragmaMap.containsKey(rd)) { Set<AvatarPragma> tmp = new HashSet<AvatarPragma>(); authPragmaMap.put(rd, tmp);