public void configure(URL url) throws Exception {
        InputStream in = null;
        try {
            URLConnection urlConnection = url.openConnection();
            urlConnection.setUseCaches(false);
            in = urlConnection.getInputStream();
            if (hasNewDoConfigureApi()) {
                doConfigure(in, url.toExternalForm());
            } else {
                // adapter old version of logback below 1.1.10
                doConfigure(in);
            }
        } catch (IOException ioe) {
            String errMsg = "Could not open URL [" + url + "].";
            addError(errMsg, ioe);
            throw new JoranException(errMsg, ioe);
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException ioe) {
                    String errMsg = "Could not close input stream";
                    addError(errMsg, ioe);
                    throw new JoranException(errMsg, ioe);
                }
            }
        }
    }
@Test
    void testConfigureWithError() throws Exception {
        doThrow(new IOException("test")).when(inputStream).close();
        try {
            nacosLogbackConfiguratorAdapter.configure(url);
        } catch (JoranException e) {
            List<Status> statusList = context.getStatusManager().getCopyOfStatusList();
            assertFalse(statusList.isEmpty());
            assertTrue(statusList.get(statusList.size() - 1) instanceof ErrorStatus);
            assertEquals("Could not close input stream", statusList.get(statusList.size() - 1).getMessage());
        }
    }