You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/01/04 18:41:09 UTC
svn commit: r608937 - in /ant/ivy/core/trunk/src/java/org/apache/ivy/util:
CopyProgressEvent.java Credentials.java CredentialsUtil.java HostUtil.java
PropertiesFile.java XMLHelper.java
Author: xavier
Date: Fri Jan 4 09:40:48 2008
New Revision: 608937
URL: http://svn.apache.org/viewvc?rev=608937&view=rev
Log:
fix style
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressEvent.java
ant/ivy/core/trunk/src/java/org/apache/ivy/util/Credentials.java
ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java
ant/ivy/core/trunk/src/java/org/apache/ivy/util/HostUtil.java
ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java
ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressEvent.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressEvent.java?rev=608937&r1=608936&r2=608937&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressEvent.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/CopyProgressEvent.java Fri Jan 4 09:40:48 2008
@@ -21,11 +21,11 @@
* Event reporting a stream copy progression
*/
public class CopyProgressEvent {
- private long _totalReadBytes;
+ private long totalReadBytes;
- private byte[] _buffer;
+ private byte[] buffer;
- private int _readBytes;
+ private int readBytes;
public CopyProgressEvent() {
}
@@ -39,22 +39,22 @@
}
protected CopyProgressEvent update(byte[] buffer, int read, long total) {
- _buffer = buffer;
- _readBytes = read;
- _totalReadBytes = total;
+ this.buffer = buffer;
+ this.readBytes = read;
+ this.totalReadBytes = total;
return this;
}
public long getTotalReadBytes() {
- return _totalReadBytes;
+ return totalReadBytes;
}
public byte[] getBuffer() {
- return _buffer;
+ return buffer;
}
public int getReadBytes() {
- return _readBytes;
+ return readBytes;
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/Credentials.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/Credentials.java?rev=608937&r1=608936&r2=608937&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/Credentials.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/Credentials.java Fri Jan 4 09:40:48 2008
@@ -21,35 +21,35 @@
*
*/
public class Credentials {
- private String _realm;
+ private String realm;
- private String _host;
+ private String host;
- private String _userName;
+ private String userName;
- private String _passwd;
+ private String passwd;
public Credentials(String realm, String host, String userName, String passwd) {
- _realm = realm;
- _host = host;
- _userName = userName;
- _passwd = passwd;
+ this.realm = realm;
+ this.host = host;
+ this.userName = userName;
+ this.passwd = passwd;
}
public String getHost() {
- return _host;
+ return host;
}
public String getPasswd() {
- return _passwd;
+ return passwd;
}
public String getRealm() {
- return _realm;
+ return realm;
}
public String getUserName() {
- return _userName;
+ return userName;
}
public static String buildKey(String realm, String host) {
@@ -69,11 +69,11 @@
}
private String getPasswdAsStars() {
- if (_passwd == null) {
+ if (passwd == null) {
return null;
}
StringBuffer sb = new StringBuffer();
- for (int i = _passwd.length(); i > 0; i--) {
+ for (int i = passwd.length(); i > 0; i--) {
sb.append('*');
}
return sb.toString();
@@ -97,6 +97,6 @@
}
public String getKey() {
- return buildKey(_realm, _host);
+ return buildKey(realm, host);
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java?rev=608937&r1=608936&r2=608937&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java Fri Jan 4 09:40:48 2008
@@ -36,14 +36,16 @@
import org.apache.ivy.Ivy;
-public class CredentialsUtil {
+public final class CredentialsUtil {
private static final class CredentialPanel extends JPanel {
- JTextField userNameField = new JTextField(20);
+ private static final int FIELD_LENGTH = 20;
- JTextField passwordField = new JPasswordField(20);
+ private JTextField userNameField = new JTextField(FIELD_LENGTH);
- JCheckBox rememberDataCB = new JCheckBox("remember my information");
+ private JTextField passwordField = new JPasswordField(FIELD_LENGTH);
+
+ private JCheckBox rememberDataCB = new JCheckBox("remember my information");
CredentialPanel(Credentials credentials, File passfile) {
GridBagLayout layout = new GridBagLayout();
@@ -119,6 +121,7 @@
try {
fos.close();
} catch (Exception e) {
+ // ignored
}
}
}
@@ -151,6 +154,7 @@
try {
fis.close();
} catch (IOException e) {
+ // ignored
}
}
}
@@ -158,4 +162,6 @@
return c;
}
+ private CredentialsUtil() {
+ }
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/HostUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/HostUtil.java?rev=608937&r1=608936&r2=608937&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/HostUtil.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/HostUtil.java Fri Jan 4 09:40:48 2008
@@ -24,11 +24,12 @@
* This class contains basic helper methods for the Host.
*
*/
-public class HostUtil {
+public final class HostUtil {
/**
* This default constructor is to hide this class from initialization through other classes.
*/
- private HostUtil() {}
+ private HostUtil() {
+ }
/**
* This method returns the name of the current Host, if this name cannot be determined,
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java?rev=608937&r1=608936&r2=608937&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java Fri Jan 4 09:40:48 2008
@@ -27,20 +27,20 @@
* A simple Properties extension easing the loading and saving of data
*/
public class PropertiesFile extends Properties {
- private File _file;
+ private File file;
- private String _header;
+ private String header;
public PropertiesFile(File file, String header) {
- _file = file;
- _header = header;
- if (_file.exists()) {
+ this.file = file;
+ this.header = header;
+ if (file.exists()) {
FileInputStream fis = null;
try {
- fis = new FileInputStream(_file);
+ fis = new FileInputStream(file);
load(fis);
} catch (Exception ex) {
- Message.warn("exception occured while reading properties file " + _file + ": "
+ Message.warn("exception occured while reading properties file " + file + ": "
+ ex.getMessage());
}
try {
@@ -48,6 +48,7 @@
fis.close();
}
} catch (IOException e) {
+ // ignored
}
}
}
@@ -55,13 +56,13 @@
public void save() {
FileOutputStream fos = null;
try {
- if (_file.getParentFile() != null && !_file.getParentFile().exists()) {
- _file.getParentFile().mkdirs();
+ if (file.getParentFile() != null && !file.getParentFile().exists()) {
+ file.getParentFile().mkdirs();
}
- fos = new FileOutputStream(_file);
- store(fos, _header);
+ fos = new FileOutputStream(file);
+ store(fos, header);
} catch (Exception ex) {
- Message.warn("exception occured while writing properties file " + _file + ": "
+ Message.warn("exception occured while writing properties file " + file + ": "
+ ex.getMessage());
}
try {
@@ -69,6 +70,7 @@
fos.close();
}
} catch (IOException e) {
+ // ignored
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java?rev=608937&r1=608936&r2=608937&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java Fri Jan 4 09:40:48 2008
@@ -32,39 +32,41 @@
import org.xml.sax.helpers.DefaultHandler;
public abstract class XMLHelper {
- private static SAXParserFactory _validatingFactory = SAXParserFactory.newInstance();
+ private static final SAXParserFactory VALIDATING_FACTORY = SAXParserFactory.newInstance();
- private static SAXParserFactory _factory = SAXParserFactory.newInstance();
+ private static final SAXParserFactory FACTORY = SAXParserFactory.newInstance();
- static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ static final String JAXP_SCHEMA_LANGUAGE
+ = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
- static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+ static final String JAXP_SCHEMA_SOURCE
+ = "http://java.sun.com/xml/jaxp/properties/schemaSource";
static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
- private static boolean _canUseSchemaValidation = true;
+ private static boolean canUseSchemaValidation = true;
static {
- _validatingFactory.setNamespaceAware(true);
- _validatingFactory.setValidating(true);
+ VALIDATING_FACTORY.setNamespaceAware(true);
+ VALIDATING_FACTORY.setValidating(true);
}
private static SAXParser newSAXParser(URL schema, InputStream schemaStream)
throws ParserConfigurationException, SAXException {
- if (!_canUseSchemaValidation || schema == null) {
- return _factory.newSAXParser();
+ if (!canUseSchemaValidation || schema == null) {
+ return FACTORY.newSAXParser();
}
try {
- SAXParser parser = _validatingFactory.newSAXParser();
+ SAXParser parser = VALIDATING_FACTORY.newSAXParser();
parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
parser.setProperty(JAXP_SCHEMA_SOURCE, schemaStream);
return parser;
} catch (SAXNotRecognizedException ex) {
- System.err
- .println("WARNING: problem while setting JAXP validating property on SAXParser... XML validation will not be done: "
- + ex.getMessage());
- _canUseSchemaValidation = false;
- return _factory.newSAXParser();
+ System.err.println(
+ "WARNING: problem while setting JAXP validating property on SAXParser... "
+ + "XML validation will not be done: " + ex.getMessage());
+ canUseSchemaValidation = false;
+ return FACTORY.newSAXParser();
}
}
@@ -77,7 +79,8 @@
parse(xmlURL, schema, handler, null);
}
- public static void parse(URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler)
+ public static void parse(
+ URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler)
throws SAXException, IOException, ParserConfigurationException {
InputStream xmlStream = URLHandlerRegistry.getDefault().openStream(xmlURL);
try {
@@ -86,12 +89,14 @@
try {
xmlStream.close();
} catch (IOException e) {
+ // ignored
}
}
}
- public static void parse(InputStream xmlStream, URL schema, DefaultHandler handler,
- LexicalHandler lHandler) throws SAXException, IOException, ParserConfigurationException {
+ public static void parse(
+ InputStream xmlStream, URL schema, DefaultHandler handler, LexicalHandler lHandler)
+ throws SAXException, IOException, ParserConfigurationException {
InputStream schemaStream = null;
try {
if (schema != null) {
@@ -103,8 +108,8 @@
try {
parser.setProperty("http://xml.org/sax/properties/lexical-handler", lHandler);
} catch (SAXException ex) {
- System.err
- .println("WARNING: problem while setting the lexical handler property on SAXParser: "
+ System.err.println(
+ "WARNING: problem while setting the lexical handler property on SAXParser: "
+ ex.getMessage());
// continue without the lexical handler
}
@@ -116,13 +121,14 @@
try {
schemaStream.close();
} catch (IOException ex) {
+ // ignored
}
}
}
}
public static boolean canUseSchemaValidation() {
- return _canUseSchemaValidation;
+ return canUseSchemaValidation;
}
/**
@@ -167,4 +173,6 @@
return result.toString();
}
+ private XMLHelper() {
+ }
}