Skip to content

Commit 68bef41

Browse files
authored
[break] Rename to Conjure ecosystem (#117)
1 parent 9da14c9 commit 68bef41

File tree

62 files changed

+606
-910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+606
-910
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies {
3434

3535
allprojects {
3636
version gitVersion()
37-
group 'com.palantir.remoting-api'
37+
group 'com.palantir.conjure.java.api'
3838

3939
apply plugin: 'com.palantir.configuration-resolver'
4040
apply plugin: 'nebula.dependency-recommender'

errors/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies {
77
compile "com.google.code.findbugs:jsr305"
88
compile "com.palantir.safe-logging:safe-logging"
99
compile "javax.ws.rs:javax.ws.rs-api"
10-
compile "com.palantir.conjure.java.api:errors"
10+
implementation "com.palantir.safe-logging:preconditions"
1111

1212
testCompile project(":extras:jackson-support")
1313
testCompile "org.assertj:assertj-core"

errors/src/main/java/com/palantir/remoting/api/errors/ErrorType.java renamed to errors/src/main/java/com/palantir/conjure/java/api/errors/ErrorType.java

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.palantir.remoting.api.errors;
17+
package com.palantir.conjure.java.api.errors;
1818

1919
import java.util.regex.Matcher;
2020
import java.util.regex.Pattern;
@@ -52,33 +52,6 @@ public enum Code {
5252
Code(Integer httpErrorCode) {
5353
this.httpErrorCode = httpErrorCode;
5454
}
55-
56-
@SuppressWarnings("checkstyle:CyclomaticComplexity")
57-
public com.palantir.conjure.java.api.errors.ErrorType.Code asConjure() {
58-
switch (this) {
59-
case PERMISSION_DENIED:
60-
return com.palantir.conjure.java.api.errors.ErrorType.Code.PERMISSION_DENIED;
61-
case INVALID_ARGUMENT:
62-
return com.palantir.conjure.java.api.errors.ErrorType.Code.INVALID_ARGUMENT;
63-
case NOT_FOUND:
64-
return com.palantir.conjure.java.api.errors.ErrorType.Code.NOT_FOUND;
65-
case CONFLICT:
66-
return com.palantir.conjure.java.api.errors.ErrorType.Code.CONFLICT;
67-
case REQUEST_ENTITY_TOO_LARGE:
68-
return com.palantir.conjure.java.api.errors.ErrorType.Code.REQUEST_ENTITY_TOO_LARGE;
69-
case FAILED_PRECONDITION:
70-
return com.palantir.conjure.java.api.errors.ErrorType.Code.FAILED_PRECONDITION;
71-
case INTERNAL:
72-
return com.palantir.conjure.java.api.errors.ErrorType.Code.INTERNAL;
73-
case TIMEOUT:
74-
return com.palantir.conjure.java.api.errors.ErrorType.Code.TIMEOUT;
75-
case CUSTOM_CLIENT:
76-
return com.palantir.conjure.java.api.errors.ErrorType.Code.CUSTOM_CLIENT;
77-
case CUSTOM_SERVER:
78-
return com.palantir.conjure.java.api.errors.ErrorType.Code.CUSTOM_SERVER;
79-
}
80-
throw new UnsupportedOperationException("Unable to convert to Conjure ErrorType.Code");
81-
}
8255
}
8356

8457
public static final ErrorType PERMISSION_DENIED =
@@ -106,10 +79,6 @@ public com.palantir.conjure.java.api.errors.ErrorType.Code asConjure() {
10679
/** The HTTP error code used to convey this error to HTTP clients. */
10780
public abstract int httpErrorCode();
10881

109-
public final com.palantir.conjure.java.api.errors.ErrorType asConjure() {
110-
return com.palantir.conjure.java.api.errors.ErrorType.create(code().asConjure(), name());
111-
}
112-
11382
@Value.Check
11483
final void check() {
11584
if (!ERROR_NAME_PATTERN.matcher(name()).matches()) {
@@ -118,26 +87,6 @@ final void check() {
11887
}
11988
}
12089

121-
/**
122-
* Creates a new error type with code {@link Code#CUSTOM_CLIENT} and the given name.
123-
*
124-
* @deprecated Use {@link #create}. This method will be removed in version 2.0.0.
125-
*/
126-
@Deprecated
127-
public static ErrorType client(String name) {
128-
return createAndCheckNamespaceIsNotDefault(Code.CUSTOM_CLIENT, name);
129-
}
130-
131-
/**
132-
* Creates a new error type with code {@link Code#CUSTOM_SERVER} and the given name.
133-
*
134-
* @deprecated Use {@link #create}. This method will be removed in version 2.0.0.
135-
*/
136-
@Deprecated
137-
public static ErrorType server(String name) {
138-
return createAndCheckNamespaceIsNotDefault(Code.CUSTOM_SERVER, name);
139-
}
140-
14190
/**
14291
* Constructs an {@link ErrorType} with the given error {@link Code} and name.
14392
*/

ssl-config/src/main/java/com/palantir/remoting/api/config/ssl/ImmutablesStyle.java renamed to errors/src/main/java/com/palantir/conjure/java/api/errors/ImmutablesStyle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.palantir.remoting.api.config.ssl;
17+
package com.palantir.conjure.java.api.errors;
1818

1919
import java.lang.annotation.ElementType;
2020
import java.lang.annotation.Retention;

errors/src/main/java/com/palantir/remoting/api/errors/QosException.java renamed to errors/src/main/java/com/palantir/conjure/java/api/errors/QosException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.palantir.remoting.api.errors;
17+
package com.palantir.conjure.java.api.errors;
1818

1919
import com.palantir.logsafe.Arg;
2020
import com.palantir.logsafe.SafeArg;

errors/src/main/java/com/palantir/remoting/api/errors/RemoteException.java renamed to errors/src/main/java/com/palantir/conjure/java/api/errors/RemoteException.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.palantir.remoting.api.errors;
17+
package com.palantir.conjure.java.api.errors;
1818

1919
/**
2020
* An exception thrown by an RPC client to indicate remote/server-side failure.
@@ -44,9 +44,4 @@ public RemoteException(SerializableError error, int status) {
4444
this.error = error;
4545
this.status = status;
4646
}
47-
48-
/** Converts this exception to an equivalent conjure-java-api RemoteException. */
49-
public com.palantir.conjure.java.api.errors.RemoteException asConjure() {
50-
return new com.palantir.conjure.java.api.errors.RemoteException(error.asConjure(), status);
51-
}
5247
}

errors/src/main/java/com/palantir/remoting/api/errors/SerializableError.java renamed to errors/src/main/java/com/palantir/conjure/java/api/errors/SerializableError.java

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.palantir.remoting.api.errors;
17+
package com.palantir.conjure.java.api.errors;
1818

1919
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
2020
import com.fasterxml.jackson.annotation.JsonProperty;
2121
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
2222
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
2323
import com.palantir.logsafe.Arg;
24+
import com.palantir.logsafe.exceptions.SafeIllegalStateException;
2425
import java.io.Serializable;
2526
import java.util.Map;
2627
import java.util.Objects;
@@ -48,7 +49,7 @@ public abstract class SerializableError implements Serializable {
4849
@JsonProperty("errorCode")
4950
@Value.Default
5051
public String errorCode() {
51-
return getExceptionClass().orElseThrow(() -> new IllegalStateException(
52+
return getExceptionClass().orElseThrow(() -> new SafeIllegalStateException(
5253
"Expected either 'errorCode' or 'exceptionClass' to be set"));
5354
}
5455

@@ -60,7 +61,7 @@ public String errorCode() {
6061
@JsonProperty("errorName")
6162
@Value.Default
6263
public String errorName() {
63-
return getMessage().orElseThrow(() -> new IllegalStateException(
64+
return getMessage().orElseThrow(() -> new SafeIllegalStateException(
6465
"Expected either 'errorName' or 'message' to be set"));
6566
}
6667

@@ -115,24 +116,6 @@ public static SerializableError forException(ServiceException exception) {
115116
return builder.build();
116117
}
117118

118-
public final com.palantir.conjure.java.api.errors.SerializableError asConjure() {
119-
com.palantir.conjure.java.api.errors.SerializableError.Builder builder =
120-
com.palantir.conjure.java.api.errors.SerializableError.builder();
121-
122-
if (!getExceptionClass().isPresent()) {
123-
builder.errorCode(errorCode());
124-
builder.errorName(errorName());
125-
} else {
126-
// this is for back-compat, old remoting2 exceptions have 'exceptionClass' and 'message' fields.
127-
builder.exceptionClass(getExceptionClass().get());
128-
builder.message(getMessage().get());
129-
}
130-
131-
builder.errorInstanceId(errorInstanceId());
132-
133-
return builder.build();
134-
}
135-
136119
// TODO(rfink): Remove once all error producers have switched to errorCode/errorName.
137120
public static final class Builder extends ImmutableSerializableError.Builder {}
138121

errors/src/main/java/com/palantir/remoting/api/errors/ServiceException.java renamed to errors/src/main/java/com/palantir/conjure/java/api/errors/ServiceException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.palantir.remoting.api.errors;
17+
package com.palantir.conjure.java.api.errors;
1818

1919
import com.palantir.logsafe.Arg;
2020
import com.palantir.logsafe.SafeArg;

errors/src/main/java/com/palantir/remoting/api/errors/UnknownRemoteException.java renamed to errors/src/main/java/com/palantir/conjure/java/api/errors/UnknownRemoteException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.palantir.remoting.api.errors;
17+
package com.palantir.conjure.java.api.errors;
1818

1919
/**
2020
* An exception thrown by an RPC client to indicate remote/server-side failure from a non-remoting server.

errors/src/test/java/com/palantir/remoting/api/errors/ErrorTypeTest.java renamed to errors/src/test/java/com/palantir/conjure/java/api/errors/ErrorTypeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.palantir.remoting.api.errors;
17+
package com.palantir.conjure.java.api.errors;
1818

1919
import static org.assertj.core.api.Assertions.assertThat;
2020
import static org.assertj.core.api.Assertions.assertThatThrownBy;

0 commit comments

Comments
 (0)