Author: rob.stryker(a)jboss.com
Date: 2007-10-25 20:12:12 -0400 (Thu, 25 Oct 2007)
New Revision: 4526
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModelCore.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
Log:
JBIDE-1164
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModelCore.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModelCore.java 2007-10-25
22:19:17 UTC (rev 4525)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModelCore.java 2007-10-26
00:12:12 UTC (rev 4526)
@@ -24,8 +24,11 @@
import org.apache.tools.ant.DirectoryScanner;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
/**
@@ -88,14 +91,20 @@
public static IPath[] findMatchingPaths(IPath root, String includes, String excludes) {
- DirectoryScanner scanner =
- DirectoryScannerFactory.createDirectoryScanner(root, includes, excludes, true);
- String[] files = scanner.getIncludedFiles();
- IPath[] paths = new IPath[files.length];
- for( int i = 0; i < files.length; i++ ) {
- paths[i] = new Path(files[i]);
+ try {
+ DirectoryScanner scanner =
+ DirectoryScannerFactory.createDirectoryScanner(root, includes, excludes, true);
+ String[] files = scanner.getIncludedFiles();
+ IPath[] paths = new IPath[files.length];
+ for( int i = 0; i < files.length; i++ ) {
+ paths[i] = new Path(files[i]);
+ }
+ return paths;
+ } catch( IllegalStateException ise ) {
+ IStatus status = new Status(IStatus.WARNING, ArchivesCorePlugin.PLUGIN_ID, "Error
creating directory scanner", ise);
+ ArchivesCorePlugin.getDefault().getLog().log(status);
+ return new IPath[]{};
}
- return paths;
}
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2007-10-25
22:19:17 UTC (rev 4525)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2007-10-26
00:12:12 UTC (rev 4526)
@@ -22,8 +22,6 @@
package org.jboss.ide.eclipse.archives.core.model;
import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
import org.apache.tools.ant.DirectoryScanner;
import org.eclipse.core.runtime.IPath;
@@ -46,8 +44,9 @@
scanner.setBasedir(basedir);
scanner.setExcludes(excludesList);
scanner.setIncludes(includesList);
- if (scan)
+ if (scan) {
scanner.scan();
+ }
return scanner;
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2007-10-25
22:19:17 UTC (rev 4525)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2007-10-26
00:12:12 UTC (rev 4526)
@@ -25,7 +25,10 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import
org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
@@ -71,7 +74,7 @@
*/
public synchronized IPath[] findMatchingPaths () {
getScanner(); // ensure up to date
- return (IPath[]) matchingPaths.toArray(new IPath[matchingPaths.size()]);
+ return matchingPaths == null ? new IPath[0] : (IPath[]) matchingPaths.toArray(new
IPath[matchingPaths.size()]);
}
/*
@@ -139,20 +142,24 @@
if( scanner == null || rescanRequired) {
rescanRequired = false;
- // new scanner
- scanner = DirectoryScannerFactory.createDirectoryScanner(
- getGlobalSourcePath(), getIncludesPattern(), getExcludesPattern(), true);
-
- // cache the paths
- ArrayList paths = new ArrayList();
- IPath sp = getGlobalSourcePath();
- String matched[] = scanner.getIncludedFiles();
- for (int i = 0; i < matched.length; i++) {
- IPath path = sp.append(new Path(matched[i]));
- paths.add(path);
+ try {
+ // new scanner
+ scanner = DirectoryScannerFactory.createDirectoryScanner(
+ getGlobalSourcePath(), getIncludesPattern(), getExcludesPattern(), true);
+
+ // cache the paths
+ ArrayList paths = new ArrayList();
+ IPath sp = getGlobalSourcePath();
+ String matched[] = scanner.getIncludedFiles();
+ for (int i = 0; i < matched.length; i++) {
+ IPath path = sp.append(new Path(matched[i]));
+ paths.add(path);
+ }
+ matchingPaths = paths;
+ } catch( IllegalStateException ise ) {
+ IStatus status = new Status(IStatus.WARNING, ArchivesCorePlugin.PLUGIN_ID,
"Could not create directory scanner", ise);
+ ArchivesCorePlugin.getDefault().getLog().log(status);
}
-
- matchingPaths = paths;
}
return scanner;
}
Show replies by date