Javadoc OrmLite在刷新时未引发异常,但没有结果

Javadoc OrmLite在刷新时未引发异常,但没有结果,javadoc,dao,ormlite,sqlexception,Javadoc,Dao,Ormlite,Sqlexception,方法中Dao refresh()的Javadoc状态为: 抛出: SQLException-在任何SQL问题上,或者如果在表中找不到数据项,或者如果找到多个具有数据id的项 但是,类com.j256.ormlite.stmt.mapped.MappedRefresh有另一个Javadoc定义,并返回一个结果代码,一直返回到refresh和用户 /** * Execute our refresh query statement and then update all of the fields

方法中Dao refresh()的Javadoc状态为:

抛出: SQLException-在任何SQL问题上,或者如果在表中找不到数据项,或者如果找到多个具有数据id的项

但是,类com.j256.ormlite.stmt.mapped.MappedRefresh有另一个Javadoc定义,并返回一个结果代码,一直返回到refresh和用户

/**
 * Execute our refresh query statement and then update all of the fields in data with the fields from the result.
 * 
 * @return 1 if we found the object in the table by id or 0 if not.
 */
public int executeRefresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache)
        throws SQLException {
    @SuppressWarnings("unchecked")
    ID id = (ID) idField.extractJavaFieldValue(data);
    // we don't care about the cache here
    T result = super.execute(databaseConnection, id, null);
    if (result == null) {
        return 0;
    }
    // copy each field from the result into the passed in object
    for (FieldType fieldType : resultsFieldTypes) {
        if (fieldType != idField) {
            fieldType.assignField(data, fieldType.extractJavaFieldValue(result), false, objectCache);
        }
    }
    return 1;
}
对于Dao.refresh,这是一个bug还是一个Javadoc错误


我在看OrmLite 4.41。

内部方法通常有不太完美的Javadocs,因为它只针对开发人员。此外,我倾向于不记录抛出的每个异常

在本例中,
MappedRefresh.executeRefresh(…)
方法文档看起来不错,只是它没有记录异常。如果查看调用
MappedQueryForId.execute(…)
super.execute(…)
行,可以看到它具有以下测试/抛出:

} else if (result == DatabaseConnection.MORE_THAN_ONE) {
    logger.error("{} using '{}' and {} args, got >1 results", label, statement,
        args.length);
    logArgs(args);
    throw new SQLException(label + " got more than 1 result: " + statement);
}
fieldType.assignField(…)
和其他方法也可以对各种数据或数据库问题抛出
SQLException


因此,
Dao.refresh(…)
javadocs是正确的。
MappedRefresh.executeRefresh(…)
javadocs也正确,但缺少有关异常的详细信息。

我的回答对您有帮助吗?如果是,请接受: