[jboss-cvs] JBossAS SVN: r106227 - in projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator: code and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jun 22 20:26:12 EDT 2010
Author: jeff.zhang
Date: 2010-06-22 20:26:12 -0400 (Tue, 22 Jun 2010)
New Revision: 106227
Added:
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/MethodParam.java
Modified:
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Main.java
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/MethodForConnection.java
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Utils.java
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/ConnImplCodeGen.java
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/ConnInterfaceCodeGen.java
projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/TestCodeGen.java
Log:
fix findbugs warning
Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Main.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Main.java 2010-06-22 19:42:29 UTC (rev 106226)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Main.java 2010-06-23 00:26:12 UTC (rev 106227)
@@ -437,7 +437,7 @@
System.out.println(BasicType.allType() + "]");
}
- MethodForConnection.Param param = method.newParam(paramName, paramType);
+ MethodParam param = method.newParam(paramName, paramType);
method.getParams().add(param);
}
Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/MethodForConnection.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/MethodForConnection.java 2010-06-22 19:42:29 UTC (rev 106226)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/MethodForConnection.java 2010-06-23 00:26:12 UTC (rev 106227)
@@ -37,58 +37,9 @@
/** type */
private String returnType = "void";
/** value */
- private List<Param> params = new ArrayList<Param>();
+ private List<MethodParam> params = new ArrayList<MethodParam>();
/** required */
private List<String> exceptionType = new ArrayList<String>();
-
- /** param */
- public class Param
- {
- /** name */
- private String name;
- /** type */
- private String type;
-
- /**
- * Set the name.
- *
- * @param name The name to set.
- */
- public void setName(String name)
- {
- this.name = name;
- }
-
- /**
- * Get the name.
- *
- * @return the name.
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Set the type.
- *
- * @param type The type to set.
- */
- public void setType(String type)
- {
- this.type = type;
- }
-
- /**
- * Get the type.
- *
- * @return the type.
- */
- public String getType()
- {
- return type;
- }
- }
/**
* new param
@@ -97,9 +48,9 @@
* @param type param type
* @return new param
*/
- public Param newParam(String name, String type)
+ public MethodParam newParam(String name, String type)
{
- Param p = new Param();
+ MethodParam p = new MethodParam();
p.setName(name);
p.setType(type);
return p;
@@ -150,7 +101,7 @@
*
* @param params The params to set.
*/
- public void setParams(List<Param> params)
+ public void setParams(List<MethodParam> params)
{
this.params = params;
}
@@ -160,7 +111,7 @@
*
* @return the params.
*/
- public List<Param> getParams()
+ public List<MethodParam> getParams()
{
return params;
}
Added: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/MethodParam.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/MethodParam.java (rev 0)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/MethodParam.java 2010-06-23 00:26:12 UTC (rev 106227)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.codegenerator;
+
+/**
+ * A MethodParam.
+ *
+ * @author Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class MethodParam
+{
+ /** name */
+ private String name;
+
+ /** type */
+ private String type;
+
+ /**
+ * Set the name.
+ *
+ * @param name The name to set.
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the name.
+ *
+ * @return the name.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Set the type.
+ *
+ * @param type The type to set.
+ */
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ /**
+ * Get the type.
+ *
+ * @return the type.
+ */
+ public String getType()
+ {
+ return type;
+ }
+}
Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Utils.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Utils.java 2010-06-22 19:42:29 UTC (rev 106226)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/Utils.java 2010-06-23 00:26:12 UTC (rev 106227)
@@ -222,7 +222,12 @@
*/
public static void copyFolder(String sourcePath, String targetPath, final String filterName) throws IOException
{
- new File(targetPath).mkdirs();
+ File path = new File(targetPath);
+ if (!path.exists())
+ {
+ if (!path.mkdirs())
+ throw new IOException("outdir can't be created");
+ }
File a = new File(sourcePath);
String[] file = a.list(new FilenameFilter()
{
Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/ConnImplCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/ConnImplCodeGen.java 2010-06-22 19:42:29 UTC (rev 106226)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/ConnImplCodeGen.java 2010-06-23 00:26:12 UTC (rev 106227)
@@ -23,6 +23,7 @@
import org.jboss.jca.codegenerator.Definition;
import org.jboss.jca.codegenerator.MethodForConnection;
+import org.jboss.jca.codegenerator.MethodParam;
import java.io.IOException;
import java.io.Writer;
@@ -122,7 +123,7 @@
int paramSize = method.getParams().size();
for (int i = 0; i < paramSize; i++)
{
- MethodForConnection.Param param = method.getParams().get(i);
+ MethodParam param = method.getParams().get(i);
out.write(param.getType());
out.write(" ");
out.write(param.getName());
Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/ConnInterfaceCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/ConnInterfaceCodeGen.java 2010-06-22 19:42:29 UTC (rev 106226)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/ConnInterfaceCodeGen.java 2010-06-23 00:26:12 UTC (rev 106227)
@@ -23,6 +23,7 @@
import org.jboss.jca.codegenerator.Definition;
import org.jboss.jca.codegenerator.MethodForConnection;
+import org.jboss.jca.codegenerator.MethodParam;
import java.io.IOException;
import java.io.Writer;
@@ -62,7 +63,7 @@
writeIndent(out, indent);
out.write(" * " + method.getMethodName());
writeEol(out);
- for (MethodForConnection.Param param : method.getParams())
+ for (MethodParam param : method.getParams())
{
writeIndent(out, indent);
out.write(" * @param " + param.getName() + " " + param.getName());
@@ -91,7 +92,7 @@
int paramSize = method.getParams().size();
for (int i = 0; i < paramSize; i++)
{
- MethodForConnection.Param param = method.getParams().get(i);
+ MethodParam param = method.getParams().get(i);
out.write(param.getType());
out.write(" ");
out.write(param.getName());
Modified: projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/TestCodeGen.java
===================================================================
--- projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/TestCodeGen.java 2010-06-22 19:42:29 UTC (rev 106226)
+++ projects/jboss-jca/trunk/codegenerator/src/main/java/org/jboss/jca/codegenerator/code/TestCodeGen.java 2010-06-23 00:26:12 UTC (rev 106227)
@@ -24,6 +24,7 @@
import org.jboss.jca.codegenerator.BasicType;
import org.jboss.jca.codegenerator.Definition;
import org.jboss.jca.codegenerator.MethodForConnection;
+import org.jboss.jca.codegenerator.MethodParam;
import java.io.IOException;
import java.io.Writer;
@@ -323,7 +324,7 @@
int paramSize = method.getParams().size();
for (int i = 0; i < paramSize; i++)
{
- MethodForConnection.Param param = method.getParams().get(i);
+ MethodParam param = method.getParams().get(i);
out.write(BasicType.defaultValue(param.getType()));
if (i + 1 < paramSize)
out.write(", ");
More information about the jboss-cvs-commits
mailing list