Throwing an NPE here hides the actual exception and it is much harder to track what...
[core.git] / inc / classes / main / helper / class_BaseHelper.php
index 984475ea9ab5edddba50415fcee5603a1d0fa37d..8011081af8da8de89aab160e93e5a3de76eb160d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2013 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -217,13 +217,8 @@ class BaseHelper extends BaseFrameworkSystem {
 
                // Is the value instance valid?
                if (is_null($this->valueInstance)) {
-                       try {
-                               // Get the requested instance
-                               $this->valueInstance = ObjectFactory::createObjectByConfiguredName($registryKey . '_class', array($this->extraInstance));
-                       } catch (FrameworkException $e) {
-                               // Okay, nothing found so throw a null pointer exception here
-                               throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-                       }
+                       // Get the requested instance
+                       $this->valueInstance = ObjectFactory::createObjectByConfiguredName($registryKey . '_class', array($this->extraInstance));
                } // END - if
        }
 
@@ -253,7 +248,7 @@ class BaseHelper extends BaseFrameworkSystem {
                $this->groups[$this->totalCounter] = $groupId;
                $this->groups[$groupId]['opened']  = TRUE;
                $this->groups[$groupId]['content'] = sprintf(
-                       "<!-- group %s opened (length: %s, tag: %s) //-->%s\n",
+                       '<!-- group %s opened (length: %s, tag: %s) //-->%s' . PHP_EOL,
                        $groupId,
                        strlen($content),
                        $tag,
@@ -367,11 +362,11 @@ class BaseHelper extends BaseFrameworkSystem {
                // Is the content empty?
                if ((empty($content)) && (!empty($this->subGroups[$subGroupId]['tag']))) {
                        // Get it from opener
-                       $content = sprintf("<!-- sub-group %s auto-closed //--></%s>", $subGroupId, $this->subGroups[$subGroupId]['tag']);
+                       $content = sprintf('<!-- sub-group %s auto-closed //--></%s>', $subGroupId, $this->subGroups[$subGroupId]['tag']);
                } // END - if
 
                // Add content to it and mark it as closed
-               $this->subGroups[$subGroupId]['content'] .= sprintf("<!-- sub-group %s closed (length: %s, tag: %s) //-->%s\n", $subGroupId, strlen($content), $this->subGroups[$subGroupId]['tag'], $content);
+               $this->subGroups[$subGroupId]['content'] .= sprintf('<!-- sub-group %s closed (length: %s, tag: %s) //-->%s' . PHP_EOL, $subGroupId, strlen($content), $this->subGroups[$subGroupId]['tag'], $content);
                $this->subGroups[$subGroupId]['opened'] = FALSE
                ;
 
@@ -413,7 +408,7 @@ class BaseHelper extends BaseFrameworkSystem {
                                $content .= trim($subGroupContent);
                        } else {
                                // Something went wrong
-                               $this->debugInstance(__METHOD__."(): Something unexpected happened here.");
+                               $this->debugInstance(__METHOD__ . '(): Something unexpected happened here.');
                        }
                } // END - for