auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ImportCorrection(DataObject correctedObject, CorrectedProperty correctedProperty, String oldValue, String newValue) { super(); <START> Preconditions.checkNotNull(correctedProperty); <END> Preconditions.checkArgument(StringUtils.isNotBlank(oldValue) || StringUtils.isNotBlank(newValue)); this.correctedObject = correctedObject; this.correctedProperty = correctedProperty; this.oldValue = oldValue; this.newValue = newValue; }</code><technical_language>is a matter of taste I calling super() explicitly in this case bring readability of code</technical_language>

Target:
public ImportCorrection(DataObject correctedObject, CorrectedProperty correctedProperty, String oldValue, String newValue) { Preconditions.checkNotNull(correctedProperty); Preconditions.checkArgument(StringUtils.isNotBlank(oldValue) || StringUtils.isNotBlank(newValue)); this.correctedObject = correctedObject; this.correctedProperty = correctedProperty; this.oldValue = oldValue; this.newValue = newValue; }
Source:
<code>private boolean hasSeriesSummary(ProgData progData) { if (progData.getSeason() != null && !Strings.isNullOrEmpty(progData.getSeason().getSeasonSummary())) { return true; } <START> return false; <END> }</code><technical_language>Another instance of returning boolean result of a boolean check. THIS IS BAD</technical_language>

Target:
private boolean hasSeriesSummary(ProgData progData) { return (progData.getSeason() != null && !Strings.isNullOrEmpty(progData.getSeason().getSeasonSummary())); }
Source:
<code>public void test_index_initialization() { File java_ucfg_dir = new File(new File(tmp.getRoot(), "ucfg"), "java"); if(java_ucfg_dir.isDirectory()) { for (File file : java_ucfg_dir.listFiles()) { file.delete(); } } CompilationUnitTree cut = getCompilationUnitTreeWithSemantics("class A {String fun() {return \"\";}} "); UCFGJavaVisitor UCFGJavaVisitor = new UCFGJavaVisitor(tmp.getRoot()); UCFGJavaVisitor.fileKey = FILE_KEY; UCFGJavaVisitor.visitCompilationUnit(cut); UCFGJavaVisitor = new UCFGJavaVisitor(tmp.getRoot()); UCFGJavaVisitor.fileKey = FILE_KEY; UCFGJavaVisitor.visitCompilationUnit(cut); <START> String[] list = new File(new File(tmp.getRoot(), "ucfg"), "java").list(); <END> assertThat(list).hasSize(2).containsExactly("ucfg_0.proto", "ucfg_1.proto"); }</code><technical_language>java_ucfg_dir</technical_language>

Target:
public void test_index_initialization() { File java_ucfg_dir = new File(new File(tmp.getRoot(), "ucfg"), "java"); if(java_ucfg_dir.isDirectory()) { for (File file : java_ucfg_dir.listFiles()) { file.delete(); } } CompilationUnitTree cut = getCompilationUnitTreeWithSemantics("class A {String fun() {return \"\";}} "); UCFGJavaVisitor UCFGJavaVisitor = new UCFGJavaVisitor(tmp.getRoot()); UCFGJavaVisitor.fileKey = FILE_KEY; UCFGJavaVisitor.visitCompilationUnit(cut); UCFGJavaVisitor = new UCFGJavaVisitor(tmp.getRoot()); UCFGJavaVisitor.fileKey = FILE_KEY; UCFGJavaVisitor.visitCompilationUnit(cut); String[] list = java_ucfg_dir.list(); assertThat(list).hasSize(2).containsExactly("ucfg_0.proto", "ucfg_1.proto"); }
Source:
<code><START> public void flush(final String value) { <END> final int rowIndex = context.getRowIndex(); final int columnIndex = context.getColumnIndex(); String actualValue = (value == null || value.trim().isEmpty()) ? null : value; ((ScenarioGridModel) gridWidget.getModel()).setCellValue(rowIndex, columnIndex, new ScenarioGridCellValue(actualValue)); }</code><technical_language>mind add coverage for this method</technical_language>

Target:
public void flush(final String value) { final int rowIndex = context.getRowIndex(); final int columnIndex = context.getColumnIndex(); String actualValue = (value == null || value.trim().isEmpty()) ? null : value; gridWidget.getModel().setCellValue(rowIndex, columnIndex, new ScenarioGridCellValue(actualValue, ScenarioSimulationEditorConstants.INSTANCE.insertValue())); }
Source:
<code>protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { Dashboard dashboard; response.setContentType(CONTENT_TYPE); response.setCharacterEncoding(ENCODING); try { if (FakeDataGenerator.headerWantsFakeData(request)) { dashboard = getFakeDashboard(); } else if <START> ("nocache".equals(request.getHeader("Prefer"))) <END> { dashboard = getDashboard(); dashboard.setInventory(lookupInventory()); } else { dashboard = getDashboardFromCache(); } ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(response.getOutputStream(), dashboard); } catch (final DashboardDataException se) { log.error("Unable to retrieve dashboard data", se); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(response.getOutputStream(), new DashboardError("Unable to retrieve dashboard data")); } }</code><technical_language>Prefer header support multiple values: Prefer: value1[,value2,etc] Therefore, instead of request.getHeader (which returns if present), request.getHeaders check if is present. for FakeDataGenerator#headerWantsFakeData method. Also, FakeDataGenerator#PREFER constant moved DashboardDataServlet class</technical_language>

Target:
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { Dashboard dashboard; response.setContentType(CONTENT_TYPE); response.setCharacterEncoding(ENCODING); try { boolean preferFake = false; boolean preferError = false; boolean preferNoCache = false; String preferHeader = request.getHeader(PREFER_HEADER); String[] preferOptions = preferHeader == null ? new String[0] : preferHeader.trim().split("\\s*,\\s*"); for (String option : preferOptions) { switch (option) { case PREFER_FAKE_DATA: preferFake = true; break; case PREFER_ERROR: preferError = true; break; case PREFER_NO_CACHE: preferNoCache = true; break; } } if (preferError) { log.debug("client requested an error condition"); throw new ServletException("An error condition was requested."); } else if (preferFake) { log.debug("client requested fake data"); dashboard = getFakeDashboard(); } else if (preferNoCache) { log.debug("client requested non-cache direct query data"); dashboard = getDashboard(); dashboard.setInventory(lookupInventory()); } else { dashboard = getDashboardFromCache(); } ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(response.getOutputStream(), dashboard); } catch (final DashboardDataException se) { log.error("Unable to retrieve dashboard data", se); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(response.getOutputStream(), new DashboardError("Unable to retrieve dashboard data")); } }
Source:
<code>private void addApplicationAttributes(Connection conn, Map<String, String> attributes, int applicationId, int tenantId) throws APIManagementException { PreparedStatement ps = null; ResultSet rs = null; try { if (attributes != null) { ps = conn.prepareStatement(SQLConstants.ADD_APPLICATION_ATTRIBUTES_SQL); <START> for (String key : attributes.keySet()) { <END> if (!StringUtils.isEmpty(key) && !StringUtils.isEmpty(attributes.get(key))) { ps.setInt(1, applicationId); ps.setString(2, key); ps.setString(3, attributes.get(key)); ps.setInt(4, tenantId); ps.addBatch(); } } int[] update = ps.executeBatch(); } } catch (SQLException e) { handleException("Error in adding attributes of application with id: " + applicationId , e); } finally { APIMgtDBUtil.closeAllConnections(ps, null, rs); } }</code><technical_language>entry set</technical_language>

Target:
private void addApplicationAttributes(Connection conn, Map<String, String> attributes, int applicationId, int tenantId) throws APIManagementException { PreparedStatement ps = null; ResultSet rs = null; try { if (attributes != null) { ps = conn.prepareStatement(SQLConstants.ADD_APPLICATION_ATTRIBUTES_SQL); for (Map.Entry<String, String> attribute : attributes.entrySet()) { if (StringUtils.isNotEmpty(attribute.getKey()) && StringUtils.isNotEmpty(attribute.getValue())) { ps.setInt(1, applicationId); ps.setString(2, attribute.getKey()); ps.setString(3, attribute.getValue()); ps.setInt(4, tenantId); ps.addBatch(); } } int[] update = ps.executeBatch(); } } catch (SQLException e) { handleException("Error in adding attributes of application with id: " + applicationId , e); } finally { APIMgtDBUtil.closeAllConnections(ps, null, rs); } }
Source:
<code><START> private void verifyRunListForEnvironment(Map<String, List<String>> envRunList, String envName, <END> String... expectedEntries) { assertTrue(envRunList.containsKey(envName), "envRunList contains " + envName); assertEquals(envRunList.get(envName).size(), expectedEntries.length, "envRunList size for '" + envName); assertTrue(envRunList.get(envName).containsAll(Arrays.asList(expectedEntries)), "envRunList for e1 contains " + Arrays.asList(expectedEntries)); }</code><technical_language>this public static call live test avoid code duplication</technical_language>

Target:
public static void verifyRunListForEnvironment(Map<String, List<String>> envRunList, String envName, String... expectedEntries) { assertTrue(envRunList.containsKey(envName), "envRunList contains " + envName); assertEquals(envRunList.get(envName).size(), expectedEntries.length, "envRunList size for '" + envName); assertTrue(envRunList.get(envName).containsAll(Arrays.asList(expectedEntries)), "envRunList for e1 contains " + Arrays.asList(expectedEntries)); }
Source:
<code>public CliCommand init(final Arguments args) throws Exception { this.filterParams = args.getFilterParams(); this.bucketName = args.getBucket(); if (!Guard.isStringNullOrEmpty(args.getPrefix())) { <START> throw new BadArgumentException("'-p' prefix is not supported."); <END> } this.prefix = null; return this; }</code><technical_language>This a warning instead of a exceptional condition. if is supported a prefix method variable in place</technical_language>

Target:
public CliCommand init(final Arguments args) throws Exception { this.filterParams = args.getFilterParams(); this.bucketName = args.getBucket(); if (!Guard.isStringNullOrEmpty(args.getPrefix())) { LOG.warn("'-p' prefix is not supported."); } this.prefix = null; return this; }
Source:
<code>protected void doWork(IProgressMonitor monitor) throws OseeCoreException { if (workPackages.isEmpty()) { throw new OseeArgumentException("ERROR", "Must provide Work Packages"); } for (IAtsWorkPackage workPkg : workPackages) { <START> for (Artifact art : ArtifactQuery.getArtifactListFromAttribute(AtsAttributeTypes.WorkPackageGuid, <END> workPkg.getGuid(), AtsUtilCore.getAtsBranchToken(), QueryOptions.EXACT_MATCH_OPTIONS)) { AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) art; EarnedValueReportResult result = new EarnedValueReportResult(workPkg, art); results.add(result); result.setValue(Work_Package_Id, workPkg.getWorkPackageId()); result.setValue(Work_Package_Name, workPkg.getName()); result.setValue(Work_Package_Percent, String.valueOf(workPkg.getWorkPackagePercent())); result.setValue(Work_Package_Guid, String.valueOf(workPkg.getGuid())); result.setValue(Related_Action_Id, getActionId(art)); result.setValue(Related_Action_Name, art.getName()); result.setValue(Related_Action_Type, awa.getParentTeamWorkflow().getTeamDefinition().getName()); result.setValue(Related_Action_Percent, String.valueOf(PercentCompleteTotalUtil.getPercentCompleteTotal(art))); result.setValue(Related_Action_Guid, art.getGuid()); } } }</code><technical_language>Suggest a checkForCancelled</technical_language>

Target:
protected void doWork(IProgressMonitor monitor) throws OseeCoreException { if (workPackages.isEmpty()) { throw new OseeArgumentException("ERROR", "Must provide Work Packages"); } for (IAtsWorkPackage workPkg : workPackages) { checkForCancelledStatus(monitor); for (Artifact art : ArtifactQuery.getArtifactListFromAttribute(AtsAttributeTypes.WorkPackageGuid, workPkg.getGuid(), AtsUtilCore.getAtsBranchToken(), QueryOptions.EXACT_MATCH_OPTIONS)) { checkForCancelledStatus(monitor); AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) art; EarnedValueReportResult result = new EarnedValueReportResult(workPkg, art); results.add(result); result.setValue(Work_Package_Id, workPkg.getWorkPackageId()); result.setValue(Work_Package_Name, workPkg.getName()); result.setValue(Work_Package_Percent, String.valueOf(workPkg.getWorkPackagePercent())); result.setValue(Work_Package_Guid, String.valueOf(workPkg.getGuid())); result.setValue(Related_Action_Id, getActionId(art)); result.setValue(Related_Action_Name, art.getName()); result.setValue(Related_Action_Type, awa.getParentTeamWorkflow().getTeamDefinition().getName()); result.setValue(Related_Action_Percent, String.valueOf(PercentCompleteTotalUtil.getPercentCompleteTotal(art))); result.setValue(Related_Action_Guid, art.getGuid()); } } }
Source:
<code>public LockResponseV2 lock(LockRequestV2 request) { LockResponseV2 delegateResponse = delegate.lock(request); if (delegateResponse.wasSuccessful()) { return ImmutableLockResponseV2.builder() .from(delegateResponse) .tokenOrEmpty(makeSerializable(delegateResponse.getToken())) .build(); } <START> return ImmutableLockResponseV2.copyOf(delegateResponse); <END> }</code><technical_language>i see. hmm, yeah map optional. i.e., return ImmutableLockResponseV2.builder() .from(delegateResponse) .tokenOrEmpty(delegateReponse.map(this::makeSerializable)) .build();</technical_language>

Target:
public LockResponseV2 lock(LockRequestV2 request) { LockResponseV2 delegateResponse = delegate.lock(request); if (delegateResponse.wasSuccessful()) { return ImmutableLockResponseV2.builder() .from(delegateResponse) .tokenOrEmpty(makeSerializable(delegateResponse.getToken())) .build(); } return delegateResponse; }
Source:
<code>public KnoxShellTable greaterThanOrEqualTo(Comparable<? extends Object> comparable) throws KnoxShellTableFilterException { <START> return filter(s -> s.compareTo(comparable) > 0 || s.compareTo(comparable) == 0); <END> }</code><technical_language>equals() for gt lt</technical_language>

Target:
public KnoxShellTable greaterThanOrEqualTo(Comparable<? extends Object> comparable) throws KnoxShellTableFilterException { return filter(s -> s.compareTo(comparable) > 0 || s.equals(comparable)); }
Source:
<code>private String buildMessageForCompositeId(Long clusterId, Long serviceId) { <START> return String.format("cluster id <%d>, id <%d>", <END> clusterId, serviceId); }</code><technical_language>check this prints messages decent grammar? sure, "cluster id ... service id ..."</technical_language>

Target:
private String buildMessageForCompositeId(Long clusterId, Long serviceId) { return String.format("cluster id <%d>, service id <%d>", clusterId, serviceId); }
Source:
<code>public void testJavaDocsRecognition() throws Exception { final List<BlockCommentPositionTestMetadata> metadataList = Arrays.asList( new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnClass.java", BlockCommentPosition::isOnClass, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnMethod.java", BlockCommentPosition::isOnMethod, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnField.java", BlockCommentPosition::isOnField, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnEnum.java", BlockCommentPosition::isOnEnum, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnConstructor.java", BlockCommentPosition::isOnConstructor, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnInterface.java", BlockCommentPosition::isOnInterface, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnAnnotation.java", BlockCommentPosition::isOnAnnotationDef, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnEnumMember.java", BlockCommentPosition::isOnEnumConstant, 2) ); for (BlockCommentPositionTestMetadata metadata : metadataList) { final DetailAST ast = TestUtils.parseFile( new File(getPath(metadata.getFileName())) ); <START> final int matches = foundJavaDocsCount(ast, metadata.getAssertion()); <END> assertEquals(metadata.getMatchesNum(), matches); } }</code><technical_language>This @romani wants method removed</technical_language>

Target:
public void testJavaDocsRecognition() throws Exception { final List<BlockCommentPositionTestMetadata> metadataList = Arrays.asList( new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnClass.java", BlockCommentPosition::isOnClass, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnMethod.java", BlockCommentPosition::isOnMethod, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnField.java", BlockCommentPosition::isOnField, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnEnum.java", BlockCommentPosition::isOnEnum, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnConstructor.java", BlockCommentPosition::isOnConstructor, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnInterface.java", BlockCommentPosition::isOnInterface, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnAnnotation.java", BlockCommentPosition::isOnAnnotationDef, 3), new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnEnumMember.java", BlockCommentPosition::isOnEnumConstant, 2) ); for (BlockCommentPositionTestMetadata metadata : metadataList) { final DetailAST ast = TestUtils.parseFile( new File(getPath(metadata.getFileName())) ); final int matches = getJavadocsCount(ast, metadata.getAssertion()); assertEquals(metadata.getMatchesNum(), matches); } }
Source:
<code>public void Rollback() { log.errorFormat("Transaction rolled-back for command: {0}.", CommandBase.this.getClass().getName()); try { if (this instanceof Quotable) { ((Quotable) this).rollbackQuota(); } <START> } catch (Exception e) { <END> log.debug("RollbackQuota: failed (may be because quota is disabled)", e); } cancelTasks(); }</code><technical_language>Same- catch NPE</technical_language>

Target:
public void Rollback() { log.errorFormat("Transaction rolled-back for command: {0}.", CommandBase.this.getClass().getName()); try { if (this instanceof Quotable) { ((Quotable) this).rollbackQuota(); } } catch (NullPointerException e) { log.debug("RollbackQuota: failed (may be because quota is disabled)", e); } cancelTasks(); }
Source:
<code><START> public static SQLDatabase openSqlDatabase(String dbFilename, KeyProvider provider) throws IOException { <END> boolean runningOnAndroid = Misc.isRunningOnAndroid(); boolean useSqlCipher = (provider.getEncryptionKey() != null); makeSureFileExists(dbFilename); try { if (runningOnAndroid) { if (useSqlCipher) { return (SQLDatabase) Class.forName("com.cloudant.sync.sqlite.android.AndroidSQLCipherSQLite") .getMethod("openAndroidSQLite", String.class, KeyProvider.class) .invoke(null, new Object[]{dbFilename, provider}); } else { return (SQLDatabase) Class.forName("com.cloudant.sync.sqlite.android.AndroidSQLite") .getMethod("createAndroidSQLite", String.class) .invoke(null, dbFilename); } } else { if (useSqlCipher) { throw new IOException("No SQLCipher-based database implementation for Java SE"); } else { return (SQLDatabase) Class.forName("com.cloudant.sync.sqlite.sqlite4java.SQLiteWrapper") .getMethod("openSQLiteWrapper", String.class) .invoke(null, dbFilename); } } } catch (Exception e) { logger.log(Level.SEVERE, "Failed to load database module", e); return null; } }</code><technical_language>a lot of shared code openSqlDatabase createSQLDatabase. method names vary collapse this down</technical_language>

Target:
public static SQLDatabase openSqlDatabase(String dbFilename, KeyProvider provider) throws IOException { boolean runningOnAndroid = Misc.isRunningOnAndroid(); boolean useSqlCipher = (provider.getEncryptionKey() != null); makeSureFileExists(dbFilename); try { if (runningOnAndroid) { if (useSqlCipher) { SQLDatabase result = (SQLDatabase) Class.forName("com.cloudant.sync.sqlite.android.AndroidSQLCipherSQLite") .getMethod("openAndroidSQLite", String.class, KeyProvider.class) .invoke(null, new Object[]{dbFilename, provider}); if (validateOpenedDatabase(result)) { return result; } else { return null; } } else { return (SQLDatabase) Class.forName("com.cloudant.sync.sqlite.android.AndroidSQLite") .getMethod("createAndroidSQLite", String.class) .invoke(null, dbFilename); } } else { if (useSqlCipher) { throw new UnsupportedOperationException("No SQLCipher-based database implementation for Java SE"); } else { return (SQLDatabase) Class.forName("com.cloudant.sync.sqlite.sqlite4java.SQLiteWrapper") .getMethod("openSQLiteWrapper", String.class) .invoke(null, dbFilename); } } } catch (Exception e) { logger.log(Level.SEVERE, "Failed to load database module", e); return null; } }
Source:
<code>protected void onCancelled() { <START> Logger.d(TAG, "HttpWebRequest onCancelled thread" + android.os.Process.myTid()); <END> if (null != mCallback) { mCallback.onComplete(null, new AuthenticationCancelError()); } }</code><technical_language>Formatting: Add delimiter end of text, colon space thread id</technical_language>

Target:
protected void onCancelled() { Logger.d(TAG, "HttpWebRequest onCancelled thread:" + android.os.Process.myTid()); if (null != mCallback) { mCallback.onComplete(null, new AuthenticationCancelError()); } }
Source:
<code>public void testWaitForPortFreeWhenAbortingOnTimeout() throws Exception { ServerSocket serverSocket = openServerSocket(); try { int port = serverSocket.getLocalPort(); String cmd = BashCommands.waitForPortFree(port, Duration.ONE_SECOND, true); int exitcode = loc.execCommands("test", ImmutableList.of(cmd)); assertEquals(exitcode, 1); serverSocket.close(); assertTrue(Networking.isPortAvailable(port)); <START> String cmd2 = BashCommands.waitForPortFree(port, Duration.ONE_SECOND, true); <END> int exitcode2 = loc.execCommands("test", ImmutableList.of(cmd2)); assertEquals(exitcode2, 0); } finally { serverSocket.close(); } }</code><technical_language>command, reuse. for other test methods</technical_language>

Target:
public void testWaitForPortFreeWhenAbortingOnTimeout() throws Exception { ServerSocket serverSocket = openServerSocket(); try { int port = serverSocket.getLocalPort(); String cmd = BashCommands.waitForPortFree(port, Duration.ONE_SECOND, true); int exitcode = loc.execCommands("test", ImmutableList.of(cmd)); assertEquals(exitcode, 1); serverSocket.close(); assertTrue(Networking.isPortAvailable(port)); int exitcode2 = loc.execCommands("test", ImmutableList.of(cmd)); assertEquals(exitcode2, 0); } finally { serverSocket.close(); } }
Source:
<code>private static Class lookupKeyGenClass() { final Class keyGenClass; <START> if (ClassUtil.checkForClass(KEYGEN_CLASS_JDK8_SUN)) { <END> keyGenClass = ClassUtil.classForName(KEYGEN_CLASS_JDK8_SUN); } else if (ClassUtil.checkForClass(KEYGEN_CLASS_JDK7_SUN)) { keyGenClass = ClassUtil.classForName(KEYGEN_CLASS_JDK7_SUN); } else if (ClassUtil.checkForClass(KEYGEN_CLASS_JDK8_IBM)) { keyGenClass = ClassUtil.classForName(KEYGEN_CLASS_JDK8_IBM); } else if (ClassUtil.checkForClass(KEYGEN_CLASS_JDK7_IBM)) { keyGenClass = ClassUtil.classForName(KEYGEN_CLASS_JDK7_IBM); } else { throw new IllegalStateException( "Cannot find any key-generator class: Tried Sun Java 8's " + KEYGEN_CLASS_JDK8_SUN + ", Sun Java 7's " + KEYGEN_CLASS_JDK7_SUN + ", IBM Java 8's " + KEYGEN_CLASS_JDK8_IBM + " and IBM Java 7's " + KEYGEN_CLASS_JDK7_IBM); } return keyGenClass; }</code><technical_language>classForName return null class save calls checkForClass(): fetch class if null, try next. This moved out extra method this in a loop returns soon found</technical_language>

Target:
private static Class lookupKeyGenClass() { Class keyGenClass = null; for (final String keyGenCandidate : new String[]{ KEYGEN_CLASS_JDK8_SUN, KEYGEN_CLASS_JDK7_SUN, KEYGEN_CLASS_JDK8_IBM, KEYGEN_CLASS_JDK7_IBM }) { keyGenClass = ClassUtil.classForName(keyGenCandidate); if (keyGenClass != null) { break; } } if (keyGenClass == null) { throw new IllegalStateException( "Cannot find any key-generator class: Tried Sun Java 8's " + KEYGEN_CLASS_JDK8_SUN + ", Sun Java 7's " + KEYGEN_CLASS_JDK7_SUN + ", IBM Java 8's " + KEYGEN_CLASS_JDK8_IBM + " and IBM Java 7's " + KEYGEN_CLASS_JDK7_IBM); } return keyGenClass; }
Source:
<code>private void setHeaderTextAndscroll(MotionEvent event){ if (mListView == null) { return; } String headerString = sections[sectionForPoint(event.getY())]; header.setText(headerString); ListAdapter adapter = mListView.getAdapter(); <START> if(sectionIndexer == null){ <END> if(adapter instanceof HeaderViewListAdapter){ sectionIndexer = (SectionIndexer) ((HeaderViewListAdapter) adapter).getWrappedAdapter(); }else if(adapter instanceof SectionIndexer){ sectionIndexer = (SectionIndexer)adapter; }else{ throw new RuntimeException("listview sets adapter does not implement SectionIndexer interface"); } } String[] adapterSections = (String[]) sectionIndexer.getSections(); try { for (int i = adapterSections.length - 1; i > -1; i--) { if(adapterSections[i].equals(headerString)){ mListView.setSelection(sectionIndexer.getPositionForSection(i)); break; } } } catch (Exception e) { Log.e("setHeaderTextAndScroll", e.getMessage()); } }</code><technical_language>sectionIndex</technical_language>

Target:
private void setHeaderTextAndscroll(MotionEvent event){ if (mListView == null) { return; } String headerString = sections[sectionForPoint(event.getY())]; header.setText(headerString); ListAdapter adapter = mListView.getAdapter(); if(sectionIndex == null){ if(adapter instanceof HeaderViewListAdapter){ sectionIndex = (SectionIndexer) ((HeaderViewListAdapter) adapter).getWrappedAdapter(); }else if(adapter instanceof SectionIndexer){ sectionIndex = (SectionIndexer)adapter; }else{ throw new RuntimeException("listview sets adapter does not implement SectionIndexer interface"); } } String[] adapterSections = (String[]) sectionIndex.getSections(); try { for (int i = adapterSections.length - 1; i > -1; i--) { if(adapterSections[i].equals(headerString)){ mListView.setSelection(sectionIndex.getPositionForSection(i)); break; } } } catch (Exception e) { Log.e("setHeaderTextAndScroll", e.getMessage()); } }
Source:
<code>void load(String file) throws IOException { try (InputStream inputStream = new FileInputStream(file)) { properties.loadFromXML(inputStream); } String defaultConfigFile = properties.getProperty("config.default"); if (defaultConfigFile != null) { try (InputStream inputStream = new FileInputStream(defaultConfigFile)) { Properties defaultProperties = new Properties(); defaultProperties.loadFromXML(inputStream); Enumeration props = defaultProperties.propertyNames(); <START> while (props.hasMoreElements()) { <END> String key = (String) props.nextElement(); if (!properties.containsKey(key)) { properties.setProperty(key, defaultProperties.getProperty(key)); } } } } }</code><technical_language>Do need this? I ways of setting environment variables</technical_language>

Target:
void load(String file) throws IOException { String defaultConfigFile = properties.getProperty("config.default"); if (defaultConfigFile != null) { try (InputStream inputStream = new FileInputStream(defaultConfigFile)) { properties.loadFromXML(inputStream); } } try (InputStream inputStream = new FileInputStream(file)) { Properties props = new Properties(); props.loadFromXML(inputStream); properties.putAll(props); } if ("true".equals(System.getenv("CONFIG_USE_ENV"))) { useEnvVars = true; } else { useEnvVars = properties.getProperty("config.useEnv", "false").equalsIgnoreCase("true"); } }
Source:
<code>public static int hexDigitMsb0ToInt(final char hexDigit) { switch (hexDigit) { case '0': return 0x0; case '1': return 0x8; case '2': return 0x4; case '3': return 0xC; case '4': return 0x2; case '5': return 0xA; case '6': return 0x6; case '7': return 0xE; case '8': return 0x1; case '9': return 0x9; case 'a':// fall through case 'A': return 0x5; case 'b':// fall through case 'B': return 0xD; case 'c':// fall through case 'C': return 0x3; case 'd':// fall through case 'D': return 0xB; case 'e':// fall through case 'E': return 0x7; case 'f':// fall through case 'F': return 0xF; default: <START> throw IllegalArgumentExceptions.format("Cannot interpret '%s' as a hexadecimal digit", hexDigit); <END> } }</code><technical_language>%d</technical_language>

Target:
public static int hexDigitMsb0ToInt(final char hexDigit) { switch (hexDigit) { case '0': return 0x0; case '1': return 0x8; case '2': return 0x4; case '3': return 0xC; case '4': return 0x2; case '5': return 0xA; case '6': return 0x6; case '7': return 0xE; case '8': return 0x1; case '9': return 0x9; case 'a':// fall through case 'A': return 0x5; case 'b':// fall through case 'B': return 0xD; case 'c':// fall through case 'C': return 0x3; case 'd':// fall through case 'D': return 0xB; case 'e':// fall through case 'E': return 0x7; case 'f':// fall through case 'F': return 0xF; default: throw IllegalArgumentExceptions.format("Cannot interpret '%d' as a hexadecimal digit", hexDigit); } }
Source:
<code>private void printContainerLog(String containerId) { LogCallback loggingCallback = new LogCallback(); dockerClient.logContainerCmd(containerId) .withStdErr(true) .withStdOut(true) .withFollowStream(true) .withTailAll() .exec(loggingCallback); try { loggingCallback.awaitCompletion(3, TimeUnit.SECONDS); } catch (InterruptedException e) { <START> e.printStackTrace(); <END> } log.infof("Container log:\n%s", loggingCallback.toString()); }</code><technical_language>logging interrupt thread</technical_language>

Target:
private void printContainerLog(String containerId) { LogCallback loggingCallback = new LogCallback(); dockerClient.logContainerCmd(containerId) .withStdErr(true) .withStdOut(true) .withFollowStream(true) .withTailAll() .exec(loggingCallback); try { loggingCallback.awaitCompletion(3, TimeUnit.SECONDS); } catch (InterruptedException e) { log.error(e.getMessage()); Thread.currentThread().interrupt(); } }
Source:
<code>public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { <START> $(selectToEnhance).as(Chosen.Chosen).chosen(); <END> } }</code><technical_language>need attach event if Element? I thought selecting widgets. I confusing :P</technical_language>

Target:
public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { ChosenOptions options = new ChosenOptions().setResources(pageProductChosenResources); $(selectToEnhance).as(Chosen.Chosen).chosen(options); } }
Source:
<code>protected void applyInformationWithProgress() { <START> final Runnable runnable = new GoImportOptimizer().processFile(myFile); <END> DocumentUtil.writeInRunUndoTransparentAction(runnable); }</code><technical_language>calculate imports remove right in EDT? efficient</technical_language>

Target:
protected void applyInformationWithProgress() { final Project project = myFile.getProject(); UndoManager undoManager = UndoManager.getInstance(project); if (undoManager.isUndoInProgress() || undoManager.isRedoInProgress()) return; DocumentUtil.writeInRunUndoTransparentAction(myRunnableFix); }
Source:
<code>public void execute(IProgressMonitor m) throws CoreException { IProgressMonitor monitor; if (m == null) monitor = new NullProgressMonitor(); else monitor = m; IWorkspaceRunnable action = new IWorkspaceRunnable() { public void run(IProgressMonitor actMonitor) throws CoreException { String taskName; if (branches.size() == 1) taskName = NLS.bind( CoreText.DeleteBranchOperation_TaskName, branches .iterator().next().getName()); else { <START> StringBuffer names = new StringBuffer(); <END> for (Ref ref : branches) names.append(ref.getName()).append(", "); taskName = NLS.bind( CoreText.DeleteBranchOperation_TaskName, names.substring(0, names.length() - 2)); } actMonitor.beginTask(taskName, branches.size()); for (Ref branch : branches) { try { new Git(repository).branchDelete().setBranchNames( branch.getName()).setForce(force).call(); status = OK; } catch (NotMergedException e) { status = REJECTED_UNMERGED; break; } catch (CannotDeleteCurrentBranchException e) { status = REJECTED_CURRENT; break; } catch (JGitInternalException e) { throw new CoreException(Activator.error(e.getMessage(), e)); } actMonitor.worked(1); } actMonitor.done(); } }; ResourcesPlugin.getWorkspace().run(action, monitor); }</code><technical_language>StringBuffer is 1900-ish. adding ", " is I cleaner if add conditionally</technical_language>

Target:
public void execute(IProgressMonitor m) throws CoreException { IProgressMonitor monitor; if (m == null) monitor = new NullProgressMonitor(); else monitor = m; IWorkspaceRunnable action = new IWorkspaceRunnable() { public void run(IProgressMonitor actMonitor) throws CoreException { String taskName; if (branches.size() == 1) taskName = NLS.bind( CoreText.DeleteBranchOperation_TaskName, branches .iterator().next().getName()); else { StringBuilder names = new StringBuilder(); for (Iterator<Ref> it = branches.iterator(); it.hasNext(); ) { Ref ref = it.next(); names.append(ref.getName()); if (it.hasNext()) names.append(", "); } taskName = NLS.bind( CoreText.DeleteBranchOperation_TaskName, names.substring(0, names.length() - 2)); } actMonitor.beginTask(taskName, branches.size()); for (Ref branch : branches) { try { new Git(repository).branchDelete().setBranchNames( branch.getName()).setForce(force).call(); status = OK; } catch (NotMergedException e) { status = REJECTED_UNMERGED; break; } catch (CannotDeleteCurrentBranchException e) { status = REJECTED_CURRENT; break; } catch (JGitInternalException e) { throw new CoreException(Activator.error(e.getMessage(), e)); } actMonitor.worked(1); } actMonitor.done(); } }; ResourcesPlugin.getWorkspace().run(action, monitor); }
Source:
<code>public void move(final String webInterceptorName, int index){ <START> final int currentIndex = this.indexOf(webInterceptorName); <END> if (-1 != currentIndex) { WebInterceptor webInterceptorRemoved = this.interceptors.remove(currentIndex); this.add(index, webInterceptorRemoved); } }</code><technical_language>check if index is out of range safe ;)</technical_language>

Target:
public void move(final String webInterceptorName, int index){ if (index >= 0 && index <= this.interceptors.size()) { final int currentIndex = this.indexOf(webInterceptorName); if (-1 != currentIndex) { WebInterceptor webInterceptorRemoved = this.interceptors.remove(currentIndex); this.add(index, webInterceptorRemoved); } }else{ throw new IndexOutOfBoundsException(); } }
Source:
<code>public void testUpwardsFloating() { Bubble bubble = new Bubble(new Point(0, 0), new Point(0, 0), null); ArrayList<Player> playerList = new ArrayList<Player>(); ArrayList<Unit> unitList = new ArrayList<Unit>(); List<Cell> items = new ArrayList<Cell>(); items.add(Cell.EMPTY); Grid<Cell> cells = new Grid<Cell>(items, 1, 1); Level level = new Level(playerList, unitList, cells); <START> final int TIME_FLOAT_UPWARDS = 50; <END> final Point FLOAT_UP_MOTION = new Point(0, -2); for(int i = 0; i < TIME_FLOAT_UPWARDS; i++) { bubble.tick(level); } assertTrue(bubble.isHit()); assertEquals(bubble.getMotion(), FLOAT_UP_MOTION); }</code><technical_language>Name 'TIME_FLOAT_UPWARDS' match pattern '^[a-z][a-zA-Z0-9]*$'. [CheckStyle] <naming</technical_language>

Target:
public void testUpwardsFloating() { Bubble bubble = new Bubble(new Point(0, 0), new Point(0, 0), null); ArrayList<Player> playerList = new ArrayList<Player>(); ArrayList<Unit> unitList = new ArrayList<Unit>(); List<Cell> items = new ArrayList<Cell>(); items.add(Cell.EMPTY); Grid<Cell> cells = new Grid<Cell>(items, 1, 1); Level level = new Level(playerList, unitList, cells); for(int i = 0; i < TIME_FLOAT_UPWARDS; i++) { bubble.tick(level); } assertTrue(bubble.isHit()); assertEquals(bubble.getMotion(), FLOAT_UP_MOTION); }
Source:
<code>public List<Procedure> splitWALs(ServerName crashedServer, boolean splitMeta) throws IOException { try { List<FileStatus> splittingFiles = getWALsToSplit(crashedServer, splitMeta); return createSplitWALProcedures(splittingFiles, crashedServer); } catch (IOException e) { <START> LOG.error("Failed to create procedures for splitting logs of {}", crashedServer, e); <END> throw e; } }</code><technical_language>logs => WALs</technical_language>

Target:
public List<Procedure> splitWALs(ServerName crashedServer, boolean splitMeta) throws IOException { try { List<FileStatus> splittingFiles = getWALsToSplit(crashedServer, splitMeta); return createSplitWALProcedures(splittingFiles, crashedServer); } catch (IOException e) { LOG.error("Failed to create procedures for splitting WALs of {}", crashedServer, e); throw e; } }
Source:
<code>private String getPageMatcherByType(HttpMessage msg) { if (CustomPageMatcherType.URL.equals(getPageMatcherType())) { return msg.getRequestHeader().getURI().toString(); } else if (CustomPageMatcherType.RESPONSE_CONTENT.equals(getPageMatcherType())) { return getHttpMessageAsString(msg); } <START> throw new RuntimeException("Not Supported"); <END> }</code><technical_language>fail gracefully (e.g. log error return empty string?)</technical_language>

Target:
private String getPageMatcherByType(HttpMessage msg) { if (CustomPageMatcherLocation.URL.equals(getPageMatcherLocation())) { return msg.getRequestHeader().getURI().toString(); } else if (CustomPageMatcherLocation.RESPONSE_CONTENT.equals(getPageMatcherLocation())) { return getHttpMessageAsString(msg); } LOGGER.error( "Could not get page matcher for the given message, with: " + getPageMatcherLocation()); return ""; }
Source:
<code>public Map<String, String> getUris(Run run) { <START> if (run.getId() == Run.UNSAVED_ID || runUris.isEmpty()) return Collections.emptyMap(); <END> return runUris.get(run.getPlatformType()) .entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, m -> expandRunUrl(m.getValue(), run))); }</code><technical_language>Add a check for platforms in map; throws NPE</technical_language>

Target:
public Map<String, String> getUris(Run run) { if (run.getId() == Run.UNSAVED_ID || runUris.isEmpty() || runUris.get(run.getPlatformType()) == null) return Collections.emptyMap(); return runUris.get(run.getPlatformType()) .entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, m -> expandRunUrl(m.getValue(), run))); }
Source:
<code>public Integer int32(String name) { Int32Field field = findField(name, Int32Field.class); if (field == null) { return null; } <START> int before = byteBuffer.position(); <END> Integer decoded = (Integer) field.decode(byteBuffer); int after = byteBuffer.position(); currentlyRead += (after - before); return decoded; }</code><technical_language>lines of code - please refactor. a pain modifies currentlyRead means need a base class</technical_language>

Target:
public Integer int32(String name) { Int32Field field = fieldSearcher.nextField(name, Int32Field.class, null, readBuffer); if (field == null) { return null; } return (Integer) field.decode(readBuffer); }
Source:
<code>public KerberosCredentials extract(WebContext context) throws CredentialsException, HttpAction { final String header = context.getRequestHeader(HttpConstants.AUTHORIZATION_HEADER); if (header == null) { <START> throw HttpAction.unauthorizedNegotiate("Kerberos Header not found", context); <END> } if (!(header.startsWith("Negotiate ") || header.startsWith("Kerberos "))) { throw new CredentialsException("Wrong prefix for header: " + HttpConstants.AUTHORIZATION_HEADER); } byte[] base64Token = header.substring(header.indexOf(" ") + 1).getBytes(StandardCharsets.UTF_8); byte[] kerberosTicket = Base64.getDecoder().decode(base64Token); return new KerberosCredentials(kerberosTicket, clientName); }</code><technical_language>Yes, good option</technical_language>

Target:
public KerberosCredentials extract(WebContext context) throws CredentialsException, HttpAction { final String header = context.getRequestHeader(HttpConstants.AUTHORIZATION_HEADER); if (header == null) { return null; } if (!(header.startsWith("Negotiate ") || header.startsWith("Kerberos "))) { return null; } byte[] base64Token = header.substring(header.indexOf(" ") + 1).getBytes(StandardCharsets.UTF_8); byte[] kerberosTicket = Base64.getDecoder().decode(base64Token); return new KerberosCredentials(kerberosTicket, clientName); }
Source:
<code>public void testFindLiveVersionTemplate() throws Exception{ Template template=new Template(); template.setTitle("TEST TEMPLATE VERSIONABLE"); template.setBody("<html><body> I'm mostly empty </body></html>"); <START> template=APILocator.getTemplateAPI().saveTemplate(template, host, user, false); <END> APILocator.getVersionableAPI().setLive(template); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(template.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),template.getTitle()); assertEquals(verAPI.getInode(),template.getInode()); APILocator.getTemplateAPI().delete(template, user, false); }</code><technical_language>above: Template template = new TemplateDataGen().nextPersisted();</technical_language>

Target:
public void testFindLiveVersionTemplate() throws Exception{ Template template = new TemplateDataGen().nextPersisted(); APILocator.getVersionableAPI().setLive(template); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(template.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),template.getTitle()); assertEquals(verAPI.getInode(),template.getInode()); APILocator.getTemplateAPI().delete(template, user, false); }
Source:
<code>public EmailConfiguration(@JsonProperty("to") final String to) { <START> this.to = to; <END> }</code><technical_language>notEmpty check</technical_language>

Target:
public EmailConfiguration(@JsonProperty("to") final String to) { this.to = notEmpty(to, "to"); }
Source:
<code>public Map<String, Integer> getColumnSizes() throws IOException { if (boxStore != null) { return boxStore.getBoxColumnSizes(); } else { <START> throw new IOException("No boxStore available. Check that it has been declared in the Spring config."); <END> } }</code><technical_language>Sacre bleu, is thees? earth mees a sweet succulent RequestManager holdover? <LINK_0></technical_language>

Target:
public Map<String, Integer> getColumnSizes() throws IOException { return boxStore.getBoxColumnSizes(); }
Source:
<code>public FormValidation doCheckDescription(@QueryParameter final String value) { if (Util.fixEmpty(value) == null) { <START> return FormValidation.error("You should provide a description."); <END> } if (CauseManagement.NEW_CAUSE_DESCRIPTION.equalsIgnoreCase(value.trim())) { return FormValidation.error("Bad description."); } return FormValidation.ok(); }</code><technical_language>check Item.Configure</technical_language>

Target:
public FormValidation doCheckDescription(@QueryParameter final String value) { Jenkins.getInstance().checkPermission(PluginImpl.UPDATE_PERMISSION); if (Util.fixEmpty(value) == null) { return FormValidation.error("You should provide a description."); } if (CauseManagement.NEW_CAUSE_DESCRIPTION.equalsIgnoreCase(value.trim())) { return FormValidation.error("Bad description."); } return FormValidation.ok(); }
Source:
<code>private static Scope getDeepestCommonScope(Symbol symbol, Usage declaration) { Set<Usage> usages = new HashSet<>(symbol.usages()); if (!declaration.isWrite()) { usages.remove(declaration); } Map<Scope, Integer> scopeDepthMap = new HashMap<>(); for (Usage usage : usages) { Scope scope = usage.identifierTree().scope(); scopeDepthMap.put(scope, getScopeDepth(scope)); } int minDepth = Collections.min(scopeDepthMap.values()); Set<Scope> scopes = new HashSet<>(); for (Entry<Scope, Integer> entry : scopeDepthMap.entrySet()) { scopes.add(raisedScope(entry.getKey(), entry.getValue() - minDepth)); } while (scopes.size() != 1) { scopes = allScopesRaiseOneLevel(scopes); } <START> return (Scope) scopes.toArray()[0]; <END> }</code><technical_language>@vilchik-elena scopes.iterator().next()</technical_language>

Target:
private static Scope getDeepestCommonScope(Symbol symbol, Usage declaration) { Set<Usage> usages = new HashSet<>(symbol.usages()); if (!declaration.isWrite()) { usages.remove(declaration); } Map<Scope, Integer> scopeDepthMap = new HashMap<>(); for (Usage usage : usages) { Scope scope = usage.identifierTree().scope(); scopeDepthMap.put(scope, getScopeDepth(scope)); } int minDepth = Collections.min(scopeDepthMap.values()); Set<Scope> sameDepthScopes = new HashSet<>(); for (Entry<Scope, Integer> entry : scopeDepthMap.entrySet()) { sameDepthScopes.add(getAncestorScope(entry.getKey(), entry.getValue() - minDepth)); } while (sameDepthScopes.size() != 1) { sameDepthScopes = outerScopes(sameDepthScopes); } return sameDepthScopes.iterator().next(); }
Source:
<code>public List<LegacyStressor> execute() { long startTime = TimeService.currentTimeMillis(); completion = createCompletion(); finishCountDown = new CountDownLatch(1); completion.setCompletionHandler(new Runnable() { @Override public void run() { if (duration > 0) { finished = true; } finishCountDown.countDown(); } }); operationSelector = wrapOperationSelector(createOperationSelector()); List<LegacyStressor> stressors = startStressors(); if (rampUp > 0) { try { Thread.sleep(rampUp); } catch (InterruptedException e) { throw new IllegalStateException("Interrupted during ramp-up.", e); } } while (!isStarted()) { int stressorStartedCount = 0; for (LegacyStressor stressor : stressors) { <START> if (stressor.isStarted()) { <END> stressorStartedCount++; } } started = (stressorStartedCount == stressors.size()); } try { if (timeout > 0) { long waitTime = getWaitTime(startTime); if (waitTime <= 0) { throw new TestTimeoutException(); } else { if (!finishCountDown.await(waitTime, TimeUnit.MILLISECONDS)) { throw new TestTimeoutException(); } } } else { finishCountDown.await(); } } catch (InterruptedException e) { throw new IllegalStateException("Unexpected interruption", e); } for (Thread stressorThread : stressors) { try { if (timeout > 0) { long waitTime = getWaitTime(startTime); if (waitTime <= 0) throw new TestTimeoutException(); stressorThread.join(waitTime); } else { stressorThread.join(); } } catch (InterruptedException e) { throw new TestTimeoutException(e); } } return stressors; }</code><technical_language>Ouch, busy wait? LegacyStressor.started volatile. CountDownLatch? Btw. field is volatile for a purpose, repeatedly read in recoding() set once, result in local field; stage.isStarted() time</technical_language>

Target:
public List<LegacyStressor> execute() { long startTime = TimeService.currentTimeMillis(); completion = createCompletion(); finishCountDown = new CountDownLatch(1); completion.setCompletionHandler(new Runnable() { @Override public void run() { if (duration > 0) { finished = true; } finishCountDown.countDown(); } }); operationSelector = wrapOperationSelector(createOperationSelector()); List<LegacyStressor> stressors = startStressors(); if (rampUp > 0) { try { Thread.sleep(rampUp); } catch (InterruptedException e) { throw new IllegalStateException("Interrupted during ramp-up.", e); } } started = true; try { if (timeout > 0) { long waitTime = getWaitTime(startTime); if (waitTime <= 0) { throw new TestTimeoutException(); } else { if (!finishCountDown.await(waitTime, TimeUnit.MILLISECONDS)) { throw new TestTimeoutException(); } } } else { finishCountDown.await(); } } catch (InterruptedException e) { throw new IllegalStateException("Unexpected interruption", e); } for (Thread stressorThread : stressors) { try { if (timeout > 0) { long waitTime = getWaitTime(startTime); if (waitTime <= 0) throw new TestTimeoutException(); stressorThread.join(waitTime); } else { stressorThread.join(); } } catch (InterruptedException e) { throw new TestTimeoutException(e); } } return stressors; }