private byte[] getPropertyAsBytes(SVNPropertyValue value, String encoding){ if (value == null){ return null; } if (value.isString()){ try { return value.getString().getBytes(encoding); } catch (UnsupportedEncodingException e) { return value.getString().getBytes(); } } return value.getBytes(); }
private byte[] getPropertyAsBytes(SVNPropertyValue value, String encoding){ if (value == null){ return null; } if (value.isString()){ try { return value.getString().getBytes(encoding); } catch (UnsupportedEncodingException e) { return value.getString().getBytes(); } } return value.getBytes(); }
private byte[] getPropertyAsBytes(SVNPropertyValue value, String encoding){ if (value == null){ return null; } if (value.isString()){ try { return value.getString().getBytes(encoding); } catch (UnsupportedEncodingException e) { return value.getString().getBytes(); } } return value.getBytes(); }
private byte[] getPropertyAsBytes(SVNPropertyValue value, String encoding){ if (value == null){ return null; } if (value.isString()){ try { return value.getString().getBytes(encoding); } catch (UnsupportedEncodingException e) { return value.getString().getBytes(); } } return value.getBytes(); }
/** * Returns <code>byte[]</code> representation of <code>value</code>. * * <p/> * If <code>value</code> is a {@link SVNPropertyValue#isString() string} property value, then bytes of * the string are encoded using the <span class="javastring">"UTF-8"</span> charset and returned by this * method. If encoding fails, then bytes are encoded using the default platform's charset. * * <p/> * Otherwise, {@link SVNPropertyValue#getBytes()} is returned. * * @param value property value object * @return bytes of the property value represented by <code>value</code>; * <span class="javakeyword">null</span> if <code>value</code> is * <span class="javakeyword">null</span> */ public static byte[] getPropertyAsBytes(SVNPropertyValue value) { if (value == null) { return null; } if (value.isString()) { try { return value.getString().getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { return value.getString().getBytes(); } } return value.getBytes(); }
/** * Says whether this object and <code>obj</code> are equal or not. * * @param obj object to compare with * @return <span class="javakeyword">true</span> in the following cases: * <ul> * <li/><code>obj</code> is the same as this one (by reference) * <li/>if <code>obj</code> is an <code>SVNPropertyValue</code> and either has got the same * <code>String</code> value in case this object holds a <code>String</code> value, or * the same byte array contents if this object represents a binary property value * </ul> */ public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (obj instanceof SVNPropertyValue) { SVNPropertyValue value = (SVNPropertyValue) obj; if (isString()) { return myValue.equals(getPropertyAsString(value)); } else if (isBinary()) { return Arrays.equals(myData, getPropertyAsBytes(value)); } } return false; }
/** * Returns <code>byte[]</code> representation of <code>value</code>. * * <p/> * If <code>value</code> is a {@link SVNPropertyValue#isString() string} property value, then bytes of * the string are encoded using the <span class="javastring">"UTF-8"</span> charset and returned by this * method. If encoding fails, then bytes are encoded using the default platform's charset. * * <p/> * Otherwise, {@link SVNPropertyValue#getBytes()} is returned. * * @param value property value object * @return bytes of the property value represented by <code>value</code>; * <span class="javakeyword">null</span> if <code>value</code> is * <span class="javakeyword">null</span> */ public static byte[] getPropertyAsBytes(SVNPropertyValue value) { if (value == null) { return null; } if (value.isString()) { try { return value.getString().getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { return value.getString().getBytes(); } } return value.getBytes(); }
/** * Constructs an <b>SVNPropertyData</b> given a property name and its * value. * * <p> * if <code>data</code> is not <span class="javakeyword">null</span>, is a * {@link SVNPropertyValue#isString() string} property and <code>name</code> is an * {@link SVNProperty#isSVNProperty(String) svn-namespace} property name, then <code>options</code>, * if not <span class="javakeyword">null</span>, is used to translate the property value replacing * all LF end of line markers in the property value with ones returned by {@link ISVNOptions#getNativeEOL()}. * Otherwise, if <code>options</code> is <span class="javakeyword">null</span>, * the <span class="javastring">"line.separator"</span> system property is used to retrieve a new EOL marker. * * @param name a property name * @param data a property value * @param options provides EOL style information */ public SVNPropertyData(String name, SVNPropertyValue data, ISVNOptions options) { myName = name; myValue = data; if (myValue != null && SVNProperty.isSVNProperty(myName) && myValue.isString()) { String nativeEOL = options == null ? System.getProperty("line.separator") : new String(options.getNativeEOL()); myValue = SVNPropertyValue.create(myValue.getString().replaceAll("\n", nativeEOL)); } }
/** * Constructs an <b>SVNPropertyData</b> given a property name and its * value. * * <p> * if <code>data</code> is not <span class="javakeyword">null</span>, is a * {@link SVNPropertyValue#isString() string} property and <code>name</code> is an * {@link SVNProperty#isSVNProperty(String) svn-namespace} property name, then <code>options</code>, * if not <span class="javakeyword">null</span>, is used to translate the property value replacing * all LF end of line markers in the property value with ones returned by {@link ISVNOptions#getNativeEOL()}. * Otherwise, if <code>options</code> is <span class="javakeyword">null</span>, * the <span class="javastring">"line.separator"</span> system property is used to retrieve a new EOL marker. * * @param name a property name * @param data a property value * @param options provides EOL style information */ public SVNPropertyData(String name, SVNPropertyValue data, ISVNOptions options) { myName = name; myValue = data; if (myValue != null && SVNProperty.isSVNProperty(myName) && myValue.isString()) { String nativeEOL = options == null ? System.getProperty("line.separator") : new String(options.getNativeEOL()); myValue = SVNPropertyValue.create(myValue.getString().replaceAll("\n", nativeEOL)); } }
/** * Constructs an <b>SVNPropertyData</b> given a property name and its * value. * * <p> * if <code>data</code> is not <span class="javakeyword">null</span>, is a * {@link SVNPropertyValue#isString() string} property and <code>name</code> is an * {@link SVNProperty#isSVNProperty(String) svn-namespace} property name, then <code>options</code>, * if not <span class="javakeyword">null</span>, is used to translate the property value replacing * all LF end of line markers in the property value with ones returned by {@link ISVNOptions#getNativeEOL()}. * Otherwise, if <code>options</code> is <span class="javakeyword">null</span>, * the <span class="javastring">"line.separator"</span> system property is used to retrieve a new EOL marker. * * @param name a property name * @param data a property value * @param options provides EOL style information */ public SVNPropertyData(String name, SVNPropertyValue data, ISVNOptions options) { myName = name; myValue = data; if (myValue != null && SVNProperty.isSVNProperty(myName) && myValue.isString()) { String nativeEOL = options == null ? System.getProperty("line.separator") : new String(options.getNativeEOL()); if (myValue.getString().indexOf(nativeEOL) < 0) { myValue = SVNPropertyValue.create(myValue.getString().replaceAll("\n", nativeEOL)); } } }
private File maybeUpdateTargetEols(File oldTargetAbspath, SVNProperties propDiff) throws SVNException { SVNPropertyValue prop = propDiff.getSVNPropertyValue(SVNProperty.EOL_STYLE); if (prop != null && prop.isString()) { byte[] eol = SVNEolStyleInfo.fromValue(prop.getString()).eolStr; File tmpNew = openUniqueFile(null, false).path; SVNTranslator.copyAndTranslate(oldTargetAbspath, tmpNew, null, eol, null, false, false, true); return tmpNew; } return oldTargetAbspath; }
public static PropertyData createPropertyData(Object client, String path, String name, SVNPropertyValue value) { if (client instanceof SVNClientImpl){ if (value.isString()) { return new JavaHLPropertyData((SVNClientImpl) client, null, path, name, value.getString(), SVNPropertyValue.getPropertyAsBytes(value)); } return new JavaHLPropertyData((SVNClientImpl) client, null, path, name, SVNPropertyValue.getPropertyAsString(value), value.getBytes()); } if (value.isString()) { return new PropertyData((SVNClient) client, path, name, value.getString(), SVNPropertyValue.getPropertyAsBytes(value)); } return new PropertyData((SVNClient) client, path, name, SVNPropertyValue.getPropertyAsString(value), value.getBytes()); }
public static PropertyData createPropertyData(Object client, String path, String name, SVNPropertyValue value) { if (client instanceof SVNClientImpl){ if (value.isString()) { return new JavaHLPropertyData((SVNClientImpl) client, null, path, name, value.getString(), SVNPropertyValue.getPropertyAsBytes(value)); } return new JavaHLPropertyData((SVNClientImpl) client, null, path, name, SVNPropertyValue.getPropertyAsString(value), value.getBytes()); } if (value.isString()) { return new PropertyData((SVNClient) client, path, name, value.getString(), SVNPropertyValue.getPropertyAsBytes(value)); } return new PropertyData((SVNClient) client, path, name, SVNPropertyValue.getPropertyAsString(value), value.getBytes()); }
public static PropertyData createPropertyData(Object client, String path, String name, SVNPropertyValue value) { if (client instanceof SVNClientImpl){ if (value.isString()) { return new JavaHLPropertyData((SVNClientImpl) client, null, path, name, value.getString(), SVNPropertyValue.getPropertyAsBytes(value)); } return new JavaHLPropertyData((SVNClientImpl) client, null, path, name, SVNPropertyValue.getPropertyAsString(value), value.getBytes()); } if (value.isString()) { return new PropertyData((SVNClient) client, path, name, value.getString(), SVNPropertyValue.getPropertyAsBytes(value)); } return new PropertyData((SVNClient) client, path, name, SVNPropertyValue.getPropertyAsString(value), value.getBytes()); }
public static PropertyData createPropertyData(Object client, String path, String name, SVNPropertyValue value) { if (client instanceof SVNClientImpl){ if (value.isString()) { return new JavaHLPropertyData((SVNClientImpl) client, null, path, name, value.getString(), SVNPropertyValue.getPropertyAsBytes(value)); } return new JavaHLPropertyData((SVNClientImpl) client, null, path, name, SVNPropertyValue.getPropertyAsString(value), value.getBytes()); } if (value.isString()) { return new PropertyData((SVNClient) client, path, name, value.getString(), SVNPropertyValue.getPropertyAsBytes(value)); } return new PropertyData((SVNClient) client, path, name, SVNPropertyValue.getPropertyAsString(value), value.getBytes()); }
private SVNConflictDescription setupTextConflictDesc(File leftAbspath, File rightAbspath, File targetAbspath, SVNConflictVersion leftVersion, SVNConflictVersion rightVersion, File resultTarget, File detranslatedTarget, SVNPropertyValue mimeprop, boolean isBinary) { SVNWCConflictDescription17 cdesc = SVNWCConflictDescription17.createText(targetAbspath); cdesc.setBinary(false); cdesc.setMimeType((mimeprop != null && mimeprop.isString()) ? mimeprop.getString() : null); cdesc.setBaseFile(leftAbspath); cdesc.setTheirFile(rightAbspath); cdesc.setMyFile(detranslatedTarget); cdesc.setMergedFile(resultTarget); cdesc.setSrcLeftVersion(leftVersion); cdesc.setSrcRightVersion(rightVersion); return cdesc.toConflictDescription(); }
public String doMakeActivity(ISVNWorkspaceMediator mediator) throws SVNException { String url = null; if (mediator != null) { SVNPropertyValue property = mediator.getWorkspaceProperty("", SVNProperty.ACTIVITY_URL); if (property != null && property.isString()) { url = property.getString(); } } String locationPath = SVNEncodingUtil.uriEncode(getLocation().getPath()); if (url == null) { url = getActivityCollectionURL(locationPath, false); } IHTTPConnection httpConnection = getConnection(); String activityURL = SVNPathUtil.append(url, generateUUID()); HTTPStatus status = httpConnection.request("MKACTIVITY", activityURL, null, (StringBuffer) null, 201, 404, null, null); if (status.getCode() == 404) { url = getActivityCollectionURL(locationPath, true); activityURL = SVNPathUtil.append(url, generateUUID()); status = httpConnection.request("MKACTIVITY", activityURL, null, (StringBuffer) null, 201, 0, null, null); } if (url != null && mediator != null) { mediator.setWorkspaceProperty("", SVNProperty.ACTIVITY_URL, SVNPropertyValue.create(url)); } return activityURL; }
public String doMakeActivity(ISVNWorkspaceMediator mediator) throws SVNException { String url = null; if (mediator != null) { SVNPropertyValue property = mediator.getWorkspaceProperty("", SVNProperty.ACTIVITY_URL); if (property != null && property.isString()) { url = property.getString(); } } String locationPath = SVNEncodingUtil.uriEncode(getLocation().getPath()); if (url == null) { url = getActivityCollectionURL(locationPath, false); } IHTTPConnection httpConnection = getConnection(); String activityURL = SVNPathUtil.append(url, generateUUID()); HTTPStatus status = httpConnection.request("MKACTIVITY", activityURL, null, (StringBuffer) null, 201, 404, null, null); if (status.getCode() == 404) { url = getActivityCollectionURL(locationPath, true); activityURL = SVNPathUtil.append(url, generateUUID()); status = httpConnection.request("MKACTIVITY", activityURL, null, (StringBuffer) null, 201, 0, null, null); } if (url != null && mediator != null) { mediator.setWorkspaceProperty("", SVNProperty.ACTIVITY_URL, SVNPropertyValue.create(url)); } return activityURL; }
SVNErrorManager.error(err, SVNLogType.WC); if (!force && SVNRevisionProperty.AUTHOR.equals(propertyName) && propertyValue != null && propertyValue.isString() && propertyValue.getString().indexOf('\n') >= 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_REVISION_AUTHOR_CONTAINS_NEWLINE, "Value will not be set unless forced"); SVNErrorManager.error(err, SVNLogType.WC);
public String doMakeActivity(ISVNWorkspaceMediator mediator) throws SVNException { beforeCall(); String url = null; if (mediator != null) { SVNPropertyValue property = mediator.getWorkspaceProperty("", SVNProperty.ACTIVITY_URL); if (property != null && property.isString()) { url = property.getString(); } } String locationPath = SVNEncodingUtil.uriEncode(getLocation().getPath()); if (url == null) { url = getActivityCollectionURL(locationPath, false); } IHTTPConnection httpConnection = getConnection(); String activityURL = SVNPathUtil.append(url, generateUUID()); HTTPStatus status = performHttpRequest(httpConnection, "MKACTIVITY", activityURL, null, (StringBuffer) null, 201, 404, null, null); if (status.getCode() == 404) { url = getActivityCollectionURL(locationPath, true); activityURL = SVNPathUtil.append(url, generateUUID()); status = performHttpRequest(httpConnection, "MKACTIVITY", activityURL, null, (StringBuffer) null, 201, 0, null, null); } if (url != null && mediator != null) { mediator.setWorkspaceProperty("", SVNProperty.ACTIVITY_URL, SVNPropertyValue.create(url)); } return activityURL; }