Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mrelease 1116 #173

Merged
merged 2 commits into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion maven-release-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
~ specific language governing permissions and limitations
~ under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.maven.shared.release;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,30 +16,27 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.shared.release;

/**
* Exception occurring during release execution.
*
* @author <a href="mailto:[email protected]">Brett Porter</a>
*/
public class ReleaseExecutionException
extends Exception
{
public class ReleaseExecutionException extends Exception {
/**
* Creates a new instance of <code>ReleaseExecutionException</code> without detail message.
*/
public ReleaseExecutionException( String message )
{
super( message );
public ReleaseExecutionException(String message) {
super(message);
}

/**
* Constructs an instance of <code>ReleaseExecutionException</code> with the specified detail message.
*
* @param message the detail message.
*/
public ReleaseExecutionException( String message, Throwable cause )
{
super( message, cause );
public ReleaseExecutionException(String message, Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.maven.shared.release;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,17 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.shared.release;

/**
* A failure during the release process.
*
* @author <a href="mailto:[email protected]">Brett Porter</a>
*/
public class ReleaseFailureException
extends Exception
{
public ReleaseFailureException( String message )
{
super( message );
public class ReleaseFailureException extends Exception {
public ReleaseFailureException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.maven.shared.release;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.shared.release;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

/**
* @author Edwin Punzalan
*/
public class ReleaseResult
{
public class ReleaseResult {
/** The result of the release. */
public static final int UNDEFINED = -1;
/** The release was successful. */
Expand All @@ -42,66 +40,60 @@ public class ReleaseResult

private long endTime;

private static final String LS = System.getProperty( "line.separator" );
private static final String LS = System.getProperty("line.separator");

/**
* Append Info message to the output.
* @param message the message to append
*/
public void appendInfo( String message )
{
stdOut.append( "[INFO] " ).append( message ).append( LS );
public void appendInfo(String message) {
stdOut.append("[INFO] ").append(message).append(LS);
}
/**
* Append warning message to the output.
* @param message the message to append
*/
public void appendWarn( String message )
{
stdOut.append( "[WARN] " ).append( message ).append( LS );
public void appendWarn(String message) {
stdOut.append("[WARN] ").append(message).append(LS);
}

/**
* Append debug message to the output.
* @param message the message to append
*/
public void appendDebug( String message )
{
stdOut.append( "[DEBUG] " ).append( message ).append( LS );
public void appendDebug(String message) {
stdOut.append("[DEBUG] ").append(message).append(LS);
}

/**
* Append error message to the output.
* @param message the message to append
* @param e the exception to append
*/
public void appendDebug( String message, Exception e )
{
appendDebug( message );
public void appendDebug(String message, Exception e) {
appendDebug(message);

stdOut.append( getStackTrace( e ) ).append( LS );
stdOut.append(getStackTrace(e)).append(LS);
}

/**
* Append error message to the output.
*
* @param message the message to append
*/
public void appendError( String message )
{
stdOut.append( "[ERROR] " ).append( message ).append( LS );
public void appendError(String message) {
stdOut.append("[ERROR] ").append(message).append(LS);

setResultCode( ERROR );
setResultCode(ERROR);
}

/**
* Append error exception to the output
*
* @param e the exception to append
*/
public void appendError( Exception e )
{
appendError( getStackTrace( e ) );
public void appendError(Exception e) {
appendError(getStackTrace(e));
}

/**
Expand All @@ -110,65 +102,55 @@ public void appendError( Exception e )
* @param message the message to append
* @param e the exception to append
*/
public void appendError( String message, Exception e )
{
appendError( message );
public void appendError(String message, Exception e) {
appendError(message);

stdOut.append( getStackTrace( e ) ).append( LS );
stdOut.append(getStackTrace(e)).append(LS);
}

/**
* Append message to the output.
*
* @param message the message to append
*/
public void appendOutput( String message )
{
stdOut.append( message );
public void appendOutput(String message) {
stdOut.append(message);
}

public String getOutput()
{
public String getOutput() {
return stdOut.toString();
}

public int getResultCode()
{
public int getResultCode() {
return resultCode;
}

public void setResultCode( int resultCode )
{
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
}

public long getStartTime()
{
public long getStartTime() {
return startTime;
}

public void setStartTime( long startTime )
{
public void setStartTime(long startTime) {
this.startTime = startTime;
}

public long getEndTime()
{
public long getEndTime() {
return endTime;
}

public void setEndTime( long endTime )
{
public void setEndTime(long endTime) {
this.endTime = endTime;
}

private String getStackTrace( Exception e )
{
private String getStackTrace(Exception e) {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();

PrintStream stream = new PrintStream( byteStream );
PrintStream stream = new PrintStream(byteStream);

e.printStackTrace( stream );
e.printStackTrace(stream);

stream.flush();

Expand Down
Loading