質問編集履歴

1

例外発生箇所を追加

2016/09/11 02:18

投稿

yuji38kwmt
yuji38kwmt

スコア437

test CHANGED
File without changes
test CHANGED
@@ -113,3 +113,81 @@
113
113
  5px左にオフセットさせるには、どのうように記述すればよいでしょうか?
114
114
 
115
115
  「設定した値が範囲外」と言われたので、`5 * Units.EMU_PER_PIXEL`という式が間違っている気がします。
116
+
117
+
118
+
119
+
120
+
121
+ ### 補足事項
122
+
123
+ 例外発生箇所のソースを添付します。
124
+
125
+ [https://github.com/cuba-platform/apache-poi/blob/master/poi/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java](https://github.com/cuba-platform/apache-poi/blob/master/poi/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java)
126
+
127
+
128
+
129
+ ```java:HSSFClientAnchor.java
130
+
131
+
132
+
133
+ public HSSFClientAnchor(int dx1, int dy1, int dx2, int dy2, short col1, int row1, short col2, int row2) {
134
+
135
+ super(dx1, dy1, dx2, dy2);
136
+
137
+
138
+
139
+ checkRange(dx1, 0, 1023, "dx1");
140
+
141
+ checkRange(dx2, 0, 1023, "dx2");
142
+
143
+ checkRange(dy1, 0, 255, "dy1");
144
+
145
+ checkRange(dy2, 0, 255, "dy2");
146
+
147
+ checkRange(col1, 0, 255, "col1");
148
+
149
+ checkRange(col2, 0, 255, "col2");
150
+
151
+ checkRange(row1, 0, 255 * 256, "row1");
152
+
153
+ checkRange(row2, 0, 255 * 256, "row2");
154
+
155
+
156
+
157
+ setCol1((short) Math.min(col1, col2));
158
+
159
+ setCol2((short) Math.max(col1, col2));
160
+
161
+ setRow1((short) Math.min(row1, row2));
162
+
163
+ setRow2((short) Math.max(row1, row2));
164
+
165
+
166
+
167
+ if (col1 > col2){
168
+
169
+ _isHorizontallyFlipped = true;
170
+
171
+ }
172
+
173
+ if (row1 > row2){
174
+
175
+ _isVerticallyFlipped = true;
176
+
177
+ }
178
+
179
+ }
180
+
181
+
182
+
183
+
184
+
185
+ private void checkRange(int value, int minRange, int maxRange, String varName) {
186
+
187
+ if (value < minRange || value > maxRange)
188
+
189
+ throw new IllegalArgumentException(varName + " must be between " + minRange + " and " + maxRange);
190
+
191
+ }
192
+
193
+ ```