com.sun.tools.doclets.internal.toolkit.util.DocletAbortException Java Examples

The following examples show how to use com.sun.tools.doclets.internal.toolkit.util.DocletAbortException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SarlDoclet.java    From sarl with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("checkstyle:all")
@Override
public boolean start(AbstractDoclet doclet, RootDoc root) {
	configuration().root = configuration().getProxyInstaller().installProxies(root);
	if (!isValidDoclet(doclet)) {
		return false;
	}
	try {
		Reflect.callProc(this, AbstractDoclet.class, "startGeneration", //$NON-NLS-1$
				new Class[] { RootDoc.class },
				configuration().root);
	} catch (DocletAbortException e) {
		final Throwable cause = Utils.getCause(e);
		if (cause.getLocalizedMessage() != null) {
			configuration().root.printError(cause.getLocalizedMessage());
		} else {
			configuration().root.printError(cause.toString());
		}
		return false;
	} catch (Throwable exc) {
		Utils.getCause(exc).printStackTrace();
		return false;
	}
	return true;
}
 
Example #2
Source File: Utils.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Copy the given file.
 *
 * @param filename the file to copy.
 * @param configuration the configuration.
 * @throws DocletAbortException a runtime exception.
 */
public static void performCopy(String filename, SarlConfiguration configuration) {
	if (filename.isEmpty()) {
		return;
	}

	try {
		final DocFile fromfile = DocFile.createFileForInput(configuration, filename);
		final DocPath path = DocPath.create(fromfile.getName());
		final DocFile toFile = DocFile.createFileForOutput(configuration, path);
		if (toFile.isSameFile(fromfile)) {
			return;
		}
		configuration.message.notice((SourcePosition) null,
				"doclet.Copying_File_0_To_File_1", //$NON-NLS-1$
				fromfile.toString(), path.getPath());
		toFile.copyFile(fromfile);
	} catch (IOException exc) {
		configuration.message.error((SourcePosition) null,
				"doclet.perform_copy_exception_encountered", //$NON-NLS-1$
				exc.toString());
		throw new DocletAbortException(exc);
	}
}