UnexpectedTypeException( String blamedAssignmentTargetVarName, TemplateModel model, String expectedTypesDesc, Class[] expectedTypes, Object[] tips, Environment env) throws InvalidReferenceException { super(null, env, null, newDesciptionBuilder( null, blamedAssignmentTargetVarName, model, expectedTypesDesc, expectedTypes, env).tips(tips)); }
= new _ErrorDescriptionBuilder("The following has evaluated to null or missing:").blame(blamed); if (endsWithDollarVariable(blamed)) { errDescBuilder.tips(TIP_NO_DOLLAR, TIP); } else if (blamed instanceof Dot) { final String rho = ((Dot) blamed).getRHO(); nameFixTip = "To query the length of a string use ?length, like myString?size"; errDescBuilder.tips( nameFixTip == null ? new Object[] { TIP_LAST_STEP_DOT, TIP } : new Object[] { TIP_LAST_STEP_DOT, nameFixTip, TIP }); } else if (blamed instanceof DynamicKeyName) { errDescBuilder.tips(TIP_LAST_STEP_SQUARE_BRACKET, TIP); } else if (blamed instanceof Identifier && ((Identifier) blamed).getName().equals("JspTaglibs")) { errDescBuilder.tips(TIP_JSP_TAGLIBS, TIP); } else { errDescBuilder.tip(TIP);
public static _TemplateModelException newCantFormatUnknownTypeDateException( Expression dateSourceExpr, UnknownDateTypeFormattingUnsupportedException cause) { return new _TemplateModelException(cause, null, new _ErrorDescriptionBuilder( _MessageUtil.UNKNOWN_DATE_TO_STRING_ERROR_MESSAGE) .blame(dateSourceExpr) .tips(_MessageUtil.UNKNOWN_DATE_TO_STRING_TIPS)); }
private _ErrorDescriptionBuilder getNullBooleanFormatErrorDescription() { return new _ErrorDescriptionBuilder( "Can't convert boolean to string automatically, because the \"", BOOLEAN_FORMAT_KEY ,"\" setting was ", new _DelayedJQuote(getBooleanFormat()), (getBooleanFormat().equals(C_TRUE_FALSE) ? ", which is the legacy default computer-language format, and hence isn't accepted." : ".") ).tips( "If you just want \"true\"/\"false\" result as you are generting computer-language output, " + "use \"?c\", like ${myBool?c}.", "You can write myBool?string('yes', 'no') and like to specify boolean formatting in place.", new Object[] { "If you need the same two values on most places, the programmers should set the \"", BOOLEAN_FORMAT_KEY ,"\" setting to something like \"yes,no\"." } ); }
/** * Used for assignments that use operators like {@code +=}, when the target variable was null/missing. */ static InvalidReferenceException getInstance(int scope, String missingAssignedVarName, String assignmentOperator, Environment env) { if (env != null && env.getFastInvalidReferenceExceptions()) { return FAST_INSTANCE; } else { final _ErrorDescriptionBuilder errDescBuilder = new _ErrorDescriptionBuilder( "The target variable of the assignment, ", new _DelayedJQuote(missingAssignedVarName), ", was null or missing in the " + Assignment.scopeAsString(scope) + ", and the \"", assignmentOperator, "\" operator must get its value from there before assigning to it." ); if (missingAssignedVarName.startsWith("$")) { errDescBuilder.tips(TIP_NO_DOLLAR, TIP_MISSING_ASSIGNMENT_TARGET); } else { errDescBuilder.tip(TIP_MISSING_ASSIGNMENT_TARGET); } return new InvalidReferenceException(errDescBuilder, env, null); } }
public int size() throws TemplateModelException { throw new _TemplateModelException( new _ErrorDescriptionBuilder( "Getting the number of items or listing the items is not supported on this ", new _DelayedFTLTypeDescription(this), " value, because this value wraps the following Java method, " + "not a real listable value: ", new _DelayedToString(getMember())) .tips( "Maybe you should to call this method first and then do something with its return value.", "obj.someMethod(i) and obj.someMethod[i] does the same for this method, hence it's a " + "\"+sequence\".")); }
UnexpectedTypeException( String blamedAssignmentTargetVarName, TemplateModel model, String expectedTypesDesc, Class[] expectedTypes, Object[] tips, Environment env) throws InvalidReferenceException { super(null, env, null, newDesciptionBuilder( null, blamedAssignmentTargetVarName, model, expectedTypesDesc, expectedTypes, env).tips(tips)); }
UnexpectedTypeException( String blamedAssignmentTargetVarName, TemplateModel model, String expectedTypesDesc, Class[] expectedTypes, Object[] tips, Environment env) throws InvalidReferenceException { super(null, env, null, newDesciptionBuilder( null, blamedAssignmentTargetVarName, model, expectedTypesDesc, expectedTypes, env).tips(tips)); }
= new _ErrorDescriptionBuilder("The following has evaluated to null or missing:").blame(blamed); if (endsWithDollarVariable(blamed)) { errDescBuilder.tips(TIP_NO_DOLLAR, TIP); } else if (blamed instanceof Dot) { final String rho = ((Dot) blamed).getRHO(); nameFixTip = "To query the length of a string use ?length, like myString?size"; errDescBuilder.tips( nameFixTip == null ? new Object[] { TIP_LAST_STEP_DOT, TIP } : new Object[] { TIP_LAST_STEP_DOT, nameFixTip, TIP }); } else if (blamed instanceof DynamicKeyName) { errDescBuilder.tips(TIP_LAST_STEP_SQUARE_BRACKET, TIP); } else if (blamed instanceof Identifier && ((Identifier) blamed).getName().equals("JspTaglibs")) { errDescBuilder.tips(TIP_JSP_TAGLIBS, TIP); } else { errDescBuilder.tip(TIP);
= new _ErrorDescriptionBuilder("The following has evaluated to null or missing:").blame(blamed); if (endsWithDollarVariable(blamed)) { errDescBuilder.tips(TIP_NO_DOLLAR, TIP); } else if (blamed instanceof Dot) { final String rho = ((Dot) blamed).getRHO(); nameFixTip = "To query the length of a string use ?length, like myString?size"; errDescBuilder.tips( nameFixTip == null ? new Object[] { TIP_LAST_STEP_DOT, TIP } : new Object[] { TIP_LAST_STEP_DOT, nameFixTip, TIP }); } else if (blamed instanceof DynamicKeyName) { errDescBuilder.tips(TIP_LAST_STEP_SQUARE_BRACKET, TIP); } else if (blamed instanceof Identifier && ((Identifier) blamed).getName().equals("JspTaglibs")) { errDescBuilder.tips(TIP_JSP_TAGLIBS, TIP); } else { errDescBuilder.tip(TIP);
public static _TemplateModelException newCantFormatUnknownTypeDateException( Expression dateSourceExpr, UnknownDateTypeFormattingUnsupportedException cause) { return new _TemplateModelException(cause, null, new _ErrorDescriptionBuilder( _MessageUtil.UNKNOWN_DATE_TO_STRING_ERROR_MESSAGE) .blame(dateSourceExpr) .tips(_MessageUtil.UNKNOWN_DATE_TO_STRING_TIPS)); }
public static _TemplateModelException newCantFormatUnknownTypeDateException( Expression dateSourceExpr, UnknownDateTypeFormattingUnsupportedException cause) { return new _TemplateModelException(cause, null, new _ErrorDescriptionBuilder( _MessageUtil.UNKNOWN_DATE_TO_STRING_ERROR_MESSAGE) .blame(dateSourceExpr) .tips(_MessageUtil.UNKNOWN_DATE_TO_STRING_TIPS)); }
private _ErrorDescriptionBuilder getNullBooleanFormatErrorDescription() { return new _ErrorDescriptionBuilder( "Can't convert boolean to string automatically, because the \"", BOOLEAN_FORMAT_KEY ,"\" setting was ", new _DelayedJQuote(getBooleanFormat()), (getBooleanFormat().equals(C_TRUE_FALSE) ? ", which is the legacy default computer-language format, and hence isn't accepted." : ".") ).tips( "If you just want \"true\"/\"false\" result as you are generting computer-language output, " + "use \"?c\", like ${myBool?c}.", "You can write myBool?string('yes', 'no') and like to specify boolean formatting in place.", new Object[] { "If you need the same two values on most places, the programmers should set the \"", BOOLEAN_FORMAT_KEY ,"\" setting to something like \"yes,no\"." } ); }
private _ErrorDescriptionBuilder getNullBooleanFormatErrorDescription() { return new _ErrorDescriptionBuilder( "Can't convert boolean to string automatically, because the \"", BOOLEAN_FORMAT_KEY ,"\" setting was ", new _DelayedJQuote(getBooleanFormat()), (getBooleanFormat().equals(C_TRUE_FALSE) ? ", which is the legacy default computer-language format, and hence isn't accepted." : ".") ).tips( "If you just want \"true\"/\"false\" result as you are generting computer-language output, " + "use \"?c\", like ${myBool?c}.", "You can write myBool?string('yes', 'no') and like to specify boolean formatting in place.", new Object[] { "If you need the same two values on most places, the programmers should set the \"", BOOLEAN_FORMAT_KEY ,"\" setting to something like \"yes,no\"." } ); }
/** * Used for assignments that use operators like {@code +=}, when the target variable was null/missing. */ static InvalidReferenceException getInstance(int scope, String missingAssignedVarName, String assignmentOperator, Environment env) { if (env != null && env.getFastInvalidReferenceExceptions()) { return FAST_INSTANCE; } else { final _ErrorDescriptionBuilder errDescBuilder = new _ErrorDescriptionBuilder( "The target variable of the assignment, ", new _DelayedJQuote(missingAssignedVarName), ", was null or missing in the " + Assignment.scopeAsString(scope) + ", and the \"", assignmentOperator, "\" operator must get its value from there before assigning to it." ); if (missingAssignedVarName.startsWith("$")) { errDescBuilder.tips(TIP_NO_DOLLAR, TIP_MISSING_ASSIGNMENT_TARGET); } else { errDescBuilder.tip(TIP_MISSING_ASSIGNMENT_TARGET); } return new InvalidReferenceException(errDescBuilder, env, null); } }
/** * Used for assignments that use operators like {@code +=}, when the target variable was null/missing. */ static InvalidReferenceException getInstance(int scope, String missingAssignedVarName, String assignmentOperator, Environment env) { if (env != null && env.getFastInvalidReferenceExceptions()) { return FAST_INSTANCE; } else { final _ErrorDescriptionBuilder errDescBuilder = new _ErrorDescriptionBuilder( "The target variable of the assignment, ", new _DelayedJQuote(missingAssignedVarName), ", was null or missing in the " + Assignment.scopeAsString(scope) + ", and the \"", assignmentOperator, "\" operator must get its value from there before assigning to it." ); if (missingAssignedVarName.startsWith("$")) { errDescBuilder.tips(TIP_NO_DOLLAR, TIP_MISSING_ASSIGNMENT_TARGET); } else { errDescBuilder.tip(TIP_MISSING_ASSIGNMENT_TARGET); } return new InvalidReferenceException(errDescBuilder, env, null); } }
public int size() throws TemplateModelException { throw new _TemplateModelException( new _ErrorDescriptionBuilder( "Getting the number of items or listing the items is not supported on this ", new _DelayedFTLTypeDescription(this), " value, because this value wraps the following Java method, " + "not a real listable value: ", new _DelayedToString(getMember())) .tips( "Maybe you should to call this method first and then do something with its return value.", "obj.someMethod(i) and obj.someMethod[i] does the same for this method, hence it's a " + "\"+sequence\".")); }
public int size() throws TemplateModelException { throw new _TemplateModelException( new _ErrorDescriptionBuilder( "Getting the number of items or listing the items is not supported on this ", new _DelayedFTLTypeDescription(this), " value, because this value wraps the following Java method, " + "not a real listable value: ", new _DelayedToString(getMember())) .tips( "Maybe you should to call this method first and then do something with its return value.", "obj.someMethod(i) and obj.someMethod[i] does the same for this method, hence it's a " + "\"+sequence\".")); }