Well known deprecated issue causing me a problem. The following line "expiry = new Date(dt);" is the targeted script. To explain in detail I successfully used to
Date expiry = null;
String dt;
if(!(dt=str.nextToken()).equals("null"));
{
  expiry = new Date(dt);
}
Using these lines in the scrips to read the cookies from the file. Yes, the "Date" is deprecated. I have read some solutions but still there are chain of errors while correcting it.
What will be the correct one in the place of "date". Also I provide the full script below
package test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Date;
import java.util.StringTokenizer;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Reader {
public static void main(String[] args) {
System.setProperty ("webdriver.chrome.driver", "D:\\Selenium\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.gmail.com");
try{
    File f = new File("browser.data");
    FileReader fr = new FileReader(f);
    BufferedReader br = new BufferedReader(fr);
String line;
while ((line = br.readLine())!=null){
StringTokenizer str = new StringTokenizer (line, ";");
while (str.hasMoreTokens()) {
    String name = str.nextToken();
    String value = str.nextToken();
    String domain = str.nextToken();
    String path = str.nextToken();
    Date expiry = null;
    String dt;
    if(!(dt=str.nextToken()).equals("null"));
    {
        expiry = new Date(dt);
    }
    boolean isSecure = new Boolean(str.nextToken()).booleanValue();
    Cookie ck = new Cookie (name,value,domain,path,expiry,isSecure);
    driver.manage().addCookie(ck);
    br.close();
}
}
}
catch (Exception ex)
{
    ex.printStackTrace();
}
driver.get("http://gmail.com");
}
}
 
     
     
    