Skip to content

doesBucketExist 接口对于不存在的bucket返回true #41

@LioRoger

Description

@LioRoger

code示例

    String ENDPOINT = "https://su.bcebos.com";                               // 用户自己指定地域的官方域名

    BosClientConfiguration config = new BosClientConfiguration();
    config.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID,SECRET_ACCESS_KEY));
    config.setEndpoint(ENDPOINT);
    BosClient client = new BosClient(config);
    System.out.println("mytest exist: " + client.doesBucketExist("mytest"));
    System.out.println("ssssss exist:" + client.doesBucketExist("ssssss"));

其中 ssssss 是不存在的,报错如下

2025-05-23 11:37:21 [DEBUG] CanonicalRequest:HEAD[\n]/v1[\n][\n]content-type:application%2Fjson%3B%20charset%3Dutf-8[\n]host:ssssss.su.bcebos.com[\n]x-bce-request-id:ef0b8dce-2630-487f-a291-e40a20b812c1 Authorization:bce-auth-v1/ALTAKRiG7epp1RQ92TEXKqrGjX/2025-05-23T03:37:21Z/1800//4f25ba40b542a1a06c3e4620f4c3de4d9bb66c5f14ed3df8a74d59c57a4b5fbc 2025-05-23 11:37:21 [DEBUG] Sending Request: InternalRequest [httpMethod=HEAD, uri=https://ssssss.su.bcebos.com/v1, expectContinueEnabled=false, parameters={}, headers={Authorization=bce-auth-v1/ALTAKRiG7epp1RQ92TEXKqrGjX/2025-05-23T03:37:21Z/1800//4f25ba40b542a1a06c3e4620f4c3de4d9bb66c5f14ed3df8a74d59c57a4b5fbc, x-bce-request-id=ef0b8dce-2630-487f-a291-e40a20b812c1, User-Agent=bce-sdk-java/0.10.373/Mac_OS_X/10.16/Java_HotSpot(TM)_64-Bit_Server_VM/25.291-b10/1.8.0_291/en-US/, Host=ssssss.su.bcebos.com, Date=Fri, 23 May 2025 03:37:21 GMT, Content-Type=application/json; charset=utf-8}] 2025-05-23 11:37:21 [DEBUG] CookieSpec selected: default 2025-05-23 11:37:21 [DEBUG] Auth cache not set in the context 2025-05-23 11:37:21 [DEBUG] Connection request: [route: {s}->https://ssssss.su.bcebos.com:443][total available: 1; route allocated: 0 of 50; total allocated: 1 of 50] 2025-05-23 11:37:21 [DEBUG] Connection leased: [id: 1][route: {s}->https://ssssss.su.bcebos.com:443][total available: 1; route allocated: 1 of 50; total allocated: 2 of 50] 2025-05-23 11:37:21 [DEBUG] Opening connection {s}->https://ssssss.su.bcebos.com:443 2025-05-23 11:37:21 [DEBUG] Connecting to ssssss.su.bcebos.com/153.3.238.72:443 2025-05-23 11:37:21 [DEBUG] Connecting socket to ssssss.su.bcebos.com/153.3.238.72:443 with timeout 50000 2025-05-23 11:37:21 [DEBUG] Enabled protocols: [TLSv1.2] 2025-05-23 11:37:21 [DEBUG] Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV] 2025-05-23 11:37:21 [DEBUG] Starting handshake 2025-05-23 11:37:21 [DEBUG] Secure session established 2025-05-23 11:37:21 [DEBUG] negotiated protocol: TLSv1.2 2025-05-23 11:37:21 [DEBUG] negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 2025-05-23 11:37:21 [DEBUG] peer principal: CN=*.su.bcebos.com, O="BeiJing Baidu Netcom Science Technology Co., Ltd", ST=北京市, C=CN 2025-05-23 11:37:21 [DEBUG] peer alternative names: [*.su.bcebos.com] 2025-05-23 11:37:21 [DEBUG] issuer principal: CN=DigiCert Secure Site Pro G2 TLS CN RSA4096 SHA256 2022 CA1, O="DigiCert, Inc.", C=US 2025-05-23 11:37:21 [DEBUG] Connection established 30.249.241.45:58165<->153.3.238.72:443 2025-05-23 11:37:21 [DEBUG] http-outgoing-1: set socket timeout to 50000 2025-05-23 11:37:21 [DEBUG] Executing request HEAD /v1 HTTP/1.1 2025-05-23 11:37:21 [DEBUG] Proxy auth state: UNCHALLENGED 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> HEAD /v1 HTTP/1.1 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> Host: ssssss.su.bcebos.com 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> Authorization: bce-auth-v1/ALTAKRiG7epp1RQ92TEXKqrGjX/2025-05-23T03:37:21Z/1800//4f25ba40b542a1a06c3e4620f4c3de4d9bb66c5f14ed3df8a74d59c57a4b5fbc 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> x-bce-request-id: ef0b8dce-2630-487f-a291-e40a20b812c1 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> User-Agent: bce-sdk-java/0.10.373/Mac_OS_X/10.16/Java_HotSpot(TM)_64-Bit_Server_VM/25.291-b10/1.8.0_291/en-US/ 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> Date: Fri, 23 May 2025 03:37:21 GMT 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> Content-Type: application/json; charset=utf-8 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> Connection: Keep-Alive 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> Accept-Encoding: gzip,deflate 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "HEAD /v1 HTTP/1.1[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "Host: ssssss.su.bcebos.com[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "Authorization: bce-auth-v1/ALTAKRiG7epp1RQ92TEXKqrGjX/2025-05-23T03:37:21Z/1800//4f25ba40b542a1a06c3e4620f4c3de4d9bb66c5f14ed3df8a74d59c57a4b5fbc[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "x-bce-request-id: ef0b8dce-2630-487f-a291-e40a20b812c1[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "User-Agent: bce-sdk-java/0.10.373/Mac_OS_X/10.16/Java_HotSpot(TM)_64-Bit_Server_VM/25.291-b10/1.8.0_291/en-US/[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "Date: Fri, 23 May 2025 03:37:21 GMT[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "Content-Type: application/json; charset=utf-8[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 >> "[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "HTTP/1.1 403 Forbidden[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "Date: Fri, 23 May 2025 03:37:21 GMT[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "Content-Length: 0[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "Connection: keep-alive[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "Server: BceBos[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "X-Bce-Versioning: unknown[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "x-bce-debug-id: FFh7572V+sO+UFhz0sFq8UZJ8O7J+L0W6YM0xDlLwFhJIFZYu3m27dYl3J12YYADsBoLoan6uIKqCgaDCz41/g==[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "x-bce-flow-control-type: -1[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "x-bce-is-transition: false[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "x-bce-request-id: ef0b8dce-2630-487f-a291-e40a20b812c1[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << "[\r][\n]" 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << HTTP/1.1 403 Forbidden 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << Date: Fri, 23 May 2025 03:37:21 GMT 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << Content-Length: 0 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << Connection: keep-alive 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << Server: BceBos 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << X-Bce-Versioning: unknown 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << x-bce-debug-id: FFh7572V+sO+UFhz0sFq8UZJ8O7J+L0W6YM0xDlLwFhJIFZYu3m27dYl3J12YYADsBoLoan6uIKqCgaDCz41/g== 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << x-bce-flow-control-type: -1 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << x-bce-is-transition: false 2025-05-23 11:37:21 [DEBUG] http-outgoing-1 << x-bce-request-id: ef0b8dce-2630-487f-a291-e40a20b812c1 2025-05-23 11:37:21 [DEBUG] Connection can be kept alive indefinitely 2025-05-23 11:37:21 [DEBUG] Connection [id: 1][route: {s}->https://ssssss.su.bcebos.com:443] can be kept alive indefinitely 2025-05-23 11:37:21 [DEBUG] http-outgoing-1: set socket timeout to 0 2025-05-23 11:37:21 [DEBUG] Connection released: [id: 1][route: {s}->https://ssssss.su.bcebos.com:443][total available: 2; route allocated: 1 of 50; total allocated: 2 of 50] 2025-05-23 11:37:21 [INFO] Unable to execute HTTP request com.baidubce.BceServiceException: Forbidden (Status Code: 403; Error Code: null; Request ID: ef0b8dce-2630-487f-a291-e40a20b812c1) at com.baidubce.http.handler.BceErrorResponseHandler.handle(BceErrorResponseHandler.java:59) ~[bce-java-sdk-0.10.376.jar:?] at com.baidubce.http.BceHttpClient.execute(BceHttpClient.java:256) [bce-java-sdk-0.10.376.jar:?] at com.baidubce.AbstractBceClient.invokeHttpClient(AbstractBceClient.java:195) [bce-java-sdk-0.10.376.jar:?] at com.baidubce.services.bos.BosClient.doesBucketExist(BosClient.java:293) [bce-java-sdk-0.10.376.jar:?] at com.baidubce.services.bos.BosClient.doesBucketExist(BosClient.java:272) [bce-java-sdk-0.10.376.jar:?] at com.oceanbase.odc.service.objectstorage.BOSCloudClientTest.testBucketExits(BOSCloudClientTest.java:113) [test-classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_291] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_291] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_291] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) [junit-4.13.1.jar:4.13.1] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.13.1.jar:4.13.1] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) [junit-4.13.1.jar:4.13.1] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.13.1.jar:4.13.1] at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.1.jar:4.13.1] at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) [junit-4.13.1.jar:4.13.1] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) [junit-4.13.1.jar:4.13.1] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.1.jar:4.13.1] at org.junit.runners.ParentRunner.run(ParentRunner.java:413) [junit-4.13.1.jar:4.13.1] at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.13.1.jar:4.13.1] at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:?] at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38) [junit-rt.jar:?] at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11) [idea_rt.jar:?] at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35) [junit-rt.jar:?] at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:231) [junit-rt.jar:?] at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55) [junit-rt.jar:?]

ssssss exist:true

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