private static boolean validOption(final String optionName, final String reportOptionName, final String[][] options, final DocErrorReporter reporter) { final String option = getOptionArg(options, optionName); final boolean foundOption = option != null && !option.trim().isEmpty(); if (!foundOption) { reporter.printError(optionName + " " + reportOptionName + " must be specified."); } return foundOption; }
public static boolean validOptions(String[][] options, DocErrorReporter reporter) { boolean sawOutput = false; for (int i = 0; i < options.length; i++) { String[] option = options[i]; if (option[0].equals("-output")) { File output = new File(option[1]); if (output.exists() && output.isDirectory()) { reporter.printError("Output file " + output + " is a directory"); return false; } else { sawOutput = true; } } } if (!sawOutput) { reporter.printError("Missing -output"); return false; } return true; }
public static boolean validOptions(String[][] options, DocErrorReporter reporter) { boolean foundTagOption = false; for (int i = 0; i < options.length; i++) { String[] opt = options[i]; if ("-dumpJavaDocFile".equals(opt[0])) { if (foundTagOption) { reporter.printError("Only one -dumpJavaDocFile option allowed."); return false; } foundTagOption = true; } } if (!foundTagOption) { reporter.printError("Usage: -dumpJavaDocFile theFileToDumpJavaDocForLatarUse..."); } return foundTagOption; } }
public static boolean validOptions(String options[][], DocErrorReporter reporter) { boolean foundFileNameOption = false; for (String[] opt : options) { if (opt[0].equals("-filename")) { if (foundFileNameOption) { reporter.printError("Only one -tag option allowed."); return false; } else { foundFileNameOption = true; } } } if (!foundFileNameOption) { reporter.printError("Usage: javadoc -filename file -artifactId bla -groupId de -version blabla-0.1 -classdir dir..."); } return foundFileNameOption; }
public static boolean validOptions(String[][] options, DocErrorReporter reporter) { boolean foundTagOption = false; for (int i = 0; i < options.length; i++) { String[] opt = options[i]; if ("-dumpJavaDocFile".equals(opt[0])) { if (foundTagOption) { reporter.printError("Only one -dumpJavaDocFile option allowed."); return false; } foundTagOption = true; } } if (!foundTagOption) { reporter.printError("Usage: -dumpJavaDocFile theFileToDumpJavaDocForLatarUse..."); } return foundTagOption; } }
public void fatalError(SAXParseException e) throws SAXException { ERROR_REPORTER.printError(e.getMessage()); ERROR_REPORTER.printError("Line: " + e.getLineNumber() + ", Column: " + e.getColumnNumber()); throw e; } });
public static boolean validOptions(String options[][], DocErrorReporter reporter) { boolean hasOut = false; for (String[] option : options) { String opt = option[0]; if (opt.equals("-out")) { hasOut = true; } } if (!hasOut) { reporter.printError("No output file specified: -out <output file>"); return false; } else { return true; } } }
public static boolean validOptions(String options[][], DocErrorReporter reporter) { boolean hasOut = false; for (String[] option : options) { String opt = option[0]; if (opt.equals("-out")) { hasOut = true; } } if (!hasOut) { reporter.printError("No output file specified: -out <output file>"); return false; } else { return true; } } }
public static boolean validOptions(String options[][], DocErrorReporter reporter) { boolean hasOut = false; for (String[] option : options) { String opt = option[0]; if (opt.equals("-out")) { hasOut = true; } } if (!hasOut) { reporter.printError("No output file specified: -out <output file>"); return false; } else { return true; } } }
private static boolean validOption( String optionName, String reportOptionName, String[][] options, DocErrorReporter reporter ) { final String option = getOptionArg( options, optionName ); final boolean foundOption = option != null && option.trim().length() > 0; if ( !foundOption ) { reporter.printError( optionName + " "+ reportOptionName +" must be specified." ); } return foundOption; }
@Override public void frameSetEnd( PrintWriter w ) { w.println( "</frameset>" ); frameNest--; if( frameNest < 0 ) { configuration.reporter.printError( "closed too many framesets" ); throw new DocletAbortException(); } }
private static boolean validOption(String optionName, String reportOptionName, String[][] options, DocErrorReporter reporter) { final String option = getOptionArg(options, optionName); final boolean foundOption = (option != null && option.trim().length() > 0); if (!foundOption) { reporter.printError(optionName + " " + reportOptionName + " must be specified."); } return foundOption; }
/** * Verifies that the named block tag exists exactly <b>once</b>, and returns it. */ public static Tag requiredTag(Doc doc, String tagName, DocErrorReporter docErrorReporter) { Tag[] tags = doc.tags(tagName); if (tags.length == 0) { docErrorReporter.printError(doc.position(), "'" + tagName + "' is missing"); } if (tags.length > 1) { docErrorReporter.printError(doc.position(), "'" + tagName + "' must appear only once"); } return tags[0]; } }
/** * Verifies that the named block tag exists exactly <b>once</b>, and returns it. */ public static Tag requiredTag(Doc doc, String tagName, DocErrorReporter docErrorReporter) { Tag[] tags = doc.tags(tagName); if (tags.length == 0) { docErrorReporter.printError(doc.position(), "'" + tagName + "' is missing"); } if (tags.length > 1) { docErrorReporter.printError(doc.position(), "'" + tagName + "' must appear only once"); } return tags[0]; } }
public boolean copy() { if (!docletOptions.destDir().isPresent()) { // standard doclet must have checked this by the time we are called errorReporter.printError("Destination directory not specified, cannot copy stylesheet"); return false; } String stylesheet = selectStylesheet(System.getProperty("java.version")); File destDir = docletOptions.destDir().get(); try { Resources.copy(Resources.getResource(stylesheet), new FileOutputStream(new File(destDir, OUTPUT_STYLESHEET))); Resources.copy(Resources.getResource(CODERAY_STYLESHEET), new FileOutputStream(new File(destDir, CODERAY_STYLESHEET))); return true; } catch (IOException e) { errorReporter.printError(e.getLocalizedMessage()); return false; } }
public final void copyResource( String name ) { final File destDir = new File( configuration.destDirName ); final File destFile = new File( destDir, name ); try { destDir.mkdirs(); FileUtils.copyFile( getResource( name ), destFile ); } catch( IOException ioe ) { configuration.reporter.printError( "Failed to write " + destFile.getAbsolutePath() + ": " + ioe.toString() ); throw new DocletAbortException(); } }
/** * @return The class described by the given {@link Type} * @throws Longjump A class described by the given {@link Type} could not be loaded */ public static Class<?> loadType(SourcePosition position, Type t, DocErrorReporter errorReporter) throws Longjump { String cn = t.qualifiedTypeName(); for (;;) { try { return Types.class.getClassLoader().loadClass(cn); } catch (Exception e) { int idx = cn.lastIndexOf('.'); if (idx == -1) { errorReporter.printError(position, t.qualifiedTypeName() + "': " + e.getMessage()); // SUPPRESS CHECKSTYLE AvoidHidingCause throw new Longjump(); } cn = cn.substring(0, idx) + '$' + cn.substring(idx + 1); } } }
/** * @return The class described by the given {@link Type} * @throws Longjump A class described by the given {@link Type} could not be loaded */ public static Class<?> loadType(SourcePosition position, Type t, DocErrorReporter errorReporter) throws Longjump { String cn = t.qualifiedTypeName(); for (;;) { try { return Types.class.getClassLoader().loadClass(cn); } catch (Exception e) { int idx = cn.lastIndexOf('.'); if (idx == -1) { errorReporter.printError(position, t.qualifiedTypeName() + "': " + e.getMessage()); // SUPPRESS CHECKSTYLE AvoidHidingCause throw new Longjump(); } cn = cn.substring(0, idx) + '$' + cn.substring(idx + 1); } } }
/** * Verifies that the named block tag exists at most <b>once</b>, and returns it. * * @return {@code null} iff the tag does not exist */ @Nullable public static Tag optionalTag(Doc doc, String tagName, DocErrorReporter docErrorReporter) { Tag[] tags = doc.tags(tagName); if (tags.length == 0) return null; if (tags.length > 1) { docErrorReporter.printError(doc.position(), "'" + tagName + "' must appear at most once"); } return tags[0]; }
/** * Verifies that the named block tag exists at most <b>once</b>, and returns it. * * @return {@code null} iff the tag does not exist */ @Nullable public static Tag optionalTag(Doc doc, String tagName, DocErrorReporter docErrorReporter) { Tag[] tags = doc.tags(tagName); if (tags.length == 0) return null; if (tags.length > 1) { docErrorReporter.printError(doc.position(), "'" + tagName + "' must appear at most once"); } return tags[0]; }