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

Error setting property using Binary value created from stream

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 2.5.1.GA, 2.6.0.Final
    • 2.6.0.Beta2
    • JCR
    • None

    Description

      This code works fine (note that "in" is a FileInputStream):

         Node file = root.addNode(filename, "nt:file");
         Node content = file.addNode("jcr:content", "nt:resource");
         content.setProperty("jcr:data", in);
      

      But this code does not:

         Node file = root.addNode(filename, "nt:file");
         Node content = file.addNode("jcr:content", "nt:resource");
         Binary binary = session.getValueFactory().createBinary(in);
         content.setProperty("jcr:data", binary);
      

      Reading the source code it seems that the problem is in AbstractJcrNode.java:

          final JcrValue valueFrom( Binary value ) {
             ValueFactories factories = cache.factories();
              org.modeshape.graph.property.Binary binary = ((JcrBinary)value).binary();
              return new JcrValue(factories, cache, PropertyType.DATE, binary);
          }
      

      DATE is wrong. No ?

      Here's a link to the offending line: https://github.com/ModeShape/modeshape/blob/617b3ed4b24b55f97df8/modeshape-jcr/src/main/java/org/modeshape/jcr/AbstractJcrNode.java#L228

      Attachments

        Activity

          People

            rhauch Randall Hauch (Inactive)
            rhauch Randall Hauch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: