List of usage examples for java.lang CloneNotSupportedException getLocalizedMessage
public String getLocalizedMessage()
From source file:com.ebay.jetstream.event.processor.esper.EsperEventListener.java
protected void fireSendEvent(JetstreamEvent event) throws EventException { if (LOGGER.isDebugEnabled()) event.log(this); JetstreamEvent fwdEvent = event;/*from ww w . j a v a2s. c o m*/ EventSink[] aSinks = (EventSink[]) event.remove("sink.array"); if (aSinks != null) { for (EventSink sink : aSinks) { // BUG FIX - SRM (1/14/2014) - every event has to be cloned as there is a chance that same event might // be annotated differently in multiple statements try { fwdEvent = event.clone(); if (fwdEvent == null) m_cloneFailedCounter.increment(); } catch (CloneNotSupportedException e) { m_cloneFailedCounter.increment(); LOGGER.error("unable to clone event : " + e.getLocalizedMessage()); fwdEvent = null; } if (fwdEvent != null) sink.sendEvent(fwdEvent); } } else { Collection<EventSink> sinks = getEventSinks(); if (sinks.size() <= 0 && getPausedEventSink().size() > 0) throw new EventException("All Event Sinks are paused.....", JetstreamErrorCodes.EVENT_SINKS_PAUSED.toString()); for (EventSink sink : sinks) { sink.sendEvent(event); } } }
From source file:com.rockhoppertech.music.scale.Scale.java
@Override public Object clone() { Scale result = null;/*from w w w . j a va2s . c o m*/ try { // copy the bitwise primitives result = (Scale) super.clone(); if (spelling != null) { result.spelling = spelling; } if (name != null) { result.name = name; } if (description != null) { result.description = description; } result.aliases.addAll(aliases); } catch (final CloneNotSupportedException e) { logger.error(e.getLocalizedMessage(), e); } return result; }
From source file:com.rockhoppertech.music.chord.Chord.java
@Override public Object clone() { Chord result = null;//from w ww.java 2 s.c o m try { // copy the bitwise primitives result = (Chord) super.clone(); result.symbol = this.symbol; result.description = this.description; if (this.spelling != null) { result.spelling = this.spelling; // what about intervals? } // result.chordVoicing = new ChordVoicing(this.root / 12, // this.chordVoicing.getDisplayName()); result.chordVoicing = new ChordVoicing(this.chordVoicing.getDisplayName()); // to hell with the rest // if (this.notelist != null) // result.notelist = new MIDITrack(this.notelist); } catch (final CloneNotSupportedException e) { logger.error(e.getLocalizedMessage(), e); } return result; }
From source file:org.apache.ambari.server.controller.KerberosHelperImpl.java
@Override public void setAuthToLocalRules(KerberosDescriptor kerberosDescriptor, Cluster cluster, String realm, Map<String, Map<String, String>> existingConfigurations, Map<String, Map<String, String>> kerberosConfigurations) throws AmbariException { boolean processAuthToLocalRules = true; Map<String, String> kerberosEnvProperties = existingConfigurations.get("kerberos-env"); if (kerberosEnvProperties.containsKey("manage_auth_to_local")) { processAuthToLocalRules = Boolean.valueOf(kerberosEnvProperties.get("manage_auth_to_local")); }//from w w w . j a va2 s . c om if (kerberosDescriptor != null && processAuthToLocalRules) { Set<String> authToLocalProperties; Set<String> authToLocalPropertiesToSet = new HashSet<String>(); // a flag to be used by the AuthToLocalBuilder marking whether the default realm rule should contain the //L option, indicating username case insensitive behaviour // the 'kerberos-env' structure is expected to be available here as it was previously validated boolean caseInsensitiveUser = Boolean .valueOf(existingConfigurations.get("kerberos-env").get("case_insensitive_username_rules")); // Additional realms that need to be handled according to the Kerberos Descriptor String additionalRealms = kerberosDescriptor.getProperty("additional_realms"); // Determine which properties need to be set AuthToLocalBuilder authToLocalBuilder = new AuthToLocalBuilder(realm, additionalRealms, caseInsensitiveUser); addIdentities(authToLocalBuilder, kerberosDescriptor.getIdentities(), null, existingConfigurations); authToLocalProperties = kerberosDescriptor.getAuthToLocalProperties(); if (authToLocalProperties != null) { authToLocalPropertiesToSet.addAll(authToLocalProperties); } Map<String, KerberosServiceDescriptor> services = kerberosDescriptor.getServices(); if (services != null) { Map<String, Service> installedServices = cluster.getServices(); for (KerberosServiceDescriptor service : services.values()) { if (installedServices.containsKey(service.getName())) { Service svc = installedServices.get(service.getName()); addIdentities(authToLocalBuilder, service.getIdentities(true), null, existingConfigurations); authToLocalProperties = service.getAuthToLocalProperties(); if (authToLocalProperties != null) { authToLocalPropertiesToSet.addAll(authToLocalProperties); } Map<String, KerberosComponentDescriptor> components = service.getComponents(); if (components != null) { Map<String, ServiceComponent> serviceComponents = svc.getServiceComponents(); for (KerberosComponentDescriptor component : components.values()) { // When the cluster is provisioned by a Blueprint service components with // cardinality 0+ might be left out from the Blueprint thus we have to check // if they exist ServiceComponent svcComp = null; if (!serviceComponents.containsKey(component.getName())) continue; svcComp = serviceComponents.get(component.getName()); boolean addSvcCompIdentities = false; if (cluster.isBluePrintDeployed()) { if (svcComp.getDesiredState() == State.INSTALLED || svcComp.getDesiredState() == State.STARTED) addSvcCompIdentities = true; } else { // Since when the cluster is deployed through the UI ALL service components of the selected services are created // with desired state INSTALLED regardless whether the service components were associated with hosts or not thus // we can not determine if the component is installed or not. // We rather look at service compoent hosts for (ServiceComponentHost svcCompHost : svcComp.getServiceComponentHosts() .values()) { if (svcCompHost.getDesiredState() != State.UNKNOWN && svcCompHost.getDesiredState() != State.UNINSTALLING && svcCompHost.getDesiredState() != State.UNINSTALLED && svcCompHost.getDesiredState() != State.INSTALL_FAILED && svcCompHost.getDesiredState() != State.WIPING_OUT) { // If there is at least a host that contains the component add the identities addSvcCompIdentities = true; break; } } } if (addSvcCompIdentities) { LOG.info("Adding identity for " + component.getName() + " to auth to local mapping"); addIdentities(authToLocalBuilder, component.getIdentities(true), null, existingConfigurations); authToLocalProperties = component.getAuthToLocalProperties(); if (authToLocalProperties != null) { authToLocalPropertiesToSet.addAll(authToLocalProperties); } } } } } } } if (!authToLocalPropertiesToSet.isEmpty()) { for (String authToLocalProperty : authToLocalPropertiesToSet) { Matcher m = KerberosDescriptor.AUTH_TO_LOCAL_PROPERTY_SPECIFICATION_PATTERN .matcher(authToLocalProperty); if (m.matches()) { AuthToLocalBuilder builder; try { builder = (AuthToLocalBuilder) authToLocalBuilder.clone(); } catch (CloneNotSupportedException e) { LOG.error("Failed to clone the AuthToLocalBuilder: " + e.getLocalizedMessage(), e); throw new AmbariException( "Failed to clone the AuthToLocalBuilder: " + e.getLocalizedMessage(), e); } String configType = m.group(1); String propertyName = m.group(2); if (configType == null) { configType = ""; } // Add existing auth_to_local configuration, if set Map<String, String> existingConfiguration = existingConfigurations.get(configType); if (existingConfiguration != null) { builder.addRules(existingConfiguration.get(propertyName)); } // Add/update descriptor auth_to_local configuration, if set Map<String, String> kerberosConfiguration = kerberosConfigurations.get(configType); if (kerberosConfiguration != null) { builder.addRules(kerberosConfiguration.get(propertyName)); } else { kerberosConfiguration = new HashMap<String, String>(); kerberosConfigurations.put(configType, kerberosConfiguration); } kerberosConfiguration.put(propertyName, builder.generate(AuthToLocalBuilder.ConcatenationType.translate(m.group(3)))); } } } } }