ktlili 2005/07/05 10:57:08 CEST
Modified files:
war project.properties
war/src/conf en_US.properties
war/src/java/com/jahia/clipping/struts BrowseAction.java
DefaultErrorAction.java
DefaultErrorForm.java
WebBrowserAction.java
war/src/java/com/jahia/clipping/web HTMLDocumentBuilder.java
war/src/java/com/jahia/clipping/web/html/Impl
ChewExtractorFilter.java
war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser
TransformBuilderVisitor.java
UserBuilderVisitor.java
war/src/java/com/jahia/clipping/web/html/Impl/JDom
JDomHTMLDocument.java
war/src/java/com/jahia/clipping/web/html/Impl/Neko
DomHTMLTransformer.java
war/src/java/com/jahia/clipping/web/http/impl
HTMLUnitProcessor.java
HttpProcessor.java
war/src/webapp/WEB-INF struts-config.xml
war/src/webapp/jsp defaultError.jsp
Log:
- activate Error handler during the browse, edit, select steps
- Refactoring
Revision Changes Path
1.4 +3 -0 webclip_builder/war/project.properties
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/project.properties.diff?r1=1.3&r2=1.4&f=h
1.15 +2 -2 webclip_builder/war/src/conf/en_US.properties
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/conf/en_US.properties.diff?r1=1.14&r2=1.15&f=h
1.12 +5 -3
webclip_builder/war/src/java/com/jahia/clipping/struts/BrowseAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/BrowseAction.java.diff?r1=1.11&r2=1.12&f=h
1.3 +1 -1
webclip_builder/war/src/java/com/jahia/clipping/struts/DefaultErrorAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/DefaultErrorAction.java.diff?r1=1.2&r2=1.3&f=h
1.2 +0 -8
webclip_builder/war/src/java/com/jahia/clipping/struts/DefaultErrorForm.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/DefaultErrorForm.java.diff?r1=1.1&r2=1.2&f=h
1.11 +38 -21
webclip_builder/war/src/java/com/jahia/clipping/struts/WebBrowserAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/struts/WebBrowserAction.java.diff?r1=1.10&r2=1.11&f=h
1.11 +28 -71
webclip_builder/war/src/java/com/jahia/clipping/web/HTMLDocumentBuilder.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/HTMLDocumentBuilder.java.diff?r1=1.10&r2=1.11&f=h
1.9 +2 -2
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/ChewExtractorFilter.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/ChewExtractorFilter.java.diff?r1=1.8&r2=1.9&f=h
1.10 +2 -2
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/TransformBuilderVisitor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/TransformBuilderVisitor.java.diff?r1=1.9&r2=1.10&f=h
1.8 +1 -3
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/UserBuilderVisitor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/UserBuilderVisitor.java.diff?r1=1.7&r2=1.8&f=h
1.9 +2 -4
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLDocument.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLDocument.java.diff?r1=1.8&r2=1.9&f=h
1.15 +2 -6
webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/Neko/DomHTMLTransformer.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/Neko/DomHTMLTransformer.java.diff?r1=1.14&r2=1.15&f=h
1.12 +11 -12
webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HTMLUnitProcessor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HTMLUnitProcessor.java.diff?r1=1.11&r2=1.12&f=h
1.15 +17 -19
webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HttpProcessor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HttpProcessor.java.diff?r1=1.14&r2=1.15&f=h
1.6 +3 -1 webclip_builder/war/src/webapp/WEB-INF/struts-config.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/webapp/WEB-INF/struts-config.xml.diff?r1=1.5&r2=1.6&f=h
1.2 +49 -5 webclip_builder/war/src/webapp/jsp/defaultError.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/webapp/jsp/defaultError.jsp.diff?r1=1.1&r2=1.2&f=h
Index: project.properties
===================================================================
RCS file: /home/cvs/repository/webclip_builder/war/project.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- project.properties 1 Jul 2005 16:21:43 -0000 1.3
+++ project.properties 5 Jul 2005 08:57:04 -0000 1.4
@@ -6,8 +6,11 @@
maven.jar.override=on
maven.jar.jta=${basedir}/lib/jta.jar
maven.jar.htmlunit=${basedir}/lib/htmlunit-1.6.jar
+
+#hmtlparser lib
maven.jar.checkstyle-all=${basedir}/lib/htmlparser/checkstyle-all-3.1.jar
maven.jar.filterbuilder=${basedir}/lib/htmlparser/filterbuilder.jar
maven.jar.htmllexer=${basedir}/lib/htmlparser/htmllexer.jar
maven.jar.htmlparser=${basedir}/lib/htmlparser/htmlparser.jar
+maven.jar.sax2=${basedir}/lib/htmlparser/sax2.jar
maven.jar.thumbelina=${basedir}/lib/htmlparser/thumbelina.jar
Index: en_US.properties
===================================================================
RCS file: /home/cvs/repository/webclip_builder/war/src/conf/en_US.properties,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- en_US.properties 5 Jul 2005 06:17:34 -0000 1.14
+++ en_US.properties 5 Jul 2005 08:57:04 -0000 1.15
@@ -166,8 +166,8 @@
edit.formName = Parent Form
edit.formId = Parent Id
edit.type = type
-edit.visibility.false = false
-edit.visibility.true = true
+edit.visibility.false = hidden
+edit.visibility.true = visible
# TestClipper
testClipper.title = Change parameters
Index: BrowseAction.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/BrowseAction.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- BrowseAction.java 5 Jul 2005 06:17:35 -0000 1.11
+++ BrowseAction.java 5 Jul 2005 08:57:05 -0000 1.12
@@ -203,7 +203,9 @@
return actionMapping.findForward("selectPart");
}
// set the browser
-
getWebBrowserForm(httpServletRequest).setShow(Constants.WEB_BROWSER_SHOW_BROWSE);
+ WebBrowserForm wForm = getWebBrowserForm(httpServletRequest);
+ wForm.setShow(Constants.WEB_BROWSER_SHOW_BROWSE);
+
//process only if it'st a new action (does'nt load from wizard)
logger.debug("[ Browse ]");
@@ -453,7 +455,7 @@
HTMLDocument doc = builder.execute(request, response);
//Get and save all errors that's occured during execution
- List errors = builder.getParsingErrors();
+ /* List errors = builder.getParsingErrors();
ActionErrors actionErrors = new ActionErrors();
for (int i = 0; i < errors.size(); i++) {
String error = errors.get(i).toString();
@@ -461,7 +463,7 @@
actionErrors.add("errors.message", e);
//logger.debug("[ ERROR ]"+error);
}
- addErrors(request, actionErrors);
+ addErrors(request, actionErrors);*/
return doc;
}
Index: DefaultErrorAction.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/DefaultErrorAction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultErrorAction.java 4 Mar 2005 17:29:25 -0000 1.2
+++ DefaultErrorAction.java 5 Jul 2005 08:57:05 -0000 1.3
@@ -7,7 +7,7 @@
*
[EMAIL PROTECTED] Tlili Khaled
*/
-public class DefaultErrorAction extends Action {
+public class DefaultErrorAction extends org.apache.struts.action.Action {
/**
* Description of the Method
*
Index: DefaultErrorForm.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/DefaultErrorForm.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultErrorForm.java 3 Mar 2005 18:03:53 -0000 1.1
+++ DefaultErrorForm.java 5 Jul 2005 08:57:05 -0000 1.2
@@ -13,14 +13,6 @@
/**
* Constructor for the DefaultErrorForm object
- */
- public DefaultErrorForm() {
-
- }
-
-
- /**
- * Constructor for the DefaultErrorForm object
*
[EMAIL PROTECTED] previousPage Description of Parameter
[EMAIL PROTECTED] typeError Description of Parameter
Index: WebBrowserAction.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/struts/WebBrowserAction.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- WebBrowserAction.java 4 Jul 2005 12:52:18 -0000 1.10
+++ WebBrowserAction.java 5 Jul 2005 08:57:05 -0000 1.11
@@ -140,17 +140,18 @@
[EMAIL PROTECTED] Exception Description of Exception
*/
public ActionForward execute(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest httpServletRequest, HttpServletResponse
httpServletResponse) throws Exception {
+ ActionForward forward = actionMapping.getInputForward();
+ WebBrowserForm form = (WebBrowserForm) actionForm;
+ ActionErrors actionErrors = getErrors(httpServletRequest);
+
try {
logger.debug("[WebBrowser - Execute ]");
- WebBrowserForm form = (WebBrowserForm) actionForm;
-
ClipperBean bean = getClipperBean(httpServletRequest);
//Handing error
logger.debug("[WebBrowser - Execute - Handle Error ]");
if (bean == null) {
- logger.error(
- "[WebBrowser - Execute -
ClipperBean not found ]");
- //return
actionMapping.findForward("description");
+ logger.error("[WebBrowser - Execute -
ClipperBean not found ]");
+ forward =
actionMapping.findForward("description");
}
//init
@@ -173,6 +174,7 @@
logger.debug(" SHOW BROWSE DOCUMENT ");
HTMLDocument doc =
addUrlBeanAndGetHTMLDocument(httpServletRequest, httpServletResponse, form);
html =
doc.getTransformedDocumentAsString();
+
}
else if
(showParam.equalsIgnoreCase(Constants.WEB_BROWSER_SHOW_LAST_DOCUMENT)) {
@@ -204,20 +206,34 @@
}
else {
- logger.error("Show Param Value not
expected: " +
- form);
+ logger.error("Show Param Value not
expected: " + form);
}
}
else {
logger.error("Show Param not found");
}
-
httpServletRequest.setCharacterEncoding(WebConstants.ENCODING_ISO);
- form.setContent(html);
+
+ //manage errors
+ actionErrors = getErrors(httpServletRequest);
+ if (actionErrors != null && actionErrors.size() > 0) {
+ forward =
actionMapping.findForward("showError");
+ }
+ else {
+
httpServletRequest.setCharacterEncoding(WebConstants.ENCODING_ISO);
+ form.setContent(html);
+ }
}
catch (Exception ex) {
+ logger.debug("Error has occured");
+ forward = actionMapping.findForward("showError");
+ ActionError e = new ActionError("errors.message",
ex.getMessage());
+ actionErrors.add("errors.message", e);
+ saveErrors(httpServletRequest, actionErrors);
ex.printStackTrace();
}
- return actionMapping.getInputForward();
+ finally {
+ return forward;
+ }
}
@@ -368,16 +384,17 @@
HTMLDocument doc = builder.execute(request, response);
//Get and save all errors that's occured during execution
- List errors = builder.getParsingErrors();
- ActionErrors actionErrors = new ActionErrors();
- for (int i = 0; i < errors.size(); i++) {
- String error = errors.get(i).toString();
- ActionError e = new ActionError("errors.message",
error);
- actionErrors.add("errors.message", e);
- //logger.debug("[ ERROR ]"+error);
- }
- addErrors(request, actionErrors);
-
+ /*
+ * List errors = builder.getParsingErrors();
+ * ActionErrors actionErrors = new ActionErrors();
+ * for (int i = 0; i < errors.size(); i++) {
+ * String error = errors.get(i).toString();
+ * ActionError e = new ActionError("errors.message", error);
+ * actionErrors.add("errors.message", e);
+ * //logger.debug("[ ERROR ]"+error);
+ * }
+ * saveErrors(request, actionErrors);
+ */
return doc;
}
@@ -487,7 +504,7 @@
BrowseForm bForm = (BrowseForm)
httpServletRequest.getAttribute(Constants.BROWSE_FORM);
bForm.getErrors().add("errors.message", e);
}
- addErrors(httpServletRequest, actionErrors);
+ saveErrors(httpServletRequest, actionErrors);
return doc;
}
Index: HTMLDocumentBuilder.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/HTMLDocumentBuilder.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- HTMLDocumentBuilder.java 4 Jul 2005 12:52:19 -0000 1.10
+++ HTMLDocumentBuilder.java 5 Jul 2005 08:57:05 -0000 1.11
@@ -31,15 +31,6 @@
private Header[] headers_ = null;
/**
- * Gets the Errors attribute of the HTMLDocument object
- *
- [EMAIL PROTECTED] The Errors value
- */
- private java.util.List parsingErrors = new ArrayList();
-
- private java.util.List connectionErrors = new ArrayList();
-
- /**
* Description of the Field
*/
public static final int PARSER_NEKO = 0;
@@ -78,26 +69,6 @@
}
- /**
- * Gets the Errors attribute of the HTMLDocument object
- *
- [EMAIL PROTECTED] The Errors value
- */
- public java.util.List getParsingErrors() {
- return this.parsingErrors;
- }
-
-
- /**
- * Gets the ConnectionErrors attribute of the HTMLDocumentBuilder
object
- *
- [EMAIL PROTECTED] The ConnectionErrors value
- */
- public java.util.List getConnectionErrors() {
- return this.connectionErrors;
- }
-
-
/**
* configure the builder
@@ -132,6 +103,7 @@
if (html == null) {
logger.error("HTML document as String is null");
html = "<html><body> <p>No document loaded </p> </body>
<html>";
+ throw new WebClippingException("Html document can't be
rendered", new NullPointerException());
}
// Execute whith the choosen parser
@@ -141,23 +113,15 @@
}
- /**
- * Adds a feature to the Error attribute of the HTMLDocumentBuilder
object
- *
- [EMAIL PROTECTED] error The feature to be added to the Error
attribute
- */
- public void addError(String error) {
- this.getParsingErrors().add(error);
- }
-
/**
* Gets the HtmlAsString attribute of the HTMLDocumentBuilder object
*
- [EMAIL PROTECTED] request Description of Parameter
- [EMAIL PROTECTED] The HtmlAsString value
+ [EMAIL PROTECTED] request Description of Parameter
+ [EMAIL PROTECTED] The HtmlAsString value
+ [EMAIL PROTECTED] Exception Description of Exception
*/
- private String getHtmlAsString(HttpServletRequest request) {
+ private String getHtmlAsString(HttpServletRequest request) throws
Exception {
String res = null;
try {
@@ -183,19 +147,16 @@
}
}
catch (WebClippingException ex) {
- // add errors
ex.printStackTrace();
- addError(ex.getType() + ": " + ex.toString());
+ throw ex;
}
catch (Exception ex) {
// add errors
ex.printStackTrace();
- addError("Exception: " + ex.toString());
- }
- finally {
- return res;
+ throw new WebClippingException("Exception", ex);
}
+ return res;
}
@@ -203,13 +164,13 @@
/**
* Gets the HtmlAsDocument attribute of the HTMLDocumentBuilder object
*
- [EMAIL PROTECTED] request Description of Parameter
- [EMAIL PROTECTED] response Description of Parameter
- [EMAIL PROTECTED] html Description of Parameter
- [EMAIL PROTECTED] The HtmlAsDocument value
- [EMAIL PROTECTED] WebClippingException Description of Exception
+ [EMAIL PROTECTED] request Description of Parameter
+ [EMAIL PROTECTED] response Description of Parameter
+ [EMAIL PROTECTED] html Description of Parameter
+ [EMAIL PROTECTED] The HtmlAsDocument value
+ [EMAIL PROTECTED] Exception Description of Exception
*/
- private HTMLDocument buildHtmlDocument(HttpServletRequest request,
HttpServletResponse response, String html) throws WebClippingException {
+ private HTMLDocument buildHtmlDocument(HttpServletRequest request,
HttpServletResponse response, String html) throws Exception {
HTMLDocument htmlDocument = new EmptyHTMLDocument(uBean_);
try {
@@ -272,27 +233,23 @@
}
catch (WebClippingException ex) {
// add errors
- addError(ex.getType() + ": " + ex.toString());
+ throw ex;
}
catch (Exception ex) {
// add errors
- addError("Exception: " + ex.toString());
- }
- finally {
- return htmlDocument;
+ throw new WebClippingException("Failing Http Status
Code", ex);
}
-
}
/**
* Description of the Method
*
- [EMAIL PROTECTED] request Description of Parameter
- [EMAIL PROTECTED] Description of the
Returned Value
- [EMAIL PROTECTED] WebClippingException Description of Exception
+ [EMAIL PROTECTED] request Description of Parameter
+ [EMAIL PROTECTED] Description of the Returned Value
+ [EMAIL PROTECTED] Exception Description of Exception
*/
- private String[] executeWhithSimpleHTMLUnitClient(HttpServletRequest
request) throws WebClippingException {
+ private String[] executeWhithSimpleHTMLUnitClient(HttpServletRequest
request) throws Exception {
HTMLUnitProcessor client = new HTMLUnitProcessor(headers_,
httpMethod_, uBean_);
//set WebClient
@@ -318,11 +275,11 @@
/**
* Description of the Method
*
- [EMAIL PROTECTED] request Description of Parameter
- [EMAIL PROTECTED] Description of the
Returned Value
- [EMAIL PROTECTED] WebClippingException Description of Exception
+ [EMAIL PROTECTED] request Description of Parameter
+ [EMAIL PROTECTED] Description of the Returned Value
+ [EMAIL PROTECTED] Exception Description of Exception
*/
- private String executeWhithAdvancedHTMLUnitClient(HttpServletRequest
request) throws WebClippingException {
+ private String executeWhithAdvancedHTMLUnitClient(HttpServletRequest
request) throws Exception {
HttpSession session = request.getSession();
// get the client
@@ -355,11 +312,11 @@
/**
* Description of the Method
*
- [EMAIL PROTECTED] request Description of Parameter
- [EMAIL PROTECTED] Description of the
Returned Value
- [EMAIL PROTECTED] WebClippingException Description of Exception
+ [EMAIL PROTECTED] request Description of Parameter
+ [EMAIL PROTECTED] Description of the Returned Value
+ [EMAIL PROTECTED] Exception Description of Exception
*/
- private String executeWhithHttpClient(HttpServletRequest request)
throws WebClippingException {
+ private String executeWhithHttpClient(HttpServletRequest request)
throws Exception {
HttpProcessor client = new HttpProcessor(httpMethod_, uBean_);
//set HttpState
Index: ChewExtractorFilter.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/ChewExtractorFilter.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ChewExtractorFilter.java 1 Jul 2005 16:21:46 -0000 1.8
+++ ChewExtractorFilter.java 5 Jul 2005 08:57:06 -0000 1.9
@@ -102,9 +102,9 @@
ex.printStackTrace();
logger.error("buldKeySelectedPart error " +
ex.getMessage());
}
- finally {
+
return encoded;
- }
+
}
Index: TransformBuilderVisitor.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/TransformBuilderVisitor.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TransformBuilderVisitor.java 5 Jul 2005 06:49:42 -0000 1.9
+++ TransformBuilderVisitor.java 5 Jul 2005 08:57:06 -0000 1.10
@@ -541,7 +541,7 @@
[EMAIL PROTECTED] WebClippingException Description of Exception
*/
protected void processScriptTag(ScriptTag tag) throws
WebClippingException {
-
+ ((ScriptScanner) tag.getThisScanner()).STRICT = true;
try {
// imported scrip
String src =
tag.getAttribute(HTML.Attribute.SRC.toString());
@@ -563,7 +563,7 @@
else {
//inline javascript
- String content = tag.toPlainTextString();
+ String content = tag.getScriptCode();
if (content != null) {
Hashtable atts = tag.getAttributes();
tag = new ScriptTag();
Index: UserBuilderVisitor.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/HTMLParser/UserBuilderVisitor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- UserBuilderVisitor.java 4 Jul 2005 15:36:17 -0000 1.7
+++ UserBuilderVisitor.java 5 Jul 2005 08:57:06 -0000 1.8
@@ -189,9 +189,7 @@
catch (Exception ex) {
throw new WebClippingException("Script", ex);
}
- finally {
- return;
- }
+
}
Index: JDomHTMLDocument.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/JDom/JDomHTMLDocument.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- JDomHTMLDocument.java 1 Jul 2005 16:21:47 -0000 1.8
+++ JDomHTMLDocument.java 5 Jul 2005 08:57:06 -0000 1.9
@@ -460,14 +460,12 @@
}
catch (Exception ex) {
- logger.error(
- "[document from neko and jdom: can't
get the transformed document] ");
+ logger.error("[document from neko and jdom: can't get
the transformed document] ");
ex.printStackTrace();
}
- finally {
return res;
- }
+
}
}
Index: DomHTMLTransformer.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/html/Impl/Neko/DomHTMLTransformer.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- DomHTMLTransformer.java 4 Jul 2005 15:36:17 -0000 1.14
+++ DomHTMLTransformer.java 5 Jul 2005 08:57:06 -0000 1.15
@@ -129,11 +129,8 @@
ex.printStackTrace();
}
- finally {
-
- //set the transformed document
- getDocument().setChewDocument(chewDocument);
- }
+ //set the transformed document
+ getDocument().setChewDocument(chewDocument);
}
@@ -996,7 +993,6 @@
-
/**
* Description of the Method
*
Index: HTMLUnitProcessor.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HTMLUnitProcessor.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- HTMLUnitProcessor.java 5 Jul 2005 06:17:36 -0000 1.11
+++ HTMLUnitProcessor.java 5 Jul 2005 08:57:07 -0000 1.12
@@ -43,19 +43,18 @@
*/
public void execute() throws WebClippingException {
String html = "";
-
- // first page
- HtmlPage page = getLastPage();
- if (page == null) {
- logger.debug("First page");
- setWebClient(getNewWebClient());
- super.execute();
- addPage(page_);
- return;
- }
-
- //continue browsing
try {
+ // first page
+ HtmlPage page = getLastPage();
+ if (page == null) {
+ logger.debug("First page");
+ setWebClient(getNewWebClient());
+ super.execute();
+ addPage(page_);
+ return;
+ }
+
+ //continue browsing
UrlBean uBean = getUrlBean();
String from = uBean.getFrom();
Index: HttpProcessor.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/com/jahia/clipping/web/http/impl/HttpProcessor.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- HttpProcessor.java 5 Jul 2005 06:17:36 -0000 1.14
+++ HttpProcessor.java 5 Jul 2005 08:57:07 -0000 1.15
@@ -652,26 +652,24 @@
throw new WebClippingException("Fatal Exception error",
e);
}
- finally {
- // Release the connections.
- if (method != null) {
- method.releaseConnection();
- }
- if (redirect != null) {
- redirect.releaseConnection();
- }
-
- //HttpState
- HttpState state = getHttpClient().getState();
- Cookie[] cookies = state.getCookies();
- logger.debug("[ Begin Enumerate cookies after execution
]");
- for (int i = 0; i < cookies.length; i++) {
- Cookie c = cookies[i];
- logger.debug("[ Found cookie after execution: "
+ c.getName() + " ]");
- }
- //update state
- setStateAfterExecution(state);
+ // Release the connections.
+ if (method != null) {
+ method.releaseConnection();
}
+ if (redirect != null) {
+ redirect.releaseConnection();
+ }
+
+ //HttpState
+ HttpState state = getHttpClient().getState();
+ Cookie[] cookies = state.getCookies();
+ logger.debug("[ Begin Enumerate cookies after execution ]");
+ for (int i = 0; i < cookies.length; i++) {
+ Cookie c = cookies[i];
+ logger.debug("[ Found cookie after execution: " +
c.getName() + " ]");
+ }
+ //update state
+ setStateAfterExecution(state);
}
Index: struts-config.xml
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/webapp/WEB-INF/struts-config.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- struts-config.xml 23 Jun 2005 16:15:52 -0000 1.5
+++ struts-config.xml 5 Jul 2005 08:57:07 -0000 1.6
@@ -51,7 +51,9 @@
<forward name="previewTest"
path="/saveClipper.do?webClippingAction=test" />
</action>
<!-- web Browser -->
- <action input="/jsp/templates/webBrowser.jsp" name="webBrowserForm"
parameter="show" path="/webBrowser" scope="session"
type="com.jahia.clipping.struts.WebBrowserAction" validate="true"/>
+ <action input="/jsp/templates/webBrowser.jsp" name="webBrowserForm"
parameter="show" path="/webBrowser" scope="session"
type="com.jahia.clipping.struts.WebBrowserAction" validate="true">
+ <forward name="showError" path="/jsp/defaultError.jsp" />
+ </action>
</action-mappings>
<message-resources parameter="ApplicationResources" />
Index: defaultError.jsp
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/webapp/jsp/defaultError.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- defaultError.jsp 3 Mar 2005 18:04:10 -0000 1.1
+++ defaultError.jsp 5 Jul 2005 08:57:07 -0000 1.2
@@ -1,5 +1,49 @@
-<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
-
-<tiles:insert template="/jsp/templates/formTemplate.jsp">
- <tiles:put name="jahia.webClipping.action"
content="/jsp/error/defaultError.jsp"/>
-</tiles:insert>
+<[EMAIL PROTECTED] uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
+<[EMAIL PROTECTED] uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
+<[EMAIL PROTECTED] uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
+<[EMAIL PROTECTED] uri="/WEB-INF/struts-template.tld" prefix="template"%>
+<[EMAIL PROTECTED] uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
+<[EMAIL PROTECTED] uri="/WEB-INF/struts-html.tld" prefix="html"%>
+<[EMAIL PROTECTED] language="Java" import="java.util.*"%>
+<html:html>
+<head>
+ <link rel="stylesheet" href="web_css.jsp?colorSet=blue" type="text/css"/>
+ <link rel="stylesheet" href="style.css" type="text/css"/>
+ <html:base/>
+</head>
+<body>
+ <!-- Error-->
+ <html:form action="webBrowser" method="post">
+ <logic:messagesPresent>
+ <table align="center" bgcolor="#800000" cellpadding="0" cellspacing="1"
width="100%">
+ <tbody>
+ <tr>
+ <td>
+ <table align="center" bgcolor="#ffffff" border="0" width="100%">
+ <tbody>
+ <tr>
+ <td align="center" bgcolor="#dcdcdc">
+ <font color="#cc0000">
+ <bean:message key="error.error"/>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <UL>
+ <html:messages id="error">
+ <LI> <bean:write name="error"/> </LI>
+ </html:messages>
+ </UL>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </logic:messagesPresent>
+ </html:form>
+</body>
+</html:html>