Skip to content

Commit c8f3486

Browse files
committed
fix coverity bug
1 parent a80159f commit c8f3486

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

apollo-demo/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<name>Apollo Demo</name>
1212
<packaging>jar</packaging>
1313
<properties>
14+
<java.version>1.7</java.version>
1415
<github.path>${project.artifactId}</github.path>
1516
<!-- apollo spring integration requires Spring 3.1.1+ -->
1617
<spring-demo.version>3.1.1.RELEASE</spring-demo.version>

apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/AnnotationApplication.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
44

5-
import java.io.IOException;
5+
import java.util.Scanner;
66

77
/**
88
* @author Jason Song(song_s@ctrip.com)
@@ -12,12 +12,9 @@ public static void main(String[] args) {
1212
new AnnotationConfigApplicationContext(AnnotationApplication.class.getPackage().getName());
1313
onKeyExit();
1414
}
15+
1516
private static void onKeyExit() {
16-
System.out.println("Press any key to exit...");
17-
try {
18-
System.in.read();
19-
} catch (IOException e) {
20-
e.printStackTrace();
21-
}
17+
System.out.println("Press Enter to exit...");
18+
new Scanner(System.in).nextLine();
2219
}
2320
}

apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/XmlApplication.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.springframework.context.support.ClassPathXmlApplicationContext;
44

5-
import java.io.IOException;
5+
import java.util.Scanner;
66

77
/**
88
* @author Jason Song(song_s@ctrip.com)
@@ -14,11 +14,7 @@ public static void main(String[] args) {
1414
}
1515

1616
private static void onKeyExit() {
17-
System.out.println("Press any key to exit...");
18-
try {
19-
System.in.read();
20-
} catch (IOException e) {
21-
e.printStackTrace();
22-
}
17+
System.out.println("Press Enter to exit...");
18+
new Scanner(System.in).nextLine();
2319
}
2420
}

0 commit comments

Comments
 (0)