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

Enforce Java 11 in archetypes #1029

Merged
merged 3 commits into from
Jan 9, 2023
Merged

Enforce Java 11 in archetypes #1029

merged 3 commits into from
Jan 9, 2023

Conversation

msghasan
Copy link
Contributor

@msghasan msghasan commented Jan 7, 2023

Signed-off-by: Maimur Hasan msghasan@gmail.com

Thanks for contributing to StormCrawler, your efforts are appreciated!

Developer Certificate of Origin

By contributing to StormCrawler, you accept and agree to the following terms and conditions (the Developer Certificate of Origin) for your present and future contributions submitted to StormCrawler.
Please refer to the Developer Certificate of Origin section in CONTRIBUTING.md for details.

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Before opening a PR, please check that:

  • You've squashed your commits into a single one
  • You've described what the PR does or at least point to a related issue
  • You've signed-ff your commits with 'git commit -s'
  • The code is properly formatted with 'mvn git-code-format:format-code -Dgcf.globPattern=**/*'

Thanks!

Signed-off-by: Maimur Hasan <msghasan@gmail.com>
@msghasan
Copy link
Contributor Author

msghasan commented Jan 7, 2023

@jnioche Shall I remove the below plugin from parent pom , as it do not support code above jdk 8

com.cosium.code
git-code-format-maven-plugin
3.4

@jnioche
Copy link
Contributor

jnioche commented Jan 7, 2023

Let's keep it until we find a replacement for it.

- Did refactoring of the code. Now the class is more reusable anybody and extend the class and can use it as per their business requirement without having to copy paste everything from the existing store method
- Secondly if we can use an utilty class in the core project and copy paste the store() method that would have been nice we could have used htis in both places for elastic search and opensearch StatusUpdaterBolt

Signed-off-by: Maimur Hasan <msghasan@gmail.com>
protected void addToTupleListAndSendToES(String url, Tuple tuple, String sha256hex, IndexRequest request) {
waitAckLock.lock();
try {
final List<Tuple> tupleList = waitAck.get(sha256hex, k -> new LinkedList<>());
Copy link
Contributor

Choose a reason for hiding this comment

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

10% of developers fix this issue

JdkObsolete: It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not.


Suggested change
final List<Tuple> tupleList = waitAck.get(sha256hex, k -> new LinkedList<>());
final List<Tuple> tupleList = waitAck.get(sha256hex, k -> new ArrayList<>());

ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

protected void addToTupleListAndSendToES(String url, Tuple tuple, String sha256hex, IndexRequest request) {
waitAckLock.lock();
try {
final List<Tuple> tupleList = waitAck.get(sha256hex, k -> new LinkedList<>());
Copy link
Contributor

Choose a reason for hiding this comment

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

10% of developers fix this issue

JdkObsolete: It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not.


Suggested change
final List<Tuple> tupleList = waitAck.get(sha256hex, k -> new LinkedList<>());
final List<Tuple> tupleList = waitAck.get(sha256hex, k -> new ArrayList<>());

ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]


LOG.debug("Sending to ES buffer {} with ID {}", url, sha256hex);

connection.addToProcessor(request);
Copy link
Contributor

Choose a reason for hiding this comment

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

7% of developers fix this issue

THREAD_SAFETY_VIOLATION: Read/Write race. Non-private method StatusUpdaterBolt.addToTupleListAndSendToES(...) reads without synchronization from this.connection. Potentially races with write in method StatusUpdaterBolt.cleanup().
Reporting because this access may occur on a background thread.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]


LOG.debug("Sending to ES buffer {} with ID {}", url, sha256hex);

connection.addToProcessor(request);
Copy link
Contributor

Choose a reason for hiding this comment

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

7% of developers fix this issue

THREAD_SAFETY_VIOLATION: Read/Write race. Non-private method StatusUpdaterBolt.addToTupleListAndSendToES(...) reads without synchronization from this.connection. Potentially races with write in method StatusUpdaterBolt.cleanup().
Reporting because this access may occur on a background thread.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@jnioche
Copy link
Contributor

jnioche commented Jan 8, 2023

git-code-format-maven-plugin

and it works when calling

mvn git-code-format:format-code -Dgcf.globPattern=**/*
with Java 11. So I am not sure why you'd want to remove it.

@rzo1
Copy link
Contributor

rzo1 commented Jan 8, 2023

@msghasan can you restore the PR to only include the Java Version changes in the archetype?

@msghasan
Copy link
Contributor Author

msghasan commented Jan 8, 2023

@msghasan can you restore the PR to only include the Java Version changes in the archetype?

yeah sure

@msghasan
Copy link
Contributor Author

msghasan commented Jan 8, 2023

git-code-format-maven-plugin

@jnioche throws error stating this plugin only supports class version till 52 which is java 8 while we try to commit anything.... in to the repository

@msghasan
Copy link
Contributor Author

msghasan commented Jan 8, 2023

@rzo1 Reverted the commit that I mistakenly did in this PR please approve the changes...

@rzo1
Copy link
Contributor

rzo1 commented Jan 8, 2023

@jnioche don't know if squashing will retain signed commits. Aside from that lgtm.

@msghasan
Copy link
Contributor Author

msghasan commented Jan 8, 2023

@rzo1 @jnioche Can I go ahead and close this pull request after the changes has been approved?

@rzo1
Copy link
Contributor

rzo1 commented Jan 8, 2023

A PR is automatically closed if it is merged into master/main.

This reverts commit 81b85a1. Need to push in different PR

Signed-off-by: Maimur Hasan <msghasan@gmail.com>
@jnioche jnioche changed the title Minor POM Changes for dependency upgrade Enforce Java 11 in archetypes Jan 9, 2023
@jnioche
Copy link
Contributor

jnioche commented Jan 9, 2023

Fixes #1022

@jnioche jnioche merged commit 2bf2a05 into apache:master Jan 9, 2023
@jnioche
Copy link
Contributor

jnioche commented Jan 9, 2023

Merged, changed the title. Thanks @msghasan

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.

None yet

3 participants