Project

General

Profile

« Previous | Next » 

Revision b918ca5d

Added by Andreas Müller over 15 years ago

solve warnings for cdmlib-commons

View differences:

cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/AccountStore.java
12 12
import java.io.File;
13 13
import java.io.FileInputStream;
14 14
import java.io.FileOutputStream;
15
import java.io.FileWriter;
16 15
import java.io.IOException;
17 16
import java.util.Properties;
18 17

  
......
88 87
	}
89 88
	
90 89
	public void removePassword(String dbms, String strServer, String userName){
91
		FileWriter out;
92 90
		String key = strServer+'.'+dbms+'.'+userName;
93 91
		Properties accounts = loadAccounts();
94 92
		accounts.remove(key);
......
111 109
			// on success store userName, pwd in property file
112 110
			if(doStore){
113 111
				accounts.setPassword(dbms, strServer, userName, pwd);
114
				logger.info("password stored in " + accounts.getAccountsFileName());
112
				logger.info("password stored in " + AccountStore.getAccountsFileName());
115 113
			}
116 114
		} catch (Exception e) {
117 115
			if(doStore){
118 116
				accounts.removePassword(dbms, strServer, userName);
119
				logger.info("password removed from " + accounts.getAccountsFileName());
117
				logger.info("password removed from " + AccountStore.getAccountsFileName());
120 118
			}
121 119
			logger.error(e);
122 120
			return null;
......
129 127
//		BerlinModel - EditWp6
130 128
		String dbms = "SQLServer";
131 129
		String strServer = "BGBM111";
132
		String strDB = "EditWP6";
133
		int port = 1247;
134 130
		String userName = "webUser";
135 131
		a.setPassword(dbms, strServer, userName, "psst");
136 132
		logger.info(a.getPassword(dbms, strServer, userName));
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/CdmUtils.java
78 78
	 * @param clazz
79 79
	 * @return
80 80
	 */
81
	static public String findLibrary(Class clazz){
81
	static public String findLibrary(Class<?> clazz){
82 82
		String result = null;
83 83
		if (clazz != null){
84 84
			String fullPackageName = clazz.getCanonicalName();
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/DoubleResult.java
25 25
	
26 26
	public DoubleResult() {
27 27
		super();
28
		if (logger.isDebugEnabled()){logger.debug("Constructor");}
28 29
	}
29 30

  
30 31
	
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/ExcelUtils.java
76 76
    		}
77 77

  
78 78
    	} catch(Exception ioe) {
79
    		if (logger.isDebugEnabled()){logger.debug("Exception");}
79 80
    		ioe.printStackTrace();
80 81
    	}
81 82
    	return recordList;
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/MediaMetaData.java
2 2
package eu.etaxonomy.cdm.common;
3 3

  
4 4
import java.io.File;
5
import java.io.FileInputStream;
6 5
import java.io.IOException;
7 6
import java.io.InputStream;
8 7
import java.net.URL;
9 8
import java.net.URLConnection;
10 9

  
11 10
import org.apache.log4j.Logger;
12
import org.apache.sanselan.ImageFormat;
13 11
import org.apache.sanselan.ImageInfo;
14 12
import org.apache.sanselan.ImageReadException;
15 13
import org.apache.sanselan.Sanselan;
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/XmlHelp.java
72 72
	
73 73
	static public Element getFirstAttributedChild(Element parent, String elementName, String attributeName, String attributeValue){
74 74
		Namespace ns = parent.getNamespace();
75
		List<Element> elList = parent.getChildren(elementName, ns);
75
		
76
		List<Element> elList = getChildren(parent, elementName, ns);
76 77
		for (Element el : elList){
77 78
			Attribute attr =  el.getAttribute(attributeName);
78 79
			if (attr != null && attr.getValue().equalsIgnoreCase(attributeValue)){
......
85 86
	static public List<Element> getAttributedChildList(Element parent, String elementName, String attributeName){
86 87
		List<Element> resultList = new ArrayList<Element>();
87 88
		Namespace ns = parent.getNamespace();
88
		List<Element> elList = parent.getChildren(elementName, ns);
89
		List<Element> elList = getChildren(parent, elementName, ns);
89 90
		for (Element el : elList){
90 91
			Attribute attr =  el.getAttribute(attributeName);
91 92
			if (attr != null){
......
94 95
		}
95 96
		return resultList;
96 97
	}
98

  
99
	@SuppressWarnings("unchecked")
100
	private static List<Element> getChildren(Element parent, String elementName,Namespace ns) {
101
		return parent.getChildren(elementName, ns);
102
	}
97 103
	
98 104
	public static String getChildAttributeValue(Element element, String childElementName, Namespace childElementNamespace, String childAttributeName, Namespace childAttributeNamespace){
99 105
		Element child = element.getChild(childElementName, childElementNamespace);
......
249 255
			logger.warn("Parent element is null");
250 256
			return result;
251 257
		}
252
		List<Element> elList = parentElement.getChildren(childName, nsChild);
258
		List<Element> elList = getChildren(parentElement, childName, nsChild);
253 259
		if (elList.size() > 1){
254 260
			logger.error("Multiple '" + childName + "' elements.");
255 261
			return result;		
......
273 279
			success.setValue(false);
274 280
			return null;
275 281
		}
276
		List<Element> elList = parentElement.getChildren(childName, nsChild);
282
		List<Element> elList = getChildren(parentElement, childName, nsChild);
277 283
		if (elList.size() > 1){
278 284
			logger.error("Multiple '" + childName + "' elements.");
279 285
			success.setValue(false);

Also available in: Unified diff