1 package org.apache.maven.scm.provider.cvslib.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.scm.providers.cvslib.settings.Settings;
23 import org.apache.maven.scm.providers.cvslib.settings.io.xpp3.CvsXpp3Reader;
24 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
25
26 import java.io.File;
27 import java.io.FileNotFoundException;
28 import java.io.FileReader;
29 import java.io.IOException;
30
31
32
33
34
35 public class CvsUtil
36 {
37 private CvsUtil()
38 {
39 }
40
41 public static Settings getSettings()
42 {
43 File scmUserDir = new File( System.getProperty( "user.home" ), ".scm" );
44 File settingsFile = new File( scmUserDir, "cvs-settings.xml" );
45
46 if ( settingsFile.exists() )
47 {
48 CvsXpp3Reader reader = new CvsXpp3Reader();
49 try
50 {
51 return reader.read( new FileReader( settingsFile ) );
52 }
53 catch ( FileNotFoundException e )
54 {
55 }
56 catch ( IOException e )
57 {
58 }
59 catch ( XmlPullParserException e )
60 {
61 String message = settingsFile.getAbsolutePath() + " isn't well formed. SKIPPED." + e.getMessage();
62
63 System.out.println( message );
64 }
65 }
66
67 return new Settings();
68 }
69 }