tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From schu...@apache.org
Subject svn commit: r1346684 - /tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoMessage.java
Date Wed, 06 Jun 2012 00:28:01 GMT
Author: schultz
Date: Wed Jun  6 00:28:01 2012
New Revision: 1346684

URL: http://svn.apache.org/viewvc?rev=1346684&view=rev
Log:
Clean-up: avoid NPE and immediate catch when init parameter does not exist. Also do not assign
default value unless necessary.

Modified:
    tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoMessage.java
  (contents, props changed)

Modified: tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoMessage.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoMessage.java?rev=1346684&r1=1346683&r2=1346684&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoMessage.java
(original)
+++ tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoMessage.java
Wed Jun  6 00:28:01 2012
@@ -42,11 +42,17 @@ public class EchoMessage extends WebSock
 
     public int getInitParameterIntValue(String name, int defaultValue) {
         String val = this.getInitParameter(name);
-        int result = defaultValue;
-        try {
-            result = Integer.parseInt(val);
-        }catch (Exception x) {
+        int result;
+        if(null != val) {
+            try {
+                result = Integer.parseInt(val);
+            }catch (Exception x) {
+                result = defaultValue;
+            }
+        } else {
+            result = defaultValue;
         }
+
         return result;
     }
 

Propchange: tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoMessage.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Jun  6 00:28:01 2012
@@ -0,0 +1 @@
+/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/EchoMessage.java:1156115-1157160,1157162-1157859,1157862-1157942,1157945-1160347,1160349-1163716,1163718-1166689,1166691-1174340,1174342-1175596,1175598-1175611,1175613-1175932,1175934-1177783,1177785-1177980,1178006-1180720,1180722-1183094,1183096-1187753,1187755,1187775,1187801,1187806,1187809,1187826-1188312,1188314-1188401,1188646-1188840,1188842-1190176,1190178-1195223,1195225-1195953,1195955,1195957-1201238,1201240-1203345,1203347-1206623,1206625-1208046,1208073,1208096,1208114,1208145,1208772,1209194-1212125,1212127-1220291,1220293,1220295-1221321,1221323-1222328,1222332-1222401,1222405-1222795,1222850-1222950,1222969-1225326,1225328-1225463,1225465,1225627,1225629-1226534,1226536-1228908,1228911-1228923,1228927-1229532,1229534-1230766,1230768-1231625,1231627-1233414,1233419-1235207,1235209-1237425,1237427,1237429-1237977,1237981,1237985,1237995,1238070,1238073,1239024-1239048,1239050-1239062,1239135,123925
 6,1239258-1239485,1239785-1240046,1240101,1240106,1240109,1240112,1240114,1240116,1240118,1240121,1240329,1240474-1240850,1240857,1241087,1241160,1241408-1241822,1241908-1241909,1241912-1242110,1242371-1292130,1292134-1292458,1292464-1292670,1292672-1292776,1292780-1293392,1293397-1297017,1297019-1297963,1297965-1299820,1300108,1300111-1300460,1300520-1300948,1300997,1301006,1301280,1302332,1302348,1302608-1302610,1302649,1302837,1303138,1303163,1303338,1303521,1303587,1303698,1303803,1303852,1304011,1304035,1304037,1304135,1304249,1304253,1304260,1304271,1304275,1304468,1304895,1304930-1304932,1305194,1305943,1305965,1306556,1306579-1306580,1307084,1307310,1307511-1307512,1307579,1307591,1307597,1310636,1310639-1310640,1310642,1310701,1311212,1311995,1327617,1327670,1331766,1333161,1333173,1333827,1334787,1335026,1335257,1335547,1335692,1335711,1335731,1336515,1336813,1336864,1336868,1336884,1337419,1337426,1337546,1337572,1337591-1337595,1337643,1337707,1337719,1337734,133
 7741,1337745,1338151-1338154,1338178,1342315,1342320,1342476,1342498,1342503,1342795,1342805,1343044-1343046,1343335,1343394,1343400,1343629,1343708,1343718,1343895,1344063,1344068,1344250,1344266,1344515,1344528,1344612,1344629,1344725,1344868,1344890,1344893,1344896,1344901,1345020,1345029,1345039,1345287-1345290,1345294,1345309,1345325,1345357,1345367,1345579-1345580,1345582,1345688,1345699,1345704,1345731-1345732,1345737,1345744,1345752,1345754,1345779,1345781,1345846,1346107,1346376,1346510,1346514,1346617,1346683



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message