return new JpaSystemException(ex);
dbf.getEntityManager().refresh(vo); } catch (JpaSystemException e) { if (e.getRootCause() instanceof MySQLIntegrityConstraintViolationException && e.getRootCause().getMessage().contains("Duplicate entry")) {
private UsedIpInventory reserveIpv4(IpRangeInventory ipRange, String ip) { try { UsedIpVO vo = new UsedIpVO(ipRange.getUuid(), ip); vo.setIpInLong(NetworkUtils.ipv4StringToLong(ip)); String uuid = ipRange.getUuid() + ip; uuid = UUID.nameUUIDFromBytes(uuid.getBytes()).toString().replaceAll("-", ""); vo.setUuid(uuid); vo.setL3NetworkUuid(ipRange.getL3NetworkUuid()); vo.setNetmask(ipRange.getNetmask()); vo.setGateway(ipRange.getGateway()); vo.setIpVersion(IPv6Constants.IPv4); vo = dbf.persistAndRefresh(vo); return UsedIpInventory.valueOf(vo); } catch (JpaSystemException e) { if (e.getRootCause() instanceof MySQLIntegrityConstraintViolationException) { logger.debug(String.format("Concurrent ip allocation. " + "Ip[%s] in ip range[uuid:%s] has been allocated, try allocating another one. " + "The error[Duplicate entry] printed by jdbc.spi.SqlExceptionHelper is no harm, " + "we will try finding another ip", ip, ipRange.getUuid())); logger.trace("", e); } else { throw e; } return null; } }
return new JpaSystemException(ex);
private UsedIpInventory reserveIpv6(IpRangeInventory ipRange, String ip) { try { UsedIpVO vo = new UsedIpVO(); //vo.setIpInLong(NetworkUtils.ipv4StringToLong(ip)); String uuid = ipRange.getUuid() + ip; uuid = UUID.nameUUIDFromBytes(uuid.getBytes()).toString().replaceAll("-", ""); vo.setUuid(uuid); vo.setIpRangeUuid(ipRange.getUuid()); vo.setIp(IPv6NetworkUtils.getIpv6AddressCanonicalString(ip)); vo.setL3NetworkUuid(ipRange.getL3NetworkUuid()); vo.setNetmask(ipRange.getNetmask()); vo.setGateway(ipRange.getGateway()); vo.setIpVersion(IPv6Constants.IPv6); vo = dbf.persistAndRefresh(vo); return UsedIpInventory.valueOf(vo); } catch (JpaSystemException e) { if (e.getRootCause() instanceof MySQLIntegrityConstraintViolationException) { logger.debug(String.format("Concurrent ip allocation. " + "Ip[%s] in ip range[uuid:%s] has been allocated, try allocating another one. " + "The error[Duplicate entry] printed by jdbc.spi.SqlExceptionHelper is no harm, " + "we will try finding another ip", ip, ipRange.getUuid())); logger.trace("", e); } else { throw e; } return null; } }
throw new JpaSystemException(new IllegalArgumentException(String .format("Unexpected path type for %s. Found %s where From.class was expected.", currentPath, from)));
logger.info(String.format("create ldap binding[ldapUid=%s, ldapUseAsLoginName=%s] success", fullDn, ldapUseAsLoginName)); } catch (JpaSystemException e) { if (e.getRootCause() instanceof MySQLIntegrityConstraintViolationException) { evt.setError(err(LdapErrors.BIND_SAME_LDAP_UID_TO_MULTI_ACCOUNT, "The ldap uid has been bound to an account. "));
return new JpaSystemException(ex);
return new JpaSystemException(ex);
return new JpaSystemException(ex);
throw new JpaSystemException(new IllegalArgumentException(String .format("Unexpected path type for %s. Found %s where From.class was expected.", currentPath, from)));
return new JpaSystemException(ex);