From 165fdcce4b3527d086ae3ff8b778f773ec2fecfe Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Mon, 10 Jul 2023 18:18:01 +0900 Subject: [PATCH] =?UTF-8?q?FileInfo.Relation:=20=ED=95=84=EC=88=98=20->=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cokr/xit/base/file/FileInfo.java | 11 +++++++++-- .../java/cokr/xit/base/file/web/FileInfoFactory.java | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/cokr/xit/base/file/FileInfo.java b/src/main/java/cokr/xit/base/file/FileInfo.java index 32ab267..5d3fc25 100644 --- a/src/main/java/cokr/xit/base/file/FileInfo.java +++ b/src/main/java/cokr/xit/base/file/FileInfo.java @@ -98,8 +98,12 @@ public class FileInfo extends AbstractEntity { * @param fileInfo FileInfo */ public void setInfo(FileInfo fileInfo) { + fileInfo.setInfoType(infoType); + fileInfo.setInfoKey(infoKey); +/* fileInfo.setInfoType(Assert.notEmpty(infoType, "infoType")); fileInfo.setInfoKey(Assert.notEmpty(infoKey, "infoKey")); +*/ fileInfo.setSubType(subType); } } @@ -190,7 +194,8 @@ public class FileInfo extends AbstractEntity { if (file == null) continue; FileInfo info = new FileInfo(); - relation.setInfo(info); + if (relation != null) + relation.setInfo(info); String filename = file.getName(); info.setName(filename); InputStream input = new FileInputStream(file); @@ -240,7 +245,9 @@ public class FileInfo extends AbstractEntity { if (holder == null) continue; FileInfo info = new FileInfo(); - holder.getRelation().setInfo(info); + Relation relation = holder.getRelation(); + if (relation != null) + relation.setInfo(info); String filename = holder.getFilename(); info.setName(filename); InputStream input = new ByteArrayInputStream(holder.data); diff --git a/src/main/java/cokr/xit/base/file/web/FileInfoFactory.java b/src/main/java/cokr/xit/base/file/web/FileInfoFactory.java index 368b311..83c4267 100644 --- a/src/main/java/cokr/xit/base/file/web/FileInfoFactory.java +++ b/src/main/java/cokr/xit/base/file/web/FileInfoFactory.java @@ -33,7 +33,8 @@ public class FileInfoFactory extends FileInfo.Factory { info.setSize(file.getSize()); info.setInputStream(file.getInputStream()); info.setSortOrder(result.size()); - relation.setInfo(info); + if (relation != null) + relation.setInfo(info); result.add(info); } catch (Exception e) { throw runtimeException(e);