-
-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve diagnostics for JarCache write errors (related to JENKINS-36947) #91
Changes from all commits
9cc8817
d802d55
03ce0ae
e332fc4
11c7bda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package hudson.remoting; | ||
|
||
import org.jvnet.animal_sniffer.IgnoreJRERequirement; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
|
@@ -14,8 +16,10 @@ | |
import java.net.Proxy; | ||
import java.net.SocketAddress; | ||
import java.net.URL; | ||
import javax.annotation.Nonnull; | ||
import javax.net.ssl.HttpsURLConnection; | ||
import javax.net.ssl.SSLSocketFactory; | ||
import java.nio.file.Files; | ||
import java.util.Iterator; | ||
|
||
/** | ||
|
@@ -247,4 +251,26 @@ static InetSocketAddress getResolvedHttpProxyAddress(String host, int port) thro | |
} | ||
return targetAddress; | ||
} | ||
|
||
@IgnoreJRERequirement @SuppressWarnings("Since15") | ||
static void mkdirs(@Nonnull File file) throws IOException { | ||
if (file.isDirectory()) return; | ||
|
||
try { | ||
Class.forName("java.nio.file.Files"); | ||
Files.createDirectories(file.toPath()); | ||
return; | ||
} catch (ClassNotFoundException e) { | ||
// JDK6 | ||
} catch (ExceptionInInitializerError e) { | ||
// JDK7 on multibyte encoding (http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7050570) | ||
} | ||
|
||
// Fallback | ||
if (!file.mkdirs()) { | ||
if (!file.isDirectory()) { | ||
throw new IOException("Directory not created"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe not ideal. E.g. we do not check this directory is writable, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which directory, the target one? I think that is out of the scope of the method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can finally drop support of Java 6 in remoting.
@stephenc is going to introduce some incompatible code, and maybe we will need remoting 3 in any case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any chance to cut a JDK6 release with this fix, first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I've forgotten you're on 1.580.
Right now there is no strong need to migrate, so I would not like to hurry too much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not any more, it is 1.609 but the limitation remains.