This commit is contained in:
redkale
2023-09-25 14:30:27 +08:00
parent 1c7bcdebc7
commit 1eb153f51f
2 changed files with 11 additions and 5 deletions

View File

@@ -20,7 +20,7 @@ import org.redkale.util.*;
*/
public class ProtobufWriter extends Writer implements ByteTuple {
private static final int defaultSize = Integer.getInteger("convert.protobuf.writer.buffer.defsize", Integer.getInteger("convert.writer.buffer.defsize", 1024));
private static final int defaultSize = Integer.getInteger("redkale.convert.protobuf.writer.buffer.defsize", Integer.getInteger("redkale.convert.writer.buffer.defsize", 1024));
private byte[] content;

View File

@@ -255,9 +255,15 @@ public final class EntityCache<T> {
}
}
T[] result = arrayer.apply(pks.length);
for (int i = 0; i < result.length; i++) {
T rs = map.get(pks[i]);
result[i] = rs == null ? null : (needCopy ? newCopier.apply(this.creator.create(), rs) : rs);
if (needCopy) {
for (int i = 0; i < result.length; i++) {
T rs = map.get(pks[i]);
result[i] = rs == null ? null : newCopier.apply(this.creator.create(), rs);
}
} else {
for (int i = 0; i < result.length; i++) {
result[i] = map.get(pks[i]);
}
}
return result;
}
@@ -271,7 +277,7 @@ public final class EntityCache<T> {
return null;
}
if (selects == null) {
return (needCopy ? newCopier.apply(this.creator.create(), rs) : rs);
return needCopy ? newCopier.apply(this.creator.create(), rs) : rs;
}
T t = this.creator.create();
for (Attribute attr : this.info.attributes) {