@@ -29,13 +29,12 @@ public class Zone implements Serializable {
2929 private Map <Name , Object > data ;
3030 private Name origin ;
3131 private Object originNode ;
32- private int dclass = DClass .IN ;
3332 private RRset NS ;
3433 private SOARecord SOA ;
3534 private boolean hasWild ;
3635
3736 class ZoneIterator implements Iterator <RRset > {
38- private Iterator zentries ;
37+ private Iterator < Map . Entry < Name , Object >> zentries ;
3938 private RRset [] current ;
4039 private int count ;
4140 private boolean wantLastSOA ;
@@ -77,7 +76,7 @@ public RRset next() {
7776 if (count == current .length ) {
7877 current = null ;
7978 while (zentries .hasNext ()) {
80- Map .Entry entry = ( Map . Entry ) zentries .next ();
79+ Map .Entry < Name , Object > entry = zentries .next ();
8180 if (entry .getKey ().equals (origin )) {
8281 continue ;
8382 }
@@ -178,14 +177,14 @@ private void fromXFR(ZoneTransferIn xfrin) throws IOException, ZoneTransferExcep
178177 }
179178
180179 origin = xfrin .getName ();
181- List records = xfrin .run ();
182- for (Object o : records ) {
183- Record record = (Record ) o ;
184- maybeAddRecord (record );
185- }
180+ xfrin .run ();
186181 if (!xfrin .isAXFR ()) {
187182 throw new IllegalArgumentException ("zones can only be created from AXFRs" );
188183 }
184+
185+ for (Record record : xfrin .getAXFR ()) {
186+ maybeAddRecord (record );
187+ }
189188 validate ();
190189 }
191190
@@ -227,7 +226,7 @@ public SOARecord getSOA() {
227226
228227 /** Returns the Zone's class */
229228 public int getDClass () {
230- return dclass ;
229+ return DClass . IN ;
231230 }
232231
233232 private synchronized Object exactName (Name name ) {
@@ -245,7 +244,7 @@ private synchronized RRset[] allRRsets(Object types) {
245244 }
246245 }
247246
248- private synchronized < T extends Record > RRset oneRRset (Object types , int type ) {
247+ private synchronized RRset oneRRset (Object types , int type ) {
249248 if (type == Type .ANY ) {
250249 throw new IllegalArgumentException ("oneRRset(ANY)" );
251250 }
@@ -266,7 +265,7 @@ private synchronized <T extends Record> RRset oneRRset(Object types, int type) {
266265 return null ;
267266 }
268267
269- private synchronized < T extends Record > RRset findRRset (Name name , int type ) {
268+ private synchronized RRset findRRset (Name name , int type ) {
270269 Object types = exactName (name );
271270 if (types == null ) {
272271 return null ;
@@ -314,9 +313,10 @@ private synchronized void removeRRset(Name name, int type) {
314313 return ;
315314 }
316315 if (types instanceof List ) {
317- List list = (List ) types ;
316+ @ SuppressWarnings ("unchecked" )
317+ List <RRset > list = (List <RRset >) types ;
318318 for (int i = 0 ; i < list .size (); i ++) {
319- RRset set = ( RRset ) list .get (i );
319+ RRset set = list .get (i );
320320 if (set .getType () == type ) {
321321 list .remove (i );
322322 if (list .size () == 0 ) {
@@ -454,7 +454,7 @@ public SetResponse findRecords(Name name, int type) {
454454 * @return The matching RRset
455455 * @see RRset
456456 */
457- public < T extends Record > RRset findExactMatch (Name name , int type ) {
457+ public RRset findExactMatch (Name name , int type ) {
458458 Object types = exactName (name );
459459 if (types == null ) {
460460 return null ;
@@ -499,7 +499,7 @@ public <T extends Record> void addRecord(T r) {
499499 * @param r The record to be removed
500500 * @see Record
501501 */
502- public < T extends Record > void removeRecord (T r ) {
502+ public void removeRecord (Record r ) {
503503 Name name = r .getName ();
504504 int rtype = r .getRRsetType ();
505505 synchronized (this ) {
0 commit comments