/** * Creates an error diagnosis. */ public static Diag error(Location location, String message, Object... args) { return create(location, message, Kind.ERROR, args); }
/** * Creates a warning diagnosis. */ public static Diag warning(Location location, String message, Object... args) { return create(location, message, Kind.WARNING, args); }
/** * Creates an error diagnosis. */ public static Diag error(Location location, String message, Object... args) { return create(location, message, Kind.ERROR, args); }
/** * Creates a warning diagnosis. */ public static Diag warning(Location location, String message, Object... args) { return create(location, message, Kind.WARNING, args); }
private void report( Diag.Kind kind, LocationContext locationContext, String formatString, Object... args) { Location location = locationContext.resolve(locationResolver); Diag diag = Diag.create(location, formatString, kind, args); if (diag.getKind() == Kind.WARNING && diagSuppressor.isDiagSuppressed(diag, location)) { return; } diagCollector.addDiag(diag); }
private void report( Diag.Kind kind, LocationContext locationContext, String formatString, Object... args) { Location location = locationContext.resolve(locationResolver); Diag diag = Diag.create(location, formatString, kind, args); if (diag.getKind() == Kind.WARNING && diagSuppressor.isDiagSuppressed(diag, location)) { return; } diagCollector.addDiag(diag); }
@Override public void addDiag(Diag diag) { int capacity = capacityByKind.containsKey(diag.getKind()) ? capacityByKind.get(diag.getKind()) : 0; int currentCount = listByKind(diag.getKind()).size(); if (currentCount < capacity) { diags.add(diag); } else if (currentCount == capacity) { final String msg = String.format( "Hit max count(%d) of allowed %s. No more diags of this kind will be logged.", capacity, StringUtils.lowerCase(diag.getKind().toString())); diags.add(Diag.create(SimpleLocation.TOPLEVEL, "%s", diag.getKind(), msg)); // Try to short circuit proceeding in a known bad state (to avoid potential timeouts in // trying process REALLY bad configuration). if (diag.getKind() == Kind.ERROR) { throw new TooManyDiagsException(msg); } } }
/** * Accumulates errors and warning encountered during import. */ @Override public void addDiag(Diag diag) { Location loc = SimpleLocation.UNKNOWN; if (diag.getLocation() == SimpleLocation.UNKNOWN || diag.getLocation() == SimpleLocation.TOPLEVEL) { loc = swaggerFileLocation; } else { loc = new SimpleLocation( String.format("%s: %s", swaggerFileName, diag.getLocation().toString())); } diag = Diag.create(loc, diag.getMessage(), diag.getKind()); diags.add(diag); if (diag.getKind() == Diag.Kind.ERROR) { errorCount++; } }
/** * Accumulates errors and warning encountered during import. */ @Override public void addDiag(Diag diag) { Location loc = SimpleLocation.UNKNOWN; if (diag.getLocation() == SimpleLocation.UNKNOWN || diag.getLocation() == SimpleLocation.TOPLEVEL) { loc = swaggerFileLocation; } else { loc = new SimpleLocation( String.format("%s: %s", swaggerFileName, diag.getLocation().toString())); } diag = Diag.create(loc, diag.getMessage(), diag.getKind()); diags.add(diag); if (diag.getKind() == Diag.Kind.ERROR) { errorCount++; } }
@Override public void addDiag(Diag diag) { int capacity = capacityByKind.containsKey(diag.getKind()) ? capacityByKind.get(diag.getKind()) : 0; int currentCount = listByKind(diag.getKind()).size(); if (currentCount < capacity) { diags.add(diag); } else if (currentCount == capacity) { final String msg = String.format( "Hit max count(%d) of allowed %s. No more diags of this kind will be logged.", capacity, StringUtils.lowerCase(diag.getKind().toString())); diags.add(Diag.create(SimpleLocation.TOPLEVEL, "%s", diag.getKind(), msg)); // Try to short circuit proceeding in a known bad state (to avoid potential timeouts in // trying process REALLY bad configuration). if (diag.getKind() == Kind.ERROR) { throw new TooManyDiagsException(msg); } } }
diagToPrint = Diag.create(diag.getLocation(), "%s", diag.getKind(), message);