This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 127884 - Exception thrown when there is a backup file with a name starting with E
Summary: Exception thrown when there is a backup file with a name starting with E
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: ClearCase (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P1 blocker (vote)
Assignee: issues@versioncontrol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-20 14:48 UTC by akochnev
Modified: 2008-02-21 11:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description akochnev 2008-02-20 14:48:10 UTC
Netbeans saves backup file with a ~ extension, e the file Foo.java becomes Foo.java~ . Therefore, Eoo.java would get
backed up as Eoo.java~. The file will have to be ignored; however, the path to the file c:\foo\bar\Eoo.java~ will break
the usage of \\Q and \\E in the regex. 

Below is the stacktrace. 

java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index ...
\QD:\JDevelop\LocalCC\FooProject\src\com\foo\Eoo.java~\E
                                                                                                                       
                                                     ^
	at java.util.regex.Pattern.error(Pattern.java:1713)
	at java.util.regex.Pattern.escape(Pattern.java:2177)
	at java.util.regex.Pattern.atom(Pattern.java:1952)
	at java.util.regex.Pattern.sequence(Pattern.java:1885)
	at java.util.regex.Pattern.expr(Pattern.java:1752)
	at java.util.regex.Pattern.compile(Pattern.java:1460)
	at java.util.regex.Pattern.<init>(Pattern.java:1133)
	at java.util.regex.Pattern.compile(Pattern.java:823)
	at org.netbeans.modules.clearcase.ClearcaseModuleConfig.toPattern(ClearcaseModuleConfig.java:105)
	at org.netbeans.modules.clearcase.ClearcaseModuleConfig.setIgnored(ClearcaseModuleConfig.java:80)
	at org.netbeans.modules.clearcase.FileStatusCache.isIgnored(FileStatusCache.java:494)
	at org.netbeans.modules.clearcase.FileStatusCache.createFileInformation(FileStatusCache.java:446)
	at org.netbeans.modules.clearcase.FileStatusCache.refresh(FileStatusCache.java:371)
	at org.netbeans.modules.clearcase.FileStatusCache.refresh(FileStatusCache.java:288)
	at org.netbeans.modules.clearcase.FileStatusCache.access$100(FileStatusCache.java:70)
	at org.netbeans.modules.clearcase.FileStatusCache$1.run(FileStatusCache.java:516)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)
Comment 1 akochnev 2008-02-20 15:27:49 UTC
I really tried exporting a patch just for this file through NetBeans, but I'm totally baffled on how to do that, I get
an export diff on a whole bunch of files that I don't care about. I would appreciate a tip on how to export a diff for a
single file.. 

Anyway.. the fix is to replace : 

    private static Pattern toPattern(File file) {
        String filePath = file.getAbsolutePath();
        return Pattern.compile("\\Q" + filePath + "\\E");
    }

with 
    private static Pattern toPattern(File file) {
        String filePath = file.getAbsolutePath();
        return Pattern.compile(Pattern.quote(filePath));
    }

And the exception disappears.
Comment 2 Maros Sandor 2008-02-21 11:11:25 UTC
Fixing pattern conversion, thanks for the patch.
4ef4926c746c