Ron McLeod

Saloon Keeper
+ Follow
since Feb 12, 2013
Ron likes ...
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
Richmond, BC, Canada
Cows and Likes
Cows
Total received
238
In last 30 days
2
Total given
79
Likes
Total received
481
Received in last 30 days
17
Total given
681
Given in last 30 days
16
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ron McLeod


I have created a custom ExceptionHandler for EclipseLink, and after configuring persistence.xml with <property name="eclipselink.exception-handler" value="my.CustomPersistenceException" />, my handler gets called rather than the default handler.

I understand that after performing some processing/logging my handler can re-throw the exception, throw a different exception, or just silently eat the exception.

What's not clear to me, is the handleException method returns a java.lang.Object - what should/can this be, and where is it used?

German Gonzalez-Morris wrote:ResourceConfig FEATURE_DISABLE_WADL "com.sun.jersey.config.feature.DisableWADL"


I have tried "com.sun.jersey.config.feature.DisableWADL" and "com.sun.jersey.config.server.wadl.DisableWADL" - neither disables WADL generation.

Jersey does seem to understand ServerProperties.WADL_FEATURE_DISABLE, but this results in a UnsatisfiedDependencyException being thrown when used with WebLogic 12.2.1.3.0 (not sure about other versions).

I'll try to provide a custom WadlGenerator which returns nothing.
4 days ago

Rob Spoor wrote:Unlike in JavaScript objects, in JSON properties must be enclosed in "" as well. {name: "Maria"} is not valid JSON; {"name": "Maria"} is.


Thanks for pointing that out.
Here's a simple example:

AhFai Chan wrote:JSON parsing error: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]


It looks like the JSON representation has problems - if it an object, it should be enclosed in { }.

Where is the JSON string data coming from?  Can you post what it looks like here?
You are missing an HTTP Accept header specifying the type of content you want, and the site is returning you XML:

If you adding Accept: application/json, you will get:
1 week ago
This doesn't look right - since you have Show Image inside the angle brackets, it is understood to be attributes:
Should be like this:

Rohan Kesharwani wrote:org.apache.jasper.JasperException: /register.jsp (line: [60], column: [20]) quote symbol expected


The value for items should be quoted.
1 week ago
JSP
You are on  the right track by creating an ObjectInputStream to deserialize your saved data, but you never actually do anything with it. You will want to:
    - read an object from the stream
    - verify that the object is a FacebookUser type
    - add the user to the list

Also, loading stored users should be separated from displaying the users list.  You don't want to keep adding the saved users to your list each time it is displayed.

For example:FacebookUser and UserAccount need to implement Serializable, Facebook doesn't.

I would also rename the quit method to something like saveUsers, since that is what it is actually doing.

Finally, write a simple program to unit test your implementation outside of the full application.  For example:

1 week ago

kennith stomps wrote:... Once the program runs again, and I select list users method, the program is to then create an objectInputStream, at which time it reads the arrayList to the console from the facebookUser.dat file


I don't see anywhere in the code that the input stream is being read; also nothing being added to the ArrayList of users.
I reformatted the code to make it easier to read
1 week ago

kennith stomps wrote:I have updated the listUsers method, however it is still not functioning properly after I close the program and re open, no users are listed.


Can you explain how storing and retrieving user data works in your application?
1 week ago
Take a look at the approach in this post.  It uses HMAC-based authentication based on a shared secret and the request's metadata/contents.  The HMAC will be different with each request, and by using time as one of the factors, cannot be replayed (outside of the server's grace period).
1 week ago

Matt Wong wrote:Even it might be true on "normal" jdbc4 drivers - it wouldnt return the driver he wants.
In standard mysql connector only com.mysql.jdbc.Driver gets autoloaded - but he wants another driver located in com.mysql.cj.jdbc.Driver wich seems to be another driver and therefor needs explicit loading.


It all depends on the library being used.  For example, using mysql-connector-java-8.0.11.jar, com.mysql.cj.jdbc.Driver is automatically registered/loaded via the SPI.
Result:
1 week ago