Have errors in my code

i tryed to extracte links from url page. and now i have some errors can you place help me.my errors only in the first part of code.
thanks alot.
package hw;
import java.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import javax.swing.text.html.parser.Parser;
import org.w3c.dom.NodeList;
public class copy {
     public static void main(String[] args){     
     Collection<String>  links = new ArrayList<String>();
     try {
String target=null;
          target = target.trim( );
          QueryString query = new QueryString("search", target);
       URI uriLink = new URI("http://search.dmoz.org/cgi-bin/search?" + query);
       Parser parser = new Parser(null);
      parser.setInputHTML(htmlBody);
       NodeList list = parser.extractAllNodesThatMatch(new NodeClassFilter (LinkTag.class));
       for (int i = 0; i < list.size (); i++){
        LinkTag extracted = (LinkTag)list.elementAt(i);
         String extractedLink = extracted.getLink();
         links.add(extractedLink);
     } catch (Exception e) {
       e.printStackTrace();
}}}package hw;
import java.net.URLEncoder;
import java.io.UnsupportedEncodingException;
public class QueryString {
private StringBuffer query = new StringBuffer();
public QueryString() {}
public QueryString(String name, String value) {
encode(name, value);
public synchronized void add(String name, String value) {
query.append('&');
encode(name, value);
private synchronized void encode(String name, String                value) {
          try {
query.append(URLEncoder.encode(name, "UTF-8"));
query.append('=');
query.append(URLEncoder.encode(value, "UTF-8"));
catch (UnsupportedEncodingException ex) {
throw new RuntimeException(
               "Broken VM does not support UTF-8");
public String getQuery() {
return query.toString();
public String toString() {
return getQuery();

i wrote anther code but still don't know what are the errors.
thanks for the time.
package hw;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.HTML.Attribute;
import javax.swing.text.html.HTML.Tag;
import javax.swing.text.html.HTMLEditorKit.ParserCallback;
import javax.swing.text.html.parser.ParserDelegator;
import com.macfaq.net.QueryString;
public class hwOne {
  public final static void main(String[] args) throws Exception
    final ArrayList<String> list = new ArrayList<String>();
    ParserDelegator parserDelegator = new ParserDelegator();
    ParserCallback parserCallback = new ParserCallback() {
      public void handleText(final char[] data, final int pos) {
      public void handleStartTag(Tag tag, MutableAttributeSet attribute, int pos) {
        if (tag == Tag.A) {
          String address = (String) attribute.getAttribute(Attribute.HREF);
          list.add(address);
      public void handleEndTag(Tag t, final int pos) {
      public void handleSimpleTag(Tag t, MutableAttributeSet a, final int pos) {
      public void handleComment(final char[] data, final int pos) {
      public void handleError(final java.lang.String errMsg, final int pos) {
    String target = null;
     try     
     BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
     target= in.readLine();     
     catch(IOException e)
     System.out.println("IOException has been caught");
    target = target.trim( );
    QueryString query = new QueryString("search", target);
    parserDelegator.parse(new FileReader("http://search.dmoz.org/cgi-bin/search?" + query), parserCallback, false);
    System.out.println(list);
   the errors:
vit
Exception in thread "main" java.io.FileNotFoundException: http:\search.dmoz.org\cgi-bin\search?search=vit (The filename, directory name, or volume label syntax is incorrect)
     at java.io.FileInputStream.open(Native Method)
     at java.io.FileInputStream.<init>(Unknown Source)
     at java.io.FileInputStream.<init>(Unknown Source)
     at java.io.FileReader.<init>(Unknown Source)
     at hw.hwOne.main(hwOne.java:62)

Similar Messages

  • "Import-Module virtualmachinemanager" always have error in C# code.

    static void Main(string[] args)
    InitialSessionState initial = InitialSessionState.CreateDefault();
    initial.ImportPSModule(new string[] { "virtualmachinemanager" });
    Runspace runspace = RunspaceFactory.CreateRunspace(initial);
    runspace.Open();
    PowerShell ps = PowerShell.Create();
    ps.Runspace = runspace;
    ps.Commands.AddCommand("get-vm");
    try
    Collection<PSObject> list = ps.Invoke();
    foreach (var item in list)
    Console.WriteLine(item.TypeNames);
    catch (Exception ex)
    Console.WriteLine(ex.Message);
    Console.ReadLine();
    I want to get vm list by C#,how can I fix this issue?
    Besr regards

    Hi Royeh,
    I cannot download your sample. Maybe you can describe your problem in here. This forum have lots of kind persons who will help you solve your problem.
    For a programmer, it also important for a programmer that how to ask a question correctly and effectively.
    Best regards,
    Shu Hu
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Error handling return code for Provide Statement

    Hi Experts,
    For select statement we have error handling return code sy-subrc.
    What is the error handling return code for provide.. end provide statement.
    Thanks,
    Ragu

    Ragu,
    Same thing.
    Check sy-subrc.
    sy-subrc is the return code for all ABAP statements as far as I know.
    Regards,
    Dilek

  • I have a an iMac 27" and am trying to import some videos of a friends wedding into iMovie however one of the movies won't import. It doesn't say why or give any error message or codes. All of the other movies on the card download with out a problem.

    I have an iMac 27" and am trying to import some videos of a friends wedding into iMovie however one of the movies won't import. It doesn't say why or give any error message or codes.
    All of the other movies on the card download with out a problem. The movie in question is not 'corrupt' as you can watch it in iMovie direct from the SD card but as soon as you try to import it, it  just says 'error'. iIve tried moving the file to an external drive ( and other variations on this theme) then importing but have had no luck.
    Can anyone please help me.

    The mystery remains....
    Thanks for the pointers. The file type is .mts (a proprietry sony one).
    I have now found some video converter software (Wondershare and iSkysoft) at a cost. Either will convert this file for me into .mp4. This I can then import into iMovie without any problems. I've checked this on the trial versions and it worked well but without paying am left with a giant watermark in the video
    The mystery (which I still havent solved) is why did 20 other .mts files import fine and then this one not?
    If you could point me in the direction of some free .mts converter software that would be the cherry on the cake.
    Thanks

  • I cannot install Creative Suite 5.5 on my Windows 7 Professional. I keep getting error message: "Exit Code: 15 - Media DB sync failed". I have disabled UAC and Startup items and Services with no luck. Can you please help?

    I cannot install Creative Suite 5.5 on my Windows 7 Professional. I keep getting error message: "Exit Code: 15 - Media DB sync failed". I have disabled UAC and Startup items and Services with no luck. Can you please help?

    I am sorry Erickkasner but there is no longer direct support provided for Creative Suite 5.5 installation issues.
    You are welcome to post any specific errors you are able to discover within your installation log to this discussion.  Since you are using Windows then Exit Code 15 could mean one of the following:
    Installer database is corrupted
    Update pending to your operating system
    Improper permissions set for the Media.db
    The installation log file should provide additional insight into the exact error you are experiencing.  Please make sure to use the find command to look for the words 'ERROR' and 'FATAL' to locate the relevant error messages.

  • I have an issue installing photoshop CC trial, I currently have elements and wanted to see the differences before buying, when installing through the creative cloud app I get the error message  Exit Code: 7 Please see specific errors below for troubleshoo

    I have an issue installing photoshop CC trial, I currently have elements and wanted to see the differences before buying, when installing through the creative cloud app I get the error message  Exit Code: 7 Please see specific errors below for troubleshooting. For example,  ERROR: DW041 ...   -------------------------------------- Summary --------------------------------------   - 0 fatal error(s), 1 error(s)
    ERROR: DW041: INSTALLDIR Volume D:\ doesn't exist.  -------------------------------------------------------------------------------------  System Requirements  and it will not install, It says cant find the path D: im not sure why because as far as I can see its set to install on drive C: which is where I want it!

    Exit Code: 6, Exit Code: 7 Installation Errors - http://helpx.adobe.com/creative-suite/kb/errors-exit-code-6-exit.html
    Troubleshoot with install logs | CS5, CS5.5, CS6 - http://helpx.adobe.com/creative-suite/kb/troubleshoot-install-logs-cs5-cs5.html for information on how to review your installation logs

  • I am trying to activate new itunes card. I am getting error message: The code you have entered has not been properly activated. Does this mean the store did something wrong or me?

    I am trying to activate new itunes card. I am getting error message: The code you have entered has not been properly activated. Does this mean the store did something wrong or me?

    Yes, the store didn't properly activate the card. If the store is nearly then you could try going back and asking them to do so, if it isn't (or if they can't/won't help) then try contacting iTunes Support (you will probably need to give them images of the front and back of the card, and possibly its receipt) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then iTunes Cards And Codes

  • TS2380 It's says I have error code (13014) but I cant open iTunes or get on the internet

    It's says I have error code (13014) but I cant open iTunes or get on the internet

    "Extended" network means your phone is picking up towers from another carrier that Sprint has an agreement with. Long story short, Sprint does not have adquate coverage in the area where you are located when you see "extended".

  • My friend has send me a app gift he is in UK and i am in pakistan my itunes is showing error of redeem code which i dont have ?? require help

    my friend has send me a app gift he is in UK and i am in pakistan my itunes is showing error of redeem code which i dont have ?? require help

    You cannot gift to another country.
    Sorry.

  • HT201210 I have error code -43 when trying to upgrade iPhone 3GS running v4.3 to version 5 or above. This error occurs whilst trying to back up phone during upgrade process. 2GB of free memory on phone. Can anyone help?

    I have error code -43 when trying to upgrade iPhone 3GS running v4.3 to version 5 or above. This error occurs whilst trying to back up phone during upgrade process. 2GB of free memory on phone. Can anyone help?

    Well I spoke too soon.
    The update was successful, but now I cannot connect to the 3GS data network.
    Cannot get email and cannot open a page in Safari.
    +"Safari could not open the page because the server stopped responding."+
    +"Cannot Get Mail+
    +THe mail server is not responding. Verify that you have entered the correct account info in Mail settings."+
    Email and internet work fine on WiFi.........no data using 3GS network.
    Looks like I will have to revert back to old OS.

  • I keep getting an error message that I have an invalid security code when trying to make purchased in itunes.  But my security code and billing info are valid.  How do I rectify this problem?

    I keep getting an error message that I have an invalid security code when trying to make purchased in itunes.  But my security code and billing info are valid.  How do I rectify this problem?

    Did you ever get an answer to this? Im having same issue now! So frustrating!

  • TS3694 have error code 3194. how can i get ride of it

    have error code 3194 on iphone 4..phone dose not turn on

    look to the right in the MORE LIKE THIS box

  • I have error code -36.need help!

    I bought a new macbook air yesterday.along with it i purchased seagate expansion drive 1tb.
    i copied stuff from my windows laptop to the external HDD.
    when i connected it to my mac it asked that i can use this as backup drive .
    so i copied all the files to my desktop on mac.
    the external HDD got formatted and i formatted the other partition to exFat
    i want to copy the files on my desktop back to hard disk but i have error code 36 and my external HDD gets disconnected and won't mount back.
    FIXES tried
    used the "dot_clean" on all the folders.
    repared disk permissions
    verified disk all of them(macbook and external)
    checked the external HDD by copying huge folders from my iMac(sure that external HDD is fine)
    ran diagnostics during boot(says everything is OK)
    formatted the entire External HDD to ms-dos,exfat,macos journaled .(still same error)
    tried copying single huge file (some movie.mp4) still get the error.

    Hey thanks a lot, it worked like a charm!

  • TS1424 i have error code 1009

    i have error code:1009 on my iphone & ipad
    i can't download any files from itunes.
    please let me know how can i solve this problem
    on my ipad i can't do anything.

    Hi,
    If you could read your data/files now, please back them up. You need to replace the HDD. Is your machine still under warranty ? If yes you can contact HP support using the following contact points:
      http://welcome.hp.com/country/w1/en/support.html
    Good luck.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • I believe I have implemented it correctly but I am not receiving the notifications on my phone. I have an ad hoc provisioning profile set up.  I have the device token from the phone through NSLOG to console. I have the dot net code running without errors.

    I believe I have implemented it correctly but I am not receiving the notifications on my phone. I have an ad hoc provisioning profile set up.  I have the device token from the phone through NSLOG to console. I have the dot net code running without errors.The notifications just don’t appear.
    Any ideas where I am going wrong?

    IMAP account access by itself does not provide for syncing contacts, calendar events, and notes or anything over the air. This is possible with an Exchange account accessed via ActiveSync with the Exchange Server.
    If your company email account is an Exchange Account, your company's IT Dept. has enabled IMAP account access for your Exchange account on the Exchange server?
    If an Exchange account, the IT Dept. must have ActiveSync enabled for your account on the Exchange Server to create and access the account as an Exchange account which provides Push access for received messages, and over the air syncing for contacts and calendar events with the Exchange Server.

Maybe you are looking for

  • Where can i buy an extended charger

    I'm looking for a charger for my macbook pro 13" that i bought in 2011. The length of my current one is too short and I can't be far from the plug. Also, if my macbook has been charging all day and I take it off the charger automatically it is at 98%

  • Raising error in process chain

    Hi, I have a change routine that calls a function within an InfoPackage.  The InfoPackage is in turn in a process chain.  The change routine calls a function which can raise an exception.  If an exception is returned the predefined field 'p_subrc' wi

  • Windows rac实例崩溃

    ALTER SYSTEM SET service_names='hbhis','SYS$SYS.KUPC$C_1_20120917120007.HBHIS' SCOPE=MEMORY SID='hbhis1'; Mon Sep 17 12:00:08 2012 ALTER SYSTEM SET service_names='SYS$SYS.KUPC$C_1_20120917120007.HBHIS','hbhis','SYS$SYS.KUPC$S_1_20120917120007.HBHIS'

  • OIM: Question on Process Task configuration

    Hi OIM guru, I have a process form and a child form. I have a process task that gets triggered when a child entry is added. My question is, is there a way to avoid duplicate child table entries? For example, a user can have groups g1, g2 ... etc. How

  • Itunes isn't saving anything i do on my ipod touch.

    When i try to put an app on my iPod Touch it doesn't save anything and it says it is over capacity. I dont have much on there but a few gigs of songs and like a gig of apps. I have an 8gb iPod Touch 4th gen.