[Logo] JCVSForum - Community Support For JCVS Users and Developers
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Not ger response from CVS server?  XML
Forum Index » JCVS Developers
Author Message
peip


[Avatar]

Joined: 01/03/2005 17:45:05
Messages: 10
Location: Vancouver, Canada
Offline

I got the following output from my java program, but it seems waiting for response forever. Anyone know why?


<pre>
C:\src\java>java -cp jars/jcvsii.jar;. JCVSAddNewFile abc
Opening server '2401@cvsserver.blah.com'...
Authenticating 'peip@cvsserver.blah.com'...
Negotiating cvs protocol...
Sending command request, 'status:A:EUAF:d:'...
Reading server response...</pre>

There should be no problem with the CVS server, as I used it all the time.



My code is here:


<pre>
import java.io.*;
import java.util.Enumeration;
import com.ice.cvsc.*;

public class JCVSAddNewFile extends JCVSExample {
public static void main(String[] args) {
JCVSAddNewFile app = new JCVSAddNewFile();
try {
app.instanceMain( args );
} catch ( Exception ex ) {
ex.printStackTrace();
}
}

private void instanceMain(String[] args) throws Exception {
String localRootDir = "C:/HEAD";
String module = "aseries/OPENROAD/costs";

CVSProject project = new CVSProject(new CVSClient("cvsserver.blah.com", 2401));
project.openProject(new File(localRootDir + "/" + module));
project.setPServer(true);
project.setUserName("peip");
project.setPassword(CVSScramble.scramblePassword("peip", 'A'));

CVSRequest request = new CVSRequest();

request.setCommand("'status:A:EUAF:d:");
request.setConnectionMethod(1);
// In this case, our entries is only those being added.
CVSEntryVector entries = new CVSEntryVector();
request.setEntries(entries);

String repos = project.getRepository();

String rootDir = CVSCUtilities.ensureFinalSlash(project.getRootDirectory());

CVSEntry entry = new CVSEntry();

entry.setName("pufr6165.w4gl");
entry.setLocalDirectory( repos );
entry.setRepository( rootDir + repos );
entry.setTimestamp( project.getEntryFile( entry ) );
entry.setVersion( "0" );

entries.addElement(entry);

request.setArguments( new CVSArgumentVector() ); // add -kb for binary files

// Once you are confident of the code, you can turn these off.
request.traceRequest = true;
request.traceResponse = true;
request.traceTCPData = true;
request.traceProcessing = true;

request.setUserInterface(new CVSTestUI());

CVSResponse response = new CVSResponse();

if (project.performCVSRequest(request, response)) {
boolean respOk = project.processCVSResponse( request, response );
System.err.println(response.getErrorText());
} else {
System.err.println( "FAILED to perform cvs request." );
}
// NOTE, You MUST make a call to CVSProject.writeAdminFile() ANY
// time that you perform an operation that modifies the CVSEntrys
// in the project, including "update", "ci", and other commands.

project.writeAdminFiles();
}
}
</pre>
time


[Avatar]

Joined: 05/06/2004 18:09:23
Messages: 367
Location: Bangkok
Offline

The problem with the code is the use of CVSRequest.setCommand() to parse the control string (e.g., "add:G:SUAFX:due:"). You need to use the method CVSRequest.parseControlString(). There is an example of adding a file in the example code included with the tutorial. As you can see in that code, this is the way to parse the request control string:


You can download the tutorial example code here.
[Email] [WWW]
Anonymous



<p>Now I modified my code to call parseControlString(), when I ran it, it simply displayed "failed to performCVSRequest", which means performCVSRequest() failed:</p>
time


[Avatar]

Joined: 05/06/2004 18:09:23
Messages: 367
Location: Bangkok
Offline

See my reply at http://www.jcvs.org/jcvsforum/posts/list/1553.page
[Email] [WWW]
peip


[Avatar]

Joined: 01/03/2005 17:45:05
Messages: 10
Location: Vancouver, Canada
Offline

<p>Cool. I will try tomorrow.</p>
<p>The code was copied from the tutorial, but yeah, you probably should only create CVSEntry if it is a new file.</p>
<p>If still does not work, I will come back with the new code and also the cvslog.txt
 
Forum Index » JCVS Developers
Go to:   
Powered by JForum 2.1.9 © JForum Team