if (depot != null) {
try {
Counters counters = depot.getCounters();
Counter p4Counter = counters.getCounter(counter);
// try setting the counter back to the same value to verify permissions
counters.saveCounter(p4Counter);
} catch (PerforceException e) {
return FormValidation.error(
"Error accessing perforce while checking counter: " + e.getLocalizedMessage());
}
}