>I am trying to use the clearcase >org.apache.tools.ant.taskdefs.optional.clearcase.CCCheckout tool and I >get a null pointer error on line 43 "ckout.execute();". The code is >attached below. > > > >Here is the Exception: > > > >Exception in thread "main" java.lang.NullPointerException > > at >org.apache.tools.ant.taskdefs.optional.clearcase.ClearCase.run( >ClearCase >.java:134) > > at >org.apache.tools.ant.taskdefs.optional.clearcase.CCCheckout.exe >cute(CCCh >eckout.java:145) > > at >com.lmco.dat.util.ClearCaseMethods.checkOutFiles(ClearCaseMetho >ds.java:4 >4) > > at com.lmco.dat.util.Main.main(Main.java:9) > > > >I checked and all of the required attributes are set( > >reserved > >Specifies whether to check out the file as reserved or not > >Yes > >). > > > >Do you have a code example that I can view? > > > >Thanks in advance, > >Nicole > > > >1 package com.lmco.dat.util; > >2 > >3 import java.io.File; > >4 import java.text.SimpleDateFormat; > >5 > >6 import org.apache.tools.ant.Task; > >7 import >org.apache.tools.ant.taskdefs.optional.clearcase.CCCheckout; > >8 > >9 public class ClearCaseMethods{ > >10 > >11 /** Date format required by commands passed to Clear Case */ > >12 static final SimpleDateFormat IN_DATE_FORMAT = > >13 new >SimpleDateFormat("dd-MMMM-yyyy.HH:mm:ss"); > >14 > >15 /** Date format returned in the output of Clear Case >commands. */ > >16 static final SimpleDateFormat OUT_DATE_FORMAT = > >17 new >SimpleDateFormat("yyyyMMdd.HHmmss"); > >18 > >19 /** The path of the clear case view */ > >20 private static String viewPath = >"C:/ngrant_irad_view/webapps/IRADMgmt/test.txt"; > >21 private String branch; > >22 > >23 > >24 //Constructor > >25 public static void ClearCaseMethods(){ > >26 System.out.println("Here is my Clearcase test"); > >27 } > >28 > >29 > >30 public static void checkOutFiles(){ > >31 > >32 Boolean reserved = true; > >33 > >34 CCCheckout ckout = new CCCheckout(); > >35 ckout.setBranch("main"); > >36 ckout.setDescription("test desc"); > >37 ckout.setViewPath("C:/ngrant_irad_view"); > >38 ckout.setComment("here is my comment"); > >39 ckout.setReserved(reserved); > >40 ckout.setOut("C:/ngrant_irad_view/webapps/IRADMgmt/"); > >41 ckout.setObjSelect("test.txt"); > >42 > >43 ckout.execute(); > >44 >
You could have a look at its source http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/an t/taskdefs/optional/clearcase/ClearCase.java?view=annotate Line 134 is exe.setWorkingDirectory(aProj.getBaseDir()); aProj is initialized on 130 Project aProj = getProject(); That method is inherited from ProjectComponent (Task base class extends that) which returns the project reference needed for logging, properties etc. You havent set that value. ckout.setProject(...); Jan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]