Skip to content

Commit 00960f0

Browse files
committed
replace IllegalStateException to logging on deserializers
1 parent 2a40dde commit 00960f0

36 files changed

+86
-79
lines changed

src/main/java/com/bhyoo/onedrive/client/auth/AuthenticationInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.jetbrains.annotations.Nullable;
99

1010
import java.io.IOException;
11+
import java.util.logging.Logger;
1112

1213

1314
/**
@@ -61,8 +62,7 @@ protected AuthenticationInfo(@NotNull String tokenType, long expiresIn, @NotNull
6162
// TODO
6263
break;
6364
default:
64-
throw new IllegalStateException(
65-
"Unknown attribute detected in AuthenticationInfo : " + currentName);
65+
Logger.getGlobal().info("Unknown attribute detected in AuthenticationInfo : " + currentName);
6666
}
6767
}
6868

src/main/java/com/bhyoo/onedrive/container/AsyncJobMonitor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.io.IOException;
1414
import java.net.MalformedURLException;
1515
import java.net.URL;
16+
import java.util.logging.Logger;
1617

1718
import static io.netty.handler.codec.http.HttpHeaderNames.ACCEPT;
1819
import static io.netty.handler.codec.http.HttpHeaderNames.ACCEPT_ENCODING;
@@ -74,8 +75,7 @@ public AsyncJobMonitor update() {
7475
// TODO
7576
break;
7677
default:
77-
throw new IllegalStateException(
78-
"Unknown attribute detected in AsyncJobMonitor : " + currentName);
78+
Logger.getGlobal().info("Unknown attribute detected in AsyncJobMonitor : " + currentName);
7979
}
8080
}
8181

src/main/java/com/bhyoo/onedrive/container/Identity.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import java.io.IOException;
1313
import java.util.concurrent.ConcurrentHashMap;
14+
import java.util.logging.Logger;
1415

1516
/**
1617
* https://dev.onedrive.com/resources/identitySet.htm
@@ -59,11 +60,8 @@ static Identity deserialize(@NotNull JsonParser parser) throws IOException {
5960
case "thumbnails":
6061
thumbnails = ThumbnailSet.deserialize(parser);
6162
break;
62-
case "@odata.type":
63-
// TODO
64-
break;
6563
default:
66-
throw new IllegalStateException("Unknown attribute detected in Identity : " + currentName);
64+
Logger.getGlobal().info("Unknown attribute detected in Identity : " + currentName);
6765
}
6866
}
6967

src/main/java/com/bhyoo/onedrive/container/ItemActionSet.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.jetbrains.annotations.Nullable;
99

1010
import java.io.IOException;
11+
import java.util.logging.Logger;
1112

1213
public class ItemActionSet {
1314
@Getter protected final @Nullable CommentAction comment;
@@ -95,7 +96,7 @@ public static ItemActionSet deserialize(@NotNull JsonParser parser) throws IOExc
9596
version = VersionAction.deserialize(parser);
9697
break;
9798
default:
98-
throw new IllegalStateException("Unknown attribute detected in ItemActionSet : " + currentName);
99+
Logger.getGlobal().info("Unknown attribute detected in ItemActionSet : " + currentName);
99100
}
100101
}
101102

src/main/java/com/bhyoo/onedrive/container/ItemActivity.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.jetbrains.annotations.NotNull;
99

1010
import java.io.IOException;
11+
import java.util.logging.Logger;
1112

1213
public class ItemActivity {
1314
@Getter protected final @NotNull String id;
@@ -56,7 +57,7 @@ public static ItemActivity deserialize(@NotNull Client client, @NotNull JsonPars
5657
times = ItemActivityTimeSet.deserialize(parser);
5758
break;
5859
default:
59-
throw new IllegalStateException("Unknown attribute detected in ItemActivity : " + currentName);
60+
Logger.getGlobal().info("Unknown attribute detected in ItemActivity : " + currentName);
6061
}
6162
}
6263

@@ -88,8 +89,9 @@ public static ItemActivityTimeSet deserialize(@NotNull JsonParser parser) throws
8889
recordedDateTime = parser.getText();
8990
break;
9091
default:
91-
throw new IllegalStateException(
92-
"Unknown attribute detected in ItemActivityTimeSet : " + currentName);
92+
Logger.getGlobal().info(
93+
"Unknown attribute detected in ItemActivityTimeSet : " + currentName
94+
);
9395
}
9496
}
9597

src/main/java/com/bhyoo/onedrive/container/action/CommentAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.jetbrains.annotations.NotNull;
88

99
import java.io.IOException;
10+
import java.util.logging.Logger;
1011

1112
public class CommentAction {
1213
@Getter protected final boolean isReply;
@@ -41,7 +42,7 @@ protected CommentAction(boolean isReply, @NotNull IdentitySet parentAuthor, @Not
4142
participants = IdentitySet.deserialize(parser);
4243
break;
4344
default:
44-
throw new IllegalStateException("Unknown attribute detected in CommentAction : " + currentName);
45+
Logger.getGlobal().info("Unknown attribute detected in CommentAction : " + currentName);
4546
}
4647
}
4748

src/main/java/com/bhyoo/onedrive/container/action/DeleteAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.jetbrains.annotations.NotNull;
77

88
import java.io.IOException;
9+
import java.util.logging.Logger;
910

1011
public class DeleteAction {
1112
@Getter protected final @NotNull String name;
@@ -25,7 +26,7 @@ public class DeleteAction {
2526
name = parser.getText();
2627
break;
2728
default:
28-
throw new IllegalStateException("Unknown attribute detected in DeleteAction : " + currentName);
29+
Logger.getGlobal().info("Unknown attribute detected in DeleteAction : " + currentName);
2930
}
3031
}
3132

src/main/java/com/bhyoo/onedrive/container/action/MentionAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.jetbrains.annotations.NotNull;
88

99
import java.io.IOException;
10+
import java.util.logging.Logger;
1011

1112
public class MentionAction {
1213
@Getter protected final @NotNull IdentitySet mentionees;
@@ -26,7 +27,7 @@ public class MentionAction {
2627
mentionees = IdentitySet.deserialize(parser);
2728
break;
2829
default:
29-
throw new IllegalStateException("Unknown attribute detected in MentionAction : " + currentName);
30+
Logger.getGlobal().info("Unknown attribute detected in MentionAction : " + currentName);
3031
}
3132
}
3233

src/main/java/com/bhyoo/onedrive/container/action/MoveAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.jetbrains.annotations.Nullable;
88

99
import java.io.IOException;
10+
import java.util.logging.Logger;
1011

1112
// TODO: add pointer (PathPointer)
1213
public class MoveAction {
@@ -34,7 +35,7 @@ protected MoveAction(@NotNull String from, @NotNull String to) {
3435
to = parser.getText();
3536
break;
3637
default:
37-
throw new IllegalStateException("Unknown attribute detected in MoveAction : " + currentName);
38+
Logger.getGlobal().info("Unknown attribute detected in MoveAction : " + currentName);
3839
}
3940
}
4041

src/main/java/com/bhyoo/onedrive/container/action/RenameAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.jetbrains.annotations.NotNull;
77

88
import java.io.IOException;
9+
import java.util.logging.Logger;
910

1011
public class RenameAction {
1112
@Getter protected final @NotNull String oldName;
@@ -25,7 +26,7 @@ public class RenameAction {
2526
oldName = parser.getText();
2627
break;
2728
default:
28-
throw new IllegalStateException("Unknown attribute detected in RenameAction : " + currentName);
29+
Logger.getGlobal().info("Unknown attribute detected in RenameAction : " + currentName);
2930
}
3031
}
3132

0 commit comments

Comments
 (0)