Revision 39053 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/toolListeners/snapping/snappers/IntersectionPointSnapper.java

View differences:

IntersectionPointSnapper.java
28 28
    
29 29
	private static int maxPointsGeom = 1000;
30 30
	private List<Geometry> geometries;
31
	private static long lastLogTime = 0;
31 32

  
32 33
    public Point2D getSnapPoint(Point2D point, Geometry geom,
33 34
        double tolerance, Point2D lastPointEntered) {
......
72 73
                return geometry.getHandlers(Geometry.SELECTHANDLER)[0].getPoint();
73 74
            }
74 75
        } catch (GeometryOperationNotSupportedException e) {
75
            LOG.error("Is not possible to intersect these geometries", e);
76
            LOG.error("Unable to intersect these geometries", e);
76 77
        } catch (GeometryOperationException e) {
77
            LOG.error("Is not possible to intersect these geometries", e);
78
            LOG.error("Unable to intersect these geometries", e);
79
        } catch (Exception e) {
80
            /*
81
             * Sometimes there is a JTS TopologyException.
82
             * The cause is unknown because it's difficult to
83
             * reproduce, but probably caused by extremely similar
84
             * geometries. This is unlikely to cause functionality
85
             * problems, so we'll only log it once every 5 seconds
86
             * (otherwise the user can see performance issues because
87
             * this exception is thrown many times in those strange
88
             * cases) 
89
             */
90
            long curr_time = System.currentTimeMillis();
91
            // This ensures not more than one log every 5 seconds
92
            if (curr_time - lastLogTime > 5000) {
93
                LOG.info("Error while intersecting.", e);
94
                lastLogTime = curr_time;
95
            }
78 96
        }    
79 97
    	
80 98
    	return null;

Also available in: Unified diff