[GitHub] geode pull request #700: GEODE-3386 - Make KeyedErrorResponse & ErrorRespons...

2017-08-15 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/geode/pull/700


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #700: GEODE-3386 - Make KeyedErrorResponse & ErrorRespons...

2017-08-14 Thread pivotal-amurmann
Github user pivotal-amurmann commented on a diff in the pull request:

https://github.com/apache/geode/pull/700#discussion_r133001811
  
--- Diff: 
geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java
 ---
@@ -79,9 +81,10 @@
   private BasicTypes.KeyedErrorResponse 
buildAndLogKeyedError(BasicTypes.Entry entry,
   ProtocolErrorCode errorCode, String message, Exception ex) {
 logger.error(message, ex);
-BasicTypes.ErrorResponse errorResponse = 
BasicTypes.ErrorResponse.newBuilder()
-.setErrorCode(errorCode.codeValue).setMessage(message).build();
-return 
BasicTypes.KeyedErrorResponse.newBuilder().setKey(entry.getKey()).setError(errorResponse)
+
+return 
BasicTypes.KeyedErrorResponse.newBuilder().setKey(entry.getKey())
+.setError(
+
BasicTypes.Error.newBuilder().setErrorCode(errorCode.codeValue).setMessage(message))
--- End diff --

yeah it did 😔
Tried to reformat it, but it insists on making this bad.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #700: GEODE-3386 - Make KeyedErrorResponse & ErrorRespons...

2017-08-14 Thread pivotal-amurmann
Github user pivotal-amurmann commented on a diff in the pull request:

https://github.com/apache/geode/pull/700#discussion_r133000153
  
--- Diff: 
geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java
 ---
@@ -59,13 +59,14 @@
   }
   return 
Success.of(RegionAPI.GetAllResponse.newBuilder().addAllEntries(entries).build());
 } catch (UnsupportedEncodingTypeException ex) {
-  return Failure.of(BasicTypes.ErrorResponse.newBuilder()
-  .setErrorCode(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue)
-  .setMessage("Encoding not supported.").build());
+  int errorCode = ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue;
+  String message = "Encoding not supported.";
+  return 
Failure.of(ProtobufResponseUtilities.makeErrorResponse(errorCode, message));
--- End diff --

good catch! The variables were supposed to be temporary to enable 
IntelliJ's refactoring.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #700: GEODE-3386 - Make KeyedErrorResponse & ErrorRespons...

2017-08-10 Thread WireBaron
Github user WireBaron commented on a diff in the pull request:

https://github.com/apache/geode/pull/700#discussion_r132591028
  
--- Diff: 
geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java
 ---
@@ -41,9 +42,8 @@
 String regionName = request.getRegionName();
 Region region = cache.getRegion(regionName);
 if (region == null) {
-  return Failure.of(BasicTypes.ErrorResponse.newBuilder()
-  
.setErrorCode(ProtocolErrorCode.REGION_NOT_FOUND.codeValue).setMessage("Region 
not found")
-  .build());
+  return Failure.of(ProtobufResponseUtilities
+  .makeErrorResponse(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, 
"Region not found"));
--- End diff --

Thank you for making this change, this has been bothering me since I added 
the error code. Sorry I didn't do this sooner.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #700: GEODE-3386 - Make KeyedErrorResponse & ErrorRespons...

2017-08-10 Thread WireBaron
Github user WireBaron commented on a diff in the pull request:

https://github.com/apache/geode/pull/700#discussion_r132591701
  
--- Diff: 
geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java
 ---
@@ -28,6 +28,8 @@
 import org.apache.geode.serialization.SerializationService;
 import 
org.apache.geode.serialization.exception.UnsupportedEncodingTypeException;
 import 
org.apache.geode.serialization.registry.exception.CodecNotRegisteredForTypeException;
+
+import com.fasterxml.jackson.databind.introspect.TypeResolutionContext;
--- End diff --

I don't see how this new import is being used?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #700: GEODE-3386 - Make KeyedErrorResponse & ErrorRespons...

2017-08-10 Thread WireBaron
Github user WireBaron commented on a diff in the pull request:

https://github.com/apache/geode/pull/700#discussion_r132591361
  
--- Diff: 
geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java
 ---
@@ -59,13 +59,14 @@
   }
   return 
Success.of(RegionAPI.GetAllResponse.newBuilder().addAllEntries(entries).build());
 } catch (UnsupportedEncodingTypeException ex) {
-  return Failure.of(BasicTypes.ErrorResponse.newBuilder()
-  .setErrorCode(ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue)
-  .setMessage("Encoding not supported.").build());
+  int errorCode = ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue;
+  String message = "Encoding not supported.";
+  return 
Failure.of(ProtobufResponseUtilities.makeErrorResponse(errorCode, message));
--- End diff --

Having a local variable for the error code and message or inlining them are 
both fine approaches, but it's a bit jarring to see both approaches used in two 
adjacent code blocks.  Please use a consistent approach.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #700: GEODE-3386 - Make KeyedErrorResponse & ErrorRespons...

2017-08-10 Thread WireBaron
Github user WireBaron commented on a diff in the pull request:

https://github.com/apache/geode/pull/700#discussion_r132591888
  
--- Diff: 
geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java
 ---
@@ -79,9 +81,10 @@
   private BasicTypes.KeyedErrorResponse 
buildAndLogKeyedError(BasicTypes.Entry entry,
   ProtocolErrorCode errorCode, String message, Exception ex) {
 logger.error(message, ex);
-BasicTypes.ErrorResponse errorResponse = 
BasicTypes.ErrorResponse.newBuilder()
-.setErrorCode(errorCode.codeValue).setMessage(message).build();
-return 
BasicTypes.KeyedErrorResponse.newBuilder().setKey(entry.getKey()).setError(errorResponse)
+
+return 
BasicTypes.KeyedErrorResponse.newBuilder().setKey(entry.getKey())
+.setError(
+
BasicTypes.Error.newBuilder().setErrorCode(errorCode.codeValue).setMessage(message))
--- End diff --

Ugh...is this how spotless formatted this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #700: GEODE-3386 - Make KeyedErrorResponse & ErrorRespons...

2017-08-09 Thread pivotal-amurmann
GitHub user pivotal-amurmann opened a pull request:

https://github.com/apache/geode/pull/700

GEODE-3386 - Make KeyedErrorResponse & ErrorResponse siblings

Thank you for submitting a contribution to Apache Geode.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced in 
the commit message?

- [x] Has your PR been rebased against the latest commit within the target 
branch (typically `develop`)?

- [x] Is your initial contribution a single, squashed commit?

- [ ] Does `gradlew build` run cleanly?

- [x] Have you written or updated unit tests to verify your changes?

- [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
N/A

### Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and
submit an update to your PR as soon as possible. If you need help, please 
send an
email to dev@geode.apache.org.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/pivotal-amurmann/geode feature/GEODE-3386

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/geode/pull/700.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #700


commit 81d7a34ef695738c61bf3d288b9ff01f054c30f5
Author: Alexander Murmann 
Date:   2017-08-09T18:52:17Z

GEODE-3386 - Make KeyedErrorResponse & ErrorResponse siblings




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---