Most of the Exceptions that were thrown when a bug was detected where IllegalStateException. This was not very strict, so when that usage is not appropriate RuntimeException is used.
Fixed also a couple of typos in the thrown runtime exceptions.
| | |
| | | catch (IOException ioe) |
| | | { |
| | | // Bug |
| | | throw new IllegalStateException("Unexpected encoding exception: "+ioe, |
| | | throw new RuntimeException("Unexpected encoding exception: "+ioe, |
| | | ioe); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | if (node.isLeaf() && (node.getChildCount() >= 1)) { |
| | | throw new IllegalStateException("Inconsistent node: " + node.getDN()); |
| | | throw new RuntimeException("Inconsistent node: " + node.getDN()); |
| | | } |
| | | |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | |
| | | ConnectionUtils.getBindPassword(ctx), false); |
| | | } |
| | | catch (NamingException x) { |
| | | throw new IllegalStateException("Bug"); |
| | | throw new RuntimeException("Bug"); |
| | | } |
| | | } |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding dn: "+parentDn+" . "+t, |
| | | throw new RuntimeException("Error decoding dn: "+parentDn+" . "+t, |
| | | t); |
| | | } |
| | | NamingEnumeration<SearchResult> entries = ctx.search( |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding dns: "+t, t); |
| | | throw new RuntimeException("Error decoding dns: "+t, t); |
| | | } |
| | | |
| | | if (!add) |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding dn: "+ |
| | | throw new RuntimeException("Error decoding dn: "+ |
| | | addedEntry.getName()+" . "+t, t); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding dn: "+ |
| | | throw new RuntimeException("Error decoding dn: "+ |
| | | node.getDN()+" . "+t, t); |
| | | } |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | } |
| | | catch (ParseException pe) |
| | | { |
| | | throw new IllegalStateException( |
| | | throw new RuntimeException( |
| | | "Unexpected error getting bytes: "+pe, pe); |
| | | } |
| | | } |
| | |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalStateException("Unknown state: "+desc.getState()); |
| | | throw new RuntimeException("Unknown state: "+desc.getState()); |
| | | } |
| | | dataArray.add(s); |
| | | } |
| | |
| | | } |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unknown policy: "+getConnectionPolicy()); |
| | | throw new RuntimeException("Unknown policy: "+getConnectionPolicy()); |
| | | } |
| | | return url; |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | v = INFO_CTRL_PANEL_INDEX_APPROXIMATE.get(); |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unknown index type: "+type); |
| | | throw new RuntimeException("Unknown index type: "+type); |
| | | } |
| | | if (sb.length() > 0) |
| | | { |
| | |
| | | toString = "Schedule Type: periodical schedule "+cronValue; |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Invalid type: "+type); |
| | | throw new RuntimeException("Invalid type: "+type); |
| | | } |
| | | return toString; |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | s = "Subordinate Subtree"; |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unknow scope: "+i.getScope()); |
| | | throw new RuntimeException("Unknown scope: "+i.getScope()); |
| | | } |
| | | return s; |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalStateException("Unknown type: " + type); |
| | | throw new RuntimeException("Unknown type: " + type); |
| | | } |
| | | |
| | | if (returnVal == JFileChooser.APPROVE_OPTION) |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | throw new IllegalStateException("Unexpected error parsing dn: "+ |
| | | throw new RuntimeException("Unexpected error parsing dn: "+ |
| | | node.getDN(), de); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | throw new IllegalStateException("Unexpected error parsing dn: "+ |
| | | throw new RuntimeException("Unexpected error parsing dn: "+ |
| | | node.getDN(), de); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new IllegalStateException("Could not parse DN: "+oldEntry.getDN(), |
| | | throw new RuntimeException("Could not parse DN: "+oldEntry.getDN(), |
| | | ode); |
| | | } |
| | | modifications = getModifications(newEntry, oldEntry, getInfo()); |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | } |
| | | else |
| | |
| | | catch (NamingException ne) |
| | | { |
| | | // This should not happen |
| | | throw new IllegalStateException("Unexpected exception: "+ne, ne); |
| | | throw new RuntimeException("Unexpected exception: "+ne, ne); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | throw new IllegalStateException("Unexpected error parsing DN: "+ |
| | | throw new RuntimeException("Unexpected error parsing DN: "+ |
| | | oldEntry.getDN(), de); |
| | | } |
| | | for (int i=0; i<oldRDN.getNumValues(); i++) |
| | |
| | | catch (Throwable t) |
| | | { |
| | | // Bug |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | } |
| | | return parentNode; |
| | |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new IllegalStateException("Could not parse DN: "+node.getDN(), ode); |
| | | throw new RuntimeException("Could not parse DN: "+node.getDN(), ode); |
| | | } |
| | | try |
| | | { |
| | |
| | | catch (NamingException ne) |
| | | { |
| | | // Bug |
| | | throw new IllegalStateException( |
| | | throw new RuntimeException( |
| | | "Unexpected error parsing modifications: "+ne, ne); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Unexpected error decoding dn "+ |
| | | throw new RuntimeException("Unexpected error decoding dn "+ |
| | | newBaseDn, t); |
| | | } |
| | | if (newElement != null) |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | if (baseDN.getEntries() > 0) |
| | | { |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | catch (Throwable t) |
| | | { |
| | | // Unexpected error: getEntry() should work after calling checkSyntax |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | String dn = entry.getDN().toString(); |
| | | // Checking for the existence of an entry is fast enough so we can do |
| | |
| | | catch (Throwable t) |
| | | { |
| | | // Unexpected error: getEntry() should work after calling checkSyntax |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | } |
| | | if (errors.size() > 0) |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | |
| | |
| | | catch (Throwable t) |
| | | { |
| | | // Bug |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | return confirm; |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | newElements.add(dn); |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new IllegalStateException( |
| | | throw new RuntimeException( |
| | | "Unexpected error decoding dn. Details: "+ode.getMessageObject(), |
| | | ode); |
| | | } |
| | |
| | | catch (Throwable t) |
| | | { |
| | | // Unexpected error: getEntry() should work after calling checkSyntax |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | } |
| | | if (errors.size() > 0) |
| | |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new IllegalStateException( |
| | | throw new RuntimeException( |
| | | "Unexpected error decoding dn. Details: "+ode.getMessageObject(), |
| | | ode); |
| | | } |
| | |
| | | entryPane.updateJavaInformation(); |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unknown node type: "+type); |
| | | throw new RuntimeException("Unknown node type: "+type); |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | else |
| | | { |
| | | throw new IllegalStateException("Unexpected tree node: "+value); |
| | | throw new RuntimeException("Unexpected tree node: "+value); |
| | | } |
| | | return icon; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | throw new IllegalStateException("Unexpected component: "+l); |
| | | throw new RuntimeException("Unexpected component: "+l); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | throw new IllegalStateException("Unexpected component: "+l); |
| | | throw new RuntimeException("Unexpected component: "+l); |
| | | } |
| | | } |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding DNs: "+t, t); |
| | | throw new RuntimeException("Error decoding DNs: "+t, t); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding DNs: "+t, t); |
| | | throw new RuntimeException("Error decoding DNs: "+t, t); |
| | | } |
| | | return isReadOnly; |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding DNs: "+t, t); |
| | | throw new RuntimeException("Error decoding DNs: "+t, t); |
| | | } |
| | | return canDelete; |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new IllegalStateException("Unexpected error decoding DN: "+ |
| | | throw new RuntimeException("Unexpected error decoding DN: "+ |
| | | member, ode); |
| | | } |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | catch (IOException ioe) |
| | | { |
| | | // This should not occur |
| | | throw new IllegalStateException("Unexpected error: "+ioe, ioe); |
| | | throw new RuntimeException("Unexpected error: "+ioe, ioe); |
| | | } |
| | | } |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | catch (IOException ioe) |
| | | { |
| | | // This should not occur |
| | | throw new IllegalStateException("Unexpected error: "+ioe, ioe); |
| | | throw new RuntimeException("Unexpected error: "+ioe, ioe); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | |
| | | } |
| | | catch (ParseException pe) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+pe); |
| | | throw new RuntimeException("Unexpected error: "+pe); |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | } |
| | | hmBaseDNs.put(backendID, baseDNs); |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | dns.add(dn); |
| | | SortedSet<AbstractIndexDescriptor> indexes = |
| | |
| | | int n = Integer.parseInt(stringValue); |
| | | if ((n > maxValue) || (n < minValue)) |
| | | { |
| | | throw new IllegalStateException("Invalid value"); |
| | | throw new RuntimeException("Invalid value"); |
| | | } |
| | | } |
| | | catch (Throwable t) |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | } |
| | | |
| | |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalStateException("Unknown status: "+desc.getStatus()); |
| | | throw new RuntimeException("Unknown status: "+desc.getStatus()); |
| | | } |
| | | return status.toString(); |
| | | } |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+t, t); |
| | | throw new RuntimeException("Unexpected error: "+t, t); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | throw new IllegalStateException("Unknown schedule type: "+type); |
| | | throw new RuntimeException("Unknown schedule type: "+type); |
| | | } |
| | | return schedule; |
| | | } |
| | |
| | | } |
| | | catch (OpenDsException odse) |
| | | { |
| | | throw new IllegalStateException("Unexpected error parsing DN "+ |
| | | throw new RuntimeException("Unexpected error parsing DN "+ |
| | | getBaseDN()+": "+odse, odse); |
| | | } |
| | | if (indexToModify.getScope() != scope) |
| | |
| | | } |
| | | catch (ParseException pe) |
| | | { |
| | | throw new IllegalStateException("Unexpected error: "+pe, pe); |
| | | throw new RuntimeException("Unexpected error: "+pe, pe); |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | else |
| | | { |
| | | throw new IllegalStateException("Unknown schedule type: "+type); |
| | | throw new RuntimeException("Unknown schedule type: "+type); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Could not decode DNs: "+t, t); |
| | | throw new RuntimeException("Could not decode DNs: "+t, t); |
| | | } |
| | | } |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | } |
| | | catch (OpenDsException oe) |
| | | { |
| | | throw new IllegalStateException("Error decoding DN of url: "+ |
| | | throw new RuntimeException("Error decoding DN of url: "+ |
| | | parentUrl); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (OpenDsException oe) |
| | | { |
| | | throw new IllegalStateException("Error decoding DN of url: "+ |
| | | throw new RuntimeException("Error decoding DN of url: "+ |
| | | url); |
| | | } |
| | | } |
| | |
| | | b = (byte) 0xF0; |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unexpected byte: "+escapedByte1); |
| | | throw new RuntimeException("Unexpected byte: "+escapedByte1); |
| | | } |
| | | |
| | | byte escapedByte2 = stringBytes[++i]; |
| | |
| | | b |= 0x0F; |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unexpected byte: "+escapedByte2); |
| | | throw new RuntimeException("Unexpected byte: "+escapedByte2); |
| | | } |
| | | |
| | | decodedBytes[pos++] = b; |
| | |
| | | catch (UnsupportedEncodingException uee) |
| | | { |
| | | // This is a bug, UTF-8 should be supported always by the JVM |
| | | throw new IllegalStateException("UTF-8 encoding not supported", uee); |
| | | throw new RuntimeException("UTF-8 encoding not supported", uee); |
| | | } |
| | | } |
| | | |