mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Fix npe.
This commit is contained in:
parent
28ffead0a0
commit
deca7e51b2
@ -18,8 +18,10 @@
|
||||
|
||||
package com.wisemapping.model;
|
||||
|
||||
import com.wisemapping.util.ZipUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class MindMapHistory {
|
||||
@ -71,7 +73,7 @@ public class MindMapHistory {
|
||||
return xml;
|
||||
}
|
||||
|
||||
public void setXml(byte[] xml) {
|
||||
this.xml = xml;
|
||||
public byte[] getUnzipXml() throws IOException {
|
||||
return ZipUtils.zipToBytes(xml);
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class MindmapController extends BaseController {
|
||||
|
||||
@RequestMapping(value = "maps/{id}/history/{hid}", method = RequestMethod.POST)
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException {
|
||||
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException, IOException {
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
|
||||
@ -129,7 +129,7 @@ public class MindmapController extends BaseController {
|
||||
List<MindMapHistory> mindmapHistory = mindmapService.findMindmapHistory(id);
|
||||
if (mindmapHistory.size() > 0) {
|
||||
final MindMapHistory mindMapHistory = mindmapHistory.get(0);
|
||||
mindmap.setXml(mindMapHistory.getXml());
|
||||
mindmap.setZippedXml(mindMapHistory.getXml());
|
||||
saveMindmapDocument(true, mindmap, user);
|
||||
}
|
||||
} else {
|
||||
@ -188,7 +188,7 @@ public class MindmapController extends BaseController {
|
||||
// I should not return byte, but there is some encoding issue here. Further research needed.
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid);
|
||||
return mindmapHistory.getXml();
|
||||
return mindmapHistory.getUnzipXml();
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
);
|
||||
</c:if>
|
||||
<c:if test="${memoryPersistence || readOnlyMode}">
|
||||
options.persistenceManager = new mindplot.LocalStorageManager("c/restful/maps/{id}${hid!=null?'/'+hid:''}/document/xml${principal!=null?'':'-pub'}");
|
||||
options.persistenceManager = new mindplot.LocalStorageManager("c/restful/maps/{id}${hid!=null?'/':''}${hid!=null?hid:''}/document/xml${principal!=null?'':'-pub'}");
|
||||
</c:if>
|
||||
|
||||
var userOptions = ${mindmap.properties};
|
||||
|
Loading…
Reference in New Issue
Block a user