illegalargumentexception

Google preconditions illegal Argument exception

本小妞迷上赌 提交于 2019-12-11 11:12:16
问题 I am using mahout to create a basic recommender for may application. my data set does not have any preferences. here's how my table looks like Here's how set up mahout MySQLJDBCDataModel jdbcModel2 = new MySQLJDBCDataModel(dataSource,"user_viewed_song_statistics", "AUDIO_FK","USER_PROFILE_FK","AUDIO_FK","UVSS_DATE_CREATED"); ItemSimilarity similarity = new LogLikelihoodSimilarity(jdbcModel2); Recommender recommender = new GenericBooleanPrefItemBasedRecommender(jdbcModel2, similarity); for

Pros and cons of forbidding an empty string argument and throwing a RuntimeException in order to prevent the method from proceeding

不羁的心 提交于 2019-12-11 05:29:41
问题 Say I have the following method definition in a Spring service layer : @Override public boolean passwordsMatch(String encrypted, String plain) { if (encrypted == null || encrypted.isEmpty() || plain == null || plain.isEmpty()) { throw new IllegalArgumentException("One argument is null or empty"); } return passwordEncoder.matches(plain, encrypted); } It is called by a Spring MVC application controller that wants to check whether the new password provided by a user (here called "plain") matches

JMock matchers with setAttribute(String, Object)

折月煮酒 提交于 2019-12-11 05:14:09
问题 I am facing issue while expecting a setAttribute call from a mock. MyClass { public final void setAttribute(String name, Object value) { // Do Something } myClass.setAttribute("Key", "Value"); While invoking the setAttribute operation, String is passed as a value. I have a mock of the above class by the name mockMyClass and in my Expectations block I have the below code. oneOf(mockMyClass).setAttribute(with(equal("Key")), with(equal("Value"))); I have also tried using any, just to see if the

JAVA EE Stateless EJB IllegalArgumentException: Can not set field

时光总嘲笑我的痴心妄想 提交于 2019-12-11 03:45:33
问题 I'm heaving some trouble while learning ejb. All I want is write a simple app operatign on database. Here's my code: Servlet - Main.java package main; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name = "Main",

IllegalArgumentException Base64 to image decoding android

拈花ヽ惹草 提交于 2019-12-11 01:48:52
问题 I want to decode an image from webservice which is in base64 to the bitmap and use it in my android app. This is my method: public Bitmap getCaptcha() throws IOException { List<NameValuePair> params = new ArrayList<NameValuePair>(); String json = jsonParser.getCaptcha(captchaURL, params); Log.i("", json); byte [] encodeByte=Base64.decode(json.getBytes(),Base64.DEFAULT); Bitmap bitmap=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length); return bitmap; } If I decode the string which

IllegalArgumentException caught when parsing URL with JSON String

瘦欲@ 提交于 2019-12-10 21:33:03
问题 I need to formulate a url with JSON data that will look something like http://someurl.com/passfail?parameter={"data1":"123456789","data2":"123456789"}, and I will need to pass it using JBoss's ClientResponse to get a response status. I first tried passing in the literal String data in ClientRequest clientrequest = new ClientRequest("http://someurl.com/passfail?parameter={\"data1\":\"123456789\",\"data2\":\"123456789\"});// assuming the "\" is formulated correctly but it gives an exception.

Error : java.lang.IllegalArgumentException: Extra samples are not supported

折月煮酒 提交于 2019-12-10 19:07:19
问题 If I execute this method tiff = TiffImage.getTiffImage(rafa,i,false); Then it's through the below exception. Can anyone give me any solution for this exception? Exception Stack Trace: java.lang.IllegalArgumentException: Extra samples are not supported. at com.lowagie.text.pdf.codec.TiffImage.getTiffImageColor(Unknown Source) at com.lowagie.text.pdf.codec.TiffImage.getTiffImage 回答1: If you're using com.lowagie , you must be using version 2.1.7 or earlier (thanks Amedee Van Gasse). iText didn't

Should I throw IllegalArgmentException when 'user of given id not exist'?

随声附和 提交于 2019-12-10 18:56:38
问题 Say we have a method changeUserName(Long id,String newName) which invokes the repository's findUser(Long id) to find the right user entity and then change its name. Is it appropriate to thow an IllegalArgmentException when findUser returns null ? Or should I instead throw a custom UserNotExistException (extends AppException extends RuntimeException) ? UPDATE: RuntimeException : @nachokk @JunedAhsan Actually I deliberately make all the exceptions unchecked , because I think this way makes

IllegalArgumentException from gluUnProject

怎甘沉沦 提交于 2019-12-10 17:42:20
问题 I get this error message 08-30 19:20:17.774: ERROR/AndroidRuntime(4681): FATAL EXCEPTION: GLThread 9 08-30 19:20:17.774: ERROR/AndroidRuntime(4681): java.lang.IllegalArgumentException: length - offset < n 08-30 19:20:17.774: ERROR/AndroidRuntime(4681): at android.opengl.Matrix.multiplyMV(Native Method) 08-30 19:20:17.774: ERROR/AndroidRuntime(4681): at android.opengl.GLU.gluUnProject(GLU.java:237) 08-30 19:20:17.774: ERROR/AndroidRuntime(4681): at android.app.ui.GLSurfaceRenderer.vector3

Unable to destroy activity: java.lang.IllegalArgumentException: No view found for id () for fragment

风流意气都作罢 提交于 2019-12-10 17:11:32
问题 I have an activity YYYY (which inflates a fragment) that extends a base activity XXXX which in turn extends ActionBarActivity . I now call finish() in onCreate() method of XXXX (at the very top), based on some condition. But I get the exception below. Kindly help me out. PS: I call return; after the finish(); so that the rest of the onCreate() is not executed. 07-26 16:46:26.902 14569-14569/E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to destroy activity