[BAEL-2073] Java 9 Migration Issues and Resolution

This commit is contained in:
macroscopic64 2019-04-03 00:04:39 +05:30
parent 74624d8cc7
commit b6bf4415a2
2 changed files with 18 additions and 22 deletions

View File

@ -16,7 +16,7 @@ import sun.reflect.Reflection;
public class App { public class App {
private static final Logger logger = LoggerFactory.getLogger(App.class); private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
@ -28,28 +28,26 @@ public class App {
private static void getCrytpographyProviderName() { private static void getCrytpographyProviderName() {
try { try {
logger.info("1. Java Cryptography Extension - Provider Name: " + new SunJCE().getName() + "\n"); LOGGER.info("1. JCE Provider Name: {}\n", new SunJCE().getName());
} catch (Throwable e) { } catch (Throwable e) {
logger.error(e.toString()); LOGGER.error(e.toString());
} }
} }
private static void getCallStackClassNames() { private static void getCallStackClassNames() {
try { try {
int i = 0;
StringBuffer sbStack = new StringBuffer(); StringBuffer sbStack = new StringBuffer();
while (true) { int i = 0;
Class<?> caller = Reflection.getCallerClass(i++); Class<?> caller = Reflection.getCallerClass(i++);
if (caller == null) { do {
break; sbStack.append(i + ".")
} else { .append(caller.getName())
sbStack.append(caller.getName()) .append("\n");
.append("\n"); caller = Reflection.getCallerClass(i++);
} } while (caller != null);
} LOGGER.info("2. Call Stack:\n{}", sbStack);
logger.info("2. Call Stack Class Names:\n" + sbStack.toString());
} catch (Throwable e) { } catch (Throwable e) {
logger.error(e.toString()); LOGGER.error(e.toString());
} }
} }
@ -61,9 +59,9 @@ public class App {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
marshallerObj.marshal(book, sw); marshallerObj.marshal(book, sw);
logger.info("3. Xml for Book object:\n" + sw); LOGGER.info("3. Xml for Book object:\n{}", sw);
} catch (Throwable e) { } catch (Throwable e) {
logger.error(e.toString()); LOGGER.error(e.toString());
} }
} }
@ -71,9 +69,9 @@ public class App {
private static void getBase64EncodedString(String inputString) { private static void getBase64EncodedString(String inputString) {
try { try {
String encodedString = new BASE64Encoder().encode(inputString.getBytes()); String encodedString = new BASE64Encoder().encode(inputString.getBytes());
logger.info("4. Base Encoded String: " + encodedString); LOGGER.info("4. Base Encoded String: {}", encodedString);
} catch (Throwable e) { } catch (Throwable e) {
logger.error(e.toString()); LOGGER.error(e.toString());
} }
} }
} }

View File

@ -10,9 +10,8 @@ public class Book {
private String name; private String name;
public Book() { public Book() {
} }
public Book(long id, String name) { public Book(long id, String name) {
this.id = id; this.id = id;
this.name = name; this.name = name;
@ -35,5 +34,4 @@ public class Book {
public Long getId() { public Long getId() {
return id; return id;
} }
} }