Get a string from an iterator object. Help

Hello community,

I have this code fragment in my application and it complains about this line:

strGUID = (String) it.next ();

I'm trying to get the string that I'm pulling in the loop so I can handle. The funny thing is that I am able to print the entire string like this:

out.println (attrName + "=" + it.next () + "< br >");

But I wan to store this string in a variable, and I can't. The code is below. I have bolded two statements that I try to use to store the string in a variable, and it does not work. Advice please?


If (uploading! = null) {}
out.println ("< tr >");
out.println ("< td valign = top > < attributes b >: < /b > < table >");
Iterator iter = attrs.keySet () .iterator ();
out.println ("< td >");
String strguid = ""; " *
While (iter.hasNext ()) {}
String attrName = (String) iter.next ();
Set attrVals = attrs.get (attrName) (HashSet);
If ((attrVals! = null) & &! attrVals.isEmpty ()) {}
Iterator it = attrVals.iterator ();
While (it.hasNext ()) {}
out.println (attrName + "=" + it.next () + "< br >");
* strguid = (String) it.next (); *
}
}
}

Strange that it fixes the problem now, but when you "which tried" above it did not work.

Tags: Java

Similar Questions

  • Get a string from a selected path

    Hello

    I have the following piece of code in my script (which works fine)

    Dim result: result = DirListGet ("C:\","*.adf","filename","FullFileNamesRecursive")

    Instead of simply using the phone book "C:\". ", I would like to invite the user to choose one.

    I tried to use Application.DlgPathSelect as PathNameGet select a path, but I don't know how to put a string representing the path selected in the above DirListGet method.

    Thanks in advance,

    Omar

    Hello Omar.

    Use it like this

    If "IDOk" = PathDlgShow ("select a directory for the adf files", "C:") then
    Dim result: result = DirListGet (OutPutPath, "*.adf", "filename", "FullFileNamesRecursive")
    end if

    Greetings

    Andreas

  • Unable to connect to the internet after getting an update from Microsoft, Windows Vista Help

    After getting an update Microsoft my computer will connect is the internet. All services are disabled. I didn't get the updates and restarted my computer. How can I get services running again. When I did an IPCONFIG command output and renew it says RPC server is unavailable.

    http://www.bleepingcomputer.com/tutorials/tutorial140.html

    Understanding Windows Update and Extras in Windows Vista at the link above.

     

    Remove the Vista updates; two ways to do this:

    1. a System Restore to before the updates:

    Click Start > programs > Accessories > system tools > System Restore > restore time/choose your own date > next

    If you use Norton, disable it before using the system restore.

    If it is impossible to enter the Normal Mode, do a Safe Mode system restore:

    Press F8 at the startup/power and the list of startup options, use THE ARROW key to select Safe mode > and then press ENTER.

    System restore steps according to the info above.

    Also:

    2. click on start > right click on computer > properties > Windows updates down the lower left corner > updates installed in the lower left corner in the next window

    > then click the one that you don't want > uninstall will appear at the top > uninstall it.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    In addition, on the page where you clicked "Installed updates", click on change settings at the top left corner it

    > Change update settings in the next page of AutoUpdate to "check for updates but let me choose etc" > OK ".

    When you take a look at pending updates, you can either download/install them one at the time, namely the update causing you problems.

    > or if you do not need an individual > right-click on > UAC prompt > hide it

    See you soon.

    Mick Murphy - Microsoft partner

  • URGENT::opening multiple files - i have 3 files in my directory... When I run the code I can open a file and read it... but the while loop get blocked after the first iteration... can someone me help or give some indications

    bbmChatDB of public database;

    public static FileConnection fconnRead = null;
    public static String fileReadData = "";
    public static InputStream is = null;
    data Byte [] = null;
    DataInputStream is = null;

    Here is my code...

    I have 3 files in my directory... When I run the code I can open a file and read it... but the while loop get blocked after the first iteration... can someone me help or give some indications

    try {}

    FileConnection fc = Connector.open("file:///store/home/user/documents/BSM/") (FileConnection); "

    If (fc.exists ()) {}

    Enumeration e = fc.list ();

    While (e.hasMoreElements ()) {}

    System.out.println ("files are:" + (String) e.nextElement ());

    play this file
    StringBuffer stringBuff = new StringBuffer();
    try {}
    System.out.println ("opening file")-;
    System.out.println ("file name is:" + (String) e.nextElement ());
    fconnRead = Connector.open("file:///store/home/user/documents/BSM/(String)e.nextElement(),Connector.READ_WRITE) (FileConnection);
    System.out.println ("data length")-;
    If (fconnRead.exists ()) {}
    is = fconnRead.openDataInputStream ();
    data = IOUtilities.streamToBytes (is);
    Ddd = new String string (data);
    fileReadData = ddd.toString ();
    System.out.println ("length of data:" + fileReadData.length ());
    System.out.println ("read data :" + fileReadData);

    }

    } catch (IOException ee) {}
    ee.printStackTrace ();
    System.out.println ("Exception in the read data :")
    + ee.getMessage ());
    }

    }
    }

    } catch (IOException e) {}

    e.printStackTrace ();
    }

    {Finally

    try {}
    If (is! = null) {}
    is. Close();
    }
    System.out.println ("is closed...");
    } catch (IOException e1) {}

    E1. PrintStackTrace();
    }

    If (fconnRead! = null) {}
    try {}
    fconnRead.close ();
    } catch (Exception e) {}
    System.out.println (try ());
    }

    }

    }

    You can recode this treatment so that it uses only:

    e.nextElement ())

    Once a loop iteration.

    Directly at the start saying something like:

    String fileName = e.nextElement ());

    and use fileName everywhere in your loop.

    Also be aware that printStackTrace() will do nothing in your situation, it only works if you catch Throwable.  So make sure you something output all your catches exception and also have a catch (Throwable t) to catch the things you miss, as follows:

    {} catch (Throwable t)

    t.printStackTrace ();

    System.out.println ("Eception exception:" + t.toString ());

    }

    I think your code is thrown an exception and you don't see it.

  • Vista 64-bit now I changed my OS 32-bit now my web cam does not work, tried to get the drivers from dell but did not help

    of the vista 64-bit now, I changed my OS to Vista 32 bit , now my web cam does not work, tried to get the drivers from dell, but they are not available there. My laptop is studio-1537... Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Hello

    I check your firewall settings to see if it can cause a conflict with the season chat software.

    Chris
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to get the external Bitmap of URL object

    Hi all!

    I'm a developer starting with components of BlackBerry, I try to get a Bitmap of the outer object
    URL, but my getImage method does not work correctly. I think that the problem lies in the getImage method. just at the moment where I try to
    create form of Bitmap bytes. Note: J2me with the Image object, that it works!

    could someone help me please?

    Sorry for my bad English & thank you for helping me!

    Code:

    SerializableAttribute public class MainForm extends form {}

    private String url = "http://user-xxxx/json.js";
    private String [] imageURLs = new String [5];

    public MainForm() {}

    try {}
    getJSON (url);
    } catch (IOException e) {}
    e.printStackTrace ();
    }

    try {}
    Add (GetImage(this.imageURLs[0]));
    } catch (Exception e) {}
    e.printStackTrace ();
    }
    }

    Public Sub getJSON (String url) throws IOException {}
    StringBuffer sb = new StringBuffer();
    InputStream is = null;
    HttpConnection hc = null;
    try {}
    long bytesLength = 0;
    int ch = 0;
    HC = (HttpConnection), Connector.open (url);
    is = hc.openInputStream ();
    bytesLength = hc.getLength ();
    If (bytesLength! = - 1) {}
    for (int i = 0; i)< byteslength;="" i++)="">
    If ((ch = is.read (())! = - 1) {}
    SB. Append ((Char) ch);
    }
    }
    } else {}
    While ((ch = is.read (())! = - 1) {}
    bytesLength = is.available ();
    SB. Append ((Char) ch);
    }
    }
    parseJSON (sb.toString ());
    } {Finally
    is. Close();
    HC. Close();
    }
    }

    {} public void parseJSON (String sb)
    try {}
    JSONObject jo = new JSONObject (sb);
    If (jo! = null) {}
    JSONObject channel = jo.getJSONObject ("channel");
    If (channel! = null) {}
    JSONArray points = channel.getJSONArray("item");
    If (items! = null) {}
    for (int i = 0; i)< items.length();="" i++)="">
    JSONObject point = items.getJSONObject (i);
    this.imageURLs [i] = item.getString ("image");
    }
    }
    }
    }
    } catch (Exception e) {}
    e.printStackTrace ();
    }
    }

    I think that the problem lies in this method.

    public BitmapField getImage (String url) throws Exception {}
    InputStream inputStream = Connector.openInputStream (url) (InputStream);
    Bitmap image = null;
    BitmapField bf = null;
    try {}
    ByteArrayOutputStream Baos = new ByteArrayOutputStream();
    int ch;
    While ((ch = inputStream.read ())! = - 1) {}
    Baos.Write (ch);
    }
    Byte [] imageData = baos.toByteArray ();
    Image = Bitmap.createBitmapFromBytes (imageData, 0, imageData.length, 1);
    BF = new BitmapField (image);
    } {Finally
    If (inputStream! = null)
    inputStream.close ();
    }
    return (bf == null? null: bf);
    }

    public String [] getImageURLs() {}
    Return this.imageURLs;
    }

    }

    Finally my fatal mistake was in archive JSON, I change the URL of the images of http://localhost/image.jpg to
    http://user-xxx/image.jpg (MDS - CS available in http://localhost URL: 8080 /), and now it works!

    Ted and arkadyz, your suggestions have been very helpful for me, thank you very much!

    Final code:

    Class MainMIDlet

    Import net.rim.device.api.ui.UiApplication;

    SerializableAttribute public class MainMIDlet extends UiApplication {}

    public MainMIDlet() {}
    MainForm mf = new MainForm();
    pushScreen (mf);
    }

    Public Shared Sub main (String [] args) {}
    MainMIDlet mm = new MainMIDlet();
    mm.enterEventDispatcher ();
    }
    }

    Class MainForm

    import java.io.ByteArrayOutputStream.
    import java.io.IOException;
    import java.io.InputStream;

    Import javax.microedition.io.Connector;
    Import javax.microedition.io.HttpConnection;

    Import org.json.me.JSONArray;
    Import org.json.me.JSONObject;

    Import net.rim.device.api.system.EncodedImage;
    Import net.rim.device.api.ui.component.BitmapField;
    Import net.rim.device.api.ui.component.LabelField;
    Import net.rim.device.api.ui.container.MainScreen;

    SerializableAttribute public class MainForm extends form {}

    private String url = "http://user-xxx/json.js";
    private String [] jsonTitles = new String [5];
    private String [] jsonImages = new String [5];
    private LabelField lf = null;
    private BitmapField bf = null;

    public MainForm() {}

    try {}
    getJSON (url);
    } catch (IOException e) {}
    e.printStackTrace ();
    }

    LF = getLabelField(this.jsonTitles[0]);
    Add (LF);

    try {}
    BF = getBitmapField(this.jsonImages[0]);
    } catch (Exception e) {}
    e.printStackTrace ();
    }
    Add (BF);

    }

    Public Sub getJSON (String url) throws IOException {}
    StringBuffer sb = new StringBuffer();
    InputStream is = null;
    HttpConnection hc = null;
    try {}
    long bytesLength = 0;
    int ch = 0;
    HC = (HttpConnection), Connector.open (url);
    is = hc.openInputStream ();
    bytesLength = hc.getLength ();
    If (bytesLength! = - 1) {}
    for (int i = 0; i)< byteslength;="" i++)="">
    If ((ch = is.read (())! = - 1) {}
    SB. Append ((Char) ch);
    }
    }
    } else {}
    While ((ch = is.read (())! = - 1) {}
    bytesLength = is.available ();
    SB. Append ((Char) ch);
    }
    }
    parseJSON (sb.toString ());
    } {Finally
    is. Close();
    HC. Close();
    }
    }

    {} public void parseJSON (String sb)
    try {}
    JSONObject jo = new JSONObject (sb);
    If (jo! = null) {}
    JSONObject channel = jo.getJSONObject ("channel");
    If (channel! = null) {}
    JSONArray points = channel.getJSONArray("item");
    If (items! = null) {}
    for (int i = 0; i)< items.length();="" i++)="">
    JSONObject point = items.getJSONObject (i);
    this.jsonTitles [i] = item.getString ("title");
    this.jsonImages [i] = item.getString ("image");
    }
    }
    }
    }
    } catch (Exception e) {}
    e.printStackTrace ();
    }
    }

    public getLabelField (String title) {} LabelField
    LabelField lf = new LabelField (title);
    return of lf;
    }

    public BitmapField getBitmapField (String url) throws IOException {}
    InputStream is = Connector.openInputStream (url) (InputStream);
    BitmapField bf = null;
    try {}
    ByteArrayOutputStream Baos = new ByteArrayOutputStream();
    int ch;
    While ((ch = is.read (())! = - 1) {}
    Baos.Write (ch);
    }
    imageData Byte = baos.toByteArray ();
    BF = new BitmapField (EncodedImage.createEncodedImage (imageData, 0,))
    (imageData.length) .getBitmap ());
    } {Finally
    If (is! = null) {}
    is. Close();
    }
    }
    return (bf == null? null: bf);
    }

    }

  • get the "message of the website" "object error" what is it

    When you choose Explorer and sometimes other sites, I get a "message from the Web site" box and it says "object error" and I can not remove it as it appears to go faster, you can lock a page.

    Hi Dale,

    Welcome to the community Microsoft and thanks for posting the question.

    According to the description provided, you have problems with the object error while accessing Web sites.

    1. which browser is installed on the computer?

    2. the problem including Web sites?

    Perform the steps suggested by Smitty cat if you have Internet Explorer from the link below and check.

    http://answers.Microsoft.com/en-us/IE/Forum/IE8-Windows_7/receiving-object-error-after-opening-Internet/79e00b17-58a6-4fad-a7ad-3d023af2667d

    Warning: Reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings.

    Answer to us if you are having problems with the error of the object or any other issue of Windows, and we would be happy to help you.

    Good day!

    Hope this information helps.

  • ADF MOBILE: How to get selected line of an iterator in java

    Hello

    I'm calling this function:

    providerChangeSupport.fireProviderChange (String providerKey, int currentRowKey, object newValue);

    to update an individual line in an iterator.

    What value should I use for the parameter 'currentRowKey '?

    It is just the index of the line?

    If this is not the case, what is the value, and how do I get it?

    Thank you.

    Hello

    Try

    ValueExpression expression = AdfmfJavaUtilities.getValueExpression ("#{bindings.getMyIterator}", Object.class);

    AmxIteratorBinding amxIterator = expression.getValue (AdfmfJavaUtilities.getAdfELContext ()) (AmxIteratorBinding);

    BasicIterator basicIterator = amxIterator.getIterator ();

    GenericType line = (GenericType) iter.getCurrentRow ();

    YourEntity entity = row.getDataProvider ((YourEntity));


    Frank

  • Get the checksum of the database objects

    Hi, is it possible to get the hash of the database objects (called features) using PL SQL?

    Constraints I manually copy certain functions I write dev to UAT, but want to make sure to have all the objects schema are identical (have the same checksum).

    See you soon.

    With the help of Oracle XE 11 G on Linux.

    You can use rawtohex (dbms_crypto.hash (dbms_metadata.get_ddl ('PACKAGE', , ), DBMS_CRYPTO.hash_md5)), for example:

    select rawtohex(dbms_crypto.hash(dbms_metadata.get_ddl('PACKAGE', 'MY_PKG', 'MY_USER'), 2)) hashval
    from dual;
    
  • Huawei P9 - I have many issues with getting my pictures from the phone to my Imac

    Huawei P9 - I have many issues with getting my pictures from the phone to iphoto on my Mac.

    Before the summer I bought a Huawei P9 phone, I can easily see the photos on the phone - I can't just them on my mac.  When I connect via a USB cable, it refuses my permissions.

    I try to use my Google account to view on the Mac and move the iPhoto - I can't work either! I can see them, I can't move them!

    I'm pulling my hair out and I have enough to do with! Help, please...

    Jim Hosking

    You need the phone provider support - there is a problem with the way their phone works and how to use it and has nothing to do with the Photos or iPhoto - if pictures is consistent with standards of good Photos and iPhoto won't work with it

    You may need special third party software for your phone load in Photos or iPhoto

    LN

  • I lost my cd of Microsoft, but I have coverage which is the product number how to get the software from apple

    I lost my CD of Microsoft office, but I cover that has the product key and the proof of license do I get Apple online? can someone help me please. Thank you

    You get software Microsoft from Microsoft, not Apple, it is available for download.

  • How to quickly get 100 + photos from iPhone in pictures on iMac with the download speed very low broadband?

    Hi all

    I have an iPhone 6 Plus running iOS 9.3.1 and a retina iMac running OSX El Capitan 10.1.4.  I use iCloud photo library and I like the idea of having all the pictures synced across all devices.  This works well for one or two odd photos I take here and there.

    I have just been on vacation and taken 100 + photos with my iPhone and want to create an album of photo printed on my iMac, but the problem I am facing is that it takes so long to get the pictures on pictures on my iMac.

    My download speed high speed is very low - on 0.3Mbit / s, so the photos are always download to iCloud from my iPhone now, and I guess it will be another day or two to complete.

    Is it possible to get the photos from my iPhone to the iMac more quickly without creating duplicates or spoil my library?

    It's so frustrating to have to wait 5 days after her return from vacation before you can start making a photo album.

    Thanks for any help,

    Kind regards

    Ben

    You can connect the phone with USB and import or use iTunes sync or Capture of Image - this can cause a problem with duplicates

    And of course, you can stop by a store StarBucks, Apple (or other WiFi hotspot with good service) and complete quickly

    LN

  • Is the another way to get the download from the support section

    Is there another way to get the download from the support section?

    Because the download speed is very slow. For example, in the new version of the value-added packaging and its 116 MB big need. A normal download time would be approximately 5-10 minutes. But when I download from Toshiba I need 2 to 6 hours. Not good for a company that manufactures laptops and high-performance computers.

    And the worst thing is that the connection is reset after a few hours... so I'll never get the update.

    Does anyone know help?

    Gruss
    Thomas

    Unfortunately, he has no other way to get the Toshiba drivers from the European pilot of Toshiba page.
    You are right at this moment that the file transfer is too long.
    I get about 10-19KO/s. That s is really very slow.
    Maybe the server is overloaded who knows I hope this will be resolved in the next time.

    Best regards

  • Satellite 5005-S504: where can I get a driver from his BACK?

    How do noise at work in DOS? Where can I get a driver from his BACK?
    Audio chip is Yamaha YMF753.
    Help, please!

    Thank you...

    Hello

    Unfortunately, you won't find all the BACK drivers for this device.
    I put t know why you need these drivers, but as far as I know there is no drivers BACK.

    Just FYI: perhaps a compatible Sound Blaster BACK driver works but I n t think so. Google a bit for this kind of audio driver.

  • How to get the string (specified by row and column) of txt file with labview

    Hello world

    How to get the string (specified by row and column) of txt file with labview

    THX

    As far as I know, a text file has no column.  Be more specific.  Do you mean something like the 5th word on line 4, where the words are separated by a space, and lines are separated by a newline character?  You can read from the spreadsheet String function and set the delimiter to a space.  This will produce a 2D channels table.  Then use the table to index and give the line number and column number.

Maybe you are looking for