You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openaz.apache.org by co...@apache.org on 2015/05/05 14:23:02 UTC
[04/54] [abbrv] [partial] incubator-openaz git commit: Do an eclipse
based "cleanup" on the project
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Duration.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Duration.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Duration.java
index 7867397..dd5588b 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Duration.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Duration.java
@@ -36,11 +36,10 @@ import com.att.research.xacml.api.SemanticString;
/**
* ISO8601Duration implements the ISO8601 duration data type with parsers from strings and to strings.
- *
*/
public class ISO8601Duration implements SemanticString {
private static int getChunkOrder(boolean sawT, char chunkName) {
- switch(chunkName) {
+ switch (chunkName) {
case 'Y':
return 1;
case 'M':
@@ -57,28 +56,32 @@ public class ISO8601Duration implements SemanticString {
}
private static class DurationChunk {
- private char chunkName;
- private double chunkValue;
- private int length;
+ private char chunkName;
+ private double chunkValue;
+ private int length;
public DurationChunk(char name, double value, int lengthIn) {
- this.chunkName = name;
- this.chunkValue = value;
- this.length = lengthIn;
+ this.chunkName = name;
+ this.chunkValue = value;
+ this.length = lengthIn;
}
public char getChunkName() {
return this.chunkName;
}
+
public double getChunkValue() {
return this.chunkValue;
}
+
public int getLength() {
return this.length;
}
+
public boolean isIntValue() {
return Math.floor(this.getChunkValue()) == this.getChunkValue();
}
+
public int getIntValue() {
return (int)Math.floor(this.getChunkValue());
}
@@ -87,23 +90,25 @@ public class ISO8601Duration implements SemanticString {
if (duration == null || startPos >= duration.length()) {
return null;
}
- int curPos = startPos;
- int endPos = duration.length();
- int dotCount = 0;
- char charAt;
- while (curPos < endPos && ((charAt = duration.charAt(curPos)) == '.' || Character.isDigit(charAt))) {
+ int curPos = startPos;
+ int endPos = duration.length();
+ int dotCount = 0;
+ char charAt;
+ while (curPos < endPos
+ && ((charAt = duration.charAt(curPos)) == '.' || Character.isDigit(charAt))) {
if (charAt == '.') {
dotCount++;
}
curPos++;
}
if (curPos < endPos && dotCount <= 1) {
- char chunkName = duration.charAt(curPos);
- Double dvalue = null;
+ char chunkName = duration.charAt(curPos);
+ Double dvalue = null;
try {
- dvalue = Double.parseDouble(duration.substring(startPos, curPos));
+ dvalue = Double.parseDouble(duration.substring(startPos, curPos));
} catch (NumberFormatException ex) {
- throw new ParseException("Invalid chunk \"" + duration + "\" at position " + startPos, startPos);
+ throw new ParseException("Invalid chunk \"" + duration + "\" at position " + startPos,
+ startPos);
}
curPos++;
return new DurationChunk(chunkName, dvalue, (curPos - startPos));
@@ -113,14 +118,14 @@ public class ISO8601Duration implements SemanticString {
}
}
- private int durationSign = 1;
- private int years;
- private int months;
- private int days;
- private int hours;
- private int minutes;
- private int seconds;
- private int millis;
+ private int durationSign = 1;
+ private int years;
+ private int months;
+ private int days;
+ private int hours;
+ private int minutes;
+ private int seconds;
+ private int millis;
/**
* Creates a duration with the given values.
@@ -133,15 +138,16 @@ public class ISO8601Duration implements SemanticString {
* @param minutesIn the number of minutes
* @param secondsIn the number of fractional seconds
*/
- public ISO8601Duration(int durationSignIn, int yearsIn, int monthsIn, int daysIn, int hoursIn, int minutesIn, double secondsIn) {
- this.durationSign = durationSignIn;
- this.years = yearsIn;
- this.months = monthsIn;
- this.days = daysIn;
- this.hours = hoursIn;
- this.minutes = minutesIn;
- this.seconds = (int) Math.floor(secondsIn);
- this.millis = (int) Math.floor(((secondsIn * 1000) - (this.seconds * 1000)));
+ public ISO8601Duration(int durationSignIn, int yearsIn, int monthsIn, int daysIn, int hoursIn,
+ int minutesIn, double secondsIn) {
+ this.durationSign = durationSignIn;
+ this.years = yearsIn;
+ this.months = monthsIn;
+ this.days = daysIn;
+ this.hours = hoursIn;
+ this.minutes = minutesIn;
+ this.seconds = (int)Math.floor(secondsIn);
+ this.millis = (int)Math.floor(((secondsIn * 1000) - (this.seconds * 1000)));
}
/**
@@ -154,97 +160,104 @@ public class ISO8601Duration implements SemanticString {
if (iso8601DurationString == null || iso8601DurationString.length() == 0) {
return null;
}
- int curPos = 0;
- int endPos = iso8601DurationString.length();
-
- int durationSign = 1;
- int years = 0;
- int months = 0;
- int days = 0;
- int hours = 0;
- int minutes = 0;
- double fractionalSeconds = 0.0;
+ int curPos = 0;
+ int endPos = iso8601DurationString.length();
+ int durationSign = 1;
+ int years = 0;
+ int months = 0;
+ int days = 0;
+ int hours = 0;
+ int minutes = 0;
+ double fractionalSeconds = 0.0;
if (iso8601DurationString.charAt(curPos) == '-') {
- durationSign = -1;
+ durationSign = -1;
curPos++;
}
if (iso8601DurationString.charAt(curPos) != 'P') {
- throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString + "\" at position " + curPos, curPos);
+ throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString
+ + "\" at position " + curPos, curPos);
}
curPos++;
if (curPos >= endPos) {
- throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString + "\": No duration components following P", curPos);
+ throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString
+ + "\": No duration components following P", curPos);
}
- int lastChunkOrder = 0;
- boolean sawT = false;
+ int lastChunkOrder = 0;
+ boolean sawT = false;
while (curPos < endPos) {
/*
* Look for the Time divider character
*/
if (iso8601DurationString.charAt(curPos) == 'T') {
if (sawT) {
- throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString + "\" at position " + curPos + ": saw multiple T separators", curPos);
+ throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString
+ + "\" at position " + curPos + ": saw multiple T separators",
+ curPos);
} else {
- sawT = true;
+ sawT = true;
}
curPos++;
} else {
- DurationChunk durationChunk = DurationChunk.nextChunk(iso8601DurationString, curPos);
+ DurationChunk durationChunk = DurationChunk.nextChunk(iso8601DurationString, curPos);
/*
* Check for unknown chunks or out of order chunks
*/
- int chunkOrder = getChunkOrder(sawT, durationChunk.getChunkName());
+ int chunkOrder = getChunkOrder(sawT, durationChunk.getChunkName());
if (chunkOrder <= 0) {
- throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString + "\" at position " + curPos + ": invalid component", curPos);
+ throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString
+ + "\" at position " + curPos + ": invalid component", curPos);
} else if (chunkOrder <= lastChunkOrder) {
- throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString + "\" at position " + curPos + ": out of order component", curPos);
+ throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString
+ + "\" at position " + curPos + ": out of order component",
+ curPos);
}
- lastChunkOrder = chunkOrder;
+ lastChunkOrder = chunkOrder;
/*
* Check for correct value type
*/
if (durationChunk.getChunkName() != 'S' && !durationChunk.isIntValue()) {
- throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString + "\" at position " + curPos + ": expected int value", curPos);
+ throw new ParseException("Invalid ISO8601 duration string \"" + iso8601DurationString
+ + "\" at position " + curPos + ": expected int value", curPos);
}
/*
* Assign the value to the right component
*/
- switch(durationChunk.getChunkName()) {
+ switch (durationChunk.getChunkName()) {
case 'Y':
- years = durationChunk.getIntValue();
+ years = durationChunk.getIntValue();
break;
case 'M':
if (!sawT) {
- months = durationChunk.getIntValue();
+ months = durationChunk.getIntValue();
} else {
minutes = durationChunk.getIntValue();
}
break;
case 'D':
- days = durationChunk.getIntValue();
+ days = durationChunk.getIntValue();
break;
case 'H':
- hours = durationChunk.getIntValue();
+ hours = durationChunk.getIntValue();
break;
case 'S':
- fractionalSeconds = durationChunk.getChunkValue();
+ fractionalSeconds = durationChunk.getChunkValue();
break;
default:
- assert(false);
+ assert (false);
break;
}
/*
* Advance the current position
*/
- curPos += durationChunk.getLength();
+ curPos += durationChunk.getLength();
}
}
@@ -254,35 +267,44 @@ public class ISO8601Duration implements SemanticString {
public int getDurationSign() {
return this.durationSign;
}
+
public int getYears() {
return this.years;
}
+
public int getMonths() {
return this.months;
}
+
public int getDays() {
return this.days;
}
+
public int getHours() {
return this.hours;
}
+
public int getMinutes() {
return this.minutes;
}
+
public int getSeconds() {
return this.seconds;
}
+
public int getMillis() {
return this.millis;
}
+
public double getFractionalSecs() {
- double dSec = (double)(this.seconds) + (( (double)this.millis) / 1000);
+ double dSec = (this.seconds) + (((double)this.millis) / 1000);
return dSec;
}
@Override
public int hashCode() {
- return this.getDurationSign() + this.getYears() + this.getMonths() + this.getDays() + this.getHours() + this.getMinutes() + this.getSeconds() + this.getMillis();
+ return this.getDurationSign() + this.getYears() + this.getMonths() + this.getDays() + this.getHours()
+ + this.getMinutes() + this.getSeconds() + this.getMillis();
}
@Override
@@ -292,43 +314,42 @@ public class ISO8601Duration implements SemanticString {
} else if (obj == this) {
return true;
} else {
- ISO8601Duration iso8601Duration = (ISO8601Duration)obj;
- return (this.getDurationSign() == iso8601Duration.getDurationSign() &&
- this.getYears() == iso8601Duration.getYears() &&
- this.getMonths() == iso8601Duration.getMonths() &&
- this.getDays() == iso8601Duration.getDays() &&
- this.getHours() == iso8601Duration.getHours() &&
- this.getMinutes() == iso8601Duration.getMinutes() &&
- this.getSeconds() == iso8601Duration.getSeconds() &&
- this.getMillis() == iso8601Duration.getMillis()
- );
+ ISO8601Duration iso8601Duration = (ISO8601Duration)obj;
+ return (this.getDurationSign() == iso8601Duration.getDurationSign()
+ && this.getYears() == iso8601Duration.getYears()
+ && this.getMonths() == iso8601Duration.getMonths()
+ && this.getDays() == iso8601Duration.getDays()
+ && this.getHours() == iso8601Duration.getHours()
+ && this.getMinutes() == iso8601Duration.getMinutes()
+ && this.getSeconds() == iso8601Duration.getSeconds() && this.getMillis() == iso8601Duration
+ .getMillis());
}
}
@Override
public String stringValue() {
- StringBuilder stringBuilder = new StringBuilder();
+ StringBuilder stringBuilder = new StringBuilder();
if (this.getDurationSign() < 0) {
stringBuilder.append("-P");
} else {
stringBuilder.append("P");
}
- boolean sawOne = false;
+ boolean sawOne = false;
if (this.getYears() > 0) {
stringBuilder.append(this.getYears());
stringBuilder.append('Y');
- sawOne = true;
+ sawOne = true;
}
if (this.getMonths() > 0) {
stringBuilder.append(this.getMonths());
stringBuilder.append('M');
- sawOne = true;
+ sawOne = true;
}
if (this.getDays() > 0) {
stringBuilder.append(this.getDays());
stringBuilder.append('D');
- sawOne = true;
+ sawOne = true;
}
if (this.getHours() > 0 || this.getMinutes() > 0 || this.getSeconds() > 0 || this.getMillis() > 0) {
stringBuilder.append('T');
@@ -340,7 +361,7 @@ public class ISO8601Duration implements SemanticString {
stringBuilder.append(this.getMinutes());
stringBuilder.append('M');
}
- double dSeconds = this.getFractionalSecs();
+ double dSeconds = this.getFractionalSecs();
if (dSeconds > 0) {
if (dSeconds == Math.floor(dSeconds)) {
stringBuilder.append((int)dSeconds);
@@ -357,15 +378,8 @@ public class ISO8601Duration implements SemanticString {
@Override
public String toString() {
- return "{" +
- "durationSign=" + this.getDurationSign() +
- "years=" + this.getYears() +
- "months=" + this.getMonths() +
- "days=" + this.getDays() +
- "hours=" + this.getHours() +
- "minutes=" + this.getMinutes() +
- "seconds=" + this.getSeconds() +
- "millis=" + this.getMillis() +
- "}";
+ return "{" + "durationSign=" + this.getDurationSign() + "years=" + this.getYears() + "months="
+ + this.getMonths() + "days=" + this.getDays() + "hours=" + this.getHours() + "minutes="
+ + this.getMinutes() + "seconds=" + this.getSeconds() + "millis=" + this.getMillis() + "}";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Time.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Time.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Time.java
index 97cf64c..12297f4 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Time.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601Time.java
@@ -38,23 +38,23 @@ import java.util.TimeZone;
import com.att.research.xacml.api.SemanticString;
/**
- * ISO8601Time represents a time of day with an optional timezone indication using ISO8601 standard representations
- * for time, ordering, and operations.
- *
+ * ISO8601Time represents a time of day with an optional timezone indication using ISO8601 standard
+ * representations for time, ordering, and operations.
*/
public class ISO8601Time implements IDateTime<ISO8601Time>, Comparable<ISO8601Time>, SemanticString {
- private static final int ARBITRARY_YEAR = 1970;
- private static final int ARBITRARY_MONTH = 11;
- private static final int ARBITRARY_DAY = 15;
+ private static final int ARBITRARY_YEAR = 1970;
+ private static final int ARBITRARY_MONTH = 11;
+ private static final int ARBITRARY_DAY = 15;
private ISO8601DateTime dateTime;
protected ISO8601Time(ISO8601DateTime iso8601DateTime) {
- this.dateTime = iso8601DateTime;
+ this.dateTime = iso8601DateTime;
}
/**
- * Creates a <code>ISO8601Time</code> object for the given instant of time in the given <code>ISO8601TimeZone</code>.
+ * Creates a <code>ISO8601Time</code> object for the given instant of time in the given
+ * <code>ISO8601TimeZone</code>.
*
* @param tzOffsetHours the signed offset in hours for the timezone of this time
* @param tzOffsetMinutes the unsigned offset in minutes for the timezone of this time
@@ -64,7 +64,8 @@ public class ISO8601Time implements IDateTime<ISO8601Time>, Comparable<ISO8601Ti
* @param millisecondIn the millisecond
*/
public ISO8601Time(String timeZoneIn, int hourIn, int minuteIn, int secondIn, int millisecondIn) {
- this.dateTime = new ISO8601DateTime(timeZoneIn, ARBITRARY_YEAR, ARBITRARY_MONTH, ARBITRARY_DAY, hourIn, minuteIn, secondIn, millisecondIn);
+ this.dateTime = new ISO8601DateTime(timeZoneIn, ARBITRARY_YEAR, ARBITRARY_MONTH, ARBITRARY_DAY,
+ hourIn, minuteIn, secondIn, millisecondIn);
}
public ISO8601Time(int hourIn, int minuteIn, int secondIn, int millisecondIn) {
@@ -72,7 +73,8 @@ public class ISO8601Time implements IDateTime<ISO8601Time>, Comparable<ISO8601Ti
}
public ISO8601Time(ISO8601TimeZone timeZoneIn, int hourIn, int minuteIn, int secondIn, int millisecondIn) {
- this((timeZoneIn == null ? null : timeZoneIn.getTimeZoneString()), hourIn, minuteIn, secondIn, millisecondIn);
+ this((timeZoneIn == null ? null : timeZoneIn.getTimeZoneString()), hourIn, minuteIn, secondIn,
+ millisecondIn);
}
public ISO8601Time(TimeZone timeZoneIn, int hourIn, int minuteIn, int secondIn, int millisecondIn) {
@@ -82,26 +84,33 @@ public class ISO8601Time implements IDateTime<ISO8601Time>, Comparable<ISO8601Ti
public boolean getHasTimeZone() {
return this.dateTime.getHasTimeZone();
}
+
public String getTimeZone() {
return this.dateTime.getTimeZone();
}
+
public int getHour() {
return this.dateTime.getHour();
}
+
public int getMinute() {
return this.dateTime.getMinute();
}
+
public int getSecond() {
return this.dateTime.getSecond();
}
+
public int getMillisecond() {
return this.dateTime.getMillisecond();
}
+ @Override
public ISO8601Time add(ISO8601Duration iso8601Duration) {
return new ISO8601Time(this.dateTime.add(iso8601Duration));
}
+ @Override
public ISO8601Time sub(ISO8601Duration iso8601Duration) {
return new ISO8601Time(this.dateTime.sub(iso8601Duration));
}
@@ -109,17 +118,18 @@ public class ISO8601Time implements IDateTime<ISO8601Time>, Comparable<ISO8601Ti
/**
* Gets the <code>String</code> ISO8601 time representation of this <code>ISO8601Time</code>.
*
- * @param includeTimeZone <code>boolean</code> indicating whether the time zone information should be included
+ * @param includeTimeZone <code>boolean</code> indicating whether the time zone information should be
+ * included
* @return the <code>String</code> ISO8601 time representation of this <code>ISO8601Time</code>.
*/
public String stringValue(boolean includeTimeZone) {
- StringBuilder stringBuilder = new StringBuilder();
+ StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("%02d", this.getHour()));
stringBuilder.append(':');
stringBuilder.append(String.format("%02d", this.getMinute()));
stringBuilder.append(':');
stringBuilder.append(String.format("%02d", this.getSecond()));
- int ms = this.getMillisecond();
+ int ms = this.getMillisecond();
if (ms > 0) {
stringBuilder.append('.');
stringBuilder.append(String.format("%03d", ms));
@@ -162,18 +172,20 @@ public class ISO8601Time implements IDateTime<ISO8601Time>, Comparable<ISO8601Ti
}
public static ISO8601Time fromCalendar(Calendar calendar) {
- return new ISO8601Time(calendar.getTimeZone(), calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND), calendar.get(Calendar.MILLISECOND));
+ return new ISO8601Time(calendar.getTimeZone(), calendar.get(Calendar.HOUR_OF_DAY),
+ calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND),
+ calendar.get(Calendar.MILLISECOND));
}
public static ISO8601Time fromDate(Date date) {
- Calendar cal = Calendar.getInstance();
+ Calendar cal = Calendar.getInstance();
cal.setTime(date);
return ISO8601Time.fromCalendar(cal);
}
/**
- * Creates a new <code>Time</code> object by parsing the <code>String</code> supplied which must conform to the
- * ISO8601 standard for time formats {@link http://www.w3.org/TR/NOTE-datetime}
+ * Creates a new <code>Time</code> object by parsing the <code>String</code> supplied which must conform
+ * to the ISO8601 standard for time formats {@link http://www.w3.org/TR/NOTE-datetime}
*
* @param timeString the timeString to parse
* @return a new <code>Time</code> representing the given <code>String</code>
@@ -189,16 +201,16 @@ public class ISO8601Time implements IDateTime<ISO8601Time>, Comparable<ISO8601Ti
/*
* Find the starting position by searching past any whitespace
*/
- int startPos = ParseUtils.nextNonWhite(timeString, 0);
+ int startPos = ParseUtils.nextNonWhite(timeString, 0);
/*
* Get the two digit hour of day
*/
- int hh = ParseUtils.getTwoDigitValue(timeString, startPos);
+ int hh = ParseUtils.getTwoDigitValue(timeString, startPos);
if (hh < 0 || hh >= 24) {
throw new ParseException("Invalid hour of day", startPos);
}
- startPos += 2;
+ startPos += 2;
if (startPos >= timeString.length()) {
throw new ParseException("Invalid time string", startPos);
} else if (timeString.charAt(startPos) != ':') {
@@ -209,11 +221,11 @@ public class ISO8601Time implements IDateTime<ISO8601Time>, Comparable<ISO8601Ti
/*
* Get the two-digit minute of hour
*/
- int mm = ParseUtils.getTwoDigitValue(timeString, startPos);
+ int mm = ParseUtils.getTwoDigitValue(timeString, startPos);
if (mm < 0 || mm >= 60) {
throw new ParseException("Invalid minute of hour", startPos);
}
- startPos += 2;
+ startPos += 2;
if (startPos >= timeString.length()) {
throw new ParseException("Invalid time string", startPos);
} else if (timeString.charAt(startPos) != ':') {
@@ -224,41 +236,41 @@ public class ISO8601Time implements IDateTime<ISO8601Time>, Comparable<ISO8601Ti
/*
* Get the two-digit second of minute
*/
- int ss = ParseUtils.getTwoDigitValue(timeString, startPos);
+ int ss = ParseUtils.getTwoDigitValue(timeString, startPos);
if (ss < 0 || ss >= 60) {
throw new ParseException("Invalid second of minute", startPos);
}
- startPos += 2;
+ startPos += 2;
/*
* Now determine if we have a milliseconds portion
*/
- int ms = 0;
+ int ms = 0;
if (startPos < timeString.length()) {
if (timeString.charAt(startPos) == '.') {
startPos++;
if ((ms = ParseUtils.getThreeDigitValue(timeString, startPos)) < 0 || ms >= 1000) {
throw new ParseException("Invalid milliseconds", startPos);
}
- startPos += 3;
+ startPos += 3;
}
}
/*
* Now determine if there is a timezone
*/
- String timezone = null;
+ String timezone = null;
if (startPos < timeString.length()) {
- switch(timeString.charAt(startPos)) {
+ switch (timeString.charAt(startPos)) {
case 'Z':
- timezone = "GMT";
+ timezone = "GMT";
startPos++;
break;
case '-':
case '+':
- if (startPos+5 < timeString.length()) {
- timezone = "GMT" + timeString.substring(startPos, startPos+6);
+ if (startPos + 5 < timeString.length()) {
+ timezone = "GMT" + timeString.substring(startPos, startPos + 6);
} else {
throw new ParseException("Invalid timezone", startPos);
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601TimeZone.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601TimeZone.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601TimeZone.java
index 5181a0c..5d9a7ba 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601TimeZone.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ISO8601TimeZone.java
@@ -36,15 +36,14 @@ import com.att.research.xacml.api.SemanticString;
/**
* ISO8601TimeZone represents an ISO8601 TimeZone specification.
- *
*/
public class ISO8601TimeZone implements Comparable<ISO8601TimeZone>, SemanticString {
- private static int MAX_TZOFFSET_MINUTES = 60*24;
- private static int MAX_NORMALIZED_TZOFFSET_MINUTES = 60*12;
+ private static int MAX_TZOFFSET_MINUTES = 60 * 24;
+ private static int MAX_NORMALIZED_TZOFFSET_MINUTES = 60 * 12;
private int tzOffsetMinutes;
- public static final ISO8601TimeZone TIMEZONE_GMT = new ISO8601TimeZone(0);
+ public static final ISO8601TimeZone TIMEZONE_GMT = new ISO8601TimeZone(0);
/**
* Creates a new <code>ISO8601TimeZone</code> with the given time zone offset in minutes.
@@ -52,17 +51,17 @@ public class ISO8601TimeZone implements Comparable<ISO8601TimeZone>, SemanticStr
* @param tzOffsetMinutesIn the time zone offset in minutes
*/
public ISO8601TimeZone(int tzOffsetMinutesIn) {
- int absOffsetMinutes = Math.abs(tzOffsetMinutesIn);
+ int absOffsetMinutes = Math.abs(tzOffsetMinutesIn);
if (absOffsetMinutes > MAX_TZOFFSET_MINUTES) {
throw new IllegalArgumentException("Invalid ISO8601 timezone offset " + tzOffsetMinutesIn);
}
if (absOffsetMinutes <= MAX_NORMALIZED_TZOFFSET_MINUTES) {
- this.tzOffsetMinutes = tzOffsetMinutesIn;
+ this.tzOffsetMinutes = tzOffsetMinutesIn;
} else {
if (tzOffsetMinutesIn < 0) {
- this.tzOffsetMinutes = MAX_TZOFFSET_MINUTES - absOffsetMinutes;
+ this.tzOffsetMinutes = MAX_TZOFFSET_MINUTES - absOffsetMinutes;
} else {
- this.tzOffsetMinutes = -(MAX_TZOFFSET_MINUTES - absOffsetMinutes);
+ this.tzOffsetMinutes = -(MAX_TZOFFSET_MINUTES - absOffsetMinutes);
}
}
}
@@ -71,38 +70,39 @@ public class ISO8601TimeZone implements Comparable<ISO8601TimeZone>, SemanticStr
/*
* Look for timezone information
*/
- int startPos = ParseUtils.nextNonWhite(timezoneString, 0);
- int offsetMinutes = 0;
- int signPart = 1;
+ int startPos = ParseUtils.nextNonWhite(timezoneString, 0);
+ int offsetMinutes = 0;
+ int signPart = 1;
- switch(timezoneString.charAt(startPos)) {
+ switch (timezoneString.charAt(startPos)) {
case 'Z':
- offsetMinutes = 0;
+ offsetMinutes = 0;
startPos++;
break;
case '-':
- signPart = -1;
- /*
- * Note: Purposefully not breaking here so the remainder of timezone parsing takes place following the '+' label
- */
+ signPart = -1;
+ /*
+ * Note: Purposefully not breaking here so the remainder of timezone parsing takes place following
+ * the '+' label
+ */
case '+':
startPos++;
- int hourPart = ParseUtils.getTwoDigitValue(timezoneString, startPos);
+ int hourPart = ParseUtils.getTwoDigitValue(timezoneString, startPos);
if (hourPart < 0 || hourPart > 24) {
throw new ParseException("Invalid timezone", startPos);
}
- startPos += 2;
+ startPos += 2;
if (startPos >= timezoneString.length() || timezoneString.charAt(startPos) != ':') {
throw new ParseException("Invalid time string", startPos);
}
startPos++;
- int minutePart = ParseUtils.getTwoDigitValue(timezoneString, startPos);
+ int minutePart = ParseUtils.getTwoDigitValue(timezoneString, startPos);
if (minutePart < 0 || minutePart >= 60) {
throw new ParseException("Invalid timezone", startPos);
}
- startPos += 2;
+ startPos += 2;
- offsetMinutes = signPart*(hourPart*60 + minutePart);
+ offsetMinutes = signPart * (hourPart * 60 + minutePart);
break;
default:
@@ -124,29 +124,29 @@ public class ISO8601TimeZone implements Comparable<ISO8601TimeZone>, SemanticStr
if (this.tzOffsetMinutes == 0) {
return "GMT";
} else {
- int offsetAbs = Math.abs(this.tzOffsetMinutes);
- String sign = (this.tzOffsetMinutes < 0 ? "-" : "+");
- int hours = offsetAbs / 60;
- int minutes = offsetAbs - (60 * hours);
- return "GMT" + sign + String.format("%02d", hours) + ":" + String.format("%02d", minutes);
+ int offsetAbs = Math.abs(this.tzOffsetMinutes);
+ String sign = (this.tzOffsetMinutes < 0 ? "-" : "+");
+ int hours = offsetAbs / 60;
+ int minutes = offsetAbs - (60 * hours);
+ return "GMT" + sign + String.format("%02d", hours) + ":" + String.format("%02d", minutes);
}
}
@Override
public String stringValue() {
- int offset = this.getTzOffsetMinutes();
+ int offset = this.getTzOffsetMinutes();
if (offset == 0) {
return "Z";
}
- StringBuilder stringBuilder = new StringBuilder();
+ StringBuilder stringBuilder = new StringBuilder();
if (offset < 0) {
stringBuilder.append('-');
} else {
stringBuilder.append('+');
}
- int hourPart = offset / 60;
- int minutePart = offset - (hourPart * 60);
+ int hourPart = offset / 60;
+ int minutePart = offset - (hourPart * 60);
stringBuilder.append(String.format("%02d", hourPart));
stringBuilder.append(':');
stringBuilder.append(String.format("%02d", minutePart));
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/NodeNamespaceContext.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/NodeNamespaceContext.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/NodeNamespaceContext.java
index 656428c..d2e7988 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/NodeNamespaceContext.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/NodeNamespaceContext.java
@@ -43,13 +43,12 @@ import org.w3c.dom.Node;
/**
* NodeNamespaceContext extends {@link javax.xml.namespace.NamespaceContext} by delegating to the owning
* {@link org.w3c.dom.Document}.
- *
*/
public class NodeNamespaceContext extends ExtendedNamespaceContext {
private Document document;
public NodeNamespaceContext(Document documentIn) {
- this.document = documentIn;
+ this.document = documentIn;
}
@Override
@@ -72,8 +71,6 @@ public class NodeNamespaceContext extends ExtendedNamespaceContext {
return null;
}
-
-
@Override
public Iterator<String> getAllPrefixes() {
NamedNodeMap attributes = document.getDocumentElement().getAttributes();
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ParseUtils.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ParseUtils.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ParseUtils.java
index b1c046c..ebebde6 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ParseUtils.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/ParseUtils.java
@@ -33,7 +33,6 @@ package com.att.research.xacml.std.datatypes;
/**
* ParseUtils provides a number of static methods that are useful in parsing <code>String</code> objects into
* other java data types.
- *
*/
public class ParseUtils {
protected ParseUtils() {
@@ -44,64 +43,70 @@ public class ParseUtils {
private int nextPos;
public ParseValue(T v, int n) {
- this.value = v;
- this.nextPos = n;
+ this.value = v;
+ this.nextPos = n;
}
public T getValue() {
return this.value;
}
+
public int getNextPos() {
return this.nextPos;
}
}
static int getTwoDigitValue(String fromString, int startPos) {
- if (fromString.length() <= (startPos+1)) {
+ if (fromString.length() <= (startPos + 1)) {
return -1;
- } else if (!Character.isDigit(fromString.charAt(startPos)) || !Character.isDigit(fromString.charAt(startPos+1))) {
+ } else if (!Character.isDigit(fromString.charAt(startPos))
+ || !Character.isDigit(fromString.charAt(startPos + 1))) {
return -1;
} else {
- return 10*Character.digit(fromString.charAt(startPos), 10) + Character.digit(fromString.charAt(startPos+1), 10);
+ return 10 * Character.digit(fromString.charAt(startPos), 10)
+ + Character.digit(fromString.charAt(startPos + 1), 10);
}
}
static int getThreeDigitValue(String fromString, int startPos) {
- if (fromString.length() <= (startPos+2)) {
+ if (fromString.length() <= (startPos + 2)) {
return -1;
- } else if (!Character.isDigit(fromString.charAt(startPos)) || !Character.isDigit(fromString.charAt(startPos+1)) || !Character.isDigit(fromString.charAt(startPos+2))) {
+ } else if (!Character.isDigit(fromString.charAt(startPos))
+ || !Character.isDigit(fromString.charAt(startPos + 1))
+ || !Character.isDigit(fromString.charAt(startPos + 2))) {
return -1;
} else {
- return 100*Character.digit(fromString.charAt(startPos), 10) + 10*Character.digit(fromString.charAt(startPos+1), 10) + Character.digit(fromString.charAt(startPos+2), 10);
+ return 100 * Character.digit(fromString.charAt(startPos), 10) + 10
+ * Character.digit(fromString.charAt(startPos + 1), 10)
+ + Character.digit(fromString.charAt(startPos + 2), 10);
}
}
static int getFourDigitValue(String fromString, int startPos) {
if (fromString.length() <= (startPos + 3)) {
return -1;
- } else if (!Character.isDigit(fromString.charAt(startPos)) ||
- !Character.isDigit(fromString.charAt(startPos+1)) ||
- !Character.isDigit(fromString.charAt(startPos+2)) ||
- !Character.isDigit(fromString.charAt(startPos+3))
- ) {
+ } else if (!Character.isDigit(fromString.charAt(startPos))
+ || !Character.isDigit(fromString.charAt(startPos + 1))
+ || !Character.isDigit(fromString.charAt(startPos + 2))
+ || !Character.isDigit(fromString.charAt(startPos + 3))) {
return -1;
} else {
- return 1000*Character.digit(fromString.charAt(startPos), 10) +
- 100*Character.digit(fromString.charAt(startPos+1), 10) +
- 10*Character.digit(fromString.charAt(startPos+2), 10) +
- Character.digit(fromString.charAt(startPos+3), 10);
+ return 1000 * Character.digit(fromString.charAt(startPos), 10) + 100
+ * Character.digit(fromString.charAt(startPos + 1), 10) + 10
+ * Character.digit(fromString.charAt(startPos + 2), 10)
+ + Character.digit(fromString.charAt(startPos + 3), 10);
}
}
static ParseValue<Integer> getSignedValue(String fromString, int startPos) {
- int sign = 1;
- int value = 0;
- int i = startPos;
+ int sign = 1;
+ int value = 0;
+ int i = startPos;
if (i >= fromString.length()) {
return null;
}
if (fromString.charAt(i) == '-') {
- sign = -1;
+ sign = -1;
i++;
}
if (i >= fromString.length() || !Character.isDigit(fromString.charAt(i))) {
@@ -109,7 +114,7 @@ public class ParseUtils {
}
char charAt;
while (i < fromString.length() && Character.isDigit((charAt = fromString.charAt(i)))) {
- value = value*10 + Character.digit(charAt, 10);
+ value = value * 10 + Character.digit(charAt, 10);
i++;
}
return new ParseValue<Integer>(sign * value, i);
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/PortRange.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/PortRange.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/PortRange.java
index c438b27..5a43b4e 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/PortRange.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/PortRange.java
@@ -25,9 +25,8 @@ import java.text.ParseException;
import com.att.research.xacml.api.SemanticString;
/**
- * PortRange represents the optional range of port values for an <code>IPAddress</code>. A value of -1
- * for either port represents the limit for port numbers (min or max) in the given addressing scheme.
- *
+ * PortRange represents the optional range of port values for an <code>IPAddress</code>. A value of -1 for
+ * either port represents the limit for port numbers (min or max) in the given addressing scheme.
*/
public final class PortRange implements SemanticString {
private int portMin;
@@ -40,8 +39,8 @@ public final class PortRange implements SemanticString {
* @param portMaxIn the maximum port number of the range
*/
public PortRange(int portMinIn, int portMaxIn) {
- this.portMin = portMinIn;
- this.portMax = portMaxIn;
+ this.portMin = portMinIn;
+ this.portMax = portMaxIn;
}
/**
@@ -55,19 +54,19 @@ public final class PortRange implements SemanticString {
if (stringPortRange == null) {
return null;
}
- String[] portParts = stringPortRange.split("[-]", -1);
+ String[] portParts = stringPortRange.split("[-]", -1);
if (portParts == null || portParts.length == 0) {
return null;
} else if (portParts.length > 2) {
throw new ParseException("Invalid PortRange \"" + stringPortRange + "\": too many ranges", 0);
}
- int[] rangeParts = new int[portParts.length];
+ int[] rangeParts = new int[portParts.length];
try {
- for (int i = 0 ; i < portParts.length ; i++) {
+ for (int i = 0; i < portParts.length; i++) {
if (portParts[i].length() == 0) {
- rangeParts[i] = -1;
+ rangeParts[i] = -1;
} else {
- rangeParts[i] = Integer.parseInt(portParts[i]);
+ rangeParts[i] = Integer.parseInt(portParts[i]);
}
}
} catch (NumberFormatException ex) {
@@ -83,6 +82,7 @@ public final class PortRange implements SemanticString {
public int getPortMin() {
return this.portMin;
}
+
public int getPortMax() {
return this.portMax;
}
@@ -97,9 +97,9 @@ public final class PortRange implements SemanticString {
@Override
public String stringValue() {
- StringBuilder stringBuilder = new StringBuilder();
- int pMin = this.getPortMin();
- int pMax = this.getPortMax();
+ StringBuilder stringBuilder = new StringBuilder();
+ int pMin = this.getPortMin();
+ int pMax = this.getPortMax();
if (pMin >= 0) {
stringBuilder.append(pMin);
}
@@ -112,12 +112,12 @@ public final class PortRange implements SemanticString {
@Override
public int hashCode() {
- int hc = 0;
+ int hc = 0;
if (this.getPortMax() > 0) {
- hc += this.getPortMax();
+ hc += this.getPortMax();
}
if (this.getPortMin() > 0) {
- hc += this.getPortMax();
+ hc += this.getPortMax();
}
return hc;
}
@@ -129,16 +129,14 @@ public final class PortRange implements SemanticString {
} else if (obj == this) {
return true;
} else {
- PortRange portRange = (PortRange)obj;
- return (this.getPortMax() == portRange.getPortMax() && this.getPortMin() == portRange.getPortMin());
+ PortRange portRange = (PortRange)obj;
+ return (this.getPortMax() == portRange.getPortMax() && this.getPortMin() == portRange
+ .getPortMin());
}
}
@Override
public String toString() {
- return "{" +
- "portMin=" + this.getPortMin() +
- "portMax=" + this.getPortMax() +
- "}";
+ return "{" + "portMin=" + this.getPortMin() + "portMax=" + this.getPortMax() + "}";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC2396DomainName.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC2396DomainName.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC2396DomainName.java
index 87506e4..5fbf194 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC2396DomainName.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC2396DomainName.java
@@ -36,11 +36,10 @@ import com.att.research.xacml.api.SemanticString;
/**
* RFC2396DomainName represents a host name from the RFC2396 specification.
- *
*/
public class RFC2396DomainName implements SemanticString {
- private String domainName;
- private PortRange portRange;
+ private String domainName;
+ private PortRange portRange;
public static boolean isValidTopLabel(String topLabel) {
if (topLabel == null || topLabel.length() == 0) {
@@ -51,8 +50,8 @@ public class RFC2396DomainName implements SemanticString {
return false;
}
if (topLabel.length() > 1) {
- for (int i = 1 ; i < topLabel.length() - 1 ; i++) {
- char c = topLabel.charAt(i);
+ for (int i = 1; i < topLabel.length() - 1; i++) {
+ char c = topLabel.charAt(i);
if (!(Character.isLetterOrDigit(c) || c == '-')) {
return false;
}
@@ -73,8 +72,8 @@ public class RFC2396DomainName implements SemanticString {
return false;
}
if (domainLabel.length() > 1) {
- for (int i = 1 ; i < domainLabel.length() - 1 ; i++) {
- char c = domainLabel.charAt(i);
+ for (int i = 1; i < domainLabel.length() - 1; i++) {
+ char c = domainLabel.charAt(i);
if (!(Character.isLetterOrDigit(c) || c == '-')) {
return false;
}
@@ -90,7 +89,7 @@ public class RFC2396DomainName implements SemanticString {
if (hostName == null || hostName.length() == 0) {
return false;
}
- String[] labels = hostName.split("[.]",-1);
+ String[] labels = hostName.split("[.]", -1);
if (labels == null || labels.length == 0) {
return false;
}
@@ -98,7 +97,7 @@ public class RFC2396DomainName implements SemanticString {
/*
* Validate the domain label parts
*/
- for (int i = 0 ; i < labels.length-1 ; i++) {
+ for (int i = 0; i < labels.length - 1; i++) {
if (!isValidDomainLabel(labels[i])) {
return false;
}
@@ -107,7 +106,7 @@ public class RFC2396DomainName implements SemanticString {
/*
* Validate the top label
*/
- if (!isValidTopLabel(labels[labels.length-1])) {
+ if (!isValidTopLabel(labels[labels.length - 1])) {
return false;
}
return true;
@@ -118,11 +117,12 @@ public class RFC2396DomainName implements SemanticString {
throw new IllegalArgumentException("Invalid RFC2396 domain name");
}
this.domainName = domainNameIn;
- this.portRange = portRangeIn;
+ this.portRange = portRangeIn;
}
/**
- * Parses an RFC2396 domain name of the form [domain.[domain.[...]].name[:port-range] to create a new <code>RFC2396DomainName</code>.
+ * Parses an RFC2396 domain name of the form [domain.[domain.[...]].name[:port-range] to create a new
+ * <code>RFC2396DomainName</code>.
*
* @param rfc2396DomainNameString the <code>String</code> name to parse
* @return a new <code>RFC2396DomainName</code> generated from the given <code>String</code>
@@ -136,20 +136,22 @@ public class RFC2396DomainName implements SemanticString {
/*
* Break the string up into its name and port range parts
*/
- int colonPos = rfc2396DomainNameString.indexOf(':');
- String hostName = (colonPos < 0 ? rfc2396DomainNameString : rfc2396DomainNameString.substring(0, colonPos));
+ int colonPos = rfc2396DomainNameString.indexOf(':');
+ String hostName = (colonPos < 0 ? rfc2396DomainNameString : rfc2396DomainNameString
+ .substring(0, colonPos));
if (!isValidHostName(hostName)) {
throw new ParseException("Invalid RFC 2396 host name \"" + hostName + "\"", 0);
}
- PortRange portRange = null;
+ PortRange portRange = null;
if (colonPos >= 0) {
if (colonPos + 1 >= rfc2396DomainNameString.length()) {
- throw new ParseException("Invalid RFC 2396 port range \"" + rfc2396DomainNameString + "\": no port numbers", colonPos);
+ throw new ParseException("Invalid RFC 2396 port range \"" + rfc2396DomainNameString
+ + "\": no port numbers", colonPos);
}
- String stringPortRange = rfc2396DomainNameString.substring(colonPos+1);
+ String stringPortRange = rfc2396DomainNameString.substring(colonPos + 1);
try {
- portRange = PortRange.newInstance(stringPortRange);
+ portRange = PortRange.newInstance(stringPortRange);
} catch (ParseException ex) {
throw new ParseException("Invalid RFC 2396 port range \"" + stringPortRange + "\"", colonPos);
}
@@ -168,7 +170,7 @@ public class RFC2396DomainName implements SemanticString {
@Override
public String stringValue() {
- StringBuilder stringBuilder = new StringBuilder();
+ StringBuilder stringBuilder = new StringBuilder();
if (this.getDomainName() != null) {
stringBuilder.append(this.getDomainName());
}
@@ -181,7 +183,7 @@ public class RFC2396DomainName implements SemanticString {
@Override
public int hashCode() {
- int hc = (this.getDomainName() == null ? 0 : this.getDomainName().hashCode());
+ int hc = (this.getDomainName() == null ? 0 : this.getDomainName().hashCode());
return hc + (this.getPortRange() == null ? 0 : this.getPortRange().hashCode());
}
@@ -192,7 +194,7 @@ public class RFC2396DomainName implements SemanticString {
} else if (obj == this) {
return true;
} else {
- RFC2396DomainName rfc2396DomainName = (RFC2396DomainName)obj;
+ RFC2396DomainName rfc2396DomainName = (RFC2396DomainName)obj;
if (this.getDomainName() == null) {
if (rfc2396DomainName.getDomainName() != null) {
return false;
@@ -212,13 +214,13 @@ public class RFC2396DomainName implements SemanticString {
@Override
public String toString() {
- StringBuilder stringBuilder = new StringBuilder("{");
- boolean needComma = false;
+ StringBuilder stringBuilder = new StringBuilder("{");
+ boolean needComma = false;
if (this.getDomainName() != null) {
stringBuilder.append("domainName=");
stringBuilder.append(this.getDomainName());
- needComma = true;
+ needComma = true;
}
if (this.getPortRange() != null) {
if (needComma) {
@@ -226,7 +228,7 @@ public class RFC2396DomainName implements SemanticString {
}
stringBuilder.append("portRange=");
stringBuilder.append(this.getPortRange().toString());
- needComma = true;
+ needComma = true;
}
stringBuilder.append('}');
return stringBuilder.toString();
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC822Name.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC822Name.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC822Name.java
index 54321b2..8f30bf1 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC822Name.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/RFC822Name.java
@@ -36,17 +36,17 @@ import com.att.research.xacml.api.SemanticString;
/**
* RFC822Name represents an RFC 822 name consisting of a local part and a domain part.
- *
*/
public class RFC822Name implements Comparable<RFC822Name>, SemanticString {
- private String localName;
- private String domainName;
+ private String localName;
+ private String domainName;
public RFC822Name(String localNameIn, String domainNameIn) {
- if (localNameIn == null || localNameIn.length() == 0 || domainNameIn == null || domainNameIn.length() == 0) {
+ if (localNameIn == null || localNameIn.length() == 0 || domainNameIn == null
+ || domainNameIn.length() == 0) {
throw new IllegalArgumentException("Invalid RFC822Name");
}
- this.localName = localNameIn;
+ this.localName = localNameIn;
this.domainName = domainNameIn;
}
@@ -54,18 +54,21 @@ public class RFC822Name implements Comparable<RFC822Name>, SemanticString {
if (rfc822NameString == null) {
return null;
} else {
- String[] parts = rfc822NameString.split("[@]",-1);
+ String[] parts = rfc822NameString.split("[@]", -1);
if (parts == null || parts.length == 0) {
return null;
} else if (parts.length == 1) {
- throw new ParseException("Invalid RFC822Name \"" + rfc822NameString + "\": missing local part", 0);
+ throw new ParseException("Invalid RFC822Name \"" + rfc822NameString
+ + "\": missing local part", 0);
} else if (parts.length == 2) {
if (parts[0].length() == 0 || parts[1].length() == 0) {
- throw new ParseException("Invalid RFC822Name \"" + rfc822NameString + "\": empty parts", 0);
+ throw new ParseException("Invalid RFC822Name \"" + rfc822NameString + "\": empty parts",
+ 0);
}
return new RFC822Name(parts[0], parts[1]);
} else {
- throw new ParseException("Invalid RFC822Name \"" + rfc822NameString + "\": too many @ delimiters", 0);
+ throw new ParseException("Invalid RFC822Name \"" + rfc822NameString
+ + "\": too many @ delimiters", 0);
}
}
}
@@ -96,8 +99,8 @@ public class RFC822Name implements Comparable<RFC822Name>, SemanticString {
}
/**
- * Determines if the given <code>RFC822Name</code> matches this <code>RFC822Name</code>, which may
- * either be a full name or a pattern, using the XACML rules for matching RFC822 names.
+ * Determines if the given <code>RFC822Name</code> matches this <code>RFC822Name</code>, which may either
+ * be a full name or a pattern, using the XACML rules for matching RFC822 names.
*
* @param pattern the <code>String</code> pattern to match against
* @return true if this <code>RFC822Name</code> matches the given <code>RFC822Name</code>
@@ -107,7 +110,7 @@ public class RFC822Name implements Comparable<RFC822Name>, SemanticString {
return false;
}
- String[] patternParts = pattern.split("[@]",-1);
+ String[] patternParts = pattern.split("[@]", -1);
if (patternParts == null || patternParts.length == 0 || patternParts.length > 1) {
return false;
}
@@ -121,8 +124,8 @@ public class RFC822Name implements Comparable<RFC822Name>, SemanticString {
}
}
- String thisDomainName = this.getCanonicalDomainName();
- String thatDomainName = (patternParts.length == 0 ? patternParts[0] : patternParts[1]);
+ String thisDomainName = this.getCanonicalDomainName();
+ String thatDomainName = (patternParts.length == 0 ? patternParts[0] : patternParts[1]);
if (thatDomainName == null) {
return false;
}
@@ -135,14 +138,14 @@ public class RFC822Name implements Comparable<RFC822Name>, SemanticString {
@Override
public String toString() {
- StringBuilder stringBuilder = new StringBuilder("{");
- boolean needComma = false;
+ StringBuilder stringBuilder = new StringBuilder("{");
+ boolean needComma = false;
String stringToDump;
if ((stringToDump = this.getLocalName()) != null) {
stringBuilder.append("localName=");
stringBuilder.append(stringToDump);
- needComma = true;
+ needComma = true;
}
if ((stringToDump = this.getDomainName()) != null) {
if (needComma) {
@@ -150,7 +153,7 @@ public class RFC822Name implements Comparable<RFC822Name>, SemanticString {
}
stringBuilder.append("domainName=");
stringBuilder.append(stringToDump);
- needComma = true;
+ needComma = true;
}
stringBuilder.append('}');
return stringBuilder.toString();
@@ -158,7 +161,7 @@ public class RFC822Name implements Comparable<RFC822Name>, SemanticString {
@Override
public int hashCode() {
- return ( this.getLocalName().hashCode() + this.getCanonicalDomainName().hashCode());
+ return (this.getLocalName().hashCode() + this.getCanonicalDomainName().hashCode());
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/StringNamespaceContext.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/StringNamespaceContext.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/StringNamespaceContext.java
index 64ec60f..a86f0fe 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/StringNamespaceContext.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/StringNamespaceContext.java
@@ -38,14 +38,11 @@ import java.util.Map;
import javax.xml.XMLConstants;
-
-
/**
- * StringNamespaceContext extends {@link javax.xml.namespace.NamespaceContext} by
- * keeping the Namespace definitions as Strings.
- * This NamespaceContext applies to only a single scope and therefore can have at most one default unbound (i.e. with no Prefix) Namespace.
- * All other Namespaces in this context must have a prefix.
- *
+ * StringNamespaceContext extends {@link javax.xml.namespace.NamespaceContext} by keeping the Namespace
+ * definitions as Strings. This NamespaceContext applies to only a single scope and therefore can have at most
+ * one default unbound (i.e. with no Prefix) Namespace. All other Namespaces in this context must have a
+ * prefix.
*/
public class StringNamespaceContext extends ExtendedNamespaceContext {
@@ -54,11 +51,12 @@ public class StringNamespaceContext extends ExtendedNamespaceContext {
private String prefix;
private String namespace;
-// if we make this a first-class object, do not let people create it without args
-// private Namespace(){}
+ // if we make this a first-class object, do not let people create it without args
+ // private Namespace(){}
/**
* Create a new Namespace with only a namespaceURI
+ *
* @param namespace
*/
public Namespace(String namespace) {
@@ -68,6 +66,7 @@ public class StringNamespaceContext extends ExtendedNamespaceContext {
/**
* Create a new Namespace with both prefix and namespace URI
+ *
* @param prefix
* @param namespace
*/
@@ -79,6 +78,7 @@ public class StringNamespaceContext extends ExtendedNamespaceContext {
public String getPrefix() {
return this.prefix;
}
+
public String getNamespace() {
return this.namespace;
}
@@ -89,22 +89,24 @@ public class StringNamespaceContext extends ExtendedNamespaceContext {
}
}
-
/*
- * The access methods make it simpler to store Namespaces that have prefixes (which is all of them except the default, if any) in a Map
+ * The access methods make it simpler to store Namespaces that have prefixes (which is all of them except
+ * the default, if any) in a Map
*/
- private Map<String,Namespace> namespaceMap = new HashMap<String,Namespace>();
+ private Map<String, Namespace> namespaceMap = new HashMap<String, Namespace>();
private Namespace defaultNamespace = null;
-
/**
* Basic constructor
*/
- public StringNamespaceContext() {}
+ public StringNamespaceContext() {
+ }
/**
- * Constructor with a single entry consisting of only a Namespace URI without a Prefix (ie. the default namespace)
+ * Constructor with a single entry consisting of only a Namespace URI without a Prefix (ie. the default
+ * namespace)
+ *
* @param namespaceURI
* @throws Exception
*/
@@ -123,7 +125,6 @@ public class StringNamespaceContext extends ExtendedNamespaceContext {
this.add(prefix, namespaceURI);
}
-
/**
* Add a default Namespace to the list using just the Namespace URI (without a prefix).
*
@@ -156,18 +157,16 @@ public class StringNamespaceContext extends ExtendedNamespaceContext {
}
// prefix is non-null
if (namespaceMap.get(prefix) != null) {
- throw new Exception("Namespace prefix '" + prefix + "' already in use (value='" + namespaceMap.get(prefix) + "'");
+ throw new Exception("Namespace prefix '" + prefix + "' already in use (value='"
+ + namespaceMap.get(prefix) + "'");
}
namespaceMap.put(prefix, new Namespace(prefix, namespace));
}
-
-
//
// Methods implementing NamespaceContext interface
//
-
@Override
public String getNamespaceURI(String prefix) {
if (prefix == null) {
@@ -202,7 +201,7 @@ public class StringNamespaceContext extends ExtendedNamespaceContext {
} else if (namespaceURI.equals(XMLConstants.XML_NS_URI)) {
return XMLConstants.XML_NS_PREFIX;
}
- // search the map looking for an entry that matches
+ // search the map looking for an entry that matches
for (String key : namespaceMap.keySet()) {
Namespace namespace = namespaceMap.get(key);
if (namespace.getNamespace().equals(namespaceURI)) {
@@ -213,7 +212,6 @@ public class StringNamespaceContext extends ExtendedNamespaceContext {
return null;
}
-
@SuppressWarnings("rawtypes")
@Override
public Iterator getPrefixes(String namespaceURI) {
@@ -239,10 +237,6 @@ public class StringNamespaceContext extends ExtendedNamespaceContext {
return prefixList.iterator();
}
-
-
-
-
@Override
public Iterator<String> getAllPrefixes() {
// if the default namespace is not in use, just return the iterator for the prefixes in the map
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathDayTimeDuration.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathDayTimeDuration.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathDayTimeDuration.java
index 4371db1..b402923 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathDayTimeDuration.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathDayTimeDuration.java
@@ -33,12 +33,11 @@ package com.att.research.xacml.std.datatypes;
import java.text.ParseException;
/**
- * XPathDayTimeDuration extends {@link ISO8601Duration} to restrict values
- * to day and time components only, and then provides for ordering based on canonical duration in fractional seconds.
- *
+ * XPathDayTimeDuration extends {@link ISO8601Duration} to restrict values to day and time components only,
+ * and then provides for ordering based on canonical duration in fractional seconds.
*/
public class XPathDayTimeDuration extends ISO8601Duration implements Comparable<XPathDayTimeDuration> {
- private double fractionalSeconds;
+ private double fractionalSeconds;
/**
* Creates a new XPathDayTimeDuration with the given sign, days, hours, minutes, and seconds.
@@ -51,12 +50,9 @@ public class XPathDayTimeDuration extends ISO8601Duration implements Comparable<
*/
public XPathDayTimeDuration(int durationSignIn, int daysIn, int hoursIn, int minutesIn, double secondsIn) {
super(durationSignIn, 0, 0, daysIn, hoursIn, minutesIn, secondsIn);
- fractionalSeconds = this.getDurationSign() * (
- this.getDays() * 24 * 60 * 60 +
- this.getHours() * 60 * 60 +
- this.getMinutes() * 60 +
- this.getFractionalSecs()
- );
+ fractionalSeconds = this.getDurationSign()
+ * (this.getDays() * 24 * 60 * 60 + this.getHours() * 60 * 60 + this.getMinutes()
+ * 60 + this.getFractionalSecs());
}
public double getFractionalSeconds() {
@@ -75,8 +71,8 @@ public class XPathDayTimeDuration extends ISO8601Duration implements Comparable<
}
/**
- * Creates a new <code>XPathDayTimeDuration</code> by parsing the given ISO8601 duration string and validating that
- * it only contains days, hours, minutes, and seconds components.
+ * Creates a new <code>XPathDayTimeDuration</code> by parsing the given ISO8601 duration string and
+ * validating that it only contains days, hours, minutes, and seconds components.
*
* @param iso8601DurationString
* @return
@@ -87,8 +83,8 @@ public class XPathDayTimeDuration extends ISO8601Duration implements Comparable<
}
/**
- * Creates a new <code>XPathDayTimeDuration</code> from an existing <code>ISO8601Duration</code> by validating
- * that it only contains the day and time components.
+ * Creates a new <code>XPathDayTimeDuration</code> from an existing <code>ISO8601Duration</code> by
+ * validating that it only contains the day and time components.
*
* @param iso8601Duration
* @return
@@ -99,31 +95,34 @@ public class XPathDayTimeDuration extends ISO8601Duration implements Comparable<
return null;
}
if (iso8601Duration.getYears() > 0 || iso8601Duration.getMonths() > 0) {
- throw new ParseException("Invalid XPath dayTimeDuration \"" + iso8601Duration.toString() + "\": includes years or months component", 0);
+ throw new ParseException("Invalid XPath dayTimeDuration \"" + iso8601Duration.toString()
+ + "\": includes years or months component", 0);
}
- return new XPathDayTimeDuration(iso8601Duration.getDurationSign(), iso8601Duration.getDays(), iso8601Duration.getHours(), iso8601Duration.getMinutes(), iso8601Duration.getFractionalSecs());
+ return new XPathDayTimeDuration(iso8601Duration.getDurationSign(), iso8601Duration.getDays(),
+ iso8601Duration.getHours(), iso8601Duration.getMinutes(),
+ iso8601Duration.getFractionalSecs());
}
/**
- * Computes the canonical <code>XPathDayTimeDuration</code> by converting the fractional seconds to canonical
- * days, hours, minutes, and seconds.
+ * Computes the canonical <code>XPathDayTimeDuration</code> by converting the fractional seconds to
+ * canonical days, hours, minutes, and seconds.
*
* @return the canonical <code>XPathDayTimeDuration</code> for this <code>XPathDayTimeDuration</code>
*/
public XPathDayTimeDuration getCanonicalDuration() {
- double fractionalSecondsLeft = Math.abs(this.getFractionalSeconds());
- int days = (int)(fractionalSecondsLeft/(24*60*60));
- fractionalSecondsLeft -= (days*24*60*60);
- int hours = (int)(fractionalSecondsLeft/(60*60));
- fractionalSecondsLeft -= (hours*60*60);
- int minutes = (int)(fractionalSecondsLeft/60);
- fractionalSecondsLeft -= (minutes*60);
+ double fractionalSecondsLeft = Math.abs(this.getFractionalSeconds());
+ int days = (int)(fractionalSecondsLeft / (24 * 60 * 60));
+ fractionalSecondsLeft -= (days * 24 * 60 * 60);
+ int hours = (int)(fractionalSecondsLeft / (60 * 60));
+ fractionalSecondsLeft -= (hours * 60 * 60);
+ int minutes = (int)(fractionalSecondsLeft / 60);
+ fractionalSecondsLeft -= (minutes * 60);
return new XPathDayTimeDuration(this.getDurationSign(), days, hours, minutes, fractionalSecondsLeft);
}
@Override
public String toString() {
- StringBuilder stringBuilder = new StringBuilder("{super=");
+ StringBuilder stringBuilder = new StringBuilder("{super=");
stringBuilder.append(super.toString());
stringBuilder.append(",factionalSeconds=");
stringBuilder.append(this.getFractionalSecs());
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathExpressionWrapper.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathExpressionWrapper.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathExpressionWrapper.java
index 475ae38..a1463bf 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathExpressionWrapper.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathExpressionWrapper.java
@@ -46,19 +46,18 @@ import com.att.research.xacml.std.StdStatus;
import com.att.research.xacml.std.StdStatusCode;
/**
- * XPathExpressionWrapper implements the {@link javax.xml.xpath.XPathExpression} interface to wrap another <code>XPathExpression</code> and
- * keep the path expression that was used to create it.
- *
+ * XPathExpressionWrapper implements the {@link javax.xml.xpath.XPathExpression} interface to wrap another
+ * <code>XPathExpression</code> and keep the path expression that was used to create it.
*/
public class XPathExpressionWrapper implements XPathExpression {
- private XPathExpression xpathExpressionWrapped;
+ private XPathExpression xpathExpressionWrapped;
private String path;
private ExtendedNamespaceContext namespaceContext;
private Status status;
public XPathExpressionWrapper(ExtendedNamespaceContext namespaceContextIn, String pathIn) {
- this.namespaceContext = namespaceContextIn;
- this.path = pathIn;
+ this.namespaceContext = namespaceContextIn;
+ this.path = pathIn;
}
public XPathExpressionWrapper(Document documentIn, String pathIn) {
@@ -77,22 +76,23 @@ public class XPathExpressionWrapper implements XPathExpression {
}
public XPathExpressionWrapper(XPathExpression xpathExpression) {
- this.xpathExpressionWrapped = xpathExpression;
+ this.xpathExpressionWrapped = xpathExpression;
}
public synchronized XPathExpression getXpathExpressionWrapped() {
if (this.xpathExpressionWrapped == null && (this.getStatus() == null || this.getStatus().isOk())) {
- String thisPath = this.getPath();
+ String thisPath = this.getPath();
if (thisPath != null) {
- XPath xPath = XPathFactory.newInstance().newXPath();
- NamespaceContext namespaceContextThis = this.getNamespaceContext();
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ NamespaceContext namespaceContextThis = this.getNamespaceContext();
if (namespaceContextThis != null) {
xPath.setNamespaceContext(namespaceContextThis);
}
try {
this.xpathExpressionWrapped = xPath.compile(thisPath);
} catch (XPathExpressionException ex) {
- this.status = new StdStatus(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, "Error compiling XPath " + thisPath + ": " + ex.getMessage());
+ this.status = new StdStatus(StdStatusCode.STATUS_CODE_SYNTAX_ERROR,
+ "Error compiling XPath " + thisPath + ": " + ex.getMessage());
}
}
}
@@ -113,47 +113,47 @@ public class XPathExpressionWrapper implements XPathExpression {
@Override
public Object evaluate(Object item, QName returnType) throws XPathExpressionException {
- XPathExpression thisXPathExpression = this.getXpathExpressionWrapped();
+ XPathExpression thisXPathExpression = this.getXpathExpressionWrapped();
return (thisXPathExpression == null ? null : thisXPathExpression.evaluate(item, returnType));
}
@Override
public String evaluate(Object item) throws XPathExpressionException {
- XPathExpression thisXPathExpression = this.getXpathExpressionWrapped();
+ XPathExpression thisXPathExpression = this.getXpathExpressionWrapped();
return (thisXPathExpression == null ? null : thisXPathExpression.evaluate(item));
}
@Override
public Object evaluate(InputSource source, QName returnType) throws XPathExpressionException {
- XPathExpression thisXPathExpression = this.getXpathExpressionWrapped();
+ XPathExpression thisXPathExpression = this.getXpathExpressionWrapped();
return (thisXPathExpression == null ? null : thisXPathExpression.evaluate(source, returnType));
}
@Override
public String evaluate(InputSource source) throws XPathExpressionException {
- XPathExpression thisXPathExpression = this.getXpathExpressionWrapped();
+ XPathExpression thisXPathExpression = this.getXpathExpressionWrapped();
return (thisXPathExpression == null ? null : thisXPathExpression.evaluate(source));
}
-
@Override
public boolean equals(Object o) {
- if (o == null || ! (o instanceof XPathExpressionWrapper)) {
+ if (o == null || !(o instanceof XPathExpressionWrapper)) {
return false;
}
- XPathExpressionWrapper other = (XPathExpressionWrapper) o;
+ XPathExpressionWrapper other = (XPathExpressionWrapper)o;
return this.path.equals(other.path);
}
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
- sb.append("path="+this.path);
- // the document is not printed by toString, but what we really want from it is the Namespace attributes
+ sb.append("path=" + this.path);
+ // the document is not printed by toString, but what we really want from it is the Namespace
+ // attributes
sb.append(",Namespace=" + this.namespaceContext);
- sb.append(",status="+this.status);
- sb.append(",xpathExpressionWrapped=" + ((this.xpathExpressionWrapped == null) ? "null" : "(XpathExpression object)"));
+ sb.append(",status=" + this.status);
+ sb.append(",xpathExpressionWrapped="
+ + ((this.xpathExpressionWrapped == null) ? "null" : "(XpathExpression object)"));
sb.append("}");
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathYearMonthDuration.java
----------------------------------------------------------------------
diff --git a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathYearMonthDuration.java b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathYearMonthDuration.java
index 3116d18..efca1d4 100644
--- a/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathYearMonthDuration.java
+++ b/openaz-xacml/src/main/java/com/att/research/xacml/std/datatypes/XPathYearMonthDuration.java
@@ -33,16 +33,14 @@ package com.att.research.xacml.std.datatypes;
import java.text.ParseException;
/**
- * XPathYearMonthDuration extends {@link ISO8601Duration} to implement the XPath yearMonthDuration
- * data type.
- *
+ * XPathYearMonthDuration extends {@link ISO8601Duration} to implement the XPath yearMonthDuration data type.
*/
public class XPathYearMonthDuration extends ISO8601Duration implements Comparable<XPathYearMonthDuration> {
private int monthsDuration;
public XPathYearMonthDuration(int durationSignIn, int yearsIn, int monthsIn) {
super(durationSignIn, yearsIn, monthsIn, 0, 0, 0, 0);
- this.monthsDuration = this.getDurationSign() * (this.getYears()*12 + this.getMonths());
+ this.monthsDuration = this.getDurationSign() * (this.getYears() * 12 + this.getMonths());
}
/**
@@ -55,15 +53,15 @@ public class XPathYearMonthDuration extends ISO8601Duration implements Comparabl
}
/**
- * Gets a canonical <code>XPathYearMonthDuration</code> from this <code>XPathYearMonthDuration</code> by ensuring
- * the number of months never exceeds 11, converting excess months to additional years.
+ * Gets a canonical <code>XPathYearMonthDuration</code> from this <code>XPathYearMonthDuration</code> by
+ * ensuring the number of months never exceeds 11, converting excess months to additional years.
*
* @return a new <code>XPathYearMonthDuration</code> in canonical format
*/
public XPathYearMonthDuration getCanonical() {
- int monthsLeft = Math.abs(this.getMonthsDuration());
- int years = monthsLeft / 12;
- monthsLeft -= years * 12;
+ int monthsLeft = Math.abs(this.getMonthsDuration());
+ int years = monthsLeft / 12;
+ monthsLeft -= years * 12;
return new XPathYearMonthDuration(this.getDurationSign(), years, monthsLeft);
}
@@ -82,10 +80,13 @@ public class XPathYearMonthDuration extends ISO8601Duration implements Comparabl
if (iso8601Duration == null) {
return null;
}
- if (iso8601Duration.getDays() > 0 || iso8601Duration.getHours() > 0 || iso8601Duration.getMinutes() > 0 || iso8601Duration.getFractionalSecs() > 0) {
- throw new ParseException("Invalid XPath yearMonthDuraiton \"" + iso8601Duration.toString() + "\": includes days, hours, minutes, or seconds", 0);
+ if (iso8601Duration.getDays() > 0 || iso8601Duration.getHours() > 0
+ || iso8601Duration.getMinutes() > 0 || iso8601Duration.getFractionalSecs() > 0) {
+ throw new ParseException("Invalid XPath yearMonthDuraiton \"" + iso8601Duration.toString()
+ + "\": includes days, hours, minutes, or seconds", 0);
}
- return new XPathYearMonthDuration(iso8601Duration.getDurationSign(), iso8601Duration.getYears(), iso8601Duration.getMonths());
+ return new XPathYearMonthDuration(iso8601Duration.getDurationSign(), iso8601Duration.getYears(),
+ iso8601Duration.getMonths());
}
public static XPathYearMonthDuration newInstance(String iso8601DurationString) throws ParseException {
@@ -94,7 +95,7 @@ public class XPathYearMonthDuration extends ISO8601Duration implements Comparabl
@Override
public String toString() {
- StringBuilder stringBuilder = new StringBuilder("{super=");
+ StringBuilder stringBuilder = new StringBuilder("{super=");
stringBuilder.append(super.toString());
stringBuilder.append(",monthsDuration=");
stringBuilder.append(this.getMonthsDuration());