code: private static Polygon insertVertexInPolygon(Polygon polygon,
              Point vertexPoint, double tolerance) throws SQLException {        
          Polygon geom =polygon;
          LineString linearRing = polygon.getExteriorRing();
          int index = -1;
          for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
              double distCurr = computeDistance(polygon.getInteriorRingN(i),vertexPoint, tolerance);
              if (distCurr<tolerance){
                  index = i;
              }
          }        
          if(index==-1){
              //The point is a on the exterior ring.
              LinearRing inserted = insertVertexInLinearRing(linearRing, vertexPoint, tolerance);
              if(inserted!=null){
              LinearRing[] holes = new LinearRing[polygon.getNumInteriorRing()];
              for (int i = 0; i < holes.length; i++) {
                  holes[i]= (LinearRing) polygon.getInteriorRingN(i);
              }
              geom = FACTORY.createPolygon(inserted, holes);
              }
          }
          else{
              //We add the vertex on the first hole
              LinearRing[] holes = new LinearRing[polygon.getNumInteriorRing()];
              for (int i = 0; i < holes.length; i++) {
                  if (i == index) {
                      holes[i] = insertVertexInLinearRing(polygon.getInteriorRingN(i), vertexPoint, tolerance);
                  } else {
                      holes[i] = (LinearRing) polygon.getInteriorRingN(i);
                  }
              }
              geom = FACTORY.createPolygon((LinearRing) linearRing, holes);
          }       
          if(geom!=null){
          if (!geom.isValid()) {
              throw new SQLException("Geometry not valid");
          }
          }
          return geom;
      }
docs: Adds a vertex into a Polygon with a given tolerance.
  
  @param polygon
  @param vertexPoint
  @param tolerance
  @return
  @throws SQLException