Skip to content

Spi adaptive extension document instance code has an error #3117

Closed

Description

@ColinWeng

http://dubbo.apache.org/zh-cn/docs/source_code_guide/adaptive-extension.html

// 1.从 URL 中获取 WheelMaker 名称
        String wheelMakerName = url.getParameter("Wheel.maker");
        if (name == null) {
            throw new IllegalArgumentException("wheelMakerName == null");
        }

the name is error.

Activity

  1. CrazyHZM commented on Jan 3, 2019

    @CrazyHZM
    Member

    thanks, I will modify it . apache/dubbo-website#231

  2. code4wt commented on Jan 3, 2019

    @code4wt
    Contributor

    Thanks for feedback.

  3. ColinWeng commented on Jan 3, 2019

    @ColinWeng
    Author

    2.2.3.2 获取 URL 数据

    // urlTypeIndex != -1,表示参数列表中存在 URL 参数
            if (urlTypeIndex != -1) {
                // 为 URL 类型参数生成判空代码,格式如下:
                // if (arg + urlTypeIndex == null) 
                //     throw new IllegalArgumentException("url == null");
                String s = String.format("\nif (arg%d == null) throw new IllegalArgumentException(\"url == null\");",
                                         urlTypeIndex);
                code.append(s);
    
                // 为 URL 类型参数生成赋值代码,形如 URL url = arg1
                s = String.format("\n%s url = arg%d;", URL.class.getName(), urlTypeIndex);
                code.append(s);
                
            // 参数列表中不存在 URL 类型参数
            }

    hi, i think the Comment if (arg[urlTypeIndex] == null) is more reasonable.

  4. code4wt commented on Jan 3, 2019

    @code4wt
    Contributor

    hi, i think the Comment if (arg[urlTypeIndex] == null) is more reasonable.

    I think this modification is not reasonable, it will make readers mistakenly think that arg is an array.

  5. ColinWeng commented on Jan 3, 2019

    @ColinWeng
    Author

    ok,You are right

  6. ralf0131 commented on Jan 5, 2019

    @ralf0131
    Contributor

    Hi, this issue has been fixed. I am closing it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions