Detect erroneous white spaces with Hex Fiend

Recently, a colleague of mine received a small patch via email to apply it with Eclipse. To our both suprise the version that worked perfectly for me lead to syntax errors in his side. The patch seemed to be ok and so did the resulting Java code – apart from the syntax error.

Can you introspect this Java errors with a plain text editor?

Can you explain this Java error with an ordinary text editor?

For some unexplained reasons one of the spaces (0×20) had been replaced with another character (0xCA) which looks perfectly in any text editor but forces Eclipse to stop with an error. This might be connected with a common mistake I am doing regularly when switching between different types of computers is hitting <ALT>+<SPACE> on my Mac. This produces an “erroneous white space”, too!

Hex Fiend not allows you to introspect you clipboard, it's a sophisticated hex editor.

Hex Fiend is a sophisticated hex editor for Mac with many handy features.

Meanwhile, I am using Hex Fiend to quickly analyze Java code with such errors but also to look into arbitrary binary data. It allows you to paste snippets from your clipboard directly into the editor and does not force you to search and open a file before. Although it works perfectly with huge files of several Gigabytes (or even Petabytes if you trust their own words) working with the clipboard is really handy. Beyond this it allows you to convert byte ranges to different integer formats and the find/replace actions concentrate on binary data as well.

Give it a try when you have to analyze binary data or your next strange text file the next time.

Support my Work

Writing an article like the one you have just read takes me quite an amount of my personal time. Way too often, I invest this time in different interests and decide against another blog post. On the other hand, you can motivate me with your feedback, your thoughts and your ideas. Please leave a comment below or flattr this post if you think it's worth it.

Comments

  1. Helge says:

    I know this one, the “bad spaces”, too! But as far as I remember, I had that red zig-zag errorline marker thingy only underneath the erroneous space character, so it was relatively easy to just replace the space character.

  2. I often had this kind of error, too as I started developing on the mac. You can identify it because the error-line starts under the space instead of under the method. But it’s a nice tip for new apple devs because it took quite some time for me to figure that out…

    BTW: the burlington Duck is a very nice iPhone app!! Good work!

Leave a Reply