Merge branch 'jetty-9.2.x'

Conflicts:
	jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java
	jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
	jetty-start/src/main/java/org/eclipse/jetty/start/Module.java
This commit is contained in:
Joakim Erdfelt 2015-02-23 18:05:19 -07:00
commit a32c9ed79c
5 changed files with 33 additions and 34 deletions

View File

@ -18,11 +18,12 @@
package org.eclipse.jetty.http;
import static org.eclipse.jetty.http.HttpTokens.*;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.EnumSet;
import org.eclipse.jetty.http.HttpTokens.EndOfContent;
import org.eclipse.jetty.util.ArrayTernaryTrie;
import org.eclipse.jetty.util.ArrayTrie;
import org.eclipse.jetty.util.BufferUtil;
@ -32,11 +33,6 @@ import org.eclipse.jetty.util.Utf8StringBuilder;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import static org.eclipse.jetty.http.HttpTokens.CARRIAGE_RETURN;
import static org.eclipse.jetty.http.HttpTokens.LINE_FEED;
import static org.eclipse.jetty.http.HttpTokens.SPACE;
import static org.eclipse.jetty.http.HttpTokens.TAB;
/* ------------------------------------------------------------ */
/** A Parser for 1.0 and 1.1 as defined by RFC7230
@ -382,7 +378,7 @@ public class HttpParser
}
// Only LF or TAB acceptable special characters
else if (!(ch==LINE_FEED || ch==TAB))
throw new IllegalCharacter(ch,buffer);
throw new IllegalCharacterException(_state,ch,buffer);
}
return ch;
@ -511,7 +507,7 @@ public class HttpParser
if (ch==LINE_FEED)
throw new BadMessageException("No URI");
else
throw new IllegalCharacter(ch,buffer);
throw new IllegalCharacterException(_state,ch,buffer);
}
else
_string.append((char)ch);
@ -528,7 +524,7 @@ public class HttpParser
setState(State.SPACE1);
}
else if (ch < HttpTokens.SPACE)
throw new IllegalCharacter(ch,buffer);
throw new IllegalCharacterException(_state,ch,buffer);
else
_string.append((char)ch);
break;
@ -1033,7 +1029,7 @@ public class HttpParser
break;
}
throw new IllegalCharacter(ch,buffer);
throw new IllegalCharacterException(_state,ch,buffer);
case HEADER_VALUE:
if (ch>HttpTokens.SPACE || ch<0)
@ -1058,7 +1054,7 @@ public class HttpParser
setState(State.HEADER);
break;
}
throw new IllegalCharacter(ch,buffer);
throw new IllegalCharacterException(_state,ch,buffer);
case HEADER_IN_VALUE:
if (ch>=HttpTokens.SPACE || ch<0 || ch==HttpTokens.TAB)
@ -1088,7 +1084,7 @@ public class HttpParser
break;
}
throw new IllegalCharacter(ch,buffer);
throw new IllegalCharacterException(_state,ch,buffer);
default:
throw new IllegalStateException(_state.toString());
@ -1593,13 +1589,14 @@ public class HttpParser
}
/* ------------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------------- */
private class IllegalCharacter extends BadMessageException
@SuppressWarnings("serial")
private static class IllegalCharacterException extends BadMessageException
{
IllegalCharacter(byte ch,ByteBuffer buffer)
private IllegalCharacterException(State state,byte ch,ByteBuffer buffer)
{
super(String.format("Illegal character 0x%x in state=%s in '%s'",ch,_state,BufferUtil.toDebugString(buffer)));
super(400,String.format("Illegal character 0x%X",ch));
// Bug #460642 - don't reveal buffers to end user
LOG.warn(String.format("Illegal character 0x%X in state=%s for buffer %s",ch,state,BufferUtil.toDetailString(buffer)));
}
}
}

View File

@ -107,7 +107,10 @@ public class BaseBuilder
Licensing licensing = new Licensing();
for (Module module : startArgs.getAllModules().getSelected())
{
licensing.addModule(module);
if (!module.hasFiles(baseHome))
{
licensing.addModule(module);
}
}
if (licensing.hasLicenses())

View File

@ -40,7 +40,7 @@ public class Licensing
// skip, no license
return;
}
if (licenseMap.containsKey(module.getName()))
{
// skip, already being tracked

View File

@ -208,6 +208,20 @@ public class Module extends Node<Module>
return !getName().equals(fileRef);
}
public boolean hasFiles(BaseHome baseHome)
{
for (String ref : getFiles())
{
FileArg farg = new FileArg(this,ref);
Path refPath = baseHome.getBasePath(farg.location);
if (!Files.exists(refPath))
{
return false;
}
}
return true;
}
public void process(BaseHome basehome) throws FileNotFoundException, IOException
{
Pattern section = Pattern.compile("\\s*\\[([^]]*)\\]\\s*");

View File

@ -970,21 +970,6 @@ public class BufferUtil
return buf.toString();
}
/* ------------------------------------------------------------ */
/** Convert buffer to a Debug String.
* @param buffer
* @return A string showing the escaped content of the buffer around the
* position and limit (marked with &lt;&lt;&lt; and &gt;&gt;&gt;)
*/
public static String toDebugString(ByteBuffer buffer)
{
if (buffer == null)
return "null";
StringBuilder buf = new StringBuilder();
appendDebugString(buf,buffer);
return buf.toString();
}
private static void appendDebugString(StringBuilder buf,ByteBuffer buffer)
{
for (int i = 0; i < buffer.position(); i++)