&& (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { try { return createLong(numeric); } catch (NumberFormatException nfe) { return createLong(str); } catch (NumberFormatException nfe) {
private Long getAvatarId(HttpServletRequest request) throws NumberFormatException { return NumberUtils.createLong(request.getParameter("avatarId")); }
@Inject public ArchivaRuntimeInfo( @Named( value = "archivaRuntimeProperties" ) Properties archivaRuntimeProperties ) { this.version = (String) archivaRuntimeProperties.get( "archiva.version" ); this.buildNumber = (String) archivaRuntimeProperties.get( "archiva.buildNumber" ); String archivaTimeStamp = (String) archivaRuntimeProperties.get( "archiva.timestamp" ); if ( NumberUtils.isNumber( archivaTimeStamp ) ) { this.timestamp = NumberUtils.createLong( archivaTimeStamp ); } else { this.timestamp = new Date().getTime(); } this.devMode = Boolean.getBoolean( "archiva.devMode" ); }
@Inject public ArchivaRuntimeInfo( @Named( value = "archivaRuntimeProperties" ) Properties archivaRuntimeProperties ) { this.version = (String) archivaRuntimeProperties.get( "archiva.version" ); this.buildNumber = (String) archivaRuntimeProperties.get( "archiva.buildNumber" ); String archivaTimeStamp = (String) archivaRuntimeProperties.get( "archiva.timestamp" ); if ( NumberUtils.isNumber( archivaTimeStamp ) ) { this.timestamp = NumberUtils.createLong( archivaTimeStamp ); } else { this.timestamp = new Date().getTime(); } this.devMode = Boolean.getBoolean( "archiva.devMode" ); }
/** * 文本转换到整数Long * * @param o * @param defaultValue * @return */ public static long toLong(String o, Long defaultValue) { if (isBlank(o)) return defaultValue;// 空白则返回默认值,即便默认值为null也返回null try { return NumberUtils.createLong(o); } catch (NumberFormatException e) { if (defaultValue == null)// 默认值为null,且数值非法的情况下抛出异常 throw e; return defaultValue; } }
} else if (Long.class.equals(untypedValueClass)) { if (isStringTypedValue) v = NumberUtils.createLong(strTypedValue); else if (isNumberTypedValue) v = new Long(numTypedValue.longValue());
/** * Retrieve the KualiWorkflowDocument base on documentNumber * * @param documentNumber * @return */ private static KualiWorkflowDocument getKualiWorkflowDocument(String documentNumber) { KualiWorkflowDocument workflowDocument = null; WorkflowDocumentService workflowDocumentService = SpringContext.getBean(WorkflowDocumentService.class); // we need to use the system user here, since this code could be called within the // context of workflow, where there is no user session Person person = SpringContext.getBean(PersonService.class).getPersonByPrincipalName(KNSConstants.SYSTEM_USER); try { workflowDocument = workflowDocumentService.createWorkflowDocument(NumberUtils.createLong(documentNumber), person); } catch (WorkflowException ex) { throw new RuntimeException("Error to retrieve workflow document: " + documentNumber, ex); } return workflowDocument ; }
} else if (Long.class.equals(untypedValueClass)) { if (isStringTypedValue) v = NumberUtils.createLong(strTypedValue); else if (isNumberTypedValue) v = new Long(numTypedValue.longValue());
&& (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { try { return createLong(numeric); } catch (NumberFormatException nfe) { return createLong(str); } catch (NumberFormatException nfe) {
&& (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { try { return createLong(numeric); } catch (NumberFormatException nfe) { return createLong(str); } catch (NumberFormatException nfe) {
&& (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { try { return createLong(numeric); } catch (NumberFormatException nfe) { return createLong(str); } catch (NumberFormatException nfe) {
&& (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { try { return createLong(numeric); } catch (NumberFormatException nfe) { return createLong(str); } catch (NumberFormatException nfe) {
&& (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { try { return createLong(numeric); } catch (NumberFormatException nfe) { return createLong(str); } catch (NumberFormatException nfe) {