Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P4
-
Resolution: Fixed
-
Affects Version/s: 5.0
-
Fix Version/s: 17
-
Component/s: client-libs
-
Labels:None
-
Subcomponent:
-
Resolved In Build:b09
-
CPU:generic
-
OS:generic
Description
Method createStrokedShape(Shape) for java.awt.BasicStroke class throws NullPointerException when passed a null object reference for a input parameter. Such behavior is not specified either in the member spec or in the package/class description.
---------
import java.awt.*;
import java.awt.geom.Line2D;
public class Test1 {
//width
static float widths[] = {
-1f, 0f, 1f, 5f
};
static boolean widthOK[] = {
false, true, true, true
};
static boolean widthCovered[] = {
false, false, false, false
};
// cap
static int caps[] = {
BasicStroke.CAP_BUTT, BasicStroke.CAP_ROUND, BasicStroke.CAP_SQUARE
};
static String capStr[] = {
"CAP_BUTT", "CAP_ROUND", "CAP_SQUARE"
};
// join
static int joins[] = {
BasicStroke.JOIN_BEVEL, BasicStroke.JOIN_MITER, BasicStroke.JOIN_ROUND
};
static String joinStr[] = {
"JOIN_BEVEL", "JOIN_MITER", "JOIN_ROUND"
};
// miterLimit
static int miters[] = {
0, 1, 5
};
// dash
static float dashes[][] = {
{
-1, 0
}, {
0, 0
}, {
1, 2
}
};
static boolean dashesOK[] = {
false, false, true
};
static boolean dashCovered[] = {
false, false, false
};
// dashPhase
static int dashPhases[] = {
-1, 0, 5
};
static boolean dashPhaseOK[] = {
false, false, true
};
static boolean dashPhaseCovered[] = {
false, false, false
};
static void initCoveredArrays() {
int i;
for(i = 0;i < widthCovered.length;i++)
widthCovered[i] = false;
for(i = 0;i < dashCovered.length;i++)
dashCovered[i] = false;
for(i = 0;i < dashPhaseCovered.length;i++)
dashPhaseCovered[i] = false;
}
public static void main(String[] args) {
// test case ...
initCoveredArrays();
BasicStroke bs = new BasicStroke();
try {
Shape s = bs.createStrokedShape(null);
System.out.println("result: false");
}
catch(NullPointerException ne) {
System.out.println("result (npe): true");
}
}
}
###@###.### 2004-12-21 15:25:05 GMT
---------
import java.awt.*;
import java.awt.geom.Line2D;
public class Test1 {
//width
static float widths[] = {
-1f, 0f, 1f, 5f
};
static boolean widthOK[] = {
false, true, true, true
};
static boolean widthCovered[] = {
false, false, false, false
};
// cap
static int caps[] = {
BasicStroke.CAP_BUTT, BasicStroke.CAP_ROUND, BasicStroke.CAP_SQUARE
};
static String capStr[] = {
"CAP_BUTT", "CAP_ROUND", "CAP_SQUARE"
};
// join
static int joins[] = {
BasicStroke.JOIN_BEVEL, BasicStroke.JOIN_MITER, BasicStroke.JOIN_ROUND
};
static String joinStr[] = {
"JOIN_BEVEL", "JOIN_MITER", "JOIN_ROUND"
};
// miterLimit
static int miters[] = {
0, 1, 5
};
// dash
static float dashes[][] = {
{
-1, 0
}, {
0, 0
}, {
1, 2
}
};
static boolean dashesOK[] = {
false, false, true
};
static boolean dashCovered[] = {
false, false, false
};
// dashPhase
static int dashPhases[] = {
-1, 0, 5
};
static boolean dashPhaseOK[] = {
false, false, true
};
static boolean dashPhaseCovered[] = {
false, false, false
};
static void initCoveredArrays() {
int i;
for(i = 0;i < widthCovered.length;i++)
widthCovered[i] = false;
for(i = 0;i < dashCovered.length;i++)
dashCovered[i] = false;
for(i = 0;i < dashPhaseCovered.length;i++)
dashPhaseCovered[i] = false;
}
public static void main(String[] args) {
// test case ...
initCoveredArrays();
BasicStroke bs = new BasicStroke();
try {
Shape s = bs.createStrokedShape(null);
System.out.println("result: false");
}
catch(NullPointerException ne) {
System.out.println("result (npe): true");
}
}
}
###@###.### 2004-12-21 15:25:05 GMT
Attachments
Issue Links
- csr for
-
JDK-8261033 BasicStroke.createStrokedShape(Shape): NPE is not specified
-
- Closed
-