exception

UpdateException: Operation is not valid due to the current state of the object when using Entity Framework and Oracle

回眸只為那壹抹淺笑 提交于 2019-12-24 01:19:26
问题 I'm attempting to add a new Entity object for persistence, however I'm getting an UpdateException who's inner exception is an InvalidOperationException with the message: Operation is not valid due to the current state of the object. Object being created: var something = new SITE { EntityKey = new EntityKey("DataModelContainer.SITE", "SITE_ID", "ID"), SITE_COMMON_REFERENCE = "hello", SITE_ID = "hello" }; which is then passed to: public void ExportSiteData (SITE exportSiteData) { _context.SITE

Array index out of bound exception java

旧时模样 提交于 2019-12-24 01:15:37
问题 The following code throws array index out of bound exception. I have initialized a size of 1000 yet not fully utilized. What exactly are the values of unused indices? byte[] buffer=new byte[1000]; String s="i am a stupid"; buffer=s.getBytes(); System.out.println(buffer[30]); 回答1: When you call the String#getBytes method you get a new array, initialized with the length equals to the number of bytes needed to represent the string. Due to Java docs: Encodes this String into a sequence of bytes

'NSInvalidArgumentException' : attempt to scroll to invalid index path

自作多情 提交于 2019-12-24 01:15:16
问题 This is my code for animating the CollectionViewCustomCells. -(void)viewDidAppear:(BOOL)animated{ rowIndex = 0; [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(targetMethod) userInfo:nil repeats:YES]; } -(void)targetMethod { [self.offerCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:rowIndex inSection:1] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES]; rowIndex=(rowIndex<parserDataContentArrayForExhibitor.count

Scope(failure) in C++11?

被刻印的时光 ゝ 提交于 2019-12-24 01:12:36
问题 I wrote a very simple solution however someone laughed and found a flaw as shown here http://ideone.com/IcWMEf #include <iostream> #include <ostream> #include <functional> #include <exception> using namespace std; // Wrong scope(failure) class FailBlockT { typedef function<void()> T; public: T t; FailBlockT(T t) { this->t=t; } ~FailBlockT() { if (std::uncaught_exception()) { t(); } } }; struct Test { ~Test() { try { FailBlockT f([]() { cout << "failure" << endl; }); // there is no any

Why do I get “A Java Exception has occurred” after I export my application to Jar?

為{幸葍}努か 提交于 2019-12-24 01:11:34
问题 Well, I exported my application into JAR with eclipse, but now whenever I try running it I get the: "A Java Exception has occurred". When I try to run it through command line it says: C:\Users\Arturas>java -jar D:\Dropbox\EclipseWorkspace\Exports\Dantracio_skaiciu oklis3.jar Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widge ts/Composite at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang

Hibernate “ManyToOne … references an unknown entity” exception

China☆狼群 提交于 2019-12-24 01:04:01
问题 I just cannot get the relationship working between my two classes mapped to SQL tables with Hibernate. The Role class: @Entity @Table(name = "role") public class Role { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="id") private int id; @Column(name="name") private String name; @OneToMany(mappedBy="memberinfo") private Set<Memberinfo> members; ... } And the Memberinfo class: @Entity @Table(name = "memberinfo") public class Memberinfo { @Id @GeneratedValue(strategy =

How to clear out the contents of a map when clear() method call throws UnsupportedOperationException?

二次信任 提交于 2019-12-24 01:00:00
问题 How can I empty a map contents if I keep getting an UnsupportedOperationException when I call clear() method on the map instance ? 回答1: You shouldn't. There is something wrong in the contracts of the collaborating objects and their methods. You expect a modifiable map, but get an unmodifiable view. You should redefine the contracts and/or adopt any of the implementations accordingly. If you are not in control of the one, who is passing you that map, then there is probably a reason for it

JavaFX Chart - Java.lang.IllegalArgumentException : Duplicate series added

混江龙づ霸主 提交于 2019-12-24 00:57:43
问题 I'm using clear() method for removing data from chart. @FXML public void restartButtonClicked() { System.out.println("Restarting..."); timeLine.getKeyFrames().clear(); axesTest.getData().clear(); } In this function, but once button get clicked - it works.. but second time while I am gonna click it, it throw exception : Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Duplicate series added at javafx.scene.chart.XYChart.lambda$new$550(Unknown Source) at com

sl4j error in weblogic when deploying grails application war

帅比萌擦擦* 提交于 2019-12-24 00:46:19
问题 I create a WAR for my grails application and when I deploy it in Weblogic 12c server I get the following Exception <Mar 27, 2012 12:38:55 PM PDT> <Warning> <HTTP> <BEA-101162> <User defined listener org.codehaus.groovy.grails.web.context.GrailsC ontextLoaderListener failed: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/Strin g;ILjava/lang/String;Ljava/lang/Throwable;)V. java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg

UncaughtExceptionHandler not catching some exceptions

浪尽此生 提交于 2019-12-24 00:44:08
问题 I have created an UncaughtExceptionHandler as shown in this article. I have also registered this handler to catch exceptions in all threads like this: Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler()); However, it is missing some exceptions: Exception occurred during event dispatching: java.lang.RuntimeException: Critical error! at com.acme.MyClass.myMethod(MyClass.java:46) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue