void (@NotNull YAMLScalar scalarValue, @NotNull ProblemsHolder holder) { try { if (!myQuotedValuesAllowed && scalarValue instanceof YAMLQuotedText) { throw new NumberFormatException("no quoted values allowed"); } final String textValue = scalarValue.getTextValue(); // Float.parseFloat() successfully parses values like " 1.0 ", i.e. starting or ending with spaces, // which is not valid for typed schema if (textValue.startsWith(" ") || textValue.endsWith(" ")) { throw new NumberFormatException("contains spaces"); } Float.parseFloat(textValue); } catch (NumberFormatException e) { holder.registerProblem(scalarValue, YAMLBundle.message("YamlNumberType.error.numeric.value"), ProblemHighlightType.ERROR); } }