Unable to open pserverconnection in cvs
Hai
I am using java cvs for my application.First i created the pserver
connection but It didn't work well. It gives null Pointer Exception. I don't know why. Anyone plz help me?
Thnx in advance
Here is my Source Code
try{
PServerConnection c =new PServerConnection();
PServerConnection connection = c;
Scrambler scrambler = StandardScrambler.getInstance();
c.setUserName("kirank");
c.setHostName("fileserver.cash-tech.com");
c.setRepository("/source/repository/triton");
c.setEncodedPassword(scrambler.scramble("123456"));
c.open(); //Exception -- NullPointerException
System.out.println("connection created");
}
catch(Exception e)
{
System.out.println("connection not created");
e.printStackTrace();
}
Regards
Raviraj Gangrade
# 2
Here's how I fixed this freakin' problem. Wasted half of my day!!!! javacvs seems buggy and there's minimal support for it. There were a few different people asking this question, but no one had answered it properly.
String root = null;
BufferedReader r = null;
try
{
if (cvsRootFile.exists())
{
r = new BufferedReader(new FileReader(cvsRootFile));
root = r.readLine();
}
}
catch (IOException e)
{
// TODO: Fix this. log errors properly.
System.err.println(e.getMessage());
e.printStackTrace();
}
finally
{
try
{
if (r != null)
r.close();
}
catch (IOException e)
{
// TODO: Fix this. log errors properly.
System.err.println(e.getMessage());
e.printStackTrace();
}
}
globalOptions = new GlobalOptions();
globalOptions.setCVSRoot(root);
CVSRoot cvsRoot = CVSRoot.parse(root);
connection = new PServerConnection(cvsRoot);
connection.open();
The difference is I'm passing a CVSRoot object to PServerConnection. "Manually" setting the connection parameters makes javacvs crap out. I have no idea why. I suspect a bug.