فهرست منبع

fix coverity bug

Jason Song 8 سال پیش
والد
کامیت
c8f3486ecc

+ 1 - 0
apollo-demo/pom.xml

@@ -11,6 +11,7 @@
 	<name>Apollo Demo</name>
 	<packaging>jar</packaging>
 	<properties>
+		<java.version>1.7</java.version>
 		<github.path>${project.artifactId}</github.path>
         <!-- apollo spring integration requires Spring 3.1.1+ -->
 		<spring-demo.version>3.1.1.RELEASE</spring-demo.version>

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

@@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.demo.spring;
 
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 
-import java.io.IOException;
+import java.util.Scanner;
 
 /**
  * @author Jason Song(song_s@ctrip.com)
@@ -12,12 +12,9 @@ public class AnnotationApplication {
     new AnnotationConfigApplicationContext(AnnotationApplication.class.getPackage().getName());
     onKeyExit();
   }
+
   private static void onKeyExit() {
-    System.out.println("Press any key to exit...");
-    try {
-      System.in.read();
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
+    System.out.println("Press Enter to exit...");
+    new Scanner(System.in).nextLine();
   }
 }

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

@@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.demo.spring;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-import java.io.IOException;
+import java.util.Scanner;
 
 /**
  * @author Jason Song(song_s@ctrip.com)
@@ -14,11 +14,7 @@ public class XmlApplication {
   }
 
   private static void onKeyExit() {
-    System.out.println("Press any key to exit...");
-    try {
-      System.in.read();
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
+    System.out.println("Press Enter to exit...");
+    new Scanner(System.in).nextLine();
   }
 }