@@ -35,6 +35,9 @@ public AnalysysJavaSdk(Collecter collecter, String appId){
3535 */
3636 public AnalysysJavaSdk (Collecter collecter , String appId , Boolean autoDelParam ){
3737 this .collecter = collecter ;
38+ if (appId == null || appId .trim ().length () == 0 ){
39+ throw new RuntimeException ("appKey is empty" );
40+ }
3841 this .appId = appId ;
3942 this .egBaseProperties = new HashMap <String , Object >(3 );
4043 this .xcontextSuperProperties = new ConcurrentHashMap <String , Object >();
@@ -302,7 +305,7 @@ private void upload(String distinctId, boolean isLogin, String eventName, Map<St
302305 eventMap .put ("appid" , appId );
303306 Map <String , Object > newProperties = new HashMap <String , Object >(16 );
304307 String profile = "$profile" ;
305- if (!eventName .startsWith (profile ) && ! eventName .startsWith (EventName .ALIAS .getValue ())){
308+ if (!( eventName != null && ( eventName .startsWith (profile ) || eventName .startsWith (EventName .ALIAS .getValue ()) ))){
306309 newProperties .putAll (this .xcontextSuperProperties );
307310 }
308311 newProperties .put ("$debug" , debugMode );
@@ -318,8 +321,8 @@ private void upload(String distinctId, boolean isLogin, String eventName, Map<St
318321 eventMap .put ("xcontext" , newProperties );
319322 this .collecter .debug (isDebug ());
320323 boolean ret = this .collecter .send (eventMap );
321- if (eventName .startsWith (profile ) && isDebug () && ret ){
322- System .out .println (String .format ("%s success." , eventName . substring ( 1 ) ));
324+ if (eventName != null && eventName .startsWith (profile ) && isDebug () && ret ){
325+ System .out .println (String .format ("%s success." , eventName ));
323326 }
324327 }
325328
0 commit comments