Commit d44e2723 authored by Paff's avatar Paff
Browse files

comments

more detailed output
parent 2767e4d2
......@@ -52,6 +52,7 @@ public class EncryptedPathWithUnencryptedPart extends Analysis
*/
public void check(ASTArcPort node, SecPortEntry entry, ArchitectureGraph graph) throws AmbigousException{
//Checks if the path starts with this port
if(!AnalysisHelper.isPortBenningOfPath(node, resolver, getNameSpaceFor(node.getMainParent()), getNameSpaceFor(node.getMainParent().getMainParent()))) {
return;
}
......@@ -73,15 +74,20 @@ public class EncryptedPathWithUnencryptedPart extends Analysis
//First element is not needed
iterator.next();
//Run over paths
while(iterator.hasNext()) {
//Next element from graph
element = iterator.next().getArchitectureElement();
//Run over path
if(element instanceof SecConnectorEntry) {
//Search for encrypted parts
if(((SecConnectorEntry) element).isEncrypted()) {
encrypted = true;
}
//Search for unencrypted parts
if(!((SecConnectorEntry) element).isEncrypted()) {
unencryted = true;
}
......@@ -92,19 +98,24 @@ public class EncryptedPathWithUnencryptedPart extends Analysis
}
//New path starts
if((element instanceof PortEntry
&& ((PortEntry) element).getName().equals(entry.getName())) || !iterator.hasNext()) {
if((element instanceof PortEntry && ((PortEntry) element).getName().equals(entry.getName())) ||
!iterator.hasNext()) {
//Check if info is needed
if(!path.isEmpty()) {
//Check for mixed path
if(encrypted && unencryted) {
StringBuilder builder = new StringBuilder("The following path consists of encrypted and unencrypted parts: " + path.get(0));
StringBuilder sBuilder = new StringBuilder("The following path consists of encrypted and unencrypted parts: " + path.get(0));
path.remove(0);
for(SecConnectorEntry pathElement : path) {
builder.append(" -> ");
builder.append(pathElement);
sBuilder.append(" -> ");
if(pathElement.isEncrypted()) {
sBuilder.append(pathElement + "*");
} else {
sBuilder.append(pathElement);
}
}
addReport(builder.toString(), node.get_SourcePositionStart());
sBuilder.append(". The unecrypted parts are marked by *. It is likely that a encryption is missing.");
addReport(sBuilder.toString(), node.get_SourcePositionStart());
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment