{"id":"38fd2decde9142ea","repo":"spring-projects/spring-boot","slug":"error-reading-certificate-ex-getmessage","errorCode":null,"errorMessage":"Error reading certificate: ${ex.getMessage()}","messagePattern":"Error reading certificate: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemCertificateParser.java","lineNumber":94,"sourceCode":"\t\tcatch (CertificateException ex) {\n\t\t\tthrow new IllegalStateException(\"Unable to get X.509 certificate factory\", ex);\n\t\t}\n\t}\n\n\tprivate static void readCertificates(String text, CertificateFactory factory, Consumer<X509Certificate> consumer) {\n\t\ttry {\n\t\t\tMatcher matcher = PATTERN.matcher(text);\n\t\t\twhile (matcher.find()) {\n\t\t\t\tString encodedText = matcher.group(1);\n\t\t\t\tbyte[] decodedBytes = decodeBase64(encodedText);\n\t\t\t\tByteArrayInputStream inputStream = new ByteArrayInputStream(decodedBytes);\n\t\t\t\twhile (inputStream.available() > 0) {\n\t\t\t\t\tconsumer.accept((X509Certificate) factory.generateCertificate(inputStream));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch (CertificateException ex) {\n\t\t\tthrow new IllegalStateException(\"Error reading certificate: \" + ex.getMessage(), ex);\n\t\t}\n\t}\n\n\tprivate static byte[] decodeBase64(String content) {\n\t\tbyte[] bytes = content.replace(\"\\r\", \"\").replace(\"\\n\", \"\").getBytes();\n\t\treturn Base64.getDecoder().decode(bytes);\n\t}\n\n}\n","sourceCodeStart":76,"sourceCodeEnd":104,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/5b2dbdbb8be64415eb6552f81ff7c449c8d251e6/buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemCertificateParser.java#L76-L104","documentation":"Error \"Error reading certificate: ${ex.getMessage()}\" thrown in spring-projects/spring-boot.","triggerScenarios":"Thrown at buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PemCertificateParser.java:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"5b2dbdbb8be64415eb6552f81ff7c449c8d251e6","analyzedAt":"2026-08-04T18:53:14.967Z","schemaVersion":2}