Skip to content
Snippets Groups Projects
Commit cf2d0c80 authored by Jürgen Walter's avatar Jürgen Walter
Browse files

Improved parsing of method signatures

parent a0b0696f
No related branches found
No related tags found
No related merge requests found
......@@ -38,8 +38,6 @@ public class ClassAndInterfaceFilter extends AbstractFilterPlugin {
super(configuration, projectContext);
}
@InputPort(
name = ClassAndInterfaceFilter.INPUT_PORT_NAME,
description = "Extract class-information from monitoring record",
......@@ -55,39 +53,40 @@ public class ClassAndInterfaceFilter extends AbstractFilterPlugin {
final String signature = opExRecord.getOperationSignature();
final long exTime = opExRecord.getTout()-opExRecord.getTin();
final String classPattern = "[\\p{Graph}]+((\\.)(\\w)*[<(].*[>)])";//String-pattern to extract the component information
final String interfacePattern = "((\\.)(\\w)*[<(].*[>)])";//String-pattern to extract the component information
final String requestID = opExRecord.getSessionId();
// final long traceID = opExRecord.getTraceId();
// final long eoi = opExRecord.getEoi();
// final long ess = opExRecord.getEss();
String className = null;
String interfaceName = null;
try {
String[] redundantInfo=signature.split(classPattern);
//(redundantInfo + classAndInterfaceString) - redundantInfo = classAndInterfaceString
String classAndInterfaceString = signature;
if (redundantInfo.length > 0){
classAndInterfaceString = signature.substring(redundantInfo[0].length());
}
//remove return type + visibility from method signature string
String classAndInterfaceString = signature;//split("(\\s)*")[2];
classAndInterfaceString = classAndInterfaceString.replace("transient", "");
classAndInterfaceString = classAndInterfaceString.replace("public", "");
classAndInterfaceString = classAndInterfaceString.replace("private", "");
classAndInterfaceString = classAndInterfaceString.replace("protected", "");
classAndInterfaceString = classAndInterfaceString.replace("synchronized", "");
classAndInterfaceString = classAndInterfaceString.replace("static", "");
classAndInterfaceString = classAndInterfaceString.trim();
classAndInterfaceString = classAndInterfaceString.substring(classAndInterfaceString.indexOf(" ")+1);
classAndInterfaceString = classAndInterfaceString.replaceAll("\\$(\\d)*", "");
classAndInterfaceString = classAndInterfaceString.trim();
//extraction of the class information
String[] componentSeparatedByNonWordChar = classAndInterfaceString.split(interfacePattern);
className = componentSeparatedByNonWordChar[0].trim();
//extraction of the interface information
interfaceName = classAndInterfaceString.substring(className.length()+1).trim();
if(classAndInterfaceString.length() > className.length()) {
interfaceName = classAndInterfaceString.substring(className.length()+1).trim();
}else {
log.error("EEEEE "+ classAndInterfaceString);
log.error("EEEEE "+ className);
}
} catch (Exception e) {
e.printStackTrace();
/*
* TODO
*/
log.error("Errro parsing signature", e);
}
long classID = putIntoClassMap(timestamp,hostName, className, requestID);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment