commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bur...@apache.org
Subject cvs commit: jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser Main.java
Date Wed, 21 Apr 2004 07:16:03 GMT
burton      2004/04/21 00:16:03

  Modified:    feedparser/src/java/org/apache/commons/feedparser Main.java
  Log:
  console parser has error handling and URL support
  
  Revision  Changes    Path
  1.2       +20 -2     jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/Main.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Main.java	21 Apr 2004 07:00:06 -0000	1.1
  +++ Main.java	21 Apr 2004 07:16:03 -0000	1.2
  @@ -36,7 +36,25 @@
   
           FeedParserListener listener = new DebugFeedParserListener();
   
  -        parser.parse( listener, new FileInputStream( args[0] ) );
  +        if ( args.length != 1 ) {
  +
  +            System.err.println( "SYNTAX: " + Main.class.getName() + " file|url" );
  +            
  +            System.exit( 1 );
  +            
  +        }
  +        
  +        String input = args[0];
  +
  +        InputStream is = null;
  +
  +        if ( input.startsWith( "http://" ) ) {
  +            is = new URL( input ).openStream();
  +        } else {
  +            is = new FileInputStream( input );
  +        }
  +
  +        parser.parse( listener, is );
   
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message