Here you can find the source of isPSQLUniqueViolation(SQLException ex)
public static boolean isPSQLUniqueViolation(SQLException ex)
//package com.java2s; //License from project: Apache License import java.sql.SQLException; import java.util.Objects; public class Main { /**/*from w w w. ja va2 s. co m*/ * Is the specified exception a PostgreSQL unique violation. */ public static boolean isPSQLUniqueViolation(SQLException ex) { return "23505".equals(Objects.requireNonNull(ex).getSQLState()); } }