You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/09/15 18:33:38 UTC
openmeetings git commit: [OPENMEETINGS-1704] couple more deects are
fixed
Repository: openmeetings
Updated Branches:
refs/heads/master b7e349585 -> 810533e2e
[OPENMEETINGS-1704] couple more deects are fixed
Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/810533e2
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/810533e2
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/810533e2
Branch: refs/heads/master
Commit: 810533e2ef2158ef3e1318188826b2980253ad9e
Parents: b7e3495
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Sat Sep 16 01:33:31 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Sat Sep 16 01:33:31 2017 +0700
----------------------------------------------------------------------
.../core/converter/ImageConverter.java | 2 +-
.../openmeetings/db/dao/label/LabelDao.java | 4 +-
.../db/entity/file/BaseFileItem.java | 16 +-
.../openmeetings/db/util/ApplicationHelper.java | 10 +-
.../openmeetings/util/geom/ArrowStyle.java | 68 ------
.../openmeetings/util/geom/GeomPoint.java | 214 -------------------
.../web/common/tree/DownloadMenuItem.java | 2 +-
.../openmeetings/web/room/wb/WbPanel.java | 4 +-
.../test/derby/StartDerbyNetworkService.java | 26 ---
.../util/AppointmentMessageBodyReader.java | 4 +-
10 files changed, 27 insertions(+), 323 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/ImageConverter.java
----------------------------------------------------------------------
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/ImageConverter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/ImageConverter.java
index 87a3522..c452fe4 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/ImageConverter.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/ImageConverter.java
@@ -196,8 +196,8 @@ public class ImageConverter extends BaseConverter {
f.setCount(0);
} else {
f.setCount(pages.length);
+ list.addItem("get PNG page dimensions", initSize(f, pages[0], PNG_MIME_TYPE));
}
- list.addItem("get PNG page dimensions", initSize(f, pages[0], PNG_MIME_TYPE));
}
return list;
}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/label/LabelDao.java
----------------------------------------------------------------------
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/label/LabelDao.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/label/LabelDao.java
index 18ad071..b2c775f 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/label/LabelDao.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/label/LabelDao.java
@@ -24,6 +24,7 @@ import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
@@ -288,7 +289,8 @@ public class LabelDao implements IDataProviderDao<StringLabel>{
}
}
- private static class LabelComparator implements Comparator<StringLabel> {
+ private static class LabelComparator implements Comparator<StringLabel>, Serializable {
+ private static final long serialVersionUID = 1L;
final SortParam<String> sort;
LabelComparator() {
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/BaseFileItem.java
----------------------------------------------------------------------
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/BaseFileItem.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/BaseFileItem.java
index dd10d2a..a7064a2 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/BaseFileItem.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/BaseFileItem.java
@@ -308,12 +308,16 @@ public abstract class BaseFileItem implements IDataProviderEntity {
f = new File(d, String.format("%s.%s", getHash(), ext == null ? EXTENSION_MP4 : ext));
break;
case Presentation:
- int slide = (ext == null) ? 0 : -1;
- try {
- //ext is used for slide here
- slide = Integer.parseInt(ext);
- } catch (Exception e) {
- //no-op
+ int slide;
+ if (ext == null) {
+ slide = 0;
+ } else {
+ try {
+ //ext is used for slide here
+ slide = Integer.parseInt(ext);
+ } catch (Exception e) {
+ slide = -1;
+ }
}
if (slide > -1) {
f = new File(d, String.format("%1$s-%2$04d.%3$s", DOC_PAGE_PREFIX, slide, EXTENSION_PNG));
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
----------------------------------------------------------------------
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
index a4415bb..da43590 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java
@@ -80,7 +80,7 @@ public class ApplicationHelper {
return ensureApplication(-1L);
}
- public static IApplication _ensureApplication(Long langId) {
+ public static IApplication _ensureApplication() {
IApplication a = null;
if (Application.exists()) {
a = (IApplication)Application.get();
@@ -116,7 +116,7 @@ public class ApplicationHelper {
}
public static IApplication ensureApplication(Long langId) {
- IApplication a = _ensureApplication(langId);
+ IApplication a = _ensureApplication();
if (ThreadContext.getRequestCycle() == null) {
ServletWebRequest req = new ServletWebRequest(new MockHttpServletRequest((Application)a, new MockHttpSession(a.getServletContext()), a.getServletContext()), "");
RequestCycleContext rctx = new RequestCycleContext(req, new MockWebResponse(), a.getRootRequestMapper(), a.getExceptionMapperProvider().get());
@@ -133,9 +133,11 @@ public class ApplicationHelper {
public static void destroyApplication() {
WebApplication app = (WebApplication)Application.get(wicketApplicationName);
- app.internalDestroy(); //need to be called to
WebApplicationContext ctx = getWebApplicationContext(app.getServletContext());
- ((XmlWebApplicationContext)ctx).destroy();
+ app.internalDestroy(); //need to be called to
+ if (ctx != null) {
+ ((XmlWebApplicationContext)ctx).destroy();
+ }
ThreadContext.setApplication(null);
ThreadContext.setRequestCycle(null);
ThreadContext.setSession(null);
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-util/src/main/java/org/apache/openmeetings/util/geom/ArrowStyle.java
----------------------------------------------------------------------
diff --git a/openmeetings-util/src/main/java/org/apache/openmeetings/util/geom/ArrowStyle.java b/openmeetings-util/src/main/java/org/apache/openmeetings/util/geom/ArrowStyle.java
deleted file mode 100644
index 5fa3164..0000000
--- a/openmeetings-util/src/main/java/org/apache/openmeetings/util/geom/ArrowStyle.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.util.geom;
-
-public class ArrowStyle {
-
- public double headWidth=-1; //Relative width of arrow head
-
- /**
- *
- * Not used in drawArrowHead because the length is
- * determined by the points passed in
- *
- */
- public double headLength=10; //Pixel Length of arrow head
-
-
- public double shaftThickness=2;
- public float shaftPosition=0;
-
- /**
- * Not used in drawArrow, only drawArrowHead
- * This let's you curve the line at the base of the arrow
- */
- public double shaftControlPosition=.5;
- /**
- * Not used in drawArrow, only drawArrowHead
- * This let's you curve the line at the base of the arrow
- */
- public double shaftControlSize=.5;
-
-
- public double edgeControlPosition=.5;
- public double edgeControlSize=.5;
-
-
- public ArrowStyle(double edgeControlPosition, double edgeControlSize,
- double headLength, double headWidth, double shaftControlPosition,
- double shaftControlSize, float shaftPosition, double shaftThickness) {
- super();
- this.edgeControlPosition = edgeControlPosition;
- this.edgeControlSize = edgeControlSize;
- this.headLength = headLength;
- this.headWidth = headWidth;
- this.shaftControlPosition = shaftControlPosition;
- this.shaftControlSize = shaftControlSize;
- this.shaftPosition = shaftPosition;
- this.shaftThickness = shaftThickness;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-util/src/main/java/org/apache/openmeetings/util/geom/GeomPoint.java
----------------------------------------------------------------------
diff --git a/openmeetings-util/src/main/java/org/apache/openmeetings/util/geom/GeomPoint.java b/openmeetings-util/src/main/java/org/apache/openmeetings/util/geom/GeomPoint.java
deleted file mode 100644
index 74dd3b7..0000000
--- a/openmeetings-util/src/main/java/org/apache/openmeetings/util/geom/GeomPoint.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.util.geom;
-
-import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
-
-import java.awt.Point;
-
-import org.red5.logging.Red5LoggerFactory;
-import org.slf4j.Logger;
-
-/**
- *
- * Java Implementation of the Actionscript Class flash.geom.Point
- *
- * @author swagner
- *
- */
-
-public class GeomPoint extends Point {
- private static final long serialVersionUID = 1L;
- @SuppressWarnings("unused")
- private static final Logger log = Red5LoggerFactory.getLogger(GeomPoint.class, webAppRootKey);
-
- public GeomPoint add(GeomPoint p) {
- GeomPoint gPoint = new GeomPoint();
- gPoint.setLocation(this.getX() + p.getX(),this.getY() + p.getY());
- return gPoint;
- }
-
- public GeomPoint subtract(GeomPoint p) {
- GeomPoint gPoint = new GeomPoint();
- gPoint.setLocation(this.getX() - p.getX(),this.getY() - p.getY());
- return gPoint;
- }
-
- @Override
- public GeomPoint clone() {
- GeomPoint p = new GeomPoint();
- p.setLocation(this.getX(), this.getY());
- return p;
- }
-
- public static GeomPoint interpolate(GeomPoint p1, GeomPoint p2, float f) {
-
- if (f == 0) {
- GeomPoint p = new GeomPoint();
- p.setLocation(p2.getX(), p2.getY());
- return p;
- } else if (f == 1) {
- GeomPoint p = new GeomPoint();
- p.setLocation(p1.getX(), p1.getY());
- return p;
- }
-
- double returnValueP1 = linearInterpolation(p1.getX(),p2.getX(),f);
- double returnValueP2 = linearInterpolation(p1.getY(),p2.getY(),f);
-
- GeomPoint p = new GeomPoint();
- p.setLocation(returnValueP1, returnValueP2);
- return p;
- }
-
- public double length() {
- return Math.sqrt( this.getX()*this.getX() + this.getY()*this.getY() );
- }
-
- @Override
- public String toString() {
- return getClass().getName() + "[x=" + this.getX() + ",y=" + this.getY() + "]";
- }
-
- public void normalize(double newLength) {
-
- //Function for Line y = mx + 0
- //given points 0,0 and this.getX(),this.getY();
- // 0 = m*0 + c
- // m = -c;
- //
- // this.getY() = m*this.getX();
-
- double m;
- if (this.getX() == 0) {
- //log.debug("Case 1");
- if (this.getY() < 0) {
- this.setLocation(0, newLength * -1);
- } else {
- this.setLocation(0, newLength);
- }
- return;
- //m = this.getY();
- } else {
- m = this.getY() / this.getX();
- //log.debug("Case 2");
- }
-
- //log.debug("m :"+m +" newLength "+newLength);
-
- //Circle (x-x0)^2 + (y-y0)^2 = r^2
- // anyY = m * anyX;
- // newLength * newLength = anyY * anyY + anyX * anyX;
- //
- // newLength * newLength = (m * anyX) * (m * anyX) + anyX * anyX;
- //
- // newLength * newLength = m * m * anyX * anyX + anyX * anyX;
- // newLength * newLength = ( m*m + 1 ) * anyX * anyX;
- //
- // newLength * newLength / ( m*m + 1 ) = anyX * anyX;
-
- double anyX = Math.sqrt( ( newLength * newLength ) / ( m*m + 1 ) );
- double anyY = m * anyX;
-
- //log.debug("anyX :"+anyX + " anyY: " + anyY);
-
- //translate to Flash point of origin
- if (this.getX() < 0) {
- anyX *= -1;
- anyY *= -1;
- }
-
- //log.debug("anyX :"+anyX + " anyY: " + anyY);
- this.setLocation(anyX, anyY);
-
- }
-
- /**
- * Interpolate one number
- * @param a
- * @param b
- * @param t
- * @return
- */
- public static double linearInterpolation(double a, double b, float t) {
- return a + t * (b - a);
- }
-
-
- public static GeomPoint getLineIntersection ( GeomPoint a1,GeomPoint a2,
- GeomPoint b1,GeomPoint b2) {
-
- //log.debug("b1: "+b1);
- //log.debug("b2: "+b2);
-
- double x,y,m1,m2;
-
- if ((a2.getX()-a1.getX()) == 0) {
-
- //log.debug("k1 ^ 0");
-
- double k2 = (b2.getY()-b1.getY()) / (b2.getX()-b1.getX());
- //log.debug("k2: "+k2);
- //log.debug("b1.getY(): "+b1.getY());
- //log.debug("b2.getY(): "+b2.getY());
- // an infinite directional constant means the line is vertical
- // so the intersection must be at the x coordinate of the line
- x = a1.getX();
- m2 = b1.getY() - k2 * b1.getX();
- //log.debug("m2: "+m2);
- y = k2 * x + m2;
- //log.debug("y: "+y);
-
- } else if((b2.getX()-b1.getX()) == 0) {
-
- //log.debug("k2 ^^ 0");
-
- double k1 = (a2.getY()-a1.getY()) / (a2.getX()-a1.getX());
- // same as above for line 2
- m1 = a1.getY() - k1 * a1.getX();
- x = b1.getX();
- y = k1 * x + m1;
-
- } else {
-
- //calculate directional constants
- double k1 = (a2.getY()-a1.getY()) / (a2.getX()-a1.getX());
- double k2 = (b2.getY()-b1.getY()) / (b2.getX()-b1.getX());
-
- // if the directional constants are equal, the lines are parallel,
- // meaning there is no intersection point.
- if (java.lang.Double.compare(k1, k2) == 0) return null;
-
- //log.debug("neither");
-// log.debug("k1: "+k1);
-// log.debug("k2: "+k2);
-
- m1 = a1.getY() - k1 * a1.getX();
- m2 = b1.getY() - k2 * b1.getX();
- x = (m1-m2) / (k2-k1);
- y = k1 * x + m1;
- }
-
-
- GeomPoint gPoint = new GeomPoint();
- gPoint.setLocation(x, y);
-
- return gPoint;
- }
-}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/DownloadMenuItem.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/DownloadMenuItem.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/DownloadMenuItem.java
index 799800e..f21d9fe 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/DownloadMenuItem.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/DownloadMenuItem.java
@@ -61,7 +61,7 @@ public class DownloadMenuItem extends MenuItem {
if (f != null && f.exists()) {
if (ext == null && (Type.Image == fi.getType() || Type.Presentation == fi.getType())) {
File[] ff = f.getParentFile().listFiles(new OriginalFilter(fi));
- if (ff.length > 0) {
+ if (ff != null && ff.length > 0) {
f = ff[0];
}
}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
index 36a002d..23f807e 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
@@ -465,7 +465,9 @@ public class WbPanel extends AbstractWbPanel {
private void clearAll(Long roomId, long wbId) {
Whiteboard wb = WhiteboardCache.get(roomId).get(wbId);
-
+ if (wb == null) {
+ return;
+ }
JSONArray arr = getArray(wb.toJson(), null);
if (arr.length() != 0) {
addUndo(wb.getId(), new UndoObject(UndoObject.Type.remove, arr));
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-web/src/test/java/org/apache/openmeetings/test/derby/StartDerbyNetworkService.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/derby/StartDerbyNetworkService.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/derby/StartDerbyNetworkService.java
deleted file mode 100644
index 5bd4030..0000000
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/derby/StartDerbyNetworkService.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.test.derby;
-
-import org.apache.derby.drda.NetworkServerControl;
-
-public class StartDerbyNetworkService {
-
- protected NetworkServerControl server;
-}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/810533e2/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentMessageBodyReader.java
----------------------------------------------------------------------
diff --git a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentMessageBodyReader.java b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentMessageBodyReader.java
index 0aa29f9..0d90f56 100644
--- a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentMessageBodyReader.java
+++ b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentMessageBodyReader.java
@@ -18,6 +18,8 @@
*/
package org.apache.openmeetings.webservice.util;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -47,7 +49,7 @@ public class AppointmentMessageBodyReader implements MessageBodyReader<Appointme
MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
throws IOException, WebApplicationException
{
- BufferedReader br = new BufferedReader(new InputStreamReader(entityStream));
+ BufferedReader br = new BufferedReader(new InputStreamReader(entityStream, UTF_8));
String line = null;
StringBuilder sb = new StringBuilder();
while ((line = br.readLine()) != null) {