Author: dgolovin
Date: 2011-09-22 13:56:18 -0400 (Thu, 22 Sep 2011)
New Revision: 34966
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
Log:
removed unused code and fixed PMD violations
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2011-09-22
17:31:23 UTC (rev 34965)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2011-09-22
17:56:18 UTC (rev 34966)
@@ -611,56 +611,16 @@
ArrayList l = new ArrayList();
while(st.hasMoreTokens()) {
String t = st.nextToken();
- if(t.length() == 0 || t.equals(".")) continue; //$NON-NLS-1$
- if(t.equals("..")) { //$NON-NLS-1$
- if(l.size() > 0) l.remove(l.size() - 1);
+ if(t.isEmpty() || ".".equals(t)) continue; //$NON-NLS-1$
+ if("..".equals(t)) { //$NON-NLS-1$
+ if(!l.isEmpty()) l.remove(l.size() - 1);
continue;
}
l.add(t);
}
- return (String[])l.toArray(new String[0]);
+ return (String[])l.toArray(new String[l.size()]);
}
-
- public static String encode(String text, String encoding) {
- if(true) return text;
- try {
- byte[] bs = text.getBytes(System.getProperty("file.encoding"));
//$NON-NLS-1$
- ByteArrayInputStream is = new ByteArrayInputStream(bs);
- InputStreamReader r = new InputStreamReader(is, encoding);
- char[] cs = new char[bs.length];
- int l = r.read(cs, 0, cs.length);
- return new String(cs, 0, l);
- } catch (IOException e) {
- if("UTF-8".equals(encoding)) return text; //$NON-NLS-1$
- return encode(text, "UTF-8"); //$NON-NLS-1$
- }
- }
- public static String encodeDefault(String text) {
- return encode(text, System.getProperties().getProperty("file.encoding"));
//$NON-NLS-1$
- }
-
-/*
- public static String decode(String text, String encoding) {
- if(true) return text;
- try {
- byte[] bs = text.getBytes(encoding);
- ByteArrayInputStream is = new ByteArrayInputStream(bs);
- InputStreamReader r = new InputStreamReader(is,
System.getProperties().getProperty("file.encoding"));
- char[] cs = new char[bs.length];
- int l = r.read(cs, 0, cs.length);
- return new String(cs, 0, l);
- } catch (Exception e) {
- if("UTF-8".equals(encoding)) return text;
- return decode(text, "UTF-8");
- }
- }
-
- public static String decodeDefault(String text) {
- return decode(text, System.getProperties().getProperty("file.encoding"));
- }
-*/
-
public static boolean writeFile(File f, String value, String encoding) {
try {
try {
Show replies by date