You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2016/03/04 19:50:27 UTC

svn commit: r1733635 - /uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/ConvertSafely.java

Author: degenaro
Date: Fri Mar  4 18:50:27 2016
New Revision: 1733635

URL: http://svn.apache.org/viewvc?rev=1733635&view=rev
Log:
UIMA-4815 DUCC Web Server (WS) System Machines page re-imagined

Added:
    uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/ConvertSafely.java   (with props)

Added: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/ConvertSafely.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/ConvertSafely.java?rev=1733635&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/ConvertSafely.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/ConvertSafely.java Fri Mar  4 18:50:27 2016
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.common;
+
+public class ConvertSafely {
+
+	/**
+	 * Convert String to long, else zero
+	 */
+	public static long String2Long(String value) {
+		long retVal = 0;
+		try{
+			retVal = Long.parseLong(value);
+		}
+		catch(Exception e) {
+			// oh well
+		}
+		return retVal;
+	}
+	
+	/**
+	 * Convert String to double, else zero
+	 */
+	public static double String2Double(String value) {
+		double retVal = 0;
+		try{
+			retVal = Double.parseDouble(value);
+		}
+		catch(Exception e) {
+			// oh well
+		}
+		return retVal;
+	}
+	
+}

Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/ConvertSafely.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/ConvertSafely.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain