@Test public void should_extract_version() throws Exception { String content = "Atlassian Bamboo</a> version 2.7.1 build 2101 -"; String version = BambooVersionExtractor.extractVersion(content); assertEquals("2.7.1", version); }
static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } }
BambooVersionExtractor { static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } } }
BambooVersionExtractor { static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } } private  BambooVersionExtractor(); }
BambooVersionExtractor { static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } } private  BambooVersionExtractor();  }
BambooVersionExtractor { static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } } private  BambooVersionExtractor();   }