JDK-8190194 : keytool error: java.io.FileNotFoundException when using dot in folder name.
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 8u162
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows
  • CPU: x86_64
  • Submitted: 2017-10-22
  • Updated: 2017-12-06
  • Resolved: 2017-10-26
Description
FULL PRODUCT VERSION :


ADDITIONAL OS VERSION INFORMATION :
on Windows Platform if folder name contains . ( DOT). exception keytool error: java.io.FileNotFoundException: is thrown

e.g. 
keytool error: java.io.FileNotFoundException: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks (The system cannot find the path specified)
java.io.FileNotFoundException: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks (The system cannot find the path specified)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at sun.security.tools.keytool.Main.doCommands(Unknown Source)
    at sun.security.tools.keytool.Main.run(Unknown Source)
    at sun.security.tools.keytool.Main.main(Unknown Source)


https://stackoverflow.com/questions/46871893/keystore-the-system-cannot-find-the-path-specified?noredirect=1#comment80694046_46871893

A DESCRIPTION OF THE PROBLEM :
Review complete thread here. 

https://stackoverflow.com/questions/46871893/keystore-the-system-cannot-find-the-path-specified?noredirect=1#comment80694046_46871893

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
https://stackoverflow.com/questions/46871893/keystore-the-system-cannot-find-the-path-specified?noredirect=1#comment80694046_46871893

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
keytool should able to run without .(DOT) in folder name
ACTUAL -
java.io.FileNotFoundException:  is thrown

ERROR MESSAGES/STACK TRACES THAT OCCUR :
keytool error: java.io.FileNotFoundException: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks (The system cannot find the path specified)
java.io.FileNotFoundException: C:\Users\alexey.t\Downloads\ElAl\app\src\res\raw\myKeystore.bks (The system cannot find the path specified)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at sun.security.tools.keytool.Main.doCommands(Unknown Source)
    at sun.security.tools.keytool.Main.run(Unknown Source)
    at sun.security.tools.keytool.Main.main(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
remove .(DOT) from folder name and keytool works correctly


Comments
This is not reproducible, most likely an issue with submitter's environment. Created a folder with name "try.it" (dot in folder name), the import went successful. D:\src>keytool -importcert -v -trustcacerts -file D:\KeyStores\try.it\server-public.cer -alias server -keystore D:\KeyStores\try.it\server-public.bks -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath D:\bcprov-jdk15on-158.jar -storetype BKS -storepas s abc@123 Owner: CN=XXXX, OU=JPG, O=Oracle India, L=Bangalore, ST=Karnataka, C=IN Issuer: CN=XXXX, OU=JPG, O=Oracle India, L=Bangalore, ST=Karnataka, C=IN Serial number: 41494a26 Valid from: Mon May 16 12:33:31 IST 2016 until: Sun Aug 14 12:33:31 IST 2016 Certificate fingerprints: MD5: 2C:5D:75:29:3E:CF:06:45:2F:49:49:9B:54:A2:DB:C8 SHA1: 93:D8:10:F0:E5:90:BF:5C:94:AA:FE:11:9D:61:90:A6:C9:70:72:E6 SHA256: 72:5A:2E:EF:03:35:2E:F4:40:B2:1F:42:E3:B0:43:A0:7F:B9:1F:18:5A:39:10:AD:2F:2E:39:92:58:6F:BC:13 Signature algorithm name: SHA256withRSA Subject Public Key Algorithm: 2048-bit RSA key Version: 3 Extensions: #1: ObjectId: 2.5.29.14 Criticality=false SubjectKeyIdentifier [ KeyIdentifier [ 0000: EF F8 75 19 59 0C 58 C3 FE CA 09 02 10 46 F6 13 ..u.Y.X......F.. 0010: C6 8B FD DE .... ] ] Trust this certificate? [no]: y Certificate was added to keystore [Storing D:\KeyStores\try.it\server-public.bks] D:\src>keytool -list -keystore D:\KeyStores\try.it\server-public.bks -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath D:\bcprov-jdk15on-158.jar -storetype BKS -storepass abc@123 Keystore type: BKS Keystore provider: BC Your keystore contains 1 entry server, Oct 26, 2017, trustedCertEntry, Certificate fingerprint (SHA1): 93:D8:10:F0:E5:90:BF:5C:94:AA:FE:11:9D:61:90:A6:C9:70:72:E6
26-10-2017