public static boolean isValid(String path) { if (path == null) { return false; } for(int i = 0; i < path.length(); i++) { char ch = path.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch)) { return false; } } return true; }
public static boolean isValid(String path) { if (path == null) { return false; } for(int i = 0; i < path.length(); i++) { char ch = path.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch)) { return false; } } return true; }
public static boolean isValid(String path) { if (path == null) { return false; } for(int i = 0; i < path.length(); i++) { char ch = path.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch)) { return false; } } return true; }
protected boolean writeString(Writer writer, String str, int emptyFields) throws IOException { if (str != null && str.length() > 0) { for (int i = 0; i < emptyFields; i++) { writer.write('\n'); } for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch) || ch == '\\') { writer.write("\\x"); writer.write(SVNFormatUtil.getHexNumberFromByte((byte)ch)); } else { writer.write(ch); } } writer.write('\n'); return true; } return false; }
public static String fuzzyEscape(String str) { byte[] bytes = str.getBytes(); // native encoding StringBuffer result = createStringBuffer(str, 0); for (int i = 0; i < bytes.length; i++) { if (!isASCIIControlChar((char) bytes[i]) || bytes[i] == '\r' || bytes[i] == '\n' || bytes[i] == '\t') { result.append((char) bytes[i]); } else { result.append("?\\"); int code = bytes[i] & 0xFF; if (code < 100) { result.append('0'); } result.append(code); } } return result.toString(); }
public static String fuzzyEscape(String str) { byte[] bytes = str.getBytes(); // native encoding StringBuffer result = createStringBuffer(str, 0); for (int i = 0; i < bytes.length; i++) { if (!isASCIIControlChar((char) bytes[i]) || bytes[i] == '\r' || bytes[i] == '\n' || bytes[i] == '\t') { result.append((char) bytes[i]); } else { result.append("?\\"); int code = bytes[i] & 0xFF; if (code < 100) { result.append('0'); } result.append(code); } } return result.toString(); }
protected boolean writeString(Writer writer, String str, int emptyFields) throws IOException { if (str != null && str.length() > 0) { for (int i = 0; i < emptyFields; i++) { writer.write('\n'); } for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch) || ch == '\\') { writer.write("\\x"); writer.write(SVNFormatUtil.getHexNumberFromByte((byte)ch)); } else { writer.write(ch); } } writer.write('\n'); return true; } return false; }
public static String fuzzyEscape(String str) { char[] chars = str.toCharArray(); StringBuffer result = createStringBuffer(str, 0); for (int i = 0; i < chars.length; i++) { if (!isASCIIControlChar(chars[i]) || chars[i] == '\r' || chars[i] == '\n' || chars[i] == '\t') { result.append(chars[i]); } else { result.append("?\\"); int code = chars[i] & 0xFF; if (code < 100) { result.append('0'); } result.append(code); } } return result.toString(); }
protected boolean writeString(Writer writer, String str, int emptyFields) throws IOException { if (str != null && str.length() > 0) { for (int i = 0; i < emptyFields; i++) { writer.write('\n'); } for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch) || ch == '\\') { writer.write("\\x"); writer.write(SVNFormatUtil.getHexNumberFromByte((byte)ch)); } else { writer.write(ch); } } writer.write('\n'); return true; } return false; }
private boolean writeString(Writer writer, String str, int emptyFields) throws IOException { if (str != null && str.length() > 0) { for (int i = 0; i < emptyFields; i++) { writer.write('\n'); } for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch) || ch == '\\') { writer.write("\\x"); writer.write(SVNFormatUtil.getHexNumberFromByte((byte)ch)); } else { writer.write(ch); } } writer.write('\n'); return true; } return false; }
protected static void assertControlChars(String path) throws SVNException { if (path != null) { for (int i = 0; i < path.length(); i++) { char ch = path.charAt(i); String code = Integer.toHexString(ch); if (code.length() < 2) { code = "0" + code; } if (SVNEncodingUtil.isASCIIControlChar(ch)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Invalid control character '0x" + code + "' in path '" + path + "'"); SVNErrorManager.error(err, SVNLogType.DEFAULT); } } } return; } }
protected static void assertControlChars(String path) throws SVNException { if (path != null) { for (int i = 0; i < path.length(); i++) { char ch = path.charAt(i); String code = Integer.toHexString(ch); if (code.length() < 2) { code = "0" + code; } if (SVNEncodingUtil.isASCIIControlChar(ch)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Invalid control character '0x" + code + "' in path '" + path + "'"); SVNErrorManager.error(err, SVNLogType.DEFAULT); } } } return; } }
protected static void assertControlChars(String path) throws SVNException { if (path != null) { for (int i = 0; i < path.length(); i++) { char ch = path.charAt(i); String code = Integer.toHexString(ch); if (code.length() < 2) { code = "0" + code; } if (SVNEncodingUtil.isASCIIControlChar(ch)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Invalid control character '0x" + code + "' in path '" + path + "'"); SVNErrorManager.error(err, SVNLogType.DEFAULT); } } } return; } }
public static void checkPathIsValid(String path) throws SVNException { for (int i = 0; i < path.length(); i++) { char ch = path.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Invalid control character ''{0}'' in path ''{1}''", new String[] {"''0x" + SVNFormatUtil.getHexNumberFromByte((byte)ch) + "''", path}); SVNErrorManager.error(err); } } }
public static void checkPathIsValid(String path) throws SVNException { for (int i = 0; i < path.length(); i++) { char ch = path.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Invalid control character ''{0}'' in path ''{1}''", new String[]{"0x" + SVNFormatUtil.getHexNumberFromByte((byte) ch), path}); SVNErrorManager.error(err, SVNLogType.DEFAULT); } } }
public static void checkPathIsValid(String path) throws SVNException { for (int i = 0; i < path.length(); i++) { char ch = path.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Invalid control character ''{0}'' in path ''{1}''", new String[]{"0x" + SVNFormatUtil.getHexNumberFromByte((byte) ch), path}); SVNErrorManager.error(err, SVNLogType.DEFAULT); } } }
public static void checkPathIsValid(String path) throws SVNException { for (int i = 0; i < path.length(); i++) { char ch = path.charAt(i); if (SVNEncodingUtil.isASCIIControlChar(ch)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Invalid control character ''{0}'' in path ''{1}''", new String[]{"0x" + SVNFormatUtil.getHexNumberFromByte((byte) ch), path}); SVNErrorManager.error(err, SVNLogType.DEFAULT); } } }