details: https://code.openbravo.com/erp/devel/pi/rev/2dc1e3222b4c
changeset: 13293:2dc1e3222b4c
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Wed Jul 27 10:27:12 2011 +0200
summary: Related to issue 18082. Do not save MIME type in case there is no
OBContext yet (such as in the Login window)
diffstat:
src/org/openbravo/erpCommon/utility/ShowImage.java | 10 +++++++---
src/org/openbravo/erpCommon/utility/ShowImageLogo.java | 10 +++++++---
2 files changed, 14 insertions(+), 6 deletions(-)
diffs (54 lines):
diff -r a9fcfad12078 -r 2dc1e3222b4c
src/org/openbravo/erpCommon/utility/ShowImage.java
--- a/src/org/openbravo/erpCommon/utility/ShowImage.java Wed Jul 27
06:04:45 2011 +0200
+++ b/src/org/openbravo/erpCommon/utility/ShowImage.java Wed Jul 27
10:27:12 2011 +0200
@@ -29,6 +29,7 @@
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.core.OBContext;
import org.openbravo.dal.service.OBDal;
import org.openbravo.model.ad.utility.Image;
@@ -66,9 +67,12 @@
mimeType = image.getMimetype();
} else {
mimeType = MimeTypeUtil.getInstance().getMimeTypeName(img);
- image.setMimetype(mimeType);
- OBDal.getInstance().save(image);
- OBDal.getInstance().flush();
+ // If there is an OBContext, we attempt to save the MIME type of the
image
+ if (OBContext.getOBContext() != null) {
+ image.setMimetype(mimeType);
+ OBDal.getInstance().save(image);
+ OBDal.getInstance().flush();
+ }
}
if (!mimeType.equals("")) {
diff -r a9fcfad12078 -r 2dc1e3222b4c
src/org/openbravo/erpCommon/utility/ShowImageLogo.java
--- a/src/org/openbravo/erpCommon/utility/ShowImageLogo.java Wed Jul 27
06:04:45 2011 +0200
+++ b/src/org/openbravo/erpCommon/utility/ShowImageLogo.java Wed Jul 27
10:27:12 2011 +0200
@@ -28,6 +28,7 @@
import org.openbravo.base.HttpBaseServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.core.OBContext;
import org.openbravo.dal.service.OBDal;
import org.openbravo.model.ad.utility.Image;
@@ -65,9 +66,12 @@
if (mimeType == null) {
mimeType = MimeTypeUtil.getInstance().getMimeTypeName(img);
if (image != null) {
- image.setMimetype(mimeType);
- OBDal.getInstance().save(image);
- OBDal.getInstance().flush();
+ // If there is an OBContext, we attempt to save the MIME type of the
image
+ if (OBContext.getOBContext() != null) {
+ image.setMimetype(mimeType);
+ OBDal.getInstance().save(image);
+ OBDal.getInstance().flush();
+ }
}
}
if (!mimeType.equals("")) {
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits