@Override public int getLatestSCTMBuildnumber(String productName, String version) throws SCTMException { try { String[] builds = adminService.getBuilds(sessionId, productName, version); int latestBuildnumber = -1; for (String bn : builds) { int buildnumber = 0; try { buildnumber = Integer.parseInt(bn); if (buildnumber > latestBuildnumber) latestBuildnumber = buildnumber; } catch (NumberFormatException e) { LOGGER.warning( MessageFormat.format( "Build number ({0}) is not a number. Ignoring it.", buildnumber)); } } return latestBuildnumber; } catch (RemoteException e) { if (handleLostSessionException(e)) return getLatestSCTMBuildnumber(productName, version); LOGGER.log(Level.SEVERE, e.getMessage(), e); throw new SCTMException( MessageFormat.format( Messages.getString("SCTMService.err.commonFatalError"), e.getMessage())); // $NON-NLS-1$ } }
@Override public boolean buildNumberExists(String productName, String version, int buildNumber) throws SCTMException { try { String[] builds = adminService.getBuilds(sessionId, productName, version); String value = String.valueOf(buildNumber); for (String build : builds) { if (value.equals(build)) return true; } return false; } catch (RemoteException e) { if (handleLostSessionException(e)) return buildNumberExists(productName, version, buildNumber); LOGGER.log(Level.SEVERE, e.getMessage(), e); throw new SCTMException( MessageFormat.format( Messages.getString("SCTMService.err.commonFatalError"), e.getMessage())); // $NON-NLS-1$ } }