ÿþI n d e x :   D : / e c l i p s e / a p a c h e - w o r k s p a c e / l i n k c h e c k / p r o j e c t . x m l  
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =  
 - - -   D : / e c l i p s e / a p a c h e - w o r k s p a c e / l i n k c h e c k / p r o j e c t . x m l 	 ( r e v i s i o n   2 6 4 7 6 4 )  
 + + +   D : / e c l i p s e / a p a c h e - w o r k s p a c e / l i n k c h e c k / p r o j e c t . x m l 	 ( w o r k i n g   c o p y )  
 @ @   - 1 5 1 , 2 5   + 1 5 1 , 9   @ @  
               < v e r s i o n > 1 . 2 . 8 < / v e r s i o n > 
           < / d e p e n d e n c y > 
           < d e p e n d e n c y > 
 -             < g r o u p I d > d o m 4 j < / g r o u p I d > 
 -             < a r t i f a c t I d > d o m 4 j < / a r t i f a c t I d > 
 -             < v e r s i o n > 1 . 4 - d e v - 8 < / v e r s i o n > 
 -         < / d e p e n d e n c y > 
 -         < d e p e n d e n c y > 
 -             < g r o u p I d > j t i d y < / g r o u p I d > 
 -             < a r t i f a c t I d > j t i d y < / a r t i f a c t I d > 
 -             < v e r s i o n > 4 a u g 2 0 0 0 r 7 - d e v < / v e r s i o n > 
 -         < / d e p e n d e n c y > 
 -         < d e p e n d e n c y > 
               < g r o u p I d > m a v e n < / g r o u p I d > 
               < a r t i f a c t I d > m a v e n < / a r t i f a c t I d > 
               < v e r s i o n > 1 . 0 . 2 < / v e r s i o n > 
           < / d e p e n d e n c y > 
 -         < d e p e n d e n c y > 
 -             < j a r > j s - 1 . 5 R 4 - R C 3 . j a r < / j a r > 
 -             < g r o u p I d > r h i n o < / g r o u p I d > 
 -             < a r t i f a c t I d > r h i n o < / a r t i f a c t I d > 
 -             < v e r s i o n > 1 . 5 R 4 - R C 3 < / v e r s i o n > 
 -         < / d e p e n d e n c y > 
       < / d e p e n d e n c i e s > 
   < / p r o j e c t > 
 I n d e x :   D : / e c l i p s e / a p a c h e - w o r k s p a c e / l i n k c h e c k / s r c / m a i n / o r g / a p a c h e / m a v e n / l i n k c h e c k / F i l e T o C h e c k . j a v a  
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =  
 - - -   D : / e c l i p s e / a p a c h e - w o r k s p a c e / l i n k c h e c k / s r c / m a i n / o r g / a p a c h e / m a v e n / l i n k c h e c k / F i l e T o C h e c k . j a v a 	 ( r e v i s i o n   2 6 4 7 4 1 )  
 + + +   D : / e c l i p s e / a p a c h e - w o r k s p a c e / l i n k c h e c k / s r c / m a i n / o r g / a p a c h e / m a v e n / l i n k c h e c k / F i l e T o C h e c k . j a v a 	 ( w o r k i n g   c o p y )  
 @ @   - 1 7 , 2 9   + 1 7 , 1 9   @ @  
     *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
     * / 
   
 - i m p o r t   j a v a . i o . B u f f e r e d I n p u t S t r e a m ; 
 - i m p o r t   j a v a . i o . B y t e A r r a y O u t p u t S t r e a m ; 
   i m p o r t   j a v a . i o . F i l e ; 
 - i m p o r t   j a v a . i o . F i l e I n p u t S t r e a m ; 
 - i m p o r t   j a v a . i o . F i l e N o t F o u n d E x c e p t i o n ; 
   i m p o r t   j a v a . i o . I n p u t S t r e a m ; 
   i m p o r t   j a v a . i o . O u t p u t S t r e a m ; 
 - i m p o r t   j a v a . i o . P r i n t W r i t e r ; 
   i m p o r t   j a v a . u t i l . I t e r a t o r ; 
   i m p o r t   j a v a . u t i l . L i n k e d L i s t ; 
   i m p o r t   j a v a . u t i l . L i s t ; 
   i m p o r t   j a v a . u t i l . S e t ; 
 - i m p o r t   j a v a . u t i l . T r e e S e t ; 
   
   i m p o r t   o r g . a p a c h e . c o m m o n s . l o g g i n g . L o g ; 
   i m p o r t   o r g . a p a c h e . c o m m o n s . l o g g i n g . L o g F a c t o r y ; 
   i m p o r t   o r g . a p a c h e . m a v e n . l i n k c h e c k . v a l i d a t i o n . L i n k V a l i d a t i o n I t e m ; 
   i m p o r t   o r g . a p a c h e . m a v e n . l i n k c h e c k . v a l i d a t i o n . L i n k V a l i d a t i o n R e s u l t ; 
   i m p o r t   o r g . a p a c h e . m a v e n . l i n k c h e c k . v a l i d a t i o n . L i n k V a l i d a t o r M a n a g e r ; 
 - i m p o r t   o r g . d o m 4 j . D o c u m e n t ; 
 - i m p o r t   o r g . d o m 4 j . N o d e ; 
 - i m p o r t   o r g . d o m 4 j . i o . D O M R e a d e r ; 
 - i m p o r t   o r g . w 3 c . t i d y . T i d y ; 
   
   / * * 
     *   @ a u t h o r   < a   h r e f = " m a i l t o : b w a l d i n g @ a p a c h e . o r g " > B e n   W a l d i n g < / a > 
 @ @   - 8 8 , 7   + 7 8 , 7   @ @  
                           f i n a l   S e t   h r e f s ; 
                           t r y 
                           { 
 -                                 h r e f s   =   g e t L i n k s ( ) ; 
 +                                 h r e f s   =   L i n k M a t c h e r . m a t c h ( f i l e T o C h e c k ) ; 
                           } 
                           c a t c h   ( T h r o w a b l e   e ) 
                           { 
 @ @   - 1 4 3 , 3 4   + 1 3 3 , 6   @ @  
                   } 
           } 
   
 -         p r i v a t e   S e t   g e t L i n k s ( )   t h r o w s   F i l e N o t F o u n d E x c e p t i o n 
 -         { 
 -                 B y t e A r r a y O u t p u t S t r e a m   b a o s   =   n e w   B y t e A r r a y O u t p u t S t r e a m ( ) ; 
 -                 P r i n t W r i t e r   e r r O u t   =   n e w   P r i n t W r i t e r ( b a o s ) ; 
 -                 B u f f e r e d I n p u t S t r e a m   b i n   =   n e w   B u f f e r e d I n p u t S t r e a m ( n e w   F i l e I n p u t S t r e a m ( f i l e T o C h e c k ) ) ; 
 -                 t r y 
 -                 { 
 -                         T i d y   t i d y   =   g e t T i d y ( ) ; 
 -                         t i d y . s e t E r r o u t ( e r r O u t ) ; 
 -                         L O G . d e b u g ( " P r o c e s s i n g : "   +   f i l e T o C h e c k ) ; 
 -                         o r g . w 3 c . d o m . D o c u m e n t   d o m D o c u m e n t   =   t i d y . p a r s e D O M ( b i n ,   n u l l ) ; 
 - 
 -                         / /   n o w   r e a d   a   d o m 4 j   d o c u m e n t   f r o m 
 -                         / /   J T i d y ' s   W 3 C   D O M   o b j e c t 
 -                         f i n a l   D O M R e a d e r   d o m R e a d e r   =   n e w   D O M R e a d e r ( ) ; 
 -                         f i n a l   D o c u m e n t   d o c   =   d o m R e a d e r . r e a d ( d o m D o c u m e n t ) ; 
 - 
 -                         L O G . d e b u g ( b a o s . t o S t r i n g ( ) ) ; 
 - 
 -                         r e t u r n   f i n d U n i q u e L i n k s ( d o c ) ; 
 -                 } 
 -                 f i n a l l y 
 -                 { 
 -                         c l o s e ( b i n ) ; 
 -                         c l o s e ( b a o s ) ; 
 -                 } 
 -         } 
 - 
           p r i v a t e   v o i d   c l o s e ( I n p u t S t r e a m   i s ) 
           { 
                   t r y 
 @ @   - 1 7 9 , 7   + 1 4 1 , 7   @ @  
                   } 
                   c a t c h   ( E x c e p t i o n   e ) 
                   { 
 -                         / / D o n ' t   r e a l l y   c a r e . 
 +                         / /   D o n ' t   r e a l l y   c a r e . 
                   } 
           } 
   
 @ @   - 1 9 5 , 4 3   + 1 5 7 , 6   @ @  
                   } 
           } 
   
 -         p r i v a t e   S e t   f i n d U n i q u e L i n k s ( D o c u m e n t   d o c ) 
 -         { 
 -                 L i s t   x p a t h R e s u l t s   =   n e w   L i n k e d L i s t ( ) ; 
 - 
 -                 x p a t h R e s u l t s . a d d A l l ( d o c . s e l e c t N o d e s ( " / / a / @ h r e f " ) ) ; 
 -                 x p a t h R e s u l t s . a d d A l l ( d o c . s e l e c t N o d e s ( " / / i m g / @ s r c " ) ) ; 
 - 
 -                 / / < l i n k   r e l = " s t y l e s h e e t "   h r e f = " . . . " > 
 -                 x p a t h R e s u l t s . a d d A l l ( d o c . s e l e c t N o d e s ( " / / l i n k / @ h r e f " ) ) ; 
 - 
 -                 / / < s c r i p t   s r c = " h t t p : / / a r . a t w o l a . c o m / f i l e / a d s W r a p p e r . j s " > 
 -                 x p a t h R e s u l t s . a d d A l l ( d o c . s e l e c t N o d e s ( " / / s c r i p t / @ s r c " ) ) ; 
 - 
 -                 S e t   r e s u l t s   =   n e w   T r e e S e t ( ) ; 
 -                 I t e r a t o r   l i n k I t e r   =   x p a t h R e s u l t s . i t e r a t o r ( ) ; 
 -                 w h i l e   ( l i n k I t e r . h a s N e x t ( ) ) 
 -                 { 
 -                         N o d e   n o d e   =   ( N o d e )   l i n k I t e r . n e x t ( ) ; 
 -                         S t r i n g   h r e f   =   n o d e . g e t T e x t ( ) ; 
 -                         r e s u l t s . a d d ( h r e f ) ; 
 -                 } 
 - 
 -                 r e t u r n   r e s u l t s ; 
 -         } 
 - 
 -         p r i v a t e   T i d y   g e t T i d y ( ) 
 -         { 
 -                 T i d y   t i d y   =   n e w   T i d y ( ) ; 
 -                 t i d y . s e t M a k e C l e a n ( t r u e ) ; 
 -                 t i d y . s e t X m l T a g s ( t r u e ) ; 
 -                 t i d y . s e t X m l O u t ( t r u e ) ; 
 -                 t i d y . s e t X H T M L ( t r u e ) ; 
 -                 t i d y . s e t Q u i e t ( t r u e ) ; 
 -                 t i d y . s e t S h o w W a r n i n g s ( f a l s e ) ; 
 -                 r e t u r n   t i d y ; 
 -         } 
 - 
           / * * 
             *   R e t u r n s   t h e   m e s s a g e . 
             *   @ r e t u r n   S t r i n g 
 I n d e x :   D : / e c l i p s e / a p a c h e - w o r k s p a c e / l i n k c h e c k / s r c / m a i n / o r g / a p a c h e / m a v e n / l i n k c h e c k / L i n k M a t c h e r . j a v a  
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =  
 - - -   D : / e c l i p s e / a p a c h e - w o r k s p a c e / l i n k c h e c k / s r c / m a i n / o r g / a p a c h e / m a v e n / l i n k c h e c k / L i n k M a t c h e r . j a v a 	 ( r e v i s i o n   0 )  
 + + +   D : / e c l i p s e / a p a c h e - w o r k s p a c e / l i n k c h e c k / s r c / m a i n / o r g / a p a c h e / m a v e n / l i n k c h e c k / L i n k M a t c h e r . j a v a 	 ( r e v i s i o n   0 )  
 @ @   - 0 , 0   + 1 , 1 1 1   @ @  
 + p a c k a g e   o r g . a p a c h e . m a v e n . l i n k c h e c k ;  
 +  
 + / *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =  
 +   *       C o p y r i g h t   2 0 0 1 - 2 0 0 4   T h e   A p a c h e   S o f t w a r e   F o u n d a t i o n .  
 +   *  
 +   *       L i c e n s e d   u n d e r   t h e   A p a c h e   L i c e n s e ,   V e r s i o n   2 . 0   ( t h e   " L i c e n s e " ) ;  
 +   *       y o u   m a y   n o t   u s e   t h i s   f i l e   e x c e p t   i n   c o m p l i a n c e   w i t h   t h e   L i c e n s e .  
 +   *       Y o u   m a y   o b t a i n   a   c o p y   o f   t h e   L i c e n s e   a t  
 +   *  
 +   *               h t t p : / / w w w . a p a c h e . o r g / l i c e n s e s / L I C E N S E - 2 . 0  
 +   *  
 +   *       U n l e s s   r e q u i r e d   b y   a p p l i c a b l e   l a w   o r   a g r e e d   t o   i n   w r i t i n g ,   s o f t w a r e  
 +   *       d i s t r i b u t e d   u n d e r   t h e   L i c e n s e   i s   d i s t r i b u t e d   o n   a n   " A S   I S "   B A S I S ,  
 +   *       W I T H O U T   W A R R A N T I E S   O R   C O N D I T I O N S   O F   A N Y   K I N D ,   e i t h e r   e x p r e s s   o r   i m p l i e d .  
 +   *       S e e   t h e   L i c e n s e   f o r   t h e   s p e c i f i c   l a n g u a g e   g o v e r n i n g   p e r m i s s i o n s   a n d  
 +   *       l i m i t a t i o n s   u n d e r   t h e   L i c e n s e .  
 +   *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =  
 +   * /  
 +  
 + i m p o r t   j a v a . i o . B u f f e r e d R e a d e r ;  
 + i m p o r t   j a v a . i o . F i l e ;  
 + i m p o r t   j a v a . i o . F i l e R e a d e r ;  
 + i m p o r t   j a v a . i o . I O E x c e p t i o n ;  
 + i m p o r t   j a v a . u t i l . S e t ;  
 + i m p o r t   j a v a . u t i l . T r e e S e t ;  
 + i m p o r t   j a v a . u t i l . r e g e x . M a t c h e r ;  
 + i m p o r t   j a v a . u t i l . r e g e x . P a t t e r n ;  
 +  
 + / * *  
 +   *   L i n k   m a t c h e r .   R e a d s   t h e   c o n t e n t s   o f   a   f i l e   a n d   t r i e s   t o   m a t c h   t h e   f o l l o w i n g :  
 +   *   < c o d e >  
 +   *   < a   h r e f = " " . . . .  
 +   *   < l i n k   h r e f = " " . . . .  
 +   *   < i m g   s r c = " " . . . .  
 +   *   < s c r i p t   s r c = " " . . . .  
 +   *   < / c o d e >  
 +   *    
 +   *   @ a u t h o r   < a   h r e f = " m a i l t o : m a c @ a p a c h e . o r g " > I g n a c i o   G .   M a c   D o w e l l   < / a >  
 +   * /  
 + c l a s s   L i n k M a t c h e r   {  
 +  
 + 	 / * *  
 + 	   *   R e g e x p   f o r   l i n k   m a t c h i n g .  
 + 	   * /  
 + 	 p r i v a t e   f i n a l   s t a t i c   P a t t e r n   p   =   P a t t e r n  
 + 	 	 	 . c o m p i l e (  
 + 	 	 	 	 	 " < ( ? > l i n k | a | i m g | s c r i p t ) [ ^ > ] * ? ( ? > h r e f | s r c ) \ \ s * ? = \ \ s * ? [ \ \ \ " ' ] ( . * ? ) [ \ \ \ " ' ] [ ^ > ] * ? " ,  
 + 	 	 	 	 	 P a t t e r n . C A S E _ I N S E N S I T I V E ) ;  
 +  
 + 	 / * *  
 + 	   *   N o   n e e d   t o   c r e a t e   a   n e w   o b j e c t   e a c h   t i m e   a   f i l e   i s   p r o c e s s e d .   J u s t   c l e a r  
 + 	   *   i t .  
 + 	   * /  
 + 	 p r i v a t e   f i n a l   s t a t i c   S e t   l i n k L i s t   =   n e w   T r e e S e t ( ) ;  
 +  
 + 	 / * *  
 + 	   *   R e a d s   a   f i l e   a n d   r e t u r n s   a   S t r i n g B u f f e r   w i t h   i t s   c o n t e n t s .  
 + 	   *    
 + 	   *   T O D O :   C h e c k   f o r   e n c o d i n g   i s s u e s  
 + 	   *    
 + 	   *   T O D O :   B e t t e r   e x c e p t i o n   h a n d l i n g ?  
 + 	   *    
 + 	   *   @ p a r a m   f i l e  
 + 	   *                         t h e   f i l e   w e   a r e   r e a d i n g  
 + 	   *   @ r e t u r n   a   S t r i n g B u f f e r   w i t h   f i l e ' s   c o n t e n t s .  
 + 	   *   @ t h r o w s   I O E x c e p t i o n  
 + 	   * /  
 + 	 p r i v a t e   s t a t i c   S t r i n g B u f f e r   f i l e T o S t r i n g B u f f e r ( F i l e   f i l e )  
 + 	 	 	 t h r o w s   I O E x c e p t i o n   {  
 + 	 	 B u f f e r e d R e a d e r   r e a d e r   =   n u l l ;  
 + 	 	 f i n a l   S t r i n g B u f f e r   p a g e B u f f e r   =   n e w   S t r i n g B u f f e r ( ) ;  
 + 	 	 t r y   {  
 + 	 	 	 r e a d e r   =   n e w   B u f f e r e d R e a d e r ( n e w   F i l e R e a d e r ( f i l e ) ) ;  
 + 	 	 	 S t r i n g   l i n e ;  
 + 	 	 	 w h i l e   ( ( l i n e   =   r e a d e r . r e a d L i n e ( ) )   ! =   n u l l )   {  
 + 	 	 	 	 p a g e B u f f e r . a p p e n d ( l i n e ) ;  
 + 	 	 	 }  
 + 	 	 }   f i n a l l y   {  
 + 	 	 	 r e a d e r . c l o s e ( ) ;  
 + 	 	 }  
 + 	 	 r e t u r n   p a g e B u f f e r ;  
 + 	 }  
 +  
 + 	 / * *  
 + 	   *   P e r f o r m s   t h e   a c t u a l   m a t c h i n g .  
 + 	   *    
 + 	   *   @ p a r a m   f i l e  
 + 	   *                         t h e   f i l e   t o   c h e c k  
 + 	   *   @ r e t u r n   a   s e t   w i t h   a l l   l i n k s   t o   c h e c k  
 + 	   *   @ t h r o w s   I O E x c e p t i o n  
 + 	   * /  
 + 	 s t a t i c   S e t   m a t c h ( F i l e   f i l e )   t h r o w s   I O E x c e p t i o n   {  
 + 	 	 l i n k L i s t . c l e a r ( ) ;  
 + 	 	 f i n a l   M a t c h e r   m   =   p . m a t c h e r ( f i l e T o S t r i n g B u f f e r ( f i l e ) ) ;  
 + 	 	 S t r i n g   l i n k ;  
 + 	 	 w h i l e   ( m . f i n d ( ) )   {  
 + 	 	 	 l i n k   =   m . g r o u p ( 1 ) . t r i m ( ) ;  
 + 	 	 	 i f   ( l i n k . l e n g t h ( )   <   1 )   {  
 + 	 	 	 	 c o n t i n u e ;  
 + 	 	 	 }   e l s e   i f   ( l i n k . t o L o w e r C a s e ( ) . i n d e x O f ( " j a v a s c r i p t " )   ! =   - 1 )   {  
 + 	 	 	 	 c o n t i n u e ;  
 + 	 	 	 }  
 + 	 	 	 / /   e l s e   i f   ( l i n k . t o L o w e r C a s e ( ) . i n d e x O f ( " m a i l t o : " )   ! =   - 1 )   {  
 + 	 	 	 / /   c o n t i n u e ;  
 + 	 	 	 / /   }  
 + 	 	 	 l i n k L i s t . a d d ( l i n k ) ;  
 + 	 	 }  
 + 	 	 r e t u r n   l i n k L i s t ;  
 + 	 }  
 +  
 + }  
 
