This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, i dont know if its the right forum but asking :
I am facing a issue, so need some clue. one of my tests[coded in java] reads a text file [which is in dos format]. Since the text file is in dos format the test fails on linux when it compares some content with the content of the file [it should pass actually as its the same content].
When i change the file format to unix mode, everything is fine. However then the test wont pass on Windows [this is my guess and i think i am correct]
How can i make the test pass with both windows and linux ?
Unix and Windows use different line separators. If you are using a method that utilizes the os-dependent line separator, like BufferedReader.readLine(), you will have problems trying to use the same file on different OS's. Some solutions would be to parse the file for the line separator yourself or use something other than a plain text file (binary, XML, serialized collection, etc.).