Skip to content

Commit 3cc433e

Browse files
author
Caitlin Bales (MSFT)
committed
Replace invalid characters in the javadoc
HTML characters get re-encoded into <,>,&, etc at this point, so we need to turn them back into HTML characters so that Javadoc accepts them as valid
1 parent 7bc879f commit 3cc433e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Templates/Java/BaseJavaModel.template.tt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ public {1} {2}{3}{4} {{";
669669
property.Name,
670670
propertyType,
671671
property.Name.SanitizePropertyName(property).ToLowerFirstChar(),
672-
property.LongDescription);
672+
ReplaceInvalidCharacters(property.LongDescription));
673673
}
674674
return sb.ToString();
675675
}
@@ -693,7 +693,7 @@ public {1} {2}{3}{4} {{";
693693
sb.AppendFormat(
694694
format,
695695
ParamName(p).SplitCamelCase(),
696-
p.LongDescription,
696+
ReplaceInvalidCharacters(p.LongDescription),
697697
ParamName(p),
698698
ParamType(p),
699699
ParamName(p).SanitizePropertyName(p).ToLowerFirstChar()
@@ -834,4 +834,15 @@ public {1} {2}{3}{4} {{";
834834
//Specifying a return type of "void" throws an error
835835
return string.Empty;
836836
}
837+
838+
/**
839+
* Replaces invalid Javadoc characters with HTML
840+
*/
841+
public string ReplaceInvalidCharacters(string inputString)
842+
{
843+
if (inputString != null) {
844+
return inputString.Replace("<", "&lt;").Replace(">", "&gt;").Replace("&", "&amp;");
845+
}
846+
return null;
847+
}
837848
#>

0 commit comments

Comments
 (0)