nus-cs2113-AY1920S2 / forum

4 stars 0 forks source link

Java CI build failure only for windows #89

Closed alaukiknpant closed 4 years ago

alaukiknpant commented 4 years ago

Screen Shot 2020-03-24 at 23 52 40

My build has been failing for Windows only as seen in the attached photo. I thought the error was in runtest.bat, but my friend could successfully run the test in runtest.bat in her Windows machine.

Are there any potential reasons for this error?

damithc commented 4 years ago

Post a link to the repo/PR too.

melylopez99 commented 4 years ago

https://github.com/AY1920S2-CS2113-T14-2/tp/pull/33/checks?check_run_id=530870712

melylopez99 commented 4 years ago

I have also tried to run runtest.bat on my computer but it passed all tests so I am not able to figure out the error

JensonWee commented 4 years ago

Hi, I've encountered similar issue. I've found out that it could be the result of Hashmap or Arraylist. For different OS, if your array is not sorted, it could result in failing runtest for different OS.

damithc commented 4 years ago

Hi, I've encountered similar issue. I've found out that it could be the result of Hashmap or Arraylist. For different OS, if your array is not sorted, it could result in failing runtest for different OS.

Yes, it could be sorting problem where the order of data depends on the OS. There was one other student who faced a similar issue due to the use of a HashMap. Perhaps the data read from json files is not always in the order the data is in the file? Where possible, sort your data in some deterministic way e.g., alphabetically. Also, fix the merge conflict. That's gives others a chance to try your code.

melylopez99 commented 4 years ago

I created functions that sorts all of our data in our arraylist every time an action takes place and the error is still evident. I don't know what to do at this point now

damithc commented 4 years ago

Not sure if that is the cause, but in any case, use the OS-independent System.lineSeparator() instead of \n for outputting line breaks.

j-lum commented 4 years ago
> Task :compileJava
...\tp\src\main\java\seedu\techtoday\common\Messages.java:6: error: unmappable character (0xEF) for encoding windows-31j
    public static String HEADER_LINE = "     ?ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ
?";
                                             ^
...\tp\src\main\java\seedu\techtoday\common\Messages.java:6: error: unmappable character (0x8E) for encoding windows-31j
    public static String HEADER_LINE = "     ?ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ趣ケ
?";
                                                                                                                                           ^
...\tp\src\main\java\seedu\techtoday\common\Messages.java:7: error: unmappable character (0xEF) for encoding windows-31j
    public static String BOTTOM_LINE = "     ?ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ
?";
                                             ^
...l\tp\src\main\java\seedu\techtoday\common\Messages.java:7: error: unmappable character (0x8A) for encoding windows-31j
    public static String BOTTOM_LINE = "     ?ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ奇ケ
?";
                                                                                                                                           ^

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings

I got this on Windows. Looks like the fancy character is cause some problems. Try replacing it with its unicode representation.

alaukiknpant commented 4 years ago

Thank you Prof and @j-lum for helping us figure this out. I replaced all the "\n" with System.lineSeparator() and also removed the fancy ﹊ characters and replaced them with the normal straight line: "__". I am still getting the same error. Everything else seem seems to be fine as before though.

melylopez99 commented 4 years ago

Since the build is successful on my windows computer, I am unable to test and find the error that is causing this. What do you recommend we do at this point in order to move forward with the project?

damithc commented 4 years ago

As CI passes on two OS'es and tests pass on Windows locally, I suggest you ignore this problem for the moment and move forward. You might stumble on the solution at some point.

One thing you can try: see if the tests pass if the json files used are empty. Based on that, we can narrow down the problem further.

@j-lum does the updated code still fail in your computer?

j-lum commented 4 years ago
Comparing files ACTUAL.TXT and EXPECTED.TXT
***** ACTUAL.TXT
        ?          ______________________________________________________________          ?
        ?                                                                                  ?
        ?                             Hello! Here's TechToday.                             ?
        ?            Let me show you some technology news to refresh your mind!            ?
        ?          ______________________________________________________________          ?
        ?                    Your queries can be of the following forms:                   ?
        ?                              1. view [article / job]                             ?
        ?                          2. list [article / job / note]                          ?
        ?             3. save [article / job / note] [index number (optional)]             ?
        ?                  4. delete [article / job / note] [index number]                 ?
        ?            5. addinfo [article / job / note] [index number] [extract]            ?
        ?                         6. create [article / job / note]                         ?
        ?                                      7. exit                                     ?
        ?                                                                                  ?
        ?          ______________________________________________________________          ?
     What can I do for you?
***** EXPECTED.TXT
        竏」          ______________________________________________________________          竏」
        竏」                                                                                  竏」
        竏」                             Hello! Here's TechToday.                             竏」
        竏」            Let me show you some technology news to refresh your mind!            竏」
        竏」          ______________________________________________________________          竏」
        竏」                    Your queries can be of the following forms:                   竏」
        竏」                              1. view [article / job]                             竏」
        竏」                          2. list [article / job / note]                          竏」
        竏」             3. save [article / job / note] [index number (optional)]             竏」
        竏」                  4. delete [article / job / note] [index number]                 竏」
        竏」            5. addinfo [article / job / note] [index number] [extract]            竏」
        竏」                         6. create [article / job / note]                         竏」
        竏」                                      7. exit                                     竏」
        竏」                                                                                  竏」
        竏」          ______________________________________________________________          竏」
     What can I do for you?

You can add the line FC ACTUAL.TXT EXPECTED.TXT to the end of your runtest.bat file to see where the error is.

RenzoTsai commented 4 years ago

I also meet this problem. And I find it is because there is something wrong with storage and runtest.bat. e.g, if your storage file path is data/example.csv, then when you run runtest.sh, it will create a folder under text-ui-test and will get text-ui-test/data/example.csv. But for runtest.bat, it will create a folder under build/libs and will get build/libs/data/example.csv. So I edit runtest.bat in this way:

image

And now when I run runtest.bat, the storage file will in the same folder as the runtest.sh's.

alaukiknpant commented 4 years ago

Thank you all, I was able to fix the issue eventually. The problem was @j-lum pointed out. It was basically characters that Windows didn't recognise.

damithc commented 4 years ago

Glad to hear that. Thanks everyone who pitched in to help.