Index: src/main/java/org/glassfish/deployment/autodeploy/AutoDeployedFilesManager.java =================================================================== --- src/main/java/org/glassfish/deployment/autodeploy/AutoDeployedFilesManager.java (révision 21044) +++ src/main/java/org/glassfish/deployment/autodeploy/AutoDeployedFilesManager.java (copie de travail) @@ -248,7 +248,7 @@ * A marker class to indicate that the file is to be undeployed and then * deleted by the autodeployer. */ - protected class UndeployRequestedFile extends File { + protected static class UndeployRequestedFile extends File { public UndeployRequestedFile(File parent, String child) { super(parent, child); } Index: src/main/java/com/sun/enterprise/server/logging/FileandSyslogHandler.java =================================================================== --- src/main/java/com/sun/enterprise/server/logging/FileandSyslogHandler.java (révision 21044) +++ src/main/java/com/sun/enterprise/server/logging/FileandSyslogHandler.java (copie de travail) @@ -307,7 +307,7 @@ // A metered stream is a subclass of OutputStream that // (a) forwards all its output to a target stream // (b) keeps track of how many bytes have been written - private class MeteredStream extends OutputStream { + private static class MeteredStream extends OutputStream { OutputStream out; long written; Index: src/main/java/com/sun/enterprise/v3/services/impl/VsAdapter.java =================================================================== --- src/main/java/com/sun/enterprise/v3/services/impl/VsAdapter.java (révision 21044) +++ src/main/java/com/sun/enterprise/v3/services/impl/VsAdapter.java (copie de travail) @@ -261,13 +261,20 @@ res.addHeader("Server", "GlassFish/v3"); res.sendHeaders(); - FileInputStream fis = new FileInputStream(file); - byte b[] = new byte[8192]; - ByteChunk chunk = new ByteChunk(); - int rd = 0; - while ((rd = fis.read(b)) > 0) { - chunk.setBytes(b, 0, rd); - res.doWrite(chunk); + FileInputStream fis = null; + try { + fis = new FileInputStream(file); + byte b[] = new byte[8192]; + ByteChunk chunk = new ByteChunk(); + int rd = 0; + while ((rd = fis.read(b)) > 0) { + chunk.setBytes(b, 0, rd); + res.doWrite(chunk); + } + } finally { + if (fis != null) { + fis.close(); + } } try{ Index: src/main/java/com/sun/enterprise/v3/admin/adapter/Utils.java =================================================================== --- src/main/java/com/sun/enterprise/v3/admin/adapter/Utils.java (révision 21044) +++ src/main/java/com/sun/enterprise/v3/admin/adapter/Utils.java (copie de travail) @@ -43,13 +43,23 @@ static String packageResource2String(String name) throws IOException { String file = Utils.class.getPackage().getName().replace('.', '/') + "/" + name; InputStream is = Utils.class.getClassLoader().getResourceAsStream(file); - BufferedInputStream bis = new BufferedInputStream(is); - byte[] bytes = new byte[1024]; - int read; - StringBuffer sb = new StringBuffer(); - while ((read = bis.read(bytes)) != -1) { - sb.append(new String(bytes, 0, read, "UTF-8")); + BufferedInputStream bis = null; + try { + bis = new BufferedInputStream(is); + byte[] bytes = new byte[1024]; + int read; + StringBuffer sb = new StringBuffer(); + while ((read = bis.read(bytes)) != -1) { + sb.append(new String(bytes, 0, read, "UTF-8")); + } + return ( sb.toString()); + } finally { + if (bis != null) { + bis.close(); + } + if (is != null) { + is.close(); + } } - return ( sb.toString()); } } Index: src/main/java/com/sun/enterprise/v3/admin/ResourcesXMLParser.java =================================================================== --- src/main/java/com/sun/enterprise/v3/admin/ResourcesXMLParser.java (révision 21044) +++ src/main/java/com/sun/enterprise/v3/admin/ResourcesXMLParser.java (copie de travail) @@ -1126,7 +1126,7 @@ } - class AddResourcesErrorHandler implements ErrorHandler { + static class AddResourcesErrorHandler implements ErrorHandler { public void error(SAXParseException e) throws org.xml.sax.SAXException{ throw e ; } Index: src/main/java/com/sun/enterprise/v3/admin/AdminAdapter.java =================================================================== --- src/main/java/com/sun/enterprise/v3/admin/AdminAdapter.java (révision 21044) +++ src/main/java/com/sun/enterprise/v3/admin/AdminAdapter.java (copie de travail) @@ -329,7 +329,7 @@ * This class constructs a unique temporary directory, then creates one * temp file per ZipEntry in the stream to hold the uploaded content. */ - private class UploadedFilesInfo { + private static class UploadedFilesInfo { private File tempFolder = null; private ArrayList uploadedFiles; Index: src/main/java/com/sun/enterprise/v3/admin/ListCommandDescriptorsCommand.java =================================================================== --- src/main/java/com/sun/enterprise/v3/admin/ListCommandDescriptorsCommand.java (révision 21044) +++ src/main/java/com/sun/enterprise/v3/admin/ListCommandDescriptorsCommand.java (copie de travail) @@ -65,11 +65,11 @@ cliCmds.add(reflect(cmd)); } ActionReport report = context.getActionReport(); - String s = "ALL COMMANDS: " + EOL; + StringBuffer sb = new StringBuffer("ALL COMMANDS: ").append(EOL); for(CLICommand cli : cliCmds) { - s += cli.toString() + EOL; + sb.append(cli.toString()).append(EOL); } - report.setMessage(s); + report.setMessage(sb.toString()); report.setActionExitCode(ActionReport.ExitCode.SUCCESS); } @@ -193,14 +193,14 @@ @Override public String toString() { - String s = "CLI Command:" + - " name=" + name + - " class=" + adminCommand.getClass().getName(); + StringBuffer sb = new StringBuffer("CLI Command:") + .append(" name=").append(name) + .append(" class=").append(adminCommand.getClass().getName()); for(Option opt : options) { - s += opt.toString() + EOL; + sb.append(opt.toString()).append(EOL); } - return s; + return sb.toString(); } AdminCommand adminCommand;