Revision: 14923
http://gate.svn.sourceforge.net/gate/?rev=14923&view=rev
Author: valyt
Date: 2012-01-07 17:38:18 +0000 (Sat, 07 Jan 2012)
Log Message:
-----------
- only use the URL path (excluding the query string) when generating document
file names from source URLs.
- add a numeric ID at the end if that leads to duplicated names.
Closes bug #2910978.
Modified Paths:
--------------
gate/trunk/src/gate/gui/NameBearerHandle.java
Modified: gate/trunk/src/gate/gui/NameBearerHandle.java
===================================================================
--- gate/trunk/src/gate/gui/NameBearerHandle.java 2012-01-07 17:17:56 UTC
(rev 14922)
+++ gate/trunk/src/gate/gui/NameBearerHandle.java 2012-01-07 17:38:18 UTC
(rev 14923)
@@ -833,17 +833,19 @@
// makes sure that the filename does not contain any
// forbidden character
fileName = fileName.replaceAll("[\\/:\\*\\?\"<>|]", "_");
+ if(fileName.toLowerCase().endsWith(".xml")) {
+ fileName = fileName.substring(0,fileName.length() - 4);
+ }
if(usedFileNames.contains(fileName)){
// name clash -> add unique ID
String fileNameBase = fileName;
int uniqId = 0;
- fileName = fileNameBase + uniqId;
+ fileName = fileNameBase + "-" + uniqId++;
while(usedFileNames.contains(fileName)) {
- uniqId++;
- fileName = fileNameBase + uniqId;
+ fileName = fileNameBase + "-" + uniqId++;
}
}
-
+ usedFileNames.add(fileName);
if(!fileName.toLowerCase().endsWith(".xml"))
fileName += ".xml";
File docFile = null;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs