I have code that looks through a list of projects and for every channel it finds it populates the channel class with data using the channelID (because the channelID is needed to complete the url to access the web service holding the xml).
However somehow a channel ID got in that has no data associated with it, and whats more it contains a space so it creates an dinvalid uri since uris cannot have spaces.
So how can I tell this code to skip over this case, and start from the beginning of the for loop in an instance like this?
Here is the code:
channelUrl=projectChannel.getChannelId(); is returning a value of Channel 2, whch first off has no actual channel associated with that ID, plus it creates an invalid uri - www.project/channels/Channel 2
SO I need a way to handle this without it stopping everything, I need it to just skip over this and move on....any suggestions?
True wisdom is in knowing you know nothing - Socrates
Just an observation--it's not necessarily helpful to over-comment: it's another point of failure, and one that isn't capture-able by tests or compilers. Keeping comments "in-sync" with code is a *lot* of work--eliminate the need to do so whenever possible. For example:Here you basically wrote the code twice, just in a different order, and one time (the comment) is completely unverifiable except by reading it and its accompanying code. That's not helpful, that's just noise, and if it *does* get out-of-sync with the code, it's dangerously misleading noise. It'd be cleaner, and easier, to just write