├── .gitattributes ├── .gitignore ├── NOTICE.txt ├── README.md ├── jira ├── PLXUTILS-1.json ├── PLXUTILS-10.json ├── PLXUTILS-100.json ├── PLXUTILS-101.json ├── PLXUTILS-102.json ├── PLXUTILS-103.json ├── PLXUTILS-104.json ├── PLXUTILS-105.json ├── PLXUTILS-106.json ├── PLXUTILS-107.json ├── PLXUTILS-108.json ├── PLXUTILS-109.json ├── PLXUTILS-11.json ├── PLXUTILS-110.json ├── PLXUTILS-111.json ├── PLXUTILS-112.json ├── PLXUTILS-113.json ├── PLXUTILS-114.json ├── PLXUTILS-116.json ├── PLXUTILS-117.json ├── PLXUTILS-118.json ├── PLXUTILS-119.json ├── PLXUTILS-12.json ├── PLXUTILS-120.json ├── PLXUTILS-121.json ├── PLXUTILS-122.json ├── PLXUTILS-123.json ├── PLXUTILS-124.json ├── PLXUTILS-125.json ├── PLXUTILS-126.json ├── PLXUTILS-127.json ├── PLXUTILS-128.json ├── PLXUTILS-129.json ├── PLXUTILS-13.json ├── PLXUTILS-130.json ├── PLXUTILS-131.json ├── PLXUTILS-132.json ├── PLXUTILS-133.json ├── PLXUTILS-134.json ├── PLXUTILS-135.json ├── PLXUTILS-136.json ├── PLXUTILS-137.json ├── PLXUTILS-138.json ├── PLXUTILS-139.json ├── PLXUTILS-14.json ├── PLXUTILS-140.json ├── PLXUTILS-141.json ├── PLXUTILS-142.json ├── PLXUTILS-143.json ├── PLXUTILS-144.json ├── PLXUTILS-145.json ├── PLXUTILS-146.json ├── PLXUTILS-147.json ├── PLXUTILS-148.json ├── PLXUTILS-149.json ├── PLXUTILS-15.json ├── PLXUTILS-150.json ├── PLXUTILS-151.json ├── PLXUTILS-152.json ├── PLXUTILS-153.json ├── PLXUTILS-154.json ├── PLXUTILS-155.json ├── PLXUTILS-156.json ├── PLXUTILS-157.json ├── PLXUTILS-158.json ├── PLXUTILS-159.json ├── PLXUTILS-16.json ├── PLXUTILS-160.json ├── PLXUTILS-161.json ├── PLXUTILS-162.json ├── PLXUTILS-163.json ├── PLXUTILS-164.json ├── PLXUTILS-165.json ├── PLXUTILS-166.json ├── PLXUTILS-167.json ├── PLXUTILS-168.json ├── PLXUTILS-169.json ├── PLXUTILS-17.json ├── PLXUTILS-170.json ├── PLXUTILS-171.json ├── PLXUTILS-172.json ├── PLXUTILS-173.json ├── PLXUTILS-18.json ├── PLXUTILS-19.json ├── PLXUTILS-2.json ├── PLXUTILS-20.json ├── PLXUTILS-21.json ├── PLXUTILS-22.json ├── PLXUTILS-23.json ├── PLXUTILS-24.json ├── PLXUTILS-25.json ├── PLXUTILS-26.json ├── PLXUTILS-27.json ├── PLXUTILS-28.json ├── PLXUTILS-29.json ├── PLXUTILS-3.json ├── PLXUTILS-30.json ├── PLXUTILS-31.json ├── PLXUTILS-32.json ├── PLXUTILS-33.json ├── PLXUTILS-34.json ├── PLXUTILS-35.json ├── PLXUTILS-36.json ├── PLXUTILS-37.json ├── PLXUTILS-38.json ├── PLXUTILS-39.json ├── PLXUTILS-4.json ├── PLXUTILS-40.json ├── PLXUTILS-41.json ├── PLXUTILS-42.json ├── PLXUTILS-43.json ├── PLXUTILS-44.json ├── PLXUTILS-45.json ├── PLXUTILS-46.json ├── PLXUTILS-47.json ├── PLXUTILS-48.json ├── PLXUTILS-49.json ├── PLXUTILS-5.json ├── PLXUTILS-50.json ├── PLXUTILS-51.json ├── PLXUTILS-52.json ├── PLXUTILS-53.json ├── PLXUTILS-54.json ├── PLXUTILS-55.json ├── PLXUTILS-56.json ├── PLXUTILS-57.json ├── PLXUTILS-58.json ├── PLXUTILS-59.json ├── PLXUTILS-6.json ├── PLXUTILS-60.json ├── PLXUTILS-61.json ├── PLXUTILS-62.json ├── PLXUTILS-63.json ├── PLXUTILS-64.json ├── PLXUTILS-65.json ├── PLXUTILS-66.json ├── PLXUTILS-67.json ├── PLXUTILS-68.json ├── PLXUTILS-69.json ├── PLXUTILS-7.json ├── PLXUTILS-70.json ├── PLXUTILS-71.json ├── PLXUTILS-72.json ├── PLXUTILS-73.json ├── PLXUTILS-74.json ├── PLXUTILS-75.json ├── PLXUTILS-76.json ├── PLXUTILS-77.json ├── PLXUTILS-78.json ├── PLXUTILS-79.json ├── PLXUTILS-8.json ├── PLXUTILS-80.json ├── PLXUTILS-81.json ├── PLXUTILS-82.json ├── PLXUTILS-83.json ├── PLXUTILS-84.json ├── PLXUTILS-85.json ├── PLXUTILS-86.json ├── PLXUTILS-87.json ├── PLXUTILS-88.json ├── PLXUTILS-89.json ├── PLXUTILS-9.json ├── PLXUTILS-90.json ├── PLXUTILS-91.json ├── PLXUTILS-92.json ├── PLXUTILS-93.json ├── PLXUTILS-94.json ├── PLXUTILS-95.json ├── PLXUTILS-96.json ├── PLXUTILS-97.json ├── PLXUTILS-98.json └── PLXUTILS-99.json ├── pom.xml └── src ├── main ├── java │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── util │ │ ├── AbstractScanner.java │ │ ├── Base64.java │ │ ├── CachedMap.java │ │ ├── CollectionUtils.java │ │ ├── DirectoryScanner.java │ │ ├── DirectoryWalkListener.java │ │ ├── DirectoryWalker.java │ │ ├── ExceptionUtils.java │ │ ├── Expand.java │ │ ├── FastMap.java │ │ ├── FileUtils.java │ │ ├── IOUtil.java │ │ ├── InterpolationFilterReader.java │ │ ├── Java7Detector.java │ │ ├── LineOrientedInterpolatingReader.java │ │ ├── MatchPattern.java │ │ ├── MatchPatterns.java │ │ ├── NioFiles.java │ │ ├── Os.java │ │ ├── PathTool.java │ │ ├── PropertyUtils.java │ │ ├── ReaderFactory.java │ │ ├── ReflectionUtils.java │ │ ├── Scanner.java │ │ ├── SelectorUtils.java │ │ ├── StringInputStream.java │ │ ├── StringOutputStream.java │ │ ├── StringUtils.java │ │ ├── SweeperPool.java │ │ ├── TypeFormat.java │ │ ├── WriterFactory.java │ │ ├── cli │ │ ├── AbstractStreamHandler.java │ │ ├── Arg.java │ │ ├── CommandLineCallable.java │ │ ├── CommandLineException.java │ │ ├── CommandLineTimeOutException.java │ │ ├── CommandLineUtils.java │ │ ├── Commandline.java │ │ ├── DefaultConsumer.java │ │ ├── EnhancedStringTokenizer.java │ │ ├── ShutdownHookUtils.java │ │ ├── StreamConsumer.java │ │ ├── StreamFeeder.java │ │ ├── StreamPumper.java │ │ ├── WriterStreamConsumer.java │ │ └── shell │ │ │ ├── BourneShell.java │ │ │ ├── CmdShell.java │ │ │ ├── CommandShell.java │ │ │ └── Shell.java │ │ ├── dag │ │ ├── CycleDetectedException.java │ │ ├── CycleDetector.java │ │ ├── DAG.java │ │ ├── TopologicalSorter.java │ │ └── Vertex.java │ │ ├── introspection │ │ ├── ClassMap.java │ │ ├── MethodMap.java │ │ └── ReflectionValueExtractor.java │ │ ├── io │ │ ├── InputStreamFacade.java │ │ ├── RawInputStreamFacade.java │ │ └── URLInputStreamFacade.java │ │ ├── reflection │ │ ├── Reflector.java │ │ └── ReflectorException.java │ │ └── xml │ │ ├── CompactXMLWriter.java │ │ ├── PrettyPrintXMLWriter.java │ │ ├── SerializerXMLWriter.java │ │ ├── XMLWriter.java │ │ ├── XmlReader.java │ │ ├── XmlReaderException.java │ │ ├── XmlStreamReader.java │ │ ├── XmlStreamReaderException.java │ │ ├── XmlStreamWriter.java │ │ ├── XmlUtil.java │ │ ├── XmlWriterUtil.java │ │ ├── Xpp3Dom.java │ │ ├── Xpp3DomBuilder.java │ │ ├── Xpp3DomUtils.java │ │ ├── Xpp3DomWriter.java │ │ └── pull │ │ ├── EntityReplacementMap.java │ │ ├── MXParser.java │ │ ├── MXSerializer.java │ │ ├── XmlPullParser.java │ │ ├── XmlPullParserException.java │ │ └── XmlSerializer.java ├── javadoc │ └── org │ │ └── codehaus │ │ └── plexus │ │ └── util │ │ ├── cli │ │ ├── package.html │ │ └── shell │ │ │ └── package.html │ │ ├── dag │ │ └── package.html │ │ ├── interpolation │ │ └── package.html │ │ ├── introspection │ │ └── package.html │ │ ├── io │ │ └── package.html │ │ ├── package.html │ │ ├── reflection │ │ └── package.html │ │ └── xml │ │ ├── package.html │ │ └── pull │ │ └── package.html └── resources │ ├── META-INF │ ├── LICENSE │ └── NOTICE │ └── licenses │ ├── extreme.indiana.edu.license.TXT │ ├── javolution.license.TXT │ └── thoughtworks.TXT ├── site └── site.xml └── test ├── java └── org │ └── codehaus │ └── plexus │ └── util │ ├── AbstractTestThread.java │ ├── CollectionUtilsTest.java │ ├── DirectoryScannerTest.java │ ├── DirectoryWalkerTest.java │ ├── FileBasedTestCase.java │ ├── FileUtilsTest.java │ ├── IOUtilTest.java │ ├── InterpolationFilterReaderTest.java │ ├── LineOrientedInterpolatingReaderTest.java │ ├── MatchPatternTest.java │ ├── MatchPatternsTest.java │ ├── OsTest.java │ ├── PathToolTest.java │ ├── PerfTest.java │ ├── ReflectionUtilsTest.java │ ├── SelectorUtilsTest.java │ ├── StringInputStreamTest.java │ ├── StringUtilsTest.java │ ├── SweeperPoolTest.java │ ├── TestThreadManager.java │ ├── Tracer.java │ ├── WalkCollector.java │ ├── cli │ ├── CommandLineUtilsTest.java │ ├── CommandlineTest.java │ ├── DefaultConsumerTest.java │ ├── EnhancedStringTokenizerTest.java │ ├── StreamPumperTest.java │ └── shell │ │ └── BourneShellTest.java │ ├── dag │ ├── CycleDetectedExceptionTest.java │ ├── CycleDetectorTest.java │ ├── DAGTest.java │ ├── TopologicalSorterTest.java │ └── VertexTest.java │ ├── introspection │ └── ReflectionValueExtractorTest.java │ ├── reflection │ └── ReflectorTest.java │ └── xml │ ├── PrettyPrintXMLWriterTest.java │ ├── XmlStreamReaderTest.java │ ├── XmlStreamWriterTest.java │ ├── XmlUtilTest.java │ ├── XmlWriterUtilTest.java │ ├── Xpp3DomBuilderTest.java │ ├── Xpp3DomTest.java │ ├── Xpp3DomUtilsTest.java │ ├── Xpp3DomWriterTest.java │ └── pull │ └── MXParserTest.java └── resources ├── dir-layout-copy ├── dir1 │ ├── dir2 │ │ └── .gitignore │ └── foo.txt └── empty-dir │ └── .gitignore ├── directory-scanner └── foo │ └── bar │ └── munchy.txt ├── directorywalker ├── directory1 │ └── file1.txt ├── directory2 │ ├── directory21 │ │ └── file21.txt │ └── file2.txt └── file.txt ├── symlinks ├── dirOnTheOutside │ └── FileInDirOnTheOutside.txt ├── onTheOutside.txt ├── regen.sh ├── src │ ├── aRegularDir │ │ └── aRegularFile.txt │ ├── fileR.txt │ ├── fileW.txt │ ├── fileX.txt │ ├── symDir │ ├── symLinkToDirOnTheOutside │ ├── symLinkToFileOnTheOutside │ ├── symR │ ├── symW │ ├── symX │ └── targetDir │ │ └── targetFile.txt ├── symlinks.tar └── symlinks.zip ├── test.txt ├── test.xdoc.xhtml └── testDocument.xhtml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | *.java text diff=java 5 | *.html text diff=html 6 | *.css text 7 | *.js text 8 | *.sql text 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .project 3 | .classpath 4 | .settings/ 5 | bin 6 | *.iml 7 | *.ipr 8 | *.iws 9 | *.idea 10 | release.properties 11 | .java-version 12 | 13 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | This product includes software developed by 2 | The Apache Software Foundation (http://www.apache.org/). 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Plexus-archiver 2 | =============== 3 | 4 | The current master is now at https://github.com/codehaus-plexus/plexus-utils 5 | -------------------------------------------------------------------------------- /jira/PLXUTILS-104.json: -------------------------------------------------------------------------------- 1 | {"expand":"renderedFields,names,schema,transitions,operations,editmeta,changelog","id":"81935","self":"http://jira.codehaus.org/rest/api/latest/issue/81935","key":"PLXUTILS-104","fields":{"progress":{"progress":0,"total":0},"summary":"Clonning of Commandline/Shell don't clonning shellCommand that leads to unclear error.","timetracking":{},"issuetype":{"self":"http://jira.codehaus.org/rest/api/2/issuetype/1","id":"1","description":"A problem which impairs or prevents the functions of the product.","iconUrl":"http://jira.codehaus.org/images/icons/issuetypes/bug.png","name":"Bug","subtask":false},"customfield_10110":null,"votes":{"self":"http://jira.codehaus.org/rest/api/2/issue/PLXUTILS-104/votes","votes":0,"hasVoted":false},"resolution":{"self":"http://jira.codehaus.org/rest/api/2/resolution/2","id":"2","description":"The problem described is an issue which will never be fixed.","name":"Won't Fix"},"fixVersions":[],"resolutiondate":"2014-11-25T14:30:33.624-0600","customfield_10210":"0.0","timespent":null,"reporter":{"self":"http://jira.codehaus.org/rest/api/2/user?username=newfield","name":"newfield","emailAddress":"michael.neifeld@gmail.com","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/useravatar?size=xsmall&avatarId=10232","24x24":"http://jira.codehaus.org/secure/useravatar?size=small&avatarId=10232","32x32":"http://jira.codehaus.org/secure/useravatar?size=medium&avatarId=10232","48x48":"http://jira.codehaus.org/secure/useravatar?avatarId=10232"},"displayName":"Michael Neifeld","active":true},"aggregatetimeoriginalestimate":null,"customfield_10161":["newfield(newfield)","michael-o(michael-o)"],"customfield_10160":null,"updated":"2014-11-25T14:30:33.672-0600","created":"2009-02-19T01:06:55.039-0600","description":null,"priority":{"self":"http://jira.codehaus.org/rest/api/2/priority/3","iconUrl":"http://jira.codehaus.org/images/icons/priorities/major.png","name":"Major","id":"3"},"duedate":null,"issuelinks":[],"customfield_10163":"4320000","watches":{"self":"http://jira.codehaus.org/rest/api/2/issue/PLXUTILS-104/watchers","watchCount":1,"isWatching":false},"worklog":{"startAt":0,"maxResults":20,"total":0,"worklogs":[]},"subtasks":[],"status":{"self":"http://jira.codehaus.org/rest/api/2/status/6","description":"The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.","iconUrl":"http://jira.codehaus.org/images/icons/statuses/closed.png","name":"Closed","id":"6"},"customfield_10090":null,"labels":[],"workratio":-1,"assignee":null,"attachment":[],"customfield_10221":null,"customfield_10220":null,"customfield_10200":null,"aggregatetimeestimate":null,"customfield_10190":null,"project":{"self":"http://jira.codehaus.org/rest/api/2/project/11432","id":"11432","key":"PLXUTILS","name":"Plexus Utils","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/projectavatar?size=xsmall&pid=11432&avatarId=10011","24x24":"http://jira.codehaus.org/secure/projectavatar?size=small&pid=11432&avatarId=10011","32x32":"http://jira.codehaus.org/secure/projectavatar?size=medium&pid=11432&avatarId=10011","48x48":"http://jira.codehaus.org/secure/projectavatar?pid=11432&avatarId=10011"},"projectCategory":{"self":"http://jira.codehaus.org/rest/api/2/projectCategory/10003","id":"10003","description":"various containers","name":"containers"}},"versions":[{"self":"http://jira.codehaus.org/rest/api/2/version/14438","id":"14438","description":"","name":"1.5.6","archived":false,"released":true,"releaseDate":"2008-08-01"}],"customfield_10170":null,"environment":"Windows XP, Java 5","timeestimate":null,"customfield_10130":null,"aggregateprogress":{"progress":0,"total":0},"lastViewed":null,"components":[],"comment":{"startAt":0,"maxResults":1,"total":1,"comments":[{"self":"http://jira.codehaus.org/rest/api/2/issue/81935/comment/357246","id":"357246","author":{"self":"http://jira.codehaus.org/rest/api/2/user?username=michael-o","name":"michael-o","emailAddress":"1983-01-06@gmx.net","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/useravatar?size=xsmall&avatarId=10232","24x24":"http://jira.codehaus.org/secure/useravatar?size=small&avatarId=10232","32x32":"http://jira.codehaus.org/secure/useravatar?size=medium&avatarId=10232","48x48":"http://jira.codehaus.org/secure/useravatar?avatarId=10232"},"displayName":"Michael Osipov","active":true},"body":"Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.","updateAuthor":{"self":"http://jira.codehaus.org/rest/api/2/user?username=michael-o","name":"michael-o","emailAddress":"1983-01-06@gmx.net","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/useravatar?size=xsmall&avatarId=10232","24x24":"http://jira.codehaus.org/secure/useravatar?size=small&avatarId=10232","32x32":"http://jira.codehaus.org/secure/useravatar?size=medium&avatarId=10232","48x48":"http://jira.codehaus.org/secure/useravatar?avatarId=10232"},"displayName":"Michael Osipov","active":true},"created":"2014-11-25T14:30:33.649-0600","updated":"2014-11-25T14:30:33.649-0600"}]},"timeoriginalestimate":null,"aggregatetimespent":null}} -------------------------------------------------------------------------------- /jira/PLXUTILS-106.json: -------------------------------------------------------------------------------- 1 | {"expand":"renderedFields,names,schema,transitions,operations,editmeta,changelog","id":"85749","self":"http://jira.codehaus.org/rest/api/latest/issue/85749","key":"PLXUTILS-106","fields":{"progress":{"progress":0,"total":0},"summary":"Distinct CommandLineException when process is killed on timeOut","timetracking":{},"issuetype":{"self":"http://jira.codehaus.org/rest/api/2/issuetype/4","id":"4","description":"An improvement or enhancement to an existing feature or task.","iconUrl":"http://jira.codehaus.org/images/icons/issuetypes/improvement.png","name":"Improvement","subtask":false},"customfield_10110":null,"votes":{"self":"http://jira.codehaus.org/rest/api/2/issue/PLXUTILS-106/votes","votes":0,"hasVoted":false},"resolution":{"self":"http://jira.codehaus.org/rest/api/2/resolution/1","id":"1","description":"A fix for this issue is checked into the tree and tested.","name":"Fixed"},"fixVersions":[{"self":"http://jira.codehaus.org/rest/api/2/version/15258","id":"15258","description":"","name":"1.5.9","archived":false,"released":true,"releaseDate":"2009-04-28"}],"resolutiondate":"2009-04-28T16:06:47.525-0500","customfield_10210":"0.0","timespent":null,"reporter":{"self":"http://jira.codehaus.org/rest/api/2/user?username=ndeloof","name":"ndeloof","emailAddress":"nicolas.deloof@gmail.com","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/useravatar?size=xsmall&ownerId=ndeloof&avatarId=10411","24x24":"http://jira.codehaus.org/secure/useravatar?size=small&ownerId=ndeloof&avatarId=10411","32x32":"http://jira.codehaus.org/secure/useravatar?size=medium&ownerId=ndeloof&avatarId=10411","48x48":"http://jira.codehaus.org/secure/useravatar?ownerId=ndeloof&avatarId=10411"},"displayName":"nicolas de loof","active":true},"aggregatetimeoriginalestimate":null,"customfield_10161":["ndeloof(ndeloof)","olamy(olamy)"],"customfield_10160":null,"updated":"2009-04-28T16:06:47.521-0500","created":"2009-04-25T09:09:07.025-0500","description":"When running a forked process with plexus-utils using timeOut, there is no way (only can check the exception getMessage()) to disctinct error from timeOut. A CommandLineException class hierarchy would be great for finest execution check.","priority":{"self":"http://jira.codehaus.org/rest/api/2/priority/4","iconUrl":"http://jira.codehaus.org/images/icons/priorities/minor.png","name":"Minor","id":"4"},"duedate":null,"issuelinks":[],"customfield_10163":"180662400","watches":{"self":"http://jira.codehaus.org/rest/api/2/issue/PLXUTILS-106/watchers","watchCount":0,"isWatching":false},"worklog":{"startAt":0,"maxResults":20,"total":0,"worklogs":[]},"subtasks":[],"status":{"self":"http://jira.codehaus.org/rest/api/2/status/6","description":"The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.","iconUrl":"http://jira.codehaus.org/images/icons/statuses/closed.png","name":"Closed","id":"6"},"customfield_10090":null,"labels":[],"workratio":-1,"assignee":{"self":"http://jira.codehaus.org/rest/api/2/user?username=olamy","name":"olamy","emailAddress":"olamy@apache.org","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/useravatar?size=xsmall&avatarId=10232","24x24":"http://jira.codehaus.org/secure/useravatar?size=small&avatarId=10232","32x32":"http://jira.codehaus.org/secure/useravatar?size=medium&avatarId=10232","48x48":"http://jira.codehaus.org/secure/useravatar?avatarId=10232"},"displayName":"Olivier Lamy","active":true},"attachment":[],"customfield_10221":null,"customfield_10220":null,"customfield_10200":null,"aggregatetimeestimate":null,"customfield_10190":null,"project":{"self":"http://jira.codehaus.org/rest/api/2/project/11432","id":"11432","key":"PLXUTILS","name":"Plexus Utils","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/projectavatar?size=xsmall&pid=11432&avatarId=10011","24x24":"http://jira.codehaus.org/secure/projectavatar?size=small&pid=11432&avatarId=10011","32x32":"http://jira.codehaus.org/secure/projectavatar?size=medium&pid=11432&avatarId=10011","48x48":"http://jira.codehaus.org/secure/projectavatar?pid=11432&avatarId=10011"},"projectCategory":{"self":"http://jira.codehaus.org/rest/api/2/projectCategory/10003","id":"10003","description":"various containers","name":"containers"}},"versions":[{"self":"http://jira.codehaus.org/rest/api/2/version/14438","id":"14438","description":"","name":"1.5.6","archived":false,"released":true,"releaseDate":"2008-08-01"}],"customfield_10170":null,"environment":null,"timeestimate":null,"customfield_10130":null,"aggregateprogress":{"progress":0,"total":0},"lastViewed":null,"components":[],"comment":{"startAt":0,"maxResults":0,"total":0,"comments":[]},"timeoriginalestimate":null,"aggregatetimespent":null}} -------------------------------------------------------------------------------- /jira/PLXUTILS-108.json: -------------------------------------------------------------------------------- 1 | {"expand":"renderedFields,names,schema,transitions,operations,editmeta,changelog","id":"86410","self":"http://jira.codehaus.org/rest/api/latest/issue/86410","key":"PLXUTILS-108","fields":{"progress":{"progress":0,"total":0},"summary":"Javadoc for org.codehaus.plexus.util.dag package","timetracking":{},"issuetype":{"self":"http://jira.codehaus.org/rest/api/2/issuetype/4","id":"4","description":"An improvement or enhancement to an existing feature or task.","iconUrl":"http://jira.codehaus.org/images/icons/issuetypes/improvement.png","name":"Improvement","subtask":false},"customfield_10110":null,"votes":{"self":"http://jira.codehaus.org/rest/api/2/issue/PLXUTILS-108/votes","votes":0,"hasVoted":false},"resolution":null,"fixVersions":[],"resolutiondate":null,"customfield_10210":"0.0","timespent":null,"reporter":{"self":"http://jira.codehaus.org/rest/api/2/user?username=james.w.dumay","name":"james.w.dumay","emailAddress":"james@atlassian.com","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/useravatar?size=xsmall&avatarId=10232","24x24":"http://jira.codehaus.org/secure/useravatar?size=small&avatarId=10232","32x32":"http://jira.codehaus.org/secure/useravatar?size=medium&avatarId=10232","48x48":"http://jira.codehaus.org/secure/useravatar?avatarId=10232"},"displayName":"James William Dumay","active":true},"aggregatetimeoriginalestimate":null,"customfield_10161":["james.w.dumay(james.w.dumay)"],"customfield_10160":null,"updated":"2009-05-10T22:15:12.465-0500","created":"2009-05-10T22:15:12.465-0500","description":"It would be really useful to have more Javadoc for the org.codehaus.plexus.util.dag package in plexus-utils.","priority":{"self":"http://jira.codehaus.org/rest/api/2/priority/3","iconUrl":"http://jira.codehaus.org/images/icons/priorities/major.png","name":"Major","id":"3"},"duedate":null,"issuelinks":[],"customfield_10163":"179280000","watches":{"self":"http://jira.codehaus.org/rest/api/2/issue/PLXUTILS-108/watchers","watchCount":1,"isWatching":false},"worklog":{"startAt":0,"maxResults":20,"total":0,"worklogs":[]},"subtasks":[],"status":{"self":"http://jira.codehaus.org/rest/api/2/status/1","description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"http://jira.codehaus.org/images/icons/statuses/open.png","name":"Open","id":"1"},"customfield_10090":null,"labels":[],"workratio":-1,"assignee":null,"attachment":[],"customfield_10221":null,"customfield_10220":null,"customfield_10200":null,"aggregatetimeestimate":null,"customfield_10190":null,"project":{"self":"http://jira.codehaus.org/rest/api/2/project/11432","id":"11432","key":"PLXUTILS","name":"Plexus Utils","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/projectavatar?size=xsmall&pid=11432&avatarId=10011","24x24":"http://jira.codehaus.org/secure/projectavatar?size=small&pid=11432&avatarId=10011","32x32":"http://jira.codehaus.org/secure/projectavatar?size=medium&pid=11432&avatarId=10011","48x48":"http://jira.codehaus.org/secure/projectavatar?pid=11432&avatarId=10011"},"projectCategory":{"self":"http://jira.codehaus.org/rest/api/2/projectCategory/10003","id":"10003","description":"various containers","name":"containers"}},"versions":[{"self":"http://jira.codehaus.org/rest/api/2/version/15258","id":"15258","description":"","name":"1.5.9","archived":false,"released":true,"releaseDate":"2009-04-28"}],"customfield_10170":null,"environment":null,"timeestimate":null,"customfield_10130":null,"aggregateprogress":{"progress":0,"total":0},"lastViewed":null,"components":[],"comment":{"startAt":0,"maxResults":0,"total":0,"comments":[]},"timeoriginalestimate":null,"aggregatetimespent":null}} -------------------------------------------------------------------------------- /jira/PLXUTILS-119.json: -------------------------------------------------------------------------------- 1 | {"expand":"renderedFields,names,schema,transitions,operations,editmeta,changelog","id":"98424","self":"http://jira.codehaus.org/rest/api/latest/issue/98424","key":"PLXUTILS-119","fields":{"progress":{"progress":0,"total":86400,"percent":0},"summary":"org/codehaus/plexus/archiver/ArchiverException missing in plexus-archiver plugin","timetracking":{"originalEstimate":"1d","remainingEstimate":"1d","originalEstimateSeconds":86400,"remainingEstimateSeconds":86400},"issuetype":{"self":"http://jira.codehaus.org/rest/api/2/issuetype/1","id":"1","description":"A problem which impairs or prevents the functions of the product.","iconUrl":"http://jira.codehaus.org/images/icons/issuetypes/bug.png","name":"Bug","subtask":false},"customfield_10110":null,"votes":{"self":"http://jira.codehaus.org/rest/api/2/issue/PLXUTILS-119/votes","votes":0,"hasVoted":false},"resolution":{"self":"http://jira.codehaus.org/rest/api/2/resolution/5","id":"5","description":"All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.","name":"Cannot Reproduce"},"fixVersions":[],"resolutiondate":"2010-10-28T17:54:07.082-0500","customfield_10210":"0.0","timespent":null,"reporter":{"self":"http://jira.codehaus.org/rest/api/2/user?username=mgainty","name":"mgainty","emailAddress":"mgainty@hotmail.com","avatarUrls":{"16x16":"http://jira.codehaus.org/secure/useravatar?size=xsmall&avatarId=10232","24x24":"http://jira.codehaus.org/secure/useravatar?size=small&avatarId=10232","32x32":"http://jira.codehaus.org/secure/useravatar?size=medium&avatarId=10232","48x48":"http://jira.codehaus.org/secure/useravatar?avatarId=10232"},"displayName":"Martin Gainty","active":true},"aggregatetimeoriginalestimate":86400,"customfield_10161":["bentmann(bentmann)","mgainty(mgainty)"],"customfield_10160":null,"updated":"2010-10-28T17:54:07.164-0500","created":"2009-09-30T13:19:30.739-0500","description":"[INFO] Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-dependency-plugin:2.1:resolve-plugins': \nUnable to load the mojo 'org.apache.maven.plugins:maven-dependency-plugin:2.1:resolve-plugins' in the plugin\n'org.apache.maven.plugins:maven-dependency-plugin'. \nA required class is missing:\n org/codehaus/plexus/archiver/ArchiverException\n\nlocate org.codehaus.plexus.archiver.ArchiverException.java\ncompile ArchiverException.java\n 2 | 3 | 18 | 19 | 20 | 4.0.0 21 | 22 | 23 | org.codehaus.plexus 24 | plexus 25 | 3.3.1 26 | 27 | 28 | plexus-utils 29 | 3.0.22-SNAPSHOT 30 | 31 | Plexus Common Utilities 32 | A collection of various utility classes to ease working with strings, files, command lines, XML and 33 | more. 34 | 35 | http://plexus.codehaus.org/plexus-utils 36 | 37 | 38 | scm:git:git@github.com:sonatype/plexus-utils.git 39 | scm:git:git@github.com:sonatype/plexus-utils.git 40 | http://github.com/sonatype/plexus-utils 41 | HEAD 42 | 43 | 44 | JIRA 45 | http://jira.codehaus.org/browse/PLXUTILS 46 | 47 | 48 | 49 | 50 | org.apache.maven.shared 51 | maven-plugin-testing-harness 52 | 1.1 53 | test 54 | 55 | 56 | 57 | 58 | 59 | org.apache.maven.plugins 60 | maven-surefire-plugin 61 | 62 | 63 | true 64 | 65 | org/codehaus/plexus/util/FileBasedTestCase.java 66 | **/Test*.java 67 | 68 | 69 | 70 | JAVA_HOME 71 | ${JAVA_HOME} 72 | 73 | 74 | M2_HOME 75 | ${M2_HOME} 76 | 77 | 78 | 79 | 80 | 81 | org.apache.maven.plugins 82 | maven-enforcer-plugin 83 | 1.1.1 84 | 85 | 86 | enforce-java 87 | 88 | enforce 89 | 90 | 91 | 92 | 93 | 1.7.0 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | org.apache.maven.plugins 102 | maven-compiler-plugin 103 | 104 | 1.5 105 | 1.5 106 | 107 | 108 | 109 | org.apache.maven.plugins 110 | maven-release-plugin 111 | 2.5.1 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/DirectoryWalkListener.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | 21 | /** 22 | * Observes the actions of a {@link DirectoryWalker}. 23 | * @version $Id$ 24 | * @see DirectoryWalker 25 | */ 26 | public interface DirectoryWalkListener 27 | { 28 | /** 29 | * The directory walking has begun. 30 | * 31 | * @param basedir the basedir that walk started in. 32 | */ 33 | void directoryWalkStarting( File basedir ); 34 | 35 | /** 36 | * The included entry that was encountered. 37 | * 38 | * @param percentage rough percentage of the walk completed. (inaccurate) 39 | * @param file the file that was included. 40 | */ 41 | void directoryWalkStep( int percentage, File file ); 42 | 43 | /** 44 | * The directory walking has finished. 45 | */ 46 | void directoryWalkFinished(); 47 | 48 | void debug( String message ); 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/Java7Detector.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright 2011 The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | * Java7 feature detection 21 | * 22 | * @author Kristian Rosenvold 23 | */ 24 | class Java7Detector 25 | { 26 | 27 | private static final boolean isJava7; 28 | 29 | static 30 | { 31 | boolean isJava7x = true; 32 | try 33 | { 34 | Class.forName( "java.nio.file.Files" ); 35 | } 36 | catch ( Exception e ) 37 | { 38 | isJava7x = false; 39 | } 40 | isJava7 = isJava7x; 41 | } 42 | 43 | 44 | public static boolean isJava7() 45 | { 46 | return isJava7; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/MatchPattern.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | /* 3 | * Copyright The Codehaus Foundation. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import java.io.File; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | import java.util.StringTokenizer; 22 | 23 | /** 24 | * Describes a match target for SelectorUtils. 25 | *

26 | * Significantly more efficient than using strings, since re-evaluation and re-tokenizing is avoided. 27 | * 28 | * @author Kristian Rosenvold 29 | */ 30 | public class MatchPattern 31 | { 32 | private final String source; 33 | 34 | private final String regexPattern; 35 | 36 | private final String separator; 37 | 38 | private final String[] tokenized; 39 | private final char[][] tokenizedChar; 40 | 41 | private MatchPattern( String source, String separator ) 42 | { 43 | regexPattern = SelectorUtils.isRegexPrefixedPattern( source ) ? source.substring( 44 | SelectorUtils.REGEX_HANDLER_PREFIX.length(), 45 | source.length() - SelectorUtils.PATTERN_HANDLER_SUFFIX.length() ) : null; 46 | this.source = 47 | SelectorUtils.isAntPrefixedPattern( source ) 48 | ? source.substring( SelectorUtils.ANT_HANDLER_PREFIX.length(), source.length() 49 | - SelectorUtils.PATTERN_HANDLER_SUFFIX.length() ) 50 | : source; 51 | this.separator = separator; 52 | tokenized = tokenizePathToString( this.source, separator ); 53 | tokenizedChar = new char[tokenized.length][]; 54 | for (int i = 0; i < tokenized.length; i++){ 55 | tokenizedChar[i] = tokenized[i].toCharArray(); 56 | } 57 | 58 | } 59 | 60 | 61 | 62 | public boolean matchPath( String str, boolean isCaseSensitive ) 63 | { 64 | if ( regexPattern != null ) 65 | { 66 | return str.matches( regexPattern ); 67 | } 68 | else 69 | { 70 | return SelectorUtils.matchAntPathPattern( this, str, separator, isCaseSensitive ); 71 | } 72 | } 73 | 74 | boolean matchPath( String str, char[][] strDirs, boolean isCaseSensitive ) 75 | { 76 | if ( regexPattern != null ) 77 | { 78 | return str.matches( regexPattern ); 79 | } 80 | else 81 | { 82 | return SelectorUtils.matchAntPathPattern( getTokenizedPathChars(), strDirs, isCaseSensitive ); 83 | } 84 | } 85 | 86 | public boolean matchPatternStart( String str, boolean isCaseSensitive ) 87 | { 88 | if ( regexPattern != null ) 89 | { 90 | // FIXME: ICK! But we can't do partial matches for regex, so we have to reserve judgement until we have 91 | // a file to deal with, or we can definitely say this is an exclusion... 92 | return true; 93 | } 94 | else 95 | { 96 | String altStr = source.replace( '\\', '/' ); 97 | 98 | return SelectorUtils.matchAntPathPatternStart( this, str, File.separator, isCaseSensitive ) 99 | || SelectorUtils.matchAntPathPatternStart( this, altStr, "/", isCaseSensitive ); 100 | } 101 | } 102 | 103 | public String[] getTokenizedPathString() 104 | { 105 | return tokenized; 106 | } 107 | 108 | public char[][] getTokenizedPathChars() 109 | { 110 | return tokenizedChar; 111 | } 112 | 113 | public boolean startsWith( String string ) 114 | { 115 | return source.startsWith( string ); 116 | } 117 | 118 | 119 | static String[] tokenizePathToString( String path, String separator ) 120 | { 121 | List ret = new ArrayList(); 122 | StringTokenizer st = new StringTokenizer( path, separator ); 123 | while ( st.hasMoreTokens() ) 124 | { 125 | ret.add( st.nextToken() ); 126 | } 127 | return ret.toArray( new String[ret.size()] ); 128 | } 129 | 130 | public static MatchPattern fromString( String source ) 131 | { 132 | return new MatchPattern( source, File.separator ); 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/MatchPatterns.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | /** 8 | * A list of patterns to be matched 9 | * 10 | * @author Kristian Rosenvold 11 | */ 12 | public class MatchPatterns 13 | { 14 | private final MatchPattern[] patterns; 15 | 16 | private MatchPatterns( MatchPattern[] patterns ) 17 | { 18 | this.patterns = patterns; 19 | } 20 | 21 | /** 22 | * Checks these MatchPatterns against a specified string. 23 | *

24 | * Uses far less string tokenization than any of the alternatives. 25 | * 26 | * @param name The name to look for 27 | * @param isCaseSensitive If the comparison is case sensitive 28 | * @return true if any of the supplied patterns match 29 | */ 30 | public boolean matches( String name, boolean isCaseSensitive ) 31 | { 32 | String[] tokenized = MatchPattern.tokenizePathToString( name, File.separator ); 33 | return matches( name, tokenized, isCaseSensitive ); 34 | } 35 | 36 | public boolean matches( String name, String[] tokenizedName, boolean isCaseSensitive ) 37 | { 38 | char[][] tokenizedNameChar = new char[tokenizedName.length][]; 39 | for(int i = 0; i < tokenizedName.length; i++){ 40 | tokenizedNameChar[i] = tokenizedName[i].toCharArray(); 41 | } 42 | for ( MatchPattern pattern : patterns ) 43 | { 44 | if ( pattern.matchPath( name, tokenizedNameChar, isCaseSensitive ) ) 45 | { 46 | return true; 47 | } 48 | } 49 | return false; 50 | } 51 | 52 | public boolean matchesPatternStart( String name, boolean isCaseSensitive ) 53 | { 54 | for ( MatchPattern includesPattern : patterns ) 55 | { 56 | if ( includesPattern.matchPatternStart( name, isCaseSensitive ) ) 57 | { 58 | return true; 59 | } 60 | } 61 | return false; 62 | } 63 | 64 | public static MatchPatterns from( String... sources ) 65 | { 66 | final int length = sources.length; 67 | MatchPattern[] result = new MatchPattern[length]; 68 | for ( int i = 0; i < length; i++ ) 69 | { 70 | result[i] = MatchPattern.fromString( sources[i] ); 71 | } 72 | return new MatchPatterns( result ); 73 | } 74 | 75 | public static MatchPatterns from( Iterable strings ) 76 | { 77 | return new MatchPatterns( getMatchPatterns( strings ) ); 78 | } 79 | 80 | private static MatchPattern[] getMatchPatterns( Iterable items ) 81 | { 82 | List result = new ArrayList(); 83 | for ( String string : items ) 84 | { 85 | result.add( MatchPattern.fromString( string ) ); 86 | } 87 | return result.toArray( new MatchPattern[result.size()] ); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/PropertyUtils.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.util.Properties; 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.InputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | 26 | /** 27 | * Static methods to create Properties loaded from various sources. 28 | * 29 | * @author Jason van Zyl 30 | * @author Michal Maczka 31 | * 32 | * @version $Id$ 33 | */ 34 | public class PropertyUtils 35 | { 36 | 37 | public static Properties loadProperties( URL url ) 38 | { 39 | try 40 | { 41 | return loadProperties( url.openStream() ); 42 | } 43 | catch ( Exception e ) 44 | { 45 | // ignore 46 | } 47 | 48 | return null; 49 | } 50 | 51 | public static Properties loadProperties( File file ) 52 | { 53 | try 54 | { 55 | return loadProperties( new FileInputStream( file ) ); 56 | } 57 | catch ( Exception e ) 58 | { 59 | // ignore 60 | } 61 | 62 | return null; 63 | } 64 | 65 | public static Properties loadProperties( InputStream is ) 66 | { 67 | try 68 | { 69 | Properties properties = new Properties(); 70 | 71 | // Make sure the properties stream is valid 72 | if ( is != null ) 73 | { 74 | properties.load( is ); 75 | } 76 | 77 | return properties; 78 | } 79 | catch ( IOException e ) 80 | { 81 | // ignore 82 | } 83 | finally 84 | { 85 | try 86 | { 87 | if ( is != null ) 88 | { 89 | is.close(); 90 | } 91 | } 92 | catch ( IOException e ) 93 | { 94 | // ignore 95 | } 96 | } 97 | 98 | return null; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/Scanner.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | 21 | /** 22 | * Scan a directory tree for files, with specified inclusions and exclusions. 23 | */ 24 | public interface Scanner 25 | { 26 | 27 | /** 28 | * Sets the list of include patterns to use. All '/' and '\' characters 29 | * are replaced by File.separatorChar, so the separator used 30 | * need not match File.separatorChar. 31 | *

32 | * When a pattern ends with a '/' or '\', "**" is appended. 33 | * 34 | * @param includes A list of include patterns. 35 | * May be null, indicating that all files 36 | * should be included. If a non-null 37 | * list is given, all elements must be 38 | * non-null. 39 | */ 40 | void setIncludes(String[] includes); 41 | 42 | /** 43 | * Sets the list of exclude patterns to use. All '/' and '\' characters 44 | * are replaced by File.separatorChar, so the separator used 45 | * need not match File.separatorChar. 46 | *

47 | * When a pattern ends with a '/' or '\', "**" is appended. 48 | * 49 | * @param excludes A list of exclude patterns. 50 | * May be null, indicating that no files 51 | * should be excluded. If a non-null list is 52 | * given, all elements must be non-null. 53 | */ 54 | void setExcludes(String[] excludes); 55 | 56 | /** 57 | * Adds default exclusions to the current exclusions set. 58 | */ 59 | void addDefaultExcludes(); 60 | 61 | /** 62 | * Scans the base directory for files which match at least one include 63 | * pattern and don't match any exclude patterns. 64 | * 65 | * @exception IllegalStateException if the base directory was set 66 | * incorrectly (i.e. if it is null, doesn't exist, 67 | * or isn't a directory). 68 | */ 69 | void scan(); 70 | 71 | /** 72 | * Returns the names of the files which matched at least one of the 73 | * include patterns and none of the exclude patterns. 74 | * The names are relative to the base directory. 75 | * 76 | * @return the names of the files which matched at least one of the 77 | * include patterns and none of the exclude patterns. 78 | */ 79 | String[] getIncludedFiles(); 80 | 81 | /** 82 | * Returns the names of the directories which matched at least one of the 83 | * include patterns and none of the exclude patterns. 84 | * The names are relative to the base directory. 85 | * 86 | * @return the names of the directories which matched at least one of the 87 | * include patterns and none of the exclude patterns. 88 | */ 89 | String[] getIncludedDirectories(); 90 | 91 | /** 92 | * Returns the base directory to be scanned. 93 | * This is the directory which is scanned recursively. 94 | * 95 | * @return the base directory to be scanned 96 | */ 97 | File getBasedir(); 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/StringOutputStream.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.IOException; 20 | import java.io.OutputStream; 21 | 22 | /** 23 | * Wraps a String as an OutputStream. 24 | * 25 | * @author Emmanuel Venisse 26 | * @version $Id$ 27 | * @deprecated As of version 1.5.2 this class should no longer be used because it does not properly handle character 28 | * encoding. Instead, use {@link java.io.ByteArrayOutputStream#toString(String)}. 29 | */ 30 | public class StringOutputStream 31 | extends OutputStream 32 | { 33 | private StringBuffer buf = new StringBuffer(); 34 | 35 | public void write( byte[] b ) throws IOException 36 | { 37 | buf.append( new String( b ) ); 38 | } 39 | 40 | public void write( byte[] b, int off, int len ) throws IOException 41 | { 42 | buf.append( new String( b, off, len ) ); 43 | } 44 | 45 | public void write( int b ) throws IOException 46 | { 47 | byte[] bytes = new byte[1]; 48 | bytes[0] = (byte)b; 49 | buf.append( new String( bytes ) ); 50 | } 51 | 52 | public String toString() 53 | { 54 | return buf.toString(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/AbstractStreamHandler.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | * @author Kristian Rosenvold 21 | */ 22 | public class AbstractStreamHandler 23 | extends Thread 24 | { 25 | private boolean done; 26 | 27 | private volatile boolean disabled; 28 | 29 | public boolean isDone() 30 | { 31 | return done; 32 | } 33 | 34 | public synchronized void waitUntilDone() 35 | throws InterruptedException 36 | { 37 | while ( !isDone() ) 38 | { 39 | wait(); 40 | } 41 | } 42 | 43 | 44 | protected boolean isDisabled() 45 | { 46 | return disabled; 47 | } 48 | 49 | public void disable() 50 | { 51 | disabled = true; 52 | } 53 | 54 | public void setDone() 55 | { 56 | done = true; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/Arg.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | 21 | public interface Arg 22 | { 23 | void setValue( String value ); 24 | 25 | void setLine( String line ); 26 | 27 | void setFile( File value ); 28 | 29 | String[] getParts(); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/CommandLineCallable.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.util.concurrent.Callable; 20 | 21 | /** 22 | * Callable wrapper that exposes the proper exeception type to the client. 23 | * @author Kristian Rosenvold 24 | */ 25 | public interface CommandLineCallable extends Callable 26 | { 27 | public Integer call() throws CommandLineException; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/CommandLineException.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | * @author Trygve Laugstøl 21 | * @version $Id$ 22 | */ 23 | public class CommandLineException 24 | extends Exception 25 | { 26 | public CommandLineException( String message ) 27 | { 28 | super( message ); 29 | } 30 | 31 | public CommandLineException( String message, Throwable cause ) 32 | { 33 | super( message, cause ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/CommandLineTimeOutException.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | /** 23 | * 24 | * @author olamy 25 | * @since 1.5.9 26 | * @version $Id$ 27 | */ 28 | public class CommandLineTimeOutException 29 | extends CommandLineException 30 | { 31 | 32 | /** 33 | * @param message 34 | */ 35 | public CommandLineTimeOutException( String message ) 36 | { 37 | super( message ); 38 | } 39 | 40 | /** 41 | * @param message 42 | * @param cause 43 | */ 44 | public CommandLineTimeOutException( String message, Throwable cause ) 45 | { 46 | super( message, cause ); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/DefaultConsumer.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | * @author Emmanuel Venisse 21 | * @version $Id$ 22 | */ 23 | public class DefaultConsumer 24 | implements StreamConsumer 25 | { 26 | public void consumeLine( String line ) 27 | { 28 | System.out.println( line ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/EnhancedStringTokenizer.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.util.StringTokenizer; 20 | 21 | /** 22 | * The java.util.StringTokenizer is horribly broken. 23 | * Given the string 1,,,3,,4 (, delim) 24 | * It will return 1,3,4 25 | * Which is clearly wrong - 1,EMPTY,EMPTY,3,EMPTY,4 is what it should return 26 | * @version $Id$ 27 | */ 28 | public final class EnhancedStringTokenizer 29 | { 30 | private StringTokenizer cst = null; 31 | 32 | String cdelim; 33 | 34 | final boolean cdelimSingleChar; 35 | 36 | final char cdelimChar; 37 | 38 | boolean creturnDelims; 39 | 40 | String lastToken = null; 41 | 42 | boolean delimLast = true; 43 | 44 | public EnhancedStringTokenizer( String str ) 45 | { 46 | this( str, " \t\n\r\f", false ); 47 | } 48 | 49 | public EnhancedStringTokenizer( String str, String delim ) 50 | { 51 | this( str, delim, false ); 52 | } 53 | 54 | public EnhancedStringTokenizer( String str, String delim, boolean returnDelims ) 55 | { 56 | cst = new StringTokenizer( str, delim, true ); 57 | cdelim = delim; 58 | creturnDelims = returnDelims; 59 | cdelimSingleChar = ( delim.length() == 1 ); 60 | cdelimChar = delim.charAt( 0 ); 61 | } 62 | 63 | public boolean hasMoreTokens() 64 | { 65 | return cst.hasMoreTokens(); 66 | } 67 | 68 | private String internalNextToken() 69 | { 70 | if ( lastToken != null ) 71 | { 72 | String last = lastToken; 73 | lastToken = null; 74 | return last; 75 | } 76 | 77 | String token = cst.nextToken(); 78 | if ( isDelim( token ) ) 79 | { 80 | if ( delimLast ) 81 | { 82 | lastToken = token; 83 | return ""; 84 | } 85 | else 86 | { 87 | delimLast = true; 88 | return token; 89 | } 90 | } 91 | else 92 | { 93 | delimLast = false; 94 | return token; 95 | } 96 | } 97 | 98 | public String nextToken() 99 | { 100 | String token = internalNextToken(); 101 | if ( creturnDelims ) 102 | { 103 | return token; 104 | } 105 | if ( isDelim( token ) ) 106 | { 107 | return hasMoreTokens() ? internalNextToken() : ""; 108 | } 109 | else 110 | { 111 | return token; 112 | } 113 | } 114 | 115 | private boolean isDelim( String str ) 116 | { 117 | if ( str.length() == 1 ) 118 | { 119 | char ch = str.charAt( 0 ); 120 | if ( cdelimSingleChar ) 121 | { 122 | if ( cdelimChar == ch ) 123 | { 124 | return true; 125 | } 126 | } 127 | else 128 | { 129 | if ( cdelim.indexOf( ch ) >= 0 ) 130 | { 131 | return true; 132 | } 133 | } 134 | } 135 | return false; 136 | 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/ShutdownHookUtils.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.security.AccessControlException; 20 | 21 | /** 22 | * A shutdown hook that does not throw any exceptions upon container startup/shutdown or security manager 23 | * restrictions. 24 | * 25 | * Incorrect usage of the hook itself may still throw an exception. 26 | * 27 | * @author Kristian Rosenvold 28 | */ 29 | class ShutdownHookUtils 30 | { 31 | 32 | public static void addShutDownHook( Thread hook ) 33 | { 34 | try 35 | { 36 | Runtime.getRuntime().addShutdownHook( hook ); 37 | } 38 | catch ( IllegalStateException ignore ) 39 | { 40 | } 41 | catch ( AccessControlException ignore ) 42 | { 43 | } 44 | 45 | 46 | } 47 | 48 | public static void removeShutdownHook( Thread hook ) 49 | { 50 | try 51 | { 52 | Runtime.getRuntime().removeShutdownHook( hook ); 53 | } 54 | catch ( IllegalStateException ignore ) 55 | { 56 | } 57 | catch ( AccessControlException ignore ) 58 | { 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/StreamConsumer.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /******************************************************************************** 20 | * CruiseControl, a Continuous Integration Toolkit 21 | * Copyright (c) 2003, ThoughtWorks, Inc. 22 | * 651 W Washington Ave. Suite 500 23 | * Chicago, IL 60661 USA 24 | * All rights reserved. 25 | * 26 | * Redistribution and use in source and binary forms, with or without 27 | * modification, are permitted provided that the following conditions 28 | * are met: 29 | * 30 | * + Redistributions of source code must retain the above copyright 31 | * notice, this list of conditions and the following disclaimer. 32 | * 33 | * + Redistributions in binary form must reproduce the above 34 | * copyright notice, this list of conditions and the following 35 | * disclaimer in the documentation and/or other materials provided 36 | * with the distribution. 37 | * 38 | * + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the 39 | * names of its contributors may be used to endorse or promote 40 | * products derived from this software without specific prior 41 | * written permission. 42 | * 43 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 44 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 45 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 46 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 47 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 48 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 49 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 50 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 51 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 52 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 53 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 | ********************************************************************************/ 55 | 56 | /** 57 | * Works in concert with the StreamPumper class to 58 | * allow implementations to gain access to the lines being 59 | * "Pumped". 60 | * 61 | * Please note that implementations of this interface can be expected to be 62 | * called from arbitrary threads and must therefore be threadsafe. 63 | * 64 | * @author Florin Vancea 65 | * @author Paul Julius 66 | * @version $Id$ 67 | */ 68 | public interface StreamConsumer 69 | { 70 | /** 71 | * Called when the StreamPumper pumps a line from the Stream. 72 | */ 73 | public void consumeLine( String line ); 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/StreamFeeder.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | import java.io.OutputStream; 22 | 23 | /** 24 | * Read from an InputStream and write the output to an OutputStream. 25 | * 26 | * @author Trygve Laugstøl 27 | * @version $Id$ 28 | */ 29 | public class StreamFeeder extends AbstractStreamHandler { 30 | private InputStream input; 31 | 32 | private OutputStream output; 33 | 34 | 35 | /** 36 | * Create a new StreamFeeder 37 | * 38 | * @param input Stream to read from 39 | * @param output Stream to write to 40 | */ 41 | public StreamFeeder( InputStream input, OutputStream output ) 42 | { 43 | this.input = input; 44 | 45 | this.output = output; 46 | } 47 | 48 | // ---------------------------------------------------------------------- 49 | // Runnable implementation 50 | // ---------------------------------------------------------------------- 51 | 52 | public void run() 53 | { 54 | try 55 | { 56 | feed(); 57 | } 58 | catch ( Throwable ex ) 59 | { 60 | // Catched everything so the streams will be closed and flagged as done. 61 | } 62 | finally 63 | { 64 | close(); 65 | 66 | synchronized ( this ) 67 | { 68 | setDone(); 69 | 70 | this.notifyAll(); 71 | } 72 | } 73 | } 74 | 75 | // ---------------------------------------------------------------------- 76 | // 77 | // ---------------------------------------------------------------------- 78 | 79 | public void close() 80 | { 81 | if ( input != null ) 82 | { 83 | synchronized ( input ) 84 | { 85 | try 86 | { 87 | input.close(); 88 | } 89 | catch ( IOException ex ) 90 | { 91 | // ignore 92 | } 93 | 94 | input = null; 95 | } 96 | } 97 | 98 | if ( output != null ) 99 | { 100 | synchronized ( output ) 101 | { 102 | try 103 | { 104 | output.close(); 105 | } 106 | catch ( IOException ex ) 107 | { 108 | // ignore 109 | } 110 | 111 | output = null; 112 | } 113 | } 114 | } 115 | 116 | // ---------------------------------------------------------------------- 117 | // 118 | // ---------------------------------------------------------------------- 119 | 120 | private void feed() 121 | throws IOException 122 | { 123 | int data = input.read(); 124 | 125 | while ( !isDone() && data != -1 ) 126 | { 127 | synchronized ( output ) 128 | { 129 | if ( !isDisabled()) 130 | { 131 | output.write( data ); 132 | } 133 | 134 | data = input.read(); 135 | } 136 | } 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/WriterStreamConsumer.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.PrintWriter; 20 | import java.io.Writer; 21 | 22 | /** 23 | * @author Jason van Zyl 24 | * @version $Id$ 25 | */ 26 | public class WriterStreamConsumer 27 | implements StreamConsumer 28 | { 29 | private PrintWriter writer; 30 | 31 | public WriterStreamConsumer( Writer writer ) 32 | { 33 | this.writer = new PrintWriter( writer ); 34 | } 35 | 36 | public void consumeLine( String line ) 37 | { 38 | writer.println( line ); 39 | 40 | writer.flush(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/shell/BourneShell.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli.shell; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import org.codehaus.plexus.util.Os; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | /** 25 | * @author Jason van Zyl 26 | * @version $Id$ 27 | */ 28 | public class BourneShell 29 | extends Shell 30 | { 31 | 32 | public BourneShell() 33 | { 34 | this(false); 35 | } 36 | 37 | public BourneShell( boolean isLoginShell ) 38 | { 39 | setUnconditionalQuoting( true ); 40 | setShellCommand( "/bin/sh" ); 41 | setArgumentQuoteDelimiter( '\'' ); 42 | setExecutableQuoteDelimiter( '\'' ); 43 | setSingleQuotedArgumentEscaped( true ); 44 | setSingleQuotedExecutableEscaped( false ); 45 | setQuotedExecutableEnabled( true ); 46 | setArgumentEscapePattern("'\\%s'"); 47 | 48 | if ( isLoginShell ) 49 | { 50 | addShellArg( "-l" ); 51 | } 52 | } 53 | 54 | /** {@inheritDoc} */ 55 | public String getExecutable() 56 | { 57 | if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) 58 | { 59 | return super.getExecutable(); 60 | } 61 | 62 | return quoteOneItem( super.getOriginalExecutable(), true ); 63 | } 64 | 65 | public List getShellArgsList() 66 | { 67 | List shellArgs = new ArrayList(); 68 | List existingShellArgs = super.getShellArgsList(); 69 | 70 | if ( ( existingShellArgs != null ) && !existingShellArgs.isEmpty() ) 71 | { 72 | shellArgs.addAll( existingShellArgs ); 73 | } 74 | 75 | shellArgs.add( "-c" ); 76 | 77 | return shellArgs; 78 | } 79 | 80 | public String[] getShellArgs() 81 | { 82 | String[] shellArgs = super.getShellArgs(); 83 | if ( shellArgs == null ) 84 | { 85 | shellArgs = new String[0]; 86 | } 87 | 88 | if ( ( shellArgs.length > 0 ) && !shellArgs[shellArgs.length - 1].equals( "-c" ) ) 89 | { 90 | String[] newArgs = new String[shellArgs.length + 1]; 91 | 92 | System.arraycopy( shellArgs, 0, newArgs, 0, shellArgs.length ); 93 | newArgs[shellArgs.length] = "-c"; 94 | 95 | shellArgs = newArgs; 96 | } 97 | 98 | return shellArgs; 99 | } 100 | 101 | protected String getExecutionPreamble() 102 | { 103 | if ( getWorkingDirectoryAsString() == null ) 104 | { 105 | return null; 106 | } 107 | 108 | String dir = getWorkingDirectoryAsString(); 109 | StringBuilder sb = new StringBuilder(); 110 | sb.append( "cd " ); 111 | 112 | sb.append( quoteOneItem( dir, false ) ); 113 | sb.append( " && " ); 114 | 115 | return sb.toString(); 116 | } 117 | 118 | /** 119 | *

Unify quotes in a path for the Bourne Shell.

120 | * 121 | *
122 |      * BourneShell.quoteOneItem(null)                       = null
123 |      * BourneShell.quoteOneItem("")                         = ''
124 |      * BourneShell.quoteOneItem("/test/quotedpath'abc")     = '/test/quotedpath'"'"'abc'
125 |      * BourneShell.quoteOneItem("/test/quoted path'abc")    = '/test/quoted pat'"'"'habc'
126 |      * BourneShell.quoteOneItem("/test/quotedpath\"abc")    = '/test/quotedpath"abc'
127 |      * BourneShell.quoteOneItem("/test/quoted path\"abc")   = '/test/quoted path"abc'
128 |      * BourneShell.quoteOneItem("/test/quotedpath\"'abc")   = '/test/quotedpath"'"'"'abc'
129 |      * BourneShell.quoteOneItem("/test/quoted path\"'abc")  = '/test/quoted path"'"'"'abc'
130 |      * 
131 | * 132 | * @param path not null path. 133 | * @return the path unified correctly for the Bourne shell. 134 | */ 135 | protected String quoteOneItem( String path, boolean isExecutable ) 136 | { 137 | if ( path == null ) 138 | { 139 | return null; 140 | } 141 | 142 | StringBuilder sb = new StringBuilder(); 143 | sb.append( "'" ); 144 | sb.append( path.replace( "'", "'\"'\"'" ) ); 145 | sb.append( "'" ); 146 | 147 | return sb.toString(); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/shell/CmdShell.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli.shell; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | /** 23 | *

24 | * Implementation to call the CMD Shell present on Windows NT, 2000 and XP 25 | *

26 | * 27 | * @author Carlos Sanchez 28 | * @since 1.2 29 | * @version $Id$ 30 | */ 31 | public class CmdShell 32 | extends Shell 33 | { 34 | public CmdShell() 35 | { 36 | setShellCommand( "cmd.exe" ); 37 | setQuotedExecutableEnabled( true ); 38 | setShellArgs( new String[]{"/X", "/C"} ); 39 | } 40 | 41 | /** 42 | *

43 | * Specific implementation that quotes all the command line. 44 | *

45 | *

46 | * Workaround for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6468220 47 | *

48 | *

49 | * From cmd.exe /? output: 50 | *

51 | * 52 | *
53 |      *      If /C or /K is specified, then the remainder of the command line after
54 |      *      the switch is processed as a command line, where the following logic is
55 |      *      used to process quote (") characters:
56 |      *
57 |      *      1.  If all of the following conditions are met, then quote characters
58 |      *      on the command line are preserved:
59 |      *
60 |      *      - no /S switch
61 |      *      - exactly two quote characters
62 |      *      - no special characters between the two quote characters,
63 |      *      where special is one of: &<>()@ˆ|
64 |      *      - there are one or more whitespace characters between the
65 |      *      the two quote characters
66 |      *      - the string between the two quote characters is the name
67 |      *      of an executable file.
68 |      *
69 |      *      2.  Otherwise, old behavior is to see if the first character is
70 |      *      a quote character and if so, strip the leading character and
71 |      *      remove the last quote character on the command line, preserving
72 |      *      any text after the last quote character.
73 |      * 
74 | * 75 | *

76 | * Always quoting the entire command line, regardless of these conditions 77 | * appears to make Windows processes invoke successfully. 78 | *

79 | */ 80 | public List getCommandLine( String executable, String[] arguments ) 81 | { 82 | StringBuilder sb = new StringBuilder(); 83 | sb.append( "\"" ); 84 | sb.append( super.getCommandLine( executable, arguments ).get( 0 ) ); 85 | sb.append( "\"" ); 86 | 87 | return Arrays.asList( new String[] { sb.toString() } ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/cli/shell/CommandShell.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli.shell; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | *

21 | * Implementation to call the Command.com Shell present on Windows 95, 98 and Me 22 | *

23 | * 24 | * @author Carlos Sanchez 25 | * @since 1.2 26 | * @version $Id$ 27 | */ 28 | public class CommandShell 29 | extends Shell 30 | { 31 | public CommandShell() 32 | { 33 | setShellCommand( "command.com" ); 34 | setShellArgs( new String[]{"/C"} ); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/dag/CycleDetectedException.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.dag; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.util.Iterator; 20 | import java.util.List; 21 | 22 | public class CycleDetectedException 23 | extends Exception 24 | { 25 | private List cycle; 26 | 27 | public CycleDetectedException( final String message, final List cycle ) 28 | { 29 | super( message ); 30 | 31 | this.cycle = cycle; 32 | 33 | } 34 | 35 | public List getCycle() 36 | { 37 | return cycle; 38 | } 39 | 40 | /** 41 | * @return 42 | */ 43 | public String cycleToString() 44 | { 45 | final StringBuilder buffer = new StringBuilder(); 46 | 47 | for ( Iterator iterator = cycle.iterator(); iterator.hasNext(); ) 48 | { 49 | buffer.append( iterator.next() ); 50 | 51 | if ( iterator.hasNext() ) 52 | { 53 | buffer.append( " --> " ); 54 | } 55 | } 56 | return buffer.toString(); 57 | } 58 | 59 | public String getMessage() 60 | { 61 | return super.getMessage() + " " + cycleToString(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/dag/TopologicalSorter.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.dag; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.util.HashMap; 20 | import java.util.LinkedList; 21 | import java.util.List; 22 | import java.util.Map; 23 | 24 | /** 25 | * @author Michal Maczka 26 | * @version $Id$ 27 | */ 28 | public class TopologicalSorter 29 | { 30 | 31 | private final static Integer NOT_VISTITED = 0; 32 | 33 | private final static Integer VISITING = 1; 34 | 35 | private final static Integer VISITED = 2; 36 | 37 | /** 38 | * @param graph 39 | * @return List of String (vertex labels) 40 | */ 41 | 42 | public static List sort( final DAG graph ) 43 | { 44 | return dfs( graph ); 45 | } 46 | 47 | public static List sort( final Vertex vertex ) 48 | { 49 | // we need to use addFirst method so we will use LinkedList explicitly 50 | final List retValue = new LinkedList(); 51 | 52 | dfsVisit( vertex, new HashMap(), retValue ); 53 | 54 | return retValue; 55 | } 56 | 57 | 58 | private static List dfs( final DAG graph ) 59 | { 60 | // we need to use addFirst method so we will use LinkedList explicitly 61 | final List retValue = new LinkedList(); 62 | final Map vertexStateMap = new HashMap(); 63 | 64 | for ( Vertex vertex : graph.getVerticies() ) 65 | { 66 | if ( isNotVisited( vertex, vertexStateMap ) ) 67 | { 68 | dfsVisit( vertex, vertexStateMap, retValue ); 69 | } 70 | } 71 | 72 | return retValue; 73 | } 74 | 75 | /** 76 | * @param vertex 77 | * @param vertexStateMap 78 | * @return 79 | */ 80 | private static boolean isNotVisited( final Vertex vertex, final Map vertexStateMap ) 81 | { 82 | final Integer state = vertexStateMap.get( vertex ); 83 | 84 | return ( state == null ) || NOT_VISTITED.equals( state ); 85 | } 86 | 87 | 88 | private static void dfsVisit( final Vertex vertex, final Map vertexStateMap, 89 | final List list ) 90 | { 91 | vertexStateMap.put( vertex, VISITING ); 92 | 93 | for ( Vertex v : vertex.getChildren() ) 94 | { 95 | if ( isNotVisited( v, vertexStateMap ) ) 96 | { 97 | dfsVisit( v, vertexStateMap, list ); 98 | } 99 | } 100 | 101 | vertexStateMap.put( vertex, VISITED ); 102 | 103 | list.add( vertex.getLabel() ); 104 | } 105 | 106 | } 107 | 108 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/io/InputStreamFacade.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.io; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | 22 | /** 23 | * Interface of a wrapper for input streams. This facade is used 24 | * by methods, which are being implemented for files, URL's, or 25 | * input streams. 26 | */ 27 | public interface InputStreamFacade { 28 | /** 29 | * Retrieves the actual {@link InputStream}. The caller must assume, 30 | * that this method may be invoked only once. 31 | */ 32 | InputStream getInputStream() throws IOException; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/io/RawInputStreamFacade.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.io; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | 22 | /** 23 | * Implementation of {@link InputStreamFacade} for raw input streams. 24 | */ 25 | @SuppressWarnings( { "UnusedDeclaration" } ) 26 | public class RawInputStreamFacade implements InputStreamFacade { 27 | final InputStream stream; 28 | 29 | public RawInputStreamFacade( InputStream stream ) 30 | { 31 | this.stream = stream; 32 | } 33 | 34 | public InputStream getInputStream() throws IOException { 35 | return stream; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/io/URLInputStreamFacade.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.io; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | import java.net.URL; 22 | 23 | /** 24 | * Implementation of {@link InputStreamFacade} for URL's. 25 | */ 26 | public class URLInputStreamFacade implements InputStreamFacade { 27 | private final URL url; 28 | 29 | public URLInputStreamFacade( URL url ) 30 | { 31 | this.url = url; 32 | } 33 | 34 | public InputStream getInputStream() throws IOException { 35 | return url.openStream(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/reflection/ReflectorException.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.reflection; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | * Exception indicating that an error has occurred while instantiating a class 21 | * with the Reflector class. This exception is meant to put a more user-friendly 22 | * face on the myriad other exceptions throws during reflective object creation. 23 | * 24 | * @author John Casey 25 | */ 26 | public class ReflectorException 27 | extends Exception 28 | { 29 | @SuppressWarnings( { "UnusedDeclaration" } ) 30 | public ReflectorException() 31 | { 32 | } 33 | 34 | /** 35 | * Create a new ReflectorException with the specified message. 36 | * 37 | * @param msg 38 | * The message. 39 | */ 40 | public ReflectorException( String msg ) 41 | { 42 | super( msg ); 43 | } 44 | 45 | /** 46 | * Create a new ReflectorException with the specified root cause. 47 | * 48 | * @param root 49 | * The root cause. 50 | */ 51 | public ReflectorException( Throwable root ) 52 | { 53 | super( root ); 54 | } 55 | 56 | /** 57 | * Create a new ReflectorException with the specified message and root 58 | * cause. 59 | * 60 | * @param msg 61 | * The message. 62 | * @param root 63 | * The root cause. 64 | */ 65 | public ReflectorException( String msg, Throwable root ) 66 | { 67 | super( msg, root ); 68 | } 69 | } -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/xml/CompactXMLWriter.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.xml; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.PrintWriter; 20 | import java.io.Writer; 21 | 22 | /** 23 | * @version $Id$ 24 | */ 25 | public class CompactXMLWriter 26 | extends PrettyPrintXMLWriter 27 | { 28 | 29 | public CompactXMLWriter( PrintWriter writer ) 30 | { 31 | super( writer ); 32 | } 33 | 34 | public CompactXMLWriter( Writer writer ) 35 | { 36 | super( writer ); 37 | } 38 | 39 | protected void endOfLine() 40 | { 41 | // override parent: don't write anything at end of line 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/xml/SerializerXMLWriter.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.xml; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import org.codehaus.plexus.util.xml.pull.XmlSerializer; 20 | 21 | import java.io.IOException; 22 | import java.util.ArrayList; 23 | import java.util.Collections; 24 | import java.util.List; 25 | import java.util.Stack; 26 | 27 | /** 28 | * Write to an MXSerializer. 29 | * 30 | * @author Brett Porter 31 | * @version $Id$ 32 | */ 33 | public class SerializerXMLWriter 34 | implements XMLWriter 35 | { 36 | private final XmlSerializer serializer; 37 | 38 | private final String namespace; 39 | 40 | private final Stack elements = new Stack(); 41 | 42 | private List exceptions; 43 | 44 | public SerializerXMLWriter( String namespace, XmlSerializer serializer ) 45 | { 46 | this.serializer = serializer; 47 | this.namespace = namespace; 48 | } 49 | 50 | public void startElement( String name ) 51 | { 52 | try 53 | { 54 | serializer.startTag( namespace, name ); 55 | elements.push( name ); 56 | } 57 | catch ( IOException e ) 58 | { 59 | storeException( e ); 60 | } 61 | } 62 | 63 | public void addAttribute( String key, String value ) 64 | { 65 | try 66 | { 67 | serializer.attribute( namespace, key, value ); 68 | } 69 | catch ( IOException e ) 70 | { 71 | storeException( e ); 72 | } 73 | } 74 | 75 | public void writeText( String text ) 76 | { 77 | try 78 | { 79 | serializer.text( text ); 80 | } 81 | catch ( IOException e ) 82 | { 83 | storeException( e ); 84 | } 85 | } 86 | 87 | public void writeMarkup( String text ) 88 | { 89 | try 90 | { 91 | serializer.cdsect( text ); 92 | } 93 | catch ( IOException e ) 94 | { 95 | storeException( e ); 96 | } 97 | } 98 | 99 | public void endElement() 100 | { 101 | try 102 | { 103 | serializer.endTag( namespace, (String) elements.pop() ); 104 | } 105 | catch ( IOException e ) 106 | { 107 | storeException( e ); 108 | } 109 | } 110 | 111 | /** 112 | * @todo Maybe the interface should allow IOExceptions on each? 113 | */ 114 | private void storeException( IOException e ) 115 | { 116 | if ( exceptions == null ) 117 | { 118 | exceptions = new ArrayList(); 119 | } 120 | exceptions.add( e ); 121 | } 122 | 123 | public List getExceptions() 124 | { 125 | return exceptions == null ? Collections.emptyList() : exceptions; 126 | } 127 | 128 | } 129 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/xml/XMLWriter.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.xml; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | * @version $Id$ 21 | */ 22 | public interface XMLWriter 23 | { 24 | void startElement( String name ); 25 | 26 | void addAttribute( String key, String value ); 27 | 28 | void writeText( String text ); 29 | 30 | void writeMarkup( String text ); 31 | 32 | void endElement(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/xml/XmlStreamReaderException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004 Sun Microsystems, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package org.codehaus.plexus.util.xml; 18 | 19 | import java.io.InputStream; 20 | 21 | /** 22 | * The XmlStreamReaderException is thrown by the XmlStreamReader constructors if the charset encoding can not be determined 23 | * according to the XML 1.0 specification and RFC 3023. 24 | *

25 | * The exception returns the unconsumed InputStream to allow the application to do an alternate processing with the 26 | * stream. Note that the original InputStream given to the XmlStreamReader cannot be used as that one has been already read. 27 | *

28 | * 29 | * @author Alejandro Abdelnur 30 | * @version revision 1.1 taken on 26/06/2007 from Rome (see https://rome.dev.java.net/source/browse/rome/src/java/com/sun/syndication/io/XmlReaderException.java) 31 | */ 32 | public class XmlStreamReaderException extends XmlReaderException 33 | { 34 | /** 35 | * Creates an exception instance if the charset encoding could not be determined. 36 | *

37 | * Instances of this exception are thrown by the XmlReader. 38 | *

39 | * 40 | * @param msg 41 | * message describing the reason for the exception. 42 | * @param bomEnc 43 | * BOM encoding. 44 | * @param xmlGuessEnc 45 | * XML guess encoding. 46 | * @param xmlEnc 47 | * XML prolog encoding. 48 | * @param is 49 | * the unconsumed InputStream. 50 | * 51 | */ 52 | public XmlStreamReaderException( String msg, String bomEnc, String xmlGuessEnc, String xmlEnc, InputStream is ) 53 | { 54 | super( msg, bomEnc, xmlGuessEnc, xmlEnc, is ); 55 | } 56 | 57 | /** 58 | * Creates an exception instance if the charset encoding could not be determined. 59 | *

60 | * Instances of this exception are thrown by the XmlReader. 61 | *

62 | * 63 | * @param msg 64 | * message describing the reason for the exception. 65 | * @param ctMime 66 | * MIME type in the content-type. 67 | * @param ctEnc 68 | * encoding in the content-type. 69 | * @param bomEnc 70 | * BOM encoding. 71 | * @param xmlGuessEnc 72 | * XML guess encoding. 73 | * @param xmlEnc 74 | * XML prolog encoding. 75 | * @param is 76 | * the unconsumed InputStream. 77 | * 78 | */ 79 | public XmlStreamReaderException( String msg, String ctMime, String ctEnc, String bomEnc, String xmlGuessEnc, 80 | String xmlEnc, InputStream is ) 81 | { 82 | super( msg, ctMime, ctEnc, bomEnc, xmlGuessEnc, xmlEnc, is ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/xml/Xpp3DomWriter.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.xml; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.PrintWriter; 20 | import java.io.Writer; 21 | 22 | /** 23 | * @version $Id$ 24 | */ 25 | public class Xpp3DomWriter 26 | { 27 | public static void write( Writer writer, Xpp3Dom dom ) 28 | { 29 | write( new PrettyPrintXMLWriter( writer ), dom ); 30 | } 31 | 32 | public static void write( PrintWriter writer, Xpp3Dom dom ) 33 | { 34 | write( new PrettyPrintXMLWriter( writer ), dom ); 35 | } 36 | 37 | public static void write( XMLWriter xmlWriter, Xpp3Dom dom ) 38 | { 39 | write( xmlWriter, dom, true ); 40 | } 41 | 42 | public static void write( XMLWriter xmlWriter, Xpp3Dom dom, boolean escape ) 43 | { 44 | // TODO: move to XMLWriter? 45 | xmlWriter.startElement( dom.getName() ); 46 | String[] attributeNames = dom.getAttributeNames(); 47 | for ( String attributeName : attributeNames ) 48 | { 49 | xmlWriter.addAttribute( attributeName, dom.getAttribute( attributeName ) ); 50 | } 51 | Xpp3Dom[] children = dom.getChildren(); 52 | for ( Xpp3Dom aChildren : children ) 53 | { 54 | write( xmlWriter, aChildren, escape ); 55 | } 56 | 57 | String value = dom.getValue(); 58 | if ( value != null ) 59 | { 60 | if ( escape ) 61 | { 62 | xmlWriter.writeText( value ); 63 | } 64 | else 65 | { 66 | xmlWriter.writeMarkup( value ); 67 | } 68 | } 69 | 70 | xmlWriter.endElement(); 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/org/codehaus/plexus/util/xml/pull/XmlPullParserException.java: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/ 2 | // for license please see accompanying LICENSE.txt file (available also at http://www.xmlpull.org/) 3 | 4 | package org.codehaus.plexus.util.xml.pull; 5 | 6 | /** 7 | * This exception is thrown to signal XML Pull Parser related faults. 8 | * 9 | * @author Aleksander Slominski 10 | */ 11 | public class XmlPullParserException extends Exception { 12 | /** 13 | * @deprecated use generic getCause() method 14 | */ 15 | protected Throwable detail; 16 | protected int row = -1; 17 | protected int column = -1; 18 | 19 | /* public XmlPullParserException() { 20 | }*/ 21 | 22 | public XmlPullParserException(String s) { 23 | super(s); 24 | } 25 | 26 | /* 27 | public XmlPullParserException(String s, Throwable thrwble) { 28 | super(s); 29 | this.detail = thrwble; 30 | } 31 | 32 | public XmlPullParserException(String s, int row, int column) { 33 | super(s); 34 | this.row = row; 35 | this.column = column; 36 | } 37 | */ 38 | 39 | public XmlPullParserException(String msg, XmlPullParser parser, Throwable chain) { 40 | super ((msg == null ? "" : msg+" ") 41 | + (parser == null ? "" : "(position:"+parser.getPositionDescription()+") ") 42 | + (chain == null ? "" : "caused by: "+chain), chain); 43 | 44 | if (parser != null) { 45 | this.row = parser.getLineNumber(); 46 | this.column = parser.getColumnNumber(); 47 | } 48 | this.detail = chain; 49 | } 50 | 51 | /** 52 | * @deprecated Use the generic getCause() method 53 | * @return 54 | */ 55 | public Throwable getDetail() { return getCause(); } 56 | // public void setDetail(Throwable cause) { this.detail = cause; } 57 | public int getLineNumber() { return row; } 58 | public int getColumnNumber() { return column; } 59 | 60 | /* 61 | public String getMessage() { 62 | if(detail == null) 63 | return super.getMessage(); 64 | else 65 | return super.getMessage() + "; nested exception is: \n\t" 66 | + detail.getMessage(); 67 | } 68 | */ 69 | 70 | //NOTE: code that prints this and detail is difficult in J2ME 71 | public void printStackTrace() { 72 | if (getCause() == null) { 73 | super.printStackTrace(); 74 | } else { 75 | synchronized(System.err) { 76 | System.err.println(super.getMessage() + "; nested exception is:"); 77 | getCause().printStackTrace(); 78 | } 79 | } 80 | } 81 | 82 | } 83 | 84 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/cli/package.html: -------------------------------------------------------------------------------- 1 | 2 | Command-line utilities. 3 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/cli/shell/package.html: -------------------------------------------------------------------------------- 1 | 2 | Shell utilities. 3 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/dag/package.html: -------------------------------------------------------------------------------- 1 | 2 | Directed Acyclic Graph utilities. 3 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/interpolation/package.html: -------------------------------------------------------------------------------- 1 | 2 | Interpolation utilities. 3 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/introspection/package.html: -------------------------------------------------------------------------------- 1 | 2 | Introspection utilities. 3 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/io/package.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Facades to create {@code InputStream}s representing various kinds of 24 | data sources, identically. 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/package.html: -------------------------------------------------------------------------------- 1 | 2 | Miscellaneous utilities, mainly dealing with I/O, strings, and filesystems. 3 | 4 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/reflection/package.html: -------------------------------------------------------------------------------- 1 | 2 | Reflection utilities. 3 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/xml/package.html: -------------------------------------------------------------------------------- 1 | 2 | XML utilities. 3 | -------------------------------------------------------------------------------- /src/main/javadoc/org/codehaus/plexus/util/xml/pull/package.html: -------------------------------------------------------------------------------- 1 | 2 | XML Pull Parser interface and implementation. 3 | 4 | XML Pull Parser is an interface that defines parsing functionlity provided 5 | in XMLPULL V1 API (visit this website to 6 | learn more about API and its implementations). 7 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/NOTICE: -------------------------------------------------------------------------------- 1 | This product includes software developed by the Indiana University 2 | Extreme! Lab (http://www.extreme.indiana.edu/). 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | This product includes software developed by 8 | ThoughtWorks (http://www.thoughtworks.com). 9 | 10 | This product includes software developed by 11 | javolution (http://javolution.org/). 12 | 13 | This product includes software developed by 14 | Rome (https://rome.dev.java.net/). -------------------------------------------------------------------------------- /src/main/resources/licenses/extreme.indiana.edu.license.TXT: -------------------------------------------------------------------------------- 1 | Indiana University Extreme! Lab Software License 2 | 3 | Version 1.1.1 4 | 5 | Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | 1. Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in 16 | the documentation and/or other materials provided with the distribution. 17 | 18 | 3. The end-user documentation included with the redistribution, if any, 19 | must include the following acknowledgment: 20 | 21 | "This product includes software developed by the Indiana University 22 | Extreme! Lab (http://www.extreme.indiana.edu/)." 23 | 24 | Alternately, this acknowledgment may appear in the software itself, 25 | if and wherever such third-party acknowledgments normally appear. 26 | 27 | 4. The names "Indiana Univeristy" and "Indiana Univeristy Extreme! Lab" 28 | must not be used to endorse or promote products derived from this 29 | software without prior written permission. For written permission, 30 | please contact http://www.extreme.indiana.edu/. 31 | 32 | 5. Products derived from this software may not use "Indiana Univeristy" 33 | name nor may "Indiana Univeristy" appear in their name, without prior 34 | written permission of the Indiana University. 35 | 36 | THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 37 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 38 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 39 | IN NO EVENT SHALL THE AUTHORS, COPYRIGHT HOLDERS OR ITS CONTRIBUTORS 40 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 41 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 42 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 43 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 44 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 45 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 46 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 47 | 48 | -------------------------------------------------------------------------------- /src/main/resources/licenses/javolution.license.TXT: -------------------------------------------------------------------------------- 1 | Javolution - Java(TM) Solution for Real-Time and Embedded Systems 2 | Copyright (c) 2006, Javolution (http://javolution.org) 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /src/main/resources/licenses/thoughtworks.TXT: -------------------------------------------------------------------------------- 1 | 2 | /******************************************************************************** 3 | * CruiseControl, a Continuous Integration Toolkit 4 | * Copyright (c) 2001-2003, ThoughtWorks, Inc. 5 | * 651 W Washington Ave. Suite 500 6 | * Chicago, IL 60661 USA 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * + Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * + Redistributions in binary form must reproduce the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer in the documentation and/or other materials provided 19 | * with the distribution. 20 | * 21 | * + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the 22 | * names of its contributors may be used to endorse or promote 23 | * products derived from this software without specific prior 24 | * written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 30 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 31 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 32 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 33 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 34 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | ********************************************************************************/ -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 |

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/DirectoryWalkerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | 21 | import junit.framework.TestCase; 22 | 23 | public class DirectoryWalkerTest extends TestCase { 24 | public void testDirectoryWalk() 25 | { 26 | DirectoryWalker walker = new DirectoryWalker(); 27 | 28 | walker.addSCMExcludes(); 29 | 30 | walker.setBaseDir( new File("src/test/resources/directorywalker") ); 31 | 32 | WalkCollector collector = new WalkCollector(); 33 | walker.addDirectoryWalkListener( collector ); 34 | 35 | walker.scan(); 36 | 37 | assertEquals( "Walk Collector / Starting Count", 1, collector.startCount ); 38 | assertNotNull( "Walk Collector / Starting Dir", collector.startingDir ); 39 | assertEquals( "Walk Collector / Finish Count", 1, collector.finishCount ); 40 | assertEquals( "Walk Collector / Steps Count", 4, collector.steps.size() ); 41 | assertTrue( "Walk Collector / percentage low >= 0", collector.percentageLow >= 0 ); 42 | assertTrue( "Walk Collector / percentage high <= 100", collector.percentageHigh <= 100 ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/MatchPatternTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | /* 3 | * Copyright The Codehaus Foundation. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import junit.framework.TestCase; 19 | 20 | /** 21 | * @author Kristian Rosenvold 22 | */ 23 | public class MatchPatternTest extends TestCase 24 | { 25 | public void testMatchPath() 26 | throws Exception 27 | { 28 | MatchPattern mp = MatchPattern.fromString( "ABC*" ); 29 | assertTrue(mp.matchPath( "ABCD", true )); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/MatchPatternsTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | /* 3 | * Copyright The Codehaus Foundation. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import junit.framework.TestCase; 19 | 20 | public class MatchPatternsTest 21 | extends TestCase 22 | { 23 | public void testMatches() 24 | throws Exception 25 | { 26 | MatchPatterns from = MatchPatterns.from( "ABC**", "CDE**" ); 27 | assertTrue( from.matches( "ABCDE", true ) ); 28 | assertTrue( from.matches( "CDEF", true ) ); 29 | assertFalse( from.matches( "XYZ", true ) ); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/OsTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.util.Iterator; 20 | 21 | import junit.framework.TestCase; 22 | 23 | /** 24 | * Test Case for Os 25 | */ 26 | public class OsTest 27 | extends TestCase 28 | { 29 | public void testUndefinedFamily() 30 | { 31 | assertFalse( Os.isFamily( "bogus family" ) ); 32 | } 33 | 34 | public void testOs() 35 | { 36 | Iterator iter = Os.getValidFamilies().iterator(); 37 | String currentFamily = null; 38 | String notCurrentFamily = null; 39 | while ( iter.hasNext() && ( currentFamily == null || notCurrentFamily == null ) ) 40 | { 41 | String fam = iter.next(); 42 | if ( Os.isFamily( fam ) ) 43 | { 44 | currentFamily = fam; 45 | } 46 | else 47 | { 48 | notCurrentFamily = fam; 49 | } 50 | } 51 | 52 | //make sure the OS_FAMILY is set right. 53 | assertEquals( currentFamily, Os.OS_FAMILY ); 54 | 55 | // check the current family and one of the others 56 | assertTrue( Os.isOs( currentFamily, null, null, null ) ); 57 | assertFalse( Os.isOs( notCurrentFamily, null, null, null ) ); 58 | 59 | // check for junk 60 | assertFalse( Os.isOs( "junk", null, null, null ) ); 61 | 62 | // check the current name 63 | assertTrue( Os.isOs( currentFamily, Os.OS_NAME, null, null ) ); 64 | 65 | // check some other name 66 | assertFalse( Os.isOs( currentFamily, "myos", null, null ) ); 67 | 68 | // check the arch 69 | assertTrue( Os.isOs( currentFamily, Os.OS_NAME, Os.OS_ARCH, null ) ); 70 | assertFalse( Os.isOs( currentFamily, Os.OS_NAME, "myarch", null ) ); 71 | 72 | // check the version 73 | assertTrue( Os.isOs( currentFamily, Os.OS_NAME, Os.OS_ARCH, Os.OS_VERSION ) ); 74 | assertFalse( Os.isOs( currentFamily, Os.OS_NAME, Os.OS_ARCH, "myversion" ) ); 75 | } 76 | 77 | public void testValidList() 78 | { 79 | assertTrue(Os.isValidFamily( "dos" ) ); 80 | 81 | assertFalse( Os.isValidFamily( "" ) ); 82 | assertFalse( Os.isValidFamily( null ) ); 83 | assertFalse( Os.isValidFamily( "something" ) ); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/PerfTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | import junit.framework.TestCase; 4 | 5 | /* 6 | * Copyright 2011 The Codehaus Foundation. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | public class PerfTest 22 | extends TestCase 23 | { 24 | 25 | String src = "012345578901234556789012345678901234456789012345678901234567890"; 26 | 27 | private final int oops = 100; 28 | 29 | public void testSubString() 30 | { 31 | StringBuilder res = new StringBuilder(); 32 | int len = src.length(); 33 | for ( int cnt = 0; cnt < oops; cnt++ ) 34 | { 35 | for ( int i = 0; i < len - 5; i++ ) 36 | { 37 | res.append( src.substring( i, i+4 ) ); 38 | } 39 | } 40 | int i = res.length(); 41 | System.out.println( "i = " + i ); 42 | } 43 | 44 | public void testResDir() 45 | { 46 | StringBuilder res = new StringBuilder(); 47 | int len = src.length(); 48 | for ( int cnt = 0; cnt < oops; cnt++ ) 49 | { 50 | for ( int i = 0; i < len - 5; i++ ) 51 | { 52 | res.append( src, i, i+4 ); 53 | } 54 | } 55 | int i = res.length(); 56 | System.out.println( "i = " + i ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/ReflectionUtilsTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import junit.framework.TestCase; 20 | 21 | import java.util.Map; 22 | import java.util.HashMap; 23 | 24 | /** 25 | * This is used to test ReflectionUtils for correctness. 26 | * 27 | * @author Jesse McConnell 28 | * @version $Id:$ 29 | * @see org.codehaus.plexus.util.ReflectionUtils 30 | */ 31 | public final class ReflectionUtilsTest 32 | extends TestCase 33 | { 34 | public ReflectionUtilsTestClass testClass = new ReflectionUtilsTestClass(); 35 | 36 | protected void setUp() throws Exception 37 | { 38 | 39 | } 40 | 41 | public void testSimpleVariableAccess() 42 | throws IllegalAccessException 43 | { 44 | assertEquals("woohoo", (String)ReflectionUtils.getValueIncludingSuperclasses( "myString", testClass ) ); 45 | } 46 | 47 | public void testComplexVariableAccess() 48 | throws IllegalAccessException 49 | { 50 | Map map = ReflectionUtils.getVariablesAndValuesIncludingSuperclasses( testClass ); 51 | 52 | Map myMap = (Map)map.get( "myMap" ); 53 | 54 | assertEquals( "myValue", (String)myMap.get( "myKey" ) ); 55 | assertEquals( "myOtherValue", (String)myMap.get( "myOtherKey") ); 56 | 57 | } 58 | 59 | public void testSuperClassVariableAccess() 60 | throws IllegalAccessException 61 | { 62 | assertEquals("super-duper", (String)ReflectionUtils.getValueIncludingSuperclasses( "mySuperString", testClass ) ); 63 | } 64 | 65 | public void testSettingVariableValue() 66 | throws IllegalAccessException 67 | { 68 | ReflectionUtils.setVariableValueInObject( testClass, "mySettableString", "mySetString" ); 69 | 70 | assertEquals("mySetString", (String)ReflectionUtils.getValueIncludingSuperclasses( "mySettableString", testClass ) ); 71 | 72 | 73 | ReflectionUtils.setVariableValueInObject( testClass, "myParentsSettableString", "myParentsSetString" ); 74 | 75 | assertEquals("myParentsSetString", (String)ReflectionUtils.getValueIncludingSuperclasses( "myParentsSettableString", testClass ) ); 76 | } 77 | 78 | 79 | private class ReflectionUtilsTestClass 80 | extends AbstractReflectionUtilsTestClass 81 | 82 | { 83 | private String myString = "woohoo"; 84 | private String mySettableString; 85 | private Map myMap = new HashMap(); 86 | 87 | public ReflectionUtilsTestClass() 88 | { 89 | myMap.put("myKey", "myValue"); 90 | myMap.put( "myOtherKey", "myOtherValue" ); 91 | } 92 | } 93 | 94 | 95 | private class AbstractReflectionUtilsTestClass 96 | { 97 | private String mySuperString = "super-duper"; 98 | private String myParentsSettableString; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/SelectorUtilsTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | import java.io.File; 4 | 5 | import junit.framework.TestCase; 6 | 7 | /* 8 | * Copyright The Codehaus Foundation. 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | 23 | public class SelectorUtilsTest 24 | extends TestCase 25 | { 26 | public void testMatchPath_DefaultFileSeparator() 27 | { 28 | String separator = File.separator; 29 | 30 | // Pattern and target start with file separator 31 | assertTrue( SelectorUtils.matchPath( separator + "*" + separator + "a.txt", separator + "b" + separator 32 | + "a.txt" ) ); 33 | // Pattern starts with file separator, target doesn't 34 | assertFalse( SelectorUtils.matchPath( separator + "*" + separator + "a.txt", "b" + separator + "a.txt" ) ); 35 | // Pattern doesn't start with file separator, target does 36 | assertFalse( SelectorUtils.matchPath( "*" + separator + "a.txt", separator + "b" + separator + "a.txt" ) ); 37 | // Pattern and target don't start with file separator 38 | assertTrue( SelectorUtils.matchPath( "*" + separator + "a.txt", "b" + separator + "a.txt" ) ); 39 | } 40 | 41 | public void testMatchPath_UnixFileSeparator() 42 | { 43 | String separator = "/"; 44 | 45 | // Pattern and target start with file separator 46 | assertTrue( SelectorUtils.matchPath( separator + "*" + separator + "a.txt", separator + "b" + separator 47 | + "a.txt", separator, false ) ); 48 | // Pattern starts with file separator, target doesn't 49 | assertFalse( SelectorUtils.matchPath( separator + "*" + separator + "a.txt", "b" + separator + "a.txt", 50 | separator, false ) ); 51 | // Pattern doesn't start with file separator, target does 52 | assertFalse( SelectorUtils.matchPath( "*" + separator + "a.txt", separator + "b" + separator + "a.txt", 53 | separator, false ) ); 54 | // Pattern and target don't start with file separator 55 | assertTrue( SelectorUtils.matchPath( "*" + separator + "a.txt", "b" + separator + "a.txt", separator, false ) ); 56 | } 57 | 58 | public void testMatchPath_WindowsFileSeparator() 59 | { 60 | String separator = "\\"; 61 | 62 | // Pattern and target start with file separator 63 | assertTrue( SelectorUtils.matchPath( separator + "*" + separator + "a.txt", separator + "b" + separator 64 | + "a.txt", separator, false ) ); 65 | // Pattern starts with file separator, target doesn't 66 | assertFalse( SelectorUtils.matchPath( separator + "*" + separator + "a.txt", "b" + separator + "a.txt", 67 | separator, false ) ); 68 | // Pattern doesn't start with file separator, target does 69 | assertFalse( SelectorUtils.matchPath( "*" + separator + "a.txt", separator + "b" + separator + "a.txt", 70 | separator, false ) ); 71 | // Pattern and target don't start with file separator 72 | assertTrue( SelectorUtils.matchPath( "*" + separator + "a.txt", "b" + separator + "a.txt", separator, false ) ); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/StringInputStreamTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import junit.framework.TestCase; 20 | 21 | /** 22 | * @author Ben Walding 23 | * @version $Id$ 24 | */ 25 | public class StringInputStreamTest extends TestCase 26 | { 27 | public void testFoo() 28 | { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/Tracer.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.PrintWriter; 20 | import java.io.StringWriter; 21 | 22 | /** 23 | * Convenience class to handle throwable stacktraces 24 | * 25 | *

Created on 18/06/2003

26 | * 27 | * @author Bert van Brakel 28 | * @version $Revision$ 29 | */ 30 | public class Tracer 31 | { 32 | 33 | /** 34 | * Constructor 35 | * 36 | * 37 | */ 38 | private Tracer() 39 | { 40 | super(); 41 | } 42 | 43 | /** 44 | * Return the throwable stack trace as a string 45 | * */ 46 | public static String traceToString( Throwable t ) 47 | { 48 | if ( t == null ) 49 | { 50 | return null; 51 | } 52 | StringWriter sw = new StringWriter(); 53 | t.printStackTrace( new PrintWriter( sw ) ); 54 | return sw.toString(); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/WalkCollector.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.File; 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | class WalkCollector 24 | implements DirectoryWalkListener 25 | { 26 | public List steps; 27 | 28 | public File startingDir; 29 | 30 | public int startCount; 31 | 32 | public int finishCount; 33 | 34 | public int percentageLow; 35 | 36 | public int percentageHigh; 37 | 38 | public WalkCollector() 39 | { 40 | steps = new ArrayList(); 41 | startCount = 0; 42 | finishCount = 0; 43 | percentageLow = 0; 44 | percentageHigh = 0; 45 | } 46 | 47 | public void directoryWalkStarting( File basedir ) 48 | { 49 | debug( "Walk Starting: " + basedir ); 50 | startCount++; 51 | startingDir = basedir; 52 | } 53 | 54 | public void directoryWalkStep( int percentage, File file ) 55 | { 56 | percentageLow = Math.min( percentageLow, percentage ); 57 | percentageHigh = Math.max( percentageHigh, percentage ); 58 | debug( "Walk Step: [" + percentage + "%] " + file ); 59 | steps.add( file ); 60 | } 61 | 62 | public void directoryWalkFinished() 63 | { 64 | debug( "Walk Finished." ); 65 | finishCount++; 66 | } 67 | 68 | public void debug( String message ) 69 | { 70 | System.out.println( message ); 71 | } 72 | } -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/cli/CommandLineUtilsTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import junit.framework.TestCase; 20 | import org.codehaus.plexus.util.Os; 21 | 22 | import java.util.Arrays; 23 | import java.util.Locale; 24 | import java.util.Properties; 25 | 26 | @SuppressWarnings( { "JavaDoc", "deprecation" } ) 27 | public class CommandLineUtilsTest 28 | extends TestCase 29 | { 30 | 31 | public void testQuoteArguments() 32 | { 33 | try 34 | { 35 | String result = CommandLineUtils.quote( "Hello" ); 36 | System.out.println( result ); 37 | assertEquals( "Hello", result ); 38 | result = CommandLineUtils.quote( "Hello World" ); 39 | System.out.println( result ); 40 | assertEquals( "\"Hello World\"", result ); 41 | result = CommandLineUtils.quote( "\"Hello World\"" ); 42 | System.out.println( result ); 43 | assertEquals( "\'\"Hello World\"\'", result ); 44 | } 45 | catch ( Exception e ) 46 | { 47 | fail( e.getMessage() ); 48 | } 49 | try 50 | { 51 | CommandLineUtils.quote( "\"Hello \'World\'\'" ); 52 | fail(); 53 | } 54 | catch ( Exception e ) 55 | { 56 | } 57 | } 58 | 59 | /** 60 | * Tests that case-insensitive environment variables are normalized to upper case. 61 | */ 62 | public void testGetSystemEnvVarsCaseInsensitive() 63 | throws Exception 64 | { 65 | Properties vars = CommandLineUtils.getSystemEnvVars( false ); 66 | for ( Object o : vars.keySet() ) 67 | { 68 | String variable = (String) o; 69 | assertEquals( variable.toUpperCase( Locale.ENGLISH ), variable ); 70 | } 71 | } 72 | 73 | /** 74 | * Tests that environment variables on Windows are normalized to upper case. Does nothing on Unix platforms. 75 | */ 76 | public void testGetSystemEnvVarsWindows() 77 | throws Exception 78 | { 79 | if ( !Os.isFamily( Os.FAMILY_WINDOWS ) ) 80 | { 81 | return; 82 | } 83 | Properties vars = CommandLineUtils.getSystemEnvVars(); 84 | for ( Object o : vars.keySet() ) 85 | { 86 | String variable = (String) o; 87 | assertEquals( variable.toUpperCase( Locale.ENGLISH ), variable ); 88 | } 89 | } 90 | 91 | /** 92 | * Tests the splitting of a command line into distinct arguments. 93 | */ 94 | public void testTranslateCommandline() 95 | throws Exception 96 | { 97 | assertCmdLineArgs( new String[] {}, null ); 98 | assertCmdLineArgs( new String[] {}, "" ); 99 | 100 | assertCmdLineArgs( new String[] { "foo", "bar" }, "foo bar" ); 101 | assertCmdLineArgs( new String[] { "foo", "bar" }, " foo bar " ); 102 | 103 | assertCmdLineArgs( new String[] { "foo", " double quotes ", "bar" }, "foo \" double quotes \" bar" ); 104 | assertCmdLineArgs( new String[] { "foo", " single quotes ", "bar" }, "foo ' single quotes ' bar" ); 105 | 106 | assertCmdLineArgs( new String[] { "foo", " \" ", "bar" }, "foo ' \" ' bar" ); 107 | assertCmdLineArgs( new String[] { "foo", " ' ", "bar" }, "foo \" ' \" bar" ); 108 | } 109 | 110 | private void assertCmdLineArgs( String[] expected, String cmdLine ) 111 | throws Exception 112 | { 113 | String[] actual = CommandLineUtils.translateCommandline( cmdLine ); 114 | assertNotNull( actual ); 115 | assertEquals( expected.length, actual.length ); 116 | assertEquals( Arrays.asList( expected ), Arrays.asList( actual ) ); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/cli/DefaultConsumerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import junit.framework.TestCase; 20 | 21 | public class DefaultConsumerTest extends TestCase 22 | { 23 | /** 24 | * @param testName 25 | */ 26 | public DefaultConsumerTest( String testName ) 27 | { 28 | super( testName ); 29 | } 30 | 31 | /* 32 | * @see TestCase#setUp() 33 | */ 34 | public void setUp() throws Exception 35 | { 36 | super.setUp(); 37 | } 38 | 39 | public void testConsumeLine() 40 | { 41 | DefaultConsumer cons = new DefaultConsumer(); 42 | cons.consumeLine( "Test DefaultConsumer consumeLine" ); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/cli/EnhancedStringTokenizerTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.cli; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import junit.framework.TestCase; 20 | 21 | public class EnhancedStringTokenizerTest extends TestCase 22 | { 23 | /** 24 | * @param testName 25 | */ 26 | public EnhancedStringTokenizerTest( final String testName ) 27 | { 28 | super( testName ); 29 | } 30 | 31 | /* 32 | * @see TestCase#setUp() 33 | */ 34 | public void setUp() throws Exception 35 | { 36 | super.setUp(); 37 | } 38 | 39 | public void test1() 40 | { 41 | EnhancedStringTokenizer est = new EnhancedStringTokenizer( "this is a test string" ); 42 | StringBuilder sb = new StringBuilder(); 43 | while ( est.hasMoreTokens() ) 44 | { 45 | sb.append( est.nextToken() ); 46 | sb.append( " " ); 47 | } 48 | assertEquals( "this is a test string ", sb.toString() ); 49 | } 50 | 51 | public void test2() 52 | { 53 | EnhancedStringTokenizer est = new EnhancedStringTokenizer( "1,,,3,,4", "," ); 54 | assertEquals( "Token 1", "1", est.nextToken() ); 55 | assertEquals( "Token 2", "", est.nextToken() ); 56 | assertEquals( "Token 3", "", est.nextToken() ); 57 | assertEquals( "Token 4", "3", est.nextToken() ); 58 | assertEquals( "Token 5", "", est.nextToken() ); 59 | assertEquals( "Token 6", "4", est.nextToken() ); 60 | } 61 | 62 | public void test3() 63 | { 64 | EnhancedStringTokenizer est = new EnhancedStringTokenizer( "1,,,3,,4", ",", true ); 65 | assertEquals( "Token 1", "1", est.nextToken() ); 66 | assertEquals( "Token 2", ",", est.nextToken() ); 67 | assertEquals( "Token 3", "", est.nextToken() ); 68 | assertEquals( "Token 4", ",", est.nextToken() ); 69 | assertEquals( "Token 5", "", est.nextToken() ); 70 | assertEquals( "Token 6", ",", est.nextToken() ); 71 | assertEquals( "Token 7", "3", est.nextToken() ); 72 | assertEquals( "Token 8", ",", est.nextToken() ); 73 | assertEquals( "Token 9", "", est.nextToken() ); 74 | assertEquals( "Token 10", ",", est.nextToken() ); 75 | assertEquals( "Token 11", "4", est.nextToken() ); 76 | } 77 | 78 | public void testMultipleDelim() 79 | { 80 | EnhancedStringTokenizer est = new EnhancedStringTokenizer( "1 2|3|4", " |", true ); 81 | assertEquals( "Token 1", "1", est.nextToken() ); 82 | assertEquals( "Token 2", " ", est.nextToken() ); 83 | assertEquals( "Token 3", "2", est.nextToken() ); 84 | assertEquals( "Token 4", "|", est.nextToken() ); 85 | assertEquals( "Token 5", "3", est.nextToken() ); 86 | assertEquals( "Token 6", "|", est.nextToken() ); 87 | assertEquals( "Token 7", "4", est.nextToken() ); 88 | assertEquals( "est.hasMoreTokens()", false, est.hasMoreTokens() ); 89 | } 90 | 91 | public void testEmptyString() 92 | { 93 | EnhancedStringTokenizer est = new EnhancedStringTokenizer( "" ); 94 | assertEquals( "est.hasMoreTokens()", false, est.hasMoreTokens() ); 95 | try 96 | { 97 | est.nextToken(); 98 | fail(); 99 | } 100 | catch ( Exception e ) 101 | { 102 | } 103 | } 104 | 105 | public void testSimpleString() 106 | { 107 | EnhancedStringTokenizer est = new EnhancedStringTokenizer( "a " ); 108 | assertEquals( "Token 1", "a", est.nextToken() ); 109 | assertEquals( "Token 2", "", est.nextToken() ); 110 | assertEquals( "est.hasMoreTokens()", false, est.hasMoreTokens() ); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/dag/CycleDetectedExceptionTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.dag; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import junit.framework.TestCase; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | /** 25 | * @author Jason van Zyl 26 | * @version $Id$ 27 | */ 28 | public class CycleDetectedExceptionTest 29 | extends TestCase 30 | { 31 | public void testException() 32 | { 33 | final List cycle = new ArrayList(); 34 | 35 | cycle.add( "a" ); 36 | 37 | cycle.add( "b" ); 38 | 39 | cycle.add( "a" ); 40 | 41 | final CycleDetectedException e = new CycleDetectedException( "Cycle detected", cycle ); 42 | 43 | assertEquals( "Cycle detected a --> b --> a", e.getMessage() ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/dag/VertexTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.dag; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import junit.framework.TestCase; 20 | 21 | /** 22 | * @author Michal Maczka 23 | * @version $Id$ 24 | */ 25 | public class VertexTest extends TestCase 26 | { 27 | public void testVertex() 28 | { 29 | 30 | final Vertex vertex1 = new Vertex( "a" ); 31 | 32 | assertEquals( "a", vertex1.getLabel() ); 33 | 34 | assertEquals( 0, vertex1.getChildren().size() ); 35 | 36 | assertEquals( 0, vertex1.getChildLabels().size() ); 37 | 38 | final Vertex vertex2 = new Vertex( "b" ); 39 | 40 | assertEquals( "b", vertex2.getLabel() ); 41 | 42 | vertex1.addEdgeTo( vertex2 ); 43 | 44 | assertEquals( 1, vertex1.getChildren().size() ); 45 | 46 | assertEquals( 1, vertex1.getChildLabels().size() ); 47 | 48 | assertEquals( vertex2, vertex1.getChildren().get( 0 ) ); 49 | 50 | assertEquals( "b", vertex1.getChildLabels().get( 0 ) ); 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/reflection/ReflectorTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.reflection; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import junit.framework.TestCase; 20 | 21 | /** 22 | * @author Jörg Schaible 23 | * @version $Id$ 24 | */ 25 | public class ReflectorTest 26 | extends TestCase 27 | { 28 | private Project project; 29 | 30 | private Reflector reflector; 31 | 32 | protected void setUp() 33 | throws Exception 34 | { 35 | super.setUp(); 36 | 37 | project = new Project(); 38 | project.setModelVersion( "1.0.0" ); 39 | project.setVersion( "42" ); 40 | 41 | reflector = new Reflector(); 42 | } 43 | 44 | public void testObjectPropertyFromName() 45 | throws Exception 46 | { 47 | assertEquals( "1.0.0", reflector.getObjectProperty( project, "modelVersion" ) ); 48 | } 49 | 50 | public void testObjectPropertyFromBean() 51 | throws Exception 52 | { 53 | assertEquals( "Foo", reflector.getObjectProperty( project, "name" ) ); 54 | } 55 | 56 | public void testObjectPropertyFromField() 57 | throws Exception 58 | { 59 | assertEquals( "42", reflector.getObjectProperty( project, "version" ) ); 60 | } 61 | 62 | public static class Project 63 | { 64 | private String model; 65 | 66 | private String name; 67 | 68 | private String version; 69 | 70 | public void setModelVersion( String modelVersion ) 71 | { 72 | this.model = modelVersion; 73 | } 74 | 75 | public void setVersion( String version ) 76 | { 77 | this.version = version; 78 | } 79 | 80 | public String modelVersion() 81 | { 82 | return model; 83 | } 84 | 85 | public String getName() 86 | { 87 | return "Foo"; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/xml/XmlStreamWriterTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.xml; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.ByteArrayOutputStream; 20 | import java.io.IOException; 21 | 22 | import junit.framework.TestCase; 23 | 24 | public class XmlStreamWriterTest 25 | extends TestCase 26 | { 27 | /** french */ 28 | private static final String TEXT_LATIN1 = "eacute: \u00E9"; 29 | /** greek */ 30 | private static final String TEXT_LATIN7 = "alpha: \u03B1"; 31 | /** euro support */ 32 | private static final String TEXT_LATIN15 = "euro: \u20AC"; 33 | /** japanese */ 34 | private static final String TEXT_EUC_JP = "hiragana A: \u3042"; 35 | /** Unicode: support everything */ 36 | private static final String TEXT_UNICODE = 37 | TEXT_LATIN1 + ", " + 38 | TEXT_LATIN7 + ", " + 39 | TEXT_LATIN15 + ", " + 40 | TEXT_EUC_JP; 41 | 42 | private static String createXmlContent( String text, String encoding ) 43 | { 44 | String xmlDecl = ""; 45 | if ( encoding != null ) 46 | { 47 | xmlDecl = ""; 48 | } 49 | String xml = xmlDecl + "\n" + text + ""; 50 | return xml; 51 | } 52 | 53 | private static void checkXmlContent( String xml, String encoding ) 54 | throws IOException 55 | { 56 | ByteArrayOutputStream out = new ByteArrayOutputStream(); 57 | XmlStreamWriter writer = new XmlStreamWriter( out ); 58 | writer.write( xml ); 59 | writer.close(); 60 | byte[] xmlContent = out.toByteArray(); 61 | String result = new String( xmlContent, encoding ); 62 | assertEquals( xml, result ); 63 | } 64 | 65 | private static void checkXmlWriter( String text, String encoding ) 66 | throws IOException 67 | { 68 | String xml = createXmlContent( text, encoding ); 69 | String effectiveEncoding = ( encoding == null ) ? "UTF-8" : encoding; 70 | checkXmlContent( xml, effectiveEncoding ); 71 | } 72 | 73 | public void testNoXmlHeader() 74 | throws IOException 75 | { 76 | String xml = "text with no XML header"; 77 | checkXmlContent( xml, "UTF-8" ); 78 | } 79 | 80 | public void testEmpty() 81 | throws IOException 82 | { 83 | ByteArrayOutputStream out = new ByteArrayOutputStream(); 84 | XmlStreamWriter writer = new XmlStreamWriter( out ); 85 | writer.flush(); 86 | writer.write( "" ); 87 | writer.flush(); 88 | writer.write( "." ); 89 | writer.flush(); 90 | writer.close(); 91 | } 92 | 93 | public void testDefaultEncoding() 94 | throws IOException 95 | { 96 | checkXmlWriter( TEXT_UNICODE, null ); 97 | } 98 | 99 | public void testUTF8Encoding() 100 | throws IOException 101 | { 102 | checkXmlWriter( TEXT_UNICODE, "UTF-8" ); 103 | } 104 | 105 | public void testUTF16Encoding() 106 | throws IOException 107 | { 108 | checkXmlWriter( TEXT_UNICODE, "UTF-16" ); 109 | } 110 | 111 | public void testUTF16BEEncoding() 112 | throws IOException 113 | { 114 | checkXmlWriter( TEXT_UNICODE, "UTF-16BE" ); 115 | } 116 | 117 | public void testUTF16LEEncoding() 118 | throws IOException 119 | { 120 | checkXmlWriter( TEXT_UNICODE, "UTF-16LE" ); 121 | } 122 | 123 | public void testLatin1Encoding() 124 | throws IOException 125 | { 126 | checkXmlWriter( TEXT_LATIN1, "ISO-8859-1" ); 127 | } 128 | 129 | public void testLatin7Encoding() 130 | throws IOException 131 | { 132 | checkXmlWriter( TEXT_LATIN7, "ISO-8859-7" ); 133 | } 134 | 135 | public void testLatin15Encoding() 136 | throws IOException 137 | { 138 | checkXmlWriter( TEXT_LATIN15, "ISO-8859-15" ); 139 | } 140 | 141 | public void testEUC_JPEncoding() 142 | throws IOException 143 | { 144 | checkXmlWriter( TEXT_EUC_JP, "EUC-JP" ); 145 | } 146 | 147 | public void testEBCDICEncoding() 148 | throws IOException 149 | { 150 | checkXmlWriter( "simple text in EBCDIC", "CP1047" ); 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.xml; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import java.io.StringReader; 20 | 21 | import junit.framework.TestCase; 22 | 23 | public class Xpp3DomUtilsTest extends TestCase { 24 | 25 | public void testCombineId() throws Exception 26 | { 27 | String lhs = "" + 28 | "LHS-ONLYLHS" + 29 | "TOOVERWRITELHS" + 30 | ""; 31 | 32 | String rhs = "" + 33 | "RHS-ONLYRHS" + 34 | "TOOVERWRITERHS" + 35 | ""; 36 | 37 | Xpp3Dom leftDom = Xpp3DomBuilder.build( new StringReader( lhs ) ); 38 | Xpp3Dom rightDom = Xpp3DomBuilder.build( new StringReader( rhs ) ); 39 | 40 | Xpp3Dom mergeResult = Xpp3DomUtils.mergeXpp3Dom( leftDom, rightDom, true ); 41 | assertEquals( 3, mergeResult.getChildren( "property" ).length ); 42 | 43 | assertEquals( "LHS-ONLY", mergeResult.getChildren( "property" )[0].getChild( "name" ).getValue() ); 44 | assertEquals( "LHS", mergeResult.getChildren( "property" )[0].getChild( "value" ).getValue() ); 45 | assertEquals( "TOOVERWRITE", mergeResult.getChildren( "property" )[1].getChild( "name" ).getValue() ); 46 | assertEquals( "LHS", mergeResult.getChildren( "property" )[1].getChild( "value" ).getValue() ); 47 | assertEquals( "RHS-ONLY", mergeResult.getChildren( "property" )[2].getChild( "name" ).getValue() ); 48 | assertEquals( "RHS", mergeResult.getChildren( "property" )[2].getChild( "value" ).getValue() ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/org/codehaus/plexus/util/xml/Xpp3DomWriterTest.java: -------------------------------------------------------------------------------- 1 | package org.codehaus.plexus.util.xml; 2 | 3 | /* 4 | * Copyright The Codehaus Foundation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | import junit.framework.TestCase; 20 | 21 | import java.io.StringWriter; 22 | 23 | /** 24 | * @author Edwin Punzalan 25 | */ 26 | public class Xpp3DomWriterTest 27 | extends TestCase 28 | { 29 | private static final String LS = System.getProperty( "line.separator" ); 30 | 31 | public void testWriter() 32 | { 33 | StringWriter writer = new StringWriter(); 34 | 35 | Xpp3DomWriter.write( writer, createXpp3Dom() ); 36 | 37 | assertEquals( "Check if output matches", createExpectedXML( true ), writer.toString() ); 38 | } 39 | 40 | public void testWriterNoEscape() 41 | { 42 | StringWriter writer = new StringWriter(); 43 | 44 | Xpp3DomWriter.write( new PrettyPrintXMLWriter( writer ), createXpp3Dom(), false ); 45 | 46 | assertEquals( "Check if output matches", createExpectedXML( false ), writer.toString() ); 47 | } 48 | 49 | private String createExpectedXML( boolean escape ) 50 | { 51 | StringBuilder buf = new StringBuilder(); 52 | buf.append( "" ); 53 | buf.append( LS ); 54 | buf.append( " element1" ); 55 | buf.append( LS ); 56 | buf.append( " " ); 57 | buf.append( LS ); 58 | buf.append( " element3" ); 59 | buf.append( LS ); 60 | buf.append( " " ); 61 | buf.append( LS ); 62 | buf.append( " " ); 63 | buf.append( LS ); 64 | buf.append( " " ); 65 | buf.append( LS ); 66 | buf.append( " " ); 67 | buf.append( LS ); 68 | if ( escape ) 69 | { 70 | buf.append( " element7" ).append( LS ).append( "&"'<>" ); 71 | } 72 | else 73 | { 74 | buf.append( " element7" ).append( LS ).append( "&\"\'<>" ); 75 | } 76 | buf.append( LS ); 77 | buf.append( " " ); 78 | buf.append( LS ); 79 | buf.append( "" ); 80 | 81 | return buf.toString(); 82 | } 83 | 84 | private Xpp3Dom createXpp3Dom() 85 | { 86 | Xpp3Dom dom = new Xpp3Dom( "root" ); 87 | 88 | Xpp3Dom el1 = new Xpp3Dom( "el1" ); 89 | el1.setValue( "element1" ); 90 | dom.addChild( el1 ); 91 | 92 | Xpp3Dom el2 = new Xpp3Dom( "el2" ); 93 | el2.setAttribute( "att2", "attribute2\nnextline" ); 94 | dom.addChild( el2 ); 95 | 96 | Xpp3Dom el3 = new Xpp3Dom( "el3" ); 97 | el3.setAttribute( "att3", "attribute3" ); 98 | el3.setValue( "element3" ); 99 | el2.addChild( el3 ); 100 | 101 | Xpp3Dom el4 = new Xpp3Dom( "el4" ); 102 | el4.setValue( "" ); 103 | dom.addChild( el4 ); 104 | 105 | Xpp3Dom el5 = new Xpp3Dom( "el5" ); 106 | dom.addChild( el5 ); 107 | 108 | // test escaping 109 | Xpp3Dom el6 = new Xpp3Dom( "el6" ); 110 | el6.setAttribute( "att6", "attribute6\n&\"'<>" ); 111 | dom.addChild( el6 ); 112 | 113 | Xpp3Dom el7 = new Xpp3Dom( "el7" ); 114 | el7.setValue( "element7\n&\"\'<>" ); 115 | el6.addChild( el7 ); 116 | 117 | return dom; 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/test/resources/dir-layout-copy/dir1/dir2/.gitignore: -------------------------------------------------------------------------------- 1 | # just here to make the directory non-empty 2 | -------------------------------------------------------------------------------- /src/test/resources/dir-layout-copy/dir1/foo.txt: -------------------------------------------------------------------------------- 1 | nothing here 2 | -------------------------------------------------------------------------------- /src/test/resources/dir-layout-copy/empty-dir/.gitignore: -------------------------------------------------------------------------------- 1 | # just here to make the directory non-empty 2 | -------------------------------------------------------------------------------- /src/test/resources/directory-scanner/foo/bar/munchy.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype/plexus-utils/5ba6cfcca911200b5b9d2b313bb939e6d7cbbac6/src/test/resources/directory-scanner/foo/bar/munchy.txt -------------------------------------------------------------------------------- /src/test/resources/directorywalker/directory1/file1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype/plexus-utils/5ba6cfcca911200b5b9d2b313bb939e6d7cbbac6/src/test/resources/directorywalker/directory1/file1.txt -------------------------------------------------------------------------------- /src/test/resources/directorywalker/directory2/directory21/file21.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype/plexus-utils/5ba6cfcca911200b5b9d2b313bb939e6d7cbbac6/src/test/resources/directorywalker/directory2/directory21/file21.txt -------------------------------------------------------------------------------- /src/test/resources/directorywalker/directory2/file2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype/plexus-utils/5ba6cfcca911200b5b9d2b313bb939e6d7cbbac6/src/test/resources/directorywalker/directory2/file2.txt -------------------------------------------------------------------------------- /src/test/resources/directorywalker/file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype/plexus-utils/5ba6cfcca911200b5b9d2b313bb939e6d7cbbac6/src/test/resources/directorywalker/file.txt -------------------------------------------------------------------------------- /src/test/resources/symlinks/dirOnTheOutside/FileInDirOnTheOutside.txt: -------------------------------------------------------------------------------- 1 | I am on the outside... 2 | -------------------------------------------------------------------------------- /src/test/resources/symlinks/onTheOutside.txt: -------------------------------------------------------------------------------- 1 | I am on the outside of the src 2 | -------------------------------------------------------------------------------- /src/test/resources/symlinks/regen.sh: -------------------------------------------------------------------------------- 1 | rm symlinks.zip 2 | rm symlinks.tar 3 | cd src 4 | zip --symlinks ../symlinks.zip file* targetDir sym* 5 | tar -cvf ../symlinks.tar file* targetDir sym* 6 | 7 | -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/aRegularDir/aRegularFile.txt: -------------------------------------------------------------------------------- 1 | I am just an ordinary file 2 | -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/fileR.txt: -------------------------------------------------------------------------------- 1 | This file is a source. r r r filemode 2 | -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/fileW.txt: -------------------------------------------------------------------------------- 1 | all w 2 | -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/fileX.txt: -------------------------------------------------------------------------------- 1 | xxx 2 | -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/symDir: -------------------------------------------------------------------------------- 1 | targetDir/ -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/symLinkToDirOnTheOutside: -------------------------------------------------------------------------------- 1 | ../dirOnTheOutside/ -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/symLinkToFileOnTheOutside: -------------------------------------------------------------------------------- 1 | ../onTheOutside.txt -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/symR: -------------------------------------------------------------------------------- 1 | fileR.txt -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/symW: -------------------------------------------------------------------------------- 1 | fileW.txt -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/symX: -------------------------------------------------------------------------------- 1 | fileX.txt -------------------------------------------------------------------------------- /src/test/resources/symlinks/src/targetDir/targetFile.txt: -------------------------------------------------------------------------------- 1 | This is a target file 2 | -------------------------------------------------------------------------------- /src/test/resources/symlinks/symlinks.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype/plexus-utils/5ba6cfcca911200b5b9d2b313bb939e6d7cbbac6/src/test/resources/symlinks/symlinks.tar -------------------------------------------------------------------------------- /src/test/resources/symlinks/symlinks.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonatype/plexus-utils/5ba6cfcca911200b5b9d2b313bb939e6d7cbbac6/src/test/resources/symlinks/symlinks.zip -------------------------------------------------------------------------------- /src/test/resources/test.txt: -------------------------------------------------------------------------------- 1 | This is a test -------------------------------------------------------------------------------- /src/test/resources/testDocument.xhtml: -------------------------------------------------------------------------------- 1 | Title

Paragraph 1, line 1. Paragraph 1, line 2.

Paragraph 2, line 1. Paragraph 2, line 2.

Section title

Sub-section title

Sub-sub-section title

Sub-sub-sub-section title
Sub-sub-sub-sub-section title
  • List item 1.
  • List item 2.

    Paragraph contained in list item 2.

    • Sub-list item 1.
    • Sub-list item 2.
  • List item 3. Force end of list:
Verbatim text not contained in list item 3
  1. Numbered item 1.
    1. Numbered item A.
    2. Numbered item B.
  2. Numbered item 2.

List numbering schemes: [[1]], [[a]], [[A]], [[i]], [[I]].

Defined term 1
of definition list.
Defined term 2
of definition list.
Verbatim text
2 |                         in a box        

--- instead of +-- suppresses the box around verbatim text.

Figure caption

Table caption
Centered
cell 1,1
Left-aligned
cell 1,2
Right-aligned
cell 1,3
cell Bold2,1cell 2,2cell 2,3

No grid, no caption:

cellcell
cellcell
headerheader
cellcell

Horizontal line:


New page.

Italic font. Bold font. Monospaced font.

Anchor. Link to Anchor. Link to http://www.pixware.fr. Link to showing alternate text. Link to Pixware home page.

Force line
break.

Non breaking space.

Escaped special characters:
~
=
-
+
*
[
]
<
>
{
}
\

Copyright symbol: ©, ©, ©.

--------------------------------------------------------------------------------