This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import com.itextpdf.text.Document; | |
import com.itextpdf.text.DocumentException; | |
import com.itextpdf.text.pdf.PdfCopy; | |
import com.itextpdf.text.pdf.PdfImportedPage; | |
import com.itextpdf.text.pdf.PdfReader; | |
import com.itextpdf.text.pdf.RandomAccessFileOrArray; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Collection; | |
public class Utils { | |
public static <S, T, R extends Collection<T>> R map(Collection<S> target, Function<S, T> function, Class<R> clazz) { | |
R newCollection = null; | |
try { | |
newCollection = clazz.newInstance(); | |
} catch (InstantiationException e) { | |
throw new RuntimeException(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2002-2006 the original author or authors. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void runChild(FrameworkMethod method, RunNotifier notifier) { | |
EachTestNotifier eachNotifier= makeNotifier(method, notifier); | |
if (method.getAnnotation(Ignore.class) != null) { | |
runIgnored(eachNotifier); | |
} else { | |
runNotIgnored(method, eachNotifier); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sandbox.spring; | |
import org.springframework.context.ApplicationContext; | |
import org.springframework.context.support.ClassPathXmlApplicationContext; | |
public class App { | |
public static void main(String[] args) { | |
ApplicationContext context = | |
new ClassPathXmlApplicationContext("applicationContext.xml"); | |
SampleBean sample = context.getBean(SampleBean.class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sandbox.message; | |
import java.util.Locale; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.MessageSource; | |
import org.springframework.stereotype.Service; | |
@Service | |
public class Message { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
java.util.Enumeration e = request.getAttributeNames(); | |
while (e.hasMoreElements()) { | |
Object o = e.nextElement(); | |
Object attr = request.getAttribute(o.toString()); | |
if (request.getAttribute(o.toString()) instanceof org.springframework.validation.BindingResult) { | |
org.springframework.validation.BindingResult r = (org.springframework.validation.BindingResult) attr; | |
out.println(r.getObjectName()); | |
java.util.List<FieldError> errors = r.getFieldErrors(); | |
out.println("<br> ---------------- <br>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import org.dom4j.Document; | |
import org.dom4j.DocumentException; | |
import org.dom4j.Node; | |
import org.dom4j.io.SAXReader; | |
import org.junit.Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[INFO] ------------------------------------------------------------------------ | |
[INFO] BUILD FAILURE | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Total time: 1:02.492s | |
[INFO] Finished at: Wed Sep 07 12:32:18 JST 2011 | |
[INFO] Final Memory: 12M/32M | |
[INFO] ------------------------------------------------------------------------ | |
[ERROR] Character reference "�" is an invalid XML character. -> [Help 1] | |
org.xml.sax.SAXParseException: Character reference "�" is an invalid XML character. | |
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io._ | |
{ 1 to 1000 } map { n => "hoge%04d.txt".format(n) } foreach { name => | |
val writer = new PrintWriter(new FileWriter(name)) | |
writer.println("hogehoge") | |
writer.close | |
} |
OlderNewer