Adding more unit tests for EditN3Generator. Dealing with literals better

This commit is contained in:
briancaruso 2011-11-18 17:07:52 +00:00
parent 5ddd6fecad
commit 876e2d97f1
3 changed files with 74 additions and 5 deletions

View file

@ -148,7 +148,7 @@ public class EditN3GeneratorVTwo {
*
*/
protected String subInLiterals(String var, Literal literal, String target){
String varRegex = "\\?" + var + "(?=\\.\\p{Space}|\\p{Space})";
String varRegex = "\\?" + var + "(?=\\p{Punct}||\\p{Space}|&)";
if (target==null ) {
log.error("subInLiterals was passed a null target");
return "blankBecauseTargetOrValueWasNull";
@ -215,7 +215,7 @@ public class EditN3GeneratorVTwo {
String valueString = org.apache.commons.lang.StringUtils.join(n3Values, ",");
//Substitute it in to n3
String varRegex = "\\?" + var + "(?=\\.\\p{Space}|\\p{Space})";
String varRegex = "\\?" + var + "(?=\\p{Punct}|\\p{Space}|$)";
String out = null;
if( valueString != null )

View file

@ -385,7 +385,8 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
// and other unusual places that can cause problems.
Class<?> c = method.getDeclaringClass();
if (c.equals(java.lang.Object.class) ||
if (c == null ||
c.equals(java.lang.Object.class) ||
c.equals(java.lang.reflect.Constructor.class) ||
c.equals(java.lang.reflect.Field.class ) )
continue;
@ -416,7 +417,8 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
TemplateModel value = model.get(propertyName);
properties.put(propertyName, getDump(value));
}catch(Throwable th){
log.error("problem dumping " + propertyName + " on " + object.getClass().getName(), th);
log.error("problem dumping " + propertyName + " on " + object.getClass().getName() +
" declared in " + c.getName(), th);
}
continue;
}