code stringlengths 12 2.05k | label_name stringlengths 6 8 | label int64 0 95 |
|---|---|---|
static void setAttribute(TransformerFactory transformerFactory, String attributeName) {
try {
transformerFactory.setAttribute(attributeName, "");
} catch (IllegalArgumentException iae) {
if (Boolean.getBoolean(SYSTEM_PROPERTY_IGNORE_XXE_PROTECTION_FAILURES)) {
... | CWE-611 | 13 |
public void testPullCount() throws IOException {
initializeSsl();
String url = RepoUtils.getRemoteRepoURL() + "/modules/info/" + orgName + "/" + moduleName + "/*/";
HttpURLConnection conn = createHttpUrlConnection(convertToUrl(url), "", 0, "", "");
conn.setInstanceFollowRedirects(fal... | CWE-306 | 79 |
public byte[] toByteArray()
{
/* index || secretKeySeed || secretKeyPRF || publicSeed || root */
int n = params.getDigestSize();
int indexSize = (params.getHeight() + 7) / 8;
int secretKeySize = n;
int secretKeyPRFSize = n;
int publicSeedSize = n;
int rootSize =... | CWE-470 | 84 |
public Response workspaceClientEnqueue(@FormParam(WorkSpaceAdapter.CLIENT_NAME) String clientName,
@FormParam(WorkSpaceAdapter.WORK_BUNDLE_OBJ) String workBundleString) {
logger.debug("TPWorker incoming execute! check prio={}", Thread.currentThread().getPriority());
// TODO Doesn't look ... | CWE-502 | 15 |
public static boolean copyResource(File file, String filename, File targetDirectory, PathMatcher filter) {
try {
Path path = getResource(file, filename);
if(path == null) {
return false;
}
Path destDir = targetDirectory.toPath();
Files.walkFileTree(path, new CopyVisitor(path, destDir, filter))... | CWE-22 | 2 |
public RainbowParameters(int[] vi)
{
this.vi = vi;
try
{
checkParams();
}
catch (Exception e)
{
e.printStackTrace();
}
} | CWE-502 | 15 |
public Process execute()
throws CommandLineException
{
// TODO: Provided only for backward compat. with <= 1.4
verifyShellState();
Process process;
//addEnvironment( "MAVEN_TEST_ENVAR", "MAVEN_TEST_ENVAR_VALUE" );
String[] environment = getEnvironmentVariables(... | CWE-78 | 6 |
private HColor getColor(ColorParam colorParam, Stereotype stereo) {
final ISkinParam skinParam = diagram.getSkinParam();
return rose.getHtmlColor(skinParam, stereo, colorParam);
} | CWE-918 | 16 |
public void testMatchOperations() {
JWKMatcher matcher = new JWKMatcher.Builder().keyOperations(new LinkedHashSet<>(Arrays.asList(KeyOperation.SIGN, KeyOperation.VERIFY))).build();
assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1")
.keyOperations(new HashSet<>(Arr... | CWE-347 | 25 |
private boolean isStale(URL source, File target) {
if( source.getProtocol().equals("jar") ) {
// unwrap the jar protocol...
try {
String parts[] = source.getFile().split(Pattern.quote("!"));
source = new URL(parts[0]);
} catch (Mal... | CWE-94 | 14 |
public ResetPasswordRequestResponse requestResetPassword(UserReference userReference) throws ResetPasswordException
{
this.checkUserReference(userReference);
UserProperties userProperties = this.userPropertiesResolver.resolve(userReference);
InternetAddress email = userProperties.getEma... | CWE-640 | 20 |
public static IRubyObject from_document(ThreadContext context, IRubyObject klazz, IRubyObject document) {
XmlDocument doc = ((XmlDocument) ((XmlNode) document).document(context));
RubyArray errors = (RubyArray) doc.getInstanceVariable("@errors");
if (!errors.isEmpty()) {
throw (... | CWE-611 | 13 |
void doubleQuote() {
final PathAndQuery res = PathAndQuery.parse("/\"?\"");
assertThat(res).isNotNull();
assertThat(res.path()).isEqualTo("/%22");
assertThat(res.query()).isEqualTo("%22");
} | CWE-22 | 2 |
public byte[] allocateJobCaches(byte[] cacheAllocationRequestBytes) {
CacheAllocationRequest allocationRequest = (CacheAllocationRequest) SerializationUtils
.deserialize(cacheAllocationRequestBytes);
return SerializationUtils.serialize((Serializable) jobManager.allocateJobCaches(
getJobToken(), allocati... | CWE-502 | 15 |
public boolean isValidating() {
return validating;
} | CWE-611 | 13 |
public void drawU(UGraphic ug) {
ug = ug.apply(backColor.bg()).apply(borderColor);
final URectangle rect = new URectangle(dim.getWidth(), dim.getHeight()).rounded(rounded);
rect.setDeltaShadow(shadowing);
ug.apply(stroke).draw(rect);
final double yLine = titleHeight + attributeHeight;
ug = ug.apply(imgBa... | CWE-918 | 16 |
public String getShortDescription() {
if(note != null) {
return Messages.Cause_RemoteCause_ShortDescriptionWithNote(addr, note);
} else {
return Messages.Cause_RemoteCause_ShortDescription(addr);
}
} | CWE-79 | 1 |
public static String applySorting(String query, Sort sort, String alias) {
Assert.hasText(query);
if (null == sort || !sort.iterator().hasNext()) {
return query;
}
StringBuilder builder = new StringBuilder(query);
if (!ORDER_BY.matcher(query).matches()) {
builder.append(" order by ");
} else {
... | CWE-89 | 0 |
public static boolean isAbsolute(String url)
{
if (url.startsWith("//")) // //www.domain.com/start
{
return true;
}
if (url.startsWith("/")) // /somePage.html
{
return false;
}
boolean result = false;
try
{
URI uri = new URI(url);
result = uri.isAbsolute();
}
catch (URISyntax... | CWE-601 | 11 |
public void encodeByteArray() {
Packet<byte[]> packet = new Packet<>(Parser.BINARY_EVENT);
packet.data = "abc".getBytes(Charset.forName("UTF-8"));
packet.id = 23;
packet.nsp = "/cool";
Helpers.testBin(packet);
} | CWE-476 | 46 |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (l... | CWE-125 | 47 |
public static void zipFolderAPKTool(String srcFolder, String destZipFile) throws Exception {
try (FileOutputStream fileWriter = new FileOutputStream(destZipFile);
ZipOutputStream zip = new ZipOutputStream(fileWriter)){
addFolderToZipAPKTool("", srcFolder, zip);
zip.flush... | CWE-22 | 2 |
public static void main(
String[] args)
{
Security.addProvider(new BouncyCastleProvider());
runTest(new ECDSA5Test());
} | CWE-347 | 25 |
public void testSetContentFromFile() throws Exception {
TestHttpData test = new TestHttpData("test", UTF_8, 0);
try {
File tmpFile = File.createTempFile(UUID.randomUUID().toString(), ".tmp");
tmpFile.deleteOnExit();
FileOutputStream fos = new FileOutputStream(tmpF... | CWE-379 | 83 |
public static void execute(String url, String proxyHost, int proxyPort, String proxyUsername, String proxyPassword,
String terminalWidth) {
initializeSsl();
HttpURLConnection conn = createHttpUrlConnection(convertToUrl(url), proxyHost, proxyPort, proxyUsername,
proxyPassw... | CWE-306 | 79 |
public void setDocumentFactory(DocumentFactory documentFactory) {
this.factory = documentFactory;
} | CWE-611 | 13 |
parse_io(ThreadContext context,
IRubyObject klazz,
IRubyObject data,
IRubyObject enc)
{
//int encoding = (int)enc.convertToInteger().getLongValue();
final Ruby runtime = context.runtime;
XmlSaxParserContext ctx = newInstance(runtime, (RubyClass) klazz);
ctx.initializ... | CWE-241 | 68 |
public void setIgnoreComments(boolean ignoreComments) {
this.ignoreComments = ignoreComments;
} | CWE-611 | 13 |
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,
byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (!haskey) {
// The key ... | CWE-787 | 24 |
public RoundedContainer(Dimension2D dim, double titleHeight, double attributeHeight, HColor borderColor,
HColor backColor, HColor imgBackcolor, UStroke stroke, double rounded, double shadowing) {
if (dim.getWidth() == 0) {
throw new IllegalArgumentException();
}
this.rounded = rounded;
this.dim = dim;
... | CWE-918 | 16 |
public DefaultFileSystemResourceLoader(Path path) {
this.baseDirPath = Optional.of(path);
} | CWE-22 | 2 |
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,
byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (!haskey) {
// The key ... | CWE-125 | 47 |
public boolean isStripWhitespaceText() {
return stripWhitespaceText;
} | CWE-611 | 13 |
public BCXMSSMTPrivateKey(PrivateKeyInfo keyInfo)
throws IOException
{
XMSSMTKeyParams keyParams = XMSSMTKeyParams.getInstance(keyInfo.getPrivateKeyAlgorithm().getParameters());
this.treeDigest = keyParams.getTreeDigest().getAlgorithm();
XMSSPrivateKey xmssMtPrivateKey = XMSSPri... | CWE-502 | 15 |
public static List<String> checkLockedFileBeforeUnzipNonStrict(VFSLeaf zipLeaf, VFSContainer targetDir, Identity identity) {
List<String> lockedFiles = new ArrayList<>();
VFSLockManager vfsLockManager = CoreSpringFactory.getImpl(VFSLockManager.class);
try(InputStream in = zipLeaf.getInputStream();
net.sf.... | CWE-22 | 2 |
private static Stream<Arguments> provideFilesAndExpectedExceptionType() {
return Stream.of(
Arguments.of("abnormal/corrupt-header.rar", CorruptHeaderException.class),
Arguments.of("abnormal/mainHeaderNull.rar", BadRarArchiveException.class)
);
} | CWE-835 | 42 |
protected SymbolContext getContextLegacy() {
if (UseStyle.useBetaStyle() == false)
return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(2));
final HColor lineColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
... | CWE-918 | 16 |
private void decodeTest()
{
EllipticCurve curve = new EllipticCurve(
new ECFieldFp(new BigInteger("6277101735386680763835789423207666416083908700390324961279")), // q
new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a
new BigInteg... | CWE-347 | 25 |
public void testGetShellCommandLineNonWindows()
throws Exception
{
Commandline cmd = new Commandline( new BourneShell() );
cmd.setExecutable( "/usr/bin" );
cmd.addArguments( new String[] {
"a",
"b"
} );
String[] shellCommandline = cmd.getSh... | CWE-78 | 6 |
public Document read(URL url) throws DocumentException {
String systemID = url.toExternalForm();
InputSource source = new InputSource(systemID);
if (this.encoding != null) {
source.setEncoding(this.encoding);
}
return read(source);
} | CWE-611 | 13 |
protected Response attachToPost(Long messageKey, String filename, InputStream file, HttpServletRequest request) {
//load message
Message mess = fom.loadMessage(messageKey);
if(mess == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
if(!forum.equalsByPersistableKey(mess.getForum(... | CWE-22 | 2 |
public static int sharedKeyLength(final JWEAlgorithm alg, final EncryptionMethod enc)
throws JOSEException {
if (alg.equals(JWEAlgorithm.ECDH_ES)) {
int length = enc.cekBitLength();
if (length == 0) {
throw new JOSEException("Unsupported JWE encryption method " + enc);
}
return length;
} els... | CWE-347 | 25 |
public void testGetChunk() throws Exception {
TestHttpData test = new TestHttpData("test", UTF_8, 0);
try {
File tmpFile = File.createTempFile(UUID.randomUUID().toString(), ".tmp");
tmpFile.deleteOnExit();
FileOutputStream fos = new FileOutputStream(tmpFile);
... | CWE-379 | 83 |
public void sendError(int sc, String msg) throws IOException {
if (isIncluding()) {
Logger.log(Logger.ERROR, Launcher.RESOURCES, "IncludeResponse.Error",
new String[] { "" + sc, msg });
return;
}
Logger.log(Logger.DEBUG, Launcher.RESOURCES... | CWE-79 | 1 |
public void view(@RequestParam String filename,
@RequestParam(required = false) String base,
@RequestParam(required = false) Integer tailLines,
HttpServletResponse response) throws IOException {
securityCheck(filename);
response.setConte... | CWE-22 | 2 |
void empty() {
final PathAndQuery res = PathAndQuery.parse(null);
assertThat(res).isNotNull();
assertThat(res.path()).isEqualTo("/");
assertThat(res.query()).isNull();
final PathAndQuery res2 = PathAndQuery.parse("");
assertThat(res2).isNotNull();
assertThat(... | CWE-22 | 2 |
protected XMLReader createXMLReader() throws SAXException {
return SAXHelper.createXMLReader(isValidating());
} | CWE-611 | 13 |
public void configure(ICourse course, CourseNode newNode, ModuleConfiguration moduleConfig) {
newNode.setDisplayOption(CourseNode.DISPLAY_OPTS_TITLE_DESCRIPTION_CONTENT);
VFSContainer rootContainer = course.getCourseFolderContainer();
VFSLeaf singleFile = (VFSLeaf) rootContainer.resolve("/" + filename);
i... | CWE-22 | 2 |
public boolean checkUrlParameter(String url)
{
if (url != null)
{
try
{
URL parsedUrl = new URL(url);
String protocol = parsedUrl.getProtocol();
String host = parsedUrl.getHost().toLowerCase();
return (protocol.equals("http") || protocol.equals("https"))
&& !host.endsWith(".internal")... | CWE-918 | 16 |
public void write(byte[] b, int offset, int length) throws IOException {
if (b == null) {
throw new NullPointerException();
}
if (offset < 0 || offset + length > b.length) {
throw new ArrayIndexOutOfBoundsException();
}
write(fd, b, offset, length);
} | CWE-190 | 19 |
private static String encodeToPercents(Bytes value, boolean isPath) {
final BitSet allowedChars = isPath ? ALLOWED_PATH_CHARS : ALLOWED_QUERY_CHARS;
final int length = value.length;
boolean needsEncoding = false;
for (int i = 0; i < length; i++) {
if (!allowedChars.get(va... | CWE-22 | 2 |
public synchronized <T extends Result> T setResult(Class<T> resultClass) throws SQLException {
checkFreed();
initialize();
if (resultClass == null || DOMResult.class.equals(resultClass)) {
domResult = new DOMResult();
active = true;
return (T) domResult;
} else if (SAXResult.class.e... | CWE-611 | 13 |
public Directory read(final ImageInputStream input) throws IOException {
Validate.notNull(input, "input");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
// TODO: Consider parsing using SAX?
// T... | CWE-611 | 13 |
public static HColor noGradient(HColor color) {
if (color instanceof HColorGradient) {
return ((HColorGradient) color).getColor1();
}
return color;
} | CWE-918 | 16 |
public void testMatchUseNotSpecifiedOrSignature() {
JWKMatcher matcher = new JWKMatcher.Builder().keyUses(KeyUse.SIGNATURE, null).build();
assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1").keyUse(KeyUse.SIGNATURE).build()));
assertTrue(matcher.matches(new ECKey.Bu... | CWE-347 | 25 |
protected EntityResolver createDefaultEntityResolver(String systemId) {
String prefix = null;
if ((systemId != null) && (systemId.length() > 0)) {
int idx = systemId.lastIndexOf('/');
if (idx > 0) {
prefix = systemId.substring(0, idx + 1);
}
... | CWE-611 | 13 |
public boolean isIncludeInternalDTDDeclarations() {
return includeInternalDTDDeclarations;
} | CWE-611 | 13 |
static XmlSchema createSchemaInstance(ThreadContext context, RubyClass klazz, Source source) {
Ruby runtime = context.getRuntime();
XmlRelaxng xmlRelaxng = (XmlRelaxng) NokogiriService.XML_RELAXNG_ALLOCATOR.allocate(runtime, klazz);
xmlRelaxng.setInstanceVariable("@errors", runtime.newEmptyA... | CWE-611 | 13 |
public boolean isResetPasswordSent()
{
// If there is no form and we see an info box, then the request was sent.
return !getDriver().hasElementWithoutWaiting(By.cssSelector("#resetPasswordForm"))
&& messageBox.getText().contains("An e-mail was sent to");
} | CWE-640 | 20 |
public SAXReader(String xmlReaderClassName, boolean validating)
throws SAXException {
if (xmlReaderClassName != null) {
this.xmlReader = XMLReaderFactory
.createXMLReader(xmlReaderClassName);
}
this.validating = validating;
} | CWE-611 | 13 |
private void sendStreamingResponse(HttpExchange pExchange, ParsedUri pParsedUri, JSONStreamAware pJson) throws IOException {
Headers headers = pExchange.getResponseHeaders();
if (pJson != null) {
headers.set("Content-Type", getMimeType(pParsedUri) + "; charset=utf-8");
String... | CWE-79 | 1 |
public VideoMetadata readVideoMetadataFile(OLATResource videoResource){
VFSContainer baseContainer= FileResourceManager.getInstance().getFileResourceRootImpl(videoResource);
VFSLeaf metaDataFile = (VFSLeaf) baseContainer.resolve(FILENAME_VIDEO_METADATA_XML);
try {
return (VideoMetadata) XStreamHelper.readObje... | CWE-91 | 78 |
private static IRubyObject getSchema(ThreadContext context, RubyClass klazz, Source source) {
String moduleName = klazz.getName();
if ("Nokogiri::XML::Schema".equals(moduleName)) {
return XmlSchema.createSchemaInstance(context, klazz, source);
} else if ("Nokogiri::XML::RelaxNG".... | CWE-611 | 13 |
public static IRubyObject read_memory(ThreadContext context, IRubyObject klazz, IRubyObject content) {
String data = content.convertToString().asJavaString();
return getSchema(context, (RubyClass) klazz, new StreamSource(new StringReader(data)));
} | CWE-611 | 13 |
public DocumentFactory getDocumentFactory() {
if (factory == null) {
factory = DocumentFactory.getInstance();
}
return factory;
} | CWE-611 | 13 |
public boolean isMergeAdjacentText() {
return mergeAdjacentText;
} | CWE-611 | 13 |
public void encodeDeepBinaryJSONWithNullValue() throws JSONException {
JSONObject data = new JSONObject("{a: \"b\", c: 4, e: {g: null}, h: null}");
data.put("h", new byte[9]);
Packet<JSONObject> packet = new Packet<>(Parser.BINARY_EVENT);
packet.data = data;
packet.nsp = "/"... | CWE-476 | 46 |
private void checkParams()
throws Exception
{
if (vi == null)
{
throw new Exception("no layers defined.");
}
if (vi.length > 1)
{
for (int i = 0; i < vi.length - 1; i++)
{
if (vi[i] >= vi[i + 1])
... | CWE-470 | 84 |
public void testEscapeSingleQuotesOnArgument()
{
Shell sh = newShell();
sh.setWorkingDirectory( "/usr/bin" );
sh.setExecutable( "chmod" );
String[] args = { "arg'withquote" };
List shellCommandLine = sh.getShellCommandLine( args );
String cli = StringUtils.joi... | CWE-78 | 6 |
public XMLFilter getXMLFilter() {
return xmlFilter;
} | CWE-611 | 13 |
public URIDryConverter(URI base, Map<PackageID, Manifest> dependencyManifests, boolean isBuild) {
super(base, dependencyManifests, isBuild);
this.base = URI.create(base.toString() + "/modules/info/");
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, ... | CWE-306 | 79 |
private AuthnRequestParseResult parseRequest(byte[] xmlBytes) throws SAMLException {
String xml = new String(xmlBytes, StandardCharsets.UTF_8);
if (logger.isDebugEnabled()) {
logger.debug("SAMLRequest XML is\n{}", xml);
}
AuthnRequestParseResult result = new AuthnRequestParseResult();
resul... | CWE-611 | 13 |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (l... | CWE-787 | 24 |
public void testCreateHttpUrlConnection() {
HttpURLConnection conn;
// Test without proxy
conn = createHttpUrlConnection(convertToUrl(TEST_URL), "", 0, "", "");
Assert.assertNotNull(conn);
// Test with the proxy
conn = createHttpUrlConnection(convertToUrl(TEST_URL), "... | CWE-306 | 79 |
public static Object deserialize(byte[] data)
throws IOException, ClassNotFoundException
{
ByteArrayInputStream in = new ByteArrayInputStream(data);
ObjectInputStream is = new ObjectInputStream(in);
return is.readObject();
} | CWE-502 | 15 |
public DefaultFileSystemResourceLoader(File baseDirPath) {
this.baseDirPath = Optional.of(baseDirPath.toPath());
} | CWE-22 | 2 |
private static void createBaloInHomeRepo(HttpURLConnection conn, String modulePathInBaloCache,
String moduleNameWithOrg, boolean isNightlyBuild, String newUrl, String contentDisposition) {
long responseContentLength = conn.getContentLengthLong();
if (responseContentLength <= 0) {
... | CWE-306 | 79 |
public void testCurveCheckOk()
throws Exception {
ECPublicKey ephemeralPublicKey = generateECPublicKey(ECKey.Curve.P_256);
ECPrivateKey privateKey = generateECPrivateKey(ECKey.Curve.P_256);
ECDH.ensurePointOnCurve(ephemeralPublicKey, privateKey);
} | CWE-347 | 25 |
public void setStripWhitespaceText(boolean stripWhitespaceText) {
this.stripWhitespaceText = stripWhitespaceText;
} | CWE-611 | 13 |
private void drawSingleCluster(UGraphic ug, IGroup group, ElkNode elkNode) {
final Point2D corner = getPosition(elkNode);
final URectangle rect = new URectangle(elkNode.getWidth(), elkNode.getHeight());
PackageStyle packageStyle = group.getPackageStyle();
final ISkinParam skinParam = diagram.getSkinParam... | CWE-918 | 16 |
protected String getCorsDomain(String referer, String userAgent)
{
String dom = null;
if (referer != null && referer.toLowerCase()
.matches("https?://([a-z0-9,-]+[.])*draw[.]io/.*"))
{
dom = referer.toLowerCase().substring(0,
referer.indexOf(".draw.io/") + 8);
}
else if (referer != null && refe... | CWE-601 | 11 |
public void testQuoteWorkingDirectoryAndExecutable_WDPathWithSingleQuotes_BackslashFileSep()
{
Shell sh = newShell();
sh.setWorkingDirectory( "\\usr\\local\\'something else'" );
sh.setExecutable( "chmod" );
String executable = StringUtils.join( sh.getShellCommandLine( new Strin... | CWE-78 | 6 |
public void performTest()
throws Exception
{
testKeyConversion();
testAdaptiveKeyConversion();
decodeTest();
testECDSA239bitPrime();
testECDSA239bitBinary();
testGeneration();
testKeyPairGenerationWithOIDs();
testNamedCurveParameterPreserva... | CWE-347 | 25 |
private JsonNode yamlPathToJson(Path path) throws IOException {
Yaml reader = new Yaml();
ObjectMapper mapper = new ObjectMapper();
Path p;
try (InputStream in = Files.newInputStream(path)) {
return mapper.valueToTree(reader.load(in));
}
} | CWE-502 | 15 |
protected HtmlRenderable htmlBody() {
return HtmlElement.li().content(
HtmlElement.span(HtmlAttribute.cssClass("artifact")).content(
HtmlElement.a(HtmlAttribute.href(getUrl()))
.content(getFileName())
)
);
} | CWE-79 | 1 |
public PlayerClock(String title, ISkinParam skinParam, TimingRuler ruler, int period, int pulse, int offset,
boolean compact) {
super(title, skinParam, ruler, compact);
this.displayTitle = title.length() > 0;
this.period = period;
this.pulse = pulse;
this.offset = offset;
this.suggestedHeight = 30;
} | CWE-918 | 16 |
public void testByteSerialization() throws Exception {
final IBaseDataObject d = DataObjectFactory.getInstance("abc".getBytes(), "testfile", Form.UNKNOWN);
final byte[] bytes = PayloadUtil.serializeToBytes(d);
final String s1 = new String(bytes);
assertTrue("Serializedion must includ... | CWE-502 | 15 |
public static int beta() {
final int beta = 1;
return beta;
} | CWE-918 | 16 |
protected List<String> getRawCommandLine( String executable, String[] arguments )
{
List<String> commandLine = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
if ( executable != null )
{
String preamble = getExecutionPreamble();
if ( prea... | CWE-78 | 6 |
public static int version() {
return 1202204;
} | CWE-918 | 16 |
public static AlgorithmMode resolveAlgorithmMode(final JWEAlgorithm alg)
throws JOSEException {
if (alg.equals(JWEAlgorithm.ECDH_ES)) {
return AlgorithmMode.DIRECT;
} else if (alg.equals(JWEAlgorithm.ECDH_ES_A128KW) ||
alg.equals(JWEAlgorithm.ECDH_ES_A192KW) ||
alg.equals(JWEAlgorithm.ECDH_ES_A256KW)... | CWE-347 | 25 |
public static Path visit(File file, String filename, FileVisitor<Path> visitor)
throws IOException, IllegalArgumentException {
if(!StringHelper.containsNonWhitespace(filename)) {
filename = file.getName();
}
Path fPath = null;
if(file.isDirectory()) {
fPath = file.toPath();
} else if(filename != n... | CWE-22 | 2 |
public static void beforeClass() throws IOException {
final Random r = new Random();
for (int i = 0; i < BYTES.length; i++) {
BYTES[i] = (byte) r.nextInt(255);
}
tmp = File.createTempFile("netty-traffic", ".tmp");
tmp.deleteOnExit();
FileOutputStream out ... | CWE-378 | 80 |
private RDFDescription parseAsResource(Node node) {
// See: http://www.w3.org/TR/REC-rdf-syntax/#section-Syntax-parsetype-resource
List<Entry> entries = new ArrayList<Entry>();
for (Node child : asIterable(node.getChildNodes())) {
if (child.getNodeType() != Node.ELEMENT_NODE) {
... | CWE-611 | 13 |
public static long compileTime() {
return 1649510957985L;
} | CWE-918 | 16 |
protected SymbolContext getContextLegacy() {
throw new UnsupportedOperationException();
} | CWE-918 | 16 |
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,
byte[] ciphertext, int ciphertextOffset, int length)
throws ShortBufferException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (!haskey) {
// The k... | CWE-787 | 24 |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (l... | CWE-125 | 47 |
public AsciiString generateSessionId() {
ThreadLocalRandom random = ThreadLocalRandom.current();
UUID uuid = new UUID(random.nextLong(), random.nextLong());
return AsciiString.of(uuid.toString());
} | CWE-338 | 21 |
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
String filename = file.getFileName().toString();
Path normalizedPath = file.normalize();
if(!normalizedPath.startsWith(destDir)) {
throw new IOException("Invalid ZIP");
}
if(filename.endsWith(... | CWE-22 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.