Skip to content

Commit

Permalink
Source formatting - no need to pass blah.length()
Browse files Browse the repository at this point in the history
  • Loading branch information
hhuijser authored and brianchandotcom committed Mar 8, 2012
1 parent 19f9764 commit 31ae985
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ private String _transformPositionalParams(String queryString) {
from = to + 1;
}

sb.append(queryString.substring(from, queryString.length()));
sb.append(queryString.substring(from));

return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected String injectVirtualGroupURL(String layoutURL) {
pos = layoutURL.indexOf(StringPool.QUESTION);

if (pos > 0) {
sb.append(layoutURL.substring(pos, layoutURL.length()));
sb.append(layoutURL.substring(pos));
}

return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,7 @@ else if ((primKey != null) &&
long plid = GetterUtil.getLong(primKey.substring(0, pos));

String portletId = primKey.substring(
pos + PortletConstants.LAYOUT_SEPARATOR.length(),
primKey.length());
pos + PortletConstants.LAYOUT_SEPARATOR.length());

PortletPermissionUtil.check(
permissionChecker, plid, portletId, ActionKeys.CONFIGURATION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ public Enumeration<String> getAttributeNames() {
String name = enu.nextElement();

if (name.startsWith(_attrNamespace)) {
names.add(
name.substring(_attrNamespace.length(), name.length()));
names.add(name.substring(_attrNamespace.length()));
}
else if (_isReservedParam(name)) {
names.add(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ private static String _propagateQueryString(
_CSS_IMPORT_END, importX + _CSS_IMPORT_BEGIN.length());

if ((importX == -1) || (importY == -1)) {
sb.append(content.substring(pos, content.length()));
sb.append(content.substring(pos));

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static String aggregateCss(String dir, String content)
_CSS_IMPORT_END, importX + _CSS_IMPORT_BEGIN.length());

if ((importX == -1) || (importY == -1)) {
sb.append(content.substring(pos, content.length()));
sb.append(content.substring(pos));

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ else if (Validator.isNotNull(portlet.getParentStrutsPath())) {

String parentPath =
StringPool.SLASH + portlet.getParentStrutsPath() +
path.substring(pos, path.length());
path.substring(pos);

if (StrutsActionRegistryUtil.getAction(parentPath) != null) {
actionMapping =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ public void setParameters(Map<String, String[]> params) {
if (!value.startsWith(_strutsPath)) {
int pos = value.lastIndexOf(CharPool.SLASH);

value =
_strutsPath +
value.substring(pos + 1, value.length());
value = _strutsPath + value.substring(pos + 1);

values[i] = value;
}
Expand Down
3 changes: 1 addition & 2 deletions portal-impl/src/com/liferay/portal/tools/LangBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,7 @@ private String _orderProperties(File propertiesFile) throws IOException {
if (pos != -1) {
String key = line.substring(0, pos);

String value = _fixTranslation(
line.substring(pos + 1, line.length()));
String value = _fixTranslation(line.substring(pos + 1));

value = _fixEnglishTranslation(key, value);

Expand Down
16 changes: 4 additions & 12 deletions portal-impl/src/com/liferay/portal/tools/ReleaseInfoBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public ReleaseInfoBuilder() {

int y = content.indexOf("\"", x);

content =
content.substring(0, x) + version +
content.substring(y, content.length());
content = content.substring(0, x) + version + content.substring(y);

// Get build

Expand All @@ -68,9 +66,7 @@ public ReleaseInfoBuilder() {

int build = GetterUtil.getInteger(content.substring(x, y)) + 1;

content =
content.substring(0, x) + build +
content.substring(y, content.length());
content = content.substring(0, x) + build + content.substring(y);

// Get date

Expand All @@ -83,9 +79,7 @@ public ReleaseInfoBuilder() {

y = content.indexOf("\"", x);

content =
content.substring(0, x) + date +
content.substring(y, content.length());
content = content.substring(0, x) + date + content.substring(y);

// Update ReleaseInfo.java

Expand All @@ -101,9 +95,7 @@ public ReleaseInfoBuilder() {
y = content.indexOf(", FALSE);", x);
x = content.lastIndexOf(" ", y - 1) + 1;

content =
content.substring(0, x) + build +
content.substring(y, content.length());
content = content.substring(0, x) + build + content.substring(y);

_fileUtil.write(file, content);
}
Expand Down
4 changes: 2 additions & 2 deletions portal-impl/src/com/liferay/portal/tools/WebXMLBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public WebXMLBuilder(

mergedContent =
mergedContent.substring(0, z) + filterMappings +
mergedContent.substring(z, mergedContent.length());
mergedContent.substring(z);

customContent =
customContent.substring(0, x) +
Expand All @@ -116,7 +116,7 @@ public WebXMLBuilder(

mergedContent =
mergedContent.substring(0, z) + customContent +
mergedContent.substring(z, mergedContent.length());
mergedContent.substring(z);

mergedContent = organizeWebXML(mergedContent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1829,8 +1829,7 @@ public void updateWebXml(
int pos = content.indexOf("</web-app>");

String newContent =
content.substring(0, pos) + extraContent +
content.substring(pos, content.length());
content.substring(0, pos) + extraContent + content.substring(pos);

// Replace old package names

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ private void _createHbmXml() throws Exception {
if (x != -1) {
newContent =
newContent.substring(0, x) + content +
newContent.substring(x, newContent.length());
newContent.substring(x);
}
}
else {
Expand All @@ -1957,7 +1957,7 @@ private void _createHbmXml() throws Exception {

newContent =
newContent.substring(0, firstClass) + content +
newContent.substring(lastClass, newContent.length());
newContent.substring(lastClass);
}

newContent = _formatXml(newContent);
Expand Down Expand Up @@ -2072,7 +2072,7 @@ private void _createJsonJs() throws Exception {
else {
newContent =
newContent.substring(0, oldBegin) + sb.toString().trim() +
newContent.substring(oldEnd + 2, newContent.length());
newContent.substring(oldEnd + 2);
}

newContent = newContent.trim();
Expand Down Expand Up @@ -2191,15 +2191,15 @@ private void _createModelHintsXml() throws Exception {

newContent =
newContent.substring(0, x) + content +
newContent.substring(x, newContent.length());
newContent.substring(x);
}
else {
firstModel = newContent.lastIndexOf("<model", firstModel) - 1;
lastModel = newContent.indexOf("</model>", lastModel) + 9;

newContent =
newContent.substring(0, firstModel) + content +
newContent.substring(lastModel, newContent.length());
newContent.substring(lastModel);
}

newContent = _formatXml(newContent);
Expand Down Expand Up @@ -2379,7 +2379,7 @@ private void _createOrmXml() throws Exception {
if (x != -1) {
newContent =
newContent.substring(0, x) + content +
newContent.substring(x, newContent.length());
newContent.substring(x);
}
}
else {
Expand All @@ -2388,7 +2388,7 @@ private void _createOrmXml() throws Exception {

newContent =
newContent.substring(0, firstEntity) + content +
newContent.substring(lastEntity, newContent.length());
newContent.substring(lastEntity);
}

newContent = _formatXml(newContent);
Expand Down Expand Up @@ -2618,15 +2618,15 @@ private void _createRemotingXml() throws Exception {
if (x != -1) {
newContent =
content.substring(0, x - 1) + sb.toString() +
content.substring(y, content.length());
content.substring(y);
}
else {
x = content.indexOf("</beans>");

if (x != -1) {
newContent =
content.substring(0, x) + sb.toString() +
content.substring(x, content.length());
content.substring(x);
}
else {
x = content.indexOf("<beans/>");
Expand Down Expand Up @@ -3154,8 +3154,7 @@ private void _createSpringXml() throws Exception {
x = newContent.indexOf("</beans>");

newContent =
newContent.substring(0, x) + content +
newContent.substring(x, newContent.length());
newContent.substring(0, x) + content + newContent.substring(x);
}
else {
firstSession = newContent.lastIndexOf("<bean", firstSession) - 1;
Expand All @@ -3171,7 +3170,7 @@ private void _createSpringXml() throws Exception {

newContent =
newContent.substring(0, firstSession) + content +
newContent.substring(lastSession, newContent.length());
newContent.substring(lastSession);
}

newContent = _formatXml(newContent);
Expand Down Expand Up @@ -3403,7 +3402,7 @@ private void _createSQLMappingTables(
if (!oldCreateTableString.equals(newCreateTableString)) {
content =
content.substring(0, x) + newCreateTableString +
content.substring(y + 2, content.length());
content.substring(y + 2);

FileUtil.write(sqlFile, content);
}
Expand Down Expand Up @@ -3591,7 +3590,7 @@ private void _createSQLTables(
if (!oldCreateTableString.equals(newCreateTableString)) {
content =
content.substring(0, x) + newCreateTableString +
content.substring(y + 2, content.length());
content.substring(y + 2);

FileUtil.write(sqlFile, content);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ public Enumeration<String> getParameterNames() {
String name = enu.nextElement();

if (name.startsWith(_namespace)) {
parameterNames.add(
name.substring(_namespace.length(), name.length()));
parameterNames.add(name.substring(_namespace.length()));
}
else {
parameterNames.add(name);
Expand Down
2 changes: 1 addition & 1 deletion portal-impl/src/com/liferay/portal/util/HtmlImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public String stripHtml(String text) {
}

if (y == -1) {
sb.append(text.substring(x, text.length()));
sb.append(text.substring(x));
}

return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ protected void updateArticleField(
if ((x != -1) && (y != -1)) {
groupId = GetterUtil.getLong(containerId.substring(0, x));
articleId = containerId.substring(x + 1, y);
version = GetterUtil.getDouble(
containerId.substring(y, containerId.length()));
version = GetterUtil.getDouble(containerId.substring(y));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public String processXML(
}

if (y == -1) {
sb.append(content.substring(x, content.length()));
sb.append(content.substring(x));
}

return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ public static String getPpPaymentStatus(String ppPaymentStatus) {
}
else {
return Character.toUpperCase(ppPaymentStatus.charAt(0)) +
ppPaymentStatus.substring(1, ppPaymentStatus.length());
ppPaymentStatus.substring(1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected List<byte[]> getImages(
getSortedParameterNames(uploadPortletRequest, imagePrefix)) {

int priority = GetterUtil.getInteger(
name.substring(imagePrefix.length(), name.length()));
name.substring(imagePrefix.length()));

boolean preserveScreenshot = ParamUtil.getBoolean(
uploadPortletRequest, "preserveScreenshot" + priority);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static String replaceLongIds(
int y = _getEndPos(chars, x + begin.length());

if ((x == -1) || (y == -1)) {
sb.append(s.substring(pos, s.length()));
sb.append(s.substring(pos));

break;
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public String replaceLongIds(
int y = s.indexOf(end, x + begin.length());

if ((x == -1) || (y == -1)) {
sb.append(s.substring(pos, s.length()));
sb.append(s.substring(pos));

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ public static StringBundler replaceToStringBundler(
int y = s.indexOf(end, x + begin.length());

if ((x == -1) || (y == -1)) {
sb.append(s.substring(pos, s.length()));
sb.append(s.substring(pos));

break;
}
Expand Down Expand Up @@ -1855,7 +1855,7 @@ public static StringBundler replaceWithStringBundler(
int y = s.indexOf(end, x + begin.length());

if ((x == -1) || (y == -1)) {
sb.append(s.substring(pos, s.length()));
sb.append(s.substring(pos));

break;
}
Expand Down Expand Up @@ -2712,7 +2712,7 @@ public static String stripBetween(String s, String begin, String end) {
int y = s.indexOf(end, x + begin.length());

if ((x == -1) || (y == -1)) {
sb.append(s.substring(pos, s.length()));
sb.append(s.substring(pos));

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public ActionCommand getActionCommand(String actionCommandName) {

sb.append(_packagePrefix);
sb.append(Character.toUpperCase(actionCommandName.charAt(0)));
sb.append(
actionCommandName.substring(1, actionCommandName.length()));
sb.append(actionCommandName.substring(1));
sb.append(_ACTION_COMMAND_POSTFIX);

className = sb.toString();
Expand Down

0 comments on commit 31ae985

Please sign in to comment.