From abeaafc9c7c9dcea72ea5c7e0e93417bb2111cc6 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sun, 4 Sep 2016 12:07:37 +0200 Subject: Don't log error if system git config does not exist - enhance FS.readPipe to throw an exception if the external command fails to enable the caller to handle the command failure - reduce log level to warning if system git config does not exist - improve log message Bug: 476639 Change-Id: I94ae3caec22150dde81f1ea8e1e665df55290d42 Signed-off-by: Matthias Sohn --- .../jgit/errors/CommandFailedException.java | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 org.eclipse.jgit/src/org/eclipse/jgit/errors/CommandFailedException.java (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/errors') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CommandFailedException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CommandFailedException.java new file mode 100644 index 0000000000..93749f5e43 --- /dev/null +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CommandFailedException.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2016, Matthias Sohn + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.eclipse.jgit.errors; + +/** + * Thrown when an external command failed + * + * @since 4.5 + */ +public class CommandFailedException extends Exception { + + private static final long serialVersionUID = 1L; + + private int returnCode; + + /** + * @param returnCode + * return code returned by the command + * @param message + * error message + */ + public CommandFailedException(int returnCode, String message) { + super(message); + this.returnCode = returnCode; + } + + /** + * @param returnCode + * return code returned by the command + * @param message + * error message + * @param cause + * exception causing this exception + */ + public CommandFailedException(int returnCode, String message, + Throwable cause) { + super(message, cause); + this.returnCode = returnCode; + } + + /** + * @return return code returned by the command + */ + public int getReturnCode() { + return returnCode; + } +} -- cgit v1.2.3 combobox-communication'>feature/combobox-communication Vaadin 6, 7, 8 is a Java framework for modern Java web applications: https://github.com/vaadin/frameworkwww-data
aboutsummaryrefslogtreecommitdiffstats
blob: 6ddb12a74685eb0c500e51cf166e9871217325ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
title: Developing Portlets For The WebSphere Portal Server
order: 4
layout: page
---

[[developing-portlets-for-the-websphere-portal-server]]
Developing portlets for the Websphere Portal Server
---------------------------------------------------

When creating portlets for the Websphere Portal Server (aka WPS) you
have the choice between different frameworks

* JSF (2.0)
* Spring Portlet MVC
* Vaadin 6 / 7

While using JSF seems to be a bit outdated, because WPS just supports an
old JSF Version (MyFaces 2.0.2) Spring Portlet MVC is a good and valid
options for developing portlets.

On this page I will try to collect all information to
develop Vaadin portlets in a fast and easy to use way. I will also
handle topics like using CDI and the navigator in a portal environment
as well as some architectural ideas like using the MVP pattern for a
portlet project. As an example portlet I will use a simple master /
detail portlet just like the Vaadin address book application. I have
developed all code examples on this wiki pages with the current Vaadin
version (7.4.2 as I am writing this) and tested the portlets on WPS 8.0
and 8.5.

I use Maven for dependency management and SLF4J for logging. You can
download the small zipped project in the attachments section. Please,
feel free to leave comments and / or questions on the bottom of the
page.

[[a-simple-portlet]]
A simple Portlet
~~~~~~~~~~~~~~~~

Lets start with a "Click Me" (aka "Hello World") Vaading portlet.

The UI class is identical to servlet development (create a button with a
click listener and show a notification when clicking the button). The
interesting part is the configuration of the portlet.xml file.

[[portlet.xml]]
Portlet.xml
^^^^^^^^^^^

[source,xml]
....
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" id="com.gisag.vaadin.ClickMeUI">     
  <portlet>         
    <description>Vaadin Click Me Portlet </description>         
    <portlet-name>Vaadin Click Me Portlet</portlet-name>         
    <display-name>Vaadin Click Me Portlet</display-name>        
    <portlet-class>com.vaadin.server.VaadinPortlet</portlet-class>

    <init-param>           
      <name>UI</name>           
      <value>com.gisag.vaadin.ClickMeUI</value>         
    </init-param>         

    <init-param>             
      <name>productionMode</name>             
      <value>false</value>         
    </init-param>     
        
    <init-param>           
      <description>Path of all static vaadin resources (configurable from context root)</description>             
      <name>vaadin.resources.path</name>             
      <value>PORTLET_CONTEXT</value>       
    </init-param>

    <!-- Supported portlet modes and content types. -->         
    <supports>             
      <mime-type>text/html</mime-type>             
      <portlet-mode>view</portlet-mode>         
    </supports>     
  </portlet>
</portlet-app>
....

In the `portlet` tag you have to set a value for the `portlet-class`. For
this simple we can use the default Vaadin portlet class
`com.vaadin.server.VaadinPortlet`; you also have to name you UI class as a
portlet init parameter.

To let WPS find the Vaadin javascript and theme resources you have to
use the portlet init parameter `vaadin.resources.path`. The value
`PORTLET_CONTEXT` is a Vaadin constant value that makes the vaadin
resources available in the portlets resource path.

Run the Maven build with `clean package` as goals and deploy the created
war file in the portal administration. Create a blank portal page and
add your portlet to the page. Your "Click me" portlet should look like
this:

image:img/Click_Me_2015-03-31_21-03-27.png[Your first portlet]