updated copyright

This commit is contained in:
Jeremy Long
2015-09-18 05:47:06 -04:00
parent 6a7a868b71
commit b389260dec
6 changed files with 36 additions and 18 deletions

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2012 Jeremy Long. All Rights Reserved.
* Copyright (c) 2015 OWASP. All Rights Reserved.
*/
package org.owasp.dependencycheck.analyzer;
@@ -42,6 +42,7 @@ import java.security.MessageDigest;
* @author colezlaw
*/
public class ComposerLockAnalyzer extends AbstractFileTypeAnalyzer {
/**
* The logger
*/

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2012 Jeremy Long. All Rights Reserved.
* Copyright (c) 2015 OWASP. All Rights Reserved.
*/
package org.owasp.dependencycheck.data.composer;
@@ -23,13 +23,20 @@ package org.owasp.dependencycheck.data.composer;
* @author colezlaw
*/
public final class ComposerDependency {
/** The group */
/**
* The group
*/
private final String group;
/** The project */
/**
* The project
*/
private final String project;
/** The version */
/**
* The version
*/
private final String version;
/**

View File

@@ -13,17 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2012 Jeremy Long. All Rights Reserved.
* Copyright (c) 2015 OWASP. All Rights Reserved.
*/
package org.owasp.dependencycheck.data.composer;
/**
* Represents an exception when handling a composer.json or composer.lock
* file. Generally used to wrap a downstream exception.
* Represents an exception when handling a composer.json or composer.lock file. Generally used to wrap a downstream exception.
*
* @author colezlaw
*/
public class ComposerException extends RuntimeException {
/**
* Creates a ComposerException with default message.
*/

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2012 Jeremy Long. All Rights Reserved.
* Copyright (c) 2015 OWASP. All Rights Reserved.
*/
package org.owasp.dependencycheck.data.composer;
@@ -36,16 +36,25 @@ import java.util.List;
* @author colezlaw
*/
public class ComposerLockParser {
/** The JsonReader for parsing JSON */
/**
* The JsonReader for parsing JSON
*/
private final JsonReader jsonReader;
/** The input stream we'll read */
/**
* The input stream we'll read
*/
private final InputStream inputStream; // NOPMD - it gets set in the constructor, read later
/** The List of ComposerDependencies found */
/**
* The List of ComposerDependencies found
*/
private final List<ComposerDependency> composerDependencies;
/** The LOGGER */
/**
* The LOGGER
*/
private static final Logger LOGGER = LoggerFactory.getLogger(ComposerLockParser.class);
/**

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2012 Jeremy Long. All Rights Reserved.
* Copyright (c) 2015 OWASP. All Rights Reserved.
*/
package org.owasp.dependencycheck.analyzer;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2012 Jeremy Long. All Rights Reserved.
* Copyright (c) 2015 OWASP. All Rights Reserved.
*/
package org.owasp.dependencycheck.data.composer;
@@ -30,6 +30,7 @@ import static org.junit.Assert.*;
* Created by colezlaw on 9/5/15.
*/
public class ComposerLockParserTest {
private InputStream inputStream;
@Before
@@ -45,21 +46,21 @@ public class ComposerLockParserTest {
assertTrue(clp.getDependencies().contains(new ComposerDependency("symfony", "translation", "2.7.3")));
}
@Test(expected=ComposerException.class)
@Test(expected = ComposerException.class)
public void testNotJSON() throws Exception {
String input = "NOT VALID JSON";
ComposerLockParser clp = new ComposerLockParser(new ByteArrayInputStream(input.getBytes(Charset.defaultCharset())));
clp.process();
}
@Test(expected=ComposerException.class)
@Test(expected = ComposerException.class)
public void testNotComposer() throws Exception {
String input = "[\"ham\",\"eggs\"]";
ComposerLockParser clp = new ComposerLockParser(new ByteArrayInputStream(input.getBytes(Charset.defaultCharset())));
clp.process();
}
@Test(expected=ComposerException.class)
@Test(expected = ComposerException.class)
public void testNotPackagesArray() throws Exception {
String input = "{\"packages\":\"eleventy\"}";
ComposerLockParser clp = new ComposerLockParser(new ByteArrayInputStream(input.getBytes(Charset.defaultCharset())));