Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #441 allowing to build project with Windows #904

Merged
merged 6 commits into from
Apr 29, 2021

Conversation

lujop
Copy link
Contributor

@lujop lujop commented Apr 24, 2021

Thanks for contributing.

Description

Fixes issue #441 allowing to build project with Windows and with systems that don't has en-US as default locale

Changes made:

  • Changing hardcoded line separator for `System.lineSeparator()'. Except in HTML writer because Jsoup seems to use always Unix line separator.
  • Putting all surefire args in one line because two didn't work and system locale was used.
  • Changed mocked URLs because Inet URLs were used as if they were valid local filesystem urls.
  • Disabled BOM test. I think that test being failing is correct, at least in systems that don't use UTF-8. I haven't seen any management of BOM in the tablesaw code, and univocity seems to manage BOM but only when a File is passed and not a Reader as tablesaw uses.

+ "FROM myTable\n"
+ "Window w1 AS (\n"
"SELECT"
+ System.lineSeparator()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems a little hard to read to me. Can we put each System.lineSeparator() on the end of the line instead of putting it on a new line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I don't like also. But it was done by the formatter plugin that is configurated in maven.
In fact, it separated a lot of lines from the way I initially leave them.
Is it used?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wouldn't hurt to use a static import so you could just write lineSeparator(). Even that is too verbose, but you can't fight Java names.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could make it even shorter by assigning it to a constant at the top of the file like NEW_LINE

One day we'll have Java 13's triple quotes and this will all be cleaner, but it's probably too early for that since Java 11 is the last LTS unless maybe we can just run the tests on Java 13, but compile with Java 11

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I can use static import to reduce size, but about the new line I don't like it too.
But is what made the formatter plugin. I suppose that it sees a string concatenation that is two big and wants every concatenation in its new line.

What do you want me to do?
Only static import?
Reformat by hand trying to use fewer lines and ignoring formatter plugin? In that case are there any formatting rules that I must follow?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't format by hand. I'm not sure how the other options would look, but they're worth experimenting with

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then I should do just use a static import on all line separators? Any other thing it's needed to be changed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say we should try it and see how it looks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the end, I use a LINE_END constant that I've seen that was used in some places.

@@ -50,8 +50,7 @@ public void csv() throws IOException {
@Test
public void readUrlWithExtension() throws Exception {
URL url =
mockUrlHelper(
"http://something.other.com/file.csv", ImmutableList.of("region", "canada", "us"));
mockUrlHelper("something.other.com/file.csv", ImmutableList.of("region", "canada", "us"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks weird to me that http:// is missing. I didn't understand the explanation for why it had to be changed. Is there a fix we can make to mockUrlHelper or something that will allow http:// to be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the mockUrl to be able to use urls

@lujop lujop requested a review from benmccann April 28, 2021 19:42
+ //
"};\n",
"var layout = {"
+ lineSeparator()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one should be LINE_END to match the others and then you no longer need the static import

@benmccann
Copy link
Collaborator

can you rebase this PR? thanks!

lujop added 2 commits April 29, 2021 09:18
Change System.lineSeparator() for a constant to be less verbose
Change mockUrl to be able to use URLs
@lujop lujop force-pushed the fixwindowsbuild branch from 1adef31 to 4d47a22 Compare April 29, 2021 07:18
@lujop lujop requested a review from benmccann April 29, 2021 16:01
@benmccann
Copy link
Collaborator

Can you try adding Windows to the CI so that we avoid regressing? It should just be changing the line below:

# os: [windows-latest, macOS-latest, ubuntu-latest]

@lujop
Copy link
Contributor Author

lujop commented Apr 29, 2021

Can you try adding Windows to the CI so that we avoid regressing? It should just be changing the line below:

# os: [windows-latest, macOS-latest, ubuntu-latest]

Done

@@ -17,7 +17,7 @@ jobs:
java-version: [1.8, 11, 15]
# Tests seem to be failing on Windows
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this line and the next line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG, I didn't see it.
Done

@lujop lujop requested a review from benmccann April 29, 2021 17:27
@lujop
Copy link
Contributor Author

lujop commented Apr 29, 2021

I've seen that build on windows crashes on JAva 15,
Can I change for 16 that is the lastest now and retry?

@benmccann
Copy link
Collaborator

Hmm, that's weird. But sure, go ahead and try changing 15 to 16

@benmccann benmccann merged commit b6c138a into jtablesaw:master Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants