How to check if account does not exist with the Java SDK? and how to know if a public key is valid?
I found one way to the first question but is not a clean solution
Server server = new Server("https://horizon-testnet.stellar.org");
// It will throw HttpResponseException if account does not exist or there was another error.
try {
server.accounts().account("GDCI7LNULXXFMM42JAZ4734YU4IVUJEGOHLQRKPXHYJVZGQPEKNN5NNO");
}
} catch (Exception e) {
e.printStackTrace();
}
When the account does not exist it accuses an exception but I cannot assure that this is the reason that originated it.
So, exist a pre filter to identify in principle if an account's public key does not have the correct format? (to avoid sending the query to the server)