検出漏れだが0.7ぐらいをやろうと思う
2gram 3gram ucをやっていくぞ
/Volumes/HD/false_negative_50_jar/false_negative - [master|*] ❯❯❯ for i in 0.7 ; do go run intersection.go ../pre_result_remove/ucpre_0.75_greater.csv ./pro_result_parse/uc.csv "$i" > ./false_negatives_each_files_uc/false_negatives_"$i".csv;echo ;done
とりま2gram
どういうことを求めるか
- 漏らしたやつのバースマークの要素をみる?
- 積集合をとってみるか
- ソースコードを見てみる?
検出漏れした組み
org.apache.taglibs.standard.tlv.JstlFmtTLV,org.apache.taglibs.standard.tlv.JstlSqlTLV
org.apache.taglibs.standard.tlv.JstlSqlTLV,org.apache.taglibs.standard.tlv.JstlXmlTLV
net.sf.mmm.util.process.api.ProcessContext,org.eclipse.jdt.core.BufferChangedEvent (ここの左以外同じjar fileから取り出されたもの)
org.apache.taglibs.standard.tlv.JstlFmtTLV,org.apache.taglibs.standard.tlv.JstlXmlTLV
各バースマーク情報を取り出してみましょうか
// org.apache.taglibs.standard.tlv.JstlFmtTLV
org.apache.taglibs.standard.tlv.JstlFmtTLV,jar:file:/Volumes/HD/false_negative_50_jar/birthmark_server/data/jar/jonas-web-container-jetty-6.1-5.2.0-M4.jar!/org/apache/taglibs/standard/tlv/JstlFmtTLV.class,kgram,25 183,183 25,25 18,18 181,181 25,181 177,177 25,25 5,5 25,25 25,183 176,176 187,187 89,89 25,25 1,1 183
// org.apache.taglibs.standard.tlv.JstlSqlTLV
org.apache.taglibs.standard.tlv.JstlSqlTLV,jar:file:/Volumes/HD/false_negative_50_jar/birthmark_server/data/jar/jonas-web-container-jetty-6.1-5.2.0-M4.jar!/org/apache/taglibs/standard/tlv/JstlSqlTLV.class,kgram,25 183,183 25,25 18,18 181,181 25,181 177,177 25,25 6,6 25,25 25,183 176,176 187,187 89,89 25,25 1,1 183
// net.sf.mmm.util.process.api.ProcessContext
net.sf.mmm.util.process.api.ProcessContext,jar:file:/Volumes/HD/false_negative_50_jar/birthmark_server/data/jar/mmm-util-core-2.0.1.jar!/net/sf/mmm/util/process/api/ProcessContext.class,kgram,25 183,183 25,25 178,178 181,181 25,181 177,177 25,25 180,180 176,176 25,25 25,25 181,180 172,172 25,25 21,21 181
// org.eclipse.jdt.core.BufferChangedEvent
org.eclipse.jdt.core.BufferChangedEvent,jar:file:/Volumes/HD/false_negative_50_jar/birthmark_server/data/jar/jonas-web-container-jetty-6.1-5.2.0-M4.jar!/org/eclipse/jdt/core/BufferChangedEvent.class,kgram,25 25,25 183,183 25,25 21,21 181,181 25,25 181,181 177,177 25,25 180,180 192,192 176,176 25,180 172,172 25,180 176
// org.apache.taglibs.standard.tlv.JstlXmlTLV
org.apache.taglibs.standard.tlv.JstlXmlTLV,jar:file:/Volumes/HD/false_negative_50_jar/birthmark_server/data/jar/jonas-web-container-jetty-6.1-5.2.0-M4.jar!/org/apache/taglibs/standard/tlv/JstlXmlTLV.class,kgram,25 183,183 25,25 18,18 181,181 25,181 177,177 25,25 7,7 25,25 25,183 176,176 187,187 89,89 25,25 1,1 183
要素数は全て15 (最低length)
jonas-web-container-jetty-6.1-5.2.0-M4.jarというjar fileから取り出されているやつが多い(4/5)
pochiの類似度はどんなもん?
org.apache.taglibs.standard.tlv.JstlFmtTLV,org.apache.taglibs.standard.tlv.JstlSqlTLV,0.7777777777777778
org.apache.taglibs.standard.tlv.JstlSqlTLV,org.apache.taglibs.standard.tlv.JstlXmlTLV,0.7777777777777778
org.apache.taglibs.standard.tlv.JstlFmtTLV,org.apache.taglibs.standard.tlv.JstlXmlTLV,0.7777777777777778
org.eclipse.jdt.core.BufferChangedEvent,net.sf.mmm.util.process.api.ProcessContext,0.7777777777777778
検索エンジンの類似度?
org.apache.taglibs.standard.tlv.JstlFmtTLV,org.apache.taglibs.standard.tlv.JstlSqlTLV,0.6529257340164784
org.apache.taglibs.standard.tlv.JstlSqlTLV,org.apache.taglibs.standard.tlv.JstlXmlTLV,0.6529257340164784
net.sf.mmm.util.process.api.ProcessContext,org.eclipse.jdt.core.BufferChangedEvent,0.6572514956665765
org.apache.taglibs.standard.tlv.JstlFmtTLV,org.apache.taglibs.standard.tlv.JstlXmlTLV,0.6851947036315621
jarファイルの中身を見るかぁ
❯❯❯ diff -y java-files/JstlFmtTLV.java java-files/JstlSqlTLV.java
// //
// Source code recreated from a .class file by IntelliJ IDEA // Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler) // (powered by Fernflower decompiler)
// //
package org.apache.taglibs.standard.tlv; package org.apache.taglibs.standard.tlv;
import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
import javax.servlet.jsp.tagext.PageData; import javax.servlet.jsp.tagext.PageData;
import javax.servlet.jsp.tagext.ValidationMessage; import javax.servlet.jsp.tagext.ValidationMessage;
import org.apache.taglibs.standard.resources.Resources; import org.apache.taglibs.standard.resources.Resources;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
public class JstlFmtTLV extends JstlBaseTLV { | public class JstlSqlTLV extends JstlBaseTLV {
private final String SETLOCALE = "setLocale"; | private final String SETDATASOURCE = "setDataSource";
private final String SETBUNDLE = "setBundle"; | private final String QUERY = "query";
private final String SETTIMEZONE = "setTimeZone"; | private final String UPDATE = "update";
private final String BUNDLE = "bundle"; | private final String TRANSACTION = "transaction";
private final String MESSAGE = "message"; | private final String PARAM = "param";
private final String MESSAGE_PARAM = "param"; | private final String DATEPARAM = "dateParam";
private final String FORMAT_NUMBER = "formatNumber"; <
private final String PARSE_NUMBER = "parseNumber"; <
private final String PARSE_DATE = "parseDate"; <
private final String JSP_TEXT = "jsp:text"; private final String JSP_TEXT = "jsp:text";
private final String EVAL = "evaluator"; | private final String SQL = "sql";
private final String MESSAGE_KEY = "key"; | private final String DATASOURCE = "dataSource";
private final String BUNDLE_PREFIX = "prefix"; <
private final String VALUE = "value"; <
public JstlFmtTLV() { | public JstlSqlTLV() {
} }
public ValidationMessage[] validate(String prefix, String public ValidationMessage[] validate(String prefix, String
return super.validate(2, prefix, uri, page); | return super.validate(3, prefix, uri, page);
} }
protected DefaultHandler getHandler() { protected DefaultHandler getHandler() {
return new JstlFmtTLV.Handler(); | return new JstlSqlTLV.Handler();
} }
private class Handler extends DefaultHandler { private class Handler extends DefaultHandler {
private int depth; private int depth;
private Stack messageDepths; | private Stack queryDepths;
> private Stack updateDepths;
> private Stack transactionDepths;
private String lastElementName; private String lastElementName;
private boolean bodyNecessary; private boolean bodyNecessary;
private boolean bodyIllegal; private boolean bodyIllegal;
private Handler() { private Handler() {
this.depth = 0; this.depth = 0;
this.messageDepths = new Stack(); | this.queryDepths = new Stack();
> this.updateDepths = new Stack();
> this.transactionDepths = new Stack();
this.lastElementName = null; this.lastElementName = null;
this.bodyNecessary = false; this.bodyNecessary = false;
this.bodyIllegal = false; this.bodyIllegal = false;
} }
public void startElement(String ns, String ln, String public void startElement(String ns, String ln, String
if (ln == null) { if (ln == null) {
ln = JstlFmtTLV.this.getLocalPart(qn); | ln = JstlSqlTLV.this.getLocalPart(qn);
} }
if (!qn.equals("jsp:text")) { if (!qn.equals("jsp:text")) {
if (this.bodyIllegal) { if (this.bodyIllegal) {
JstlFmtTLV.this.fail(Resources.getMessage | JstlSqlTLV.this.fail(Resources.getMessage
} }
Set expAtts; Set expAtts;
if (qn.startsWith(JstlFmtTLV.this.prefix + ": | if (qn.startsWith(JstlSqlTLV.this.prefix + ":
for(int i = 0; i < a.getLength(); ++i) { for(int i = 0; i < a.getLength(); ++i) {
String attName = a.getLocalName(i); String attName = a.getLocalName(i);
if (expAtts.contains(attName)) { if (expAtts.contains(attName)) {
String vMsg = JstlFmtTLV.this.val | String vMsg = JstlSqlTLV.this.val
if (vMsg != null) { if (vMsg != null) {
JstlFmtTLV.this.fail(vMsg); | JstlSqlTLV.this.fail(vMsg);
} }
} }
} }
} }
if (qn.startsWith(JstlFmtTLV.this.prefix + ": | if (qn.startsWith(JstlSqlTLV.this.prefix + ":
JstlFmtTLV.this.fail(Resources.getMessage | JstlSqlTLV.this.fail(Resources.getMessage
} }
if (qn.startsWith(JstlFmtTLV.this.prefix + ": | if (qn.startsWith(JstlSqlTLV.this.prefix + ":
JstlFmtTLV.this.fail(Resources.getMessage | JstlSqlTLV.this.fail(Resources.getMessage
} }
if (qn.startsWith(JstlFmtTLV.this.prefix + ": | if (qn.startsWith(JstlSqlTLV.this.prefix + ":
JstlFmtTLV.this.fail(Resources.getMessage | JstlSqlTLV.this.fail(Resources.getMessage
} }
if (JstlFmtTLV.this.isFmtTag(ns, ln, "param") | if ((JstlSqlTLV.this.isSqlTag(ns, ln, "param"
JstlFmtTLV.this.fail(Resources.getMessage | JstlSqlTLV.this.fail(Resources.getMessage
} }
if (JstlFmtTLV.this.isFmtTag(ns, ln, "message | if (JstlSqlTLV.this.isSqlTag(ns, ln, "query")
this.messageDepths.push(this.depth); | this.queryDepths.push(this.depth);
> }
>
> if (JstlSqlTLV.this.isSqlTag(ns, ln, "update"
> this.updateDepths.push(this.depth);
> }
>
> if (JstlSqlTLV.this.isSqlTag(ns, ln, "transac
> this.transactionDepths.push(this.depth);
} }
this.bodyIllegal = false; this.bodyIllegal = false;
this.bodyNecessary = false; this.bodyNecessary = false;
if (!JstlFmtTLV.this.isFmtTag(ns, ln, "param" | if (JstlSqlTLV.this.isSqlTag(ns, ln, "query")
if (JstlFmtTLV.this.isFmtTag(ns, ln, "mes | if (!JstlSqlTLV.this.hasAttribute(a, "sql
this.bodyNecessary = true; <
} else if (JstlFmtTLV.this.isFmtTag(ns, l <
this.bodyNecessary = true; this.bodyNecessary = true;
} }
} else if (JstlFmtTLV.this.hasAttribute(a, "v |
> if (JstlSqlTLV.this.hasAttribute(a, "data
> JstlSqlTLV.this.fail(Resources.getMes
> }
> }
>
> if (JstlSqlTLV.this.isSqlTag(ns, ln, "datePar
this.bodyIllegal = true; this.bodyIllegal = true;
} else { <
this.bodyNecessary = true; <
} }
this.lastElementName = qn; this.lastElementName = qn;
JstlFmtTLV.this.lastElementId = a.getValue("h | JstlSqlTLV.this.lastElementId = a.getValue("h
++this.depth; ++this.depth;
} }
} }
public void characters(char[] ch, int start, int leng public void characters(char[] ch, int start, int leng
this.bodyNecessary = false; this.bodyNecessary = false;
String s = (new String(ch, start, length)).trim() String s = (new String(ch, start, length)).trim()
if (!s.equals("")) { if (!s.equals("")) {
if (this.bodyIllegal) { if (this.bodyIllegal) {
JstlFmtTLV.this.fail(Resources.getMessage | JstlSqlTLV.this.fail(Resources.getMessage
} }
} }
} }
public void endElement(String ns, String ln, String q public void endElement(String ns, String ln, String q
if (!qn.equals("jsp:text")) { if (!qn.equals("jsp:text")) {
if (this.bodyNecessary) { if (this.bodyNecessary) {
JstlFmtTLV.this.fail(Resources.getMessage | JstlSqlTLV.this.fail(Resources.getMessage
} }
this.bodyIllegal = false; this.bodyIllegal = false;
if (JstlFmtTLV.this.isFmtTag(ns, ln, "message | if (JstlSqlTLV.this.isSqlTag(ns, ln, "query")
this.messageDepths.pop(); | this.queryDepths.pop();
> }
>
> if (JstlSqlTLV.this.isSqlTag(ns, ln, "update"
> this.updateDepths.pop();
> }
>
> if (JstlSqlTLV.this.isSqlTag(ns, ln, "transac
> this.transactionDepths.pop();
} }
--this.depth; --this.depth;
} }
} }
} }
} }
❯❯❯ diff -y java-files/JstlSqlTLV.java java-files/JstlXmlTLV.java
// //
// Source code recreated from a .class file by IntelliJ IDEA // Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler) // (powered by Fernflower decompiler)
// //
package org.apache.taglibs.standard.tlv; package org.apache.taglibs.standard.tlv;
import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
import javax.servlet.jsp.tagext.PageData; import javax.servlet.jsp.tagext.PageData;
import javax.servlet.jsp.tagext.ValidationMessage; import javax.servlet.jsp.tagext.ValidationMessage;
import org.apache.taglibs.standard.resources.Resources; import org.apache.taglibs.standard.resources.Resources;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
public class JstlSqlTLV extends JstlBaseTLV { | public class JstlXmlTLV extends JstlBaseTLV {
private final String SETDATASOURCE = "setDataSource"; | private final String CHOOSE = "choose";
private final String QUERY = "query"; | private final String WHEN = "when";
private final String UPDATE = "update"; | private final String OTHERWISE = "otherwise";
private final String TRANSACTION = "transaction"; | private final String PARSE = "parse";
private final String PARAM = "param"; private final String PARAM = "param";
private final String DATEPARAM = "dateParam"; | private final String TRANSFORM = "transform";
private final String JSP_TEXT = "jsp:text"; private final String JSP_TEXT = "jsp:text";
private final String SQL = "sql"; | private final String VALUE = "value";
private final String DATASOURCE = "dataSource"; | private final String SOURCE = "xml";
public JstlSqlTLV() { | public JstlXmlTLV() {
} }
public ValidationMessage[] validate(String prefix, String public ValidationMessage[] validate(String prefix, String
return super.validate(3, prefix, uri, page); | return super.validate(4, prefix, uri, page);
} }
protected DefaultHandler getHandler() { protected DefaultHandler getHandler() {
return new JstlSqlTLV.Handler(); | return new JstlXmlTLV.Handler();
} }
private class Handler extends DefaultHandler { private class Handler extends DefaultHandler {
private int depth; private int depth;
private Stack queryDepths; | private Stack chooseDepths;
private Stack updateDepths; | private Stack chooseHasOtherwise;
private Stack transactionDepths; | private Stack chooseHasWhen;
private String lastElementName; private String lastElementName;
private boolean bodyNecessary; private boolean bodyNecessary;
private boolean bodyIllegal; private boolean bodyIllegal;
> private Stack transformWithSource;
private Handler() { private Handler() {
this.depth = 0; this.depth = 0;
this.queryDepths = new Stack(); | this.chooseDepths = new Stack();
this.updateDepths = new Stack(); | this.chooseHasOtherwise = new Stack();
this.transactionDepths = new Stack(); | this.chooseHasWhen = new Stack();
this.lastElementName = null; this.lastElementName = null;
this.bodyNecessary = false; this.bodyNecessary = false;
this.bodyIllegal = false; this.bodyIllegal = false;
> this.transformWithSource = new Stack();
} }
public void startElement(String ns, String ln, String public void startElement(String ns, String ln, String
if (ln == null) { if (ln == null) {
ln = JstlSqlTLV.this.getLocalPart(qn); | ln = JstlXmlTLV.this.getLocalPart(qn);
} }
if (!qn.equals("jsp:text")) { if (!qn.equals("jsp:text")) {
if (this.bodyIllegal) { if (this.bodyIllegal) {
JstlSqlTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
Set expAtts; Set expAtts;
if (qn.startsWith(JstlSqlTLV.this.prefix + ": | if (qn.startsWith(JstlXmlTLV.this.prefix + ":
for(int i = 0; i < a.getLength(); ++i) { for(int i = 0; i < a.getLength(); ++i) {
String attName = a.getLocalName(i); String attName = a.getLocalName(i);
if (expAtts.contains(attName)) { if (expAtts.contains(attName)) {
String vMsg = JstlSqlTLV.this.val | String vMsg = JstlXmlTLV.this.val
if (vMsg != null) { if (vMsg != null) {
JstlSqlTLV.this.fail(vMsg); | JstlXmlTLV.this.fail(vMsg);
} }
} }
} }
} }
if (qn.startsWith(JstlSqlTLV.this.prefix + ": | if (qn.startsWith(JstlXmlTLV.this.prefix + ":
JstlSqlTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
if (qn.startsWith(JstlSqlTLV.this.prefix + ": | if (qn.startsWith(JstlXmlTLV.this.prefix + ":
JstlSqlTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
if (qn.startsWith(JstlSqlTLV.this.prefix + ": | if (qn.startsWith(JstlXmlTLV.this.prefix + ":
JstlSqlTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
if ((JstlSqlTLV.this.isSqlTag(ns, ln, "param" | if (this.chooseChild()) {
JstlSqlTLV.this.fail(Resources.getMessage | if (JstlXmlTLV.this.isXmlTag(ns, ln, "whe
} | this.chooseHasWhen.pop();
> this.chooseHasWhen.push(Boolean.TRUE)
> }
>
> if (!JstlXmlTLV.this.isXmlTag(ns, ln, "wh
> JstlXmlTLV.this.fail(Resources.getMes
> }
>
> if ((Boolean)this.chooseHasOtherwise.peek
> JstlXmlTLV.this.fail(Resources.getMes
> }
if (JstlSqlTLV.this.isSqlTag(ns, ln, "query") | if (JstlXmlTLV.this.isXmlTag(ns, ln, "oth
this.queryDepths.push(this.depth); | this.chooseHasOtherwise.pop();
> this.chooseHasOtherwise.push(Boolean.
> }
} }
if (JstlSqlTLV.this.isSqlTag(ns, ln, "update" | if (!this.transformWithSource.empty() && this
this.updateDepths.push(this.depth); | JstlXmlTLV.this.fail(Resources.getMessage
} }
if (JstlSqlTLV.this.isSqlTag(ns, ln, "transac | if (JstlXmlTLV.this.isXmlTag(ns, ln, "choose"
this.transactionDepths.push(this.depth); | this.chooseDepths.push(this.depth);
> this.chooseHasWhen.push(Boolean.FALSE);
> this.chooseHasOtherwise.push(Boolean.FALS
} }
this.bodyIllegal = false; this.bodyIllegal = false;
this.bodyNecessary = false; this.bodyNecessary = false;
if (JstlSqlTLV.this.isSqlTag(ns, ln, "query") | if (JstlXmlTLV.this.isXmlTag(ns, ln, "parse")
if (!JstlSqlTLV.this.hasAttribute(a, "sql | if (JstlXmlTLV.this.hasAttribute(a, "xml"
this.bodyNecessary = true; | this.bodyIllegal = true;
} }
| } else if (JstlXmlTLV.this.isXmlTag(ns, ln, "
if (JstlSqlTLV.this.hasAttribute(a, "data | if (JstlXmlTLV.this.hasAttribute(a, "valu
JstlSqlTLV.this.fail(Resources.getMes | this.bodyIllegal = true;
> } else {
> this.bodyNecessary = true;
} }
} | } else if (JstlXmlTLV.this.isXmlTag(ns, ln, "
| this.transformWithSource.push(this.depth)
if (JstlSqlTLV.this.isSqlTag(ns, ln, "datePar <
this.bodyIllegal = true; <
} }
this.lastElementName = qn; this.lastElementName = qn;
JstlSqlTLV.this.lastElementId = a.getValue("h | JstlXmlTLV.this.lastElementId = a.getValue("h
++this.depth; ++this.depth;
} }
} }
public void characters(char[] ch, int start, int leng public void characters(char[] ch, int start, int leng
this.bodyNecessary = false; this.bodyNecessary = false;
String s = (new String(ch, start, length)).trim() String s = (new String(ch, start, length)).trim()
if (!s.equals("")) { if (!s.equals("")) {
if (this.bodyIllegal) { if (this.bodyIllegal) {
JstlSqlTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
> }
>
> if (this.chooseChild()) {
> String msg = Resources.getMessage("TLV_IL
> JstlXmlTLV.this.fail(msg);
> }
>
> if (!this.transformWithSource.empty() && this
> JstlXmlTLV.this.fail(Resources.getMessage
} }
} }
} }
public void endElement(String ns, String ln, String q public void endElement(String ns, String ln, String q
if (!qn.equals("jsp:text")) { if (!qn.equals("jsp:text")) {
if (this.bodyNecessary) { if (this.bodyNecessary) {
JstlSqlTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
this.bodyIllegal = false; this.bodyIllegal = false;
if (JstlSqlTLV.this.isSqlTag(ns, ln, "query") | if (JstlXmlTLV.this.isXmlTag(ns, ln, "choose"
this.queryDepths.pop(); | Boolean b = (Boolean)this.chooseHasWhen.p
} | if (!b) {
> JstlXmlTLV.this.fail(Resources.getMes
> }
if (JstlSqlTLV.this.isSqlTag(ns, ln, "update" | this.chooseDepths.pop();
this.updateDepths.pop(); | this.chooseHasOtherwise.pop();
} }
if (JstlSqlTLV.this.isSqlTag(ns, ln, "transac | if (!this.transformWithSource.empty() && this
this.transactionDepths.pop(); | this.transformWithSource.pop();
} }
--this.depth; --this.depth;
} }
} }
>
> private boolean chooseChild() {
> return !this.chooseDepths.empty() && this.depth -
> }
>
> private int topDepth(Stack s) {
> return (Integer)s.peek();
> }
} }
} }
❯❯❯ diff -y java-files/ProcessContext.java java-files/BufferChangedEvent.java
// //
// Source code recreated from a .class file by IntelliJ IDEA // Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler) // (powered by Fernflower decompiler)
// //
package net.sf.mmm.util.process.api; | package org.eclipse.jdt.core;
import java.io.InputStream; | import java.util.EventObject;
import java.io.OutputStream; <
import net.sf.mmm.util.io.api.DevNullSource; <
import net.sf.mmm.util.io.api.DevNullTarget; <
<
public class ProcessContext { <
private OutputStream outStream; <
private OutputStream errStream; <
private InputStream inStream; <
private boolean keepStreamsOpen; <
<
public ProcessContext() { <
this.inStream = DevNullSource.INSTANCE; <
this.outStream = DevNullTarget.INSTANCE; <
this.errStream = DevNullTarget.INSTANCE; <
} <
<
public OutputStream getOutStream() { <
return this.outStream; <
} <
public void setOutStream(OutputStream outStream) { | public class BufferChangedEvent extends EventObject {
this.outStream = outStream; | private int length;
} | private int offset;
| private String text;
public OutputStream getErrStream() { | private static final long serialVersionUID = 655379473891
return this.errStream; <
} <
public void setErrStream(OutputStream errStream) { | public BufferChangedEvent(IBuffer buffer, int offset, int
this.errStream = errStream; | super(buffer);
> this.offset = offset;
> this.length = length;
> this.text = text;
} }
public InputStream getInStream() { | public IBuffer getBuffer() {
return this.inStream; | return (IBuffer)this.source;
} }
public void setInStream(InputStream inStream) { | public int getLength() {
this.inStream = inStream; | return this.length;
} }
public boolean isKeepStreamsOpen() { | public int getOffset() {
return this.keepStreamsOpen; | return this.offset;
} }
public void setKeepStreamsOpen(boolean keepStreamsOpen) { | public String getText() {
this.keepStreamsOpen = keepStreamsOpen; | return this.text;
} }
} }
~
❯❯❯ diff -y java-files/JstlFmtTLV.java java-files/JstlXmlTLV.java
// //
// Source code recreated from a .class file by IntelliJ IDEA // Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler) // (powered by Fernflower decompiler)
// //
package org.apache.taglibs.standard.tlv; package org.apache.taglibs.standard.tlv;
import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
import javax.servlet.jsp.tagext.PageData; import javax.servlet.jsp.tagext.PageData;
import javax.servlet.jsp.tagext.ValidationMessage; import javax.servlet.jsp.tagext.ValidationMessage;
import org.apache.taglibs.standard.resources.Resources; import org.apache.taglibs.standard.resources.Resources;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
public class JstlFmtTLV extends JstlBaseTLV { | public class JstlXmlTLV extends JstlBaseTLV {
private final String SETLOCALE = "setLocale"; | private final String CHOOSE = "choose";
private final String SETBUNDLE = "setBundle"; | private final String WHEN = "when";
private final String SETTIMEZONE = "setTimeZone"; | private final String OTHERWISE = "otherwise";
private final String BUNDLE = "bundle"; | private final String PARSE = "parse";
private final String MESSAGE = "message"; | private final String PARAM = "param";
private final String MESSAGE_PARAM = "param"; | private final String TRANSFORM = "transform";
private final String FORMAT_NUMBER = "formatNumber"; <
private final String PARSE_NUMBER = "parseNumber"; <
private final String PARSE_DATE = "parseDate"; <
private final String JSP_TEXT = "jsp:text"; private final String JSP_TEXT = "jsp:text";
private final String EVAL = "evaluator"; <
private final String MESSAGE_KEY = "key"; <
private final String BUNDLE_PREFIX = "prefix"; <
private final String VALUE = "value"; private final String VALUE = "value";
> private final String SOURCE = "xml";
public JstlFmtTLV() { | public JstlXmlTLV() {
} }
public ValidationMessage[] validate(String prefix, String public ValidationMessage[] validate(String prefix, String
return super.validate(2, prefix, uri, page); | return super.validate(4, prefix, uri, page);
} }
protected DefaultHandler getHandler() { protected DefaultHandler getHandler() {
return new JstlFmtTLV.Handler(); | return new JstlXmlTLV.Handler();
} }
private class Handler extends DefaultHandler { private class Handler extends DefaultHandler {
private int depth; private int depth;
private Stack messageDepths; | private Stack chooseDepths;
> private Stack chooseHasOtherwise;
> private Stack chooseHasWhen;
private String lastElementName; private String lastElementName;
private boolean bodyNecessary; private boolean bodyNecessary;
private boolean bodyIllegal; private boolean bodyIllegal;
> private Stack transformWithSource;
private Handler() { private Handler() {
this.depth = 0; this.depth = 0;
this.messageDepths = new Stack(); | this.chooseDepths = new Stack();
> this.chooseHasOtherwise = new Stack();
> this.chooseHasWhen = new Stack();
this.lastElementName = null; this.lastElementName = null;
this.bodyNecessary = false; this.bodyNecessary = false;
this.bodyIllegal = false; this.bodyIllegal = false;
> this.transformWithSource = new Stack();
} }
public void startElement(String ns, String ln, String public void startElement(String ns, String ln, String
if (ln == null) { if (ln == null) {
ln = JstlFmtTLV.this.getLocalPart(qn); | ln = JstlXmlTLV.this.getLocalPart(qn);
} }
if (!qn.equals("jsp:text")) { if (!qn.equals("jsp:text")) {
if (this.bodyIllegal) { if (this.bodyIllegal) {
JstlFmtTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
Set expAtts; Set expAtts;
if (qn.startsWith(JstlFmtTLV.this.prefix + ": | if (qn.startsWith(JstlXmlTLV.this.prefix + ":
for(int i = 0; i < a.getLength(); ++i) { for(int i = 0; i < a.getLength(); ++i) {
String attName = a.getLocalName(i); String attName = a.getLocalName(i);
if (expAtts.contains(attName)) { if (expAtts.contains(attName)) {
String vMsg = JstlFmtTLV.this.val | String vMsg = JstlXmlTLV.this.val
if (vMsg != null) { if (vMsg != null) {
JstlFmtTLV.this.fail(vMsg); | JstlXmlTLV.this.fail(vMsg);
} }
} }
} }
} }
if (qn.startsWith(JstlFmtTLV.this.prefix + ": | if (qn.startsWith(JstlXmlTLV.this.prefix + ":
JstlFmtTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
if (qn.startsWith(JstlFmtTLV.this.prefix + ": | if (qn.startsWith(JstlXmlTLV.this.prefix + ":
JstlFmtTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
if (qn.startsWith(JstlFmtTLV.this.prefix + ": | if (qn.startsWith(JstlXmlTLV.this.prefix + ":
JstlFmtTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
if (JstlFmtTLV.this.isFmtTag(ns, ln, "param") | if (this.chooseChild()) {
JstlFmtTLV.this.fail(Resources.getMessage | if (JstlXmlTLV.this.isXmlTag(ns, ln, "whe
> this.chooseHasWhen.pop();
> this.chooseHasWhen.push(Boolean.TRUE)
> }
>
> if (!JstlXmlTLV.this.isXmlTag(ns, ln, "wh
> JstlXmlTLV.this.fail(Resources.getMes
> }
>
> if ((Boolean)this.chooseHasOtherwise.peek
> JstlXmlTLV.this.fail(Resources.getMes
> }
>
> if (JstlXmlTLV.this.isXmlTag(ns, ln, "oth
> this.chooseHasOtherwise.pop();
> this.chooseHasOtherwise.push(Boolean.
> }
> }
>
> if (!this.transformWithSource.empty() && this
> JstlXmlTLV.this.fail(Resources.getMessage
} }
if (JstlFmtTLV.this.isFmtTag(ns, ln, "message | if (JstlXmlTLV.this.isXmlTag(ns, ln, "choose"
this.messageDepths.push(this.depth); | this.chooseDepths.push(this.depth);
> this.chooseHasWhen.push(Boolean.FALSE);
> this.chooseHasOtherwise.push(Boolean.FALS
} }
this.bodyIllegal = false; this.bodyIllegal = false;
this.bodyNecessary = false; this.bodyNecessary = false;
if (!JstlFmtTLV.this.isFmtTag(ns, ln, "param" | if (JstlXmlTLV.this.isXmlTag(ns, ln, "parse")
if (JstlFmtTLV.this.isFmtTag(ns, ln, "mes | if (JstlXmlTLV.this.hasAttribute(a, "xml"
this.bodyNecessary = true; | this.bodyIllegal = true;
} else if (JstlFmtTLV.this.isFmtTag(ns, l | }
> } else if (JstlXmlTLV.this.isXmlTag(ns, ln, "
> if (JstlXmlTLV.this.hasAttribute(a, "valu
> this.bodyIllegal = true;
> } else {
this.bodyNecessary = true; this.bodyNecessary = true;
} }
} else if (JstlFmtTLV.this.hasAttribute(a, "v | } else if (JstlXmlTLV.this.isXmlTag(ns, ln, "
this.bodyIllegal = true; | this.transformWithSource.push(this.depth)
} else { <
this.bodyNecessary = true; <
} }
this.lastElementName = qn; this.lastElementName = qn;
JstlFmtTLV.this.lastElementId = a.getValue("h | JstlXmlTLV.this.lastElementId = a.getValue("h
++this.depth; ++this.depth;
} }
} }
public void characters(char[] ch, int start, int leng public void characters(char[] ch, int start, int leng
this.bodyNecessary = false; this.bodyNecessary = false;
String s = (new String(ch, start, length)).trim() String s = (new String(ch, start, length)).trim()
if (!s.equals("")) { if (!s.equals("")) {
if (this.bodyIllegal) { if (this.bodyIllegal) {
JstlFmtTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
> }
>
> if (this.chooseChild()) {
> String msg = Resources.getMessage("TLV_IL
> JstlXmlTLV.this.fail(msg);
> }
>
> if (!this.transformWithSource.empty() && this
> JstlXmlTLV.this.fail(Resources.getMessage
} }
} }
} }
public void endElement(String ns, String ln, String q public void endElement(String ns, String ln, String q
if (!qn.equals("jsp:text")) { if (!qn.equals("jsp:text")) {
if (this.bodyNecessary) { if (this.bodyNecessary) {
JstlFmtTLV.this.fail(Resources.getMessage | JstlXmlTLV.this.fail(Resources.getMessage
} }
this.bodyIllegal = false; this.bodyIllegal = false;
if (JstlFmtTLV.this.isFmtTag(ns, ln, "message | if (JstlXmlTLV.this.isXmlTag(ns, ln, "choose"
this.messageDepths.pop(); | Boolean b = (Boolean)this.chooseHasWhen.p
> if (!b) {
> JstlXmlTLV.this.fail(Resources.getMes
> }
>
> this.chooseDepths.pop();
> this.chooseHasOtherwise.pop();
> }
>
> if (!this.transformWithSource.empty() && this
> this.transformWithSource.pop();
} }
--this.depth; --this.depth;
} }
} }
>
> private boolean chooseChild() {
> return !this.chooseDepths.empty() && this.depth -
> }
>
> private int topDepth(Stack s) {
> return (Integer)s.peek();
> }
} }
} }
全然わからん
糸口
提案手法の類似度より従来手法の類似度の方が正確で,類似度が下がるのはなんとなくわかるし,そういう傾向にあるんだろうなという感じで攻めるか
それなら提案手法と従来手法の類似度の比較を行うべきだけど,それは過去にやった
検出漏れしたやつらの従来,提案の類似度を見ると傾向がわかる
やってくぞ!