Intellij Idea Java异常抛出IllegalArgumentException

ztyzrc3y  于 2023-10-15  发布在  Java
关注(0)|答案(3)|浏览(112)

我正在使用Intellij Idea,当我去生成JavaDoc(通过Tools -> Generate JavaDoc)时,我会抛出一个IllegealArgumentException,没有任何关于出错的信息。
当测试模块中的每个单独文件时,即使没有JavaDoc注解,也会发生这种情况。
下面是我得到的一个堆栈跟踪的例子:

java.lang.IllegalArgumentException
at sun.net.www.ParseUtil.decode(ParseUtil.java:202)
at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:1204)
at sun.misc.URLClassPath$3.run(URLClassPath.java:525)
at sun.misc.URLClassPath$3.run(URLClassPath.java:520)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:519)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:492)
at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:457)
at sun.misc.URLClassPath.access$100(URLClassPath.java:64)
at sun.misc.URLClassPath$1.next(URLClassPath.java:239)
at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:250)
at java.net.URLClassLoader$3$1.run(URLClassLoader.java:601)
at java.net.URLClassLoader$3$1.run(URLClassLoader.java:599)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader$3.next(URLClassLoader.java:598)
at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:623)
at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:45)
at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:54)
at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:354)
at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:293)
at java.security.AccessController.doPrivileged(Native Method)
at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:289)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267)
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:127)
at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:89)
at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:120)
at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:189)
at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:205)
at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:189)
at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:137)
at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:82)
at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:80)
at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:310)
at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:189)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:366)
at com.sun.tools.javadoc.Start.begin(Start.java:219)
at com.sun.tools.javadoc.Start.begin(Start.java:205)
at com.sun.tools.javadoc.Main.execute(Main.java:64)
at com.sun.tools.javadoc.Main.main(Main.java:54)
javadoc: error - java.lang.IllegalArgumentException

据我所知,它并没有告诉我很多关于实际错误的信息。下面是一个示例文件,我尝试为它生成JavaBean:

package Network;

public class NetworkTags {

    public static final String OPEN_TAG = "<";
    public static final String CLOSE_TAG = "/>";

    public static final String NET_OPEN_TAG = "<NET>";
    public static final String NET_CLOSE_TAG = "</NET>";

    public static final String VERTEX_TAG = "VERTEX";
    public static final String EDGE_TAG = "EDGE";

    public static final String REL_TAG = "REL";
    public static final String TYPE_TAG = "TYPE";
    public static final String COST_TAG = "COST";
    public static final String NAME_TAG = "NAME";

    public static final String SOURCE_TAG = "SOURCE";
    public static final String TARGET_TAG = "TARGET";

    public static final String FROM_TAG = "FROM";
    public static final String TO_TAG = "TO";
}

使用Java 8和IntelliJ IDEA 2016.1.1

js4nwp54

js4nwp541#

我也有同样的问题。你应该删除CLASSPATH环境变量。

xytpbqjk

xytpbqjk2#

如果您的类路径包含% init,则会出现此问题。

d8tt03nd

d8tt03nd3#

对于在maven构建过程中遇到此问题的人,请对maven插件org.apache.maven.plugins:maven-javadoc-plugin进行注解以避免错误
评论下面的插件在pom.xml

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

相关问题