runtimeexception

Groovy ConfigSlurper gives Class file too large RuntimeException

人盡茶涼 提交于 2019-12-10 17:16:32
问题 I am using the Groovy ConfigSlurper to load a large groovy file (741KB) from a Groovy script and consistently receive a RuntimeException when it tries to do the compilation. Groovy 2.1.1, Java 1.6 (Apple/MacOSX) I call it like so: conf = new ConfigSlurper().parse(new File('conf.groovy').toURL()) And always get the exception below. Is there a known limitation to the size of a file ConfigSlurper can compile? org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General

Android: Activity not registered in the manifest

余生颓废 提交于 2019-12-10 15:13:00
问题 <uses-sdk android:minSdkVersion="7" /> <application android:description="@string/app_description" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Light" > <activity android:name="com.xyz.Main.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> And the Lint-tool tells me that

Android unable to start activity, error inflating class?

女生的网名这么多〃 提交于 2019-12-10 14:46:55
问题 I'm new to android. I have some java knowledge, and I'm using Eclipse. At the moment I'm trying to display a map within a tab, and am looking at tutorials/code to help me. :) I've seen a few questions asking about this error, but I can't figure out what I'm doing wrong, still. I'm using code from here: http://vkroz.wordpress.com/2009/07/03/programming-android-%E2%80%93-map-view-within-tab-view/ Am I just missing something obvious? The value of the runtime exception e: java.lang

What causes “RuntimeException: Binary XML file line #20: You must supply a layout_height attribute.” (ActionBarScherlock is suspected)?

若如初见. 提交于 2019-12-10 14:43:44
问题 I have app with ActionBarScherlock and I use ACRA. I receive crash reports from some users with following error: "java.lang.RuntimeException: Binary XML file line #20: You must supply a layout_height attribute. at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491) at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3602) at android.view.ViewGroup$LayoutParams.<init>(ViewGroup.java:3554) at android.widget.AbsListView$LayoutParams.<init>(AbsListView.java

Is it correct behaviour that `lazy val` acts like `def` in case of exception?

半腔热情 提交于 2019-12-10 12:38:01
问题 I've noticed that lazy val repeats computation several times (in case of exception): scala> lazy val aaa = {println("calc"); sys.error("aaaa")} aaa: Nothing = <lazy> scala> aaa calc java.lang.RuntimeException: aaaa at scala.sys.package$.error(package.scala:27) at .aaa$lzycompute(<console>:7) at .aaa(<console>:7) ... 33 elided scala> aaa calc java.lang.RuntimeException: aaaa at scala.sys.package$.error(package.scala:27) at .aaa$lzycompute(<console>:7) at .aaa(<console>:7) ... 33 elided Shouldn

Reading text file and skipping blank lines until EOF is reached

无人久伴 提交于 2019-12-10 10:37:46
问题 I am trying to read csv file full of text; however if there is a blank line in the middle somewhere, the whole thing breaks and I get a: java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException How would I go about removing/ignoring blank lines as long as it's not the end of the file? file = new FileReader(fileName); @SuppressWarnings("resource") BufferedReader reader = new BufferedReader(file); while ((line = reader.readLine()) != null) { //do lots of stuff to sort the data into

Is it bad practice to catch RuntimeException for logging purposes?

雨燕双飞 提交于 2019-12-09 18:11:35
问题 I've come across the fact that catching RuntimeException is generally considered bad practice because they can't be corrected and usually are programmer errors. However, we have an (insanely) large application where changes in any part can have unforeseen consequences (Yes, this a problem in and of itself) . Now the idea has come up to start catching and logging RuntimeExceptions at the application's top level so we can be more efficient in fixing such bleed issues as they come up. Like every

Sending object as Parcel (with file descriptors) through intent causes exception

冷暖自知 提交于 2019-12-09 12:54:45
问题 I am trying to send an array of StatusBarNotifications to another service of mine so I have done this: Service that extends NotificationListenerService : @Override public void onNotificationPosted(StatusBarNotification sbn) { // TODO Auto-generated method stub StatusBarNotification[] activeN = super.getActiveNotifications(); Intent i = new Intent(this, CoreTwo.class); i.putExtra("activenotifications", activeN); startService(i); } But I get a RuntimeException concerning file descriptors. I

How to throw RuntimeException (“cannot find symbol”)

心不动则不痛 提交于 2019-12-09 07:31:11
问题 I'm trying to throw an exception in my code like this: throw RuntimeException(msg); But when I build in NetBeans I get this error: C:\....java:50: cannot find symbol symbol : method RuntimeException(java.lang.String) location: class ... throw RuntimeException(msg); 1 error Do I need to import something? Am I misspelling it? I'm sure I must be doing something dumb :-( 回答1: throw new RuntimeException(msg); You need the new in there. It's creating an instance and throwing it, not calling a

How to map RuntimeExceptions in Java streams to “recover” from invalid stream elements

家住魔仙堡 提交于 2019-12-08 23:32:39
问题 Imagine I'm building a library, that will receive a Stream of Integers, and all the library code needs to do is return a stream of Strings with the string representation of the number. public Stream<String> convertToString(Stream<Integer> input) { return input.map(n -> String.valueOf(n)); } However, imagine someone decides to invoke my function with the following code: Stream<Integer> input = Stream.of(1,2,3) .map(n -> { if (n %3 ) { throw new RuntimeException("3s are not welcome here!"); }