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