mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
java-examples: fix reported minor vulnerabilities
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
d5cb613ad0
commit
94be00a63d
@ -24,8 +24,11 @@
|
|||||||
|
|
||||||
public class A110X_intr_Example {
|
public class A110X_intr_Example {
|
||||||
|
|
||||||
public static int counter=0;
|
private static int counter=0;
|
||||||
|
|
||||||
|
public static void incrementCounter() {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
// Instantiate an A110X sensor on digital pin D2
|
// Instantiate an A110X sensor on digital pin D2
|
||||||
@ -52,6 +55,6 @@ class A110XISR implements Runnable {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
public void run(){
|
public void run(){
|
||||||
A110X_intr_Example.counter++;
|
A110X_intr_Example.incrementCounter();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,9 +24,12 @@
|
|||||||
|
|
||||||
public class Button_intr_Example {
|
public class Button_intr_Example {
|
||||||
|
|
||||||
public static int counter = 0;
|
private static int counter = 0;
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void incrementCounter() {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
public static void main(String[] args) throws InterruptedException {
|
||||||
// ! [Interesting]
|
// ! [Interesting]
|
||||||
upm_button.Button b = new upm_button.Button(2);
|
upm_button.Button b = new upm_button.Button(2);
|
||||||
|
|
||||||
@ -47,7 +50,7 @@ class ButtonISR implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
Button_intr_Example.counter++;
|
Button_intr_Example.incrementCounter();
|
||||||
System.out.println("Button pressed!");
|
System.out.println("Button pressed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class FlexSensor_Example {
|
|||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
System.out.println(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
|
@ -24,8 +24,11 @@
|
|||||||
|
|
||||||
public class GroveButton_intr_Example {
|
public class GroveButton_intr_Example {
|
||||||
|
|
||||||
public static int counter = 0;
|
private static int counter = 0;
|
||||||
|
|
||||||
|
public static void incrementCounter() {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
// ! [Interesting]
|
// ! [Interesting]
|
||||||
upm_grove.GroveButton b = new upm_grove.GroveButton(2);
|
upm_grove.GroveButton b = new upm_grove.GroveButton(2);
|
||||||
@ -47,7 +50,7 @@ class ButtonISR implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
GroveButton_intr_Example.counter++;
|
GroveButton_intr_Example.incrementCounter();
|
||||||
System.out.println("Button pressed!");
|
System.out.println("Button pressed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -40,7 +40,7 @@ public class GroveQTouch_Example {
|
|||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
System.out.println(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ! [Interesting]
|
// ! [Interesting]
|
||||||
|
@ -24,8 +24,11 @@
|
|||||||
|
|
||||||
public class RPR220_intr_Example {
|
public class RPR220_intr_Example {
|
||||||
|
|
||||||
public static int counter = 0;
|
private static int counter = 0;
|
||||||
|
|
||||||
|
public static void incrementCounter() {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
// ! [Interesting]
|
// ! [Interesting]
|
||||||
// This example uses an interrupt handler to increment a counter
|
// This example uses an interrupt handler to increment a counter
|
||||||
@ -49,6 +52,6 @@ class RPRISR implements Runnable {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
public void run() {
|
public void run() {
|
||||||
RPR220_intr_Example.counter++;
|
RPR220_intr_Example.incrementCounter();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -85,7 +85,7 @@ public class WT5001_Example {
|
|||||||
vol = mp3.getVolume();
|
vol = mp3.getVolume();
|
||||||
System.out.println("The current volume is: " + vol);
|
System.out.println("The current volume is: " + vol);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.out.println(e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -93,7 +93,7 @@ public class WT5001_Example {
|
|||||||
ps = mp3.getPlayState();
|
ps = mp3.getPlayState();
|
||||||
System.out.println("The current play state is: " + ps);
|
System.out.println("The current play state is: " + ps);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.out.println(e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -101,7 +101,7 @@ public class WT5001_Example {
|
|||||||
numf = mp3.getNumFiles(upm_wt5001.WT5001.WT5001_PLAYSOURCE_T.SD);
|
numf = mp3.getNumFiles(upm_wt5001.WT5001.WT5001_PLAYSOURCE_T.SD);
|
||||||
System.out.println("The number of files on the SD card is: " + numf);
|
System.out.println("The number of files on the SD card is: " + numf);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.out.println(e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -109,7 +109,7 @@ public class WT5001_Example {
|
|||||||
curf = mp3.getCurrentFile();
|
curf = mp3.getCurrentFile();
|
||||||
System.out.println("The current file is: " + curf);
|
System.out.println("The current file is: " + curf);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
System.out.println(e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
int year[] = new int[1];
|
int year[] = new int[1];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user