Skip to content

获取文件信息与文档描述不符 #19

Description

@chouney

api:获取文件信息,上面说的是当指定文件不存在时返回null。但是实际上当不存在时会抛出异常:

Caused by: java.io.FileNotFoundException: http://v0.api.upyun.com/xxxxxx/path/to/file
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at main.java.com.UpYun.getText(UpYun.java:906)

因为上传文件会存在覆盖问题,因此需要使用该api来进行文件判定(文档上面是这样写的)。
个人感觉在业务逻辑当中通过异常来进行判断不太优雅,可能使得业务逻辑的异常和真正出现的异常相混淆而出错。建议修复此问题

Activity

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