/* * NetbeansDevTimestamper.java * * Created on 25. 8. 2003, 10:49 */ package org.netbeans.test4u.plugin.nbvisualweb; import java.io.File; import java.util.Date; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import org.netbeans.test4u.plugin.Timestamper; import org.netbeans.test4u.plugin.TimestamperException; import org.netbeans.test4u.product.Build; /** * * @author ehucka */ public class NBVisualwebTimestamper extends Timestamper { /** Returns a date where the build has been built. */ public Date getTimeStamp(Build build, File buildZip) throws TimestamperException { //to get the build informations I have to use the parse build_info file from zip archive try { ZipFile zip=new ZipFile(buildZip); ZipEntry entry = null; entry = zip.getEntry("netbeans/xmltools1"); if (entry == null) { entry = zip.getEntry("etc"); if (entry == null) { entry = zip.getEntry("bin"); } } return new Date(entry.getTime()); } catch(Exception e) { //NumberFormatException, ClassNotFoundException, IllegalAccessException, IllegalArgumentException, //NoSuchMethodError, SecurityException, InvocationTargetException throw new TimestamperException(e); } } protected Date parseNumber(Build build, String s) throws Exception { String number=s.substring(s.indexOf(':')+1); number=number.trim(); return parseBuildNumber(build, number); } }