Author: ltheussl Date: Tue Sep 27 07:16:14 2011 New Revision: 1176241 URL: http://svn.apache.org/viewvc?rev=1176241&view=rev Log: [MSITE-600] merge r1175226 from trunk
Modified: maven/plugins/branches/maven-site-plugin-2.x/ (props changed) maven/plugins/branches/maven-site-plugin-2.x/pom.xml (props changed) maven/plugins/branches/maven-site-plugin-2.x/src/ (props changed) maven/plugins/branches/maven-site-plugin-2.x/src/it/inheritedReports/ (props changed) maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java Propchange: maven/plugins/branches/maven-site-plugin-2.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Sep 27 07:16:14 2011 @@ -1 +1 @@ -/maven/plugins/trunk/maven-site-plugin:1150948,1174605,1174614 +/maven/plugins/trunk/maven-site-plugin:1150948,1174605,1174614,1175226 Propchange: maven/plugins/branches/maven-site-plugin-2.x/pom.xml ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Sep 27 07:16:14 2011 @@ -1,2 +1,2 @@ /maven/plugins/branches/maven-site-plugin-3.x/pom.xml:940318,942876,956257,956299,984961,992626,1003823 -/maven/plugins/trunk/maven-site-plugin/pom.xml:1150948,1174605,1174614 +/maven/plugins/trunk/maven-site-plugin/pom.xml:1150948,1174605,1174614,1175226 Propchange: maven/plugins/branches/maven-site-plugin-2.x/src/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Sep 27 07:16:14 2011 @@ -1,2 +1,2 @@ /maven/plugins/branches/maven-site-plugin-3.x/src:940318,942876,956257,956299,984961,992626,1003823 -/maven/plugins/trunk/maven-site-plugin/src:1150948,1174605,1174614 +/maven/plugins/trunk/maven-site-plugin/src:1150948,1174605,1174614,1175226 Propchange: maven/plugins/branches/maven-site-plugin-2.x/src/it/inheritedReports/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Sep 27 07:16:14 2011 @@ -1 +1 @@ -/maven/plugins/trunk/maven-site-plugin/src/it/inheritedReports:801155,801171,801470,806898-806906,807943-808180,809252,810298,884137,886844,886847,890094,890124,891014,891688,920027,920041,942622,943455,944145,950463,956681,984466,984960,984991,984996,1029307,1033379,1037476,1039137,1039143,1039748-1039749,1049020,1051139-1051449,1055019,1055033,1055047,1055089,1060289,1063639,1064626,1065576,1065582,1066038,1067103,1067120,1070079-1070080,1070100,1070104,1074118,1075018,1075782,1075810,1075995,1076167,1076195,1077911,1077924,1078235,1079474,1079529,1079698,1080781,1081676,1081837,1081887,1082091,1082242,1082274,1082877,1083147,1083251,1083473,1084564,1086313,1086338-1086339,1086533,1087455,1088584,1089802,1089852,1091331,1098168,1098170,1099591,1126420,1126918-1126945,1132936,1145546,1145555,1145947,1147048,1150948,1174605,1174614 +/maven/plugins/trunk/maven-site-plugin/src/it/inheritedReports:801155,801171,801470,806898-806906,807943-808180,809252,810298,884137,886844,886847,890094,890124,891014,891688,920027,920041,942622,943455,944145,950463,956681,984466,984960,984991,984996,1029307,1033379,1037476,1039137,1039143,1039748-1039749,1049020,1051139-1051449,1055019,1055033,1055047,1055089,1060289,1063639,1064626,1065576,1065582,1066038,1067103,1067120,1070079-1070080,1070100,1070104,1074118,1075018,1075782,1075810,1075995,1076167,1076195,1077911,1077924,1078235,1079474,1079529,1079698,1080781,1081676,1081837,1081887,1082091,1082242,1082274,1082877,1083147,1083251,1083473,1084564,1086313,1086338-1086339,1086533,1087455,1088584,1089802,1089852,1091331,1098168,1098170,1099591,1126420,1126918-1126945,1132936,1145546,1145555,1145947,1147048,1150948,1174605,1174614,1175226 Modified: maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1176241&r1=1176240&r2=1176241&view=diff ============================================================================== --- maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java (original) +++ maven/plugins/branches/maven-site-plugin-2.x/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java Tue Sep 27 07:16:14 2011 @@ -677,8 +677,8 @@ public abstract class AbstractDeployMojo } // MSITE-600 - URIPathDescriptor siteURI = new URIPathDescriptor( site.getUrl(), "" ); - URIPathDescriptor oldSiteURI = new URIPathDescriptor( oldSite.getUrl(), "" ); + URIPathDescriptor siteURI = new URIPathDescriptor( URIEncoder.encodeURI( site.getUrl() ), "" ); + URIPathDescriptor oldSiteURI = new URIPathDescriptor( URIEncoder.encodeURI( oldSite.getUrl() ), "" ); if ( !siteURI.sameSite( oldSiteURI.getBaseURI() ) ) { @@ -688,4 +688,32 @@ public abstract class AbstractDeployMojo return site; } + + private static class URIEncoder + { + private static final String mark = "-_.!~*'()"; + private static final String reserved = ";/?:@&=+$,"; + + public static String encodeURI( final String uriString ) + { + final char[] chars = uriString.toCharArray(); + final StringBuilder uri = new StringBuilder( chars.length ); + + for ( int i = 0; i < chars.length; i++ ) + { + final char c = chars[i]; + if ( ( c >= '0' && c <= '9' ) || ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) + || mark.indexOf( c ) != -1 || reserved.indexOf( c ) != -1 ) + { + uri.append( c ); + } + else + { + uri.append( '%' ); + uri.append( Integer.toHexString( (int) c ) ); + } + } + return uri.toString(); + } + } }