handling the case where list of literals include nulls (this happens for date/time literals when the field is not filled in)
This commit is contained in:
parent
36a99486f6
commit
78607710de
1 changed files with 17 additions and 15 deletions
|
@ -155,21 +155,23 @@ public class AntiXssValidation implements N3ValidatorVTwo{
|
||||||
AntiSamy antiSamy = AntiScript.getAntiSamyScanner();
|
AntiSamy antiSamy = AntiScript.getAntiSamyScanner();
|
||||||
|
|
||||||
ArrayList errorMsgs = new ArrayList();
|
ArrayList errorMsgs = new ArrayList();
|
||||||
for( Literal literal : list ){
|
for( Literal literal : list ){
|
||||||
CleanResults cr = antiSamy.scan(literal.getLexicalForm());
|
if(literal != null) {
|
||||||
errorMsgs.addAll( cr.getErrorMessages() );
|
CleanResults cr = antiSamy.scan(literal.getLexicalForm());
|
||||||
|
errorMsgs.addAll( cr.getErrorMessages() );
|
||||||
String dt = literal.getDatatypeURI();
|
|
||||||
if( dt != null ){
|
String dt = literal.getDatatypeURI();
|
||||||
cr = antiSamy.scan( dt );
|
if( dt != null ){
|
||||||
errorMsgs.addAll( cr.getErrorMessages() );
|
cr = antiSamy.scan( dt );
|
||||||
}
|
errorMsgs.addAll( cr.getErrorMessages() );
|
||||||
|
}
|
||||||
String lang = literal.getLanguage() ;
|
|
||||||
if( lang != null ){
|
String lang = literal.getLanguage() ;
|
||||||
cr = antiSamy.scan( lang );
|
if( lang != null ){
|
||||||
errorMsgs.addAll( cr.getErrorMessages() );
|
cr = antiSamy.scan( lang );
|
||||||
}
|
errorMsgs.addAll( cr.getErrorMessages() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( errorMsgs.isEmpty() )
|
if( errorMsgs.isEmpty() )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue