/** * Collects error messages. * * @param location the location of the original comment source * @param lineNum the line number where the error is detected * @param message the message describes the error */ private void collectError(LocationContext location, int lineNum, String message) { diagReporter.reportError(location, "(at document line %d) " + message, lineNum); }
/** * Collects error messages. * * @param location the location of the original comment source * @param lineNum the line number where the error is detected * @param message the message describes the error */ private void collectError(LocationContext location, int lineNum, String message) { diagReporter.reportError(location, "(at document line %d) " + message, lineNum); }
/** Helper to report an error. */ public void error(LocationContext locationContext, String message, Object... params) { String prefix = String.format(DIAG_PREFIX, validatorName); diagReporter.reportError(locationContext, prefix + message, params); }
/** Helper to report an error. */ public void error(LocationContext locationContext, String message, Object... params) { String prefix = String.format(DIAG_PREFIX, validatorName); diagReporter.reportError(locationContext, prefix + message, params); }
public void error(LocationContext locationContext, String message, Object... params) { String prefix = String.format(ASPECT_DIAG_PREFIX, aspectName); getDiagReporter().reportError(locationContext, prefix + message, params); }
public void error(LocationContext locationContext, String message, Object... params) { String prefix = String.format(ASPECT_DIAG_PREFIX, aspectName); getDiagReporter().reportError(locationContext, prefix + message, params); }
/** Validate selector syntax and report errors (with given error message prefix). */ public void reportBadSelectors(String category, String messagePrefix) { for (RuleWrapper<RuleType> ruleWrapper : rules) { for (String selector : ruleWrapper.selectors) { if (!SELECTOR_PATTERN.matcher(selector).matches()) { String message = messagePrefix + "%s rule has bad syntax in selector '%s'. See " + "documentation for information on selector syntax."; diagReporter.reportError( MessageLocationContext.create(ruleWrapper.rule, SELECTOR_FIELD_NAME), message, category, selector); } } } }
/** Validate selector syntax and report errors (with given error message prefix). */ public void reportBadSelectors(String category, String messagePrefix) { for (RuleWrapper<RuleType> ruleWrapper : rules) { for (String selector : ruleWrapper.selectors) { if (!SELECTOR_PATTERN.matcher(selector).matches()) { String message = messagePrefix + "%s rule has bad syntax in selector '%s'. See " + "documentation for information on selector syntax."; diagReporter.reportError( MessageLocationContext.create(ruleWrapper.rule, SELECTOR_FIELD_NAME), message, category, selector); } } } }
private String readFileContent() { try { return Files.asCharSource(new File(resolvedFilePath), StandardCharsets.UTF_8).read(); } catch (IOException e) { diagReporter.reportError( ResolvedLocation.create(SimpleLocation.TOPLEVEL), "Failed to read file: '%s'.", resolvedFilePath); return null; } }
private String readFileContent() { try { return Files.asCharSource(new File(resolvedFilePath), StandardCharsets.UTF_8).read(); } catch (IOException e) { diagReporter.reportError( ResolvedLocation.create(SimpleLocation.TOPLEVEL), "Failed to read file: '%s'.", resolvedFilePath); return null; } }
this.diagReporter = diagReporter; if (!Files.getFileExtension(relativeFilePath).equals(SUPPORTED_FILE_EXTENSION)) { diagReporter.reportError( sourceLocation, "Not supported file extension: '%s'.", relativeFilePath); this.resolvedFilePath = null; this.resolvedFilePath = resolveFilePath(docPath, relativeFilePath); if (resolvedFilePath == null) { diagReporter.reportError( sourceLocation, "File not found, relative path '%s', inside root '%s'.",
this.diagReporter = diagReporter; if (!Files.getFileExtension(relativeFilePath).equals(SUPPORTED_FILE_EXTENSION)) { diagReporter.reportError( sourceLocation, "Not supported file extension: '%s'.", relativeFilePath); this.resolvedFilePath = null; this.resolvedFilePath = resolveFilePath(docPath, relativeFilePath); if (resolvedFilePath == null) { diagReporter.reportError( sourceLocation, "File not found, relative path '%s', inside root '%s'.",
private static void validateEndpoint(Model model, final String endpoint) { if (getEndpointConfig(model, endpoint) == null) { model .getDiagReporter() .reportError( ResolvedLocation.create(SimpleLocation.TOPLEVEL), "endpoint: Primary endpoint name '%s' does not exist in the config.", endpoint); } }
Feature feature = featuresByName.get(featureName); if (feature == null) { diagReporter.reportError( location, "No such feature %s supported for this element. "
Feature feature = featuresByName.get(featureName); if (feature == null) { diagReporter.reportError( location, "No such feature %s supported for this element. "
private static void validateEndpoint(Model model, final String endpoint) { if (getEndpointConfig(model, endpoint) == null) { model .getDiagReporter() .reportError( ResolvedLocation.create(SimpleLocation.TOPLEVEL), "endpoint: Primary endpoint name '%s' does not exist in the config.", endpoint); } }
LocationContext location) { if (!remove && !isSupportedIn(configVersion)) { diagReporter.reportError( location, "Feature %s not available in config version %s.", this, configVersion);
LocationContext location) { if (!remove && !isSupportedIn(configVersion)) { diagReporter.reportError( location, "Feature %s not available in config version %s.", this, configVersion);
/** * Visits {@link FileInclusion} element to recursively resolve the file reference and append the * external content to the normalized result. */ @VisitsBefore boolean normalize(FileInclusion inclusion) { String filePath = inclusion.getRelativeFilePath(); // Stop visiting if cyclic file inclusion is detected. if (fileInclusionPath.contains(filePath)) { String path = ARROW_JOINER.join(fileInclusionPath); diagResolver.reportError( ResolvedLocation.create(SimpleLocation.TOPLEVEL), "Cyclic file inclusion detected for '%s' via %s", filePath, path); return false; } String content = inclusion.getContent(); if (Strings.isNullOrEmpty(content)) { return false; } // Save state before normalizing included content. fileInclusionPath.add(filePath); baseSectionLevels.addLast(baseSectionLevels.peekLast() + inclusion.getSectionLevel()); normalize( content, ResolvedLocation.create(new SimpleLocation(inclusion.getFileName())), element); builder.append('\n'); return true; }
/** * Visits {@link FileInclusion} element to recursively resolve the file reference and append the * external content to the normalized result. */ @VisitsBefore boolean normalize(FileInclusion inclusion) { String filePath = inclusion.getRelativeFilePath(); // Stop visiting if cyclic file inclusion is detected. if (fileInclusionPath.contains(filePath)) { String path = ARROW_JOINER.join(fileInclusionPath); diagResolver.reportError( ResolvedLocation.create(SimpleLocation.TOPLEVEL), "Cyclic file inclusion detected for '%s' via %s", filePath, path); return false; } String content = inclusion.getContent(); if (Strings.isNullOrEmpty(content)) { return false; } // Save state before normalizing included content. fileInclusionPath.add(filePath); baseSectionLevels.addLast(baseSectionLevels.peekLast() + inclusion.getSectionLevel()); normalize( content, ResolvedLocation.create(new SimpleLocation(inclusion.getFileName())), element); builder.append('\n'); return true; }