- Improve error handling on export

- Validate FreeMind 0.9 or gretter during import
- Improve login message.
This commit is contained in:
Paulo Gustavo Veiga 2011-04-15 23:22:58 -03:00
parent 405f0d9998
commit 776e216e50
8 changed files with 21 additions and 12 deletions

2
.gitignore vendored
View File

@ -3,6 +3,6 @@
wisemapping.ipr
wisemapping.iws
wisemapping.iml
wise-webapp/wisemapping.log
wise-webapp/wisemapping.log.*
*/.DS_Store
.DS_Store

View File

@ -41,6 +41,7 @@ import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLStreamException;
import javax.xml.transform.TransformerException;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@ -97,8 +98,13 @@ public class ExportController extends BaseMultiActionController {
}
}
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
// Change image link URL.
setBaseBaseImgUrl(format, properties);
ExporterFactory.export(properties, mindMap, bos, mapSvg);
// If the export goes ok, write the map to the stream ...
// Set format content type...
final String contentType = format.getContentType();
@ -110,7 +116,7 @@ public class ExportController extends BaseMultiActionController {
// Write content ...
final ServletOutputStream outputStream = response.getOutputStream();
ExporterFactory.export(properties, mindMap, outputStream, mapSvg);
outputStream.write(bos.toByteArray());
} catch (Throwable e) {
@ -125,7 +131,7 @@ public class ExportController extends BaseMultiActionController {
return null;
}
private void setBaseBaseImgUrl(ExportFormat format, @NotNull ExportProperties properties) {
private void setBaseBaseImgUrl(@NotNull ExportFormat format, @NotNull ExportProperties properties) {
final String baseUrl;
if (format == ExportFormat.SVG) {

View File

@ -40,7 +40,7 @@ public class RenameMindmapController
final MindMap mindMap = getMindmapFromRequest(httpServletRequest);
User user = Utils.getUser();
if (!mindMap.getOwner().equals(user)) {
throw new IllegalStateException("No enought right to execute this operation");
throw new IllegalStateException("No enough right to execute this operation");
}

View File

@ -106,7 +106,7 @@ public class FreemindImporter
if (version != null) {
final VersionNumber mapVersion = new VersionNumber(version);
if (SUPPORTED_FREEMIND_VERSION.isGreaterThan(mapVersion)) {
throw new ImporterException("FreeMind map has been created with '" + mapVersion.getVersion() + "'. Supported FreeMind version is '" + SUPPORTED_FREEMIND_VERSION.getVersion() + "' or greater.");
throw new ImporterException("FreeMind version " + mapVersion.getVersion() + " is not supported.");
}
}

View File

@ -50,7 +50,8 @@ public class ImportMapValidator extends MapInfoValidator {
bean.setImportedMap(map);
} catch (ImporterException e) {
errors.rejectValue("mapFile",Messages.IMPORT_MAP_ERROR);
Object[] errorArgs = new Object[]{e.getMessage()};
errors.rejectValue("mapFile", Messages.IMPORT_MAP_ERROR,errorArgs,"FreeMind could not be imported.");
}
}
}

View File

@ -240,10 +240,10 @@ NO_ENOUGH_PERMISSIONS_DETAILS=You do not have enough right access to see this ma
SHARING=Sharing
IMPORT_MINDMAP=Import map
IMPORT_MINDMAP_DETAILS=Do you already have maps created with FreeMind?.No problem, Import them!.
IMPORT_MINDMAP_INFO=You can import FreeMind maps to WiseMapping. Please, select the FreeMind map that want to import. <br/>Fields marked with an asterisk <span class="fieldRequired">*</span> are required.
IMPORT_MINDMAP_INFO=You can import FreeMind 0.9 version maps to WiseMapping. Please, select the FreeMind map that want to import. <br/>Fields marked with an asterisk <span class="fieldRequired">*</span> are required.
PRINT=Print
FREE_MIND_FILE=FreeMind File
IMPORT_MAP_ERROR=Imported file seems not to be a valid FreeMind file.
IMPORT_MAP_ERROR=FreeMind file could not be imported. {0}
MAP_TITLE_ALREADY_EXISTS=Map name already exists.
EMBEDDED_VIEWER=Embed a map viewer in your own web site, blog or post!
EMBEDDED_VIEWER_MESSAGE=Once you make your map public, you will be able to embed a mind map viewer in your own web site, blog or post just as we did it here!<br/>Try it!!, you can drag nodes, pan the map, and zoom in and out.

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

View File

@ -13,10 +13,6 @@
<div id="loginContent">
<div id="news" class="sb">
<c:if test="${isHsql== 'true'}">
<h2 style="border:0; color:red;"> You are using an HSQL database. You shouldn't use this environment for production!</h2>
</c:if>
<h1>What is New: </h1>
<ul>
<li>Links Between Nodes</li>
@ -102,3 +98,9 @@
<spring:message code="JOIN_NOW"/>
</a>
</div>
<c:if test="${isHsql== 'true'}">
<div style="padding:10px;background-color: #E0EFFF; border-radius: 5px 5px 5px 5px;border-style:solid;border-color:gray"><img src="../images/info.png" style="margin:0px 4px">Note: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.5 instead. You can find more information how to configure MySQL <a href="http://www.wisemapping.org/documentation/configu">here</a>.</div>
</c:if>