Skip to content
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

Fix grails-core issue #9018 - Unable to create SSL cert w/ jdk8 #14

Merged
merged 2 commits into from
Jun 19, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 16 additions & 10 deletions profiles/base/commands/run-app.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try {
commandLine.systemProperties.each { key, value ->
arguments << "-D${key}=$value".toString()
}

if(port) {
arguments << "-Dgrails.server.port=$port"
}
Expand All @@ -43,9 +43,9 @@ try {
console.updateStatus "Generated SSL certificate"
}
else {
console.warn "Unable to automatically generate SSL certificate, manual configuration required. Set 'server.ssl.key-store' in application.yml"
console.warn "Unable to automatically generate SSL certificate, manual configuration required. Set 'server.ssl.key-store' in application.yml"
}

}
else {
keyStoreParametersAvailable = true
Expand Down Expand Up @@ -100,7 +100,7 @@ protected boolean createSSLCertificate(File keystoreDir) {
catch(Throwable e) {
return false
}

return true
}
else {
Expand All @@ -111,16 +111,22 @@ protected boolean createSSLCertificate(File keystoreDir) {
protected Class getKeyToolClass() {
try {
try {
return Class.forName( 'sun.security.tools.KeyTool' )
// Sun JDK 8
return Class.forName( 'sun.security.tools.keytool.Main' )
}
catch (ClassNotFoundException e) {
// no try/catch for this one, if neither is found let it fail
return Class.forName( 'com.ibm.crypto.tools.KeyTool' )
catch(ClassNotFoundException e1) {
try {
// Sun pre-JDK 8
return Class.forName( 'sun.security.tools.KeyTool' )
}
catch (ClassNotFoundException e2) {
// no try/catch for this one, if neither is found let it fail
return Class.forName( 'com.ibm.crypto.tools.KeyTool' )
}
}

}
catch(Throwable e) {
return null
}

}