Projects >> celements-photo >>af434c89b729c7856d672b5953000d75eeaa4886

Chunk
Conflicting content
 * Used to add data as a new XWikiAttachment to an XWikiDocument.
 */
public class AddAttachmentToDoc {
<<<<<<< HEAD
  private static final Log LOGGER = LogFactory.getFactory().getInstance(
      AddAttachmentToDoc.class);
=======
  private static final Log LOGGER = 
      LogFactory.getFactory().getInstance(AddAttachmentToDoc.class);
>>>>>>> 40adeae7af546892b9a3f3ba1f614b82a2201a35
  
  /**
   * Converts the given ByteArrayOutputStream to an XWikiAttachment and adds
Solution content
 * Used to add data as a new XWikiAttachment to an XWikiDocument.
 */
public class AddAttachmentToDoc {
  private static final Log LOGGER = LogFactory.getFactory().getInstance(
      AddAttachmentToDoc.class);
  
  /**
   * Converts the given ByteArrayOutputStream to an XWikiAttachment and adds
File
AddAttachmentToDoc.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
        attachment = new XWikiAttachment();
        olddoc.getAttachmentList().add(attachment);
    }
<<<<<<< HEAD
    LOGGER.info("filename='" + filename + "' contentsize='" + data.length + "'");
    ByteArrayInputStream dataStream = null;
    try {
      dataStream = new ByteArrayInputStream(data);
      attachment.setContent(dataStream);
    } catch (IOException ioe) {
      LOGGER.error("Error setting Attachment content", ioe);
    } finally {
      if(dataStream != null) {
        try {
          dataStream.close();
        } catch (IOException ioe) {
          LOGGER.error("Exception cloasing stream.", ioe);
        }
      }
    }
=======
    
    LOGGER.info("filename='" + filename + "' contentsize='" + data.length + "'");
    attachment.setContent(data);
>>>>>>> 40adeae7af546892b9a3f3ba1f614b82a2201a35
    attachment.setFilename(filename);
    attachment.setAuthor(context.getUser());
Solution content
        attachment = new XWikiAttachment();
        olddoc.getAttachmentList().add(attachment);
    }
    LOGGER.info("filename='" + filename + "' contentsize='" + data.length + "'");
    ByteArrayInputStream dataStream = null;
    try {
      dataStream = new ByteArrayInputStream(data);
      attachment.setContent(dataStream);
    } catch (IOException ioe) {
      LOGGER.error("Error setting Attachment content", ioe);
    } finally {
      if(dataStream != null) {
        try {
          dataStream.close();
        } catch (IOException ioe) {
          LOGGER.error("Exception cloasing stream.", ioe);
        }
      }
    }
    attachment.setFilename(filename);
    attachment.setAuthor(context.getUser());
File
AddAttachmentToDoc.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Try statement
Variable