Re: Trouble with ExportCommand

Martin Entlicher <[email protected]> Mon, 24 May 2004 19:28:32 +0200
Newsgroups gmane.comp.java.netbeans.modules.javacvs.devel
Message-ID <[email protected]>
This looks like a bug in SetStickyResponse class. It should not be 
necessary to call createNewFile(), since the writer will create the file 
if necessary. Also the stream must be closed in finally clause. I've 
fixed the code in trunk, so you can check out the fixed version from 
cvs.netbeans.org, module "javacvs".

Thanks for the bug report. You can also submit bugs into Issuezilla.

Regards,
Martin

[email protected] wrote:

>Hello,
>
>I'm working with javacvs for the first time.  I'm trying to write a program
>to export files from a repository that have been tagged a particular way.
>I can connect to the repository just fine.  But, when I execute my
>ExportCommand, I get this big exception:
>
>  java.io.IOException: The file exists.
>
>    boolean java.io.Win32FileSystem.createFileExclusively(java.lang.String)
>    boolean java.io.File.createNewFile()
>
>    void
>org.netbeans.lib.cvsclient.response.SetStickyResponse.process(org.netbeans.lib.cvsclient.util.LoggedDataInputStream,
> org.netbeans.lib.cvsclient.response.ResponseServices)
>    void org.netbeans.lib.cvsclient.Client.handleResponse()
>    void org.netbeans.lib.cvsclient.Client.processRequests(java.util.List)
>    void
>org.netbeans.lib.cvsclient.command.export.ExportCommand.postExpansionExecute(org.netbeans.lib.cvsclient.ClientServices,
> org.netbeans.lib.cvsclient.event.EventManager)
>    void
>org.netbeans.lib.cvsclient.command.export.ExportCommand.execute(org.netbeans.lib.cvsclient.ClientServices,
> org.netbeans.lib.cvsclient.event.EventManager)
>    void
>org.netbeans.lib.cvsclient.Client.executeCommand(org.netbeans.lib.cvsclient.command.Command,
> org.netbeans.lib.cvsclient.command.GlobalOptions)
>    void cvs_test.cvs_test.<init>()
>    void cvs_test.cvs_test.main(java.lang.String[])
>  Process exited with exit code 0.
>
>
>Can someone tell by the code below what I could be doing wrong?
>
>
>static final String USERNAME   = "my_id";
>static final String PASSWORD   = "my_password";
>static final String HOSTNAME   = "my_server";
>static final String REPOSITORY = "/u1/CVSRepository/tms";
>static final String CVSROOT    = ":pserver:" + USERNAME + "@" + HOSTNAME +
>":" + REPOSITORY;
>static final String LOCALPATH  = "D:/MY_MODULE/SQL";
>static final String TAG        = "my_tag";
>static final String MODULE     = "MY_MODULE";
>
>Client client;
>GlobalOptions gOptions = new GlobalOptions();
>
>public cvs_test() {
>File workingDir = new File(LOCALPATH);
>try {
>  if (!(workingDir.exists()))
>    workingDir.mkdirs();
>  }
>catch (Exception e) {
>  e.printStackTrace();
>  return;
>}
>
>PServerConnection connection = new PServerConnection();
>connection.setUserName(USERNAME);
>connection.setEncodedPassword(StandardScrambler.getInstance().scramble(PASSWORD));
>connection.setHostName(HOSTNAME);
>connection.setRepository(REPOSITORY);
>try {
>  connection.open();
>  client = new Client(connection, new StandardAdminHandler());
>  client.getEventManager().addCVSListener(new BasicListener());
>  client.setLocalPath(workingDir.getAbsolutePath());
>
>  gOptions.setCVSRoot(CVSROOT);
>}
>catch (AuthenticationException e) {
>  e.printStackTrace();
>  return;
>}
>
>// export -r <my_tag> <my_module>
>ExportCommand ec = new ExportCommand();
>ec.setExportByRevision(TAG);
>ec.setModule(MODULE);
>System.out.println(ec.getCVSCommand());
>
>try {
>  client.executeCommand(ec, gOptions);
>}
>catch (AuthenticationException e) {
>  e.printStackTrace();
>}
>catch (CommandException e) {
>  e.printStackTrace();
>}
>
>//  Close the connection.
>try {
>  client.getConnection().close();
>}
>catch (Exception e) {
>  e.printStackTrace();
>}
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
>  
>