public JdoUsageException(JDOUserException ex) { super(ex.getMessage(), ex); }
public JdoUsageException(JDOUserException ex) { super(ex.getMessage(), ex); }
@Test public void testParsing17() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //This wrongly recognized 'null' as null Query q = pm.newQuery(TestClass.class, "_ref2 == 'null'"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("ncompatible types")); } }
@Test public void testParsing14() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "\"_isEmpty\">_bool"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("annot compare")); } }
@Test public void testParsing16() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "0>=0b9"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("parsing number")); } }
@Test public void testParsing4() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "this"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("nexpected end")); } }
@Test public void testParsing11() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, ":_long0x!=_bool"); q.execute(0); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("ncomparable types")); } }
@Test public void testParsing5() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "d<=::0!& .contains("); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("parsing error")); } }
@Test public void testParsing8() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "0!=::|~!="); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("arsing error")); } }
@Test public void testParsing12() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, ":my_str.substring(1,3)=='xx'"); q.execute("Hello"); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("ate binding")); } }
@Test public void testParsing18() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //This wrongly compiled Query q = pm.newQuery(TestClass.class, "_ref2 > _ref1"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("llegal operator")); } } }
@Test public void testParsing2() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "!=.isEmpty,this,9or0contains Lcontains<= &(and.contains("); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage(), e.getMessage().contains("omparator expected")); } }
@Override protected void closingConnection() { // Connection is being closed so last chance to grab any results not yet loaded if (loadResultsAtCommit && isOpen()) { if (hasError) { NucleusLogger.QUERY.info("Skipping resolution of remaining results due to earlier error."); } else { try { // If we are still open, force consumption of the rest of the results lazyResult.resolveAll(); // TODO Get rid of this selective exception swallowing. Makes no sense } catch (NucleusUserException jpue) { // Log any exception - can get exceptions when maybe the user has specified an invalid result class etc NucleusLogger.QUERY.warn("Exception thrown while loading remaining rows of query : " + jpue.getMessage()); } catch (JDOUserException ue) { // Log any exception - can get exceptions when maybe the user has specified an invalid result class etc NucleusLogger.QUERY.warn("Exception thrown while loading remaining rows of query : " + ue.getMessage()); } } // Cache the query results (if required) cacheQueryResults(); } }
@Test public void testParsing10() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "_bool<=0"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage().contains("annot compare")); } }
@Test public void testParsing9() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "_float<=_bool"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage().contains("annot compare")); } }
@Test public void testParsing7() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "containsand!='get&0x^;f<=! isEmpty>this'"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage().contains("arsing error")); } }
@Test public void testParsing1() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "<=<dcontains0or.'"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage().contains("unexpected end")); } }
@Test public void testParsing3() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); try { //this was found by the fuzzying tool Query q = pm.newQuery(TestClass.class, "0bd00xLget|0b1this<=.(or\\"); q.execute(); fail(); } catch (JDOUserException e) { //good assertTrue(e.getMessage().contains("Cannot parse query")); } }
@Test public void testSchemaCreationWithEmptyArray_Deletion() { PersistenceManager pm = TestTools.openPM(props); pm.currentTransaction().begin(); pm.makePersistent(new TestClassWithArray()); pm.currentTransaction().commit(); pm.currentTransaction().begin(); ZooSchema schema = ZooJdoHelper.schema(pm); assertNotNull(schema.getClass(TestClassWithArray.class.getName())); assertNotNull(schema.getClass(TestClassInArray.class.getName())); schema.getClass(TestClassInArray.class).remove(); try { pm.currentTransaction().commit(); fail(); } catch (JDOUserException e) { assertTrue(e.getMessage().contains("Schema error")); } TestTools.closePM(); }
@Test public void testImplicitParameterErrors() { PersistenceManager pm = TestTools.openPM(); pm.currentTransaction().begin(); Query q = null; //implicit + explicit checkFail("Duplicate", pm, "_int == :intParam PARAMETERS int intParam"); checkFail("Duplicate", pm, "_string == :strParam parameters String strParam"); q = pm.newQuery(TestClass.class, "_string == :strParam"); try { q.declareParameters("String strParam"); q.compile(); fail(); } catch (JDOUserException e) { assertTrue(e.getMessage().contains("Duplicate")); } q = pm.newQuery(TestClass.class, "_string == :strParam"); try { q.declareParameters("String :strParam"); } catch (JDOUserException e) { //illegal parameter name } TestTools.closePM(); }