cormander

yet another linux engineer

Jun

29

java ftp plugin barfs on whitespace

By cormander

Now I’m not sure if this is from bad coding on part of the hudson FTPPublisher plugin or from java.net’s URI.create, but:

Connecting to rpm.cormander.com
FATAL: null
java.lang.IllegalArgumentException
	at java.net.URI.create(URI.java:842)
	at java.net.URI.resolve(URI.java:1028)
	at com.zanox.hudson.plugins.FTPPublisher.perform(FTPPublisher.java:131)
	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:56)
	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:379)
	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:367)
	at hudson.model.Build$RunnerImpl.post2(Build.java:183)
	at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:352)
	at hudson.model.Run.run(Run.java:958)
	at hudson.model.Build.run(Build.java:112)
	at hudson.model.ResourceController.execute(ResourceController.java:93)
	at hudson.model.Executor.run(Executor.java:118)
Caused by: java.net.URISyntaxException: Illegal character in path at index 7: Vanilla Kernel 32bit
	at java.net.URI$Parser.fail(URI.java:2809)
	at java.net.URI$Parser.checkChars(URI.java:2982)
	at java.net.URI$Parser.parseHierarchical(URI.java:3066)
	at java.net.URI$Parser.parse(URI.java:3024)
	at java.net.URI.<init>(URI.java:578)
	at java.net.URI.create(URI.java:840)
	... 11 more

Emphasis on the: Illegal character in path at index 7: Vanilla Kernel 32bit

Well, assuming we start counting from zero, which we do in an array index (and strings are still arrays in addition to being objects in java), the illegal character is a space. What, can’t convert a space to a %20 for me? Renaming my project to Vanilla%20Kernel%2032bit would look kind of ugly.

I ended up renaming it to kernel-32bit, and that has fixed the problem… sort of. Then there came this:

Connecting to rpm.cormander.com
file:/var/build/workspace/kernel-32bit/kernel-32bit
ERROR: Failed to upload files
hudson.util.IOException2: remote file operation failed
	at hudson.FilePath.act(FilePath.java:645)
	at hudson.FilePath.act(FilePath.java:633)
	at hudson.FilePath.list(FilePath.java:1038)
	at com.zanox.hudson.plugins.FTPPublisher.perform(FTPPublisher.java:144)
	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:56)
	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:379)
	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:367)
	at hudson.model.Build$RunnerImpl.post2(Build.java:183)
	at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:352)
	at hudson.model.Run.run(Run.java:958)
	at hudson.model.Build.run(Build.java:112)
	at hudson.model.ResourceController.execute(ResourceController.java:93)
	at hudson.model.Executor.run(Executor.java:118)
Caused by: java.io.IOException: Expecting Ant GLOB pattern, but saw '/home/hudson/rpmbuild/TARGETS/kernel.i686/*rpm'. See http://ant.apache.org/manual/CoreTypes/fileset.html for syntax
	at hudson.FilePath.glob(FilePath.java:1059)
	at hudson.FilePath.access$000(FilePath.java:155)
	at hudson.FilePath$24.invoke(FilePath.java:1040)
	at hudson.FilePath$24.invoke(FilePath.java:1038)
	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1783)
	at hudson.remoting.UserRequest.perform(UserRequest.java:103)
	at hudson.remoting.UserRequest.perform(UserRequest.java:47)
	at hudson.remoting.Request$2.run(Request.java:236)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

Long story short, turns out ant doesn’t like full path names, which means the rpmbuild stuff needs to exist within the hudson workspace. A security mesure I would assume. Anyway, I set the %_topdir for the hudson user to be %(pwd)/rpmbuild and manually created that directory (and the necessary subdirectories within it) and built the RPM and ftp’d it over just fine, sort of.

I was using the ravencore project to test since it only takes a minute to do, rather than two hours. This is what the file on the remote ftp server ended up being:

./ravencore/2009-06-29_09-59-47/file:/var/www/.hudson/jobs/ravencore/workspace/rpmbuild/RPMS/noarch/ravencore-0.3.6-0.1246291028.noarch.rpm

I really expected it to be:

./ravencore/ravencore-0.3.6-0.1246291028.noarch.rpm

I’m gonna have to try out the scp plugin instead to see if I can avoid this.

Comments are closed.