diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7422519f48..047de8b611 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,9 +5,12 @@ trigger: - master +- branch* +- feature* pr: - master -- releases/* +- br* +- feature* pool: vmImage: ubuntu-latest @@ -33,12 +36,14 @@ steps: publishJUnitResults: true testResultsFiles: '**/surefire-reports/TEST-*.xml' goals: 'clean package sonar:sonar' + - task: PowerShell@2 inputs: targetType: 'inline' script: | # Write your PowerShell commands here. - Start-Sleep -Seconds 20 + Start-Sleep -Seconds 1 + - task: SonarQubePublish@4 inputs: - pollingTimeoutSec: '300' \ No newline at end of file + pollingTimeoutSec: '300' diff --git a/my-app.iml b/my-app.iml new file mode 100644 index 0000000000..e802c7b850 --- /dev/null +++ b/my-app.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 0ebae33777..f7eebfb4b3 100644 --- a/pom.xml +++ b/pom.xml @@ -42,9 +42,9 @@ 1.8 1.8 - + d58f0d63d88254491a09164a0deb397298a99f6e diff --git a/src/main/java/com/mycompany/app/App.java b/src/main/java/com/mycompany/app/App.java index 5a6d57214d..a79fe4567b 100644 --- a/src/main/java/com/mycompany/app/App.java +++ b/src/main/java/com/mycompany/app/App.java @@ -7,15 +7,37 @@ public class App { private final String message = "Hello World!"; + public String msg1; + public String msg2; - public App() {} + + public App() { + msg1 = "one"; + msg2="two"; + } public static void main(String[] args) { - System.out.println(new App().getMessage()); + App myApp = new App(); + try { + System.out.println(myApp.getMessage()); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + private final String getMessage(boolean isSync) throws InterruptedException { + synchronized (this.msg1) { + // threadB can't enter this block to request this.mon2 lock & release threadA + synchronized (this.msg2) { + this.msg2.wait(); // Noncompliant; threadA is stuck here holding lock on this.mon1 + } + } + return message; } - private final String getMessage() { + private final String getMessage() throws InterruptedException { return message; } + }