Buggy code:
public class Skeleton { private final Collection < List < AbstractHalfEdge > > polylines ; private final Set < Integer > groups1 = HashFactory . createSet ( ) ; private final Set < Integer > groups2 = HashFactory . createSet ( ) ; public Skeleton ( Mesh mesh , double angle ) { } public Collection < AbstractHalfEdge > getByGroups ( int ... groupIds ) { } public Collection < AbstractHalfEdge > getByGroups ( int groupIds ) { } public Collection < List < AbstractHalfEdge > > getPolylines ( int groupIds ) { } public Collection < List < AbstractHalfEdge > > getPolylines ( int ... groupIds ) { } private class VertexPolyline { public final List < Vertex > vertices ; public VertexPolyline ( List < AbstractHalfEdge > edges ) { } @ Override public boolean equals ( Object obj ) { } @ Override public int hashCode ( ) { } } public Collection < List < Vertex > > getPolylinesVertices ( ) { } public Collection < List < AbstractHalfEdge > > getPolylines ( ) { } private Collection < AbstractHalfEdge > getNonManifoldHE ( Mesh mesh ) { } protected boolean isNonManifold ( AbstractHalfEdge he ) { } private void getGroups ( AbstractHalfEdge v , Collection < Integer > groups ) { } private boolean isPolylineEnd ( AbstractHalfEdge edge , double angle ) { AbstractHalfEdge next = null ; if ( edge . destination ( ) . isManifold ( ) ) { Triangle triangle = ( ( Triangle ) ( edge . destination ( ) . getLink ( ) ) ) ; AbstractHalfEdge ot = edge . destination ( ) . getIncidentAbstractHalfEdge ( triangle , null ) ; assert ( ot . origin ( ) ) == ( edge . destination ( ) ) ; Vertex d = ot . destination ( ) ; do { if ( ( ( ot . destination ( ) ) != ( edge . origin ( ) ) ) && ( isNonManifold ( ot ) ) ) { if ( next == null ) next = ot ; else assert false ; } ot = ot . nextOriginLoop ( ) ; } while ( ( ot . destination ( ) ) != d ) ; } else { Iterator < AbstractHalfEdge > it = edge . destination ( ) . getNeighbourIteratorAbstractHalfEdge ( ) ; while ( it . hasNext ( ) ) { AbstractHalfEdge e = it . next ( ) ; assert e != edge ; assert ( e . origin ( ) ) == ( edge . destination ( ) ) ; if ( ( ( ( next == null ) || ( ( e . destination ( ) ) != ( next . destination ( ) ) ) ) && ( ( e . destination ( ) ) != ( edge . origin ( ) ) ) ) && ( isNonManifold ( e ) ) ) { if ( next == null ) next = e ; else return true ; } } } if ( next == null ) return true ; if ( ( edge . hasAttributes ( IMMUTABLE ) ) != ( next . hasAttributes ( IMMUTABLE ) ) ) return true ; if ( ( edge . hasAttributes ( BOUNDARY ) ) && ( next . hasAttributes ( BOUNDARY ) ) ) { <START_BUG> if ( ( edge . getTri ( ) ) != ( next . getTri ( ) ) ) <END_BUG> return true ; } else { groups1 . clear ( ) ; groups2 . clear ( ) ; getGroups ( edge , groups1 ) ; getGroups ( next , groups2 ) ; if ( ! ( groups1 . equals ( groups2 ) ) ) return true ; } if ( angle > ( 2 * ( Math . PI ) ) ) return true ; return ( edge . destination ( ) . angle3D ( edge . origin ( ) , next . destination ( ) ) ) < angle ; } private List < AbstractHalfEdge > createPolyline ( AbstractHalfEdge startEdge , Collection < Vertex > possibleEnds ) { } private Collection < List < AbstractHalfEdge > > computePolylines ( Collection < AbstractHalfEdge > input , double angle ) { } public static void main ( final String [ ] args ) { } }

Fix:
if ( ( edge . getTri ( ) . getGroupId ( ) ) != ( next . getTri ( ) . getGroupId ( ) ) )