diff options
author | Michael Valenta | 2005-04-07 18:57:44 +0000 |
---|---|---|
committer | Michael Valenta | 2005-04-07 18:57:44 +0000 |
commit | e1519d24cb7af9bca8d9e2d27e10e9c314f053f8 (patch) | |
tree | 31bb30916581875531f5d51853d44ebce3fb663d /bundles/org.eclipse.team.cvs.core | |
parent | 82489920f66b7b61f93206f31bfa95a876142af0 (diff) | |
download | eclipse.platform.team-e1519d24cb7af9bca8d9e2d27e10e9c314f053f8.tar.gz eclipse.platform.team-e1519d24cb7af9bca8d9e2d27e10e9c314f053f8.tar.xz eclipse.platform.team-e1519d24cb7af9bca8d9e2d27e10e9c314f053f8.zip |
Bug 90585 CVSException while importing projects in my workspace
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core')
-rw-r--r-- | bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java index 2ea853297..2275abdf8 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java @@ -63,8 +63,10 @@ public class SyncFileWriter { * If the folder does not have a CVS subdirectory then <code>null</code> is returned. */ public static byte[][] readAllResourceSync(IContainer parent) throws CVSException { - IFolder cvsSubDir = getCVSSubdirectory(parent); - if (! cvsSubDir.exists()) return null; + IFolder cvsSubDir = getCVSSubdirectory(parent); + if (! cvsSubDir.exists() && !cvsSubDir.getLocation().toFile().exists()) { + return null; + } if (Policy.DEBUG_METAFILE_CHANGES) { System.out.println("Reading Entries file for " + parent.getFullPath()); //$NON-NLS-1$ @@ -145,14 +147,16 @@ public class SyncFileWriter { */ public static FolderSyncInfo readFolderSync(IContainer folder) throws CVSException { IFolder cvsSubDir = getCVSSubdirectory(folder); - if (! cvsSubDir.exists()) return null; + if (! cvsSubDir.exists() && !cvsSubDir.getLocation().toFile().exists()) { + return null; + } if (Policy.DEBUG_METAFILE_CHANGES) { System.out.println("Reading Root/Repository files for " + folder.getFullPath()); //$NON-NLS-1$ } // check to make sure the the cvs folder is hidden - if (!cvsSubDir.isTeamPrivateMember()) { + if (!cvsSubDir.isTeamPrivateMember() && cvsSubDir.exists()) { try { cvsSubDir.setTeamPrivateMember(true); } catch (CoreException e) { @@ -280,7 +284,9 @@ public class SyncFileWriter { */ public static NotifyInfo[] readAllNotifyInfo(IContainer parent) throws CVSException { IFolder cvsSubDir = getCVSSubdirectory(parent); - if (! cvsSubDir.exists()) return null; + if (! cvsSubDir.exists() && !cvsSubDir.getLocation().toFile().exists()) { + return null; + } // process Notify file contents String[] entries = readLines(cvsSubDir.getFile(NOTIFY)); @@ -343,7 +349,9 @@ public class SyncFileWriter { */ public static BaserevInfo[] readAllBaserevInfo(IContainer parent) throws CVSException { IFolder cvsSubDir = getCVSSubdirectory(parent); - if (! cvsSubDir.exists()) return null; + if (! cvsSubDir.exists() && !cvsSubDir.getLocation().toFile().exists()) { + return null; + } // process Notify file contents String[] entries = readLines(cvsSubDir.getFile(BASEREV)); @@ -419,9 +427,17 @@ public class SyncFileWriter { * Returns null if the file does not exist, or the empty string if it is blank. */ private static String readFirstLine(IFile file) throws CVSException { - if (! file.exists()) return null; try { - BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents(true)), 512); + BufferedReader reader = null;; + if (file.exists()) { + reader = new BufferedReader(new InputStreamReader(file.getContents(true)), 512); + } else { + File ioFile = file.getLocation().toFile(); + if (ioFile.exists()) { + reader = new BufferedReader(new InputStreamReader(new FileInputStream(ioFile)), 512); + } + } + if (reader == null) return null; try { String line = reader.readLine(); if (line == null) return ""; //$NON-NLS-1$ @@ -447,9 +463,18 @@ public class SyncFileWriter { */ private static String[] readLines(IFile file) throws CVSException { try { - if(! file.exists()) return null; - // Peform a forced read (ignoring out-of-sync) - BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents(true))); + BufferedReader reader = null;; + if (file.exists()) { + // Peform a forced read (ignoring out-of-sync) + reader = new BufferedReader(new InputStreamReader(file.getContents(true))); + } else { + File ioFile = file.getLocation().toFile(); + if (ioFile.exists()) { + reader = new BufferedReader(new InputStreamReader(new FileInputStream(ioFile)), 512); + } + } + if (reader == null) return null; + List fileContentStore = new ArrayList(); try { String line; |