这篇文章主要围绕java.beans.PropertyVetoException的实例源码和javaerrorcreatingbean展开,旨在为您提供一份详细的参考资料。我们将全面介绍java.be
这篇文章主要围绕java.beans.PropertyVetoException的实例源码和java error creating bean展开,旨在为您提供一份详细的参考资料。我们将全面介绍java.beans.PropertyVetoException的实例源码的优缺点,解答java error creating bean的相关问题,同时也会为您带来groovy.lang.MissingPropertyException的实例源码、groovy.lang.ReadOnlyPropertyException的实例源码、io.reactivex.exceptions.OnErrorNotImplementedException的实例源码、io.reactivex.exceptions.ProtocolViolationException的实例源码的实用方法。
本文目录一览:- java.beans.PropertyVetoException的实例源码(java error creating bean)
- groovy.lang.MissingPropertyException的实例源码
- groovy.lang.ReadOnlyPropertyException的实例源码
- io.reactivex.exceptions.OnErrorNotImplementedException的实例源码
- io.reactivex.exceptions.ProtocolViolationException的实例源码
java.beans.PropertyVetoException的实例源码(java error creating bean)
@Setup public void setup() throws PropertyVetoException { dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("com.MysqL.jdbc.Driver"); dataSource.setUrl(propertyOr("jdbcUrl","jdbc:MysqL://127.0.0.1:3306?useSSL=false")); dataSource.setUsername(propertyOr("username","root")); dataSource.setPassword(propertyOr("password","root")); JdbcTemplate delegate = new JdbcTemplate(dataSource); delegate.setDataSource(dataSource); proxy = new SenderProxy(new JdbcTemplateSender(delegate)); proxy.onMessages(updated -> counter.addAndGet(updated.size())); reporter = reporter(proxy); batch = new BatchJdbcTemplate(delegate,reporter); batch.setDataSource(dataSource); unbatch = new JdbcTemplate(dataSource); unbatch.setDataSource(dataSource); unbatch.update(CREATE_DATABASE); unbatch.update(DROP_TABLE); unbatch.update(CREATE_TABLE); }
public static void prepareTest(String[] additionalLayers,Object[] additionalLookupContent) throws IOException,SAXException,PropertyVetoException { Collection<URL> allUrls = new ArrayList<URL>(); for (String u : additionalLayers) { if (u.charat(0) == '/') { u = u.substring(1); } for (Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources(u); en.hasMoreElements(); ) { allUrls.add(en.nextElement()); } } XMLFileSystem system = new XMLFileSystem(); system.setXmlUrls(allUrls.toArray(new URL[allUrls.size()])); Repository repository = new Repository(system); Object[] lookupContent = new Object[additionalLookupContent.length + 1]; System.arraycopy(additionalLookupContent,lookupContent,1,additionalLookupContent.length); lookupContent[0] = repository; setLookup(lookupContent,BaseCaretTest.class.getClassLoader()); }
public void testRenameInteriorSection() throws BadLocationException,PropertyVetoException { System.out.println("-- testRenameInteriorSection -------------"); editor.doc.insertString(0,"aaa",null); InteriorSection is1 = guards.createInteriorSection(editor.doc.createPosition(1),"is1"); assertEquals("name","is1",is1.getName()); is1.setName("isNewName"); assertTrue("valid",is1.isValid()); assertEquals("new name","isNewName",is1.getName()); // set the same name is1.setName("isNewName"); InteriorSection is2 = guards.createInteriorSection( editor.doc.createPosition(is1.getEndPosition().getoffset() + 1),"is2"); // rename to existing name try { is1.setName("is2"); fail("accepted already existing name"); } catch (PropertyVetoException ex) { assertTrue("valid",is1.isValid()); assertEquals("name",is1.getName()); } }
/** * Sets the active Window. Only a Frame or a Dialog can be the active * Window. The native windowing system may denote the active Window or its * children with special decorations,such as a highlighted title bar. The * active Window is always either the focused Window,or the first Frame or * Dialog that is an owner of the focused Window. * <p> * This method does not actually change the active Window as far as the * native windowing system is concerned. It merely stores the value to be * subsequently returned by {@code getActiveWindow()}. Use * {@code Component.requestFocus()} or * {@code Component.requestFocusInWindow()} to change the active * Window,subject to platform limitations. * * @param activeWindow the active Window * @see #getActiveWindow * @see #getGlobalActiveWindow * @see Component#requestFocus() * @see Component#requestFocusInWindow() * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context * and if the calling thread does not have "replaceKeyboardFocusManager" * permission */ protected void setGlobalActiveWindow(Window activeWindow) throws SecurityException { Window oldActiveWindow; synchronized (KeyboardFocusManager.class) { checkKFMSecurity(); oldActiveWindow = getActiveWindow(); if (focusLog.isLoggable(Platformlogger.Level.FINER)) { focusLog.finer("Setting global active window to " + activeWindow + ",old active " + oldActiveWindow); } try { fireVetoableChange("activeWindow",oldActiveWindow,activeWindow); } catch (PropertyVetoException e) { // rejected return; } KeyboardFocusManager.activeWindow = activeWindow; } firePropertyChange("activeWindow",activeWindow); }
/** * Called when selection in tree is changed. */ private void callSelectionChanged (Node[] nodes) { manager.removePropertychangelistener (wlpc); manager.removeVetoablechangelistener (wlvc); try { manager.setSelectednodes(nodes); } catch (PropertyVetoException e) { synchronizeSelectednodes(false); } finally { // to be sure not to add them twice! manager.removePropertychangelistener (wlpc); manager.removeVetoablechangelistener (wlvc); manager.addPropertychangelistener (wlpc); manager.addVetoablechangelistener (wlvc); } }
private static Component nodeBasedView(Node root) { Node root2; if (Children.MUTEX == Mutex.EVENT) { // #35833 branch. root2 = root; } else { root2 = new EQReplannednode(root); } ExpPanel p = new ExpPanel(); p.setLayout(new BorderLayout()); JComponent tree = new BeanTreeView(); p.add(tree,BorderLayout.CENTER); p.getExplorerManager().setRootContext(root2); try { p.getExplorerManager().setSelectednodes(new Node[] {root2}); } catch (PropertyVetoException pve) { pve.printstacktrace(); } Object key = "org.openide.actions.PopupAction"; Keystroke ks = Keystroke.getKeystroke("shift F10"); tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks,key); return p; }
protected JInternalFrame createInstanceImpl() { JInternalFrame frame = new JInternalFrame(title,resizable,closable,maximizable,iconable) { protected JRootPane createRootPane() { return _rootPane == null ? null : _rootPane.createInstance(); } public void addNotify() { try { // Doesn't seem to work correctly setClosed(_isClosed); setMaximum(_isMaximum); setIcon(_isIcon); setSelected(_isSelected); } catch (PropertyVetoException ex) {} } }; return frame; }
/** Initializes the root of FS. */ private void readobject(ObjectInputStream ois) throws IOException,ClassNotFoundException { //ois.defaultReadobject (); ObjectInputStream.GetField fields = ois.readFields(); URL[] urls = (URL[]) fields.get("urlsToXml",null); // NOI18N if (urls == null) { urls = new URL[1]; urls[0] = (URL) fields.get("uriId",null); // NOI18N if (urls[0] == null) { throw new IOException("missing uriId"); // NOI18N } } try { setXmlUrls(urls); } catch (PropertyVetoException ex) { IOException x = new IOException(ex.getMessage()); ExternalUtil.copyAnnotation(x,ex); throw x; } }
/** * Iconifies or de-iconifies this internal frame,* if the look and feel supports iconification. * If the internal frame's state changes to iconified,* this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event. * If the state changes to de-iconified,* an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired. * * @param b a boolean,where <code>true</code> means to iconify this internal frame and * <code>false</code> means to de-iconify it * @exception PropertyVetoException when the attempt to set the * property is vetoed by the <code>JInternalFrame</code> * * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED * * @beaninfo * bound: true * constrained: true * description: The image displayed when this internal frame is minimized. */ public void setIcon(boolean b) throws PropertyVetoException { if (isIcon == b) { return; } /* If an internal frame is being iconified before it has a parent,(e.g.,client wants it to start iconic),create the parent if possible so that we can place the icon in its proper place on the desktop. I am not sure the call to validate() is necessary,since we are not going to display this frame yet */ firePropertyChange("ancestor",null,getParent()); Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE; Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE; fireVetoableChange(IS_ICON_PROPERTY,oldValue,newValue); isIcon = b; firePropertyChange(IS_ICON_PROPERTY,newValue); if (b) fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED); else fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED); }
/** * Creates new form TelaInicial */ public TelaInicial() throws PropertyVetoException,IOException { initComponents(); this.setLocationRelativeto(null); jDesktopPane3.add(obj); obj.setMaximizable(true); obj.setMaximum(true); obj.setVisible(true); getContentPane().setBackground(Color.WHITE); File file = new File("CADASTradOS.txt"); if(!file.exists()){ file.createNewFile();// Todo code application logic here } File dir = new File("CadastroRemedios"); if(!dir.exists()){ dir.mkdir(); } //this.setExtendedState(MAXIMIZED_BOTH); //jDesktopPane3.setExtendedState(MAXIMIZED_BOTH); //obj.setLocation(jDesktopPane3.getSize().width/2 - obj.getSize().width/2,jDesktopPane3.getSize().height/2 - obj.getSize().height/2); }
private static void expandAllNodes(BeanTreeView btv,Node node,ExplorerManager mgr,AndroidSdk platform) { btv.expandNode(node); Children ch = node.getChildren(); if (ch == Children.LEAF) { if (platform != null && platform.equals(node.getLookup().lookup(AndroidSdk.class))) { try { mgr.setSelectednodes(new Node[]{node}); } catch (PropertyVetoException e) { //Ignore it } } return; } Node nodes[] = ch.getNodes(true); for (int i = 0; i < nodes.length; i++) { expandAllNodes(btv,nodes[i],mgr,platform); } }
public static void main(String[] args) throws PropertyVetoException,sqlException,InterruptedException { //DataSourceFactory factory = new C3P0DataSourceFactory(); //DataSourceFactory factory = new DBCPDataSourceFactory(); DataSourceFactory factory = new HikariCPDataSourceFactory(); Connection connection = factory.get().getConnection(); System.out.println("DatabaseProductName: " + connection.getMetaData().getDatabaseProductName()); Connection connection2 = factory.get().getConnection(); System.out.println("DriverName: " + connection2.getMetaData().getDriverName()); Connection connection3 = factory.get().getConnection(); System.out.println("URL: " + connection3.getMetaData().getURL()); hold(); }
/** Initializes the root of FS. */ private void readobject(ObjectInputStream ois) throws IOException,ClassNotFoundException { ois.defaultReadobject(); closeSync = new Object(); strongCache = null; softCache = new SoftReference<Cache>(null); aliveCount = 0; try { setJarFile(root); } catch (PropertyVetoException ex) { throw new IOException(ex.getMessage()); } catch (IOException iex) { ExternalUtil.log(iex.getLocalizedMessage()); } }
public void testPlusInName() throws IOException,PropertyVetoException { clearworkdir(); File plus = new File(getworkdir(),"plus+plus"); plus.createNewFile(); LocalFileSystem lfs = new LocalFileSystem(); lfs.setRootDirectory(getworkdir()); Repository.getDefault().addFileSystem(lfs); URL uPlus = BaseUtilities.toURI(plus).toURL(); FileObject fo = URLMapper.findFileObject(uPlus); assertNotNull("File object found",fo); assertEquals("plus+plus",fo.getNameExt()); URL back = URLMapper.findURL(fo,URLMapper.EXTERNAL); assertTrue("plus+plus is there",back.getPath().endsWith("plus+plus")); }
public mineC3P0DataSource(boolean autoregister) { super(autoregister); this.dmds = new DriverManagerDataSource(); this.wcpds = new WrapperConnectionPoolDataSource(); this.wcpds.setnestedDataSource(this.dmds); try { this.setConnectionPoolDataSource(this.wcpds); } catch (PropertyVetoException var3) { logger.log(MLevel.WARNING,"Hunh??? This can\'t happen. We haven\'t set up any listeners to veto the property change yet!",var3); throw new RuntimeException("Hunh??? This can\'t happen. We haven\'t set up any listeners to veto the property change yet! " + var3); } this.setUpPropertyEvents(); }
private void performJdbcTests() throws Exception { // Get a JDBC connection try (Connection connection = createConnection()) { connection.setAutoCommit(false); // Test connection pooling ConnectionPoolingTester poolingTester = new ConnectionPoolingTester(); poolingTester.testPooling((CloudSpannerConnection) connection); // Test Table DDL statements TableDDLTester tableDDLTester = new TableDDLTester(connection); tableDDLTester.runcreateTests(); // Test DML statements DMLTester dmlTester = new DMLTester(connection); dmlTester.runDMLTests(); // Test Meta data functions MetaDataTester MetaDataTester = new MetaDataTester(connection); MetaDataTester.runMetaDataTests(); // Test transaction functions TransactionTester txTester = new TransactionTester(connection); txTester.runTransactionTests(); // Test select statements SelectStatementsTester selectTester = new SelectStatementsTester(connection); selectTester.runSelectTests(); // Test XA transactions XATester xaTester = new XATester(); xaTester.testXA(projectId,instanceId,DATABASE_ID,credentialsPath); // Test drop statements tableDDLTester.runDropTests(); } catch (sqlException | PropertyVetoException e) { log.log(Level.WARNING,"Error during JDBC tests",e); throw e; } }
/** * Sets the focused Window. The focused Window is the Window that is or * contains the focus owner. The operation will be cancelled if the * specified Window to focus is not a focusable Window. * <p> * This method does not actually change the focused Window as far as the * native windowing system is concerned. It merely stores the value to be * subsequently returned by <code>getFocusedWindow()</code>. Use * <code>Component.requestFocus()</code> or * <code>Component.requestFocusInWindow()</code> to change the focused * Window,subject to platform limitations. * * @param focusedWindow the focused Window * @see #getFocusedWindow * @see #getGlobalFocusedWindow * @see Component#requestFocus() * @see Component#requestFocusInWindow() * @see Window#isFocusableWindow * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context * and if the calling thread does not have "replaceKeyboardFocusManager" * permission * @beaninfo * bound: true */ protected void setGlobalFocusedWindow(Window focusedWindow) throws SecurityException { Window oldFocusedWindow = null; boolean shouldFire = false; if (focusedWindow == null || focusedWindow.isFocusableWindow()) { synchronized (KeyboardFocusManager.class) { checkKFMSecurity(); oldFocusedWindow = getFocusedWindow(); try { fireVetoableChange("focusedWindow",oldFocusedWindow,focusedWindow); } catch (PropertyVetoException e) { // rejected return; } KeyboardFocusManager.focusedWindow = focusedWindow; shouldFire = true; } } if (shouldFire) { firePropertyChange("focusedWindow",focusedWindow); } }
/** * 通过基础配置信息构建DBCP数据源信息. * @param driver 数据库连接的JDBC驱动 * @param url 数据库连接的url * @param user 数据库连接的用户名 * @param password 数据库连接的密码 */ public ComboPooledDataSource buildDataSource(String driver,String url,String user,String password) { ComboPooledDataSource dataSource = new ComboPooledDataSource(); try { dataSource.setDriverClass(driver); } catch (PropertyVetoException e) { log.error("设置C3P0数据源的DriverClass出错!",e); } dataSource.setJdbcUrl(url); dataSource.setUser(user); dataSource.setPassword(password); return dataSource; }
private void shift(int direction) { Node next = findShiftNode(direction,getoutlineView(),true); if (next != null) { try { getExplorerManager().setSelectednodes(new Node[]{next}); onDetailShift(next); } catch (PropertyVetoException pve) { Exceptions.printstacktrace(pve); } } }
public void activateFrame(JInternalFrame f) { JInternalFrame currentFrame = currentFrameRef != null ? currentFrameRef.get() : null; try { super.activateFrame(f); if (currentFrame != null && f != currentFrame) { // If the current frame is maximized,transfer that // attribute to the frame being activated. if (currentFrame.isMaximum() && (f.getClientProperty("JInternalFrame.frameType") != "optionDialog") ) { //Special case. If key binding was used to select next //frame instead of minimizing the icon via the minimize //icon. if (!currentFrame.isIcon()) { currentFrame.setMaximum(false); if (f.isMaximizable()) { if (!f.isMaximum()) { f.setMaximum(true); } else if (f.isMaximum() && f.isIcon()) { f.setIcon(false); } else { f.setMaximum(false); } } } } if (currentFrame.isSelected()) { currentFrame.setSelected(false); } } if (!f.isSelected()) { f.setSelected(true); } } catch (PropertyVetoException e) {} if (f != currentFrame) { currentFrameRef = new WeakReference<JInternalFrame>(f); } }
public void activateFrame(JInternalFrame f) { JInternalFrame currentFrame = currentFrameRef != null ? currentFrameRef.get() : null; try { super.activateFrame(f); if (currentFrame != null && f != currentFrame) { // If the current frame is maximized,transfer that // attribute to the frame being activated. if (!currentFrame.isClosed() && currentFrame.isMaximum() && (f.getClientProperty("JInternalFrame.frameType") != "optionDialog") ) { //Special case. If key binding was used to select next //frame instead of minimizing the icon via the minimize //icon. if (!currentFrame.isIcon()) { currentFrame.setMaximum(false); if (f.isMaximizable()) { if (!f.isMaximum()) { f.setMaximum(true); } else if (f.isMaximum() && f.isIcon()) { f.setIcon(false); } else { f.setMaximum(false); } } } } if (currentFrame.isSelected()) { currentFrame.setSelected(false); } } if (!f.isSelected()) { f.setSelected(true); } } catch (PropertyVetoException e) {} if (f != currentFrame) { currentFrameRef = new WeakReference<JInternalFrame>(f); } }
private void setSelection(final Node[] nodes) { SwingUtilities.invokelater(new Runnable() { @Override public void run() { try { tablePanel.getExplorerManager().setSelectednodes(nodes); } catch (PropertyVetoException ex) { // ignore } } }); }
public MyFileSystem (FileSystem[] fileSystems) { super (fileSystems); try { setSystemName ("TestFS"); } catch (PropertyVetoException ex) { ex.printstacktrace(); } }
@Override public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException { super.vetoableChange(ev); if (PropertyEnv.PROP_STATE.equals(ev.getPropertyName()) && resourcePanel == null && noI18nCheckBox != null) { // no resourcing,just internationalizing // mark the property excluded if the NOI18N checkBox is checked ResourceSupport.setExcludedProperty(property,noI18nCheckBox.isSelected()); } }
/** * Sets the permanent focus owner. The operation will be cancelled if the * Component is not focusable. The permanent focus owner is defined as the * last Component in an application to receive a permanent FOCUS_GAINED * event. The focus owner and permanent focus owner are equivalent unless * a temporary focus change is currently in effect. In such a situation,* the permanent focus owner will again be the focus owner when the * temporary focus change ends. * <p> * This method does not actually set the focus to the specified Component. * It merely stores the value to be subsequently returned by * {@code getPermanentFocusOwner()}. Use * {@code Component.requestFocus()} or * {@code Component.requestFocusInWindow()} to change the focus owner,* subject to platform limitations. * * @param permanentFocusOwner the permanent focus owner * @see #getPermanentFocusOwner * @see #getGlobalPermanentFocusOwner * @see Component#requestFocus() * @see Component#requestFocusInWindow() * @see Component#isFocusable * @throws SecurityException if this KeyboardFocusManager is not the * current KeyboardFocusManager for the calling thread's context * and if the calling thread does not have "replaceKeyboardFocusManager" * permission */ protected void setGlobalPermanentFocusOwner(Component permanentFocusOwner) throws SecurityException { Component oldPermanentFocusOwner = null; boolean shouldFire = false; if (permanentFocusOwner == null || permanentFocusOwner.isFocusable()) { synchronized (KeyboardFocusManager.class) { checkKFMSecurity(); oldPermanentFocusOwner = getPermanentFocusOwner(); try { fireVetoableChange("permanentFocusOwner",oldPermanentFocusOwner,permanentFocusOwner); } catch (PropertyVetoException e) { // rejected return; } KeyboardFocusManager.permanentFocusOwner = permanentFocusOwner; KeyboardFocusManager. setMostRecentFocusOwner(permanentFocusOwner); shouldFire = true; } } if (shouldFire) { firePropertyChange("permanentFocusOwner",permanentFocusOwner); } }
protected synchronized void fireVetoableChange(String property,Object oldValue,Object newValue) throws PropertyVetoException { if (_vcSupport != null) { _vcSupport.fireVetoableChange(property,newValue); } }
public static void prepareTest(String[] additionalLayers,PropertyVetoException { URL[] layers = new URL[additionalLayers.length + 1]; layers[0] = Utilities.class.getResource("/org/netbeans/modules/editor/errorstripe/resources/layer.xml"); for (int cntr = 0; cntr < additionalLayers.length; cntr++) { layers[cntr + 1] = Utilities.class.getResource(additionalLayers[cntr]); } for (int cntr = 0; cntr < layers.length; cntr++) { if (layers[cntr] == null) { throw new IllegalStateException("layers[" + cntr + "]=null"); } } XMLFileSystem system = new XMLFileSystem(); system.setXmlUrls(layers); Repository repository = new Repository(system); Object[] lookupContent = new Object[additionalLookupContent.length + 1]; System.arraycopy(additionalLookupContent,additionalLookupContent.length); lookupContent[0] = repository; DEFAULT_LOOKUP.setLookup(lookupContent,UnitUtilities.class.getClassLoader()); }
public static void selectFrame(final JInternalFrame frame) { SwingUtilities.invokelater(new Runnable(){ @Override public void run() { frame.requestFocusInWindow(); try { frame.setSelected(true); } catch (PropertyVetoException e) {} frame.toFront(); } }); }
@Override public Object getValue() throws illegalaccessexception,InvocationTargetException { synchronized (valueLock) { if (value == null) { value = valueCalculating; debugger.getRequestProcessor().post(new Runnable() { @Override public void run() { try { RemoteServices.runOnStoppedThread(t,new Runnable() { @Override public void run() { boolean[] isEditablePtr = new boolean[] { false }; Type[] typePtr = new Type[] { null }; String v = getValueLazy(isEditablePtr,typePtr); synchronized (valueLock) { value = v; valueIsEditable = isEditablePtr[0]; valueType = typePtr[0]; } ci.firePropertyChange(propertyName,v); } },sType); } catch (PropertyVetoException ex) { value = ex.getLocalizedMessage(); } } }); } return value; } }
/** * Select corresponding node in the document view tree upon change of the * rule editor's content. * * A. The RuleNode holds instances of Rule-s from the model instance which * was created as setContext(file) was called on the view panel. B. The * 'rule' argument here is from an up-to-date model. * */ private void setSelectedRule(RuleHandle handle) { try { Node foundRuleNode = findLocation(manager.getRootContext(),handle); Node[] toSelect = foundRuleNode != null ? new Node[]{foundRuleNode} : new Node[0]; manager.setSelectednodes(toSelect); } catch (PropertyVetoException ex) { //no-op } }
public static void main(String[] args) throws PropertyVetoException { Object source = new Object(); new TestMethods(source).fireVetoableChange(new PropertyChangeEvent(source,NAME,null)); new TestMethods(source).fireVetoableChange(NAME,null); new TestMethods(source).fireVetoableChange(NAME,1); new TestMethods(source).fireVetoableChange(NAME,true,false); }
private void createAndShowUI() throws Exception { frame = new JFrame(); frame.setTitle("Test Frame"); frame.setSize(800,600); JDesktopPane pane = new JDesktopPane(); TestInternalFrameWPopup testInternalFrame1 = new TestInternalFrameWPopup(); pane.add(testInternalFrame1); testInternalFrame1.setVisible(true); JScrollPane scrollPane = new JScrollPane(pane); frame.getContentPane().add(scrollPane); testInternalFrame1.setMaximum(true); frame.getRootPane().registerKeyboardAction(e -> { TestInternalFrame testInternalFrame2 = new TestInternalFrame(); pane.add(testInternalFrame2); try { testInternalFrame2.setMaximum(true); } catch (PropertyVetoException ex) { throw new RuntimeException(ex); } testInternalFrame2.setVisible(true); },Keystroke.getKeystroke(KeyEvent.VK_U,KeyEvent.CTRL_MASK),JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); frame.setVisible(true); }
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FirsT:event_cancelButtonActionPerformed // Add your handling code here: synchronized (this) { try { fireVetoableChange(PROP_ALL_CANCELLED,null); } catch (PropertyVetoException pvex) {} try { internallyClosing = true; close(); } finally { internallyClosing = false; } } }
/** Called from the <code>EnvironmentListener</code>. * The components are going to be closed anyway and in case of * modified document its asked before if to save the change. */ private void fileRemoved() { LOG.finer("Environment.fileRemoved() ... "); //NOI18N try { fireVetoableChange(PROP_VALID,Boolean.TRUE,Boolean.FALSE); } catch(PropertyVetoException pve) { // Ignore it and close anyway. File doesn't exist anymore. } firePropertyChange(PROP_VALID,Boolean.FALSE); }
/** Accepts vetoable changes and fires them to own listeners. */ public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException { fireVetoableChange ( ev.getPropertyName (),ev.getoldValue (),ev.getNewValue () ); }
private void setIcon(boolean b) { try { jif.setIcon(b); } catch (PropertyVetoException e) { e.printstacktrace(); } }
/** * * @param testName name of test * @return array of FileSystems that should be tested in test named: "testName" */ protected FileSystem[] createFileSystem (String testName,String[] resources) throws IOException { FileSystem lfs = TestUtilHid.createLocalFileSystem("mfs3"+testName,resources); FileSystem xfs = TestUtilHid.createXMLFileSystem(testName,resources); FileSystem mfs = new MultiFileSystem(lfs,xfs); try { mfs.setSystemName("mfs3test"); } catch (PropertyVetoException e) { e.printstacktrace(); //To change body of catch statement use Options | File Templates. } return new FileSystem[] {mfs,lfs,xfs}; }
/** it mounts LocalFileSystem in temorary directory */ private void preprocess() throws IOException,PropertyVetoException { // fileSystemFile.mkdir(); clearworkdir(); fileSystemDir = new File(getworkdir(),"testAtt123rDir"); if(fileSystemDir.mkdir() == false || fileSystemDir.isDirectory() == false) { throw new IOException (fileSystemDir.toString() + " is not directory"); } fileSystem = new LocalFileSystem(); fileSystem.setRootDirectory(fileSystemDir); }
private void updateNodes() { //Create nodes for TopComponents,sort them using their own comparator List<TopComponent> tcList = getopenedDocuments(); TopComponent activeTC = TopComponent.getRegistry().getActivated(); TopComponentNode[] tcNodes = new TopComponentNode[tcList.size()]; TopComponentNode toSelect = null; for (int i = 0; i < tcNodes.length; i++) { TopComponent tc = tcList.get(i); tcNodes[i] = new TopComponentNode(tc); if( tc == activeTC ) { toSelect = tcNodes[i]; } } if( radioOrderByName.isSelected() ) { Arrays.sort(tcNodes); } Children.Array nodeArray = new Children.Array(); nodeArray.add(tcNodes); Node root = new AbstractNode(nodeArray); explorer.setRootContext(root); // set focus to documents list listView.requestFocus(); // select the active editor tab or the first item if possible if (tcNodes.length > 0) { try { if( null == toSelect ) toSelect = tcNodes[0]; explorer.setSelectednodes(new Node[] {toSelect} ); } catch (PropertyVetoException exc) { // do nothing,what should I do? } } }
protected void assembleSystemMenu() { systemPopupMenu = new jpopupmenuUIResource(); addSystemMenuItems(systemPopupMenu); enableActions(); menuButton = createNoFocusButton(); updateMenuIcon(); menuButton.addMouseListener(new MouseAdapter() { public void mousepressed(MouseEvent e) { try { frame.setSelected(true); } catch(PropertyVetoException pve) { } showSystemMenu(); } }); jpopupmenu p = frame.getComponentPopupMenu(); if (p == null || p instanceof UIResource) { frame.setComponentPopupMenu(systemPopupMenu); } if (frame.getDesktopIcon() != null) { p = frame.getDesktopIcon().getComponentPopupMenu(); if (p == null || p instanceof UIResource) { frame.getDesktopIcon().setComponentPopupMenu(systemPopupMenu); } } setInheritsPopupMenu(true); }
groovy.lang.MissingPropertyException的实例源码
public String determineName(Object thing) { Object name; try { if (thing instanceof Named) { name = ((Named) thing).getName(); } else if (thing instanceof Map) { name = ((Map) thing).get("name"); } else if (thing instanceof GroovyObject) { name = ((GroovyObject) thing).getProperty("name"); } else { name = DynamicObjectUtil.asDynamicObject(thing).getProperty("name"); } } catch (MissingPropertyException e) { throw new NoNamingPropertyException(thing); } if (name == null) { throw new NullNamingPropertyException(thing); } return name.toString(); }
@Override public void setProperty(final String property,final Object newValue) { if (property == null) { throw new MissingPropertyException("null",getClass()); } switch (property) { case "sha": case "url": case "author": case "committer": case "parents": case "message": case "comment_count": case "comments": case "additions": case "deletions": case "total_changes": case "files": case "statuses": throw new ReadOnlyPropertyException(property,getClass()); default: throw new MissingPropertyException(property,getClass()); } }
@Override public void setProperty(final String property,getClass()); } switch (property) { case "sha": case "filename": case "status": case "patch": case "additions": case "deletions": case "changes": case "raw_url": case "blob_url": throw new ReadOnlyPropertyException(property,getClass()); } }
@Override public Object getProperty(final String property) { if (property == null) { throw new MissingPropertyException("null",getClass()); } switch (property) { case "id": return comment.getId(); case "url": return comment.getUrl(); case "user": return GitHubHelper.userToLogin(comment.getUser()); case "body": return comment.getBody(); case "created_at": return comment.getCreatedAt(); case "updated_at": return comment.getUpdatedAt(); default: throw new MissingPropertyException(property,getClass()); } }
@Override public void setProperty(final String property,getClass()); } switch (property) { case "id": case "url": case "user": case "created_at": case "updated_at": throw new ReadOnlyPropertyException(property,getClass()); case "body": setBody(newValue.toString()); break; default: throw new MissingPropertyException(property,getClass()); } }
@Override public void setProperty(final String property,getClass()); } switch (property) { case "id": case "url": case "status": case "context": case "description": case "target_url": case "created_at": case "updated_at": case "creator": throw new ReadOnlyPropertyException(property,getClass()); } }
/** * Result {@code null} means that there is no variable. Result other than {@code null} means that there is a variable (that may possibly * be {@code null}). * * @param name the name of the variable. * @return a holder for a variable. */ protected Mutable<Object> doGetvariable(String name) { List<Object> variables = scripts.stream().filter(script -> script.getMetaClass().hasProperty(script.getMetaClass().getTheClass(),name) != null) .map(script -> script.getProperty(name)).collect(Collectors.toList()); if (variables.isEmpty()) { try { return new MutableObject<>(binding.getProperty(name)); } catch (MissingPropertyException e) { return null; // This means that no variable has been found! } } return new MutableObject<>(variables.get(0)); }
@TaskAction public void danGenerateEntity() { try { String entities = (String) this.getProject().property("entities"); if (entities != null) { for(String entity: Arrays.asList(entities.split(","))) { new DanConsole().generateEntity(entity); } } else { throw new MissingPropertyException(""); } } catch (MissingPropertyException e) { System.err.println(USAGE); throw e; } }
@Test @LoadGraphWith(LoadGraphWith.GraphData.MODERN) public void shouldClearBindingsBetweenEvals() throws Exception { final ScriptEngine engine = new GremlinGroovyScriptEngine(); engine.put("g",g); engine.put("marko",convertToVertexId("marko")); assertEquals(g.V(convertToVertexId("marko")).next(),engine.eval("g.V(marko).next()")); final Bindings bindings = engine.createBindings(); bindings.put("g",g); bindings.put("s","marko"); assertEquals(engine.eval("g.V().has('name',s).next()",bindings),g.V(convertToVertexId("marko")).next()); try { engine.eval("g.V().has('name',s).next()"); fail("This should have Failed because s is no longer bound"); } catch (Exception ex) { final Throwable t = ExceptionUtils.getRootCause(ex); assertEquals(MissingPropertyException.class,t.getClass()); assertTrue(t.getMessage().startsWith("No such property: s for class")); } }
@Test public void shouldNotPreserveInstantiatedVariablesBetweenEvals() throws Exception { final ScriptEngines engines = new ScriptEngines(se -> {}); engines.reload("gremlin-groovy",Collections.<String>emptySet(),Collections.emptyMap()); final Bindings localBindingsFirstRequest = new SimpleBindings(); localBindingsFirstRequest.put("x","there"); assertEquals("herethere",engines.eval("z = 'here' + x",localBindingsFirstRequest,"gremlin-groovy")); try { final Bindings localBindingsSecondRequest = new SimpleBindings(); engines.eval("z",localBindingsSecondRequest,"gremlin-groovy"); fail("Should not have kNowledge of z"); } catch (Exception ex) { final Throwable root = ExceptionUtils.getRootCause(ex); assertthat(root,instanceOf(MissingPropertyException.class)); } }
@Test public void shouldPromoteDefinedVarsInInterpreterModeWithNoBindings() throws Exception { final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new InterpreterModeCustomizerProvider()); engine.eval("def addItUp = { x,y -> x + y }"); assertEquals(3,engine.eval("int xxx = 1 + 2")); assertEquals(4,engine.eval("yyy = xxx + 1")); assertEquals(7,engine.eval("def zzz = yyy + xxx")); assertEquals(4,engine.eval("zzz - xxx")); assertEquals("accessible-globally",engine.eval("if (yyy > 0) { def inner = 'should-stay-local'; outer = 'accessible-globally' }\n outer")); assertEquals("accessible-globally",engine.eval("outer")); try { engine.eval("inner"); fail("Should not have been able to access 'inner'"); } catch (Exception ex) { final Throwable root = ExceptionUtils.getRootCause(ex); assertthat(root,instanceOf(MissingPropertyException.class)); } assertEquals(10,engine.eval("addItUp(zzz,xxx)")); }
@Test public void shouldPromoteDefinedVarsInInterpreterModeWithBindings() throws Exception { final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new InterpreterModeCustomizerProvider()); final Bindings b = new SimpleBindings(); b.put("x",2); engine.eval("def addItUp = { x,y -> x + y }",b); assertEquals(3,engine.eval("int xxx = 1 + x",b)); assertEquals(4,engine.eval("yyy = xxx + 1",b)); assertEquals(7,engine.eval("def zzz = yyy + xxx",engine.eval("zzz - xxx",b)); assertEquals("accessible-globally",engine.eval("if (yyy > 0) { def inner = 'should-stay-local'; outer = 'accessible-globally' }\n outer",engine.eval("outer",b)); try { engine.eval("inner",b); fail("Should not have been able to access 'inner'"); } catch (Exception ex) { final Throwable root = ExceptionUtils.getRootCause(ex); assertthat(root,xxx)",b)); }
/** * Error hook installed to Groovy shell. * * Will display exception that appeared during executing command. In most * cases we will simply delegate the call to printing throwable method,* however in case that we've received ClientError.CLIENT_0006 (server * exception),we will unwrap server issue and view only that as local * context shouldn't make any difference. * * @param t Throwable to be displayed */ public static void errorHook(Throwable t) { // Based on the kind of exception we are dealing with,let's provide different user experince if(t instanceof SqoopException && ((SqoopException)t).getErrorCode() == ShellError.SHELL_0006) { println("@|red Server has returned exception: |@"); printThrowable(t.getCause(),isverbose()); } else if(t instanceof SqoopException && ((SqoopException)t).getErrorCode() == ShellError.SHELL_0003) { print("@|red Invalid command invocation: |@"); // In most cases the cause will be actual parsing error,so let's print that alone if (t.getCause() != null) { println(t.getCause().getMessage()); } else { println(t.getMessage()); } } else if(t.getClass() == MissingPropertyException.class) { print("@|red UnkNown command: |@"); println(t.getMessage()); } else { println("@|red Exception has occurred during processing command |@"); printThrowable(t,isverbose()); } }
/** * Retrieve the value of the property by its index. * A negative index will count backwards from the last column. * * @param index is the number of the column to look at * @return the value of the property */ public Object getAt(int index) { try { // a negative index will count backwards from the last column. if (index < 0) index += result.size(); Iterator it = result.values().iterator(); int i = 0; Object obj = null; while ((obj == null) && (it.hasNext())) { if (i == index) obj = it.next(); else it.next(); i++; } return obj; } catch (Exception e) { throw new MissingPropertyException(Integer.toString(index),GroovyRowResult.class,e); } }
private Object extractNewValue(Object newObject) { Object newValue; try { newValue = InvokerHelper.getProperty(newObject,propertyName); } catch (MissingPropertyException mpe) { //todo we should flag this when the path is created that this is a field not a prop... // try direct method... try { newValue = InvokerHelper.getAttribute(newObject,propertyName); if (newValue instanceof Reference) { newValue = ((Reference) newValue).get(); } } catch (Exception e) { //LOGME? newValue = null; } } return newValue; }
/** * Overloaded to make variables appear as bean properties or via the subscript operator */ public Object getProperty(String property) { try { return getProxyBuilder().doGetProperty(property); } catch (MissingPropertyException mpe) { if ((getContext() != null) && (getContext().containsKey(property))) { return getContext().get(property); } else { try { return getMetaClass().getProperty(this,property); } catch(MissingPropertyException mpe2) { if(mpe2.getproperty().equals(property) && propertyMissingDelegate != null) { return propertyMissingDelegate.call(new Object[]{property}); } throw mpe2; } } } }
private void addPropertiesToProject(Project project) { Properties projectProperties = new Properties(); File projectPropertiesFile = new File(project.getProjectDir(),Project.GRADLE_PROPERTIES); LOGGER.debug("Looking for project properties from: {}",projectPropertiesFile); if (projectPropertiesFile.isFile()) { projectProperties = GUtil.loadProperties(projectPropertiesFile); LOGGER.debug("Adding project properties (if not overwritten by user properties): {}",projectProperties.keySet()); } else { LOGGER.debug("project property file does not exists. We continue!"); } Map<String,String> mergedProperties = propertiesLoader.mergeProperties(new HashMap(projectProperties)); ExtraPropertiesExtension extraProperties = new DslObject(project).getExtensions().getExtraProperties(); for (Map.Entry<String,String> entry: mergedProperties.entrySet()) { try { project.setProperty(entry.getKey(),entry.getValue()); } catch (MissingPropertyException e) { if (!entry.getKey().equals(e.getproperty())) { throw e; } // Ignore and define as an extra property extraProperties.set(entry.getKey(),entry.getValue()); } } }
@Test public void shouldClearBindingsBetweenEvals() throws Exception { final Graph graph = TinkerFactory.createModern(); final GraphTraversalSource g = graph.traversal(); final ScriptEngine engine = new GremlinGroovyScriptEngine(); engine.put("g",convertToVertexId(graph,"marko")); assertEquals(g.V(convertToVertexId(graph,"marko")).next(),g.V(convertToVertexId(graph,"marko")).next()); try { engine.eval("g.V().has('name',t.getClass()); assertTrue(t.getMessage().startsWith("No such property: s for class")); } }
@Test public void shouldPromoteDefinedVarsInInterpreterModeWithNoBindings() throws Exception { final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new InterpreterModeGroovyCustomizer()); engine.eval("def addItUp = { x,xxx)")); }
@Test public void shouldPromoteDefinedVarsInInterpreterModeWithBindings() throws Exception { final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(new InterpreterModeGroovyCustomizer()); final Bindings b = new SimpleBindings(); b.put("x",b)); }
private static boolean hasProperty(Object object,String property) { if (InvokerHelper.getMetaClass(object).hasProperty(object,property) != null) { return true; } // The only way to be sure whether something is handled as a property in // Groovy is to actually get it and catch a MissingPropertyException. // But this actually accesses the property (-> side effects?)! // Here this is no problem,since we only disallow some write access... // The only allowed class with side effects should be InstanceAccessor,// which is in "allAllowedClasses" and thus shouldn't reach here try { InvokerHelper.getProperty(object,property); return true; } catch (MissingPropertyException e) { return false; } }
@Override public Object getProperty(String property) { if (property.equals("name")) { return getName(); } if (property.equals("displayName")) { return getdisplayName(); } I element = get(property); if (element == null) { throw new MissingPropertyException(property,ModelMap.class); } return element; }
public Object propertyMissing(final String name) { if (suiteXmlBuilder != null) { return suiteXmlBuilder.getMetaClass().getProperty(suiteXmlBuilder,name); } throw new MissingPropertyException(name,getClass()); }
public Object propertyMissing(String name) { if (getProject().getProperties().containsKey(name)) { return getProject().getProperties().get(name); } throw new MissingPropertyException(name,getClass()); }
public void propertyMissing(String name,Object value) { if (value instanceof Closure) { map(name,(Closure) value); } else { throw new MissingPropertyException(name,getClass()); } }
public Object getProperty(String name) { if (name.equals("properties")) { return getProperties(); } if (storage.containsKey(name)) { return storage.get(name); } else { throw new MissingPropertyException(UnkNownPropertyException.createMessage(name),name,null); } }
@Override public Object getProperty(String name) throws MissingPropertyException { GetPropertyResult result = new GetPropertyResult(); getProperty(name,result); if (!result.isFound()) { throw getMissingProperty(name); } return result.getValue(); }
@Override public void setProperty(String name,Object value) throws MissingPropertyException { SetPropertyResult result = new SetPropertyResult(); setProperty(name,value,result); if (!result.isFound()) { throw setMissingProperty(name); } }
public MissingPropertyException getMissingProperty(String name) { Class<?> publicType = getPublicType(); boolean includedisplayName = hasUsefuldisplayName(); if (publicType != null && includedisplayName) { return new MissingPropertyException(String.format("Could not get unkNown property '%s' for %s of type %s.",getdisplayName(),publicType.getName()),publicType); } else if (publicType != null) { return new MissingPropertyException(String.format("Could not get unkNown property '%s' for object of type %s.",publicType); } else { // Use the display name anyway return new MissingPropertyException(String.format("Could not get unkNown property '%s' for %s.",getdisplayName()),null); } }
public MissingPropertyException setMissingProperty(String name) { Class<?> publicType = getPublicType(); boolean includedisplayName = hasUsefuldisplayName(); if (publicType != null && includedisplayName) { return new MissingPropertyException(String.format("Could not set unkNown property '%s' for %s of type %s.",publicType); } else if (publicType != null) { return new MissingPropertyException(String.format("Could not set unkNown property '%s' for object of type %s.",publicType); } else { // Use the display name anyway return new MissingPropertyException(String.format("Could not set unkNown property '%s' for %s.",null); } }
@Override public Object getProperty(final String property) { if (property == null) { throw new MissingPropertyException("null",this.getClass()); } switch (property) { case "id": return commitComment.getId(); case "url": return commitComment.getUrl(); case "user": return GitHubHelper.userToLogin(commitComment.getUser()); case "created_at": return commitComment.getCreatedAt(); case "updated_at": return commitComment.getUpdatedAt(); case "commit_id": return commitComment.getCommitId(); case "original_commit_id": return commitComment.getoriginalCommitId(); case "body": return commitComment.getBody(); case "path": return commitComment.getPath(); case "line": return commitComment.getLine(); case "position": return commitComment.getPosition(); case "original_position": return commitComment.getPosition(); case "diff_hunk": return commitComment.getDiffHunk(); default: throw new MissingPropertyException(property,this.getClass()); } }
@Override public void setProperty(final String property,this.getClass()); } switch (property) { case "id": case "url": case "user": case "created_at": case "updated_at": case "commit_id": case "original_commit_id": case "path": case "line": case "position": case "original_position": case "diff_hunk": throw new ReadOnlyPropertyException(property,getClass()); case "body": Objects.requireNonNull(newValue,"body cannot be null"); setBody(newValue.toString()); break; default: throw new MissingPropertyException(property,this.getClass()); } }
@Override public Object getProperty(final String property) { if (property == null) { throw new MissingPropertyException("null",this.getClass()); } switch (property) { case "sha": return commit.getSha(); case "url": return commit.getUrl(); case "author": return commit.getAuthor().getLogin(); case "committer": return commit.getCommitter().getLogin(); case "parents": return getParents(); case "message": return commit.getCommit().getMessage(); case "comment_count": return commit.getCommit().getCommentCount(); case "comments": return getComments(); case "additions": return commit.getStats().getAdditions(); case "deletions": return commit.getStats().getDeletions(); case "total_changes": return commit.getStats().getTotal(); case "files": return getFiles(); case "statuses": return getStatuses(); default: throw new MissingPropertyException(property,this.getClass()); } }
@Override public Object getProperty(final String property) { if (property == null) { throw new MissingPropertyException("null",this.getClass()); } switch (property) { case "sha": return file.getSha(); case "filename": return file.getFilename(); case "status": return file.getStatus(); case "patch": return file.getPatch(); case "additions": return file.getAdditions(); case "deletions": return file.getDeletions(); case "changes": return file.getChanges(); case "raw_url": return file.getRawUrl(); case "blob_url": return file.getBlobUrl(); default: throw new MissingPropertyException(property,this.getClass()); } }
@Override public Object getProperty(final String property) { if (property == null) { throw new MissingPropertyException("null",this.getClass()); } switch (property) { case "id": return commitStatus.getId(); case "url": return commitStatus.getUrl(); case "status": return commitStatus.getState(); case "context": return commitStatus.getContext(); case "description": return commitStatus.getDescription(); case "target_url": return commitStatus.getTargetUrl(); case "created_at": return commitStatus.getCreatedAt(); case "updated_at": return commitStatus.getUpdatedAt(); case "creator": return commitStatus.getCreator().getLogin(); default: throw new MissingPropertyException(property,this.getClass()); } }
private EclipseModel eclipseModel(Project project) { try { return (EclipseModel) project.property("eclipse"); } catch (MissingPropertyException e) { throw new RuntimeException( "Cannot find 'eclipse' property.\nEnsure that the following is in your project: \n\napply plugin: 'eclipse'\n\n",e); } }
@Override public final Object getProperty(String property) { if (!dynamicProperties.containsKey(property)) { throw new MissingPropertyException(property); } return dynamicProperties.get(property); }
@TaskAction public void danGenerateView() { try { String argUiName = (String) this.getProject().property("uiName"); String argViewName = (String) this.getProject().property("viewName"); if (argUiName != null && argViewName != null) { new DanConsole().generateView(argUiName,argViewName); } else { throw new MissingPropertyException(""); } } catch (MissingPropertyException e) { System.err.println(USAGE); throw e; } }
@TaskAction public void danGenerateUi() { try { String argUiName = (String) this.getProject().property("uiName"); if (argUiName != null) { new DanConsole().generateUi(argUiName); } else { throw new MissingPropertyException(""); } } catch (MissingPropertyException e) { System.err.println(USAGE); throw e; } }
@Deployment public void testFailingScript() { Exception expectedException = null; try { runtimeService.startProcessInstanceByKey("failingScript"); } catch (Exception e) { expectedException = e; } // Check if correct exception is found in the stacktrace verifyExceptionInStacktrace(expectedException,MissingPropertyException.class); }
groovy.lang.ReadOnlyPropertyException的实例源码
@Override public void setProperty(final String property,final Object newValue) { if (property == null) { throw new MissingPropertyException("null",getClass()); } switch (property) { case "sha": case "url": case "author": case "committer": case "parents": case "message": case "comment_count": case "comments": case "additions": case "deletions": case "total_changes": case "files": case "statuses": throw new ReadOnlyPropertyException(property,getClass()); default: throw new MissingPropertyException(property,getClass()); } }
@Override public void setProperty(final String property,getClass()); } switch (property) { case "sha": case "filename": case "status": case "patch": case "additions": case "deletions": case "changes": case "raw_url": case "blob_url": throw new ReadOnlyPropertyException(property,getClass()); } }
@Override public void setProperty(final String property,getClass()); } switch (property) { case "id": case "url": case "user": case "created_at": case "updated_at": throw new ReadOnlyPropertyException(property,getClass()); case "body": setBody(newValue.toString()); break; default: throw new MissingPropertyException(property,getClass()); } }
@Override public void setProperty(final String property,getClass()); } switch (property) { case "id": case "url": case "status": case "context": case "description": case "target_url": case "created_at": case "updated_at": case "creator": throw new ReadOnlyPropertyException(property,getClass()); } }
@Override public void setProperty(final String property,this.getClass()); } switch (property) { case "id": case "url": case "user": case "created_at": case "updated_at": case "commit_id": case "original_commit_id": case "path": case "line": case "position": case "original_position": case "diff_hunk": throw new ReadOnlyPropertyException(property,getClass()); case "body": Objects.requireNonNull(newValue,"body cannot be null"); setBody(newValue.toString()); break; default: throw new MissingPropertyException(property,this.getClass()); } }
/** * Overridden to enforce read-only access to the 'pseudo-variables' * corpora,docs,prs and apps. * @throws ReadOnlyPropertyException if an attempt is made to set * any of these variables. */ public void setvariable(String name,Object value) { if("corpora".equals(name) || "docs".equals(name) || "prs".equals(name) || "apps".equals(name)) { throw new ReadOnlyPropertyException(name,this.getClass()); } super.setvariable(name,value); }
/** * Overridden to enforce read-only access to the 'pseudo-variables' * corpora,value); }
public void setProperty(String name,Object newValue) { if (name.equals("properties")) { throw new ReadOnlyPropertyException("name",ExtraPropertiesExtension.class); } set(name,newValue); }
@Override public void setProperty(final String property,final Object newValue) { if (property == null) { throw new MissingPropertyException("null",this.getClass()); } switch (property) { // writable properties case "state": Objects.requireNonNull(newValue,"state cannot be null"); setState(newValue.toString()); break; case "title": Objects.requireNonNull(newValue,"title cannot be null"); setTitle(newValue.toString()); break; case "body": Objects.requireNonNull(newValue,"body cannot be null"); setBody(newValue.toString()); break; case "base": Objects.requireNonNull(newValue,"base cannot be null"); setBase(newValue.toString()); break; case "locked": Objects.requireNonNull(newValue,"locked cannot be null"); setLocked(Boolean.valueOf(newValue.toString())); break; case "labels": setLabels(newValue); break; case "milestone": // setMilestone(Integer.valueOf(newValue.toString())); break; case "maintainer_can_modify": Objects.requireNonNull(newValue,"maintainer_can_modify cannot be null"); setMaintainerCanModify(Boolean.valueOf(newValue.toString())); break; // read only properties case "id": case "number": case "url": case "patch_url": case "diff_url": case "issue_url": case "head": case "files": case "assignees": case "commits": case "comments": case "review_comments": case "statuses": case "requested_reviewers": case "updated_at": case "created_at": case "created_by": case "closed_at": case "closed_by": case "merged_at": case "merged_by": case "commit_count": case "comment_count": case "additions": case "deletions": case "changed_files": case "merged": case "mergeable": case "merge_commit_sha": throw new ReadOnlyPropertyException(property,this.getClass()); // unkNown properties default: throw new MissingPropertyException(property,this.getClass()); } }
@Override public void setProperty(String property,Object newValue) { throw new ReadOnlyPropertyException(property,target.getClass()); }
public void setProperty(String property,Object value) { throw new ReadOnlyPropertyException(property,model.getClass()); }
public void setProperty(String name,newValue); }
io.reactivex.exceptions.OnErrorNotImplementedException的实例源码
public <R> disposable subscribe(Consumer<R> onNext,Consumer<Throwable> onError,Action onCompleted,FlowableTransformer<T,R> transformer) { Flowable flowable = build(false); if (transformer != null) flowable = flowable.compose(transformer); if (onNext == null) onNext = data -> {}; if (onError == null) onError = error -> { throw new OnErrorNotImplementedException(error); }; if (onCompleted == null) onCompleted = () -> {}; Consumer<R> actualOnNext = onNext; if (mQueuer != null && mQueueSubscriptionSafetyCheckEnabled) actualOnNext = RxBusUtil.wrapQueueConsumer(onNext,mQueuer); flowable = applySchedular(flowable); disposable disposable = flowable.subscribe(actualOnNext,onError,onCompleted); if (mBoundobject != null) RxdisposableManager.adddisposable(mBoundobject,disposable); return disposable; }
@Test public void expect_exceptionThrownAndExpected_shouldMatchExpectedException() throws Throwable { // given Statement originalStatement = new Statement() { @Override public void evaluate() throws Throwable { Single.just("bar") .map(s -> { throw new Exception("foo"); }) .subscribe(); } }; ExpectedUncaughtException uncaughtThrown = ExpectedUncaughtException.none(); uncaughtThrown.expect(OnErrorNotImplementedException.class); uncaughtThrown.expectMessage("foo"); Statement statement = uncaughtThrown.apply(originalStatement,description); // when statement.evaluate(); // then verifyNoMoreInteractions(description); }
@Override public void accept(Throwable e) throws Exception { if (e instanceof OnErrorNotImplementedException) { Promise.error(e.getCause()).then(Action.noop()); } else if (e instanceof UndeliverableException) { Promise.error(e.getCause()).then(Action.noop()); } else { Promise.error(e).then(Action.noop()); } }
@Test public void expect_exceptionThrownMatchesExpectedButExpectingDifferentMessage_shouldFail() throws Throwable { // given Statement originalStatement = new Statement() { @Override public void evaluate() throws Throwable { Single.just("bar") .map(s -> { throw new Exception("foo"); }) .subscribe(); } }; ExpectedUncaughtException uncaughtThrown = ExpectedUncaughtException.none(); uncaughtThrown.expect(OnErrorNotImplementedException.class); uncaughtThrown.expectMessage("bar"); Statement statement = uncaughtThrown.apply(originalStatement,description); thrown.expect(AssertionError.class); thrown.expectMessage("Expected uncaught exception " + "io.reactivex.exceptions.OnErrorNotImplementedException " + "occurred but has unexpected message:\n" + "Expected: \"bar\"\n" + " but: was \"foo\""); // when statement.evaluate(); // then should fail }
@Override public void onError(Throwable throwable) { throw new OnErrorNotImplementedException(throwable); }
@Override public PopulararticlesResource requestPopulararticles() throws IOException { throw new OnErrorNotImplementedException(new Throwable("Todo: implement for not Rx clients")); }
io.reactivex.exceptions.ProtocolViolationException的实例源码
@Test public void badSource() { List<Throwable> errors = TestHelper.trackPluginErrors(); try { final PublishProcessor<Integer> pp1 = PublishProcessor.create(); final Flowable<Integer> pp2 = new Flowable<Integer>() { @Override protected void subscribeActual(Subscriber<? super Integer> s) { BooleanSubscription bs1 = new BooleanSubscription(); s.onSubscribe(bs1); BooleanSubscription bs2 = new BooleanSubscription(); s.onSubscribe(bs2); Assert.assertFalse(bs1.isCancelled()); Assert.assertTrue(bs2.isCancelled()); } }; Flowables.zipLatest(pp1,pp2,toString2).test(); TestHelper.assertError(errors,ProtocolViolationException.class); } finally { RxJavaPlugins.reset(); } }
public void onNext(T value) { if (isdisposed()) return; if (terminated) { throw new ProtocolViolationException("OnNext called after Observable terminal event"); } observer.onNext(value); }
/** * Report a ProtocolViolationException with a personalized message referencing * the simple type name of the consumer class and report it via * RxJavaPlugins.onError. * * @param consumer the class of the consumer */ public static void reportDoubleSubscription(Class<?> consumer) { RxJavaPlugins.onError(new ProtocolViolationException(composeMessage(consumer.getName()))); }
今天关于java.beans.PropertyVetoException的实例源码和java error creating bean的介绍到此结束,谢谢您的阅读,有关groovy.lang.MissingPropertyException的实例源码、groovy.lang.ReadOnlyPropertyException的实例源码、io.reactivex.exceptions.OnErrorNotImplementedException的实例源码、io.reactivex.exceptions.ProtocolViolationException的实例源码等更多相关知识的信息可以在本站进行查询。
本文标签: