Fixed server crash; Refactoring
authorEriks Jenkevics <eriks@netxms.org>
Thu, 14 Sep 2017 10:01:26 +0000 (13:01 +0300)
committerEriks Jenkevics <eriks@netxms.org>
Thu, 14 Sep 2017 10:01:26 +0000 (13:01 +0300)
src/java/client/netxms-client/src/main/java/org/netxms/client/NXCSession.java
src/java/client/netxms-client/src/main/java/org/netxms/client/events/EventGroup.java
src/server/core/config.cpp
src/server/core/dcitem.cpp
src/server/tools/nxget/nxget.cpp

index e555af4..55de860 100644 (file)
@@ -6359,7 +6359,6 @@ public class NXCSession
     * Modify event object.
     *
     * @param obj Event Object
-    * @return new event object code
     * @throws IOException  if socket I/O error occurs
     * @throws NXCException if NetXMS server returns an error or operation was timed out
     */
index 86af287..ef32528 100644 (file)
@@ -12,8 +12,6 @@ public class EventGroup extends EventObject
 
    /**
     * Create new empty event group
-    * 
-    * @param code event code
     */
    public EventGroup()
    {
index f15ce66..301f325 100644 (file)
@@ -184,23 +184,30 @@ stop_search:
 
    if (s_debugTags != NULL)
    {
+      TCHAR const *ptr;
+      int numTags;
       TCHAR **tagList = SplitString(s_debugTags, _T(','), &numTags);
       if (tagList != NULL)
       {
+         TCHAR tagBuffer[254], lvlBuffer[2];
+
          for(int i = 0; i < numTags; i++)
          {
             ptr = ExtractWord(tagList[i], tagBuffer);
-            ExtractWord(ptr, lvlBuffer);
-            lvl = _tcstol(lvlBuffer, NULL, 0);
-
-            if(lvl != 0 && tagBuffer != NULL)
-               nxlog_set_debug_level_tag(tagBuffer, lvl);
-         }
-         for(int i = 0; i < numTags; i++)
+            if (tagBuffer[0] != 0)
+            {
+               ExtractWord(ptr, lvlBuffer);
+               if (lvlBuffer[0] != 0)
+               {
+                  int lvl = _tcstol(lvlBuffer, NULL, 0);
+                  nxlog_set_debug_level_tag(tagBuffer, lvl);
+               }
+            }
             free(tagList[i]);
-         free(tagList);
+         }
       }
       free(s_debugTags);
+      free(tagList);
    }
 
        // Decrypt password
index 842c904..01a658c 100644 (file)
@@ -473,10 +473,10 @@ void DCItem::checkThresholds(ItemValue &value)
                UINT32 repeatInterval = (t->getRepeatInterval() == -1) ? g_thresholdRepeatInterval : (UINT32)t->getRepeatInterval();
                                   if (thresholdDeactivated || ((repeatInterval != 0) && (t->getLastEventTimestamp() + (time_t)repeatInterval < now)))
                                   {
-                                          PostDciEventWithNames(t->getEventCode(), m_owner->getId(), m_id, "ssssisds",
-                                                  s_paramNamesReach, m_name, m_description, t->getStringValue(),
-                                                  (const TCHAR *)checkValue, m_id, m_instance, 1);
-                                          EventTemplate *evt = (EventTemplate *)FindEventObjectByCode(t->getEventCode());
+                  PostDciEventWithNames(t->getEventCode(), m_owner->getId(), m_id, "ssssisds",
+                     s_paramNamesReach, m_name, m_description, t->getStringValue(),
+                           (const TCHAR *)checkValue, m_id, m_instance, 1, (const TCHAR *)value);
+                          EventTemplate *evt = (EventTemplate *)FindEventObjectByCode(t->getEventCode());
                                           if (evt != NULL)
                                           {
                                                   t->markLastEvent(evt->getSeverity());
index 028f2fd..cd1e6be 100644 (file)
@@ -52,7 +52,7 @@ enum Operation
 static void DebugWriter(const TCHAR *tag, const TCHAR *text)
 {
    if (tag == NULL)      
-      _tprintf(_T("%s\n"), tag);
+      _tprintf(_T("%s\n"), text);
    else
       _tprintf(_T("<%s> %s\n"), tag, text);
 }