Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-956

Property Not Found Exception when value is null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.4.0.Final, 2.2.1.GA
    • 2.2.0.Final
    • None
    • None

      AbstractJcrNode.java contains the following code:

      public final Property setProperty( String name,
      Calendar value )
      throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
      checkSession();

      if (value == null)

      { return removeExistingValuedProperty(name); }

      return editor().setProperty(nameFrom(name), valueFrom(value));
      }

      Now the issue arises where the value is null AND the property has NOT been set before. In this case 'removeExistingValuedProperty' is called (since value == null) and it will throw an exception that it cannot find the property.

      It may be nicer to check it the property exists before calling removeExistingValuedPropery, which is the what JR does.

      --Kurt

            bcarothers_jira Brian Carothers (Inactive)
            kstam@redhat.com Kurt Stam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: