Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit ff5133d

Browse files
committed
Merge pull request #53 from jateeter/master
Printf Statements in AuthorizationController to chase down deployment
2 parents 50ed0d5 + 6224e75 commit ff5133d

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/main/java/org/energyos/espi/thirdparty/web/AuthorizationController.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,39 +88,54 @@ public String authorization(String code, String state, ModelMap model, Principal
8888
ClientRestTemplate restTemplate = templateFactory.newClientRestTemplate(applicationInformation.getClientId(), applicationInformation.getClientSecret());
8989

9090
// Process /oauth/token Endpoint response
91+
System.out.printf("*1*||");
9192
AccessToken token = restTemplate.getForObject(url, AccessToken.class);
92-
authorization.setAccessToken(token.getAccessToken());
93+
System.out.printf("*2*||");
94+
authorization.setAccessToken(token.getAccessToken());
95+
System.out.printf("*3*||");
9396
authorization.setTokenType(token.getTokenType());
97+
System.out.printf("*4*||");
9498
authorization.setExpiresIn(token.getExpiresIn());
99+
System.out.printf("*5*||");
95100
authorization.setRefreshToken(token.getRefreshToken());
101+
System.out.printf("*6*||");
96102
authorization.setScope(token.getScope());
103+
System.out.printf("*7*||");
97104
authorization.setAuthorizationURI(token.getAuthorizationURI());
105+
System.out.printf("*8*||");
98106
authorization.setResourceURI(token.getResourceURI());
99-
authorization.setUpdated(new GregorianCalendar());
107+
System.out.printf("*9*||");
108+
authorization.setUpdated(new GregorianCalendar());
109+
System.out.printf("*10*||");
100110
authorization.setStatus("1"); // Set authorization record status as "Active"
101-
authorization.setState(null); // Clear State as a security measure
111+
System.out.printf("*11*||");
112+
authorization.setState(null); // Clear State as a security measure
113+
System.out.printf("*12*||");
102114

103115
// Update authorization record with /oauth/token response data
104116
authorizationService.merge(authorization);
105-
117+
System.out.printf("*13*||");
106118
// now do the initial import of the Authorized Resouce, if it is
107119
// not ready, then we will wait till we receive a Notify or the UX call for it.
108120
// TODO: create a Subscription to work with if needed
109121
//
110122
RetailCustomer currentCustomer = currentCustomer(principal);
123+
System.out.printf("*14*||");
111124
try {
112125
usagePointRESTRepository.findAllByRetailCustomerId(currentCustomer.getId());
126+
System.out.printf("*15*\n");
113127
} catch (JAXBException e) {
114128
// nothing there, so log the fact and move on. It will
115129
// get imported later.
116-
System.out.printf("ThirdParty Import Exception: %s\n", e.toString());
130+
System.out.printf("\nThirdParty Import Exception: %s\n", e.toString());
117131
e.printStackTrace();
118132
}
119133
} catch (HttpClientErrorException x) {
120134

121135
//TODO: Extract error, error_description and error_uri from JSON response. Currently recording null for all three fields.
122136

123-
// Update authorization record
137+
// Update authorization record
138+
System.out.printf("\nHTTPClientException: %s\n", x.toString());
124139
authorization.setError(error);
125140
authorization.setErrorDescription(error_description);
126141
authorization.setErrorUri(error_uri);
@@ -135,6 +150,7 @@ public String authorization(String code, String state, ModelMap model, Principal
135150
}
136151
else {
137152

153+
System.out.printf("Code == null\n");
138154
// Update authorization record with error response
139155
authorization.setError(error);
140156
authorization.setErrorDescription(error_description);

0 commit comments

Comments
 (0)