diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2013-05-29 12:27:50 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2013-05-29 12:28:10 +0200 |
commit | 658401c8ef2e82d5c29e7597df05d303559273be (patch) | |
tree | acd5494c2bbba43857169d8503b1052433b2ed70 /org.eclipse.jgit.test | |
parent | 7f2f59734c9bc435d66f2a2cfd659bd37ccdde2b (diff) | |
parent | 0603519aad6e1ea9c70e81eac76113c1fc95a735 (diff) | |
download | jgit-658401c8ef2e82d5c29e7597df05d303559273be.tar.gz jgit-658401c8ef2e82d5c29e7597df05d303559273be.zip |
Merge branch 'stable-3.0'
* stable-3.0:
Prepare post 3.0.0-rc2 builds
JGit v3.0.0.201305281830-rc2
Support refspecs with wildcard in middle (not only at end)
Fix multiple bugs in RawSubStringPattern used by MessageRevFilter
Handle short branch/tag name for setBranch in CloneCommand
Add missing Bundle-Localization header
Apply tree filter marks when pairing DiffEntry for renames
Improve feature names to become understandable by end users
Update kepler orbit version to R20130517111416
Fix BatchRefUpdate progress-monitoring so it doesn't count twice
Fix AnyObjectId's generic type declaration of Comparable
Fix DiffFormatter NPEs for DiffEntry without content change
Fix CommitCommand not to destroy repo
Fix the parameters to an exception
Prepare post 3.0.0 M7 builds
JGit v3.0.0.201305080800-m7
Change-Id: Ia8441c9796f01497e0d90e672c0aaf60520a0098
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
6 files changed, 375 insertions, 14 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java index 7422951920..31f909a5f2 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, Chris Aniszczyk <caniszczyk@gmail.com> + * Copyright (C) 2011, 2013 Chris Aniszczyk <caniszczyk@gmail.com> * and other copyright owners as documented in the project's IP log. * * This program and the accompanying materials are made available @@ -64,7 +64,6 @@ import org.eclipse.jgit.lib.ConfigConstants; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; -import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.revwalk.RevCommit; @@ -92,11 +91,10 @@ public class CloneCommandTest extends RepositoryTestCase { writeTrashFile("Test.txt", "Hello world"); git.add().addFilepattern("Test.txt").call(); git.commit().setMessage("Initial commit").call(); + git.tag().setName("tag-initial").setMessage("Tag initial").call(); - // create a master branch and switch to it - git.branchCreate().setName("test").call(); - RefUpdate rup = db.updateRef(Constants.HEAD); - rup.link("refs/heads/test"); + // create a test branch and switch to it + git.checkout().setCreateBranch(true).setName("test").call(); // commit something on the test branch writeTrashFile("Test.txt", "Some change"); @@ -206,6 +204,36 @@ public class CloneCommandTest extends RepositoryTestCase { } @Test + public void testCloneRepositoryWithBranchShortName() throws Exception { + File directory = createTempDirectory("testCloneRepositoryWithBranch"); + CloneCommand command = Git.cloneRepository(); + command.setBranch("test"); + command.setDirectory(directory); + command.setURI("file://" + git.getRepository().getWorkTree().getPath()); + Git git2 = command.call(); + addRepoToClose(git2.getRepository()); + + assertNotNull(git2); + assertEquals("refs/heads/test", git2.getRepository().getFullBranch()); + } + + @Test + public void testCloneRepositoryWithTagName() throws Exception { + File directory = createTempDirectory("testCloneRepositoryWithBranch"); + CloneCommand command = Git.cloneRepository(); + command.setBranch("tag-initial"); + command.setDirectory(directory); + command.setURI("file://" + git.getRepository().getWorkTree().getPath()); + Git git2 = command.call(); + addRepoToClose(git2.getRepository()); + + assertNotNull(git2); + ObjectId taggedCommit = db.resolve("tag-initial^{commit}"); + assertEquals(taggedCommit.name(), git2 + .getRepository().getFullBranch()); + } + + @Test public void testCloneRepositoryOnlyOneBranch() throws IOException, JGitInternalException, GitAPIException { File directory = createTempDirectory("testCloneRepositoryWithBranch"); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java index ba0847bd8d..67e1879d37 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java @@ -327,6 +327,33 @@ public class MergeCommandTest extends RepositoryTestCase { } @Test + public void testMergeTag() throws Exception { + Git git = new Git(db); + + writeTrashFile("a", "a"); + git.add().addFilepattern("a").call(); + RevCommit initialCommit = git.commit().setMessage("initial").call(); + + createBranch(initialCommit, "refs/heads/side"); + checkoutBranch("refs/heads/side"); + + writeTrashFile("b", "b"); + git.add().addFilepattern("b").call(); + RevCommit secondCommit = git.commit().setMessage("side").call(); + Ref tag = git.tag().setAnnotated(true).setMessage("my tag 01") + .setName("tag01").setObjectId(secondCommit).call(); + + checkoutBranch("refs/heads/master"); + + writeTrashFile("a", "a2"); + git.add().addFilepattern("a").call(); + git.commit().setMessage("main").call(); + + MergeResult result = git.merge().include(tag).setStrategy(MergeStrategy.RESOLVE).call(); + assertEquals(MergeStatus.MERGED, result.getMergeStatus()); + } + + @Test public void testMergeMessage() throws Exception { Git git = new Git(db); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java index 820c0c6d78..00e5f06747 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, Google Inc. + * Copyright (C) 2010, 2013 Google Inc. * and other copyright owners as documented in the project's IP log. * * This program and the accompanying materials are made available @@ -257,6 +257,35 @@ public class DiffFormatterTest extends RepositoryTestCase { } @Test + public void testCreateFileHeaderWithoutIndexLine() throws Exception { + DiffEntry m = DiffEntry.modify(PATH_A); + m.oldMode = FileMode.REGULAR_FILE; + m.newMode = FileMode.EXECUTABLE_FILE; + + FileHeader fh = df.toFileHeader(m); + String expected = DIFF + "a/src/a b/src/a\n" + // + "old mode 100644\n" + // + "new mode 100755\n"; + assertEquals(expected, fh.getScriptText()); + } + + @Test + public void testCreateFileHeaderForRenameWithoutContentChange() throws Exception { + DiffEntry a = DiffEntry.delete(PATH_A, ObjectId.zeroId()); + DiffEntry b = DiffEntry.add(PATH_B, ObjectId.zeroId()); + DiffEntry m = DiffEntry.pair(ChangeType.RENAME, a, b, 100); + m.oldId = null; + m.newId = null; + + FileHeader fh = df.toFileHeader(m); + String expected = DIFF + "a/src/a b/src/b\n" + // + "similarity index 100%\n" + // + "rename from src/a\n" + // + "rename to src/b\n"; + assertEquals(expected, fh.getScriptText()); + } + + @Test public void testDiff() throws Exception { write(new File(db.getDirectory().getParent(), "test.txt"), "test"); File folder = new File(db.getDirectory().getParent(), "folder"); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java index 9bf3b94c43..a821e948e7 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, Google Inc. + * Copyright (C) 2010, 2013 Google Inc. * and other copyright owners as documented in the project's IP log. * * This program and the accompanying materials are made available @@ -73,6 +73,7 @@ import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.BatchRefUpdate; +import org.eclipse.jgit.lib.ProgressMonitor; import org.eclipse.jgit.lib.NullProgressMonitor; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Ref.Storage; @@ -1191,8 +1192,7 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase { ReceiveCommand.Type.UPDATE_NONFASTFORWARD)); BatchRefUpdate batchUpdate = refdir.newBatchUpdate(); batchUpdate.addCommand(commands); - batchUpdate - .execute(new RevWalk(diskRepo), NullProgressMonitor.INSTANCE); + batchUpdate.execute(new RevWalk(diskRepo), new StrictWorkMonitor()); Map<String, Ref> refs = refdir.getRefs(RefDatabase.ALL); assertEquals(ReceiveCommand.Result.OK, commands.get(0).getResult()); assertEquals(ReceiveCommand.Result.REJECTED_NONFASTFORWARD, commands @@ -1215,8 +1215,7 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase { BatchRefUpdate batchUpdate = refdir.newBatchUpdate(); batchUpdate.setAllowNonFastForwards(true); batchUpdate.addCommand(commands); - batchUpdate - .execute(new RevWalk(diskRepo), NullProgressMonitor.INSTANCE); + batchUpdate.execute(new RevWalk(diskRepo), new StrictWorkMonitor()); Map<String, Ref> refs = refdir.getRefs(RefDatabase.ALL); assertEquals(ReceiveCommand.Result.OK, commands.get(0).getResult()); assertEquals(ReceiveCommand.Result.OK, commands.get(1).getResult()); @@ -1267,8 +1266,7 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase { BatchRefUpdate batchUpdate = refdir.newBatchUpdate(); batchUpdate.setAllowNonFastForwards(true); batchUpdate.addCommand(commands); - batchUpdate - .execute(new RevWalk(diskRepo), NullProgressMonitor.INSTANCE); + batchUpdate.execute(new RevWalk(diskRepo), new StrictWorkMonitor()); Map<String, Ref> refs = refdir.getRefs(RefDatabase.ALL); assertEquals(ReceiveCommand.Result.OK, commands.get(0).getResult()); assertEquals(ReceiveCommand.Result.OK, commands.get(1).getResult()); @@ -1311,4 +1309,29 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase { File path = new File(diskRepo.getDirectory(), name); assertTrue("deleted " + name, path.delete()); } + + private static final class StrictWorkMonitor implements ProgressMonitor { + private int lastWork, totalWork; + + public void start(int totalTasks) { + // empty + } + + public void beginTask(String title, int totalWork) { + this.totalWork = totalWork; + lastWork = 0; + } + + public void update(int completed) { + lastWork += completed; + } + + public void endTask() { + assertEquals("Units of work recorded", totalWork, lastWork); + } + + public boolean isCancelled() { + return false; + } + } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java index 871741f697..3f5fcbbf07 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java @@ -1,6 +1,7 @@ /* * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com> * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> + * Copyright (C) 2013, Robin Stocker <robin@nibor.org> * and other copyright owners as documented in the project's IP log. * * This program and the accompanying materials are made available @@ -46,6 +47,7 @@ package org.eclipse.jgit.transport; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; @@ -294,4 +296,152 @@ public class RefSpecTest { assertEquals(src, r.getSource()); assertEquals(dst, r.getDestination()); } + + @Test + public void isWildcardShouldWorkForWildcardSuffixAndComponent() { + assertTrue(RefSpec.isWildcard("refs/heads/*")); + assertTrue(RefSpec.isWildcard("refs/pull/*/head")); + assertFalse(RefSpec.isWildcard("refs/heads/a")); + } + + @Test + public void testWildcardInMiddleOfSource() { + RefSpec a = new RefSpec("+refs/pull/*/head:refs/remotes/origin/pr/*"); + assertTrue(a.isWildcard()); + assertTrue(a.matchSource("refs/pull/a/head")); + assertTrue(a.matchSource("refs/pull/foo/head")); + assertTrue(a.matchSource("refs/pull/foo/bar/head")); + assertFalse(a.matchSource("refs/pull/foo")); + assertFalse(a.matchSource("refs/pull/head")); + assertFalse(a.matchSource("refs/pull/foo/head/more")); + assertFalse(a.matchSource("refs/pullx/head")); + + RefSpec b = a.expandFromSource("refs/pull/foo/head"); + assertEquals("refs/remotes/origin/pr/foo", b.getDestination()); + RefSpec c = a.expandFromDestination("refs/remotes/origin/pr/foo"); + assertEquals("refs/pull/foo/head", c.getSource()); + } + + @Test + public void testWildcardInMiddleOfDestionation() { + RefSpec a = new RefSpec("+refs/heads/*:refs/remotes/origin/*/head"); + assertTrue(a.isWildcard()); + assertTrue(a.matchDestination("refs/remotes/origin/a/head")); + assertTrue(a.matchDestination("refs/remotes/origin/foo/head")); + assertTrue(a.matchDestination("refs/remotes/origin/foo/bar/head")); + assertFalse(a.matchDestination("refs/remotes/origin/foo")); + assertFalse(a.matchDestination("refs/remotes/origin/head")); + assertFalse(a.matchDestination("refs/remotes/origin/foo/head/more")); + assertFalse(a.matchDestination("refs/remotes/originx/head")); + + RefSpec b = a.expandFromSource("refs/heads/foo"); + assertEquals("refs/remotes/origin/foo/head", b.getDestination()); + RefSpec c = a.expandFromDestination("refs/remotes/origin/foo/head"); + assertEquals("refs/heads/foo", c.getSource()); + } + + @Test + public void testWildcardMirror() { + RefSpec a = new RefSpec("*:*"); + assertTrue(a.isWildcard()); + assertTrue(a.matchSource("a")); + assertTrue(a.matchSource("foo")); + assertTrue(a.matchSource("foo/bar")); + assertTrue(a.matchDestination("a")); + assertTrue(a.matchDestination("foo")); + assertTrue(a.matchDestination("foo/bar")); + + RefSpec b = a.expandFromSource("refs/heads/foo"); + assertEquals("refs/heads/foo", b.getDestination()); + RefSpec c = a.expandFromDestination("refs/heads/foo"); + assertEquals("refs/heads/foo", c.getSource()); + } + + @Test + public void testWildcardAtStart() { + RefSpec a = new RefSpec("*/head:refs/heads/*"); + assertTrue(a.isWildcard()); + assertTrue(a.matchSource("a/head")); + assertTrue(a.matchSource("foo/head")); + assertTrue(a.matchSource("foo/bar/head")); + assertFalse(a.matchSource("/head")); + assertFalse(a.matchSource("a/head/extra")); + + RefSpec b = a.expandFromSource("foo/head"); + assertEquals("refs/heads/foo", b.getDestination()); + RefSpec c = a.expandFromDestination("refs/heads/foo"); + assertEquals("foo/head", c.getSource()); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenSourceOnlyAndWildcard() { + assertNotNull(new RefSpec("refs/heads/*")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenDestinationOnlyAndWildcard() { + assertNotNull(new RefSpec(":refs/heads/*")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenOnlySourceWildcard() { + assertNotNull(new RefSpec("refs/heads/*:refs/heads/foo")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenOnlyDestinationWildcard() { + assertNotNull(new RefSpec("refs/heads/foo:refs/heads/*")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenMoreThanOneWildcardInSource() { + assertNotNull(new RefSpec("refs/heads/*/*:refs/heads/*")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenMoreThanOneWildcardInDestination() { + assertNotNull(new RefSpec("refs/heads/*:refs/heads/*/*")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenWildcardAfterText() { + assertNotNull(new RefSpec("refs/heads/wrong*:refs/heads/right/*")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenWildcardBeforeText() { + assertNotNull(new RefSpec("*wrong:right/*")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenWildcardBeforeTextAtEnd() { + assertNotNull(new RefSpec("refs/heads/*wrong:right/*")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidSourceDoubleSlashes() { + assertNotNull(new RefSpec("refs/heads//wrong")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidSlashAtStart() { + assertNotNull(new RefSpec("/foo:/foo")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidDestinationDoubleSlashes() { + assertNotNull(new RefSpec(":refs/heads//wrong")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidSetSource() { + RefSpec a = new RefSpec("refs/heads/*:refs/remotes/origin/*"); + a.setSource("refs/heads/*/*"); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidSetDestination() { + RefSpec a = new RefSpec("refs/heads/*:refs/remotes/origin/*"); + a.setDestination("refs/remotes/origin/*/*"); + } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawSubStringPatternTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawSubStringPatternTest.java new file mode 100644 index 0000000000..194fab47fc --- /dev/null +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawSubStringPatternTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2013, Robin Stocker <robin@nibor.org> + * and other copyright owners as documented in the project's IP log. + * + * This program and the accompanying materials are made available + * under the terms of the Eclipse Distribution License v1.0 which + * accompanies this distribution, is reproduced below, and is + * available at http://www.eclipse.org/org/documents/edl-v10.php + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * - Neither the name of the Eclipse Foundation, Inc. nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.eclipse.jgit.util; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.UnsupportedEncodingException; + +import org.eclipse.jgit.junit.RepositoryTestCase; +import org.junit.Test; + +public class RawSubStringPatternTest extends RepositoryTestCase { + + @Test + public void testBoundary() { + assertMatchResult("a", "a", 0); + assertMatchResult("a", "abcd", 0); + assertMatchResult("ab", "abcd", 0); + assertMatchResult("abcd", "abcd", 0); + assertMatchResult("bc", "abcd", 1); + assertMatchResult("bcd", "abcd", 1); + assertMatchResult("cd", "abcd", 2); + assertMatchResult("d", "abcd", 3); + assertMatchResult("abab", "abaabab", 3); + } + + @Test + public void testNoMatches() { + assertMatchResult("a", "", -1); + assertMatchResult("a", "b", -1); + assertMatchResult("abab", "abaaba", -1); + assertMatchResult("ab", "ddda", -1); + } + + @Test + public void testCaseInsensitive() { + assertMatchResult("a", "A", 0); + assertMatchResult("A", "a", 0); + assertMatchResult("Ab", "aB", 0); + assertMatchResult("aB", "Ab", 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testEmptyPattern() { + assertNotNull(new RawSubStringPattern("")); + } + + private static void assertMatchResult(String pattern, String input, int position) { + RawSubStringPattern p = new RawSubStringPattern(pattern); + assertEquals("Expected match result " + position + " with input " + + input + " for pattern " + pattern, + position, p.match(raw(input))); + } + + private static RawCharSequence raw(String text) { + try { + byte[] bytes = text.getBytes("UTF-8"); + return new RawCharSequence(bytes, 0, bytes.length); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } +} |