2013-03-01 5 views
3

내가 ST-4.0.7.jar를 사용하고 있습니다를 찾을 수없는 내 템플릿은 다음과 같습니다 : 내 출력 파일에 보면하지만 난 그냥 얻을StringTemplate는 게터

backtrack_result(btresult) ::=<< 
    <backtrack-result> 
     <pattern id="$btresult.pattern.id$">$btresult.pattern.description$</pattern> 
     <file>$btresult.file.file.path$</file> 
     <line>$btresult.codeline.lineNr$</line> 
     <method>$btresult.codeline.method.name$</method>   
    </backtrack-result> 
>> 

<method></method> 

BTResult에서 :

public CodeLineInterface getCodeline() { 
    return cl; 
} 

코드 라인에서 :

방법에서

:

public String getName() { 
    return name; 
} 

은 내가 getMethod 메소드 방법에 대한 코드 라인 객체에 중단 점을 설정하고 호출되지 않습니다. 그래서 어떻게 든 stringtemplate이 올바른 getter를 해결하는 데 문제가 있다고 결론을 내립니다.

나는 보안 목표 명세서는 다음과 같은 오류가 발생하는 것이 발견되는 STErrorListener을 추가 :

STReportGenerator - context [/report /backtrack_results /backtrack_result] 5:19 no such property or can't access: ju.no.need.toknow.BTResult.method 
Caused by: org.stringtemplate.v4.misc.STNoSuchPropertyException: no such property: ju.no.need.toknow.BTResult.method 
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.throwNoSuchProperty(ObjectModelAdaptor.java:106) 
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.lookupMethod(ObjectModelAdaptor.java:99) 
    at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:67) 
    at org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1158) 

무엇 특히 이것에 대해 나 퍼즐 : 왜 템플릿이 btresult 가야 말할 때 BTReult.method에 해결하려고 않습니다. 코드 라인.method.name?

+1

'getMethod'는 public 인스턴스 메소드입니다. 맞습니까? – dasblinkenlight

+0

'getLineNr()'에 중단 점을 설정하면 충돌합니까? 그렇지 않다면, 나는'getCodeline()'에 중단 점을 설정하여 그것이 무엇을 반환하는지 봅니다. – monty0

+0

내 xml 문서에서 올바른 값을 볼 수 있으므로 getLineNr이 분명히 히트되었습니다. 방법의 이름과 관련이 있는지 궁금해지기 시작했습니다. 어쩌면 ST가 그 getter를 추측하는 데 사용하는 반사와 관련된 이상한 코너 케이스 일 수도 있습니다. – er4z0r

답변

2

확인. 내 어리 석음이었습니다. 템플릿을 수정하는 동안 코드가 실제로 이전 템플릿을 사용하여 모든 수정 사항이 작동하지 않는 것처럼 보였습니다. OSI Layer 8 Problem :-)